##// END OF EJS Templates
Proper fix for tab-completion bug reported by Alex Schmolck; patch by Dan Milstein
fperez -
Show More
@@ -1,2566 +1,2569 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.3 or newer.
5 Requires Python 2.3 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2126 2007-03-02 06:51:02Z fperez $
9 $Id: iplib.py 2135 2007-03-10 09:26:25Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pydoc
50 import pydoc
51 import re
51 import re
52 import shutil
52 import shutil
53 import string
53 import string
54 import sys
54 import sys
55 import tempfile
55 import tempfile
56 import traceback
56 import traceback
57 import types
57 import types
58 import pickleshare
58 import pickleshare
59 from sets import Set
59 from sets import Set
60 from pprint import pprint, pformat
60 from pprint import pprint, pformat
61
61
62 # IPython's own modules
62 # IPython's own modules
63 import IPython
63 import IPython
64 from IPython import OInspect,PyColorize,ultraTB
64 from IPython import OInspect,PyColorize,ultraTB
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.FakeModule import FakeModule
66 from IPython.FakeModule import FakeModule
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Logger import Logger
68 from IPython.Logger import Logger
69 from IPython.Magic import Magic
69 from IPython.Magic import Magic
70 from IPython.Prompts import CachedOutput
70 from IPython.Prompts import CachedOutput
71 from IPython.ipstruct import Struct
71 from IPython.ipstruct import Struct
72 from IPython.background_jobs import BackgroundJobManager
72 from IPython.background_jobs import BackgroundJobManager
73 from IPython.usage import cmd_line_usage,interactive_usage
73 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.genutils import *
74 from IPython.genutils import *
75 from IPython.strdispatch import StrDispatch
75 from IPython.strdispatch import StrDispatch
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class Quitter(object):
129 class Quitter(object):
130 """Simple class to handle exit, similar to Python 2.5's.
130 """Simple class to handle exit, similar to Python 2.5's.
131
131
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
133 doesn't do (obviously, since it doesn't know about ipython)."""
133 doesn't do (obviously, since it doesn't know about ipython)."""
134
134
135 def __init__(self,shell,name):
135 def __init__(self,shell,name):
136 self.shell = shell
136 self.shell = shell
137 self.name = name
137 self.name = name
138
138
139 def __repr__(self):
139 def __repr__(self):
140 return 'Type %s() to exit.' % self.name
140 return 'Type %s() to exit.' % self.name
141 __str__ = __repr__
141 __str__ = __repr__
142
142
143 def __call__(self):
143 def __call__(self):
144 self.shell.exit()
144 self.shell.exit()
145
145
146 class InputList(list):
146 class InputList(list):
147 """Class to store user input.
147 """Class to store user input.
148
148
149 It's basically a list, but slices return a string instead of a list, thus
149 It's basically a list, but slices return a string instead of a list, thus
150 allowing things like (assuming 'In' is an instance):
150 allowing things like (assuming 'In' is an instance):
151
151
152 exec In[4:7]
152 exec In[4:7]
153
153
154 or
154 or
155
155
156 exec In[5:9] + In[14] + In[21:25]"""
156 exec In[5:9] + In[14] + In[21:25]"""
157
157
158 def __getslice__(self,i,j):
158 def __getslice__(self,i,j):
159 return ''.join(list.__getslice__(self,i,j))
159 return ''.join(list.__getslice__(self,i,j))
160
160
161 class SyntaxTB(ultraTB.ListTB):
161 class SyntaxTB(ultraTB.ListTB):
162 """Extension which holds some state: the last exception value"""
162 """Extension which holds some state: the last exception value"""
163
163
164 def __init__(self,color_scheme = 'NoColor'):
164 def __init__(self,color_scheme = 'NoColor'):
165 ultraTB.ListTB.__init__(self,color_scheme)
165 ultraTB.ListTB.__init__(self,color_scheme)
166 self.last_syntax_error = None
166 self.last_syntax_error = None
167
167
168 def __call__(self, etype, value, elist):
168 def __call__(self, etype, value, elist):
169 self.last_syntax_error = value
169 self.last_syntax_error = value
170 ultraTB.ListTB.__call__(self,etype,value,elist)
170 ultraTB.ListTB.__call__(self,etype,value,elist)
171
171
172 def clear_err_state(self):
172 def clear_err_state(self):
173 """Return the current error state and clear it"""
173 """Return the current error state and clear it"""
174 e = self.last_syntax_error
174 e = self.last_syntax_error
175 self.last_syntax_error = None
175 self.last_syntax_error = None
176 return e
176 return e
177
177
178 #****************************************************************************
178 #****************************************************************************
179 # Main IPython class
179 # Main IPython class
180
180
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
182 # until a full rewrite is made. I've cleaned all cross-class uses of
182 # until a full rewrite is made. I've cleaned all cross-class uses of
183 # attributes and methods, but too much user code out there relies on the
183 # attributes and methods, but too much user code out there relies on the
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
185 #
185 #
186 # But at least now, all the pieces have been separated and we could, in
186 # But at least now, all the pieces have been separated and we could, in
187 # principle, stop using the mixin. This will ease the transition to the
187 # principle, stop using the mixin. This will ease the transition to the
188 # chainsaw branch.
188 # chainsaw branch.
189
189
190 # For reference, the following is the list of 'self.foo' uses in the Magic
190 # For reference, the following is the list of 'self.foo' uses in the Magic
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
192 # class, to prevent clashes.
192 # class, to prevent clashes.
193
193
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 # 'self.value']
197 # 'self.value']
198
198
199 class InteractiveShell(object,Magic):
199 class InteractiveShell(object,Magic):
200 """An enhanced console for Python."""
200 """An enhanced console for Python."""
201
201
202 # class attribute to indicate whether the class supports threads or not.
202 # class attribute to indicate whether the class supports threads or not.
203 # Subclasses with thread support should override this as needed.
203 # Subclasses with thread support should override this as needed.
204 isthreaded = False
204 isthreaded = False
205
205
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
207 user_ns = None,user_global_ns=None,banner2='',
207 user_ns = None,user_global_ns=None,banner2='',
208 custom_exceptions=((),None),embedded=False):
208 custom_exceptions=((),None),embedded=False):
209
209
210 # log system
210 # log system
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212
212
213 # some minimal strict typechecks. For some core data structures, I
213 # some minimal strict typechecks. For some core data structures, I
214 # want actual basic python types, not just anything that looks like
214 # want actual basic python types, not just anything that looks like
215 # one. This is especially true for namespaces.
215 # one. This is especially true for namespaces.
216 for ns in (user_ns,user_global_ns):
216 for ns in (user_ns,user_global_ns):
217 if ns is not None and type(ns) != types.DictType:
217 if ns is not None and type(ns) != types.DictType:
218 raise TypeError,'namespace must be a dictionary'
218 raise TypeError,'namespace must be a dictionary'
219
219
220 # Job manager (for jobs run as background threads)
220 # Job manager (for jobs run as background threads)
221 self.jobs = BackgroundJobManager()
221 self.jobs = BackgroundJobManager()
222
222
223 # Store the actual shell's name
223 # Store the actual shell's name
224 self.name = name
224 self.name = name
225
225
226 # We need to know whether the instance is meant for embedding, since
226 # We need to know whether the instance is meant for embedding, since
227 # global/local namespaces need to be handled differently in that case
227 # global/local namespaces need to be handled differently in that case
228 self.embedded = embedded
228 self.embedded = embedded
229
229
230 # command compiler
230 # command compiler
231 self.compile = codeop.CommandCompiler()
231 self.compile = codeop.CommandCompiler()
232
232
233 # User input buffer
233 # User input buffer
234 self.buffer = []
234 self.buffer = []
235
235
236 # Default name given in compilation of code
236 # Default name given in compilation of code
237 self.filename = '<ipython console>'
237 self.filename = '<ipython console>'
238
238
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
241 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.exit = Quitter(self,'exit')
242 __builtin__.quit = Quitter(self,'quit')
242 __builtin__.quit = Quitter(self,'quit')
243
243
244 # Make an empty namespace, which extension writers can rely on both
244 # Make an empty namespace, which extension writers can rely on both
245 # existing and NEVER being used by ipython itself. This gives them a
245 # existing and NEVER being used by ipython itself. This gives them a
246 # convenient location for storing additional information and state
246 # convenient location for storing additional information and state
247 # their extensions may require, without fear of collisions with other
247 # their extensions may require, without fear of collisions with other
248 # ipython names that may develop later.
248 # ipython names that may develop later.
249 self.meta = Struct()
249 self.meta = Struct()
250
250
251 # Create the namespace where the user will operate. user_ns is
251 # Create the namespace where the user will operate. user_ns is
252 # normally the only one used, and it is passed to the exec calls as
252 # normally the only one used, and it is passed to the exec calls as
253 # the locals argument. But we do carry a user_global_ns namespace
253 # the locals argument. But we do carry a user_global_ns namespace
254 # given as the exec 'globals' argument, This is useful in embedding
254 # given as the exec 'globals' argument, This is useful in embedding
255 # situations where the ipython shell opens in a context where the
255 # situations where the ipython shell opens in a context where the
256 # distinction between locals and globals is meaningful.
256 # distinction between locals and globals is meaningful.
257
257
258 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # FIXME. For some strange reason, __builtins__ is showing up at user
259 # level as a dict instead of a module. This is a manual fix, but I
259 # level as a dict instead of a module. This is a manual fix, but I
260 # should really track down where the problem is coming from. Alex
260 # should really track down where the problem is coming from. Alex
261 # Schmolck reported this problem first.
261 # Schmolck reported this problem first.
262
262
263 # A useful post by Alex Martelli on this topic:
263 # A useful post by Alex Martelli on this topic:
264 # Re: inconsistent value from __builtins__
264 # Re: inconsistent value from __builtins__
265 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Von: Alex Martelli <aleaxit@yahoo.com>
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 # Gruppen: comp.lang.python
267 # Gruppen: comp.lang.python
268
268
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 # > <type 'dict'>
271 # > <type 'dict'>
272 # > >>> print type(__builtins__)
272 # > >>> print type(__builtins__)
273 # > <type 'module'>
273 # > <type 'module'>
274 # > Is this difference in return value intentional?
274 # > Is this difference in return value intentional?
275
275
276 # Well, it's documented that '__builtins__' can be either a dictionary
276 # Well, it's documented that '__builtins__' can be either a dictionary
277 # or a module, and it's been that way for a long time. Whether it's
277 # or a module, and it's been that way for a long time. Whether it's
278 # intentional (or sensible), I don't know. In any case, the idea is
278 # intentional (or sensible), I don't know. In any case, the idea is
279 # that if you need to access the built-in namespace directly, you
279 # that if you need to access the built-in namespace directly, you
280 # should start with "import __builtin__" (note, no 's') which will
280 # should start with "import __builtin__" (note, no 's') which will
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282
282
283 # These routines return properly built dicts as needed by the rest of
283 # These routines return properly built dicts as needed by the rest of
284 # the code, and can also be used by extension writers to generate
284 # the code, and can also be used by extension writers to generate
285 # properly initialized namespaces.
285 # properly initialized namespaces.
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
288
288
289 # Assign namespaces
289 # Assign namespaces
290 # This is the namespace where all normal user variables live
290 # This is the namespace where all normal user variables live
291 self.user_ns = user_ns
291 self.user_ns = user_ns
292 # Embedded instances require a separate namespace for globals.
292 # Embedded instances require a separate namespace for globals.
293 # Normally this one is unused by non-embedded instances.
293 # Normally this one is unused by non-embedded instances.
294 self.user_global_ns = user_global_ns
294 self.user_global_ns = user_global_ns
295 # A namespace to keep track of internal data structures to prevent
295 # A namespace to keep track of internal data structures to prevent
296 # them from cluttering user-visible stuff. Will be updated later
296 # them from cluttering user-visible stuff. Will be updated later
297 self.internal_ns = {}
297 self.internal_ns = {}
298
298
299 # Namespace of system aliases. Each entry in the alias
299 # Namespace of system aliases. Each entry in the alias
300 # table must be a 2-tuple of the form (N,name), where N is the number
300 # table must be a 2-tuple of the form (N,name), where N is the number
301 # of positional arguments of the alias.
301 # of positional arguments of the alias.
302 self.alias_table = {}
302 self.alias_table = {}
303
303
304 # A table holding all the namespaces IPython deals with, so that
304 # A table holding all the namespaces IPython deals with, so that
305 # introspection facilities can search easily.
305 # introspection facilities can search easily.
306 self.ns_table = {'user':user_ns,
306 self.ns_table = {'user':user_ns,
307 'user_global':user_global_ns,
307 'user_global':user_global_ns,
308 'alias':self.alias_table,
308 'alias':self.alias_table,
309 'internal':self.internal_ns,
309 'internal':self.internal_ns,
310 'builtin':__builtin__.__dict__
310 'builtin':__builtin__.__dict__
311 }
311 }
312
312
313 # The user namespace MUST have a pointer to the shell itself.
313 # The user namespace MUST have a pointer to the shell itself.
314 self.user_ns[name] = self
314 self.user_ns[name] = self
315
315
316 # We need to insert into sys.modules something that looks like a
316 # We need to insert into sys.modules something that looks like a
317 # module but which accesses the IPython namespace, for shelve and
317 # module but which accesses the IPython namespace, for shelve and
318 # pickle to work interactively. Normally they rely on getting
318 # pickle to work interactively. Normally they rely on getting
319 # everything out of __main__, but for embedding purposes each IPython
319 # everything out of __main__, but for embedding purposes each IPython
320 # instance has its own private namespace, so we can't go shoving
320 # instance has its own private namespace, so we can't go shoving
321 # everything into __main__.
321 # everything into __main__.
322
322
323 # note, however, that we should only do this for non-embedded
323 # note, however, that we should only do this for non-embedded
324 # ipythons, which really mimic the __main__.__dict__ with their own
324 # ipythons, which really mimic the __main__.__dict__ with their own
325 # namespace. Embedded instances, on the other hand, should not do
325 # namespace. Embedded instances, on the other hand, should not do
326 # this because they need to manage the user local/global namespaces
326 # this because they need to manage the user local/global namespaces
327 # only, but they live within a 'normal' __main__ (meaning, they
327 # only, but they live within a 'normal' __main__ (meaning, they
328 # shouldn't overtake the execution environment of the script they're
328 # shouldn't overtake the execution environment of the script they're
329 # embedded in).
329 # embedded in).
330
330
331 if not embedded:
331 if not embedded:
332 try:
332 try:
333 main_name = self.user_ns['__name__']
333 main_name = self.user_ns['__name__']
334 except KeyError:
334 except KeyError:
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 else:
336 else:
337 #print "pickle hack in place" # dbg
337 #print "pickle hack in place" # dbg
338 #print 'main_name:',main_name # dbg
338 #print 'main_name:',main_name # dbg
339 sys.modules[main_name] = FakeModule(self.user_ns)
339 sys.modules[main_name] = FakeModule(self.user_ns)
340
340
341 # List of input with multi-line handling.
341 # List of input with multi-line handling.
342 # Fill its zero entry, user counter starts at 1
342 # Fill its zero entry, user counter starts at 1
343 self.input_hist = InputList(['\n'])
343 self.input_hist = InputList(['\n'])
344 # This one will hold the 'raw' input history, without any
344 # This one will hold the 'raw' input history, without any
345 # pre-processing. This will allow users to retrieve the input just as
345 # pre-processing. This will allow users to retrieve the input just as
346 # it was exactly typed in by the user, with %hist -r.
346 # it was exactly typed in by the user, with %hist -r.
347 self.input_hist_raw = InputList(['\n'])
347 self.input_hist_raw = InputList(['\n'])
348
348
349 # list of visited directories
349 # list of visited directories
350 try:
350 try:
351 self.dir_hist = [os.getcwd()]
351 self.dir_hist = [os.getcwd()]
352 except IOError, e:
352 except IOError, e:
353 self.dir_hist = []
353 self.dir_hist = []
354
354
355 # dict of output history
355 # dict of output history
356 self.output_hist = {}
356 self.output_hist = {}
357
357
358 # dict of things NOT to alias (keywords, builtins and some magics)
358 # dict of things NOT to alias (keywords, builtins and some magics)
359 no_alias = {}
359 no_alias = {}
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 for key in keyword.kwlist + no_alias_magics:
361 for key in keyword.kwlist + no_alias_magics:
362 no_alias[key] = 1
362 no_alias[key] = 1
363 no_alias.update(__builtin__.__dict__)
363 no_alias.update(__builtin__.__dict__)
364 self.no_alias = no_alias
364 self.no_alias = no_alias
365
365
366 # make global variables for user access to these
366 # make global variables for user access to these
367 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_ih'] = self.input_hist
368 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_oh'] = self.output_hist
369 self.user_ns['_dh'] = self.dir_hist
369 self.user_ns['_dh'] = self.dir_hist
370
370
371 # user aliases to input and output histories
371 # user aliases to input and output histories
372 self.user_ns['In'] = self.input_hist
372 self.user_ns['In'] = self.input_hist
373 self.user_ns['Out'] = self.output_hist
373 self.user_ns['Out'] = self.output_hist
374
374
375 # Object variable to store code object waiting execution. This is
375 # Object variable to store code object waiting execution. This is
376 # used mainly by the multithreaded shells, but it can come in handy in
376 # used mainly by the multithreaded shells, but it can come in handy in
377 # other situations. No need to use a Queue here, since it's a single
377 # other situations. No need to use a Queue here, since it's a single
378 # item which gets cleared once run.
378 # item which gets cleared once run.
379 self.code_to_run = None
379 self.code_to_run = None
380
380
381 # escapes for automatic behavior on the command line
381 # escapes for automatic behavior on the command line
382 self.ESC_SHELL = '!'
382 self.ESC_SHELL = '!'
383 self.ESC_HELP = '?'
383 self.ESC_HELP = '?'
384 self.ESC_MAGIC = '%'
384 self.ESC_MAGIC = '%'
385 self.ESC_QUOTE = ','
385 self.ESC_QUOTE = ','
386 self.ESC_QUOTE2 = ';'
386 self.ESC_QUOTE2 = ';'
387 self.ESC_PAREN = '/'
387 self.ESC_PAREN = '/'
388
388
389 # And their associated handlers
389 # And their associated handlers
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
393 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_MAGIC : self.handle_magic,
394 self.ESC_HELP : self.handle_help,
394 self.ESC_HELP : self.handle_help,
395 self.ESC_SHELL : self.handle_shell_escape,
395 self.ESC_SHELL : self.handle_shell_escape,
396 }
396 }
397
397
398 # class initializations
398 # class initializations
399 Magic.__init__(self,self)
399 Magic.__init__(self,self)
400
400
401 # Python source parser/formatter for syntax highlighting
401 # Python source parser/formatter for syntax highlighting
402 pyformat = PyColorize.Parser().format
402 pyformat = PyColorize.Parser().format
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404
404
405 # hooks holds pointers used for user-side customizations
405 # hooks holds pointers used for user-side customizations
406 self.hooks = Struct()
406 self.hooks = Struct()
407
407
408 self.strdispatchers = {}
408 self.strdispatchers = {}
409
409
410 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
411 hooks = IPython.hooks
411 hooks = IPython.hooks
412 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 #print "bound hook",hook_name
415 #print "bound hook",hook_name
416
416
417 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
418 self.exit_now = False
418 self.exit_now = False
419
419
420 self.usage_min = """\
420 self.usage_min = """\
421 An enhanced console for Python.
421 An enhanced console for Python.
422 Some of its features are:
422 Some of its features are:
423 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
424 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
425 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
426 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 """
430 """
431 if usage: self.usage = usage
431 if usage: self.usage = usage
432 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
433
433
434 # Storage
434 # Storage
435 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
436 self.pager = 'less'
436 self.pager = 'less'
437 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
438 self.tempfiles = []
438 self.tempfiles = []
439
439
440 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
441 self.has_readline = False
441 self.has_readline = False
442
442
443 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
444 # logstart method.
444 # logstart method.
445 self.loghead_tpl = \
445 self.loghead_tpl = \
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 #log# opts = %s
448 #log# opts = %s
449 #log# args = %s
449 #log# args = %s
450 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
451 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
452 """
452 """
453 # for pushd/popd management
453 # for pushd/popd management
454 try:
454 try:
455 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
456 except HomeDirError,msg:
456 except HomeDirError,msg:
457 fatal(msg)
457 fatal(msg)
458
458
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460
460
461 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
462
462
463 # The first is similar to os.system, but it doesn't return a value,
463 # The first is similar to os.system, but it doesn't return a value,
464 # and it allows interpolation of variables in the user's namespace.
464 # and it allows interpolation of variables in the user's namespace.
465 self.system = lambda cmd: \
465 self.system = lambda cmd: \
466 shell(self.var_expand(cmd,depth=2),
466 shell(self.var_expand(cmd,depth=2),
467 header=self.rc.system_header,
467 header=self.rc.system_header,
468 verbose=self.rc.system_verbose)
468 verbose=self.rc.system_verbose)
469
469
470 # These are for getoutput and getoutputerror:
470 # These are for getoutput and getoutputerror:
471 self.getoutput = lambda cmd: \
471 self.getoutput = lambda cmd: \
472 getoutput(self.var_expand(cmd,depth=2),
472 getoutput(self.var_expand(cmd,depth=2),
473 header=self.rc.system_header,
473 header=self.rc.system_header,
474 verbose=self.rc.system_verbose)
474 verbose=self.rc.system_verbose)
475
475
476 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
477 getoutputerror(self.var_expand(cmd,depth=2),
477 getoutputerror(self.var_expand(cmd,depth=2),
478 header=self.rc.system_header,
478 header=self.rc.system_header,
479 verbose=self.rc.system_verbose)
479 verbose=self.rc.system_verbose)
480
480
481 # RegExp for splitting line contents into pre-char//first
481 # RegExp for splitting line contents into pre-char//first
482 # word-method//rest. For clarity, each group in on one line.
482 # word-method//rest. For clarity, each group in on one line.
483
483
484 # WARNING: update the regexp if the above escapes are changed, as they
484 # WARNING: update the regexp if the above escapes are changed, as they
485 # are hardwired in.
485 # are hardwired in.
486
486
487 # Don't get carried away with trying to make the autocalling catch too
487 # Don't get carried away with trying to make the autocalling catch too
488 # much: it's better to be conservative rather than to trigger hidden
488 # much: it's better to be conservative rather than to trigger hidden
489 # evals() somewhere and end up causing side effects.
489 # evals() somewhere and end up causing side effects.
490
490 self.line_split = re.compile(r'^(\s*[,;/]?\s*)'
491 self.line_split = re.compile(r'^([\s*,;/])'
492 r'([\?\w\.]+\w*\s*)'
491 r'([\?\w\.]+\w*\s*)'
493 r'(\(?.*$)')
492 r'(\(?.*$)')
494
493
495 # A simpler regexp used as a fallback if the above doesn't work. This
494 # A simpler regexp used as a fallback if the above doesn't work. This
496 # one is more conservative in how it partitions the input. This code
495 # one is more conservative in how it partitions the input. This code
497 # can probably be cleaned up to do everything with just one regexp, but
496 # can probably be cleaned up to do everything with just one regexp, but
498 # I'm afraid of breaking something; do it once the unit tests are in
497 # I'm afraid of breaking something; do it once the unit tests are in
499 # place.
498 # place.
500 self.line_split_fallback = re.compile(r'^(\s*)'
499 self.line_split_fallback = re.compile(r'^(\s*)'
501 r'([%\!\?\w\.]*)'
500 r'([%\!\?\w\.]*)'
502 r'(.*)')
501 r'(.*)')
503
502
504 # Original re, keep around for a while in case changes break something
503 # Original re, keep around for a while in case changes break something
505 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
504 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
506 # r'(\s*[\?\w\.]+\w*\s*)'
505 # r'(\s*[\?\w\.]+\w*\s*)'
507 # r'(\(?.*$)')
506 # r'(\(?.*$)')
508
507
509 # RegExp to identify potential function names
508 # RegExp to identify potential function names
510 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
509 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
511
510
512 # RegExp to exclude strings with this start from autocalling. In
511 # RegExp to exclude strings with this start from autocalling. In
513 # particular, all binary operators should be excluded, so that if foo
512 # particular, all binary operators should be excluded, so that if foo
514 # is callable, foo OP bar doesn't become foo(OP bar), which is
513 # is callable, foo OP bar doesn't become foo(OP bar), which is
515 # invalid. The characters '!=()' don't need to be checked for, as the
514 # invalid. The characters '!=()' don't need to be checked for, as the
516 # _prefilter routine explicitely does so, to catch direct calls and
515 # _prefilter routine explicitely does so, to catch direct calls and
517 # rebindings of existing names.
516 # rebindings of existing names.
518
517
519 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
518 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
520 # it affects the rest of the group in square brackets.
519 # it affects the rest of the group in square brackets.
521 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
520 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
522 '|^is |^not |^in |^and |^or ')
521 '|^is |^not |^in |^and |^or ')
523
522
524 # try to catch also methods for stuff in lists/tuples/dicts: off
523 # try to catch also methods for stuff in lists/tuples/dicts: off
525 # (experimental). For this to work, the line_split regexp would need
524 # (experimental). For this to work, the line_split regexp would need
526 # to be modified so it wouldn't break things at '['. That line is
525 # to be modified so it wouldn't break things at '['. That line is
527 # nasty enough that I shouldn't change it until I can test it _well_.
526 # nasty enough that I shouldn't change it until I can test it _well_.
528 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
527 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
529
528
530 # keep track of where we started running (mainly for crash post-mortem)
529 # keep track of where we started running (mainly for crash post-mortem)
531 self.starting_dir = os.getcwd()
530 self.starting_dir = os.getcwd()
532
531
533 # Various switches which can be set
532 # Various switches which can be set
534 self.CACHELENGTH = 5000 # this is cheap, it's just text
533 self.CACHELENGTH = 5000 # this is cheap, it's just text
535 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
534 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
536 self.banner2 = banner2
535 self.banner2 = banner2
537
536
538 # TraceBack handlers:
537 # TraceBack handlers:
539
538
540 # Syntax error handler.
539 # Syntax error handler.
541 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
540 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
542
541
543 # The interactive one is initialized with an offset, meaning we always
542 # The interactive one is initialized with an offset, meaning we always
544 # want to remove the topmost item in the traceback, which is our own
543 # want to remove the topmost item in the traceback, which is our own
545 # internal code. Valid modes: ['Plain','Context','Verbose']
544 # internal code. Valid modes: ['Plain','Context','Verbose']
546 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
545 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
547 color_scheme='NoColor',
546 color_scheme='NoColor',
548 tb_offset = 1)
547 tb_offset = 1)
549
548
550 # IPython itself shouldn't crash. This will produce a detailed
549 # IPython itself shouldn't crash. This will produce a detailed
551 # post-mortem if it does. But we only install the crash handler for
550 # post-mortem if it does. But we only install the crash handler for
552 # non-threaded shells, the threaded ones use a normal verbose reporter
551 # non-threaded shells, the threaded ones use a normal verbose reporter
553 # and lose the crash handler. This is because exceptions in the main
552 # and lose the crash handler. This is because exceptions in the main
554 # thread (such as in GUI code) propagate directly to sys.excepthook,
553 # thread (such as in GUI code) propagate directly to sys.excepthook,
555 # and there's no point in printing crash dumps for every user exception.
554 # and there's no point in printing crash dumps for every user exception.
556 if self.isthreaded:
555 if self.isthreaded:
557 ipCrashHandler = ultraTB.FormattedTB()
556 ipCrashHandler = ultraTB.FormattedTB()
558 else:
557 else:
559 from IPython import CrashHandler
558 from IPython import CrashHandler
560 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
559 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
561 self.set_crash_handler(ipCrashHandler)
560 self.set_crash_handler(ipCrashHandler)
562
561
563 # and add any custom exception handlers the user may have specified
562 # and add any custom exception handlers the user may have specified
564 self.set_custom_exc(*custom_exceptions)
563 self.set_custom_exc(*custom_exceptions)
565
564
566 # indentation management
565 # indentation management
567 self.autoindent = False
566 self.autoindent = False
568 self.indent_current_nsp = 0
567 self.indent_current_nsp = 0
569
568
570 # Make some aliases automatically
569 # Make some aliases automatically
571 # Prepare list of shell aliases to auto-define
570 # Prepare list of shell aliases to auto-define
572 if os.name == 'posix':
571 if os.name == 'posix':
573 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
572 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
574 'mv mv -i','rm rm -i','cp cp -i',
573 'mv mv -i','rm rm -i','cp cp -i',
575 'cat cat','less less','clear clear',
574 'cat cat','less less','clear clear',
576 # a better ls
575 # a better ls
577 'ls ls -F',
576 'ls ls -F',
578 # long ls
577 # long ls
579 'll ls -lF')
578 'll ls -lF')
580 # Extra ls aliases with color, which need special treatment on BSD
579 # Extra ls aliases with color, which need special treatment on BSD
581 # variants
580 # variants
582 ls_extra = ( # color ls
581 ls_extra = ( # color ls
583 'lc ls -F -o --color',
582 'lc ls -F -o --color',
584 # ls normal files only
583 # ls normal files only
585 'lf ls -F -o --color %l | grep ^-',
584 'lf ls -F -o --color %l | grep ^-',
586 # ls symbolic links
585 # ls symbolic links
587 'lk ls -F -o --color %l | grep ^l',
586 'lk ls -F -o --color %l | grep ^l',
588 # directories or links to directories,
587 # directories or links to directories,
589 'ldir ls -F -o --color %l | grep /$',
588 'ldir ls -F -o --color %l | grep /$',
590 # things which are executable
589 # things which are executable
591 'lx ls -F -o --color %l | grep ^-..x',
590 'lx ls -F -o --color %l | grep ^-..x',
592 )
591 )
593 # The BSDs don't ship GNU ls, so they don't understand the
592 # The BSDs don't ship GNU ls, so they don't understand the
594 # --color switch out of the box
593 # --color switch out of the box
595 if 'bsd' in sys.platform:
594 if 'bsd' in sys.platform:
596 ls_extra = ( # ls normal files only
595 ls_extra = ( # ls normal files only
597 'lf ls -lF | grep ^-',
596 'lf ls -lF | grep ^-',
598 # ls symbolic links
597 # ls symbolic links
599 'lk ls -lF | grep ^l',
598 'lk ls -lF | grep ^l',
600 # directories or links to directories,
599 # directories or links to directories,
601 'ldir ls -lF | grep /$',
600 'ldir ls -lF | grep /$',
602 # things which are executable
601 # things which are executable
603 'lx ls -lF | grep ^-..x',
602 'lx ls -lF | grep ^-..x',
604 )
603 )
605 auto_alias = auto_alias + ls_extra
604 auto_alias = auto_alias + ls_extra
606 elif os.name in ['nt','dos']:
605 elif os.name in ['nt','dos']:
607 auto_alias = ('dir dir /on', 'ls dir /on',
606 auto_alias = ('dir dir /on', 'ls dir /on',
608 'ddir dir /ad /on', 'ldir dir /ad /on',
607 'ddir dir /ad /on', 'ldir dir /ad /on',
609 'mkdir mkdir','rmdir rmdir','echo echo',
608 'mkdir mkdir','rmdir rmdir','echo echo',
610 'ren ren','cls cls','copy copy')
609 'ren ren','cls cls','copy copy')
611 else:
610 else:
612 auto_alias = ()
611 auto_alias = ()
613 self.auto_alias = [s.split(None,1) for s in auto_alias]
612 self.auto_alias = [s.split(None,1) for s in auto_alias]
614 # Call the actual (public) initializer
613 # Call the actual (public) initializer
615 self.init_auto_alias()
614 self.init_auto_alias()
616
615
617 # Produce a public API instance
616 # Produce a public API instance
618 self.api = IPython.ipapi.IPApi(self)
617 self.api = IPython.ipapi.IPApi(self)
619
618
620 # track which builtins we add, so we can clean up later
619 # track which builtins we add, so we can clean up later
621 self.builtins_added = {}
620 self.builtins_added = {}
622 # This method will add the necessary builtins for operation, but
621 # This method will add the necessary builtins for operation, but
623 # tracking what it did via the builtins_added dict.
622 # tracking what it did via the builtins_added dict.
624 self.add_builtins()
623 self.add_builtins()
625
624
626 # end __init__
625 # end __init__
627
626
628 def var_expand(self,cmd,depth=0):
627 def var_expand(self,cmd,depth=0):
629 """Expand python variables in a string.
628 """Expand python variables in a string.
630
629
631 The depth argument indicates how many frames above the caller should
630 The depth argument indicates how many frames above the caller should
632 be walked to look for the local namespace where to expand variables.
631 be walked to look for the local namespace where to expand variables.
633
632
634 The global namespace for expansion is always the user's interactive
633 The global namespace for expansion is always the user's interactive
635 namespace.
634 namespace.
636 """
635 """
637
636
638 return str(ItplNS(cmd.replace('#','\#'),
637 return str(ItplNS(cmd.replace('#','\#'),
639 self.user_ns, # globals
638 self.user_ns, # globals
640 # Skip our own frame in searching for locals:
639 # Skip our own frame in searching for locals:
641 sys._getframe(depth+1).f_locals # locals
640 sys._getframe(depth+1).f_locals # locals
642 ))
641 ))
643
642
644 def pre_config_initialization(self):
643 def pre_config_initialization(self):
645 """Pre-configuration init method
644 """Pre-configuration init method
646
645
647 This is called before the configuration files are processed to
646 This is called before the configuration files are processed to
648 prepare the services the config files might need.
647 prepare the services the config files might need.
649
648
650 self.rc already has reasonable default values at this point.
649 self.rc already has reasonable default values at this point.
651 """
650 """
652 rc = self.rc
651 rc = self.rc
653
652
654 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
653 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
655
654
656 def post_config_initialization(self):
655 def post_config_initialization(self):
657 """Post configuration init method
656 """Post configuration init method
658
657
659 This is called after the configuration files have been processed to
658 This is called after the configuration files have been processed to
660 'finalize' the initialization."""
659 'finalize' the initialization."""
661
660
662 rc = self.rc
661 rc = self.rc
663
662
664 # Object inspector
663 # Object inspector
665 self.inspector = OInspect.Inspector(OInspect.InspectColors,
664 self.inspector = OInspect.Inspector(OInspect.InspectColors,
666 PyColorize.ANSICodeColors,
665 PyColorize.ANSICodeColors,
667 'NoColor',
666 'NoColor',
668 rc.object_info_string_level)
667 rc.object_info_string_level)
669
668
670 # Load readline proper
669 # Load readline proper
671 if rc.readline:
670 if rc.readline:
672 self.init_readline()
671 self.init_readline()
673
672
674 # local shortcut, this is used a LOT
673 # local shortcut, this is used a LOT
675 self.log = self.logger.log
674 self.log = self.logger.log
676
675
677 # Initialize cache, set in/out prompts and printing system
676 # Initialize cache, set in/out prompts and printing system
678 self.outputcache = CachedOutput(self,
677 self.outputcache = CachedOutput(self,
679 rc.cache_size,
678 rc.cache_size,
680 rc.pprint,
679 rc.pprint,
681 input_sep = rc.separate_in,
680 input_sep = rc.separate_in,
682 output_sep = rc.separate_out,
681 output_sep = rc.separate_out,
683 output_sep2 = rc.separate_out2,
682 output_sep2 = rc.separate_out2,
684 ps1 = rc.prompt_in1,
683 ps1 = rc.prompt_in1,
685 ps2 = rc.prompt_in2,
684 ps2 = rc.prompt_in2,
686 ps_out = rc.prompt_out,
685 ps_out = rc.prompt_out,
687 pad_left = rc.prompts_pad_left)
686 pad_left = rc.prompts_pad_left)
688
687
689 # user may have over-ridden the default print hook:
688 # user may have over-ridden the default print hook:
690 try:
689 try:
691 self.outputcache.__class__.display = self.hooks.display
690 self.outputcache.__class__.display = self.hooks.display
692 except AttributeError:
691 except AttributeError:
693 pass
692 pass
694
693
695 # I don't like assigning globally to sys, because it means when
694 # I don't like assigning globally to sys, because it means when
696 # embedding instances, each embedded instance overrides the previous
695 # embedding instances, each embedded instance overrides the previous
697 # choice. But sys.displayhook seems to be called internally by exec,
696 # choice. But sys.displayhook seems to be called internally by exec,
698 # so I don't see a way around it. We first save the original and then
697 # so I don't see a way around it. We first save the original and then
699 # overwrite it.
698 # overwrite it.
700 self.sys_displayhook = sys.displayhook
699 self.sys_displayhook = sys.displayhook
701 sys.displayhook = self.outputcache
700 sys.displayhook = self.outputcache
702
701
703 # Set user colors (don't do it in the constructor above so that it
702 # Set user colors (don't do it in the constructor above so that it
704 # doesn't crash if colors option is invalid)
703 # doesn't crash if colors option is invalid)
705 self.magic_colors(rc.colors)
704 self.magic_colors(rc.colors)
706
705
707 # Set calling of pdb on exceptions
706 # Set calling of pdb on exceptions
708 self.call_pdb = rc.pdb
707 self.call_pdb = rc.pdb
709
708
710 # Load user aliases
709 # Load user aliases
711 for alias in rc.alias:
710 for alias in rc.alias:
712 self.magic_alias(alias)
711 self.magic_alias(alias)
713 self.hooks.late_startup_hook()
712 self.hooks.late_startup_hook()
714
713
715 batchrun = False
714 batchrun = False
716 for batchfile in [path(arg) for arg in self.rc.args
715 for batchfile in [path(arg) for arg in self.rc.args
717 if arg.lower().endswith('.ipy')]:
716 if arg.lower().endswith('.ipy')]:
718 if not batchfile.isfile():
717 if not batchfile.isfile():
719 print "No such batch file:", batchfile
718 print "No such batch file:", batchfile
720 continue
719 continue
721 self.api.runlines(batchfile.text())
720 self.api.runlines(batchfile.text())
722 batchrun = True
721 batchrun = True
723 if batchrun:
722 if batchrun:
724 self.exit_now = True
723 self.exit_now = True
725
724
726 def add_builtins(self):
725 def add_builtins(self):
727 """Store ipython references into the builtin namespace.
726 """Store ipython references into the builtin namespace.
728
727
729 Some parts of ipython operate via builtins injected here, which hold a
728 Some parts of ipython operate via builtins injected here, which hold a
730 reference to IPython itself."""
729 reference to IPython itself."""
731
730
732 # TODO: deprecate all except _ip; 'jobs' should be installed
731 # TODO: deprecate all except _ip; 'jobs' should be installed
733 # by an extension and the rest are under _ip, ipalias is redundant
732 # by an extension and the rest are under _ip, ipalias is redundant
734 builtins_new = dict(__IPYTHON__ = self,
733 builtins_new = dict(__IPYTHON__ = self,
735 ip_set_hook = self.set_hook,
734 ip_set_hook = self.set_hook,
736 jobs = self.jobs,
735 jobs = self.jobs,
737 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
736 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
738 ipalias = wrap_deprecated(self.ipalias),
737 ipalias = wrap_deprecated(self.ipalias),
739 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
738 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
740 _ip = self.api
739 _ip = self.api
741 )
740 )
742 for biname,bival in builtins_new.items():
741 for biname,bival in builtins_new.items():
743 try:
742 try:
744 # store the orignal value so we can restore it
743 # store the orignal value so we can restore it
745 self.builtins_added[biname] = __builtin__.__dict__[biname]
744 self.builtins_added[biname] = __builtin__.__dict__[biname]
746 except KeyError:
745 except KeyError:
747 # or mark that it wasn't defined, and we'll just delete it at
746 # or mark that it wasn't defined, and we'll just delete it at
748 # cleanup
747 # cleanup
749 self.builtins_added[biname] = Undefined
748 self.builtins_added[biname] = Undefined
750 __builtin__.__dict__[biname] = bival
749 __builtin__.__dict__[biname] = bival
751
750
752 # Keep in the builtins a flag for when IPython is active. We set it
751 # Keep in the builtins a flag for when IPython is active. We set it
753 # with setdefault so that multiple nested IPythons don't clobber one
752 # with setdefault so that multiple nested IPythons don't clobber one
754 # another. Each will increase its value by one upon being activated,
753 # another. Each will increase its value by one upon being activated,
755 # which also gives us a way to determine the nesting level.
754 # which also gives us a way to determine the nesting level.
756 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
755 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
757
756
758 def clean_builtins(self):
757 def clean_builtins(self):
759 """Remove any builtins which might have been added by add_builtins, or
758 """Remove any builtins which might have been added by add_builtins, or
760 restore overwritten ones to their previous values."""
759 restore overwritten ones to their previous values."""
761 for biname,bival in self.builtins_added.items():
760 for biname,bival in self.builtins_added.items():
762 if bival is Undefined:
761 if bival is Undefined:
763 del __builtin__.__dict__[biname]
762 del __builtin__.__dict__[biname]
764 else:
763 else:
765 __builtin__.__dict__[biname] = bival
764 __builtin__.__dict__[biname] = bival
766 self.builtins_added.clear()
765 self.builtins_added.clear()
767
766
768 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
767 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
769 """set_hook(name,hook) -> sets an internal IPython hook.
768 """set_hook(name,hook) -> sets an internal IPython hook.
770
769
771 IPython exposes some of its internal API as user-modifiable hooks. By
770 IPython exposes some of its internal API as user-modifiable hooks. By
772 adding your function to one of these hooks, you can modify IPython's
771 adding your function to one of these hooks, you can modify IPython's
773 behavior to call at runtime your own routines."""
772 behavior to call at runtime your own routines."""
774
773
775 # At some point in the future, this should validate the hook before it
774 # At some point in the future, this should validate the hook before it
776 # accepts it. Probably at least check that the hook takes the number
775 # accepts it. Probably at least check that the hook takes the number
777 # of args it's supposed to.
776 # of args it's supposed to.
778
777
779 f = new.instancemethod(hook,self,self.__class__)
778 f = new.instancemethod(hook,self,self.__class__)
780
779
781 # check if the hook is for strdispatcher first
780 # check if the hook is for strdispatcher first
782 if str_key is not None:
781 if str_key is not None:
783 sdp = self.strdispatchers.get(name, StrDispatch())
782 sdp = self.strdispatchers.get(name, StrDispatch())
784 sdp.add_s(str_key, f, priority )
783 sdp.add_s(str_key, f, priority )
785 self.strdispatchers[name] = sdp
784 self.strdispatchers[name] = sdp
786 return
785 return
787 if re_key is not None:
786 if re_key is not None:
788 sdp = self.strdispatchers.get(name, StrDispatch())
787 sdp = self.strdispatchers.get(name, StrDispatch())
789 sdp.add_re(re.compile(re_key), f, priority )
788 sdp.add_re(re.compile(re_key), f, priority )
790 self.strdispatchers[name] = sdp
789 self.strdispatchers[name] = sdp
791 return
790 return
792
791
793 dp = getattr(self.hooks, name, None)
792 dp = getattr(self.hooks, name, None)
794 if name not in IPython.hooks.__all__:
793 if name not in IPython.hooks.__all__:
795 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
794 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
796 if not dp:
795 if not dp:
797 dp = IPython.hooks.CommandChainDispatcher()
796 dp = IPython.hooks.CommandChainDispatcher()
798
797
799 try:
798 try:
800 dp.add(f,priority)
799 dp.add(f,priority)
801 except AttributeError:
800 except AttributeError:
802 # it was not commandchain, plain old func - replace
801 # it was not commandchain, plain old func - replace
803 dp = f
802 dp = f
804
803
805 setattr(self.hooks,name, dp)
804 setattr(self.hooks,name, dp)
806
805
807
806
808 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
807 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
809
808
810 def set_crash_handler(self,crashHandler):
809 def set_crash_handler(self,crashHandler):
811 """Set the IPython crash handler.
810 """Set the IPython crash handler.
812
811
813 This must be a callable with a signature suitable for use as
812 This must be a callable with a signature suitable for use as
814 sys.excepthook."""
813 sys.excepthook."""
815
814
816 # Install the given crash handler as the Python exception hook
815 # Install the given crash handler as the Python exception hook
817 sys.excepthook = crashHandler
816 sys.excepthook = crashHandler
818
817
819 # The instance will store a pointer to this, so that runtime code
818 # The instance will store a pointer to this, so that runtime code
820 # (such as magics) can access it. This is because during the
819 # (such as magics) can access it. This is because during the
821 # read-eval loop, it gets temporarily overwritten (to deal with GUI
820 # read-eval loop, it gets temporarily overwritten (to deal with GUI
822 # frameworks).
821 # frameworks).
823 self.sys_excepthook = sys.excepthook
822 self.sys_excepthook = sys.excepthook
824
823
825
824
826 def set_custom_exc(self,exc_tuple,handler):
825 def set_custom_exc(self,exc_tuple,handler):
827 """set_custom_exc(exc_tuple,handler)
826 """set_custom_exc(exc_tuple,handler)
828
827
829 Set a custom exception handler, which will be called if any of the
828 Set a custom exception handler, which will be called if any of the
830 exceptions in exc_tuple occur in the mainloop (specifically, in the
829 exceptions in exc_tuple occur in the mainloop (specifically, in the
831 runcode() method.
830 runcode() method.
832
831
833 Inputs:
832 Inputs:
834
833
835 - exc_tuple: a *tuple* of valid exceptions to call the defined
834 - exc_tuple: a *tuple* of valid exceptions to call the defined
836 handler for. It is very important that you use a tuple, and NOT A
835 handler for. It is very important that you use a tuple, and NOT A
837 LIST here, because of the way Python's except statement works. If
836 LIST here, because of the way Python's except statement works. If
838 you only want to trap a single exception, use a singleton tuple:
837 you only want to trap a single exception, use a singleton tuple:
839
838
840 exc_tuple == (MyCustomException,)
839 exc_tuple == (MyCustomException,)
841
840
842 - handler: this must be defined as a function with the following
841 - handler: this must be defined as a function with the following
843 basic interface: def my_handler(self,etype,value,tb).
842 basic interface: def my_handler(self,etype,value,tb).
844
843
845 This will be made into an instance method (via new.instancemethod)
844 This will be made into an instance method (via new.instancemethod)
846 of IPython itself, and it will be called if any of the exceptions
845 of IPython itself, and it will be called if any of the exceptions
847 listed in the exc_tuple are caught. If the handler is None, an
846 listed in the exc_tuple are caught. If the handler is None, an
848 internal basic one is used, which just prints basic info.
847 internal basic one is used, which just prints basic info.
849
848
850 WARNING: by putting in your own exception handler into IPython's main
849 WARNING: by putting in your own exception handler into IPython's main
851 execution loop, you run a very good chance of nasty crashes. This
850 execution loop, you run a very good chance of nasty crashes. This
852 facility should only be used if you really know what you are doing."""
851 facility should only be used if you really know what you are doing."""
853
852
854 assert type(exc_tuple)==type(()) , \
853 assert type(exc_tuple)==type(()) , \
855 "The custom exceptions must be given AS A TUPLE."
854 "The custom exceptions must be given AS A TUPLE."
856
855
857 def dummy_handler(self,etype,value,tb):
856 def dummy_handler(self,etype,value,tb):
858 print '*** Simple custom exception handler ***'
857 print '*** Simple custom exception handler ***'
859 print 'Exception type :',etype
858 print 'Exception type :',etype
860 print 'Exception value:',value
859 print 'Exception value:',value
861 print 'Traceback :',tb
860 print 'Traceback :',tb
862 print 'Source code :','\n'.join(self.buffer)
861 print 'Source code :','\n'.join(self.buffer)
863
862
864 if handler is None: handler = dummy_handler
863 if handler is None: handler = dummy_handler
865
864
866 self.CustomTB = new.instancemethod(handler,self,self.__class__)
865 self.CustomTB = new.instancemethod(handler,self,self.__class__)
867 self.custom_exceptions = exc_tuple
866 self.custom_exceptions = exc_tuple
868
867
869 def set_custom_completer(self,completer,pos=0):
868 def set_custom_completer(self,completer,pos=0):
870 """set_custom_completer(completer,pos=0)
869 """set_custom_completer(completer,pos=0)
871
870
872 Adds a new custom completer function.
871 Adds a new custom completer function.
873
872
874 The position argument (defaults to 0) is the index in the completers
873 The position argument (defaults to 0) is the index in the completers
875 list where you want the completer to be inserted."""
874 list where you want the completer to be inserted."""
876
875
877 newcomp = new.instancemethod(completer,self.Completer,
876 newcomp = new.instancemethod(completer,self.Completer,
878 self.Completer.__class__)
877 self.Completer.__class__)
879 self.Completer.matchers.insert(pos,newcomp)
878 self.Completer.matchers.insert(pos,newcomp)
880
879
881 def _get_call_pdb(self):
880 def _get_call_pdb(self):
882 return self._call_pdb
881 return self._call_pdb
883
882
884 def _set_call_pdb(self,val):
883 def _set_call_pdb(self,val):
885
884
886 if val not in (0,1,False,True):
885 if val not in (0,1,False,True):
887 raise ValueError,'new call_pdb value must be boolean'
886 raise ValueError,'new call_pdb value must be boolean'
888
887
889 # store value in instance
888 # store value in instance
890 self._call_pdb = val
889 self._call_pdb = val
891
890
892 # notify the actual exception handlers
891 # notify the actual exception handlers
893 self.InteractiveTB.call_pdb = val
892 self.InteractiveTB.call_pdb = val
894 if self.isthreaded:
893 if self.isthreaded:
895 try:
894 try:
896 self.sys_excepthook.call_pdb = val
895 self.sys_excepthook.call_pdb = val
897 except:
896 except:
898 warn('Failed to activate pdb for threaded exception handler')
897 warn('Failed to activate pdb for threaded exception handler')
899
898
900 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
899 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
901 'Control auto-activation of pdb at exceptions')
900 'Control auto-activation of pdb at exceptions')
902
901
903
902
904 # These special functions get installed in the builtin namespace, to
903 # These special functions get installed in the builtin namespace, to
905 # provide programmatic (pure python) access to magics, aliases and system
904 # provide programmatic (pure python) access to magics, aliases and system
906 # calls. This is important for logging, user scripting, and more.
905 # calls. This is important for logging, user scripting, and more.
907
906
908 # We are basically exposing, via normal python functions, the three
907 # We are basically exposing, via normal python functions, the three
909 # mechanisms in which ipython offers special call modes (magics for
908 # mechanisms in which ipython offers special call modes (magics for
910 # internal control, aliases for direct system access via pre-selected
909 # internal control, aliases for direct system access via pre-selected
911 # names, and !cmd for calling arbitrary system commands).
910 # names, and !cmd for calling arbitrary system commands).
912
911
913 def ipmagic(self,arg_s):
912 def ipmagic(self,arg_s):
914 """Call a magic function by name.
913 """Call a magic function by name.
915
914
916 Input: a string containing the name of the magic function to call and any
915 Input: a string containing the name of the magic function to call and any
917 additional arguments to be passed to the magic.
916 additional arguments to be passed to the magic.
918
917
919 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
918 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
920 prompt:
919 prompt:
921
920
922 In[1]: %name -opt foo bar
921 In[1]: %name -opt foo bar
923
922
924 To call a magic without arguments, simply use ipmagic('name').
923 To call a magic without arguments, simply use ipmagic('name').
925
924
926 This provides a proper Python function to call IPython's magics in any
925 This provides a proper Python function to call IPython's magics in any
927 valid Python code you can type at the interpreter, including loops and
926 valid Python code you can type at the interpreter, including loops and
928 compound statements. It is added by IPython to the Python builtin
927 compound statements. It is added by IPython to the Python builtin
929 namespace upon initialization."""
928 namespace upon initialization."""
930
929
931 args = arg_s.split(' ',1)
930 args = arg_s.split(' ',1)
932 magic_name = args[0]
931 magic_name = args[0]
933 magic_name = magic_name.lstrip(self.ESC_MAGIC)
932 magic_name = magic_name.lstrip(self.ESC_MAGIC)
934
933
935 try:
934 try:
936 magic_args = args[1]
935 magic_args = args[1]
937 except IndexError:
936 except IndexError:
938 magic_args = ''
937 magic_args = ''
939 fn = getattr(self,'magic_'+magic_name,None)
938 fn = getattr(self,'magic_'+magic_name,None)
940 if fn is None:
939 if fn is None:
941 error("Magic function `%s` not found." % magic_name)
940 error("Magic function `%s` not found." % magic_name)
942 else:
941 else:
943 magic_args = self.var_expand(magic_args,1)
942 magic_args = self.var_expand(magic_args,1)
944 return fn(magic_args)
943 return fn(magic_args)
945
944
946 def ipalias(self,arg_s):
945 def ipalias(self,arg_s):
947 """Call an alias by name.
946 """Call an alias by name.
948
947
949 Input: a string containing the name of the alias to call and any
948 Input: a string containing the name of the alias to call and any
950 additional arguments to be passed to the magic.
949 additional arguments to be passed to the magic.
951
950
952 ipalias('name -opt foo bar') is equivalent to typing at the ipython
951 ipalias('name -opt foo bar') is equivalent to typing at the ipython
953 prompt:
952 prompt:
954
953
955 In[1]: name -opt foo bar
954 In[1]: name -opt foo bar
956
955
957 To call an alias without arguments, simply use ipalias('name').
956 To call an alias without arguments, simply use ipalias('name').
958
957
959 This provides a proper Python function to call IPython's aliases in any
958 This provides a proper Python function to call IPython's aliases in any
960 valid Python code you can type at the interpreter, including loops and
959 valid Python code you can type at the interpreter, including loops and
961 compound statements. It is added by IPython to the Python builtin
960 compound statements. It is added by IPython to the Python builtin
962 namespace upon initialization."""
961 namespace upon initialization."""
963
962
964 args = arg_s.split(' ',1)
963 args = arg_s.split(' ',1)
965 alias_name = args[0]
964 alias_name = args[0]
966 try:
965 try:
967 alias_args = args[1]
966 alias_args = args[1]
968 except IndexError:
967 except IndexError:
969 alias_args = ''
968 alias_args = ''
970 if alias_name in self.alias_table:
969 if alias_name in self.alias_table:
971 self.call_alias(alias_name,alias_args)
970 self.call_alias(alias_name,alias_args)
972 else:
971 else:
973 error("Alias `%s` not found." % alias_name)
972 error("Alias `%s` not found." % alias_name)
974
973
975 def ipsystem(self,arg_s):
974 def ipsystem(self,arg_s):
976 """Make a system call, using IPython."""
975 """Make a system call, using IPython."""
977
976
978 self.system(arg_s)
977 self.system(arg_s)
979
978
980 def complete(self,text):
979 def complete(self,text):
981 """Return a sorted list of all possible completions on text.
980 """Return a sorted list of all possible completions on text.
982
981
983 Inputs:
982 Inputs:
984
983
985 - text: a string of text to be completed on.
984 - text: a string of text to be completed on.
986
985
987 This is a wrapper around the completion mechanism, similar to what
986 This is a wrapper around the completion mechanism, similar to what
988 readline does at the command line when the TAB key is hit. By
987 readline does at the command line when the TAB key is hit. By
989 exposing it as a method, it can be used by other non-readline
988 exposing it as a method, it can be used by other non-readline
990 environments (such as GUIs) for text completion.
989 environments (such as GUIs) for text completion.
991
990
992 Simple usage example:
991 Simple usage example:
993
992
994 In [1]: x = 'hello'
993 In [1]: x = 'hello'
995
994
996 In [2]: __IP.complete('x.l')
995 In [2]: __IP.complete('x.l')
997 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
996 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
998
997
999 complete = self.Completer.complete
998 complete = self.Completer.complete
1000 state = 0
999 state = 0
1001 # use a dict so we get unique keys, since ipyhton's multiple
1000 # use a dict so we get unique keys, since ipyhton's multiple
1002 # completers can return duplicates.
1001 # completers can return duplicates.
1003 comps = {}
1002 comps = {}
1004 while True:
1003 while True:
1005 newcomp = complete(text,state)
1004 newcomp = complete(text,state)
1006 if newcomp is None:
1005 if newcomp is None:
1007 break
1006 break
1008 comps[newcomp] = 1
1007 comps[newcomp] = 1
1009 state += 1
1008 state += 1
1010 outcomps = comps.keys()
1009 outcomps = comps.keys()
1011 outcomps.sort()
1010 outcomps.sort()
1012 return outcomps
1011 return outcomps
1013
1012
1014 def set_completer_frame(self, frame=None):
1013 def set_completer_frame(self, frame=None):
1015 if frame:
1014 if frame:
1016 self.Completer.namespace = frame.f_locals
1015 self.Completer.namespace = frame.f_locals
1017 self.Completer.global_namespace = frame.f_globals
1016 self.Completer.global_namespace = frame.f_globals
1018 else:
1017 else:
1019 self.Completer.namespace = self.user_ns
1018 self.Completer.namespace = self.user_ns
1020 self.Completer.global_namespace = self.user_global_ns
1019 self.Completer.global_namespace = self.user_global_ns
1021
1020
1022 def init_auto_alias(self):
1021 def init_auto_alias(self):
1023 """Define some aliases automatically.
1022 """Define some aliases automatically.
1024
1023
1025 These are ALL parameter-less aliases"""
1024 These are ALL parameter-less aliases"""
1026
1025
1027 for alias,cmd in self.auto_alias:
1026 for alias,cmd in self.auto_alias:
1028 self.alias_table[alias] = (0,cmd)
1027 self.alias_table[alias] = (0,cmd)
1029
1028
1030 def alias_table_validate(self,verbose=0):
1029 def alias_table_validate(self,verbose=0):
1031 """Update information about the alias table.
1030 """Update information about the alias table.
1032
1031
1033 In particular, make sure no Python keywords/builtins are in it."""
1032 In particular, make sure no Python keywords/builtins are in it."""
1034
1033
1035 no_alias = self.no_alias
1034 no_alias = self.no_alias
1036 for k in self.alias_table.keys():
1035 for k in self.alias_table.keys():
1037 if k in no_alias:
1036 if k in no_alias:
1038 del self.alias_table[k]
1037 del self.alias_table[k]
1039 if verbose:
1038 if verbose:
1040 print ("Deleting alias <%s>, it's a Python "
1039 print ("Deleting alias <%s>, it's a Python "
1041 "keyword or builtin." % k)
1040 "keyword or builtin." % k)
1042
1041
1043 def set_autoindent(self,value=None):
1042 def set_autoindent(self,value=None):
1044 """Set the autoindent flag, checking for readline support.
1043 """Set the autoindent flag, checking for readline support.
1045
1044
1046 If called with no arguments, it acts as a toggle."""
1045 If called with no arguments, it acts as a toggle."""
1047
1046
1048 if not self.has_readline:
1047 if not self.has_readline:
1049 if os.name == 'posix':
1048 if os.name == 'posix':
1050 warn("The auto-indent feature requires the readline library")
1049 warn("The auto-indent feature requires the readline library")
1051 self.autoindent = 0
1050 self.autoindent = 0
1052 return
1051 return
1053 if value is None:
1052 if value is None:
1054 self.autoindent = not self.autoindent
1053 self.autoindent = not self.autoindent
1055 else:
1054 else:
1056 self.autoindent = value
1055 self.autoindent = value
1057
1056
1058 def rc_set_toggle(self,rc_field,value=None):
1057 def rc_set_toggle(self,rc_field,value=None):
1059 """Set or toggle a field in IPython's rc config. structure.
1058 """Set or toggle a field in IPython's rc config. structure.
1060
1059
1061 If called with no arguments, it acts as a toggle.
1060 If called with no arguments, it acts as a toggle.
1062
1061
1063 If called with a non-existent field, the resulting AttributeError
1062 If called with a non-existent field, the resulting AttributeError
1064 exception will propagate out."""
1063 exception will propagate out."""
1065
1064
1066 rc_val = getattr(self.rc,rc_field)
1065 rc_val = getattr(self.rc,rc_field)
1067 if value is None:
1066 if value is None:
1068 value = not rc_val
1067 value = not rc_val
1069 setattr(self.rc,rc_field,value)
1068 setattr(self.rc,rc_field,value)
1070
1069
1071 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1070 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1072 """Install the user configuration directory.
1071 """Install the user configuration directory.
1073
1072
1074 Can be called when running for the first time or to upgrade the user's
1073 Can be called when running for the first time or to upgrade the user's
1075 .ipython/ directory with the mode parameter. Valid modes are 'install'
1074 .ipython/ directory with the mode parameter. Valid modes are 'install'
1076 and 'upgrade'."""
1075 and 'upgrade'."""
1077
1076
1078 def wait():
1077 def wait():
1079 try:
1078 try:
1080 raw_input("Please press <RETURN> to start IPython.")
1079 raw_input("Please press <RETURN> to start IPython.")
1081 except EOFError:
1080 except EOFError:
1082 print >> Term.cout
1081 print >> Term.cout
1083 print '*'*70
1082 print '*'*70
1084
1083
1085 cwd = os.getcwd() # remember where we started
1084 cwd = os.getcwd() # remember where we started
1086 glb = glob.glob
1085 glb = glob.glob
1087 print '*'*70
1086 print '*'*70
1088 if mode == 'install':
1087 if mode == 'install':
1089 print \
1088 print \
1090 """Welcome to IPython. I will try to create a personal configuration directory
1089 """Welcome to IPython. I will try to create a personal configuration directory
1091 where you can customize many aspects of IPython's functionality in:\n"""
1090 where you can customize many aspects of IPython's functionality in:\n"""
1092 else:
1091 else:
1093 print 'I am going to upgrade your configuration in:'
1092 print 'I am going to upgrade your configuration in:'
1094
1093
1095 print ipythondir
1094 print ipythondir
1096
1095
1097 rcdirend = os.path.join('IPython','UserConfig')
1096 rcdirend = os.path.join('IPython','UserConfig')
1098 cfg = lambda d: os.path.join(d,rcdirend)
1097 cfg = lambda d: os.path.join(d,rcdirend)
1099 try:
1098 try:
1100 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1099 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1101 except IOError:
1100 except IOError:
1102 warning = """
1101 warning = """
1103 Installation error. IPython's directory was not found.
1102 Installation error. IPython's directory was not found.
1104
1103
1105 Check the following:
1104 Check the following:
1106
1105
1107 The ipython/IPython directory should be in a directory belonging to your
1106 The ipython/IPython directory should be in a directory belonging to your
1108 PYTHONPATH environment variable (that is, it should be in a directory
1107 PYTHONPATH environment variable (that is, it should be in a directory
1109 belonging to sys.path). You can copy it explicitly there or just link to it.
1108 belonging to sys.path). You can copy it explicitly there or just link to it.
1110
1109
1111 IPython will proceed with builtin defaults.
1110 IPython will proceed with builtin defaults.
1112 """
1111 """
1113 warn(warning)
1112 warn(warning)
1114 wait()
1113 wait()
1115 return
1114 return
1116
1115
1117 if mode == 'install':
1116 if mode == 'install':
1118 try:
1117 try:
1119 shutil.copytree(rcdir,ipythondir)
1118 shutil.copytree(rcdir,ipythondir)
1120 os.chdir(ipythondir)
1119 os.chdir(ipythondir)
1121 rc_files = glb("ipythonrc*")
1120 rc_files = glb("ipythonrc*")
1122 for rc_file in rc_files:
1121 for rc_file in rc_files:
1123 os.rename(rc_file,rc_file+rc_suffix)
1122 os.rename(rc_file,rc_file+rc_suffix)
1124 except:
1123 except:
1125 warning = """
1124 warning = """
1126
1125
1127 There was a problem with the installation:
1126 There was a problem with the installation:
1128 %s
1127 %s
1129 Try to correct it or contact the developers if you think it's a bug.
1128 Try to correct it or contact the developers if you think it's a bug.
1130 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1129 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1131 warn(warning)
1130 warn(warning)
1132 wait()
1131 wait()
1133 return
1132 return
1134
1133
1135 elif mode == 'upgrade':
1134 elif mode == 'upgrade':
1136 try:
1135 try:
1137 os.chdir(ipythondir)
1136 os.chdir(ipythondir)
1138 except:
1137 except:
1139 print """
1138 print """
1140 Can not upgrade: changing to directory %s failed. Details:
1139 Can not upgrade: changing to directory %s failed. Details:
1141 %s
1140 %s
1142 """ % (ipythondir,sys.exc_info()[1])
1141 """ % (ipythondir,sys.exc_info()[1])
1143 wait()
1142 wait()
1144 return
1143 return
1145 else:
1144 else:
1146 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1145 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1147 for new_full_path in sources:
1146 for new_full_path in sources:
1148 new_filename = os.path.basename(new_full_path)
1147 new_filename = os.path.basename(new_full_path)
1149 if new_filename.startswith('ipythonrc'):
1148 if new_filename.startswith('ipythonrc'):
1150 new_filename = new_filename + rc_suffix
1149 new_filename = new_filename + rc_suffix
1151 # The config directory should only contain files, skip any
1150 # The config directory should only contain files, skip any
1152 # directories which may be there (like CVS)
1151 # directories which may be there (like CVS)
1153 if os.path.isdir(new_full_path):
1152 if os.path.isdir(new_full_path):
1154 continue
1153 continue
1155 if os.path.exists(new_filename):
1154 if os.path.exists(new_filename):
1156 old_file = new_filename+'.old'
1155 old_file = new_filename+'.old'
1157 if os.path.exists(old_file):
1156 if os.path.exists(old_file):
1158 os.remove(old_file)
1157 os.remove(old_file)
1159 os.rename(new_filename,old_file)
1158 os.rename(new_filename,old_file)
1160 shutil.copy(new_full_path,new_filename)
1159 shutil.copy(new_full_path,new_filename)
1161 else:
1160 else:
1162 raise ValueError,'unrecognized mode for install:',`mode`
1161 raise ValueError,'unrecognized mode for install:',`mode`
1163
1162
1164 # Fix line-endings to those native to each platform in the config
1163 # Fix line-endings to those native to each platform in the config
1165 # directory.
1164 # directory.
1166 try:
1165 try:
1167 os.chdir(ipythondir)
1166 os.chdir(ipythondir)
1168 except:
1167 except:
1169 print """
1168 print """
1170 Problem: changing to directory %s failed.
1169 Problem: changing to directory %s failed.
1171 Details:
1170 Details:
1172 %s
1171 %s
1173
1172
1174 Some configuration files may have incorrect line endings. This should not
1173 Some configuration files may have incorrect line endings. This should not
1175 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1174 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1176 wait()
1175 wait()
1177 else:
1176 else:
1178 for fname in glb('ipythonrc*'):
1177 for fname in glb('ipythonrc*'):
1179 try:
1178 try:
1180 native_line_ends(fname,backup=0)
1179 native_line_ends(fname,backup=0)
1181 except IOError:
1180 except IOError:
1182 pass
1181 pass
1183
1182
1184 if mode == 'install':
1183 if mode == 'install':
1185 print """
1184 print """
1186 Successful installation!
1185 Successful installation!
1187
1186
1188 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1187 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1189 IPython manual (there are both HTML and PDF versions supplied with the
1188 IPython manual (there are both HTML and PDF versions supplied with the
1190 distribution) to make sure that your system environment is properly configured
1189 distribution) to make sure that your system environment is properly configured
1191 to take advantage of IPython's features.
1190 to take advantage of IPython's features.
1192
1191
1193 Important note: the configuration system has changed! The old system is
1192 Important note: the configuration system has changed! The old system is
1194 still in place, but its setting may be partly overridden by the settings in
1193 still in place, but its setting may be partly overridden by the settings in
1195 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1194 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1196 if some of the new settings bother you.
1195 if some of the new settings bother you.
1197
1196
1198 """
1197 """
1199 else:
1198 else:
1200 print """
1199 print """
1201 Successful upgrade!
1200 Successful upgrade!
1202
1201
1203 All files in your directory:
1202 All files in your directory:
1204 %(ipythondir)s
1203 %(ipythondir)s
1205 which would have been overwritten by the upgrade were backed up with a .old
1204 which would have been overwritten by the upgrade were backed up with a .old
1206 extension. If you had made particular customizations in those files you may
1205 extension. If you had made particular customizations in those files you may
1207 want to merge them back into the new files.""" % locals()
1206 want to merge them back into the new files.""" % locals()
1208 wait()
1207 wait()
1209 os.chdir(cwd)
1208 os.chdir(cwd)
1210 # end user_setup()
1209 # end user_setup()
1211
1210
1212 def atexit_operations(self):
1211 def atexit_operations(self):
1213 """This will be executed at the time of exit.
1212 """This will be executed at the time of exit.
1214
1213
1215 Saving of persistent data should be performed here. """
1214 Saving of persistent data should be performed here. """
1216
1215
1217 #print '*** IPython exit cleanup ***' # dbg
1216 #print '*** IPython exit cleanup ***' # dbg
1218 # input history
1217 # input history
1219 self.savehist()
1218 self.savehist()
1220
1219
1221 # Cleanup all tempfiles left around
1220 # Cleanup all tempfiles left around
1222 for tfile in self.tempfiles:
1221 for tfile in self.tempfiles:
1223 try:
1222 try:
1224 os.unlink(tfile)
1223 os.unlink(tfile)
1225 except OSError:
1224 except OSError:
1226 pass
1225 pass
1227
1226
1228 # save the "persistent data" catch-all dictionary
1227 # save the "persistent data" catch-all dictionary
1229 self.hooks.shutdown_hook()
1228 self.hooks.shutdown_hook()
1230
1229
1231 def savehist(self):
1230 def savehist(self):
1232 """Save input history to a file (via readline library)."""
1231 """Save input history to a file (via readline library)."""
1233 try:
1232 try:
1234 self.readline.write_history_file(self.histfile)
1233 self.readline.write_history_file(self.histfile)
1235 except:
1234 except:
1236 print 'Unable to save IPython command history to file: ' + \
1235 print 'Unable to save IPython command history to file: ' + \
1237 `self.histfile`
1236 `self.histfile`
1238
1237
1239 def history_saving_wrapper(self, func):
1238 def history_saving_wrapper(self, func):
1240 """ Wrap func for readline history saving
1239 """ Wrap func for readline history saving
1241
1240
1242 Convert func into callable that saves & restores
1241 Convert func into callable that saves & restores
1243 history around the call """
1242 history around the call """
1244
1243
1245 if not self.has_readline:
1244 if not self.has_readline:
1246 return func
1245 return func
1247
1246
1248 def wrapper():
1247 def wrapper():
1249 self.savehist()
1248 self.savehist()
1250 try:
1249 try:
1251 func()
1250 func()
1252 finally:
1251 finally:
1253 readline.read_history_file(self.histfile)
1252 readline.read_history_file(self.histfile)
1254 return wrapper
1253 return wrapper
1255
1254
1256
1255
1257 def pre_readline(self):
1256 def pre_readline(self):
1258 """readline hook to be used at the start of each line.
1257 """readline hook to be used at the start of each line.
1259
1258
1260 Currently it handles auto-indent only."""
1259 Currently it handles auto-indent only."""
1261
1260
1262 #debugx('self.indent_current_nsp','pre_readline:')
1261 #debugx('self.indent_current_nsp','pre_readline:')
1263 self.readline.insert_text(self.indent_current_str())
1262 self.readline.insert_text(self.indent_current_str())
1264
1263
1265 def init_readline(self):
1264 def init_readline(self):
1266 """Command history completion/saving/reloading."""
1265 """Command history completion/saving/reloading."""
1267
1266
1268 import IPython.rlineimpl as readline
1267 import IPython.rlineimpl as readline
1269 if not readline.have_readline:
1268 if not readline.have_readline:
1270 self.has_readline = 0
1269 self.has_readline = 0
1271 self.readline = None
1270 self.readline = None
1272 # no point in bugging windows users with this every time:
1271 # no point in bugging windows users with this every time:
1273 warn('Readline services not available on this platform.')
1272 warn('Readline services not available on this platform.')
1274 else:
1273 else:
1275 sys.modules['readline'] = readline
1274 sys.modules['readline'] = readline
1276 import atexit
1275 import atexit
1277 from IPython.completer import IPCompleter
1276 from IPython.completer import IPCompleter
1278 self.Completer = IPCompleter(self,
1277 self.Completer = IPCompleter(self,
1279 self.user_ns,
1278 self.user_ns,
1280 self.user_global_ns,
1279 self.user_global_ns,
1281 self.rc.readline_omit__names,
1280 self.rc.readline_omit__names,
1282 self.alias_table)
1281 self.alias_table)
1283 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1282 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1284 self.strdispatchers['complete_command'] = sdisp
1283 self.strdispatchers['complete_command'] = sdisp
1285 self.Completer.custom_completers = sdisp
1284 self.Completer.custom_completers = sdisp
1286 # Platform-specific configuration
1285 # Platform-specific configuration
1287 if os.name == 'nt':
1286 if os.name == 'nt':
1288 self.readline_startup_hook = readline.set_pre_input_hook
1287 self.readline_startup_hook = readline.set_pre_input_hook
1289 else:
1288 else:
1290 self.readline_startup_hook = readline.set_startup_hook
1289 self.readline_startup_hook = readline.set_startup_hook
1291
1290
1292 # Load user's initrc file (readline config)
1291 # Load user's initrc file (readline config)
1293 inputrc_name = os.environ.get('INPUTRC')
1292 inputrc_name = os.environ.get('INPUTRC')
1294 if inputrc_name is None:
1293 if inputrc_name is None:
1295 home_dir = get_home_dir()
1294 home_dir = get_home_dir()
1296 if home_dir is not None:
1295 if home_dir is not None:
1297 inputrc_name = os.path.join(home_dir,'.inputrc')
1296 inputrc_name = os.path.join(home_dir,'.inputrc')
1298 if os.path.isfile(inputrc_name):
1297 if os.path.isfile(inputrc_name):
1299 try:
1298 try:
1300 readline.read_init_file(inputrc_name)
1299 readline.read_init_file(inputrc_name)
1301 except:
1300 except:
1302 warn('Problems reading readline initialization file <%s>'
1301 warn('Problems reading readline initialization file <%s>'
1303 % inputrc_name)
1302 % inputrc_name)
1304
1303
1305 self.has_readline = 1
1304 self.has_readline = 1
1306 self.readline = readline
1305 self.readline = readline
1307 # save this in sys so embedded copies can restore it properly
1306 # save this in sys so embedded copies can restore it properly
1308 sys.ipcompleter = self.Completer.complete
1307 sys.ipcompleter = self.Completer.complete
1309 readline.set_completer(self.Completer.complete)
1308 readline.set_completer(self.Completer.complete)
1310
1309
1311 # Configure readline according to user's prefs
1310 # Configure readline according to user's prefs
1312 for rlcommand in self.rc.readline_parse_and_bind:
1311 for rlcommand in self.rc.readline_parse_and_bind:
1313 readline.parse_and_bind(rlcommand)
1312 readline.parse_and_bind(rlcommand)
1314
1313
1315 # remove some chars from the delimiters list
1314 # remove some chars from the delimiters list
1316 delims = readline.get_completer_delims()
1315 delims = readline.get_completer_delims()
1317 delims = delims.translate(string._idmap,
1316 delims = delims.translate(string._idmap,
1318 self.rc.readline_remove_delims)
1317 self.rc.readline_remove_delims)
1319 readline.set_completer_delims(delims)
1318 readline.set_completer_delims(delims)
1320 # otherwise we end up with a monster history after a while:
1319 # otherwise we end up with a monster history after a while:
1321 readline.set_history_length(1000)
1320 readline.set_history_length(1000)
1322 try:
1321 try:
1323 #print '*** Reading readline history' # dbg
1322 #print '*** Reading readline history' # dbg
1324 readline.read_history_file(self.histfile)
1323 readline.read_history_file(self.histfile)
1325 except IOError:
1324 except IOError:
1326 pass # It doesn't exist yet.
1325 pass # It doesn't exist yet.
1327
1326
1328 atexit.register(self.atexit_operations)
1327 atexit.register(self.atexit_operations)
1329 del atexit
1328 del atexit
1330
1329
1331 # Configure auto-indent for all platforms
1330 # Configure auto-indent for all platforms
1332 self.set_autoindent(self.rc.autoindent)
1331 self.set_autoindent(self.rc.autoindent)
1333
1332
1334 def ask_yes_no(self,prompt,default=True):
1333 def ask_yes_no(self,prompt,default=True):
1335 if self.rc.quiet:
1334 if self.rc.quiet:
1336 return True
1335 return True
1337 return ask_yes_no(prompt,default)
1336 return ask_yes_no(prompt,default)
1338
1337
1339 def _should_recompile(self,e):
1338 def _should_recompile(self,e):
1340 """Utility routine for edit_syntax_error"""
1339 """Utility routine for edit_syntax_error"""
1341
1340
1342 if e.filename in ('<ipython console>','<input>','<string>',
1341 if e.filename in ('<ipython console>','<input>','<string>',
1343 '<console>','<BackgroundJob compilation>',
1342 '<console>','<BackgroundJob compilation>',
1344 None):
1343 None):
1345
1344
1346 return False
1345 return False
1347 try:
1346 try:
1348 if (self.rc.autoedit_syntax and
1347 if (self.rc.autoedit_syntax and
1349 not self.ask_yes_no('Return to editor to correct syntax error? '
1348 not self.ask_yes_no('Return to editor to correct syntax error? '
1350 '[Y/n] ','y')):
1349 '[Y/n] ','y')):
1351 return False
1350 return False
1352 except EOFError:
1351 except EOFError:
1353 return False
1352 return False
1354
1353
1355 def int0(x):
1354 def int0(x):
1356 try:
1355 try:
1357 return int(x)
1356 return int(x)
1358 except TypeError:
1357 except TypeError:
1359 return 0
1358 return 0
1360 # always pass integer line and offset values to editor hook
1359 # always pass integer line and offset values to editor hook
1361 self.hooks.fix_error_editor(e.filename,
1360 self.hooks.fix_error_editor(e.filename,
1362 int0(e.lineno),int0(e.offset),e.msg)
1361 int0(e.lineno),int0(e.offset),e.msg)
1363 return True
1362 return True
1364
1363
1365 def edit_syntax_error(self):
1364 def edit_syntax_error(self):
1366 """The bottom half of the syntax error handler called in the main loop.
1365 """The bottom half of the syntax error handler called in the main loop.
1367
1366
1368 Loop until syntax error is fixed or user cancels.
1367 Loop until syntax error is fixed or user cancels.
1369 """
1368 """
1370
1369
1371 while self.SyntaxTB.last_syntax_error:
1370 while self.SyntaxTB.last_syntax_error:
1372 # copy and clear last_syntax_error
1371 # copy and clear last_syntax_error
1373 err = self.SyntaxTB.clear_err_state()
1372 err = self.SyntaxTB.clear_err_state()
1374 if not self._should_recompile(err):
1373 if not self._should_recompile(err):
1375 return
1374 return
1376 try:
1375 try:
1377 # may set last_syntax_error again if a SyntaxError is raised
1376 # may set last_syntax_error again if a SyntaxError is raised
1378 self.safe_execfile(err.filename,self.user_ns)
1377 self.safe_execfile(err.filename,self.user_ns)
1379 except:
1378 except:
1380 self.showtraceback()
1379 self.showtraceback()
1381 else:
1380 else:
1382 try:
1381 try:
1383 f = file(err.filename)
1382 f = file(err.filename)
1384 try:
1383 try:
1385 sys.displayhook(f.read())
1384 sys.displayhook(f.read())
1386 finally:
1385 finally:
1387 f.close()
1386 f.close()
1388 except:
1387 except:
1389 self.showtraceback()
1388 self.showtraceback()
1390
1389
1391 def showsyntaxerror(self, filename=None):
1390 def showsyntaxerror(self, filename=None):
1392 """Display the syntax error that just occurred.
1391 """Display the syntax error that just occurred.
1393
1392
1394 This doesn't display a stack trace because there isn't one.
1393 This doesn't display a stack trace because there isn't one.
1395
1394
1396 If a filename is given, it is stuffed in the exception instead
1395 If a filename is given, it is stuffed in the exception instead
1397 of what was there before (because Python's parser always uses
1396 of what was there before (because Python's parser always uses
1398 "<string>" when reading from a string).
1397 "<string>" when reading from a string).
1399 """
1398 """
1400 etype, value, last_traceback = sys.exc_info()
1399 etype, value, last_traceback = sys.exc_info()
1401
1400
1402 # See note about these variables in showtraceback() below
1401 # See note about these variables in showtraceback() below
1403 sys.last_type = etype
1402 sys.last_type = etype
1404 sys.last_value = value
1403 sys.last_value = value
1405 sys.last_traceback = last_traceback
1404 sys.last_traceback = last_traceback
1406
1405
1407 if filename and etype is SyntaxError:
1406 if filename and etype is SyntaxError:
1408 # Work hard to stuff the correct filename in the exception
1407 # Work hard to stuff the correct filename in the exception
1409 try:
1408 try:
1410 msg, (dummy_filename, lineno, offset, line) = value
1409 msg, (dummy_filename, lineno, offset, line) = value
1411 except:
1410 except:
1412 # Not the format we expect; leave it alone
1411 # Not the format we expect; leave it alone
1413 pass
1412 pass
1414 else:
1413 else:
1415 # Stuff in the right filename
1414 # Stuff in the right filename
1416 try:
1415 try:
1417 # Assume SyntaxError is a class exception
1416 # Assume SyntaxError is a class exception
1418 value = SyntaxError(msg, (filename, lineno, offset, line))
1417 value = SyntaxError(msg, (filename, lineno, offset, line))
1419 except:
1418 except:
1420 # If that failed, assume SyntaxError is a string
1419 # If that failed, assume SyntaxError is a string
1421 value = msg, (filename, lineno, offset, line)
1420 value = msg, (filename, lineno, offset, line)
1422 self.SyntaxTB(etype,value,[])
1421 self.SyntaxTB(etype,value,[])
1423
1422
1424 def debugger(self,force=False):
1423 def debugger(self,force=False):
1425 """Call the pydb/pdb debugger.
1424 """Call the pydb/pdb debugger.
1426
1425
1427 Keywords:
1426 Keywords:
1428
1427
1429 - force(False): by default, this routine checks the instance call_pdb
1428 - force(False): by default, this routine checks the instance call_pdb
1430 flag and does not actually invoke the debugger if the flag is false.
1429 flag and does not actually invoke the debugger if the flag is false.
1431 The 'force' option forces the debugger to activate even if the flag
1430 The 'force' option forces the debugger to activate even if the flag
1432 is false.
1431 is false.
1433 """
1432 """
1434
1433
1435 if not (force or self.call_pdb):
1434 if not (force or self.call_pdb):
1436 return
1435 return
1437
1436
1438 if not hasattr(sys,'last_traceback'):
1437 if not hasattr(sys,'last_traceback'):
1439 error('No traceback has been produced, nothing to debug.')
1438 error('No traceback has been produced, nothing to debug.')
1440 return
1439 return
1441
1440
1442 have_pydb = False
1441 have_pydb = False
1443 # use pydb if available
1442 # use pydb if available
1444 try:
1443 try:
1445 from pydb import pm
1444 from pydb import pm
1446 have_pydb = True
1445 have_pydb = True
1447 except ImportError:
1446 except ImportError:
1448 pass
1447 pass
1449 if not have_pydb:
1448 if not have_pydb:
1450 # fallback to our internal debugger
1449 # fallback to our internal debugger
1451 pm = lambda : self.InteractiveTB.debugger(force=True)
1450 pm = lambda : self.InteractiveTB.debugger(force=True)
1452 self.history_saving_wrapper(pm)()
1451 self.history_saving_wrapper(pm)()
1453
1452
1454 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1453 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1455 """Display the exception that just occurred.
1454 """Display the exception that just occurred.
1456
1455
1457 If nothing is known about the exception, this is the method which
1456 If nothing is known about the exception, this is the method which
1458 should be used throughout the code for presenting user tracebacks,
1457 should be used throughout the code for presenting user tracebacks,
1459 rather than directly invoking the InteractiveTB object.
1458 rather than directly invoking the InteractiveTB object.
1460
1459
1461 A specific showsyntaxerror() also exists, but this method can take
1460 A specific showsyntaxerror() also exists, but this method can take
1462 care of calling it if needed, so unless you are explicitly catching a
1461 care of calling it if needed, so unless you are explicitly catching a
1463 SyntaxError exception, don't try to analyze the stack manually and
1462 SyntaxError exception, don't try to analyze the stack manually and
1464 simply call this method."""
1463 simply call this method."""
1465
1464
1466 # Though this won't be called by syntax errors in the input line,
1465 # Though this won't be called by syntax errors in the input line,
1467 # there may be SyntaxError cases whith imported code.
1466 # there may be SyntaxError cases whith imported code.
1468 if exc_tuple is None:
1467 if exc_tuple is None:
1469 etype, value, tb = sys.exc_info()
1468 etype, value, tb = sys.exc_info()
1470 else:
1469 else:
1471 etype, value, tb = exc_tuple
1470 etype, value, tb = exc_tuple
1472
1471
1473 if etype is SyntaxError:
1472 if etype is SyntaxError:
1474 self.showsyntaxerror(filename)
1473 self.showsyntaxerror(filename)
1475 else:
1474 else:
1476 # WARNING: these variables are somewhat deprecated and not
1475 # WARNING: these variables are somewhat deprecated and not
1477 # necessarily safe to use in a threaded environment, but tools
1476 # necessarily safe to use in a threaded environment, but tools
1478 # like pdb depend on their existence, so let's set them. If we
1477 # like pdb depend on their existence, so let's set them. If we
1479 # find problems in the field, we'll need to revisit their use.
1478 # find problems in the field, we'll need to revisit their use.
1480 sys.last_type = etype
1479 sys.last_type = etype
1481 sys.last_value = value
1480 sys.last_value = value
1482 sys.last_traceback = tb
1481 sys.last_traceback = tb
1483
1482
1484 if etype in self.custom_exceptions:
1483 if etype in self.custom_exceptions:
1485 self.CustomTB(etype,value,tb)
1484 self.CustomTB(etype,value,tb)
1486 else:
1485 else:
1487 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1486 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1488 if self.InteractiveTB.call_pdb and self.has_readline:
1487 if self.InteractiveTB.call_pdb and self.has_readline:
1489 # pdb mucks up readline, fix it back
1488 # pdb mucks up readline, fix it back
1490 self.readline.set_completer(self.Completer.complete)
1489 self.readline.set_completer(self.Completer.complete)
1491
1490
1492 def mainloop(self,banner=None):
1491 def mainloop(self,banner=None):
1493 """Creates the local namespace and starts the mainloop.
1492 """Creates the local namespace and starts the mainloop.
1494
1493
1495 If an optional banner argument is given, it will override the
1494 If an optional banner argument is given, it will override the
1496 internally created default banner."""
1495 internally created default banner."""
1497
1496
1498 if self.rc.c: # Emulate Python's -c option
1497 if self.rc.c: # Emulate Python's -c option
1499 self.exec_init_cmd()
1498 self.exec_init_cmd()
1500 if banner is None:
1499 if banner is None:
1501 if not self.rc.banner:
1500 if not self.rc.banner:
1502 banner = ''
1501 banner = ''
1503 # banner is string? Use it directly!
1502 # banner is string? Use it directly!
1504 elif isinstance(self.rc.banner,basestring):
1503 elif isinstance(self.rc.banner,basestring):
1505 banner = self.rc.banner
1504 banner = self.rc.banner
1506 else:
1505 else:
1507 banner = self.BANNER+self.banner2
1506 banner = self.BANNER+self.banner2
1508
1507
1509 self.interact(banner)
1508 self.interact(banner)
1510
1509
1511 def exec_init_cmd(self):
1510 def exec_init_cmd(self):
1512 """Execute a command given at the command line.
1511 """Execute a command given at the command line.
1513
1512
1514 This emulates Python's -c option."""
1513 This emulates Python's -c option."""
1515
1514
1516 #sys.argv = ['-c']
1515 #sys.argv = ['-c']
1517 self.push(self.rc.c)
1516 self.push(self.rc.c)
1518
1517
1519 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1518 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1520 """Embeds IPython into a running python program.
1519 """Embeds IPython into a running python program.
1521
1520
1522 Input:
1521 Input:
1523
1522
1524 - header: An optional header message can be specified.
1523 - header: An optional header message can be specified.
1525
1524
1526 - local_ns, global_ns: working namespaces. If given as None, the
1525 - local_ns, global_ns: working namespaces. If given as None, the
1527 IPython-initialized one is updated with __main__.__dict__, so that
1526 IPython-initialized one is updated with __main__.__dict__, so that
1528 program variables become visible but user-specific configuration
1527 program variables become visible but user-specific configuration
1529 remains possible.
1528 remains possible.
1530
1529
1531 - stack_depth: specifies how many levels in the stack to go to
1530 - stack_depth: specifies how many levels in the stack to go to
1532 looking for namespaces (when local_ns and global_ns are None). This
1531 looking for namespaces (when local_ns and global_ns are None). This
1533 allows an intermediate caller to make sure that this function gets
1532 allows an intermediate caller to make sure that this function gets
1534 the namespace from the intended level in the stack. By default (0)
1533 the namespace from the intended level in the stack. By default (0)
1535 it will get its locals and globals from the immediate caller.
1534 it will get its locals and globals from the immediate caller.
1536
1535
1537 Warning: it's possible to use this in a program which is being run by
1536 Warning: it's possible to use this in a program which is being run by
1538 IPython itself (via %run), but some funny things will happen (a few
1537 IPython itself (via %run), but some funny things will happen (a few
1539 globals get overwritten). In the future this will be cleaned up, as
1538 globals get overwritten). In the future this will be cleaned up, as
1540 there is no fundamental reason why it can't work perfectly."""
1539 there is no fundamental reason why it can't work perfectly."""
1541
1540
1542 # Get locals and globals from caller
1541 # Get locals and globals from caller
1543 if local_ns is None or global_ns is None:
1542 if local_ns is None or global_ns is None:
1544 call_frame = sys._getframe(stack_depth).f_back
1543 call_frame = sys._getframe(stack_depth).f_back
1545
1544
1546 if local_ns is None:
1545 if local_ns is None:
1547 local_ns = call_frame.f_locals
1546 local_ns = call_frame.f_locals
1548 if global_ns is None:
1547 if global_ns is None:
1549 global_ns = call_frame.f_globals
1548 global_ns = call_frame.f_globals
1550
1549
1551 # Update namespaces and fire up interpreter
1550 # Update namespaces and fire up interpreter
1552
1551
1553 # The global one is easy, we can just throw it in
1552 # The global one is easy, we can just throw it in
1554 self.user_global_ns = global_ns
1553 self.user_global_ns = global_ns
1555
1554
1556 # but the user/local one is tricky: ipython needs it to store internal
1555 # but the user/local one is tricky: ipython needs it to store internal
1557 # data, but we also need the locals. We'll copy locals in the user
1556 # data, but we also need the locals. We'll copy locals in the user
1558 # one, but will track what got copied so we can delete them at exit.
1557 # one, but will track what got copied so we can delete them at exit.
1559 # This is so that a later embedded call doesn't see locals from a
1558 # This is so that a later embedded call doesn't see locals from a
1560 # previous call (which most likely existed in a separate scope).
1559 # previous call (which most likely existed in a separate scope).
1561 local_varnames = local_ns.keys()
1560 local_varnames = local_ns.keys()
1562 self.user_ns.update(local_ns)
1561 self.user_ns.update(local_ns)
1563
1562
1564 # Patch for global embedding to make sure that things don't overwrite
1563 # Patch for global embedding to make sure that things don't overwrite
1565 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1564 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1566 # FIXME. Test this a bit more carefully (the if.. is new)
1565 # FIXME. Test this a bit more carefully (the if.. is new)
1567 if local_ns is None and global_ns is None:
1566 if local_ns is None and global_ns is None:
1568 self.user_global_ns.update(__main__.__dict__)
1567 self.user_global_ns.update(__main__.__dict__)
1569
1568
1570 # make sure the tab-completer has the correct frame information, so it
1569 # make sure the tab-completer has the correct frame information, so it
1571 # actually completes using the frame's locals/globals
1570 # actually completes using the frame's locals/globals
1572 self.set_completer_frame()
1571 self.set_completer_frame()
1573
1572
1574 # before activating the interactive mode, we need to make sure that
1573 # before activating the interactive mode, we need to make sure that
1575 # all names in the builtin namespace needed by ipython point to
1574 # all names in the builtin namespace needed by ipython point to
1576 # ourselves, and not to other instances.
1575 # ourselves, and not to other instances.
1577 self.add_builtins()
1576 self.add_builtins()
1578
1577
1579 self.interact(header)
1578 self.interact(header)
1580
1579
1581 # now, purge out the user namespace from anything we might have added
1580 # now, purge out the user namespace from anything we might have added
1582 # from the caller's local namespace
1581 # from the caller's local namespace
1583 delvar = self.user_ns.pop
1582 delvar = self.user_ns.pop
1584 for var in local_varnames:
1583 for var in local_varnames:
1585 delvar(var,None)
1584 delvar(var,None)
1586 # and clean builtins we may have overridden
1585 # and clean builtins we may have overridden
1587 self.clean_builtins()
1586 self.clean_builtins()
1588
1587
1589 def interact(self, banner=None):
1588 def interact(self, banner=None):
1590 """Closely emulate the interactive Python console.
1589 """Closely emulate the interactive Python console.
1591
1590
1592 The optional banner argument specify the banner to print
1591 The optional banner argument specify the banner to print
1593 before the first interaction; by default it prints a banner
1592 before the first interaction; by default it prints a banner
1594 similar to the one printed by the real Python interpreter,
1593 similar to the one printed by the real Python interpreter,
1595 followed by the current class name in parentheses (so as not
1594 followed by the current class name in parentheses (so as not
1596 to confuse this with the real interpreter -- since it's so
1595 to confuse this with the real interpreter -- since it's so
1597 close!).
1596 close!).
1598
1597
1599 """
1598 """
1600
1599
1601 if self.exit_now:
1600 if self.exit_now:
1602 # batch run -> do not interact
1601 # batch run -> do not interact
1603 return
1602 return
1604 cprt = 'Type "copyright", "credits" or "license" for more information.'
1603 cprt = 'Type "copyright", "credits" or "license" for more information.'
1605 if banner is None:
1604 if banner is None:
1606 self.write("Python %s on %s\n%s\n(%s)\n" %
1605 self.write("Python %s on %s\n%s\n(%s)\n" %
1607 (sys.version, sys.platform, cprt,
1606 (sys.version, sys.platform, cprt,
1608 self.__class__.__name__))
1607 self.__class__.__name__))
1609 else:
1608 else:
1610 self.write(banner)
1609 self.write(banner)
1611
1610
1612 more = 0
1611 more = 0
1613
1612
1614 # Mark activity in the builtins
1613 # Mark activity in the builtins
1615 __builtin__.__dict__['__IPYTHON__active'] += 1
1614 __builtin__.__dict__['__IPYTHON__active'] += 1
1616
1615
1617 # exit_now is set by a call to %Exit or %Quit
1616 # exit_now is set by a call to %Exit or %Quit
1618 while not self.exit_now:
1617 while not self.exit_now:
1619 if more:
1618 if more:
1620 prompt = self.hooks.generate_prompt(True)
1619 prompt = self.hooks.generate_prompt(True)
1621 if self.autoindent:
1620 if self.autoindent:
1622 self.readline_startup_hook(self.pre_readline)
1621 self.readline_startup_hook(self.pre_readline)
1623 else:
1622 else:
1624 prompt = self.hooks.generate_prompt(False)
1623 prompt = self.hooks.generate_prompt(False)
1625 try:
1624 try:
1626 line = self.raw_input(prompt,more)
1625 line = self.raw_input(prompt,more)
1627 if self.exit_now:
1626 if self.exit_now:
1628 # quick exit on sys.std[in|out] close
1627 # quick exit on sys.std[in|out] close
1629 break
1628 break
1630 if self.autoindent:
1629 if self.autoindent:
1631 self.readline_startup_hook(None)
1630 self.readline_startup_hook(None)
1632 except KeyboardInterrupt:
1631 except KeyboardInterrupt:
1633 self.write('\nKeyboardInterrupt\n')
1632 self.write('\nKeyboardInterrupt\n')
1634 self.resetbuffer()
1633 self.resetbuffer()
1635 # keep cache in sync with the prompt counter:
1634 # keep cache in sync with the prompt counter:
1636 self.outputcache.prompt_count -= 1
1635 self.outputcache.prompt_count -= 1
1637
1636
1638 if self.autoindent:
1637 if self.autoindent:
1639 self.indent_current_nsp = 0
1638 self.indent_current_nsp = 0
1640 more = 0
1639 more = 0
1641 except EOFError:
1640 except EOFError:
1642 if self.autoindent:
1641 if self.autoindent:
1643 self.readline_startup_hook(None)
1642 self.readline_startup_hook(None)
1644 self.write('\n')
1643 self.write('\n')
1645 self.exit()
1644 self.exit()
1646 except bdb.BdbQuit:
1645 except bdb.BdbQuit:
1647 warn('The Python debugger has exited with a BdbQuit exception.\n'
1646 warn('The Python debugger has exited with a BdbQuit exception.\n'
1648 'Because of how pdb handles the stack, it is impossible\n'
1647 'Because of how pdb handles the stack, it is impossible\n'
1649 'for IPython to properly format this particular exception.\n'
1648 'for IPython to properly format this particular exception.\n'
1650 'IPython will resume normal operation.')
1649 'IPython will resume normal operation.')
1651 except:
1650 except:
1652 # exceptions here are VERY RARE, but they can be triggered
1651 # exceptions here are VERY RARE, but they can be triggered
1653 # asynchronously by signal handlers, for example.
1652 # asynchronously by signal handlers, for example.
1654 self.showtraceback()
1653 self.showtraceback()
1655 else:
1654 else:
1656 more = self.push(line)
1655 more = self.push(line)
1657 if (self.SyntaxTB.last_syntax_error and
1656 if (self.SyntaxTB.last_syntax_error and
1658 self.rc.autoedit_syntax):
1657 self.rc.autoedit_syntax):
1659 self.edit_syntax_error()
1658 self.edit_syntax_error()
1660
1659
1661 # We are off again...
1660 # We are off again...
1662 __builtin__.__dict__['__IPYTHON__active'] -= 1
1661 __builtin__.__dict__['__IPYTHON__active'] -= 1
1663
1662
1664 def excepthook(self, etype, value, tb):
1663 def excepthook(self, etype, value, tb):
1665 """One more defense for GUI apps that call sys.excepthook.
1664 """One more defense for GUI apps that call sys.excepthook.
1666
1665
1667 GUI frameworks like wxPython trap exceptions and call
1666 GUI frameworks like wxPython trap exceptions and call
1668 sys.excepthook themselves. I guess this is a feature that
1667 sys.excepthook themselves. I guess this is a feature that
1669 enables them to keep running after exceptions that would
1668 enables them to keep running after exceptions that would
1670 otherwise kill their mainloop. This is a bother for IPython
1669 otherwise kill their mainloop. This is a bother for IPython
1671 which excepts to catch all of the program exceptions with a try:
1670 which excepts to catch all of the program exceptions with a try:
1672 except: statement.
1671 except: statement.
1673
1672
1674 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1673 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1675 any app directly invokes sys.excepthook, it will look to the user like
1674 any app directly invokes sys.excepthook, it will look to the user like
1676 IPython crashed. In order to work around this, we can disable the
1675 IPython crashed. In order to work around this, we can disable the
1677 CrashHandler and replace it with this excepthook instead, which prints a
1676 CrashHandler and replace it with this excepthook instead, which prints a
1678 regular traceback using our InteractiveTB. In this fashion, apps which
1677 regular traceback using our InteractiveTB. In this fashion, apps which
1679 call sys.excepthook will generate a regular-looking exception from
1678 call sys.excepthook will generate a regular-looking exception from
1680 IPython, and the CrashHandler will only be triggered by real IPython
1679 IPython, and the CrashHandler will only be triggered by real IPython
1681 crashes.
1680 crashes.
1682
1681
1683 This hook should be used sparingly, only in places which are not likely
1682 This hook should be used sparingly, only in places which are not likely
1684 to be true IPython errors.
1683 to be true IPython errors.
1685 """
1684 """
1686 self.showtraceback((etype,value,tb),tb_offset=0)
1685 self.showtraceback((etype,value,tb),tb_offset=0)
1687
1686
1688 def expand_aliases(self,fn,rest):
1687 def expand_aliases(self,fn,rest):
1689 """ Expand multiple levels of aliases:
1688 """ Expand multiple levels of aliases:
1690
1689
1691 if:
1690 if:
1692
1691
1693 alias foo bar /tmp
1692 alias foo bar /tmp
1694 alias baz foo
1693 alias baz foo
1695
1694
1696 then:
1695 then:
1697
1696
1698 baz huhhahhei -> bar /tmp huhhahhei
1697 baz huhhahhei -> bar /tmp huhhahhei
1699
1698
1700 """
1699 """
1701 line = fn + " " + rest
1700 line = fn + " " + rest
1702
1701
1703 done = Set()
1702 done = Set()
1704 while 1:
1703 while 1:
1705 pre,fn,rest = self.split_user_input(line)
1704 pre,fn,rest = self.split_user_input(line)
1706 if fn in self.alias_table:
1705 if fn in self.alias_table:
1707 if fn in done:
1706 if fn in done:
1708 warn("Cyclic alias definition, repeated '%s'" % fn)
1707 warn("Cyclic alias definition, repeated '%s'" % fn)
1709 return ""
1708 return ""
1710 done.add(fn)
1709 done.add(fn)
1711
1710
1712 l2 = self.transform_alias(fn,rest)
1711 l2 = self.transform_alias(fn,rest)
1713 # dir -> dir
1712 # dir -> dir
1714 # print "alias",line, "->",l2 #dbg
1713 # print "alias",line, "->",l2 #dbg
1715 if l2 == line:
1714 if l2 == line:
1716 break
1715 break
1717 # ls -> ls -F should not recurse forever
1716 # ls -> ls -F should not recurse forever
1718 if l2.split(None,1)[0] == line.split(None,1)[0]:
1717 if l2.split(None,1)[0] == line.split(None,1)[0]:
1719 line = l2
1718 line = l2
1720 break
1719 break
1721
1720
1722 line=l2
1721 line=l2
1723
1722
1724
1723
1725 # print "al expand to",line #dbg
1724 # print "al expand to",line #dbg
1726 else:
1725 else:
1727 break
1726 break
1728
1727
1729 return line
1728 return line
1730
1729
1731 def transform_alias(self, alias,rest=''):
1730 def transform_alias(self, alias,rest=''):
1732 """ Transform alias to system command string.
1731 """ Transform alias to system command string.
1733 """
1732 """
1734 nargs,cmd = self.alias_table[alias]
1733 nargs,cmd = self.alias_table[alias]
1735 if ' ' in cmd and os.path.isfile(cmd):
1734 if ' ' in cmd and os.path.isfile(cmd):
1736 cmd = '"%s"' % cmd
1735 cmd = '"%s"' % cmd
1737
1736
1738 # Expand the %l special to be the user's input line
1737 # Expand the %l special to be the user's input line
1739 if cmd.find('%l') >= 0:
1738 if cmd.find('%l') >= 0:
1740 cmd = cmd.replace('%l',rest)
1739 cmd = cmd.replace('%l',rest)
1741 rest = ''
1740 rest = ''
1742 if nargs==0:
1741 if nargs==0:
1743 # Simple, argument-less aliases
1742 # Simple, argument-less aliases
1744 cmd = '%s %s' % (cmd,rest)
1743 cmd = '%s %s' % (cmd,rest)
1745 else:
1744 else:
1746 # Handle aliases with positional arguments
1745 # Handle aliases with positional arguments
1747 args = rest.split(None,nargs)
1746 args = rest.split(None,nargs)
1748 if len(args)< nargs:
1747 if len(args)< nargs:
1749 error('Alias <%s> requires %s arguments, %s given.' %
1748 error('Alias <%s> requires %s arguments, %s given.' %
1750 (alias,nargs,len(args)))
1749 (alias,nargs,len(args)))
1751 return None
1750 return None
1752 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1751 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1753 # Now call the macro, evaluating in the user's namespace
1752 # Now call the macro, evaluating in the user's namespace
1754 #print 'new command: <%r>' % cmd # dbg
1753 #print 'new command: <%r>' % cmd # dbg
1755 return cmd
1754 return cmd
1756
1755
1757 def call_alias(self,alias,rest=''):
1756 def call_alias(self,alias,rest=''):
1758 """Call an alias given its name and the rest of the line.
1757 """Call an alias given its name and the rest of the line.
1759
1758
1760 This is only used to provide backwards compatibility for users of
1759 This is only used to provide backwards compatibility for users of
1761 ipalias(), use of which is not recommended for anymore."""
1760 ipalias(), use of which is not recommended for anymore."""
1762
1761
1763 # Now call the macro, evaluating in the user's namespace
1762 # Now call the macro, evaluating in the user's namespace
1764 cmd = self.transform_alias(alias, rest)
1763 cmd = self.transform_alias(alias, rest)
1765 try:
1764 try:
1766 self.system(cmd)
1765 self.system(cmd)
1767 except:
1766 except:
1768 self.showtraceback()
1767 self.showtraceback()
1769
1768
1770 def indent_current_str(self):
1769 def indent_current_str(self):
1771 """return the current level of indentation as a string"""
1770 """return the current level of indentation as a string"""
1772 return self.indent_current_nsp * ' '
1771 return self.indent_current_nsp * ' '
1773
1772
1774 def autoindent_update(self,line):
1773 def autoindent_update(self,line):
1775 """Keep track of the indent level."""
1774 """Keep track of the indent level."""
1776
1775
1777 #debugx('line')
1776 #debugx('line')
1778 #debugx('self.indent_current_nsp')
1777 #debugx('self.indent_current_nsp')
1779 if self.autoindent:
1778 if self.autoindent:
1780 if line:
1779 if line:
1781 inisp = num_ini_spaces(line)
1780 inisp = num_ini_spaces(line)
1782 if inisp < self.indent_current_nsp:
1781 if inisp < self.indent_current_nsp:
1783 self.indent_current_nsp = inisp
1782 self.indent_current_nsp = inisp
1784
1783
1785 if line[-1] == ':':
1784 if line[-1] == ':':
1786 self.indent_current_nsp += 4
1785 self.indent_current_nsp += 4
1787 elif dedent_re.match(line):
1786 elif dedent_re.match(line):
1788 self.indent_current_nsp -= 4
1787 self.indent_current_nsp -= 4
1789 else:
1788 else:
1790 self.indent_current_nsp = 0
1789 self.indent_current_nsp = 0
1791
1790
1792 def runlines(self,lines):
1791 def runlines(self,lines):
1793 """Run a string of one or more lines of source.
1792 """Run a string of one or more lines of source.
1794
1793
1795 This method is capable of running a string containing multiple source
1794 This method is capable of running a string containing multiple source
1796 lines, as if they had been entered at the IPython prompt. Since it
1795 lines, as if they had been entered at the IPython prompt. Since it
1797 exposes IPython's processing machinery, the given strings can contain
1796 exposes IPython's processing machinery, the given strings can contain
1798 magic calls (%magic), special shell access (!cmd), etc."""
1797 magic calls (%magic), special shell access (!cmd), etc."""
1799
1798
1800 # We must start with a clean buffer, in case this is run from an
1799 # We must start with a clean buffer, in case this is run from an
1801 # interactive IPython session (via a magic, for example).
1800 # interactive IPython session (via a magic, for example).
1802 self.resetbuffer()
1801 self.resetbuffer()
1803 lines = lines.split('\n')
1802 lines = lines.split('\n')
1804 more = 0
1803 more = 0
1805 for line in lines:
1804 for line in lines:
1806 # skip blank lines so we don't mess up the prompt counter, but do
1805 # skip blank lines so we don't mess up the prompt counter, but do
1807 # NOT skip even a blank line if we are in a code block (more is
1806 # NOT skip even a blank line if we are in a code block (more is
1808 # true)
1807 # true)
1809 if line or more:
1808 if line or more:
1810 more = self.push(self.prefilter(line,more))
1809 more = self.push(self.prefilter(line,more))
1811 # IPython's runsource returns None if there was an error
1810 # IPython's runsource returns None if there was an error
1812 # compiling the code. This allows us to stop processing right
1811 # compiling the code. This allows us to stop processing right
1813 # away, so the user gets the error message at the right place.
1812 # away, so the user gets the error message at the right place.
1814 if more is None:
1813 if more is None:
1815 break
1814 break
1816 # final newline in case the input didn't have it, so that the code
1815 # final newline in case the input didn't have it, so that the code
1817 # actually does get executed
1816 # actually does get executed
1818 if more:
1817 if more:
1819 self.push('\n')
1818 self.push('\n')
1820
1819
1821 def runsource(self, source, filename='<input>', symbol='single'):
1820 def runsource(self, source, filename='<input>', symbol='single'):
1822 """Compile and run some source in the interpreter.
1821 """Compile and run some source in the interpreter.
1823
1822
1824 Arguments are as for compile_command().
1823 Arguments are as for compile_command().
1825
1824
1826 One several things can happen:
1825 One several things can happen:
1827
1826
1828 1) The input is incorrect; compile_command() raised an
1827 1) The input is incorrect; compile_command() raised an
1829 exception (SyntaxError or OverflowError). A syntax traceback
1828 exception (SyntaxError or OverflowError). A syntax traceback
1830 will be printed by calling the showsyntaxerror() method.
1829 will be printed by calling the showsyntaxerror() method.
1831
1830
1832 2) The input is incomplete, and more input is required;
1831 2) The input is incomplete, and more input is required;
1833 compile_command() returned None. Nothing happens.
1832 compile_command() returned None. Nothing happens.
1834
1833
1835 3) The input is complete; compile_command() returned a code
1834 3) The input is complete; compile_command() returned a code
1836 object. The code is executed by calling self.runcode() (which
1835 object. The code is executed by calling self.runcode() (which
1837 also handles run-time exceptions, except for SystemExit).
1836 also handles run-time exceptions, except for SystemExit).
1838
1837
1839 The return value is:
1838 The return value is:
1840
1839
1841 - True in case 2
1840 - True in case 2
1842
1841
1843 - False in the other cases, unless an exception is raised, where
1842 - False in the other cases, unless an exception is raised, where
1844 None is returned instead. This can be used by external callers to
1843 None is returned instead. This can be used by external callers to
1845 know whether to continue feeding input or not.
1844 know whether to continue feeding input or not.
1846
1845
1847 The return value can be used to decide whether to use sys.ps1 or
1846 The return value can be used to decide whether to use sys.ps1 or
1848 sys.ps2 to prompt the next line."""
1847 sys.ps2 to prompt the next line."""
1849
1848
1850 # if the source code has leading blanks, add 'if 1:\n' to it
1849 # if the source code has leading blanks, add 'if 1:\n' to it
1851 # this allows execution of indented pasted code. It is tempting
1850 # this allows execution of indented pasted code. It is tempting
1852 # to add '\n' at the end of source to run commands like ' a=1'
1851 # to add '\n' at the end of source to run commands like ' a=1'
1853 # directly, but this fails for more complicated scenarios
1852 # directly, but this fails for more complicated scenarios
1854 if source[:1] in [' ', '\t']:
1853 if source[:1] in [' ', '\t']:
1855 source = 'if 1:\n%s' % source
1854 source = 'if 1:\n%s' % source
1856
1855
1857 try:
1856 try:
1858 code = self.compile(source,filename,symbol)
1857 code = self.compile(source,filename,symbol)
1859 except (OverflowError, SyntaxError, ValueError):
1858 except (OverflowError, SyntaxError, ValueError):
1860 # Case 1
1859 # Case 1
1861 self.showsyntaxerror(filename)
1860 self.showsyntaxerror(filename)
1862 return None
1861 return None
1863
1862
1864 if code is None:
1863 if code is None:
1865 # Case 2
1864 # Case 2
1866 return True
1865 return True
1867
1866
1868 # Case 3
1867 # Case 3
1869 # We store the code object so that threaded shells and
1868 # We store the code object so that threaded shells and
1870 # custom exception handlers can access all this info if needed.
1869 # custom exception handlers can access all this info if needed.
1871 # The source corresponding to this can be obtained from the
1870 # The source corresponding to this can be obtained from the
1872 # buffer attribute as '\n'.join(self.buffer).
1871 # buffer attribute as '\n'.join(self.buffer).
1873 self.code_to_run = code
1872 self.code_to_run = code
1874 # now actually execute the code object
1873 # now actually execute the code object
1875 if self.runcode(code) == 0:
1874 if self.runcode(code) == 0:
1876 return False
1875 return False
1877 else:
1876 else:
1878 return None
1877 return None
1879
1878
1880 def runcode(self,code_obj):
1879 def runcode(self,code_obj):
1881 """Execute a code object.
1880 """Execute a code object.
1882
1881
1883 When an exception occurs, self.showtraceback() is called to display a
1882 When an exception occurs, self.showtraceback() is called to display a
1884 traceback.
1883 traceback.
1885
1884
1886 Return value: a flag indicating whether the code to be run completed
1885 Return value: a flag indicating whether the code to be run completed
1887 successfully:
1886 successfully:
1888
1887
1889 - 0: successful execution.
1888 - 0: successful execution.
1890 - 1: an error occurred.
1889 - 1: an error occurred.
1891 """
1890 """
1892
1891
1893 # Set our own excepthook in case the user code tries to call it
1892 # Set our own excepthook in case the user code tries to call it
1894 # directly, so that the IPython crash handler doesn't get triggered
1893 # directly, so that the IPython crash handler doesn't get triggered
1895 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1894 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1896
1895
1897 # we save the original sys.excepthook in the instance, in case config
1896 # we save the original sys.excepthook in the instance, in case config
1898 # code (such as magics) needs access to it.
1897 # code (such as magics) needs access to it.
1899 self.sys_excepthook = old_excepthook
1898 self.sys_excepthook = old_excepthook
1900 outflag = 1 # happens in more places, so it's easier as default
1899 outflag = 1 # happens in more places, so it's easier as default
1901 try:
1900 try:
1902 try:
1901 try:
1903 # Embedded instances require separate global/local namespaces
1902 # Embedded instances require separate global/local namespaces
1904 # so they can see both the surrounding (local) namespace and
1903 # so they can see both the surrounding (local) namespace and
1905 # the module-level globals when called inside another function.
1904 # the module-level globals when called inside another function.
1906 if self.embedded:
1905 if self.embedded:
1907 exec code_obj in self.user_global_ns, self.user_ns
1906 exec code_obj in self.user_global_ns, self.user_ns
1908 # Normal (non-embedded) instances should only have a single
1907 # Normal (non-embedded) instances should only have a single
1909 # namespace for user code execution, otherwise functions won't
1908 # namespace for user code execution, otherwise functions won't
1910 # see interactive top-level globals.
1909 # see interactive top-level globals.
1911 else:
1910 else:
1912 exec code_obj in self.user_ns
1911 exec code_obj in self.user_ns
1913 finally:
1912 finally:
1914 # Reset our crash handler in place
1913 # Reset our crash handler in place
1915 sys.excepthook = old_excepthook
1914 sys.excepthook = old_excepthook
1916 except SystemExit:
1915 except SystemExit:
1917 self.resetbuffer()
1916 self.resetbuffer()
1918 self.showtraceback()
1917 self.showtraceback()
1919 warn("Type %exit or %quit to exit IPython "
1918 warn("Type %exit or %quit to exit IPython "
1920 "(%Exit or %Quit do so unconditionally).",level=1)
1919 "(%Exit or %Quit do so unconditionally).",level=1)
1921 except self.custom_exceptions:
1920 except self.custom_exceptions:
1922 etype,value,tb = sys.exc_info()
1921 etype,value,tb = sys.exc_info()
1923 self.CustomTB(etype,value,tb)
1922 self.CustomTB(etype,value,tb)
1924 except:
1923 except:
1925 self.showtraceback()
1924 self.showtraceback()
1926 else:
1925 else:
1927 outflag = 0
1926 outflag = 0
1928 if softspace(sys.stdout, 0):
1927 if softspace(sys.stdout, 0):
1929 print
1928 print
1930 # Flush out code object which has been run (and source)
1929 # Flush out code object which has been run (and source)
1931 self.code_to_run = None
1930 self.code_to_run = None
1932 return outflag
1931 return outflag
1933
1932
1934 def push(self, line):
1933 def push(self, line):
1935 """Push a line to the interpreter.
1934 """Push a line to the interpreter.
1936
1935
1937 The line should not have a trailing newline; it may have
1936 The line should not have a trailing newline; it may have
1938 internal newlines. The line is appended to a buffer and the
1937 internal newlines. The line is appended to a buffer and the
1939 interpreter's runsource() method is called with the
1938 interpreter's runsource() method is called with the
1940 concatenated contents of the buffer as source. If this
1939 concatenated contents of the buffer as source. If this
1941 indicates that the command was executed or invalid, the buffer
1940 indicates that the command was executed or invalid, the buffer
1942 is reset; otherwise, the command is incomplete, and the buffer
1941 is reset; otherwise, the command is incomplete, and the buffer
1943 is left as it was after the line was appended. The return
1942 is left as it was after the line was appended. The return
1944 value is 1 if more input is required, 0 if the line was dealt
1943 value is 1 if more input is required, 0 if the line was dealt
1945 with in some way (this is the same as runsource()).
1944 with in some way (this is the same as runsource()).
1946 """
1945 """
1947
1946
1948 # autoindent management should be done here, and not in the
1947 # autoindent management should be done here, and not in the
1949 # interactive loop, since that one is only seen by keyboard input. We
1948 # interactive loop, since that one is only seen by keyboard input. We
1950 # need this done correctly even for code run via runlines (which uses
1949 # need this done correctly even for code run via runlines (which uses
1951 # push).
1950 # push).
1952
1951
1953 #print 'push line: <%s>' % line # dbg
1952 #print 'push line: <%s>' % line # dbg
1954 for subline in line.splitlines():
1953 for subline in line.splitlines():
1955 self.autoindent_update(subline)
1954 self.autoindent_update(subline)
1956 self.buffer.append(line)
1955 self.buffer.append(line)
1957 more = self.runsource('\n'.join(self.buffer), self.filename)
1956 more = self.runsource('\n'.join(self.buffer), self.filename)
1958 if not more:
1957 if not more:
1959 self.resetbuffer()
1958 self.resetbuffer()
1960 return more
1959 return more
1961
1960
1962 def resetbuffer(self):
1961 def resetbuffer(self):
1963 """Reset the input buffer."""
1962 """Reset the input buffer."""
1964 self.buffer[:] = []
1963 self.buffer[:] = []
1965
1964
1966 def raw_input(self,prompt='',continue_prompt=False):
1965 def raw_input(self,prompt='',continue_prompt=False):
1967 """Write a prompt and read a line.
1966 """Write a prompt and read a line.
1968
1967
1969 The returned line does not include the trailing newline.
1968 The returned line does not include the trailing newline.
1970 When the user enters the EOF key sequence, EOFError is raised.
1969 When the user enters the EOF key sequence, EOFError is raised.
1971
1970
1972 Optional inputs:
1971 Optional inputs:
1973
1972
1974 - prompt(''): a string to be printed to prompt the user.
1973 - prompt(''): a string to be printed to prompt the user.
1975
1974
1976 - continue_prompt(False): whether this line is the first one or a
1975 - continue_prompt(False): whether this line is the first one or a
1977 continuation in a sequence of inputs.
1976 continuation in a sequence of inputs.
1978 """
1977 """
1979
1978
1980 try:
1979 try:
1981 line = raw_input_original(prompt)
1980 line = raw_input_original(prompt)
1982 except ValueError:
1981 except ValueError:
1983 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1982 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1984 self.exit_now = True
1983 self.exit_now = True
1985 return ""
1984 return ""
1986
1985
1987
1986
1988 # Try to be reasonably smart about not re-indenting pasted input more
1987 # Try to be reasonably smart about not re-indenting pasted input more
1989 # than necessary. We do this by trimming out the auto-indent initial
1988 # than necessary. We do this by trimming out the auto-indent initial
1990 # spaces, if the user's actual input started itself with whitespace.
1989 # spaces, if the user's actual input started itself with whitespace.
1991 #debugx('self.buffer[-1]')
1990 #debugx('self.buffer[-1]')
1992
1991
1993 if self.autoindent:
1992 if self.autoindent:
1994 if num_ini_spaces(line) > self.indent_current_nsp:
1993 if num_ini_spaces(line) > self.indent_current_nsp:
1995 line = line[self.indent_current_nsp:]
1994 line = line[self.indent_current_nsp:]
1996 self.indent_current_nsp = 0
1995 self.indent_current_nsp = 0
1997
1996
1998 # store the unfiltered input before the user has any chance to modify
1997 # store the unfiltered input before the user has any chance to modify
1999 # it.
1998 # it.
2000 if line.strip():
1999 if line.strip():
2001 if continue_prompt:
2000 if continue_prompt:
2002 self.input_hist_raw[-1] += '%s\n' % line
2001 self.input_hist_raw[-1] += '%s\n' % line
2003 if self.has_readline: # and some config option is set?
2002 if self.has_readline: # and some config option is set?
2004 try:
2003 try:
2005 histlen = self.readline.get_current_history_length()
2004 histlen = self.readline.get_current_history_length()
2006 newhist = self.input_hist_raw[-1].rstrip()
2005 newhist = self.input_hist_raw[-1].rstrip()
2007 self.readline.remove_history_item(histlen-1)
2006 self.readline.remove_history_item(histlen-1)
2008 self.readline.replace_history_item(histlen-2,newhist)
2007 self.readline.replace_history_item(histlen-2,newhist)
2009 except AttributeError:
2008 except AttributeError:
2010 pass # re{move,place}_history_item are new in 2.4.
2009 pass # re{move,place}_history_item are new in 2.4.
2011 else:
2010 else:
2012 self.input_hist_raw.append('%s\n' % line)
2011 self.input_hist_raw.append('%s\n' % line)
2013
2012
2014 try:
2013 try:
2015 lineout = self.prefilter(line,continue_prompt)
2014 lineout = self.prefilter(line,continue_prompt)
2016 except:
2015 except:
2017 # blanket except, in case a user-defined prefilter crashes, so it
2016 # blanket except, in case a user-defined prefilter crashes, so it
2018 # can't take all of ipython with it.
2017 # can't take all of ipython with it.
2019 self.showtraceback()
2018 self.showtraceback()
2020 return ''
2019 return ''
2021 else:
2020 else:
2022 return lineout
2021 return lineout
2023
2022
2024 def split_user_input(self,line):
2023 def split_user_input(self,line):
2025 """Split user input into pre-char, function part and rest."""
2024 """Split user input into pre-char, function part and rest."""
2026
2025
2027 lsplit = self.line_split.match(line)
2026 lsplit = self.line_split.match(line)
2028 if lsplit is None: # no regexp match returns None
2027 if lsplit is None: # no regexp match returns None
2028 #print "match failed for line '%s'" % line # dbg
2029 try:
2029 try:
2030 iFun,theRest = line.split(None,1)
2030 iFun,theRest = line.split(None,1)
2031 except ValueError:
2031 except ValueError:
2032 #print "split failed for line '%s'" % line # dbg
2032 iFun,theRest = line,''
2033 iFun,theRest = line,''
2033 pre = re.match('^(\s*)(.*)',line).groups()[0]
2034 pre = re.match('^(\s*)(.*)',line).groups()[0]
2034 else:
2035 else:
2035 pre,iFun,theRest = lsplit.groups()
2036 pre,iFun,theRest = lsplit.groups()
2036
2037
2037 #print 'line:<%s>' % line # dbg
2038 #print 'line:<%s>' % line # dbg
2038 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2039 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2039 return pre,iFun.strip(),theRest
2040 return pre,iFun.strip(),theRest
2040
2041
2041
2042 # THIS VERSION IS BROKEN!!! It was intended to prevent spurious attribute
2042 def split_user_inputTMP(self,line):
2043 # accesses with a more stringent check of inputs, but it introduced other
2044 # bugs. Disable it for now until I can properly fix it.
2045 def split_user_inputBROKEN(self,line):
2043 """Split user input into pre-char, function part and rest."""
2046 """Split user input into pre-char, function part and rest."""
2044
2047
2045 lsplit = self.line_split.match(line)
2048 lsplit = self.line_split.match(line)
2046 if lsplit is None: # no regexp match returns None
2049 if lsplit is None: # no regexp match returns None
2047 lsplit = self.line_split_fallback.match(line)
2050 lsplit = self.line_split_fallback.match(line)
2048
2051
2049 #pre,iFun,theRest = lsplit.groups() # dbg
2052 #pre,iFun,theRest = lsplit.groups() # dbg
2050 #print 'line:<%s>' % line # dbg
2053 #print 'line:<%s>' % line # dbg
2051 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2054 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2052 #return pre,iFun.strip(),theRest # dbg
2055 #return pre,iFun.strip(),theRest # dbg
2053
2056
2054 return lsplit.groups()
2057 return lsplit.groups()
2055
2058
2056 def _prefilter(self, line, continue_prompt):
2059 def _prefilter(self, line, continue_prompt):
2057 """Calls different preprocessors, depending on the form of line."""
2060 """Calls different preprocessors, depending on the form of line."""
2058
2061
2059 # All handlers *must* return a value, even if it's blank ('').
2062 # All handlers *must* return a value, even if it's blank ('').
2060
2063
2061 # Lines are NOT logged here. Handlers should process the line as
2064 # Lines are NOT logged here. Handlers should process the line as
2062 # needed, update the cache AND log it (so that the input cache array
2065 # needed, update the cache AND log it (so that the input cache array
2063 # stays synced).
2066 # stays synced).
2064
2067
2065 # This function is _very_ delicate, and since it's also the one which
2068 # This function is _very_ delicate, and since it's also the one which
2066 # determines IPython's response to user input, it must be as efficient
2069 # determines IPython's response to user input, it must be as efficient
2067 # as possible. For this reason it has _many_ returns in it, trying
2070 # as possible. For this reason it has _many_ returns in it, trying
2068 # always to exit as quickly as it can figure out what it needs to do.
2071 # always to exit as quickly as it can figure out what it needs to do.
2069
2072
2070 # This function is the main responsible for maintaining IPython's
2073 # This function is the main responsible for maintaining IPython's
2071 # behavior respectful of Python's semantics. So be _very_ careful if
2074 # behavior respectful of Python's semantics. So be _very_ careful if
2072 # making changes to anything here.
2075 # making changes to anything here.
2073
2076
2074 #.....................................................................
2077 #.....................................................................
2075 # Code begins
2078 # Code begins
2076
2079
2077 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2080 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2078
2081
2079 # save the line away in case we crash, so the post-mortem handler can
2082 # save the line away in case we crash, so the post-mortem handler can
2080 # record it
2083 # record it
2081 self._last_input_line = line
2084 self._last_input_line = line
2082
2085
2083 #print '***line: <%s>' % line # dbg
2086 #print '***line: <%s>' % line # dbg
2084
2087
2085 # the input history needs to track even empty lines
2088 # the input history needs to track even empty lines
2086 stripped = line.strip()
2089 stripped = line.strip()
2087
2090
2088 if not stripped:
2091 if not stripped:
2089 if not continue_prompt:
2092 if not continue_prompt:
2090 self.outputcache.prompt_count -= 1
2093 self.outputcache.prompt_count -= 1
2091 return self.handle_normal(line,continue_prompt)
2094 return self.handle_normal(line,continue_prompt)
2092 #return self.handle_normal('',continue_prompt)
2095 #return self.handle_normal('',continue_prompt)
2093
2096
2094 # print '***cont',continue_prompt # dbg
2097 # print '***cont',continue_prompt # dbg
2095 # special handlers are only allowed for single line statements
2098 # special handlers are only allowed for single line statements
2096 if continue_prompt and not self.rc.multi_line_specials:
2099 if continue_prompt and not self.rc.multi_line_specials:
2097 return self.handle_normal(line,continue_prompt)
2100 return self.handle_normal(line,continue_prompt)
2098
2101
2099
2102
2100 # For the rest, we need the structure of the input
2103 # For the rest, we need the structure of the input
2101 pre,iFun,theRest = self.split_user_input(line)
2104 pre,iFun,theRest = self.split_user_input(line)
2102
2105
2103 # See whether any pre-existing handler can take care of it
2106 # See whether any pre-existing handler can take care of it
2104
2107
2105 rewritten = self.hooks.input_prefilter(stripped)
2108 rewritten = self.hooks.input_prefilter(stripped)
2106 if rewritten != stripped: # ok, some prefilter did something
2109 if rewritten != stripped: # ok, some prefilter did something
2107 rewritten = pre + rewritten # add indentation
2110 rewritten = pre + rewritten # add indentation
2108 return self.handle_normal(rewritten)
2111 return self.handle_normal(rewritten)
2109
2112
2110 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2113 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2111
2114
2112 # First check for explicit escapes in the last/first character
2115 # First check for explicit escapes in the last/first character
2113 handler = None
2116 handler = None
2114 if line[-1] == self.ESC_HELP:
2117 if line[-1] == self.ESC_HELP:
2115 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2118 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2116 if handler is None:
2119 if handler is None:
2117 # look at the first character of iFun, NOT of line, so we skip
2120 # look at the first character of iFun, NOT of line, so we skip
2118 # leading whitespace in multiline input
2121 # leading whitespace in multiline input
2119 handler = self.esc_handlers.get(iFun[0:1])
2122 handler = self.esc_handlers.get(iFun[0:1])
2120 if handler is not None:
2123 if handler is not None:
2121 return handler(line,continue_prompt,pre,iFun,theRest)
2124 return handler(line,continue_prompt,pre,iFun,theRest)
2122 # Emacs ipython-mode tags certain input lines
2125 # Emacs ipython-mode tags certain input lines
2123 if line.endswith('# PYTHON-MODE'):
2126 if line.endswith('# PYTHON-MODE'):
2124 return self.handle_emacs(line,continue_prompt)
2127 return self.handle_emacs(line,continue_prompt)
2125
2128
2126 # Next, check if we can automatically execute this thing
2129 # Next, check if we can automatically execute this thing
2127
2130
2128 # Allow ! in multi-line statements if multi_line_specials is on:
2131 # Allow ! in multi-line statements if multi_line_specials is on:
2129 if continue_prompt and self.rc.multi_line_specials and \
2132 if continue_prompt and self.rc.multi_line_specials and \
2130 iFun.startswith(self.ESC_SHELL):
2133 iFun.startswith(self.ESC_SHELL):
2131 return self.handle_shell_escape(line,continue_prompt,
2134 return self.handle_shell_escape(line,continue_prompt,
2132 pre=pre,iFun=iFun,
2135 pre=pre,iFun=iFun,
2133 theRest=theRest)
2136 theRest=theRest)
2134
2137
2135 # Let's try to find if the input line is a magic fn
2138 # Let's try to find if the input line is a magic fn
2136 oinfo = None
2139 oinfo = None
2137 if hasattr(self,'magic_'+iFun):
2140 if hasattr(self,'magic_'+iFun):
2138 # WARNING: _ofind uses getattr(), so it can consume generators and
2141 # WARNING: _ofind uses getattr(), so it can consume generators and
2139 # cause other side effects.
2142 # cause other side effects.
2140 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2143 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2141 if oinfo['ismagic']:
2144 if oinfo['ismagic']:
2142 # Be careful not to call magics when a variable assignment is
2145 # Be careful not to call magics when a variable assignment is
2143 # being made (ls='hi', for example)
2146 # being made (ls='hi', for example)
2144 if self.rc.automagic and \
2147 if self.rc.automagic and \
2145 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2148 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2146 (self.rc.multi_line_specials or not continue_prompt):
2149 (self.rc.multi_line_specials or not continue_prompt):
2147 return self.handle_magic(line,continue_prompt,
2150 return self.handle_magic(line,continue_prompt,
2148 pre,iFun,theRest)
2151 pre,iFun,theRest)
2149 else:
2152 else:
2150 return self.handle_normal(line,continue_prompt)
2153 return self.handle_normal(line,continue_prompt)
2151
2154
2152 # If the rest of the line begins with an (in)equality, assginment or
2155 # If the rest of the line begins with an (in)equality, assginment or
2153 # function call, we should not call _ofind but simply execute it.
2156 # function call, we should not call _ofind but simply execute it.
2154 # This avoids spurious geattr() accesses on objects upon assignment.
2157 # This avoids spurious geattr() accesses on objects upon assignment.
2155 #
2158 #
2156 # It also allows users to assign to either alias or magic names true
2159 # It also allows users to assign to either alias or magic names true
2157 # python variables (the magic/alias systems always take second seat to
2160 # python variables (the magic/alias systems always take second seat to
2158 # true python code).
2161 # true python code).
2159 if theRest and theRest[0] in '!=()':
2162 if theRest and theRest[0] in '!=()':
2160 return self.handle_normal(line,continue_prompt)
2163 return self.handle_normal(line,continue_prompt)
2161
2164
2162 if oinfo is None:
2165 if oinfo is None:
2163 # let's try to ensure that _oinfo is ONLY called when autocall is
2166 # let's try to ensure that _oinfo is ONLY called when autocall is
2164 # on. Since it has inevitable potential side effects, at least
2167 # on. Since it has inevitable potential side effects, at least
2165 # having autocall off should be a guarantee to the user that no
2168 # having autocall off should be a guarantee to the user that no
2166 # weird things will happen.
2169 # weird things will happen.
2167
2170
2168 if self.rc.autocall:
2171 if self.rc.autocall:
2169 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2172 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2170 else:
2173 else:
2171 # in this case, all that's left is either an alias or
2174 # in this case, all that's left is either an alias or
2172 # processing the line normally.
2175 # processing the line normally.
2173 if iFun in self.alias_table:
2176 if iFun in self.alias_table:
2174 # if autocall is off, by not running _ofind we won't know
2177 # if autocall is off, by not running _ofind we won't know
2175 # whether the given name may also exist in one of the
2178 # whether the given name may also exist in one of the
2176 # user's namespace. At this point, it's best to do a
2179 # user's namespace. At this point, it's best to do a
2177 # quick check just to be sure that we don't let aliases
2180 # quick check just to be sure that we don't let aliases
2178 # shadow variables.
2181 # shadow variables.
2179 head = iFun.split('.',1)[0]
2182 head = iFun.split('.',1)[0]
2180 if head in self.user_ns or head in self.internal_ns \
2183 if head in self.user_ns or head in self.internal_ns \
2181 or head in __builtin__.__dict__:
2184 or head in __builtin__.__dict__:
2182 return self.handle_normal(line,continue_prompt)
2185 return self.handle_normal(line,continue_prompt)
2183 else:
2186 else:
2184 return self.handle_alias(line,continue_prompt,
2187 return self.handle_alias(line,continue_prompt,
2185 pre,iFun,theRest)
2188 pre,iFun,theRest)
2186
2189
2187 else:
2190 else:
2188 return self.handle_normal(line,continue_prompt)
2191 return self.handle_normal(line,continue_prompt)
2189
2192
2190 if not oinfo['found']:
2193 if not oinfo['found']:
2191 return self.handle_normal(line,continue_prompt)
2194 return self.handle_normal(line,continue_prompt)
2192 else:
2195 else:
2193 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2196 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2194 if oinfo['isalias']:
2197 if oinfo['isalias']:
2195 return self.handle_alias(line,continue_prompt,
2198 return self.handle_alias(line,continue_prompt,
2196 pre,iFun,theRest)
2199 pre,iFun,theRest)
2197
2200
2198 if (self.rc.autocall
2201 if (self.rc.autocall
2199 and
2202 and
2200 (
2203 (
2201 #only consider exclusion re if not "," or ";" autoquoting
2204 #only consider exclusion re if not "," or ";" autoquoting
2202 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2205 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2203 or pre == self.ESC_PAREN) or
2206 or pre == self.ESC_PAREN) or
2204 (not self.re_exclude_auto.match(theRest)))
2207 (not self.re_exclude_auto.match(theRest)))
2205 and
2208 and
2206 self.re_fun_name.match(iFun) and
2209 self.re_fun_name.match(iFun) and
2207 callable(oinfo['obj'])) :
2210 callable(oinfo['obj'])) :
2208 #print 'going auto' # dbg
2211 #print 'going auto' # dbg
2209 return self.handle_auto(line,continue_prompt,
2212 return self.handle_auto(line,continue_prompt,
2210 pre,iFun,theRest,oinfo['obj'])
2213 pre,iFun,theRest,oinfo['obj'])
2211 else:
2214 else:
2212 #print 'was callable?', callable(oinfo['obj']) # dbg
2215 #print 'was callable?', callable(oinfo['obj']) # dbg
2213 return self.handle_normal(line,continue_prompt)
2216 return self.handle_normal(line,continue_prompt)
2214
2217
2215 # If we get here, we have a normal Python line. Log and return.
2218 # If we get here, we have a normal Python line. Log and return.
2216 return self.handle_normal(line,continue_prompt)
2219 return self.handle_normal(line,continue_prompt)
2217
2220
2218 def _prefilter_dumb(self, line, continue_prompt):
2221 def _prefilter_dumb(self, line, continue_prompt):
2219 """simple prefilter function, for debugging"""
2222 """simple prefilter function, for debugging"""
2220 return self.handle_normal(line,continue_prompt)
2223 return self.handle_normal(line,continue_prompt)
2221
2224
2222
2225
2223 def multiline_prefilter(self, line, continue_prompt):
2226 def multiline_prefilter(self, line, continue_prompt):
2224 """ Run _prefilter for each line of input
2227 """ Run _prefilter for each line of input
2225
2228
2226 Covers cases where there are multiple lines in the user entry,
2229 Covers cases where there are multiple lines in the user entry,
2227 which is the case when the user goes back to a multiline history
2230 which is the case when the user goes back to a multiline history
2228 entry and presses enter.
2231 entry and presses enter.
2229
2232
2230 """
2233 """
2231 out = []
2234 out = []
2232 for l in line.rstrip('\n').split('\n'):
2235 for l in line.rstrip('\n').split('\n'):
2233 out.append(self._prefilter(l, continue_prompt))
2236 out.append(self._prefilter(l, continue_prompt))
2234 return '\n'.join(out)
2237 return '\n'.join(out)
2235
2238
2236 # Set the default prefilter() function (this can be user-overridden)
2239 # Set the default prefilter() function (this can be user-overridden)
2237 prefilter = multiline_prefilter
2240 prefilter = multiline_prefilter
2238
2241
2239 def handle_normal(self,line,continue_prompt=None,
2242 def handle_normal(self,line,continue_prompt=None,
2240 pre=None,iFun=None,theRest=None):
2243 pre=None,iFun=None,theRest=None):
2241 """Handle normal input lines. Use as a template for handlers."""
2244 """Handle normal input lines. Use as a template for handlers."""
2242
2245
2243 # With autoindent on, we need some way to exit the input loop, and I
2246 # With autoindent on, we need some way to exit the input loop, and I
2244 # don't want to force the user to have to backspace all the way to
2247 # don't want to force the user to have to backspace all the way to
2245 # clear the line. The rule will be in this case, that either two
2248 # clear the line. The rule will be in this case, that either two
2246 # lines of pure whitespace in a row, or a line of pure whitespace but
2249 # lines of pure whitespace in a row, or a line of pure whitespace but
2247 # of a size different to the indent level, will exit the input loop.
2250 # of a size different to the indent level, will exit the input loop.
2248
2251
2249 if (continue_prompt and self.autoindent and line.isspace() and
2252 if (continue_prompt and self.autoindent and line.isspace() and
2250 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2253 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2251 (self.buffer[-1]).isspace() )):
2254 (self.buffer[-1]).isspace() )):
2252 line = ''
2255 line = ''
2253
2256
2254 self.log(line,line,continue_prompt)
2257 self.log(line,line,continue_prompt)
2255 return line
2258 return line
2256
2259
2257 def handle_alias(self,line,continue_prompt=None,
2260 def handle_alias(self,line,continue_prompt=None,
2258 pre=None,iFun=None,theRest=None):
2261 pre=None,iFun=None,theRest=None):
2259 """Handle alias input lines. """
2262 """Handle alias input lines. """
2260
2263
2261 # pre is needed, because it carries the leading whitespace. Otherwise
2264 # pre is needed, because it carries the leading whitespace. Otherwise
2262 # aliases won't work in indented sections.
2265 # aliases won't work in indented sections.
2263 transformed = self.expand_aliases(iFun, theRest)
2266 transformed = self.expand_aliases(iFun, theRest)
2264 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2267 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2265 self.log(line,line_out,continue_prompt)
2268 self.log(line,line_out,continue_prompt)
2266 #print 'line out:',line_out # dbg
2269 #print 'line out:',line_out # dbg
2267 return line_out
2270 return line_out
2268
2271
2269 def handle_shell_escape(self, line, continue_prompt=None,
2272 def handle_shell_escape(self, line, continue_prompt=None,
2270 pre=None,iFun=None,theRest=None):
2273 pre=None,iFun=None,theRest=None):
2271 """Execute the line in a shell, empty return value"""
2274 """Execute the line in a shell, empty return value"""
2272
2275
2273 #print 'line in :', `line` # dbg
2276 #print 'line in :', `line` # dbg
2274 # Example of a special handler. Others follow a similar pattern.
2277 # Example of a special handler. Others follow a similar pattern.
2275 if line.lstrip().startswith('!!'):
2278 if line.lstrip().startswith('!!'):
2276 # rewrite iFun/theRest to properly hold the call to %sx and
2279 # rewrite iFun/theRest to properly hold the call to %sx and
2277 # the actual command to be executed, so handle_magic can work
2280 # the actual command to be executed, so handle_magic can work
2278 # correctly
2281 # correctly
2279 theRest = '%s %s' % (iFun[2:],theRest)
2282 theRest = '%s %s' % (iFun[2:],theRest)
2280 iFun = 'sx'
2283 iFun = 'sx'
2281 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2284 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2282 line.lstrip()[2:]),
2285 line.lstrip()[2:]),
2283 continue_prompt,pre,iFun,theRest)
2286 continue_prompt,pre,iFun,theRest)
2284 else:
2287 else:
2285 cmd=line.lstrip().lstrip('!')
2288 cmd=line.lstrip().lstrip('!')
2286 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2289 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2287 # update cache/log and return
2290 # update cache/log and return
2288 self.log(line,line_out,continue_prompt)
2291 self.log(line,line_out,continue_prompt)
2289 return line_out
2292 return line_out
2290
2293
2291 def handle_magic(self, line, continue_prompt=None,
2294 def handle_magic(self, line, continue_prompt=None,
2292 pre=None,iFun=None,theRest=None):
2295 pre=None,iFun=None,theRest=None):
2293 """Execute magic functions."""
2296 """Execute magic functions."""
2294
2297
2295
2298
2296 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2299 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2297 self.log(line,cmd,continue_prompt)
2300 self.log(line,cmd,continue_prompt)
2298 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2301 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2299 return cmd
2302 return cmd
2300
2303
2301 def handle_auto(self, line, continue_prompt=None,
2304 def handle_auto(self, line, continue_prompt=None,
2302 pre=None,iFun=None,theRest=None,obj=None):
2305 pre=None,iFun=None,theRest=None,obj=None):
2303 """Hande lines which can be auto-executed, quoting if requested."""
2306 """Hande lines which can be auto-executed, quoting if requested."""
2304
2307
2305 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2308 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2306
2309
2307 # This should only be active for single-line input!
2310 # This should only be active for single-line input!
2308 if continue_prompt:
2311 if continue_prompt:
2309 self.log(line,line,continue_prompt)
2312 self.log(line,line,continue_prompt)
2310 return line
2313 return line
2311
2314
2312 auto_rewrite = True
2315 auto_rewrite = True
2313
2316
2314 if pre == self.ESC_QUOTE:
2317 if pre == self.ESC_QUOTE:
2315 # Auto-quote splitting on whitespace
2318 # Auto-quote splitting on whitespace
2316 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2319 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2317 elif pre == self.ESC_QUOTE2:
2320 elif pre == self.ESC_QUOTE2:
2318 # Auto-quote whole string
2321 # Auto-quote whole string
2319 newcmd = '%s("%s")' % (iFun,theRest)
2322 newcmd = '%s("%s")' % (iFun,theRest)
2320 elif pre == self.ESC_PAREN:
2323 elif pre == self.ESC_PAREN:
2321 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2324 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2322 else:
2325 else:
2323 # Auto-paren.
2326 # Auto-paren.
2324 # We only apply it to argument-less calls if the autocall
2327 # We only apply it to argument-less calls if the autocall
2325 # parameter is set to 2. We only need to check that autocall is <
2328 # parameter is set to 2. We only need to check that autocall is <
2326 # 2, since this function isn't called unless it's at least 1.
2329 # 2, since this function isn't called unless it's at least 1.
2327 if not theRest and (self.rc.autocall < 2):
2330 if not theRest and (self.rc.autocall < 2):
2328 newcmd = '%s %s' % (iFun,theRest)
2331 newcmd = '%s %s' % (iFun,theRest)
2329 auto_rewrite = False
2332 auto_rewrite = False
2330 else:
2333 else:
2331 if theRest.startswith('['):
2334 if theRest.startswith('['):
2332 if hasattr(obj,'__getitem__'):
2335 if hasattr(obj,'__getitem__'):
2333 # Don't autocall in this case: item access for an object
2336 # Don't autocall in this case: item access for an object
2334 # which is BOTH callable and implements __getitem__.
2337 # which is BOTH callable and implements __getitem__.
2335 newcmd = '%s %s' % (iFun,theRest)
2338 newcmd = '%s %s' % (iFun,theRest)
2336 auto_rewrite = False
2339 auto_rewrite = False
2337 else:
2340 else:
2338 # if the object doesn't support [] access, go ahead and
2341 # if the object doesn't support [] access, go ahead and
2339 # autocall
2342 # autocall
2340 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2343 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2341 elif theRest.endswith(';'):
2344 elif theRest.endswith(';'):
2342 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2345 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2343 else:
2346 else:
2344 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2347 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2345
2348
2346 if auto_rewrite:
2349 if auto_rewrite:
2347 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2350 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2348 # log what is now valid Python, not the actual user input (without the
2351 # log what is now valid Python, not the actual user input (without the
2349 # final newline)
2352 # final newline)
2350 self.log(line,newcmd,continue_prompt)
2353 self.log(line,newcmd,continue_prompt)
2351 return newcmd
2354 return newcmd
2352
2355
2353 def handle_help(self, line, continue_prompt=None,
2356 def handle_help(self, line, continue_prompt=None,
2354 pre=None,iFun=None,theRest=None):
2357 pre=None,iFun=None,theRest=None):
2355 """Try to get some help for the object.
2358 """Try to get some help for the object.
2356
2359
2357 obj? or ?obj -> basic information.
2360 obj? or ?obj -> basic information.
2358 obj?? or ??obj -> more details.
2361 obj?? or ??obj -> more details.
2359 """
2362 """
2360
2363
2361 # We need to make sure that we don't process lines which would be
2364 # We need to make sure that we don't process lines which would be
2362 # otherwise valid python, such as "x=1 # what?"
2365 # otherwise valid python, such as "x=1 # what?"
2363 try:
2366 try:
2364 codeop.compile_command(line)
2367 codeop.compile_command(line)
2365 except SyntaxError:
2368 except SyntaxError:
2366 # We should only handle as help stuff which is NOT valid syntax
2369 # We should only handle as help stuff which is NOT valid syntax
2367 if line[0]==self.ESC_HELP:
2370 if line[0]==self.ESC_HELP:
2368 line = line[1:]
2371 line = line[1:]
2369 elif line[-1]==self.ESC_HELP:
2372 elif line[-1]==self.ESC_HELP:
2370 line = line[:-1]
2373 line = line[:-1]
2371 self.log(line,'#?'+line,continue_prompt)
2374 self.log(line,'#?'+line,continue_prompt)
2372 if line:
2375 if line:
2373 self.magic_pinfo(line)
2376 self.magic_pinfo(line)
2374 else:
2377 else:
2375 page(self.usage,screen_lines=self.rc.screen_length)
2378 page(self.usage,screen_lines=self.rc.screen_length)
2376 return '' # Empty string is needed here!
2379 return '' # Empty string is needed here!
2377 except:
2380 except:
2378 # Pass any other exceptions through to the normal handler
2381 # Pass any other exceptions through to the normal handler
2379 return self.handle_normal(line,continue_prompt)
2382 return self.handle_normal(line,continue_prompt)
2380 else:
2383 else:
2381 # If the code compiles ok, we should handle it normally
2384 # If the code compiles ok, we should handle it normally
2382 return self.handle_normal(line,continue_prompt)
2385 return self.handle_normal(line,continue_prompt)
2383
2386
2384 def getapi(self):
2387 def getapi(self):
2385 """ Get an IPApi object for this shell instance
2388 """ Get an IPApi object for this shell instance
2386
2389
2387 Getting an IPApi object is always preferable to accessing the shell
2390 Getting an IPApi object is always preferable to accessing the shell
2388 directly, but this holds true especially for extensions.
2391 directly, but this holds true especially for extensions.
2389
2392
2390 It should always be possible to implement an extension with IPApi
2393 It should always be possible to implement an extension with IPApi
2391 alone. If not, contact maintainer to request an addition.
2394 alone. If not, contact maintainer to request an addition.
2392
2395
2393 """
2396 """
2394 return self.api
2397 return self.api
2395
2398
2396 def handle_emacs(self,line,continue_prompt=None,
2399 def handle_emacs(self,line,continue_prompt=None,
2397 pre=None,iFun=None,theRest=None):
2400 pre=None,iFun=None,theRest=None):
2398 """Handle input lines marked by python-mode."""
2401 """Handle input lines marked by python-mode."""
2399
2402
2400 # Currently, nothing is done. Later more functionality can be added
2403 # Currently, nothing is done. Later more functionality can be added
2401 # here if needed.
2404 # here if needed.
2402
2405
2403 # The input cache shouldn't be updated
2406 # The input cache shouldn't be updated
2404
2407
2405 return line
2408 return line
2406
2409
2407 def mktempfile(self,data=None):
2410 def mktempfile(self,data=None):
2408 """Make a new tempfile and return its filename.
2411 """Make a new tempfile and return its filename.
2409
2412
2410 This makes a call to tempfile.mktemp, but it registers the created
2413 This makes a call to tempfile.mktemp, but it registers the created
2411 filename internally so ipython cleans it up at exit time.
2414 filename internally so ipython cleans it up at exit time.
2412
2415
2413 Optional inputs:
2416 Optional inputs:
2414
2417
2415 - data(None): if data is given, it gets written out to the temp file
2418 - data(None): if data is given, it gets written out to the temp file
2416 immediately, and the file is closed again."""
2419 immediately, and the file is closed again."""
2417
2420
2418 filename = tempfile.mktemp('.py','ipython_edit_')
2421 filename = tempfile.mktemp('.py','ipython_edit_')
2419 self.tempfiles.append(filename)
2422 self.tempfiles.append(filename)
2420
2423
2421 if data:
2424 if data:
2422 tmp_file = open(filename,'w')
2425 tmp_file = open(filename,'w')
2423 tmp_file.write(data)
2426 tmp_file.write(data)
2424 tmp_file.close()
2427 tmp_file.close()
2425 return filename
2428 return filename
2426
2429
2427 def write(self,data):
2430 def write(self,data):
2428 """Write a string to the default output"""
2431 """Write a string to the default output"""
2429 Term.cout.write(data)
2432 Term.cout.write(data)
2430
2433
2431 def write_err(self,data):
2434 def write_err(self,data):
2432 """Write a string to the default error output"""
2435 """Write a string to the default error output"""
2433 Term.cerr.write(data)
2436 Term.cerr.write(data)
2434
2437
2435 def exit(self):
2438 def exit(self):
2436 """Handle interactive exit.
2439 """Handle interactive exit.
2437
2440
2438 This method sets the exit_now attribute."""
2441 This method sets the exit_now attribute."""
2439
2442
2440 if self.rc.confirm_exit:
2443 if self.rc.confirm_exit:
2441 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2444 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2442 self.exit_now = True
2445 self.exit_now = True
2443 else:
2446 else:
2444 self.exit_now = True
2447 self.exit_now = True
2445
2448
2446 def safe_execfile(self,fname,*where,**kw):
2449 def safe_execfile(self,fname,*where,**kw):
2447 """A safe version of the builtin execfile().
2450 """A safe version of the builtin execfile().
2448
2451
2449 This version will never throw an exception, and knows how to handle
2452 This version will never throw an exception, and knows how to handle
2450 ipython logs as well."""
2453 ipython logs as well."""
2451
2454
2452 def syspath_cleanup():
2455 def syspath_cleanup():
2453 """Internal cleanup routine for sys.path."""
2456 """Internal cleanup routine for sys.path."""
2454 if add_dname:
2457 if add_dname:
2455 try:
2458 try:
2456 sys.path.remove(dname)
2459 sys.path.remove(dname)
2457 except ValueError:
2460 except ValueError:
2458 # For some reason the user has already removed it, ignore.
2461 # For some reason the user has already removed it, ignore.
2459 pass
2462 pass
2460
2463
2461 fname = os.path.expanduser(fname)
2464 fname = os.path.expanduser(fname)
2462
2465
2463 # Find things also in current directory. This is needed to mimic the
2466 # Find things also in current directory. This is needed to mimic the
2464 # behavior of running a script from the system command line, where
2467 # behavior of running a script from the system command line, where
2465 # Python inserts the script's directory into sys.path
2468 # Python inserts the script's directory into sys.path
2466 dname = os.path.dirname(os.path.abspath(fname))
2469 dname = os.path.dirname(os.path.abspath(fname))
2467 add_dname = False
2470 add_dname = False
2468 if dname not in sys.path:
2471 if dname not in sys.path:
2469 sys.path.insert(0,dname)
2472 sys.path.insert(0,dname)
2470 add_dname = True
2473 add_dname = True
2471
2474
2472 try:
2475 try:
2473 xfile = open(fname)
2476 xfile = open(fname)
2474 except:
2477 except:
2475 print >> Term.cerr, \
2478 print >> Term.cerr, \
2476 'Could not open file <%s> for safe execution.' % fname
2479 'Could not open file <%s> for safe execution.' % fname
2477 syspath_cleanup()
2480 syspath_cleanup()
2478 return None
2481 return None
2479
2482
2480 kw.setdefault('islog',0)
2483 kw.setdefault('islog',0)
2481 kw.setdefault('quiet',1)
2484 kw.setdefault('quiet',1)
2482 kw.setdefault('exit_ignore',0)
2485 kw.setdefault('exit_ignore',0)
2483 first = xfile.readline()
2486 first = xfile.readline()
2484 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2487 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2485 xfile.close()
2488 xfile.close()
2486 # line by line execution
2489 # line by line execution
2487 if first.startswith(loghead) or kw['islog']:
2490 if first.startswith(loghead) or kw['islog']:
2488 print 'Loading log file <%s> one line at a time...' % fname
2491 print 'Loading log file <%s> one line at a time...' % fname
2489 if kw['quiet']:
2492 if kw['quiet']:
2490 stdout_save = sys.stdout
2493 stdout_save = sys.stdout
2491 sys.stdout = StringIO.StringIO()
2494 sys.stdout = StringIO.StringIO()
2492 try:
2495 try:
2493 globs,locs = where[0:2]
2496 globs,locs = where[0:2]
2494 except:
2497 except:
2495 try:
2498 try:
2496 globs = locs = where[0]
2499 globs = locs = where[0]
2497 except:
2500 except:
2498 globs = locs = globals()
2501 globs = locs = globals()
2499 badblocks = []
2502 badblocks = []
2500
2503
2501 # we also need to identify indented blocks of code when replaying
2504 # we also need to identify indented blocks of code when replaying
2502 # logs and put them together before passing them to an exec
2505 # logs and put them together before passing them to an exec
2503 # statement. This takes a bit of regexp and look-ahead work in the
2506 # statement. This takes a bit of regexp and look-ahead work in the
2504 # file. It's easiest if we swallow the whole thing in memory
2507 # file. It's easiest if we swallow the whole thing in memory
2505 # first, and manually walk through the lines list moving the
2508 # first, and manually walk through the lines list moving the
2506 # counter ourselves.
2509 # counter ourselves.
2507 indent_re = re.compile('\s+\S')
2510 indent_re = re.compile('\s+\S')
2508 xfile = open(fname)
2511 xfile = open(fname)
2509 filelines = xfile.readlines()
2512 filelines = xfile.readlines()
2510 xfile.close()
2513 xfile.close()
2511 nlines = len(filelines)
2514 nlines = len(filelines)
2512 lnum = 0
2515 lnum = 0
2513 while lnum < nlines:
2516 while lnum < nlines:
2514 line = filelines[lnum]
2517 line = filelines[lnum]
2515 lnum += 1
2518 lnum += 1
2516 # don't re-insert logger status info into cache
2519 # don't re-insert logger status info into cache
2517 if line.startswith('#log#'):
2520 if line.startswith('#log#'):
2518 continue
2521 continue
2519 else:
2522 else:
2520 # build a block of code (maybe a single line) for execution
2523 # build a block of code (maybe a single line) for execution
2521 block = line
2524 block = line
2522 try:
2525 try:
2523 next = filelines[lnum] # lnum has already incremented
2526 next = filelines[lnum] # lnum has already incremented
2524 except:
2527 except:
2525 next = None
2528 next = None
2526 while next and indent_re.match(next):
2529 while next and indent_re.match(next):
2527 block += next
2530 block += next
2528 lnum += 1
2531 lnum += 1
2529 try:
2532 try:
2530 next = filelines[lnum]
2533 next = filelines[lnum]
2531 except:
2534 except:
2532 next = None
2535 next = None
2533 # now execute the block of one or more lines
2536 # now execute the block of one or more lines
2534 try:
2537 try:
2535 exec block in globs,locs
2538 exec block in globs,locs
2536 except SystemExit:
2539 except SystemExit:
2537 pass
2540 pass
2538 except:
2541 except:
2539 badblocks.append(block.rstrip())
2542 badblocks.append(block.rstrip())
2540 if kw['quiet']: # restore stdout
2543 if kw['quiet']: # restore stdout
2541 sys.stdout.close()
2544 sys.stdout.close()
2542 sys.stdout = stdout_save
2545 sys.stdout = stdout_save
2543 print 'Finished replaying log file <%s>' % fname
2546 print 'Finished replaying log file <%s>' % fname
2544 if badblocks:
2547 if badblocks:
2545 print >> sys.stderr, ('\nThe following lines/blocks in file '
2548 print >> sys.stderr, ('\nThe following lines/blocks in file '
2546 '<%s> reported errors:' % fname)
2549 '<%s> reported errors:' % fname)
2547
2550
2548 for badline in badblocks:
2551 for badline in badblocks:
2549 print >> sys.stderr, badline
2552 print >> sys.stderr, badline
2550 else: # regular file execution
2553 else: # regular file execution
2551 try:
2554 try:
2552 execfile(fname,*where)
2555 execfile(fname,*where)
2553 except SyntaxError:
2556 except SyntaxError:
2554 self.showsyntaxerror()
2557 self.showsyntaxerror()
2555 warn('Failure executing file: <%s>' % fname)
2558 warn('Failure executing file: <%s>' % fname)
2556 except SystemExit,status:
2559 except SystemExit,status:
2557 if not kw['exit_ignore']:
2560 if not kw['exit_ignore']:
2558 self.showtraceback()
2561 self.showtraceback()
2559 warn('Failure executing file: <%s>' % fname)
2562 warn('Failure executing file: <%s>' % fname)
2560 except:
2563 except:
2561 self.showtraceback()
2564 self.showtraceback()
2562 warn('Failure executing file: <%s>' % fname)
2565 warn('Failure executing file: <%s>' % fname)
2563
2566
2564 syspath_cleanup()
2567 syspath_cleanup()
2565
2568
2566 #************************* end of file <iplib.py> *****************************
2569 #************************* end of file <iplib.py> *****************************
@@ -1,6284 +1,6290 b''
1 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
4 Schmolck's recently reported tab-completion bug (my previous one
5 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
6
1 2007-03-09 Walter Doerwald <walter@livinglogic.de>
7 2007-03-09 Walter Doerwald <walter@livinglogic.de>
2
8
3 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
9 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
4 Close help window if exiting igrid.
10 Close help window if exiting igrid.
5
11
6 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
12 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
7
13
8 * IPython/Extensions/ipy_defaults.py: Check if readline is available
14 * IPython/Extensions/ipy_defaults.py: Check if readline is available
9 before calling functions from readline.
15 before calling functions from readline.
10
16
11 2007-03-02 Walter Doerwald <walter@livinglogic.de>
17 2007-03-02 Walter Doerwald <walter@livinglogic.de>
12
18
13 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
19 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
14 igrid is a wxPython-based display object for ipipe. If your system has
20 igrid is a wxPython-based display object for ipipe. If your system has
15 wx installed igrid will be the default display. Without wx ipipe falls
21 wx installed igrid will be the default display. Without wx ipipe falls
16 back to ibrowse (which needs curses). If no curses is installed ipipe
22 back to ibrowse (which needs curses). If no curses is installed ipipe
17 falls back to idump.
23 falls back to idump.
18
24
19 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
25 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
20
26
21 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
27 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
22 my changes from yesterday, they introduced bugs. Will reactivate
28 my changes from yesterday, they introduced bugs. Will reactivate
23 once I get a correct solution, which will be much easier thanks to
29 once I get a correct solution, which will be much easier thanks to
24 Dan Milstein's new prefilter test suite.
30 Dan Milstein's new prefilter test suite.
25
31
26 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
32 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
27
33
28 * IPython/iplib.py (split_user_input): fix input splitting so we
34 * IPython/iplib.py (split_user_input): fix input splitting so we
29 don't attempt attribute accesses on things that can't possibly be
35 don't attempt attribute accesses on things that can't possibly be
30 valid Python attributes. After a bug report by Alex Schmolck.
36 valid Python attributes. After a bug report by Alex Schmolck.
31 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
37 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
32 %magic with explicit % prefix.
38 %magic with explicit % prefix.
33
39
34 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
40 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
35
41
36 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
42 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
37 avoid a DeprecationWarning from GTK.
43 avoid a DeprecationWarning from GTK.
38
44
39 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
45 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
40
46
41 * IPython/genutils.py (clock): I modified clock() to return total
47 * IPython/genutils.py (clock): I modified clock() to return total
42 time, user+system. This is a more commonly needed metric. I also
48 time, user+system. This is a more commonly needed metric. I also
43 introduced the new clocku/clocks to get only user/system time if
49 introduced the new clocku/clocks to get only user/system time if
44 one wants those instead.
50 one wants those instead.
45
51
46 ***WARNING: API CHANGE*** clock() used to return only user time,
52 ***WARNING: API CHANGE*** clock() used to return only user time,
47 so if you want exactly the same results as before, use clocku
53 so if you want exactly the same results as before, use clocku
48 instead.
54 instead.
49
55
50 2007-02-22 Ville Vainio <vivainio@gmail.com>
56 2007-02-22 Ville Vainio <vivainio@gmail.com>
51
57
52 * IPython/Extensions/ipy_p4.py: Extension for improved
58 * IPython/Extensions/ipy_p4.py: Extension for improved
53 p4 (perforce version control system) experience.
59 p4 (perforce version control system) experience.
54 Adds %p4 magic with p4 command completion and
60 Adds %p4 magic with p4 command completion and
55 automatic -G argument (marshall output as python dict)
61 automatic -G argument (marshall output as python dict)
56
62
57 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
63 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
58
64
59 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
65 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
60 stop marks.
66 stop marks.
61 (ClearingMixin): a simple mixin to easily make a Demo class clear
67 (ClearingMixin): a simple mixin to easily make a Demo class clear
62 the screen in between blocks and have empty marquees. The
68 the screen in between blocks and have empty marquees. The
63 ClearDemo and ClearIPDemo classes that use it are included.
69 ClearDemo and ClearIPDemo classes that use it are included.
64
70
65 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
71 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
66
72
67 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
73 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
68 protect against exceptions at Python shutdown time. Patch
74 protect against exceptions at Python shutdown time. Patch
69 sumbmitted to upstream.
75 sumbmitted to upstream.
70
76
71 2007-02-14 Walter Doerwald <walter@livinglogic.de>
77 2007-02-14 Walter Doerwald <walter@livinglogic.de>
72
78
73 * IPython/Extensions/ibrowse.py: If entering the first object level
79 * IPython/Extensions/ibrowse.py: If entering the first object level
74 (i.e. the object for which the browser has been started) fails,
80 (i.e. the object for which the browser has been started) fails,
75 now the error is raised directly (aborting the browser) instead of
81 now the error is raised directly (aborting the browser) instead of
76 running into an empty levels list later.
82 running into an empty levels list later.
77
83
78 2007-02-03 Walter Doerwald <walter@livinglogic.de>
84 2007-02-03 Walter Doerwald <walter@livinglogic.de>
79
85
80 * IPython/Extensions/ipipe.py: Add an xrepr implementation
86 * IPython/Extensions/ipipe.py: Add an xrepr implementation
81 for the noitem object.
87 for the noitem object.
82
88
83 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
89 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
84
90
85 * IPython/completer.py (Completer.attr_matches): Fix small
91 * IPython/completer.py (Completer.attr_matches): Fix small
86 tab-completion bug with Enthought Traits objects with units.
92 tab-completion bug with Enthought Traits objects with units.
87 Thanks to a bug report by Tom Denniston
93 Thanks to a bug report by Tom Denniston
88 <tom.denniston-AT-alum.dartmouth.org>.
94 <tom.denniston-AT-alum.dartmouth.org>.
89
95
90 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
96 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
91
97
92 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
98 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
93 bug where only .ipy or .py would be completed. Once the first
99 bug where only .ipy or .py would be completed. Once the first
94 argument to %run has been given, all completions are valid because
100 argument to %run has been given, all completions are valid because
95 they are the arguments to the script, which may well be non-python
101 they are the arguments to the script, which may well be non-python
96 filenames.
102 filenames.
97
103
98 * IPython/irunner.py (InteractiveRunner.run_source): major updates
104 * IPython/irunner.py (InteractiveRunner.run_source): major updates
99 to irunner to allow it to correctly support real doctesting of
105 to irunner to allow it to correctly support real doctesting of
100 out-of-process ipython code.
106 out-of-process ipython code.
101
107
102 * IPython/Magic.py (magic_cd): Make the setting of the terminal
108 * IPython/Magic.py (magic_cd): Make the setting of the terminal
103 title an option (-noterm_title) because it completely breaks
109 title an option (-noterm_title) because it completely breaks
104 doctesting.
110 doctesting.
105
111
106 * IPython/demo.py: fix IPythonDemo class that was not actually working.
112 * IPython/demo.py: fix IPythonDemo class that was not actually working.
107
113
108 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
114 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
109
115
110 * IPython/irunner.py (main): fix small bug where extensions were
116 * IPython/irunner.py (main): fix small bug where extensions were
111 not being correctly recognized.
117 not being correctly recognized.
112
118
113 2007-01-23 Walter Doerwald <walter@livinglogic.de>
119 2007-01-23 Walter Doerwald <walter@livinglogic.de>
114
120
115 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
121 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
116 a string containing a single line yields the string itself as the
122 a string containing a single line yields the string itself as the
117 only item.
123 only item.
118
124
119 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
125 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
120 object if it's the same as the one on the last level (This avoids
126 object if it's the same as the one on the last level (This avoids
121 infinite recursion for one line strings).
127 infinite recursion for one line strings).
122
128
123 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
129 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
124
130
125 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
131 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
126 all output streams before printing tracebacks. This ensures that
132 all output streams before printing tracebacks. This ensures that
127 user output doesn't end up interleaved with traceback output.
133 user output doesn't end up interleaved with traceback output.
128
134
129 2007-01-10 Ville Vainio <vivainio@gmail.com>
135 2007-01-10 Ville Vainio <vivainio@gmail.com>
130
136
131 * Extensions/envpersist.py: Turbocharged %env that remembers
137 * Extensions/envpersist.py: Turbocharged %env that remembers
132 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
138 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
133 "%env VISUAL=jed".
139 "%env VISUAL=jed".
134
140
135 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
141 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
136
142
137 * IPython/iplib.py (showtraceback): ensure that we correctly call
143 * IPython/iplib.py (showtraceback): ensure that we correctly call
138 custom handlers in all cases (some with pdb were slipping through,
144 custom handlers in all cases (some with pdb were slipping through,
139 but I'm not exactly sure why).
145 but I'm not exactly sure why).
140
146
141 * IPython/Debugger.py (Tracer.__init__): added new class to
147 * IPython/Debugger.py (Tracer.__init__): added new class to
142 support set_trace-like usage of IPython's enhanced debugger.
148 support set_trace-like usage of IPython's enhanced debugger.
143
149
144 2006-12-24 Ville Vainio <vivainio@gmail.com>
150 2006-12-24 Ville Vainio <vivainio@gmail.com>
145
151
146 * ipmaker.py: more informative message when ipy_user_conf
152 * ipmaker.py: more informative message when ipy_user_conf
147 import fails (suggest running %upgrade).
153 import fails (suggest running %upgrade).
148
154
149 * tools/run_ipy_in_profiler.py: Utility to see where
155 * tools/run_ipy_in_profiler.py: Utility to see where
150 the time during IPython startup is spent.
156 the time during IPython startup is spent.
151
157
152 2006-12-20 Ville Vainio <vivainio@gmail.com>
158 2006-12-20 Ville Vainio <vivainio@gmail.com>
153
159
154 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
160 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
155
161
156 * ipapi.py: Add new ipapi method, expand_alias.
162 * ipapi.py: Add new ipapi method, expand_alias.
157
163
158 * Release.py: Bump up version to 0.7.4.svn
164 * Release.py: Bump up version to 0.7.4.svn
159
165
160 2006-12-17 Ville Vainio <vivainio@gmail.com>
166 2006-12-17 Ville Vainio <vivainio@gmail.com>
161
167
162 * Extensions/jobctrl.py: Fixed &cmd arg arg...
168 * Extensions/jobctrl.py: Fixed &cmd arg arg...
163 to work properly on posix too
169 to work properly on posix too
164
170
165 * Release.py: Update revnum (version is still just 0.7.3).
171 * Release.py: Update revnum (version is still just 0.7.3).
166
172
167 2006-12-15 Ville Vainio <vivainio@gmail.com>
173 2006-12-15 Ville Vainio <vivainio@gmail.com>
168
174
169 * scripts/ipython_win_post_install: create ipython.py in
175 * scripts/ipython_win_post_install: create ipython.py in
170 prefix + "/scripts".
176 prefix + "/scripts".
171
177
172 * Release.py: Update version to 0.7.3.
178 * Release.py: Update version to 0.7.3.
173
179
174 2006-12-14 Ville Vainio <vivainio@gmail.com>
180 2006-12-14 Ville Vainio <vivainio@gmail.com>
175
181
176 * scripts/ipython_win_post_install: Overwrite old shortcuts
182 * scripts/ipython_win_post_install: Overwrite old shortcuts
177 if they already exist
183 if they already exist
178
184
179 * Release.py: release 0.7.3rc2
185 * Release.py: release 0.7.3rc2
180
186
181 2006-12-13 Ville Vainio <vivainio@gmail.com>
187 2006-12-13 Ville Vainio <vivainio@gmail.com>
182
188
183 * Branch and update Release.py for 0.7.3rc1
189 * Branch and update Release.py for 0.7.3rc1
184
190
185 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
191 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
186
192
187 * IPython/Shell.py (IPShellWX): update for current WX naming
193 * IPython/Shell.py (IPShellWX): update for current WX naming
188 conventions, to avoid a deprecation warning with current WX
194 conventions, to avoid a deprecation warning with current WX
189 versions. Thanks to a report by Danny Shevitz.
195 versions. Thanks to a report by Danny Shevitz.
190
196
191 2006-12-12 Ville Vainio <vivainio@gmail.com>
197 2006-12-12 Ville Vainio <vivainio@gmail.com>
192
198
193 * ipmaker.py: apply david cournapeau's patch to make
199 * ipmaker.py: apply david cournapeau's patch to make
194 import_some work properly even when ipythonrc does
200 import_some work properly even when ipythonrc does
195 import_some on empty list (it was an old bug!).
201 import_some on empty list (it was an old bug!).
196
202
197 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
203 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
198 Add deprecation note to ipythonrc and a url to wiki
204 Add deprecation note to ipythonrc and a url to wiki
199 in ipy_user_conf.py
205 in ipy_user_conf.py
200
206
201
207
202 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
208 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
203 as if it was typed on IPython command prompt, i.e.
209 as if it was typed on IPython command prompt, i.e.
204 as IPython script.
210 as IPython script.
205
211
206 * example-magic.py, magic_grepl.py: remove outdated examples
212 * example-magic.py, magic_grepl.py: remove outdated examples
207
213
208 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
214 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
209
215
210 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
216 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
211 is called before any exception has occurred.
217 is called before any exception has occurred.
212
218
213 2006-12-08 Ville Vainio <vivainio@gmail.com>
219 2006-12-08 Ville Vainio <vivainio@gmail.com>
214
220
215 * Extensions/ipy_stock_completers.py: fix cd completer
221 * Extensions/ipy_stock_completers.py: fix cd completer
216 to translate /'s to \'s again.
222 to translate /'s to \'s again.
217
223
218 * completer.py: prevent traceback on file completions w/
224 * completer.py: prevent traceback on file completions w/
219 backslash.
225 backslash.
220
226
221 * Release.py: Update release number to 0.7.3b3 for release
227 * Release.py: Update release number to 0.7.3b3 for release
222
228
223 2006-12-07 Ville Vainio <vivainio@gmail.com>
229 2006-12-07 Ville Vainio <vivainio@gmail.com>
224
230
225 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
231 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
226 while executing external code. Provides more shell-like behaviour
232 while executing external code. Provides more shell-like behaviour
227 and overall better response to ctrl + C / ctrl + break.
233 and overall better response to ctrl + C / ctrl + break.
228
234
229 * tools/make_tarball.py: new script to create tarball straight from svn
235 * tools/make_tarball.py: new script to create tarball straight from svn
230 (setup.py sdist doesn't work on win32).
236 (setup.py sdist doesn't work on win32).
231
237
232 * Extensions/ipy_stock_completers.py: fix cd completer to give up
238 * Extensions/ipy_stock_completers.py: fix cd completer to give up
233 on dirnames with spaces and use the default completer instead.
239 on dirnames with spaces and use the default completer instead.
234
240
235 * Revision.py: Change version to 0.7.3b2 for release.
241 * Revision.py: Change version to 0.7.3b2 for release.
236
242
237 2006-12-05 Ville Vainio <vivainio@gmail.com>
243 2006-12-05 Ville Vainio <vivainio@gmail.com>
238
244
239 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
245 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
240 pydb patch 4 (rm debug printing, py 2.5 checking)
246 pydb patch 4 (rm debug printing, py 2.5 checking)
241
247
242 2006-11-30 Walter Doerwald <walter@livinglogic.de>
248 2006-11-30 Walter Doerwald <walter@livinglogic.de>
243 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
249 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
244 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
250 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
245 "refreshfind" (mapped to "R") does the same but tries to go back to the same
251 "refreshfind" (mapped to "R") does the same but tries to go back to the same
246 object the cursor was on before the refresh. The command "markrange" is
252 object the cursor was on before the refresh. The command "markrange" is
247 mapped to "%" now.
253 mapped to "%" now.
248 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
254 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
249
255
250 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
256 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
251
257
252 * IPython/Magic.py (magic_debug): new %debug magic to activate the
258 * IPython/Magic.py (magic_debug): new %debug magic to activate the
253 interactive debugger on the last traceback, without having to call
259 interactive debugger on the last traceback, without having to call
254 %pdb and rerun your code. Made minor changes in various modules,
260 %pdb and rerun your code. Made minor changes in various modules,
255 should automatically recognize pydb if available.
261 should automatically recognize pydb if available.
256
262
257 2006-11-28 Ville Vainio <vivainio@gmail.com>
263 2006-11-28 Ville Vainio <vivainio@gmail.com>
258
264
259 * completer.py: If the text start with !, show file completions
265 * completer.py: If the text start with !, show file completions
260 properly. This helps when trying to complete command name
266 properly. This helps when trying to complete command name
261 for shell escapes.
267 for shell escapes.
262
268
263 2006-11-27 Ville Vainio <vivainio@gmail.com>
269 2006-11-27 Ville Vainio <vivainio@gmail.com>
264
270
265 * ipy_stock_completers.py: bzr completer submitted by Stefan van
271 * ipy_stock_completers.py: bzr completer submitted by Stefan van
266 der Walt. Clean up svn and hg completers by using a common
272 der Walt. Clean up svn and hg completers by using a common
267 vcs_completer.
273 vcs_completer.
268
274
269 2006-11-26 Ville Vainio <vivainio@gmail.com>
275 2006-11-26 Ville Vainio <vivainio@gmail.com>
270
276
271 * Remove ipconfig and %config; you should use _ip.options structure
277 * Remove ipconfig and %config; you should use _ip.options structure
272 directly instead!
278 directly instead!
273
279
274 * genutils.py: add wrap_deprecated function for deprecating callables
280 * genutils.py: add wrap_deprecated function for deprecating callables
275
281
276 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
282 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
277 _ip.system instead. ipalias is redundant.
283 _ip.system instead. ipalias is redundant.
278
284
279 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
285 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
280 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
286 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
281 explicit.
287 explicit.
282
288
283 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
289 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
284 completer. Try it by entering 'hg ' and pressing tab.
290 completer. Try it by entering 'hg ' and pressing tab.
285
291
286 * macro.py: Give Macro a useful __repr__ method
292 * macro.py: Give Macro a useful __repr__ method
287
293
288 * Magic.py: %whos abbreviates the typename of Macro for brevity.
294 * Magic.py: %whos abbreviates the typename of Macro for brevity.
289
295
290 2006-11-24 Walter Doerwald <walter@livinglogic.de>
296 2006-11-24 Walter Doerwald <walter@livinglogic.de>
291 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
297 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
292 we don't get a duplicate ipipe module, where registration of the xrepr
298 we don't get a duplicate ipipe module, where registration of the xrepr
293 implementation for Text is useless.
299 implementation for Text is useless.
294
300
295 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
301 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
296
302
297 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
303 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
298
304
299 2006-11-24 Ville Vainio <vivainio@gmail.com>
305 2006-11-24 Ville Vainio <vivainio@gmail.com>
300
306
301 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
307 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
302 try to use "cProfile" instead of the slower pure python
308 try to use "cProfile" instead of the slower pure python
303 "profile"
309 "profile"
304
310
305 2006-11-23 Ville Vainio <vivainio@gmail.com>
311 2006-11-23 Ville Vainio <vivainio@gmail.com>
306
312
307 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
313 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
308 Qt+IPython+Designer link in documentation.
314 Qt+IPython+Designer link in documentation.
309
315
310 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
316 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
311 correct Pdb object to %pydb.
317 correct Pdb object to %pydb.
312
318
313
319
314 2006-11-22 Walter Doerwald <walter@livinglogic.de>
320 2006-11-22 Walter Doerwald <walter@livinglogic.de>
315 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
321 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
316 generic xrepr(), otherwise the list implementation would kick in.
322 generic xrepr(), otherwise the list implementation would kick in.
317
323
318 2006-11-21 Ville Vainio <vivainio@gmail.com>
324 2006-11-21 Ville Vainio <vivainio@gmail.com>
319
325
320 * upgrade_dir.py: Now actually overwrites a nonmodified user file
326 * upgrade_dir.py: Now actually overwrites a nonmodified user file
321 with one from UserConfig.
327 with one from UserConfig.
322
328
323 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
329 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
324 it was missing which broke the sh profile.
330 it was missing which broke the sh profile.
325
331
326 * completer.py: file completer now uses explicit '/' instead
332 * completer.py: file completer now uses explicit '/' instead
327 of os.path.join, expansion of 'foo' was broken on win32
333 of os.path.join, expansion of 'foo' was broken on win32
328 if there was one directory with name 'foobar'.
334 if there was one directory with name 'foobar'.
329
335
330 * A bunch of patches from Kirill Smelkov:
336 * A bunch of patches from Kirill Smelkov:
331
337
332 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
338 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
333
339
334 * [patch 7/9] Implement %page -r (page in raw mode) -
340 * [patch 7/9] Implement %page -r (page in raw mode) -
335
341
336 * [patch 5/9] ScientificPython webpage has moved
342 * [patch 5/9] ScientificPython webpage has moved
337
343
338 * [patch 4/9] The manual mentions %ds, should be %dhist
344 * [patch 4/9] The manual mentions %ds, should be %dhist
339
345
340 * [patch 3/9] Kill old bits from %prun doc.
346 * [patch 3/9] Kill old bits from %prun doc.
341
347
342 * [patch 1/9] Fix typos here and there.
348 * [patch 1/9] Fix typos here and there.
343
349
344 2006-11-08 Ville Vainio <vivainio@gmail.com>
350 2006-11-08 Ville Vainio <vivainio@gmail.com>
345
351
346 * completer.py (attr_matches): catch all exceptions raised
352 * completer.py (attr_matches): catch all exceptions raised
347 by eval of expr with dots.
353 by eval of expr with dots.
348
354
349 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
355 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
350
356
351 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
357 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
352 input if it starts with whitespace. This allows you to paste
358 input if it starts with whitespace. This allows you to paste
353 indented input from any editor without manually having to type in
359 indented input from any editor without manually having to type in
354 the 'if 1:', which is convenient when working interactively.
360 the 'if 1:', which is convenient when working interactively.
355 Slightly modifed version of a patch by Bo Peng
361 Slightly modifed version of a patch by Bo Peng
356 <bpeng-AT-rice.edu>.
362 <bpeng-AT-rice.edu>.
357
363
358 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
364 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
359
365
360 * IPython/irunner.py (main): modified irunner so it automatically
366 * IPython/irunner.py (main): modified irunner so it automatically
361 recognizes the right runner to use based on the extension (.py for
367 recognizes the right runner to use based on the extension (.py for
362 python, .ipy for ipython and .sage for sage).
368 python, .ipy for ipython and .sage for sage).
363
369
364 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
370 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
365 visible in ipapi as ip.config(), to programatically control the
371 visible in ipapi as ip.config(), to programatically control the
366 internal rc object. There's an accompanying %config magic for
372 internal rc object. There's an accompanying %config magic for
367 interactive use, which has been enhanced to match the
373 interactive use, which has been enhanced to match the
368 funtionality in ipconfig.
374 funtionality in ipconfig.
369
375
370 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
376 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
371 so it's not just a toggle, it now takes an argument. Add support
377 so it's not just a toggle, it now takes an argument. Add support
372 for a customizable header when making system calls, as the new
378 for a customizable header when making system calls, as the new
373 system_header variable in the ipythonrc file.
379 system_header variable in the ipythonrc file.
374
380
375 2006-11-03 Walter Doerwald <walter@livinglogic.de>
381 2006-11-03 Walter Doerwald <walter@livinglogic.de>
376
382
377 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
383 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
378 generic functions (using Philip J. Eby's simplegeneric package).
384 generic functions (using Philip J. Eby's simplegeneric package).
379 This makes it possible to customize the display of third-party classes
385 This makes it possible to customize the display of third-party classes
380 without having to monkeypatch them. xiter() no longer supports a mode
386 without having to monkeypatch them. xiter() no longer supports a mode
381 argument and the XMode class has been removed. The same functionality can
387 argument and the XMode class has been removed. The same functionality can
382 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
388 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
383 One consequence of the switch to generic functions is that xrepr() and
389 One consequence of the switch to generic functions is that xrepr() and
384 xattrs() implementation must define the default value for the mode
390 xattrs() implementation must define the default value for the mode
385 argument themselves and xattrs() implementations must return real
391 argument themselves and xattrs() implementations must return real
386 descriptors.
392 descriptors.
387
393
388 * IPython/external: This new subpackage will contain all third-party
394 * IPython/external: This new subpackage will contain all third-party
389 packages that are bundled with IPython. (The first one is simplegeneric).
395 packages that are bundled with IPython. (The first one is simplegeneric).
390
396
391 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
397 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
392 directory which as been dropped in r1703.
398 directory which as been dropped in r1703.
393
399
394 * IPython/Extensions/ipipe.py (iless): Fixed.
400 * IPython/Extensions/ipipe.py (iless): Fixed.
395
401
396 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
402 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
397
403
398 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
404 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
399
405
400 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
406 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
401 handling in variable expansion so that shells and magics recognize
407 handling in variable expansion so that shells and magics recognize
402 function local scopes correctly. Bug reported by Brian.
408 function local scopes correctly. Bug reported by Brian.
403
409
404 * scripts/ipython: remove the very first entry in sys.path which
410 * scripts/ipython: remove the very first entry in sys.path which
405 Python auto-inserts for scripts, so that sys.path under IPython is
411 Python auto-inserts for scripts, so that sys.path under IPython is
406 as similar as possible to that under plain Python.
412 as similar as possible to that under plain Python.
407
413
408 * IPython/completer.py (IPCompleter.file_matches): Fix
414 * IPython/completer.py (IPCompleter.file_matches): Fix
409 tab-completion so that quotes are not closed unless the completion
415 tab-completion so that quotes are not closed unless the completion
410 is unambiguous. After a request by Stefan. Minor cleanups in
416 is unambiguous. After a request by Stefan. Minor cleanups in
411 ipy_stock_completers.
417 ipy_stock_completers.
412
418
413 2006-11-02 Ville Vainio <vivainio@gmail.com>
419 2006-11-02 Ville Vainio <vivainio@gmail.com>
414
420
415 * ipy_stock_completers.py: Add %run and %cd completers.
421 * ipy_stock_completers.py: Add %run and %cd completers.
416
422
417 * completer.py: Try running custom completer for both
423 * completer.py: Try running custom completer for both
418 "foo" and "%foo" if the command is just "foo". Ignore case
424 "foo" and "%foo" if the command is just "foo". Ignore case
419 when filtering possible completions.
425 when filtering possible completions.
420
426
421 * UserConfig/ipy_user_conf.py: install stock completers as default
427 * UserConfig/ipy_user_conf.py: install stock completers as default
422
428
423 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
429 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
424 simplified readline history save / restore through a wrapper
430 simplified readline history save / restore through a wrapper
425 function
431 function
426
432
427
433
428 2006-10-31 Ville Vainio <vivainio@gmail.com>
434 2006-10-31 Ville Vainio <vivainio@gmail.com>
429
435
430 * strdispatch.py, completer.py, ipy_stock_completers.py:
436 * strdispatch.py, completer.py, ipy_stock_completers.py:
431 Allow str_key ("command") in completer hooks. Implement
437 Allow str_key ("command") in completer hooks. Implement
432 trivial completer for 'import' (stdlib modules only). Rename
438 trivial completer for 'import' (stdlib modules only). Rename
433 ipy_linux_package_managers.py to ipy_stock_completers.py.
439 ipy_linux_package_managers.py to ipy_stock_completers.py.
434 SVN completer.
440 SVN completer.
435
441
436 * Extensions/ledit.py: %magic line editor for easily and
442 * Extensions/ledit.py: %magic line editor for easily and
437 incrementally manipulating lists of strings. The magic command
443 incrementally manipulating lists of strings. The magic command
438 name is %led.
444 name is %led.
439
445
440 2006-10-30 Ville Vainio <vivainio@gmail.com>
446 2006-10-30 Ville Vainio <vivainio@gmail.com>
441
447
442 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
448 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
443 Bernsteins's patches for pydb integration.
449 Bernsteins's patches for pydb integration.
444 http://bashdb.sourceforge.net/pydb/
450 http://bashdb.sourceforge.net/pydb/
445
451
446 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
452 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
447 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
453 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
448 custom completer hook to allow the users to implement their own
454 custom completer hook to allow the users to implement their own
449 completers. See ipy_linux_package_managers.py for example. The
455 completers. See ipy_linux_package_managers.py for example. The
450 hook name is 'complete_command'.
456 hook name is 'complete_command'.
451
457
452 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
458 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
453
459
454 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
460 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
455 Numeric leftovers.
461 Numeric leftovers.
456
462
457 * ipython.el (py-execute-region): apply Stefan's patch to fix
463 * ipython.el (py-execute-region): apply Stefan's patch to fix
458 garbled results if the python shell hasn't been previously started.
464 garbled results if the python shell hasn't been previously started.
459
465
460 * IPython/genutils.py (arg_split): moved to genutils, since it's a
466 * IPython/genutils.py (arg_split): moved to genutils, since it's a
461 pretty generic function and useful for other things.
467 pretty generic function and useful for other things.
462
468
463 * IPython/OInspect.py (getsource): Add customizable source
469 * IPython/OInspect.py (getsource): Add customizable source
464 extractor. After a request/patch form W. Stein (SAGE).
470 extractor. After a request/patch form W. Stein (SAGE).
465
471
466 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
472 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
467 window size to a more reasonable value from what pexpect does,
473 window size to a more reasonable value from what pexpect does,
468 since their choice causes wrapping bugs with long input lines.
474 since their choice causes wrapping bugs with long input lines.
469
475
470 2006-10-28 Ville Vainio <vivainio@gmail.com>
476 2006-10-28 Ville Vainio <vivainio@gmail.com>
471
477
472 * Magic.py (%run): Save and restore the readline history from
478 * Magic.py (%run): Save and restore the readline history from
473 file around %run commands to prevent side effects from
479 file around %run commands to prevent side effects from
474 %runned programs that might use readline (e.g. pydb).
480 %runned programs that might use readline (e.g. pydb).
475
481
476 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
482 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
477 invoking the pydb enhanced debugger.
483 invoking the pydb enhanced debugger.
478
484
479 2006-10-23 Walter Doerwald <walter@livinglogic.de>
485 2006-10-23 Walter Doerwald <walter@livinglogic.de>
480
486
481 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
487 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
482 call the base class method and propagate the return value to
488 call the base class method and propagate the return value to
483 ifile. This is now done by path itself.
489 ifile. This is now done by path itself.
484
490
485 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
491 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
486
492
487 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
493 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
488 api: set_crash_handler(), to expose the ability to change the
494 api: set_crash_handler(), to expose the ability to change the
489 internal crash handler.
495 internal crash handler.
490
496
491 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
497 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
492 the various parameters of the crash handler so that apps using
498 the various parameters of the crash handler so that apps using
493 IPython as their engine can customize crash handling. Ipmlemented
499 IPython as their engine can customize crash handling. Ipmlemented
494 at the request of SAGE.
500 at the request of SAGE.
495
501
496 2006-10-14 Ville Vainio <vivainio@gmail.com>
502 2006-10-14 Ville Vainio <vivainio@gmail.com>
497
503
498 * Magic.py, ipython.el: applied first "safe" part of Rocky
504 * Magic.py, ipython.el: applied first "safe" part of Rocky
499 Bernstein's patch set for pydb integration.
505 Bernstein's patch set for pydb integration.
500
506
501 * Magic.py (%unalias, %alias): %store'd aliases can now be
507 * Magic.py (%unalias, %alias): %store'd aliases can now be
502 removed with '%unalias'. %alias w/o args now shows most
508 removed with '%unalias'. %alias w/o args now shows most
503 interesting (stored / manually defined) aliases last
509 interesting (stored / manually defined) aliases last
504 where they catch the eye w/o scrolling.
510 where they catch the eye w/o scrolling.
505
511
506 * Magic.py (%rehashx), ext_rehashdir.py: files with
512 * Magic.py (%rehashx), ext_rehashdir.py: files with
507 'py' extension are always considered executable, even
513 'py' extension are always considered executable, even
508 when not in PATHEXT environment variable.
514 when not in PATHEXT environment variable.
509
515
510 2006-10-12 Ville Vainio <vivainio@gmail.com>
516 2006-10-12 Ville Vainio <vivainio@gmail.com>
511
517
512 * jobctrl.py: Add new "jobctrl" extension for spawning background
518 * jobctrl.py: Add new "jobctrl" extension for spawning background
513 processes with "&find /". 'import jobctrl' to try it out. Requires
519 processes with "&find /". 'import jobctrl' to try it out. Requires
514 'subprocess' module, standard in python 2.4+.
520 'subprocess' module, standard in python 2.4+.
515
521
516 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
522 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
517 so if foo -> bar and bar -> baz, then foo -> baz.
523 so if foo -> bar and bar -> baz, then foo -> baz.
518
524
519 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
525 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
520
526
521 * IPython/Magic.py (Magic.parse_options): add a new posix option
527 * IPython/Magic.py (Magic.parse_options): add a new posix option
522 to allow parsing of input args in magics that doesn't strip quotes
528 to allow parsing of input args in magics that doesn't strip quotes
523 (if posix=False). This also closes %timeit bug reported by
529 (if posix=False). This also closes %timeit bug reported by
524 Stefan.
530 Stefan.
525
531
526 2006-10-03 Ville Vainio <vivainio@gmail.com>
532 2006-10-03 Ville Vainio <vivainio@gmail.com>
527
533
528 * iplib.py (raw_input, interact): Return ValueError catching for
534 * iplib.py (raw_input, interact): Return ValueError catching for
529 raw_input. Fixes infinite loop for sys.stdin.close() or
535 raw_input. Fixes infinite loop for sys.stdin.close() or
530 sys.stdout.close().
536 sys.stdout.close().
531
537
532 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
538 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
533
539
534 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
540 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
535 to help in handling doctests. irunner is now pretty useful for
541 to help in handling doctests. irunner is now pretty useful for
536 running standalone scripts and simulate a full interactive session
542 running standalone scripts and simulate a full interactive session
537 in a format that can be then pasted as a doctest.
543 in a format that can be then pasted as a doctest.
538
544
539 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
545 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
540 on top of the default (useless) ones. This also fixes the nasty
546 on top of the default (useless) ones. This also fixes the nasty
541 way in which 2.5's Quitter() exits (reverted [1785]).
547 way in which 2.5's Quitter() exits (reverted [1785]).
542
548
543 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
549 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
544 2.5.
550 2.5.
545
551
546 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
552 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
547 color scheme is updated as well when color scheme is changed
553 color scheme is updated as well when color scheme is changed
548 interactively.
554 interactively.
549
555
550 2006-09-27 Ville Vainio <vivainio@gmail.com>
556 2006-09-27 Ville Vainio <vivainio@gmail.com>
551
557
552 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
558 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
553 infinite loop and just exit. It's a hack, but will do for a while.
559 infinite loop and just exit. It's a hack, but will do for a while.
554
560
555 2006-08-25 Walter Doerwald <walter@livinglogic.de>
561 2006-08-25 Walter Doerwald <walter@livinglogic.de>
556
562
557 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
563 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
558 the constructor, this makes it possible to get a list of only directories
564 the constructor, this makes it possible to get a list of only directories
559 or only files.
565 or only files.
560
566
561 2006-08-12 Ville Vainio <vivainio@gmail.com>
567 2006-08-12 Ville Vainio <vivainio@gmail.com>
562
568
563 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
569 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
564 they broke unittest
570 they broke unittest
565
571
566 2006-08-11 Ville Vainio <vivainio@gmail.com>
572 2006-08-11 Ville Vainio <vivainio@gmail.com>
567
573
568 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
574 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
569 by resolving issue properly, i.e. by inheriting FakeModule
575 by resolving issue properly, i.e. by inheriting FakeModule
570 from types.ModuleType. Pickling ipython interactive data
576 from types.ModuleType. Pickling ipython interactive data
571 should still work as usual (testing appreciated).
577 should still work as usual (testing appreciated).
572
578
573 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
579 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
574
580
575 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
581 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
576 running under python 2.3 with code from 2.4 to fix a bug with
582 running under python 2.3 with code from 2.4 to fix a bug with
577 help(). Reported by the Debian maintainers, Norbert Tretkowski
583 help(). Reported by the Debian maintainers, Norbert Tretkowski
578 <norbert-AT-tretkowski.de> and Alexandre Fayolle
584 <norbert-AT-tretkowski.de> and Alexandre Fayolle
579 <afayolle-AT-debian.org>.
585 <afayolle-AT-debian.org>.
580
586
581 2006-08-04 Walter Doerwald <walter@livinglogic.de>
587 2006-08-04 Walter Doerwald <walter@livinglogic.de>
582
588
583 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
589 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
584 (which was displaying "quit" twice).
590 (which was displaying "quit" twice).
585
591
586 2006-07-28 Walter Doerwald <walter@livinglogic.de>
592 2006-07-28 Walter Doerwald <walter@livinglogic.de>
587
593
588 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
594 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
589 the mode argument).
595 the mode argument).
590
596
591 2006-07-27 Walter Doerwald <walter@livinglogic.de>
597 2006-07-27 Walter Doerwald <walter@livinglogic.de>
592
598
593 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
599 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
594 not running under IPython.
600 not running under IPython.
595
601
596 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
602 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
597 and make it iterable (iterating over the attribute itself). Add two new
603 and make it iterable (iterating over the attribute itself). Add two new
598 magic strings for __xattrs__(): If the string starts with "-", the attribute
604 magic strings for __xattrs__(): If the string starts with "-", the attribute
599 will not be displayed in ibrowse's detail view (but it can still be
605 will not be displayed in ibrowse's detail view (but it can still be
600 iterated over). This makes it possible to add attributes that are large
606 iterated over). This makes it possible to add attributes that are large
601 lists or generator methods to the detail view. Replace magic attribute names
607 lists or generator methods to the detail view. Replace magic attribute names
602 and _attrname() and _getattr() with "descriptors": For each type of magic
608 and _attrname() and _getattr() with "descriptors": For each type of magic
603 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
609 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
604 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
610 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
605 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
611 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
606 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
612 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
607 are still supported.
613 are still supported.
608
614
609 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
615 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
610 fails in ibrowse.fetch(), the exception object is added as the last item
616 fails in ibrowse.fetch(), the exception object is added as the last item
611 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
617 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
612 a generator throws an exception midway through execution.
618 a generator throws an exception midway through execution.
613
619
614 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
620 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
615 encoding into methods.
621 encoding into methods.
616
622
617 2006-07-26 Ville Vainio <vivainio@gmail.com>
623 2006-07-26 Ville Vainio <vivainio@gmail.com>
618
624
619 * iplib.py: history now stores multiline input as single
625 * iplib.py: history now stores multiline input as single
620 history entries. Patch by Jorgen Cederlof.
626 history entries. Patch by Jorgen Cederlof.
621
627
622 2006-07-18 Walter Doerwald <walter@livinglogic.de>
628 2006-07-18 Walter Doerwald <walter@livinglogic.de>
623
629
624 * IPython/Extensions/ibrowse.py: Make cursor visible over
630 * IPython/Extensions/ibrowse.py: Make cursor visible over
625 non existing attributes.
631 non existing attributes.
626
632
627 2006-07-14 Walter Doerwald <walter@livinglogic.de>
633 2006-07-14 Walter Doerwald <walter@livinglogic.de>
628
634
629 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
635 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
630 error output of the running command doesn't mess up the screen.
636 error output of the running command doesn't mess up the screen.
631
637
632 2006-07-13 Walter Doerwald <walter@livinglogic.de>
638 2006-07-13 Walter Doerwald <walter@livinglogic.de>
633
639
634 * IPython/Extensions/ipipe.py (isort): Make isort usable without
640 * IPython/Extensions/ipipe.py (isort): Make isort usable without
635 argument. This sorts the items themselves.
641 argument. This sorts the items themselves.
636
642
637 2006-07-12 Walter Doerwald <walter@livinglogic.de>
643 2006-07-12 Walter Doerwald <walter@livinglogic.de>
638
644
639 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
645 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
640 Compile expression strings into code objects. This should speed
646 Compile expression strings into code objects. This should speed
641 up ifilter and friends somewhat.
647 up ifilter and friends somewhat.
642
648
643 2006-07-08 Ville Vainio <vivainio@gmail.com>
649 2006-07-08 Ville Vainio <vivainio@gmail.com>
644
650
645 * Magic.py: %cpaste now strips > from the beginning of lines
651 * Magic.py: %cpaste now strips > from the beginning of lines
646 to ease pasting quoted code from emails. Contributed by
652 to ease pasting quoted code from emails. Contributed by
647 Stefan van der Walt.
653 Stefan van der Walt.
648
654
649 2006-06-29 Ville Vainio <vivainio@gmail.com>
655 2006-06-29 Ville Vainio <vivainio@gmail.com>
650
656
651 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
657 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
652 mode, patch contributed by Darren Dale. NEEDS TESTING!
658 mode, patch contributed by Darren Dale. NEEDS TESTING!
653
659
654 2006-06-28 Walter Doerwald <walter@livinglogic.de>
660 2006-06-28 Walter Doerwald <walter@livinglogic.de>
655
661
656 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
662 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
657 a blue background. Fix fetching new display rows when the browser
663 a blue background. Fix fetching new display rows when the browser
658 scrolls more than a screenful (e.g. by using the goto command).
664 scrolls more than a screenful (e.g. by using the goto command).
659
665
660 2006-06-27 Ville Vainio <vivainio@gmail.com>
666 2006-06-27 Ville Vainio <vivainio@gmail.com>
661
667
662 * Magic.py (_inspect, _ofind) Apply David Huard's
668 * Magic.py (_inspect, _ofind) Apply David Huard's
663 patch for displaying the correct docstring for 'property'
669 patch for displaying the correct docstring for 'property'
664 attributes.
670 attributes.
665
671
666 2006-06-23 Walter Doerwald <walter@livinglogic.de>
672 2006-06-23 Walter Doerwald <walter@livinglogic.de>
667
673
668 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
674 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
669 commands into the methods implementing them.
675 commands into the methods implementing them.
670
676
671 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
677 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
672
678
673 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
679 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
674 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
680 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
675 autoindent support was authored by Jin Liu.
681 autoindent support was authored by Jin Liu.
676
682
677 2006-06-22 Walter Doerwald <walter@livinglogic.de>
683 2006-06-22 Walter Doerwald <walter@livinglogic.de>
678
684
679 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
685 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
680 for keymaps with a custom class that simplifies handling.
686 for keymaps with a custom class that simplifies handling.
681
687
682 2006-06-19 Walter Doerwald <walter@livinglogic.de>
688 2006-06-19 Walter Doerwald <walter@livinglogic.de>
683
689
684 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
690 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
685 resizing. This requires Python 2.5 to work.
691 resizing. This requires Python 2.5 to work.
686
692
687 2006-06-16 Walter Doerwald <walter@livinglogic.de>
693 2006-06-16 Walter Doerwald <walter@livinglogic.de>
688
694
689 * IPython/Extensions/ibrowse.py: Add two new commands to
695 * IPython/Extensions/ibrowse.py: Add two new commands to
690 ibrowse: "hideattr" (mapped to "h") hides the attribute under
696 ibrowse: "hideattr" (mapped to "h") hides the attribute under
691 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
697 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
692 attributes again. Remapped the help command to "?". Display
698 attributes again. Remapped the help command to "?". Display
693 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
699 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
694 as keys for the "home" and "end" commands. Add three new commands
700 as keys for the "home" and "end" commands. Add three new commands
695 to the input mode for "find" and friends: "delend" (CTRL-K)
701 to the input mode for "find" and friends: "delend" (CTRL-K)
696 deletes to the end of line. "incsearchup" searches upwards in the
702 deletes to the end of line. "incsearchup" searches upwards in the
697 command history for an input that starts with the text before the cursor.
703 command history for an input that starts with the text before the cursor.
698 "incsearchdown" does the same downwards. Removed a bogus mapping of
704 "incsearchdown" does the same downwards. Removed a bogus mapping of
699 the x key to "delete".
705 the x key to "delete".
700
706
701 2006-06-15 Ville Vainio <vivainio@gmail.com>
707 2006-06-15 Ville Vainio <vivainio@gmail.com>
702
708
703 * iplib.py, hooks.py: Added new generate_prompt hook that can be
709 * iplib.py, hooks.py: Added new generate_prompt hook that can be
704 used to create prompts dynamically, instead of the "old" way of
710 used to create prompts dynamically, instead of the "old" way of
705 assigning "magic" strings to prompt_in1 and prompt_in2. The old
711 assigning "magic" strings to prompt_in1 and prompt_in2. The old
706 way still works (it's invoked by the default hook), of course.
712 way still works (it's invoked by the default hook), of course.
707
713
708 * Prompts.py: added generate_output_prompt hook for altering output
714 * Prompts.py: added generate_output_prompt hook for altering output
709 prompt
715 prompt
710
716
711 * Release.py: Changed version string to 0.7.3.svn.
717 * Release.py: Changed version string to 0.7.3.svn.
712
718
713 2006-06-15 Walter Doerwald <walter@livinglogic.de>
719 2006-06-15 Walter Doerwald <walter@livinglogic.de>
714
720
715 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
721 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
716 the call to fetch() always tries to fetch enough data for at least one
722 the call to fetch() always tries to fetch enough data for at least one
717 full screen. This makes it possible to simply call moveto(0,0,True) in
723 full screen. This makes it possible to simply call moveto(0,0,True) in
718 the constructor. Fix typos and removed the obsolete goto attribute.
724 the constructor. Fix typos and removed the obsolete goto attribute.
719
725
720 2006-06-12 Ville Vainio <vivainio@gmail.com>
726 2006-06-12 Ville Vainio <vivainio@gmail.com>
721
727
722 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
728 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
723 allowing $variable interpolation within multiline statements,
729 allowing $variable interpolation within multiline statements,
724 though so far only with "sh" profile for a testing period.
730 though so far only with "sh" profile for a testing period.
725 The patch also enables splitting long commands with \ but it
731 The patch also enables splitting long commands with \ but it
726 doesn't work properly yet.
732 doesn't work properly yet.
727
733
728 2006-06-12 Walter Doerwald <walter@livinglogic.de>
734 2006-06-12 Walter Doerwald <walter@livinglogic.de>
729
735
730 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
736 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
731 input history and the position of the cursor in the input history for
737 input history and the position of the cursor in the input history for
732 the find, findbackwards and goto command.
738 the find, findbackwards and goto command.
733
739
734 2006-06-10 Walter Doerwald <walter@livinglogic.de>
740 2006-06-10 Walter Doerwald <walter@livinglogic.de>
735
741
736 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
742 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
737 implements the basic functionality of browser commands that require
743 implements the basic functionality of browser commands that require
738 input. Reimplement the goto, find and findbackwards commands as
744 input. Reimplement the goto, find and findbackwards commands as
739 subclasses of _CommandInput. Add an input history and keymaps to those
745 subclasses of _CommandInput. Add an input history and keymaps to those
740 commands. Add "\r" as a keyboard shortcut for the enterdefault and
746 commands. Add "\r" as a keyboard shortcut for the enterdefault and
741 execute commands.
747 execute commands.
742
748
743 2006-06-07 Ville Vainio <vivainio@gmail.com>
749 2006-06-07 Ville Vainio <vivainio@gmail.com>
744
750
745 * iplib.py: ipython mybatch.ipy exits ipython immediately after
751 * iplib.py: ipython mybatch.ipy exits ipython immediately after
746 running the batch files instead of leaving the session open.
752 running the batch files instead of leaving the session open.
747
753
748 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
754 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
749
755
750 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
756 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
751 the original fix was incomplete. Patch submitted by W. Maier.
757 the original fix was incomplete. Patch submitted by W. Maier.
752
758
753 2006-06-07 Ville Vainio <vivainio@gmail.com>
759 2006-06-07 Ville Vainio <vivainio@gmail.com>
754
760
755 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
761 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
756 Confirmation prompts can be supressed by 'quiet' option.
762 Confirmation prompts can be supressed by 'quiet' option.
757 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
763 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
758
764
759 2006-06-06 *** Released version 0.7.2
765 2006-06-06 *** Released version 0.7.2
760
766
761 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
767 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
762
768
763 * IPython/Release.py (version): Made 0.7.2 final for release.
769 * IPython/Release.py (version): Made 0.7.2 final for release.
764 Repo tagged and release cut.
770 Repo tagged and release cut.
765
771
766 2006-06-05 Ville Vainio <vivainio@gmail.com>
772 2006-06-05 Ville Vainio <vivainio@gmail.com>
767
773
768 * Magic.py (magic_rehashx): Honor no_alias list earlier in
774 * Magic.py (magic_rehashx): Honor no_alias list earlier in
769 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
775 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
770
776
771 * upgrade_dir.py: try import 'path' module a bit harder
777 * upgrade_dir.py: try import 'path' module a bit harder
772 (for %upgrade)
778 (for %upgrade)
773
779
774 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
780 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
775
781
776 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
782 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
777 instead of looping 20 times.
783 instead of looping 20 times.
778
784
779 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
785 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
780 correctly at initialization time. Bug reported by Krishna Mohan
786 correctly at initialization time. Bug reported by Krishna Mohan
781 Gundu <gkmohan-AT-gmail.com> on the user list.
787 Gundu <gkmohan-AT-gmail.com> on the user list.
782
788
783 * IPython/Release.py (version): Mark 0.7.2 version to start
789 * IPython/Release.py (version): Mark 0.7.2 version to start
784 testing for release on 06/06.
790 testing for release on 06/06.
785
791
786 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
792 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
787
793
788 * scripts/irunner: thin script interface so users don't have to
794 * scripts/irunner: thin script interface so users don't have to
789 find the module and call it as an executable, since modules rarely
795 find the module and call it as an executable, since modules rarely
790 live in people's PATH.
796 live in people's PATH.
791
797
792 * IPython/irunner.py (InteractiveRunner.__init__): added
798 * IPython/irunner.py (InteractiveRunner.__init__): added
793 delaybeforesend attribute to control delays with newer versions of
799 delaybeforesend attribute to control delays with newer versions of
794 pexpect. Thanks to detailed help from pexpect's author, Noah
800 pexpect. Thanks to detailed help from pexpect's author, Noah
795 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
801 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
796 correctly (it works in NoColor mode).
802 correctly (it works in NoColor mode).
797
803
798 * IPython/iplib.py (handle_normal): fix nasty crash reported on
804 * IPython/iplib.py (handle_normal): fix nasty crash reported on
799 SAGE list, from improper log() calls.
805 SAGE list, from improper log() calls.
800
806
801 2006-05-31 Ville Vainio <vivainio@gmail.com>
807 2006-05-31 Ville Vainio <vivainio@gmail.com>
802
808
803 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
809 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
804 with args in parens to work correctly with dirs that have spaces.
810 with args in parens to work correctly with dirs that have spaces.
805
811
806 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
812 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
807
813
808 * IPython/Logger.py (Logger.logstart): add option to log raw input
814 * IPython/Logger.py (Logger.logstart): add option to log raw input
809 instead of the processed one. A -r flag was added to the
815 instead of the processed one. A -r flag was added to the
810 %logstart magic used for controlling logging.
816 %logstart magic used for controlling logging.
811
817
812 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
818 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
813
819
814 * IPython/iplib.py (InteractiveShell.__init__): add check for the
820 * IPython/iplib.py (InteractiveShell.__init__): add check for the
815 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
821 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
816 recognize the option. After a bug report by Will Maier. This
822 recognize the option. After a bug report by Will Maier. This
817 closes #64 (will do it after confirmation from W. Maier).
823 closes #64 (will do it after confirmation from W. Maier).
818
824
819 * IPython/irunner.py: New module to run scripts as if manually
825 * IPython/irunner.py: New module to run scripts as if manually
820 typed into an interactive environment, based on pexpect. After a
826 typed into an interactive environment, based on pexpect. After a
821 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
827 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
822 ipython-user list. Simple unittests in the tests/ directory.
828 ipython-user list. Simple unittests in the tests/ directory.
823
829
824 * tools/release: add Will Maier, OpenBSD port maintainer, to
830 * tools/release: add Will Maier, OpenBSD port maintainer, to
825 recepients list. We are now officially part of the OpenBSD ports:
831 recepients list. We are now officially part of the OpenBSD ports:
826 http://www.openbsd.org/ports.html ! Many thanks to Will for the
832 http://www.openbsd.org/ports.html ! Many thanks to Will for the
827 work.
833 work.
828
834
829 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
835 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
830
836
831 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
837 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
832 so that it doesn't break tkinter apps.
838 so that it doesn't break tkinter apps.
833
839
834 * IPython/iplib.py (_prefilter): fix bug where aliases would
840 * IPython/iplib.py (_prefilter): fix bug where aliases would
835 shadow variables when autocall was fully off. Reported by SAGE
841 shadow variables when autocall was fully off. Reported by SAGE
836 author William Stein.
842 author William Stein.
837
843
838 * IPython/OInspect.py (Inspector.__init__): add a flag to control
844 * IPython/OInspect.py (Inspector.__init__): add a flag to control
839 at what detail level strings are computed when foo? is requested.
845 at what detail level strings are computed when foo? is requested.
840 This allows users to ask for example that the string form of an
846 This allows users to ask for example that the string form of an
841 object is only computed when foo?? is called, or even never, by
847 object is only computed when foo?? is called, or even never, by
842 setting the object_info_string_level >= 2 in the configuration
848 setting the object_info_string_level >= 2 in the configuration
843 file. This new option has been added and documented. After a
849 file. This new option has been added and documented. After a
844 request by SAGE to be able to control the printing of very large
850 request by SAGE to be able to control the printing of very large
845 objects more easily.
851 objects more easily.
846
852
847 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
853 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
848
854
849 * IPython/ipmaker.py (make_IPython): remove the ipython call path
855 * IPython/ipmaker.py (make_IPython): remove the ipython call path
850 from sys.argv, to be 100% consistent with how Python itself works
856 from sys.argv, to be 100% consistent with how Python itself works
851 (as seen for example with python -i file.py). After a bug report
857 (as seen for example with python -i file.py). After a bug report
852 by Jeffrey Collins.
858 by Jeffrey Collins.
853
859
854 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
860 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
855 nasty bug which was preventing custom namespaces with -pylab,
861 nasty bug which was preventing custom namespaces with -pylab,
856 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
862 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
857 compatibility (long gone from mpl).
863 compatibility (long gone from mpl).
858
864
859 * IPython/ipapi.py (make_session): name change: create->make. We
865 * IPython/ipapi.py (make_session): name change: create->make. We
860 use make in other places (ipmaker,...), it's shorter and easier to
866 use make in other places (ipmaker,...), it's shorter and easier to
861 type and say, etc. I'm trying to clean things before 0.7.2 so
867 type and say, etc. I'm trying to clean things before 0.7.2 so
862 that I can keep things stable wrt to ipapi in the chainsaw branch.
868 that I can keep things stable wrt to ipapi in the chainsaw branch.
863
869
864 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
870 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
865 python-mode recognizes our debugger mode. Add support for
871 python-mode recognizes our debugger mode. Add support for
866 autoindent inside (X)emacs. After a patch sent in by Jin Liu
872 autoindent inside (X)emacs. After a patch sent in by Jin Liu
867 <m.liu.jin-AT-gmail.com> originally written by
873 <m.liu.jin-AT-gmail.com> originally written by
868 doxgen-AT-newsmth.net (with minor modifications for xemacs
874 doxgen-AT-newsmth.net (with minor modifications for xemacs
869 compatibility)
875 compatibility)
870
876
871 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
877 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
872 tracebacks when walking the stack so that the stack tracking system
878 tracebacks when walking the stack so that the stack tracking system
873 in emacs' python-mode can identify the frames correctly.
879 in emacs' python-mode can identify the frames correctly.
874
880
875 * IPython/ipmaker.py (make_IPython): make the internal (and
881 * IPython/ipmaker.py (make_IPython): make the internal (and
876 default config) autoedit_syntax value false by default. Too many
882 default config) autoedit_syntax value false by default. Too many
877 users have complained to me (both on and off-list) about problems
883 users have complained to me (both on and off-list) about problems
878 with this option being on by default, so I'm making it default to
884 with this option being on by default, so I'm making it default to
879 off. It can still be enabled by anyone via the usual mechanisms.
885 off. It can still be enabled by anyone via the usual mechanisms.
880
886
881 * IPython/completer.py (Completer.attr_matches): add support for
887 * IPython/completer.py (Completer.attr_matches): add support for
882 PyCrust-style _getAttributeNames magic method. Patch contributed
888 PyCrust-style _getAttributeNames magic method. Patch contributed
883 by <mscott-AT-goldenspud.com>. Closes #50.
889 by <mscott-AT-goldenspud.com>. Closes #50.
884
890
885 * IPython/iplib.py (InteractiveShell.__init__): remove the
891 * IPython/iplib.py (InteractiveShell.__init__): remove the
886 deletion of exit/quit from __builtin__, which can break
892 deletion of exit/quit from __builtin__, which can break
887 third-party tools like the Zope debugging console. The
893 third-party tools like the Zope debugging console. The
888 %exit/%quit magics remain. In general, it's probably a good idea
894 %exit/%quit magics remain. In general, it's probably a good idea
889 not to delete anything from __builtin__, since we never know what
895 not to delete anything from __builtin__, since we never know what
890 that will break. In any case, python now (for 2.5) will support
896 that will break. In any case, python now (for 2.5) will support
891 'real' exit/quit, so this issue is moot. Closes #55.
897 'real' exit/quit, so this issue is moot. Closes #55.
892
898
893 * IPython/genutils.py (with_obj): rename the 'with' function to
899 * IPython/genutils.py (with_obj): rename the 'with' function to
894 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
900 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
895 becomes a language keyword. Closes #53.
901 becomes a language keyword. Closes #53.
896
902
897 * IPython/FakeModule.py (FakeModule.__init__): add a proper
903 * IPython/FakeModule.py (FakeModule.__init__): add a proper
898 __file__ attribute to this so it fools more things into thinking
904 __file__ attribute to this so it fools more things into thinking
899 it is a real module. Closes #59.
905 it is a real module. Closes #59.
900
906
901 * IPython/Magic.py (magic_edit): add -n option to open the editor
907 * IPython/Magic.py (magic_edit): add -n option to open the editor
902 at a specific line number. After a patch by Stefan van der Walt.
908 at a specific line number. After a patch by Stefan van der Walt.
903
909
904 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
910 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
905
911
906 * IPython/iplib.py (edit_syntax_error): fix crash when for some
912 * IPython/iplib.py (edit_syntax_error): fix crash when for some
907 reason the file could not be opened. After automatic crash
913 reason the file could not be opened. After automatic crash
908 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
914 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
909 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
915 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
910 (_should_recompile): Don't fire editor if using %bg, since there
916 (_should_recompile): Don't fire editor if using %bg, since there
911 is no file in the first place. From the same report as above.
917 is no file in the first place. From the same report as above.
912 (raw_input): protect against faulty third-party prefilters. After
918 (raw_input): protect against faulty third-party prefilters. After
913 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
919 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
914 while running under SAGE.
920 while running under SAGE.
915
921
916 2006-05-23 Ville Vainio <vivainio@gmail.com>
922 2006-05-23 Ville Vainio <vivainio@gmail.com>
917
923
918 * ipapi.py: Stripped down ip.to_user_ns() to work only as
924 * ipapi.py: Stripped down ip.to_user_ns() to work only as
919 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
925 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
920 now returns None (again), unless dummy is specifically allowed by
926 now returns None (again), unless dummy is specifically allowed by
921 ipapi.get(allow_dummy=True).
927 ipapi.get(allow_dummy=True).
922
928
923 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
929 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
924
930
925 * IPython: remove all 2.2-compatibility objects and hacks from
931 * IPython: remove all 2.2-compatibility objects and hacks from
926 everywhere, since we only support 2.3 at this point. Docs
932 everywhere, since we only support 2.3 at this point. Docs
927 updated.
933 updated.
928
934
929 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
935 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
930 Anything requiring extra validation can be turned into a Python
936 Anything requiring extra validation can be turned into a Python
931 property in the future. I used a property for the db one b/c
937 property in the future. I used a property for the db one b/c
932 there was a nasty circularity problem with the initialization
938 there was a nasty circularity problem with the initialization
933 order, which right now I don't have time to clean up.
939 order, which right now I don't have time to clean up.
934
940
935 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
941 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
936 another locking bug reported by Jorgen. I'm not 100% sure though,
942 another locking bug reported by Jorgen. I'm not 100% sure though,
937 so more testing is needed...
943 so more testing is needed...
938
944
939 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
945 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
940
946
941 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
947 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
942 local variables from any routine in user code (typically executed
948 local variables from any routine in user code (typically executed
943 with %run) directly into the interactive namespace. Very useful
949 with %run) directly into the interactive namespace. Very useful
944 when doing complex debugging.
950 when doing complex debugging.
945 (IPythonNotRunning): Changed the default None object to a dummy
951 (IPythonNotRunning): Changed the default None object to a dummy
946 whose attributes can be queried as well as called without
952 whose attributes can be queried as well as called without
947 exploding, to ease writing code which works transparently both in
953 exploding, to ease writing code which works transparently both in
948 and out of ipython and uses some of this API.
954 and out of ipython and uses some of this API.
949
955
950 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
956 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
951
957
952 * IPython/hooks.py (result_display): Fix the fact that our display
958 * IPython/hooks.py (result_display): Fix the fact that our display
953 hook was using str() instead of repr(), as the default python
959 hook was using str() instead of repr(), as the default python
954 console does. This had gone unnoticed b/c it only happened if
960 console does. This had gone unnoticed b/c it only happened if
955 %Pprint was off, but the inconsistency was there.
961 %Pprint was off, but the inconsistency was there.
956
962
957 2006-05-15 Ville Vainio <vivainio@gmail.com>
963 2006-05-15 Ville Vainio <vivainio@gmail.com>
958
964
959 * Oinspect.py: Only show docstring for nonexisting/binary files
965 * Oinspect.py: Only show docstring for nonexisting/binary files
960 when doing object??, closing ticket #62
966 when doing object??, closing ticket #62
961
967
962 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
968 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
963
969
964 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
970 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
965 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
971 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
966 was being released in a routine which hadn't checked if it had
972 was being released in a routine which hadn't checked if it had
967 been the one to acquire it.
973 been the one to acquire it.
968
974
969 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
975 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
970
976
971 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
977 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
972
978
973 2006-04-11 Ville Vainio <vivainio@gmail.com>
979 2006-04-11 Ville Vainio <vivainio@gmail.com>
974
980
975 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
981 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
976 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
982 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
977 prefilters, allowing stuff like magics and aliases in the file.
983 prefilters, allowing stuff like magics and aliases in the file.
978
984
979 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
985 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
980 added. Supported now are "%clear in" and "%clear out" (clear input and
986 added. Supported now are "%clear in" and "%clear out" (clear input and
981 output history, respectively). Also fixed CachedOutput.flush to
987 output history, respectively). Also fixed CachedOutput.flush to
982 properly flush the output cache.
988 properly flush the output cache.
983
989
984 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
990 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
985 half-success (and fail explicitly).
991 half-success (and fail explicitly).
986
992
987 2006-03-28 Ville Vainio <vivainio@gmail.com>
993 2006-03-28 Ville Vainio <vivainio@gmail.com>
988
994
989 * iplib.py: Fix quoting of aliases so that only argless ones
995 * iplib.py: Fix quoting of aliases so that only argless ones
990 are quoted
996 are quoted
991
997
992 2006-03-28 Ville Vainio <vivainio@gmail.com>
998 2006-03-28 Ville Vainio <vivainio@gmail.com>
993
999
994 * iplib.py: Quote aliases with spaces in the name.
1000 * iplib.py: Quote aliases with spaces in the name.
995 "c:\program files\blah\bin" is now legal alias target.
1001 "c:\program files\blah\bin" is now legal alias target.
996
1002
997 * ext_rehashdir.py: Space no longer allowed as arg
1003 * ext_rehashdir.py: Space no longer allowed as arg
998 separator, since space is legal in path names.
1004 separator, since space is legal in path names.
999
1005
1000 2006-03-16 Ville Vainio <vivainio@gmail.com>
1006 2006-03-16 Ville Vainio <vivainio@gmail.com>
1001
1007
1002 * upgrade_dir.py: Take path.py from Extensions, correcting
1008 * upgrade_dir.py: Take path.py from Extensions, correcting
1003 %upgrade magic
1009 %upgrade magic
1004
1010
1005 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1011 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1006
1012
1007 * hooks.py: Only enclose editor binary in quotes if legal and
1013 * hooks.py: Only enclose editor binary in quotes if legal and
1008 necessary (space in the name, and is an existing file). Fixes a bug
1014 necessary (space in the name, and is an existing file). Fixes a bug
1009 reported by Zachary Pincus.
1015 reported by Zachary Pincus.
1010
1016
1011 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1017 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1012
1018
1013 * Manual: thanks to a tip on proper color handling for Emacs, by
1019 * Manual: thanks to a tip on proper color handling for Emacs, by
1014 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1020 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1015
1021
1016 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1022 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1017 by applying the provided patch. Thanks to Liu Jin
1023 by applying the provided patch. Thanks to Liu Jin
1018 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1024 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1019 XEmacs/Linux, I'm trusting the submitter that it actually helps
1025 XEmacs/Linux, I'm trusting the submitter that it actually helps
1020 under win32/GNU Emacs. Will revisit if any problems are reported.
1026 under win32/GNU Emacs. Will revisit if any problems are reported.
1021
1027
1022 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1028 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1023
1029
1024 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1030 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1025 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1031 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1026
1032
1027 2006-03-12 Ville Vainio <vivainio@gmail.com>
1033 2006-03-12 Ville Vainio <vivainio@gmail.com>
1028
1034
1029 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1035 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1030 Torsten Marek.
1036 Torsten Marek.
1031
1037
1032 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1038 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1033
1039
1034 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1040 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1035 line ranges works again.
1041 line ranges works again.
1036
1042
1037 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1043 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1038
1044
1039 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1045 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1040 and friends, after a discussion with Zach Pincus on ipython-user.
1046 and friends, after a discussion with Zach Pincus on ipython-user.
1041 I'm not 100% sure, but after thinking about it quite a bit, it may
1047 I'm not 100% sure, but after thinking about it quite a bit, it may
1042 be OK. Testing with the multithreaded shells didn't reveal any
1048 be OK. Testing with the multithreaded shells didn't reveal any
1043 problems, but let's keep an eye out.
1049 problems, but let's keep an eye out.
1044
1050
1045 In the process, I fixed a few things which were calling
1051 In the process, I fixed a few things which were calling
1046 self.InteractiveTB() directly (like safe_execfile), which is a
1052 self.InteractiveTB() directly (like safe_execfile), which is a
1047 mistake: ALL exception reporting should be done by calling
1053 mistake: ALL exception reporting should be done by calling
1048 self.showtraceback(), which handles state and tab-completion and
1054 self.showtraceback(), which handles state and tab-completion and
1049 more.
1055 more.
1050
1056
1051 2006-03-01 Ville Vainio <vivainio@gmail.com>
1057 2006-03-01 Ville Vainio <vivainio@gmail.com>
1052
1058
1053 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1059 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1054 To use, do "from ipipe import *".
1060 To use, do "from ipipe import *".
1055
1061
1056 2006-02-24 Ville Vainio <vivainio@gmail.com>
1062 2006-02-24 Ville Vainio <vivainio@gmail.com>
1057
1063
1058 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1064 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1059 "cleanly" and safely than the older upgrade mechanism.
1065 "cleanly" and safely than the older upgrade mechanism.
1060
1066
1061 2006-02-21 Ville Vainio <vivainio@gmail.com>
1067 2006-02-21 Ville Vainio <vivainio@gmail.com>
1062
1068
1063 * Magic.py: %save works again.
1069 * Magic.py: %save works again.
1064
1070
1065 2006-02-15 Ville Vainio <vivainio@gmail.com>
1071 2006-02-15 Ville Vainio <vivainio@gmail.com>
1066
1072
1067 * Magic.py: %Pprint works again
1073 * Magic.py: %Pprint works again
1068
1074
1069 * Extensions/ipy_sane_defaults.py: Provide everything provided
1075 * Extensions/ipy_sane_defaults.py: Provide everything provided
1070 in default ipythonrc, to make it possible to have a completely empty
1076 in default ipythonrc, to make it possible to have a completely empty
1071 ipythonrc (and thus completely rc-file free configuration)
1077 ipythonrc (and thus completely rc-file free configuration)
1072
1078
1073 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1079 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1074
1080
1075 * IPython/hooks.py (editor): quote the call to the editor command,
1081 * IPython/hooks.py (editor): quote the call to the editor command,
1076 to allow commands with spaces in them. Problem noted by watching
1082 to allow commands with spaces in them. Problem noted by watching
1077 Ian Oswald's video about textpad under win32 at
1083 Ian Oswald's video about textpad under win32 at
1078 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1084 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1079
1085
1080 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1086 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1081 describing magics (we haven't used @ for a loong time).
1087 describing magics (we haven't used @ for a loong time).
1082
1088
1083 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1089 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1084 contributed by marienz to close
1090 contributed by marienz to close
1085 http://www.scipy.net/roundup/ipython/issue53.
1091 http://www.scipy.net/roundup/ipython/issue53.
1086
1092
1087 2006-02-10 Ville Vainio <vivainio@gmail.com>
1093 2006-02-10 Ville Vainio <vivainio@gmail.com>
1088
1094
1089 * genutils.py: getoutput now works in win32 too
1095 * genutils.py: getoutput now works in win32 too
1090
1096
1091 * completer.py: alias and magic completion only invoked
1097 * completer.py: alias and magic completion only invoked
1092 at the first "item" in the line, to avoid "cd %store"
1098 at the first "item" in the line, to avoid "cd %store"
1093 nonsense.
1099 nonsense.
1094
1100
1095 2006-02-09 Ville Vainio <vivainio@gmail.com>
1101 2006-02-09 Ville Vainio <vivainio@gmail.com>
1096
1102
1097 * test/*: Added a unit testing framework (finally).
1103 * test/*: Added a unit testing framework (finally).
1098 '%run runtests.py' to run test_*.
1104 '%run runtests.py' to run test_*.
1099
1105
1100 * ipapi.py: Exposed runlines and set_custom_exc
1106 * ipapi.py: Exposed runlines and set_custom_exc
1101
1107
1102 2006-02-07 Ville Vainio <vivainio@gmail.com>
1108 2006-02-07 Ville Vainio <vivainio@gmail.com>
1103
1109
1104 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1110 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1105 instead use "f(1 2)" as before.
1111 instead use "f(1 2)" as before.
1106
1112
1107 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1113 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1108
1114
1109 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1115 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1110 facilities, for demos processed by the IPython input filter
1116 facilities, for demos processed by the IPython input filter
1111 (IPythonDemo), and for running a script one-line-at-a-time as a
1117 (IPythonDemo), and for running a script one-line-at-a-time as a
1112 demo, both for pure Python (LineDemo) and for IPython-processed
1118 demo, both for pure Python (LineDemo) and for IPython-processed
1113 input (IPythonLineDemo). After a request by Dave Kohel, from the
1119 input (IPythonLineDemo). After a request by Dave Kohel, from the
1114 SAGE team.
1120 SAGE team.
1115 (Demo.edit): added an edit() method to the demo objects, to edit
1121 (Demo.edit): added an edit() method to the demo objects, to edit
1116 the in-memory copy of the last executed block.
1122 the in-memory copy of the last executed block.
1117
1123
1118 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1124 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1119 processing to %edit, %macro and %save. These commands can now be
1125 processing to %edit, %macro and %save. These commands can now be
1120 invoked on the unprocessed input as it was typed by the user
1126 invoked on the unprocessed input as it was typed by the user
1121 (without any prefilters applied). After requests by the SAGE team
1127 (without any prefilters applied). After requests by the SAGE team
1122 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1128 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1123
1129
1124 2006-02-01 Ville Vainio <vivainio@gmail.com>
1130 2006-02-01 Ville Vainio <vivainio@gmail.com>
1125
1131
1126 * setup.py, eggsetup.py: easy_install ipython==dev works
1132 * setup.py, eggsetup.py: easy_install ipython==dev works
1127 correctly now (on Linux)
1133 correctly now (on Linux)
1128
1134
1129 * ipy_user_conf,ipmaker: user config changes, removed spurious
1135 * ipy_user_conf,ipmaker: user config changes, removed spurious
1130 warnings
1136 warnings
1131
1137
1132 * iplib: if rc.banner is string, use it as is.
1138 * iplib: if rc.banner is string, use it as is.
1133
1139
1134 * Magic: %pycat accepts a string argument and pages it's contents.
1140 * Magic: %pycat accepts a string argument and pages it's contents.
1135
1141
1136
1142
1137 2006-01-30 Ville Vainio <vivainio@gmail.com>
1143 2006-01-30 Ville Vainio <vivainio@gmail.com>
1138
1144
1139 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1145 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1140 Now %store and bookmarks work through PickleShare, meaning that
1146 Now %store and bookmarks work through PickleShare, meaning that
1141 concurrent access is possible and all ipython sessions see the
1147 concurrent access is possible and all ipython sessions see the
1142 same database situation all the time, instead of snapshot of
1148 same database situation all the time, instead of snapshot of
1143 the situation when the session was started. Hence, %bookmark
1149 the situation when the session was started. Hence, %bookmark
1144 results are immediately accessible from othes sessions. The database
1150 results are immediately accessible from othes sessions. The database
1145 is also available for use by user extensions. See:
1151 is also available for use by user extensions. See:
1146 http://www.python.org/pypi/pickleshare
1152 http://www.python.org/pypi/pickleshare
1147
1153
1148 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1154 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1149
1155
1150 * aliases can now be %store'd
1156 * aliases can now be %store'd
1151
1157
1152 * path.py moved to Extensions so that pickleshare does not need
1158 * path.py moved to Extensions so that pickleshare does not need
1153 IPython-specific import. Extensions added to pythonpath right
1159 IPython-specific import. Extensions added to pythonpath right
1154 at __init__.
1160 at __init__.
1155
1161
1156 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1162 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1157 called with _ip.system and the pre-transformed command string.
1163 called with _ip.system and the pre-transformed command string.
1158
1164
1159 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1165 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1160
1166
1161 * IPython/iplib.py (interact): Fix that we were not catching
1167 * IPython/iplib.py (interact): Fix that we were not catching
1162 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1168 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1163 logic here had to change, but it's fixed now.
1169 logic here had to change, but it's fixed now.
1164
1170
1165 2006-01-29 Ville Vainio <vivainio@gmail.com>
1171 2006-01-29 Ville Vainio <vivainio@gmail.com>
1166
1172
1167 * iplib.py: Try to import pyreadline on Windows.
1173 * iplib.py: Try to import pyreadline on Windows.
1168
1174
1169 2006-01-27 Ville Vainio <vivainio@gmail.com>
1175 2006-01-27 Ville Vainio <vivainio@gmail.com>
1170
1176
1171 * iplib.py: Expose ipapi as _ip in builtin namespace.
1177 * iplib.py: Expose ipapi as _ip in builtin namespace.
1172 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1178 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1173 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1179 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1174 syntax now produce _ip.* variant of the commands.
1180 syntax now produce _ip.* variant of the commands.
1175
1181
1176 * "_ip.options().autoedit_syntax = 2" automatically throws
1182 * "_ip.options().autoedit_syntax = 2" automatically throws
1177 user to editor for syntax error correction without prompting.
1183 user to editor for syntax error correction without prompting.
1178
1184
1179 2006-01-27 Ville Vainio <vivainio@gmail.com>
1185 2006-01-27 Ville Vainio <vivainio@gmail.com>
1180
1186
1181 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1187 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1182 'ipython' at argv[0]) executed through command line.
1188 'ipython' at argv[0]) executed through command line.
1183 NOTE: this DEPRECATES calling ipython with multiple scripts
1189 NOTE: this DEPRECATES calling ipython with multiple scripts
1184 ("ipython a.py b.py c.py")
1190 ("ipython a.py b.py c.py")
1185
1191
1186 * iplib.py, hooks.py: Added configurable input prefilter,
1192 * iplib.py, hooks.py: Added configurable input prefilter,
1187 named 'input_prefilter'. See ext_rescapture.py for example
1193 named 'input_prefilter'. See ext_rescapture.py for example
1188 usage.
1194 usage.
1189
1195
1190 * ext_rescapture.py, Magic.py: Better system command output capture
1196 * ext_rescapture.py, Magic.py: Better system command output capture
1191 through 'var = !ls' (deprecates user-visible %sc). Same notation
1197 through 'var = !ls' (deprecates user-visible %sc). Same notation
1192 applies for magics, 'var = %alias' assigns alias list to var.
1198 applies for magics, 'var = %alias' assigns alias list to var.
1193
1199
1194 * ipapi.py: added meta() for accessing extension-usable data store.
1200 * ipapi.py: added meta() for accessing extension-usable data store.
1195
1201
1196 * iplib.py: added InteractiveShell.getapi(). New magics should be
1202 * iplib.py: added InteractiveShell.getapi(). New magics should be
1197 written doing self.getapi() instead of using the shell directly.
1203 written doing self.getapi() instead of using the shell directly.
1198
1204
1199 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1205 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1200 %store foo >> ~/myfoo.txt to store variables to files (in clean
1206 %store foo >> ~/myfoo.txt to store variables to files (in clean
1201 textual form, not a restorable pickle).
1207 textual form, not a restorable pickle).
1202
1208
1203 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1209 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1204
1210
1205 * usage.py, Magic.py: added %quickref
1211 * usage.py, Magic.py: added %quickref
1206
1212
1207 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1213 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1208
1214
1209 * GetoptErrors when invoking magics etc. with wrong args
1215 * GetoptErrors when invoking magics etc. with wrong args
1210 are now more helpful:
1216 are now more helpful:
1211 GetoptError: option -l not recognized (allowed: "qb" )
1217 GetoptError: option -l not recognized (allowed: "qb" )
1212
1218
1213 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1219 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1214
1220
1215 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1221 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1216 computationally intensive blocks don't appear to stall the demo.
1222 computationally intensive blocks don't appear to stall the demo.
1217
1223
1218 2006-01-24 Ville Vainio <vivainio@gmail.com>
1224 2006-01-24 Ville Vainio <vivainio@gmail.com>
1219
1225
1220 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1226 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1221 value to manipulate resulting history entry.
1227 value to manipulate resulting history entry.
1222
1228
1223 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1229 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1224 to instance methods of IPApi class, to make extending an embedded
1230 to instance methods of IPApi class, to make extending an embedded
1225 IPython feasible. See ext_rehashdir.py for example usage.
1231 IPython feasible. See ext_rehashdir.py for example usage.
1226
1232
1227 * Merged 1071-1076 from branches/0.7.1
1233 * Merged 1071-1076 from branches/0.7.1
1228
1234
1229
1235
1230 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1236 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1231
1237
1232 * tools/release (daystamp): Fix build tools to use the new
1238 * tools/release (daystamp): Fix build tools to use the new
1233 eggsetup.py script to build lightweight eggs.
1239 eggsetup.py script to build lightweight eggs.
1234
1240
1235 * Applied changesets 1062 and 1064 before 0.7.1 release.
1241 * Applied changesets 1062 and 1064 before 0.7.1 release.
1236
1242
1237 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1243 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1238 see the raw input history (without conversions like %ls ->
1244 see the raw input history (without conversions like %ls ->
1239 ipmagic("ls")). After a request from W. Stein, SAGE
1245 ipmagic("ls")). After a request from W. Stein, SAGE
1240 (http://modular.ucsd.edu/sage) developer. This information is
1246 (http://modular.ucsd.edu/sage) developer. This information is
1241 stored in the input_hist_raw attribute of the IPython instance, so
1247 stored in the input_hist_raw attribute of the IPython instance, so
1242 developers can access it if needed (it's an InputList instance).
1248 developers can access it if needed (it's an InputList instance).
1243
1249
1244 * Versionstring = 0.7.2.svn
1250 * Versionstring = 0.7.2.svn
1245
1251
1246 * eggsetup.py: A separate script for constructing eggs, creates
1252 * eggsetup.py: A separate script for constructing eggs, creates
1247 proper launch scripts even on Windows (an .exe file in
1253 proper launch scripts even on Windows (an .exe file in
1248 \python24\scripts).
1254 \python24\scripts).
1249
1255
1250 * ipapi.py: launch_new_instance, launch entry point needed for the
1256 * ipapi.py: launch_new_instance, launch entry point needed for the
1251 egg.
1257 egg.
1252
1258
1253 2006-01-23 Ville Vainio <vivainio@gmail.com>
1259 2006-01-23 Ville Vainio <vivainio@gmail.com>
1254
1260
1255 * Added %cpaste magic for pasting python code
1261 * Added %cpaste magic for pasting python code
1256
1262
1257 2006-01-22 Ville Vainio <vivainio@gmail.com>
1263 2006-01-22 Ville Vainio <vivainio@gmail.com>
1258
1264
1259 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1265 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1260
1266
1261 * Versionstring = 0.7.2.svn
1267 * Versionstring = 0.7.2.svn
1262
1268
1263 * eggsetup.py: A separate script for constructing eggs, creates
1269 * eggsetup.py: A separate script for constructing eggs, creates
1264 proper launch scripts even on Windows (an .exe file in
1270 proper launch scripts even on Windows (an .exe file in
1265 \python24\scripts).
1271 \python24\scripts).
1266
1272
1267 * ipapi.py: launch_new_instance, launch entry point needed for the
1273 * ipapi.py: launch_new_instance, launch entry point needed for the
1268 egg.
1274 egg.
1269
1275
1270 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1276 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1271
1277
1272 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1278 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1273 %pfile foo would print the file for foo even if it was a binary.
1279 %pfile foo would print the file for foo even if it was a binary.
1274 Now, extensions '.so' and '.dll' are skipped.
1280 Now, extensions '.so' and '.dll' are skipped.
1275
1281
1276 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1282 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1277 bug, where macros would fail in all threaded modes. I'm not 100%
1283 bug, where macros would fail in all threaded modes. I'm not 100%
1278 sure, so I'm going to put out an rc instead of making a release
1284 sure, so I'm going to put out an rc instead of making a release
1279 today, and wait for feedback for at least a few days.
1285 today, and wait for feedback for at least a few days.
1280
1286
1281 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1287 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1282 it...) the handling of pasting external code with autoindent on.
1288 it...) the handling of pasting external code with autoindent on.
1283 To get out of a multiline input, the rule will appear for most
1289 To get out of a multiline input, the rule will appear for most
1284 users unchanged: two blank lines or change the indent level
1290 users unchanged: two blank lines or change the indent level
1285 proposed by IPython. But there is a twist now: you can
1291 proposed by IPython. But there is a twist now: you can
1286 add/subtract only *one or two spaces*. If you add/subtract three
1292 add/subtract only *one or two spaces*. If you add/subtract three
1287 or more (unless you completely delete the line), IPython will
1293 or more (unless you completely delete the line), IPython will
1288 accept that line, and you'll need to enter a second one of pure
1294 accept that line, and you'll need to enter a second one of pure
1289 whitespace. I know it sounds complicated, but I can't find a
1295 whitespace. I know it sounds complicated, but I can't find a
1290 different solution that covers all the cases, with the right
1296 different solution that covers all the cases, with the right
1291 heuristics. Hopefully in actual use, nobody will really notice
1297 heuristics. Hopefully in actual use, nobody will really notice
1292 all these strange rules and things will 'just work'.
1298 all these strange rules and things will 'just work'.
1293
1299
1294 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1300 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1295
1301
1296 * IPython/iplib.py (interact): catch exceptions which can be
1302 * IPython/iplib.py (interact): catch exceptions which can be
1297 triggered asynchronously by signal handlers. Thanks to an
1303 triggered asynchronously by signal handlers. Thanks to an
1298 automatic crash report, submitted by Colin Kingsley
1304 automatic crash report, submitted by Colin Kingsley
1299 <tercel-AT-gentoo.org>.
1305 <tercel-AT-gentoo.org>.
1300
1306
1301 2006-01-20 Ville Vainio <vivainio@gmail.com>
1307 2006-01-20 Ville Vainio <vivainio@gmail.com>
1302
1308
1303 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1309 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1304 (%rehashdir, very useful, try it out) of how to extend ipython
1310 (%rehashdir, very useful, try it out) of how to extend ipython
1305 with new magics. Also added Extensions dir to pythonpath to make
1311 with new magics. Also added Extensions dir to pythonpath to make
1306 importing extensions easy.
1312 importing extensions easy.
1307
1313
1308 * %store now complains when trying to store interactively declared
1314 * %store now complains when trying to store interactively declared
1309 classes / instances of those classes.
1315 classes / instances of those classes.
1310
1316
1311 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1317 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1312 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1318 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1313 if they exist, and ipy_user_conf.py with some defaults is created for
1319 if they exist, and ipy_user_conf.py with some defaults is created for
1314 the user.
1320 the user.
1315
1321
1316 * Startup rehashing done by the config file, not InterpreterExec.
1322 * Startup rehashing done by the config file, not InterpreterExec.
1317 This means system commands are available even without selecting the
1323 This means system commands are available even without selecting the
1318 pysh profile. It's the sensible default after all.
1324 pysh profile. It's the sensible default after all.
1319
1325
1320 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1326 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1321
1327
1322 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1328 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1323 multiline code with autoindent on working. But I am really not
1329 multiline code with autoindent on working. But I am really not
1324 sure, so this needs more testing. Will commit a debug-enabled
1330 sure, so this needs more testing. Will commit a debug-enabled
1325 version for now, while I test it some more, so that Ville and
1331 version for now, while I test it some more, so that Ville and
1326 others may also catch any problems. Also made
1332 others may also catch any problems. Also made
1327 self.indent_current_str() a method, to ensure that there's no
1333 self.indent_current_str() a method, to ensure that there's no
1328 chance of the indent space count and the corresponding string
1334 chance of the indent space count and the corresponding string
1329 falling out of sync. All code needing the string should just call
1335 falling out of sync. All code needing the string should just call
1330 the method.
1336 the method.
1331
1337
1332 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1338 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1333
1339
1334 * IPython/Magic.py (magic_edit): fix check for when users don't
1340 * IPython/Magic.py (magic_edit): fix check for when users don't
1335 save their output files, the try/except was in the wrong section.
1341 save their output files, the try/except was in the wrong section.
1336
1342
1337 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1343 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1338
1344
1339 * IPython/Magic.py (magic_run): fix __file__ global missing from
1345 * IPython/Magic.py (magic_run): fix __file__ global missing from
1340 script's namespace when executed via %run. After a report by
1346 script's namespace when executed via %run. After a report by
1341 Vivian.
1347 Vivian.
1342
1348
1343 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1349 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1344 when using python 2.4. The parent constructor changed in 2.4, and
1350 when using python 2.4. The parent constructor changed in 2.4, and
1345 we need to track it directly (we can't call it, as it messes up
1351 we need to track it directly (we can't call it, as it messes up
1346 readline and tab-completion inside our pdb would stop working).
1352 readline and tab-completion inside our pdb would stop working).
1347 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1353 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1348
1354
1349 2006-01-16 Ville Vainio <vivainio@gmail.com>
1355 2006-01-16 Ville Vainio <vivainio@gmail.com>
1350
1356
1351 * Ipython/magic.py: Reverted back to old %edit functionality
1357 * Ipython/magic.py: Reverted back to old %edit functionality
1352 that returns file contents on exit.
1358 that returns file contents on exit.
1353
1359
1354 * IPython/path.py: Added Jason Orendorff's "path" module to
1360 * IPython/path.py: Added Jason Orendorff's "path" module to
1355 IPython tree, http://www.jorendorff.com/articles/python/path/.
1361 IPython tree, http://www.jorendorff.com/articles/python/path/.
1356 You can get path objects conveniently through %sc, and !!, e.g.:
1362 You can get path objects conveniently through %sc, and !!, e.g.:
1357 sc files=ls
1363 sc files=ls
1358 for p in files.paths: # or files.p
1364 for p in files.paths: # or files.p
1359 print p,p.mtime
1365 print p,p.mtime
1360
1366
1361 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1367 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1362 now work again without considering the exclusion regexp -
1368 now work again without considering the exclusion regexp -
1363 hence, things like ',foo my/path' turn to 'foo("my/path")'
1369 hence, things like ',foo my/path' turn to 'foo("my/path")'
1364 instead of syntax error.
1370 instead of syntax error.
1365
1371
1366
1372
1367 2006-01-14 Ville Vainio <vivainio@gmail.com>
1373 2006-01-14 Ville Vainio <vivainio@gmail.com>
1368
1374
1369 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1375 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1370 ipapi decorators for python 2.4 users, options() provides access to rc
1376 ipapi decorators for python 2.4 users, options() provides access to rc
1371 data.
1377 data.
1372
1378
1373 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1379 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1374 as path separators (even on Linux ;-). Space character after
1380 as path separators (even on Linux ;-). Space character after
1375 backslash (as yielded by tab completer) is still space;
1381 backslash (as yielded by tab completer) is still space;
1376 "%cd long\ name" works as expected.
1382 "%cd long\ name" works as expected.
1377
1383
1378 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1384 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1379 as "chain of command", with priority. API stays the same,
1385 as "chain of command", with priority. API stays the same,
1380 TryNext exception raised by a hook function signals that
1386 TryNext exception raised by a hook function signals that
1381 current hook failed and next hook should try handling it, as
1387 current hook failed and next hook should try handling it, as
1382 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1388 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1383 requested configurable display hook, which is now implemented.
1389 requested configurable display hook, which is now implemented.
1384
1390
1385 2006-01-13 Ville Vainio <vivainio@gmail.com>
1391 2006-01-13 Ville Vainio <vivainio@gmail.com>
1386
1392
1387 * IPython/platutils*.py: platform specific utility functions,
1393 * IPython/platutils*.py: platform specific utility functions,
1388 so far only set_term_title is implemented (change terminal
1394 so far only set_term_title is implemented (change terminal
1389 label in windowing systems). %cd now changes the title to
1395 label in windowing systems). %cd now changes the title to
1390 current dir.
1396 current dir.
1391
1397
1392 * IPython/Release.py: Added myself to "authors" list,
1398 * IPython/Release.py: Added myself to "authors" list,
1393 had to create new files.
1399 had to create new files.
1394
1400
1395 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1401 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1396 shell escape; not a known bug but had potential to be one in the
1402 shell escape; not a known bug but had potential to be one in the
1397 future.
1403 future.
1398
1404
1399 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1405 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1400 extension API for IPython! See the module for usage example. Fix
1406 extension API for IPython! See the module for usage example. Fix
1401 OInspect for docstring-less magic functions.
1407 OInspect for docstring-less magic functions.
1402
1408
1403
1409
1404 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1410 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1405
1411
1406 * IPython/iplib.py (raw_input): temporarily deactivate all
1412 * IPython/iplib.py (raw_input): temporarily deactivate all
1407 attempts at allowing pasting of code with autoindent on. It
1413 attempts at allowing pasting of code with autoindent on. It
1408 introduced bugs (reported by Prabhu) and I can't seem to find a
1414 introduced bugs (reported by Prabhu) and I can't seem to find a
1409 robust combination which works in all cases. Will have to revisit
1415 robust combination which works in all cases. Will have to revisit
1410 later.
1416 later.
1411
1417
1412 * IPython/genutils.py: remove isspace() function. We've dropped
1418 * IPython/genutils.py: remove isspace() function. We've dropped
1413 2.2 compatibility, so it's OK to use the string method.
1419 2.2 compatibility, so it's OK to use the string method.
1414
1420
1415 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1421 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1416
1422
1417 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1423 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1418 matching what NOT to autocall on, to include all python binary
1424 matching what NOT to autocall on, to include all python binary
1419 operators (including things like 'and', 'or', 'is' and 'in').
1425 operators (including things like 'and', 'or', 'is' and 'in').
1420 Prompted by a bug report on 'foo & bar', but I realized we had
1426 Prompted by a bug report on 'foo & bar', but I realized we had
1421 many more potential bug cases with other operators. The regexp is
1427 many more potential bug cases with other operators. The regexp is
1422 self.re_exclude_auto, it's fairly commented.
1428 self.re_exclude_auto, it's fairly commented.
1423
1429
1424 2006-01-12 Ville Vainio <vivainio@gmail.com>
1430 2006-01-12 Ville Vainio <vivainio@gmail.com>
1425
1431
1426 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1432 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1427 Prettified and hardened string/backslash quoting with ipsystem(),
1433 Prettified and hardened string/backslash quoting with ipsystem(),
1428 ipalias() and ipmagic(). Now even \ characters are passed to
1434 ipalias() and ipmagic(). Now even \ characters are passed to
1429 %magics, !shell escapes and aliases exactly as they are in the
1435 %magics, !shell escapes and aliases exactly as they are in the
1430 ipython command line. Should improve backslash experience,
1436 ipython command line. Should improve backslash experience,
1431 particularly in Windows (path delimiter for some commands that
1437 particularly in Windows (path delimiter for some commands that
1432 won't understand '/'), but Unix benefits as well (regexps). %cd
1438 won't understand '/'), but Unix benefits as well (regexps). %cd
1433 magic still doesn't support backslash path delimiters, though. Also
1439 magic still doesn't support backslash path delimiters, though. Also
1434 deleted all pretense of supporting multiline command strings in
1440 deleted all pretense of supporting multiline command strings in
1435 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1441 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1436
1442
1437 * doc/build_doc_instructions.txt added. Documentation on how to
1443 * doc/build_doc_instructions.txt added. Documentation on how to
1438 use doc/update_manual.py, added yesterday. Both files contributed
1444 use doc/update_manual.py, added yesterday. Both files contributed
1439 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1445 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1440 doc/*.sh for deprecation at a later date.
1446 doc/*.sh for deprecation at a later date.
1441
1447
1442 * /ipython.py Added ipython.py to root directory for
1448 * /ipython.py Added ipython.py to root directory for
1443 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1449 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1444 ipython.py) and development convenience (no need to keep doing
1450 ipython.py) and development convenience (no need to keep doing
1445 "setup.py install" between changes).
1451 "setup.py install" between changes).
1446
1452
1447 * Made ! and !! shell escapes work (again) in multiline expressions:
1453 * Made ! and !! shell escapes work (again) in multiline expressions:
1448 if 1:
1454 if 1:
1449 !ls
1455 !ls
1450 !!ls
1456 !!ls
1451
1457
1452 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1458 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1453
1459
1454 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1460 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1455 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1461 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1456 module in case-insensitive installation. Was causing crashes
1462 module in case-insensitive installation. Was causing crashes
1457 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1463 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1458
1464
1459 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1465 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1460 <marienz-AT-gentoo.org>, closes
1466 <marienz-AT-gentoo.org>, closes
1461 http://www.scipy.net/roundup/ipython/issue51.
1467 http://www.scipy.net/roundup/ipython/issue51.
1462
1468
1463 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1469 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1464
1470
1465 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1471 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1466 problem of excessive CPU usage under *nix and keyboard lag under
1472 problem of excessive CPU usage under *nix and keyboard lag under
1467 win32.
1473 win32.
1468
1474
1469 2006-01-10 *** Released version 0.7.0
1475 2006-01-10 *** Released version 0.7.0
1470
1476
1471 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1477 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1472
1478
1473 * IPython/Release.py (revision): tag version number to 0.7.0,
1479 * IPython/Release.py (revision): tag version number to 0.7.0,
1474 ready for release.
1480 ready for release.
1475
1481
1476 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1482 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1477 it informs the user of the name of the temp. file used. This can
1483 it informs the user of the name of the temp. file used. This can
1478 help if you decide later to reuse that same file, so you know
1484 help if you decide later to reuse that same file, so you know
1479 where to copy the info from.
1485 where to copy the info from.
1480
1486
1481 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1487 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1482
1488
1483 * setup_bdist_egg.py: little script to build an egg. Added
1489 * setup_bdist_egg.py: little script to build an egg. Added
1484 support in the release tools as well.
1490 support in the release tools as well.
1485
1491
1486 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1492 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1487
1493
1488 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1494 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1489 version selection (new -wxversion command line and ipythonrc
1495 version selection (new -wxversion command line and ipythonrc
1490 parameter). Patch contributed by Arnd Baecker
1496 parameter). Patch contributed by Arnd Baecker
1491 <arnd.baecker-AT-web.de>.
1497 <arnd.baecker-AT-web.de>.
1492
1498
1493 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1499 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1494 embedded instances, for variables defined at the interactive
1500 embedded instances, for variables defined at the interactive
1495 prompt of the embedded ipython. Reported by Arnd.
1501 prompt of the embedded ipython. Reported by Arnd.
1496
1502
1497 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1503 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1498 it can be used as a (stateful) toggle, or with a direct parameter.
1504 it can be used as a (stateful) toggle, or with a direct parameter.
1499
1505
1500 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1506 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1501 could be triggered in certain cases and cause the traceback
1507 could be triggered in certain cases and cause the traceback
1502 printer not to work.
1508 printer not to work.
1503
1509
1504 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1510 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1505
1511
1506 * IPython/iplib.py (_should_recompile): Small fix, closes
1512 * IPython/iplib.py (_should_recompile): Small fix, closes
1507 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1513 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1508
1514
1509 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1515 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1510
1516
1511 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1517 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1512 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1518 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1513 Moad for help with tracking it down.
1519 Moad for help with tracking it down.
1514
1520
1515 * IPython/iplib.py (handle_auto): fix autocall handling for
1521 * IPython/iplib.py (handle_auto): fix autocall handling for
1516 objects which support BOTH __getitem__ and __call__ (so that f [x]
1522 objects which support BOTH __getitem__ and __call__ (so that f [x]
1517 is left alone, instead of becoming f([x]) automatically).
1523 is left alone, instead of becoming f([x]) automatically).
1518
1524
1519 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1525 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1520 Ville's patch.
1526 Ville's patch.
1521
1527
1522 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1528 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1523
1529
1524 * IPython/iplib.py (handle_auto): changed autocall semantics to
1530 * IPython/iplib.py (handle_auto): changed autocall semantics to
1525 include 'smart' mode, where the autocall transformation is NOT
1531 include 'smart' mode, where the autocall transformation is NOT
1526 applied if there are no arguments on the line. This allows you to
1532 applied if there are no arguments on the line. This allows you to
1527 just type 'foo' if foo is a callable to see its internal form,
1533 just type 'foo' if foo is a callable to see its internal form,
1528 instead of having it called with no arguments (typically a
1534 instead of having it called with no arguments (typically a
1529 mistake). The old 'full' autocall still exists: for that, you
1535 mistake). The old 'full' autocall still exists: for that, you
1530 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1536 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1531
1537
1532 * IPython/completer.py (Completer.attr_matches): add
1538 * IPython/completer.py (Completer.attr_matches): add
1533 tab-completion support for Enthoughts' traits. After a report by
1539 tab-completion support for Enthoughts' traits. After a report by
1534 Arnd and a patch by Prabhu.
1540 Arnd and a patch by Prabhu.
1535
1541
1536 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1542 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1537
1543
1538 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1544 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1539 Schmolck's patch to fix inspect.getinnerframes().
1545 Schmolck's patch to fix inspect.getinnerframes().
1540
1546
1541 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1547 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1542 for embedded instances, regarding handling of namespaces and items
1548 for embedded instances, regarding handling of namespaces and items
1543 added to the __builtin__ one. Multiple embedded instances and
1549 added to the __builtin__ one. Multiple embedded instances and
1544 recursive embeddings should work better now (though I'm not sure
1550 recursive embeddings should work better now (though I'm not sure
1545 I've got all the corner cases fixed, that code is a bit of a brain
1551 I've got all the corner cases fixed, that code is a bit of a brain
1546 twister).
1552 twister).
1547
1553
1548 * IPython/Magic.py (magic_edit): added support to edit in-memory
1554 * IPython/Magic.py (magic_edit): added support to edit in-memory
1549 macros (automatically creates the necessary temp files). %edit
1555 macros (automatically creates the necessary temp files). %edit
1550 also doesn't return the file contents anymore, it's just noise.
1556 also doesn't return the file contents anymore, it's just noise.
1551
1557
1552 * IPython/completer.py (Completer.attr_matches): revert change to
1558 * IPython/completer.py (Completer.attr_matches): revert change to
1553 complete only on attributes listed in __all__. I realized it
1559 complete only on attributes listed in __all__. I realized it
1554 cripples the tab-completion system as a tool for exploring the
1560 cripples the tab-completion system as a tool for exploring the
1555 internals of unknown libraries (it renders any non-__all__
1561 internals of unknown libraries (it renders any non-__all__
1556 attribute off-limits). I got bit by this when trying to see
1562 attribute off-limits). I got bit by this when trying to see
1557 something inside the dis module.
1563 something inside the dis module.
1558
1564
1559 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1565 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1560
1566
1561 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1567 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1562 namespace for users and extension writers to hold data in. This
1568 namespace for users and extension writers to hold data in. This
1563 follows the discussion in
1569 follows the discussion in
1564 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1570 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1565
1571
1566 * IPython/completer.py (IPCompleter.complete): small patch to help
1572 * IPython/completer.py (IPCompleter.complete): small patch to help
1567 tab-completion under Emacs, after a suggestion by John Barnard
1573 tab-completion under Emacs, after a suggestion by John Barnard
1568 <barnarj-AT-ccf.org>.
1574 <barnarj-AT-ccf.org>.
1569
1575
1570 * IPython/Magic.py (Magic.extract_input_slices): added support for
1576 * IPython/Magic.py (Magic.extract_input_slices): added support for
1571 the slice notation in magics to use N-M to represent numbers N...M
1577 the slice notation in magics to use N-M to represent numbers N...M
1572 (closed endpoints). This is used by %macro and %save.
1578 (closed endpoints). This is used by %macro and %save.
1573
1579
1574 * IPython/completer.py (Completer.attr_matches): for modules which
1580 * IPython/completer.py (Completer.attr_matches): for modules which
1575 define __all__, complete only on those. After a patch by Jeffrey
1581 define __all__, complete only on those. After a patch by Jeffrey
1576 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1582 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1577 speed up this routine.
1583 speed up this routine.
1578
1584
1579 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1585 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1580 don't know if this is the end of it, but the behavior now is
1586 don't know if this is the end of it, but the behavior now is
1581 certainly much more correct. Note that coupled with macros,
1587 certainly much more correct. Note that coupled with macros,
1582 slightly surprising (at first) behavior may occur: a macro will in
1588 slightly surprising (at first) behavior may occur: a macro will in
1583 general expand to multiple lines of input, so upon exiting, the
1589 general expand to multiple lines of input, so upon exiting, the
1584 in/out counters will both be bumped by the corresponding amount
1590 in/out counters will both be bumped by the corresponding amount
1585 (as if the macro's contents had been typed interactively). Typing
1591 (as if the macro's contents had been typed interactively). Typing
1586 %hist will reveal the intermediate (silently processed) lines.
1592 %hist will reveal the intermediate (silently processed) lines.
1587
1593
1588 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1594 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1589 pickle to fail (%run was overwriting __main__ and not restoring
1595 pickle to fail (%run was overwriting __main__ and not restoring
1590 it, but pickle relies on __main__ to operate).
1596 it, but pickle relies on __main__ to operate).
1591
1597
1592 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1598 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1593 using properties, but forgot to make the main InteractiveShell
1599 using properties, but forgot to make the main InteractiveShell
1594 class a new-style class. Properties fail silently, and
1600 class a new-style class. Properties fail silently, and
1595 mysteriously, with old-style class (getters work, but
1601 mysteriously, with old-style class (getters work, but
1596 setters don't do anything).
1602 setters don't do anything).
1597
1603
1598 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1604 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1599
1605
1600 * IPython/Magic.py (magic_history): fix history reporting bug (I
1606 * IPython/Magic.py (magic_history): fix history reporting bug (I
1601 know some nasties are still there, I just can't seem to find a
1607 know some nasties are still there, I just can't seem to find a
1602 reproducible test case to track them down; the input history is
1608 reproducible test case to track them down; the input history is
1603 falling out of sync...)
1609 falling out of sync...)
1604
1610
1605 * IPython/iplib.py (handle_shell_escape): fix bug where both
1611 * IPython/iplib.py (handle_shell_escape): fix bug where both
1606 aliases and system accesses where broken for indented code (such
1612 aliases and system accesses where broken for indented code (such
1607 as loops).
1613 as loops).
1608
1614
1609 * IPython/genutils.py (shell): fix small but critical bug for
1615 * IPython/genutils.py (shell): fix small but critical bug for
1610 win32 system access.
1616 win32 system access.
1611
1617
1612 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1618 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1613
1619
1614 * IPython/iplib.py (showtraceback): remove use of the
1620 * IPython/iplib.py (showtraceback): remove use of the
1615 sys.last_{type/value/traceback} structures, which are non
1621 sys.last_{type/value/traceback} structures, which are non
1616 thread-safe.
1622 thread-safe.
1617 (_prefilter): change control flow to ensure that we NEVER
1623 (_prefilter): change control flow to ensure that we NEVER
1618 introspect objects when autocall is off. This will guarantee that
1624 introspect objects when autocall is off. This will guarantee that
1619 having an input line of the form 'x.y', where access to attribute
1625 having an input line of the form 'x.y', where access to attribute
1620 'y' has side effects, doesn't trigger the side effect TWICE. It
1626 'y' has side effects, doesn't trigger the side effect TWICE. It
1621 is important to note that, with autocall on, these side effects
1627 is important to note that, with autocall on, these side effects
1622 can still happen.
1628 can still happen.
1623 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1629 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1624 trio. IPython offers these three kinds of special calls which are
1630 trio. IPython offers these three kinds of special calls which are
1625 not python code, and it's a good thing to have their call method
1631 not python code, and it's a good thing to have their call method
1626 be accessible as pure python functions (not just special syntax at
1632 be accessible as pure python functions (not just special syntax at
1627 the command line). It gives us a better internal implementation
1633 the command line). It gives us a better internal implementation
1628 structure, as well as exposing these for user scripting more
1634 structure, as well as exposing these for user scripting more
1629 cleanly.
1635 cleanly.
1630
1636
1631 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1637 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1632 file. Now that they'll be more likely to be used with the
1638 file. Now that they'll be more likely to be used with the
1633 persistance system (%store), I want to make sure their module path
1639 persistance system (%store), I want to make sure their module path
1634 doesn't change in the future, so that we don't break things for
1640 doesn't change in the future, so that we don't break things for
1635 users' persisted data.
1641 users' persisted data.
1636
1642
1637 * IPython/iplib.py (autoindent_update): move indentation
1643 * IPython/iplib.py (autoindent_update): move indentation
1638 management into the _text_ processing loop, not the keyboard
1644 management into the _text_ processing loop, not the keyboard
1639 interactive one. This is necessary to correctly process non-typed
1645 interactive one. This is necessary to correctly process non-typed
1640 multiline input (such as macros).
1646 multiline input (such as macros).
1641
1647
1642 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1648 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1643 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1649 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1644 which was producing problems in the resulting manual.
1650 which was producing problems in the resulting manual.
1645 (magic_whos): improve reporting of instances (show their class,
1651 (magic_whos): improve reporting of instances (show their class,
1646 instead of simply printing 'instance' which isn't terribly
1652 instead of simply printing 'instance' which isn't terribly
1647 informative).
1653 informative).
1648
1654
1649 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1655 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1650 (minor mods) to support network shares under win32.
1656 (minor mods) to support network shares under win32.
1651
1657
1652 * IPython/winconsole.py (get_console_size): add new winconsole
1658 * IPython/winconsole.py (get_console_size): add new winconsole
1653 module and fixes to page_dumb() to improve its behavior under
1659 module and fixes to page_dumb() to improve its behavior under
1654 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1660 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1655
1661
1656 * IPython/Magic.py (Macro): simplified Macro class to just
1662 * IPython/Magic.py (Macro): simplified Macro class to just
1657 subclass list. We've had only 2.2 compatibility for a very long
1663 subclass list. We've had only 2.2 compatibility for a very long
1658 time, yet I was still avoiding subclassing the builtin types. No
1664 time, yet I was still avoiding subclassing the builtin types. No
1659 more (I'm also starting to use properties, though I won't shift to
1665 more (I'm also starting to use properties, though I won't shift to
1660 2.3-specific features quite yet).
1666 2.3-specific features quite yet).
1661 (magic_store): added Ville's patch for lightweight variable
1667 (magic_store): added Ville's patch for lightweight variable
1662 persistence, after a request on the user list by Matt Wilkie
1668 persistence, after a request on the user list by Matt Wilkie
1663 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1669 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1664 details.
1670 details.
1665
1671
1666 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1672 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1667 changed the default logfile name from 'ipython.log' to
1673 changed the default logfile name from 'ipython.log' to
1668 'ipython_log.py'. These logs are real python files, and now that
1674 'ipython_log.py'. These logs are real python files, and now that
1669 we have much better multiline support, people are more likely to
1675 we have much better multiline support, people are more likely to
1670 want to use them as such. Might as well name them correctly.
1676 want to use them as such. Might as well name them correctly.
1671
1677
1672 * IPython/Magic.py: substantial cleanup. While we can't stop
1678 * IPython/Magic.py: substantial cleanup. While we can't stop
1673 using magics as mixins, due to the existing customizations 'out
1679 using magics as mixins, due to the existing customizations 'out
1674 there' which rely on the mixin naming conventions, at least I
1680 there' which rely on the mixin naming conventions, at least I
1675 cleaned out all cross-class name usage. So once we are OK with
1681 cleaned out all cross-class name usage. So once we are OK with
1676 breaking compatibility, the two systems can be separated.
1682 breaking compatibility, the two systems can be separated.
1677
1683
1678 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1684 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1679 anymore, and the class is a fair bit less hideous as well. New
1685 anymore, and the class is a fair bit less hideous as well. New
1680 features were also introduced: timestamping of input, and logging
1686 features were also introduced: timestamping of input, and logging
1681 of output results. These are user-visible with the -t and -o
1687 of output results. These are user-visible with the -t and -o
1682 options to %logstart. Closes
1688 options to %logstart. Closes
1683 http://www.scipy.net/roundup/ipython/issue11 and a request by
1689 http://www.scipy.net/roundup/ipython/issue11 and a request by
1684 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1690 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1685
1691
1686 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1692 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1687
1693
1688 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1694 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1689 better handle backslashes in paths. See the thread 'More Windows
1695 better handle backslashes in paths. See the thread 'More Windows
1690 questions part 2 - \/ characters revisited' on the iypthon user
1696 questions part 2 - \/ characters revisited' on the iypthon user
1691 list:
1697 list:
1692 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1698 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1693
1699
1694 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1700 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1695
1701
1696 (InteractiveShell.__init__): change threaded shells to not use the
1702 (InteractiveShell.__init__): change threaded shells to not use the
1697 ipython crash handler. This was causing more problems than not,
1703 ipython crash handler. This was causing more problems than not,
1698 as exceptions in the main thread (GUI code, typically) would
1704 as exceptions in the main thread (GUI code, typically) would
1699 always show up as a 'crash', when they really weren't.
1705 always show up as a 'crash', when they really weren't.
1700
1706
1701 The colors and exception mode commands (%colors/%xmode) have been
1707 The colors and exception mode commands (%colors/%xmode) have been
1702 synchronized to also take this into account, so users can get
1708 synchronized to also take this into account, so users can get
1703 verbose exceptions for their threaded code as well. I also added
1709 verbose exceptions for their threaded code as well. I also added
1704 support for activating pdb inside this exception handler as well,
1710 support for activating pdb inside this exception handler as well,
1705 so now GUI authors can use IPython's enhanced pdb at runtime.
1711 so now GUI authors can use IPython's enhanced pdb at runtime.
1706
1712
1707 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1713 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1708 true by default, and add it to the shipped ipythonrc file. Since
1714 true by default, and add it to the shipped ipythonrc file. Since
1709 this asks the user before proceeding, I think it's OK to make it
1715 this asks the user before proceeding, I think it's OK to make it
1710 true by default.
1716 true by default.
1711
1717
1712 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1718 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1713 of the previous special-casing of input in the eval loop. I think
1719 of the previous special-casing of input in the eval loop. I think
1714 this is cleaner, as they really are commands and shouldn't have
1720 this is cleaner, as they really are commands and shouldn't have
1715 a special role in the middle of the core code.
1721 a special role in the middle of the core code.
1716
1722
1717 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1723 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1718
1724
1719 * IPython/iplib.py (edit_syntax_error): added support for
1725 * IPython/iplib.py (edit_syntax_error): added support for
1720 automatically reopening the editor if the file had a syntax error
1726 automatically reopening the editor if the file had a syntax error
1721 in it. Thanks to scottt who provided the patch at:
1727 in it. Thanks to scottt who provided the patch at:
1722 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1728 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1723 version committed).
1729 version committed).
1724
1730
1725 * IPython/iplib.py (handle_normal): add suport for multi-line
1731 * IPython/iplib.py (handle_normal): add suport for multi-line
1726 input with emtpy lines. This fixes
1732 input with emtpy lines. This fixes
1727 http://www.scipy.net/roundup/ipython/issue43 and a similar
1733 http://www.scipy.net/roundup/ipython/issue43 and a similar
1728 discussion on the user list.
1734 discussion on the user list.
1729
1735
1730 WARNING: a behavior change is necessarily introduced to support
1736 WARNING: a behavior change is necessarily introduced to support
1731 blank lines: now a single blank line with whitespace does NOT
1737 blank lines: now a single blank line with whitespace does NOT
1732 break the input loop, which means that when autoindent is on, by
1738 break the input loop, which means that when autoindent is on, by
1733 default hitting return on the next (indented) line does NOT exit.
1739 default hitting return on the next (indented) line does NOT exit.
1734
1740
1735 Instead, to exit a multiline input you can either have:
1741 Instead, to exit a multiline input you can either have:
1736
1742
1737 - TWO whitespace lines (just hit return again), or
1743 - TWO whitespace lines (just hit return again), or
1738 - a single whitespace line of a different length than provided
1744 - a single whitespace line of a different length than provided
1739 by the autoindent (add or remove a space).
1745 by the autoindent (add or remove a space).
1740
1746
1741 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1747 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1742 module to better organize all readline-related functionality.
1748 module to better organize all readline-related functionality.
1743 I've deleted FlexCompleter and put all completion clases here.
1749 I've deleted FlexCompleter and put all completion clases here.
1744
1750
1745 * IPython/iplib.py (raw_input): improve indentation management.
1751 * IPython/iplib.py (raw_input): improve indentation management.
1746 It is now possible to paste indented code with autoindent on, and
1752 It is now possible to paste indented code with autoindent on, and
1747 the code is interpreted correctly (though it still looks bad on
1753 the code is interpreted correctly (though it still looks bad on
1748 screen, due to the line-oriented nature of ipython).
1754 screen, due to the line-oriented nature of ipython).
1749 (MagicCompleter.complete): change behavior so that a TAB key on an
1755 (MagicCompleter.complete): change behavior so that a TAB key on an
1750 otherwise empty line actually inserts a tab, instead of completing
1756 otherwise empty line actually inserts a tab, instead of completing
1751 on the entire global namespace. This makes it easier to use the
1757 on the entire global namespace. This makes it easier to use the
1752 TAB key for indentation. After a request by Hans Meine
1758 TAB key for indentation. After a request by Hans Meine
1753 <hans_meine-AT-gmx.net>
1759 <hans_meine-AT-gmx.net>
1754 (_prefilter): add support so that typing plain 'exit' or 'quit'
1760 (_prefilter): add support so that typing plain 'exit' or 'quit'
1755 does a sensible thing. Originally I tried to deviate as little as
1761 does a sensible thing. Originally I tried to deviate as little as
1756 possible from the default python behavior, but even that one may
1762 possible from the default python behavior, but even that one may
1757 change in this direction (thread on python-dev to that effect).
1763 change in this direction (thread on python-dev to that effect).
1758 Regardless, ipython should do the right thing even if CPython's
1764 Regardless, ipython should do the right thing even if CPython's
1759 '>>>' prompt doesn't.
1765 '>>>' prompt doesn't.
1760 (InteractiveShell): removed subclassing code.InteractiveConsole
1766 (InteractiveShell): removed subclassing code.InteractiveConsole
1761 class. By now we'd overridden just about all of its methods: I've
1767 class. By now we'd overridden just about all of its methods: I've
1762 copied the remaining two over, and now ipython is a standalone
1768 copied the remaining two over, and now ipython is a standalone
1763 class. This will provide a clearer picture for the chainsaw
1769 class. This will provide a clearer picture for the chainsaw
1764 branch refactoring.
1770 branch refactoring.
1765
1771
1766 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1772 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1767
1773
1768 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1774 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1769 failures for objects which break when dir() is called on them.
1775 failures for objects which break when dir() is called on them.
1770
1776
1771 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1777 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1772 distinct local and global namespaces in the completer API. This
1778 distinct local and global namespaces in the completer API. This
1773 change allows us to properly handle completion with distinct
1779 change allows us to properly handle completion with distinct
1774 scopes, including in embedded instances (this had never really
1780 scopes, including in embedded instances (this had never really
1775 worked correctly).
1781 worked correctly).
1776
1782
1777 Note: this introduces a change in the constructor for
1783 Note: this introduces a change in the constructor for
1778 MagicCompleter, as a new global_namespace parameter is now the
1784 MagicCompleter, as a new global_namespace parameter is now the
1779 second argument (the others were bumped one position).
1785 second argument (the others were bumped one position).
1780
1786
1781 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1787 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1782
1788
1783 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1789 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1784 embedded instances (which can be done now thanks to Vivian's
1790 embedded instances (which can be done now thanks to Vivian's
1785 frame-handling fixes for pdb).
1791 frame-handling fixes for pdb).
1786 (InteractiveShell.__init__): Fix namespace handling problem in
1792 (InteractiveShell.__init__): Fix namespace handling problem in
1787 embedded instances. We were overwriting __main__ unconditionally,
1793 embedded instances. We were overwriting __main__ unconditionally,
1788 and this should only be done for 'full' (non-embedded) IPython;
1794 and this should only be done for 'full' (non-embedded) IPython;
1789 embedded instances must respect the caller's __main__. Thanks to
1795 embedded instances must respect the caller's __main__. Thanks to
1790 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1796 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1791
1797
1792 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1798 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1793
1799
1794 * setup.py: added download_url to setup(). This registers the
1800 * setup.py: added download_url to setup(). This registers the
1795 download address at PyPI, which is not only useful to humans
1801 download address at PyPI, which is not only useful to humans
1796 browsing the site, but is also picked up by setuptools (the Eggs
1802 browsing the site, but is also picked up by setuptools (the Eggs
1797 machinery). Thanks to Ville and R. Kern for the info/discussion
1803 machinery). Thanks to Ville and R. Kern for the info/discussion
1798 on this.
1804 on this.
1799
1805
1800 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1806 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1801
1807
1802 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1808 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1803 This brings a lot of nice functionality to the pdb mode, which now
1809 This brings a lot of nice functionality to the pdb mode, which now
1804 has tab-completion, syntax highlighting, and better stack handling
1810 has tab-completion, syntax highlighting, and better stack handling
1805 than before. Many thanks to Vivian De Smedt
1811 than before. Many thanks to Vivian De Smedt
1806 <vivian-AT-vdesmedt.com> for the original patches.
1812 <vivian-AT-vdesmedt.com> for the original patches.
1807
1813
1808 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1814 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1809
1815
1810 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1816 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1811 sequence to consistently accept the banner argument. The
1817 sequence to consistently accept the banner argument. The
1812 inconsistency was tripping SAGE, thanks to Gary Zablackis
1818 inconsistency was tripping SAGE, thanks to Gary Zablackis
1813 <gzabl-AT-yahoo.com> for the report.
1819 <gzabl-AT-yahoo.com> for the report.
1814
1820
1815 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1821 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1816
1822
1817 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1823 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1818 Fix bug where a naked 'alias' call in the ipythonrc file would
1824 Fix bug where a naked 'alias' call in the ipythonrc file would
1819 cause a crash. Bug reported by Jorgen Stenarson.
1825 cause a crash. Bug reported by Jorgen Stenarson.
1820
1826
1821 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1827 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1822
1828
1823 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1829 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1824 startup time.
1830 startup time.
1825
1831
1826 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1832 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1827 instances had introduced a bug with globals in normal code. Now
1833 instances had introduced a bug with globals in normal code. Now
1828 it's working in all cases.
1834 it's working in all cases.
1829
1835
1830 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1836 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1831 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1837 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1832 has been introduced to set the default case sensitivity of the
1838 has been introduced to set the default case sensitivity of the
1833 searches. Users can still select either mode at runtime on a
1839 searches. Users can still select either mode at runtime on a
1834 per-search basis.
1840 per-search basis.
1835
1841
1836 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1842 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1837
1843
1838 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1844 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1839 attributes in wildcard searches for subclasses. Modified version
1845 attributes in wildcard searches for subclasses. Modified version
1840 of a patch by Jorgen.
1846 of a patch by Jorgen.
1841
1847
1842 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1848 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1843
1849
1844 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1850 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1845 embedded instances. I added a user_global_ns attribute to the
1851 embedded instances. I added a user_global_ns attribute to the
1846 InteractiveShell class to handle this.
1852 InteractiveShell class to handle this.
1847
1853
1848 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1854 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1849
1855
1850 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1856 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1851 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1857 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1852 (reported under win32, but may happen also in other platforms).
1858 (reported under win32, but may happen also in other platforms).
1853 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1859 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1854
1860
1855 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1861 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1856
1862
1857 * IPython/Magic.py (magic_psearch): new support for wildcard
1863 * IPython/Magic.py (magic_psearch): new support for wildcard
1858 patterns. Now, typing ?a*b will list all names which begin with a
1864 patterns. Now, typing ?a*b will list all names which begin with a
1859 and end in b, for example. The %psearch magic has full
1865 and end in b, for example. The %psearch magic has full
1860 docstrings. Many thanks to JΓΆrgen Stenarson
1866 docstrings. Many thanks to JΓΆrgen Stenarson
1861 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1867 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1862 implementing this functionality.
1868 implementing this functionality.
1863
1869
1864 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1870 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1865
1871
1866 * Manual: fixed long-standing annoyance of double-dashes (as in
1872 * Manual: fixed long-standing annoyance of double-dashes (as in
1867 --prefix=~, for example) being stripped in the HTML version. This
1873 --prefix=~, for example) being stripped in the HTML version. This
1868 is a latex2html bug, but a workaround was provided. Many thanks
1874 is a latex2html bug, but a workaround was provided. Many thanks
1869 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1875 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1870 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1876 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1871 rolling. This seemingly small issue had tripped a number of users
1877 rolling. This seemingly small issue had tripped a number of users
1872 when first installing, so I'm glad to see it gone.
1878 when first installing, so I'm glad to see it gone.
1873
1879
1874 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1880 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1875
1881
1876 * IPython/Extensions/numeric_formats.py: fix missing import,
1882 * IPython/Extensions/numeric_formats.py: fix missing import,
1877 reported by Stephen Walton.
1883 reported by Stephen Walton.
1878
1884
1879 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1885 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1880
1886
1881 * IPython/demo.py: finish demo module, fully documented now.
1887 * IPython/demo.py: finish demo module, fully documented now.
1882
1888
1883 * IPython/genutils.py (file_read): simple little utility to read a
1889 * IPython/genutils.py (file_read): simple little utility to read a
1884 file and ensure it's closed afterwards.
1890 file and ensure it's closed afterwards.
1885
1891
1886 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1892 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1887
1893
1888 * IPython/demo.py (Demo.__init__): added support for individually
1894 * IPython/demo.py (Demo.__init__): added support for individually
1889 tagging blocks for automatic execution.
1895 tagging blocks for automatic execution.
1890
1896
1891 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1897 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1892 syntax-highlighted python sources, requested by John.
1898 syntax-highlighted python sources, requested by John.
1893
1899
1894 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1900 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1895
1901
1896 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1902 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1897 finishing.
1903 finishing.
1898
1904
1899 * IPython/genutils.py (shlex_split): moved from Magic to here,
1905 * IPython/genutils.py (shlex_split): moved from Magic to here,
1900 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1906 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1901
1907
1902 * IPython/demo.py (Demo.__init__): added support for silent
1908 * IPython/demo.py (Demo.__init__): added support for silent
1903 blocks, improved marks as regexps, docstrings written.
1909 blocks, improved marks as regexps, docstrings written.
1904 (Demo.__init__): better docstring, added support for sys.argv.
1910 (Demo.__init__): better docstring, added support for sys.argv.
1905
1911
1906 * IPython/genutils.py (marquee): little utility used by the demo
1912 * IPython/genutils.py (marquee): little utility used by the demo
1907 code, handy in general.
1913 code, handy in general.
1908
1914
1909 * IPython/demo.py (Demo.__init__): new class for interactive
1915 * IPython/demo.py (Demo.__init__): new class for interactive
1910 demos. Not documented yet, I just wrote it in a hurry for
1916 demos. Not documented yet, I just wrote it in a hurry for
1911 scipy'05. Will docstring later.
1917 scipy'05. Will docstring later.
1912
1918
1913 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1919 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1914
1920
1915 * IPython/Shell.py (sigint_handler): Drastic simplification which
1921 * IPython/Shell.py (sigint_handler): Drastic simplification which
1916 also seems to make Ctrl-C work correctly across threads! This is
1922 also seems to make Ctrl-C work correctly across threads! This is
1917 so simple, that I can't beleive I'd missed it before. Needs more
1923 so simple, that I can't beleive I'd missed it before. Needs more
1918 testing, though.
1924 testing, though.
1919 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1925 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1920 like this before...
1926 like this before...
1921
1927
1922 * IPython/genutils.py (get_home_dir): add protection against
1928 * IPython/genutils.py (get_home_dir): add protection against
1923 non-dirs in win32 registry.
1929 non-dirs in win32 registry.
1924
1930
1925 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1931 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1926 bug where dict was mutated while iterating (pysh crash).
1932 bug where dict was mutated while iterating (pysh crash).
1927
1933
1928 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1934 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1929
1935
1930 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1936 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1931 spurious newlines added by this routine. After a report by
1937 spurious newlines added by this routine. After a report by
1932 F. Mantegazza.
1938 F. Mantegazza.
1933
1939
1934 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1940 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1935
1941
1936 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1942 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1937 calls. These were a leftover from the GTK 1.x days, and can cause
1943 calls. These were a leftover from the GTK 1.x days, and can cause
1938 problems in certain cases (after a report by John Hunter).
1944 problems in certain cases (after a report by John Hunter).
1939
1945
1940 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1946 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1941 os.getcwd() fails at init time. Thanks to patch from David Remahl
1947 os.getcwd() fails at init time. Thanks to patch from David Remahl
1942 <chmod007-AT-mac.com>.
1948 <chmod007-AT-mac.com>.
1943 (InteractiveShell.__init__): prevent certain special magics from
1949 (InteractiveShell.__init__): prevent certain special magics from
1944 being shadowed by aliases. Closes
1950 being shadowed by aliases. Closes
1945 http://www.scipy.net/roundup/ipython/issue41.
1951 http://www.scipy.net/roundup/ipython/issue41.
1946
1952
1947 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1953 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1948
1954
1949 * IPython/iplib.py (InteractiveShell.complete): Added new
1955 * IPython/iplib.py (InteractiveShell.complete): Added new
1950 top-level completion method to expose the completion mechanism
1956 top-level completion method to expose the completion mechanism
1951 beyond readline-based environments.
1957 beyond readline-based environments.
1952
1958
1953 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1959 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1954
1960
1955 * tools/ipsvnc (svnversion): fix svnversion capture.
1961 * tools/ipsvnc (svnversion): fix svnversion capture.
1956
1962
1957 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1963 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1958 attribute to self, which was missing. Before, it was set by a
1964 attribute to self, which was missing. Before, it was set by a
1959 routine which in certain cases wasn't being called, so the
1965 routine which in certain cases wasn't being called, so the
1960 instance could end up missing the attribute. This caused a crash.
1966 instance could end up missing the attribute. This caused a crash.
1961 Closes http://www.scipy.net/roundup/ipython/issue40.
1967 Closes http://www.scipy.net/roundup/ipython/issue40.
1962
1968
1963 2005-08-16 Fernando Perez <fperez@colorado.edu>
1969 2005-08-16 Fernando Perez <fperez@colorado.edu>
1964
1970
1965 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1971 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1966 contains non-string attribute. Closes
1972 contains non-string attribute. Closes
1967 http://www.scipy.net/roundup/ipython/issue38.
1973 http://www.scipy.net/roundup/ipython/issue38.
1968
1974
1969 2005-08-14 Fernando Perez <fperez@colorado.edu>
1975 2005-08-14 Fernando Perez <fperez@colorado.edu>
1970
1976
1971 * tools/ipsvnc: Minor improvements, to add changeset info.
1977 * tools/ipsvnc: Minor improvements, to add changeset info.
1972
1978
1973 2005-08-12 Fernando Perez <fperez@colorado.edu>
1979 2005-08-12 Fernando Perez <fperez@colorado.edu>
1974
1980
1975 * IPython/iplib.py (runsource): remove self.code_to_run_src
1981 * IPython/iplib.py (runsource): remove self.code_to_run_src
1976 attribute. I realized this is nothing more than
1982 attribute. I realized this is nothing more than
1977 '\n'.join(self.buffer), and having the same data in two different
1983 '\n'.join(self.buffer), and having the same data in two different
1978 places is just asking for synchronization bugs. This may impact
1984 places is just asking for synchronization bugs. This may impact
1979 people who have custom exception handlers, so I need to warn
1985 people who have custom exception handlers, so I need to warn
1980 ipython-dev about it (F. Mantegazza may use them).
1986 ipython-dev about it (F. Mantegazza may use them).
1981
1987
1982 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1988 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1983
1989
1984 * IPython/genutils.py: fix 2.2 compatibility (generators)
1990 * IPython/genutils.py: fix 2.2 compatibility (generators)
1985
1991
1986 2005-07-18 Fernando Perez <fperez@colorado.edu>
1992 2005-07-18 Fernando Perez <fperez@colorado.edu>
1987
1993
1988 * IPython/genutils.py (get_home_dir): fix to help users with
1994 * IPython/genutils.py (get_home_dir): fix to help users with
1989 invalid $HOME under win32.
1995 invalid $HOME under win32.
1990
1996
1991 2005-07-17 Fernando Perez <fperez@colorado.edu>
1997 2005-07-17 Fernando Perez <fperez@colorado.edu>
1992
1998
1993 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1999 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1994 some old hacks and clean up a bit other routines; code should be
2000 some old hacks and clean up a bit other routines; code should be
1995 simpler and a bit faster.
2001 simpler and a bit faster.
1996
2002
1997 * IPython/iplib.py (interact): removed some last-resort attempts
2003 * IPython/iplib.py (interact): removed some last-resort attempts
1998 to survive broken stdout/stderr. That code was only making it
2004 to survive broken stdout/stderr. That code was only making it
1999 harder to abstract out the i/o (necessary for gui integration),
2005 harder to abstract out the i/o (necessary for gui integration),
2000 and the crashes it could prevent were extremely rare in practice
2006 and the crashes it could prevent were extremely rare in practice
2001 (besides being fully user-induced in a pretty violent manner).
2007 (besides being fully user-induced in a pretty violent manner).
2002
2008
2003 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2009 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2004 Nothing major yet, but the code is simpler to read; this should
2010 Nothing major yet, but the code is simpler to read; this should
2005 make it easier to do more serious modifications in the future.
2011 make it easier to do more serious modifications in the future.
2006
2012
2007 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2013 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2008 which broke in .15 (thanks to a report by Ville).
2014 which broke in .15 (thanks to a report by Ville).
2009
2015
2010 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2016 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2011 be quite correct, I know next to nothing about unicode). This
2017 be quite correct, I know next to nothing about unicode). This
2012 will allow unicode strings to be used in prompts, amongst other
2018 will allow unicode strings to be used in prompts, amongst other
2013 cases. It also will prevent ipython from crashing when unicode
2019 cases. It also will prevent ipython from crashing when unicode
2014 shows up unexpectedly in many places. If ascii encoding fails, we
2020 shows up unexpectedly in many places. If ascii encoding fails, we
2015 assume utf_8. Currently the encoding is not a user-visible
2021 assume utf_8. Currently the encoding is not a user-visible
2016 setting, though it could be made so if there is demand for it.
2022 setting, though it could be made so if there is demand for it.
2017
2023
2018 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2024 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2019
2025
2020 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2026 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2021
2027
2022 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2028 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2023
2029
2024 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2030 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2025 code can work transparently for 2.2/2.3.
2031 code can work transparently for 2.2/2.3.
2026
2032
2027 2005-07-16 Fernando Perez <fperez@colorado.edu>
2033 2005-07-16 Fernando Perez <fperez@colorado.edu>
2028
2034
2029 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2035 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2030 out of the color scheme table used for coloring exception
2036 out of the color scheme table used for coloring exception
2031 tracebacks. This allows user code to add new schemes at runtime.
2037 tracebacks. This allows user code to add new schemes at runtime.
2032 This is a minimally modified version of the patch at
2038 This is a minimally modified version of the patch at
2033 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2039 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2034 for the contribution.
2040 for the contribution.
2035
2041
2036 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2042 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2037 slightly modified version of the patch in
2043 slightly modified version of the patch in
2038 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2044 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2039 to remove the previous try/except solution (which was costlier).
2045 to remove the previous try/except solution (which was costlier).
2040 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2046 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2041
2047
2042 2005-06-08 Fernando Perez <fperez@colorado.edu>
2048 2005-06-08 Fernando Perez <fperez@colorado.edu>
2043
2049
2044 * IPython/iplib.py (write/write_err): Add methods to abstract all
2050 * IPython/iplib.py (write/write_err): Add methods to abstract all
2045 I/O a bit more.
2051 I/O a bit more.
2046
2052
2047 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2053 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2048 warning, reported by Aric Hagberg, fix by JD Hunter.
2054 warning, reported by Aric Hagberg, fix by JD Hunter.
2049
2055
2050 2005-06-02 *** Released version 0.6.15
2056 2005-06-02 *** Released version 0.6.15
2051
2057
2052 2005-06-01 Fernando Perez <fperez@colorado.edu>
2058 2005-06-01 Fernando Perez <fperez@colorado.edu>
2053
2059
2054 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2060 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2055 tab-completion of filenames within open-quoted strings. Note that
2061 tab-completion of filenames within open-quoted strings. Note that
2056 this requires that in ~/.ipython/ipythonrc, users change the
2062 this requires that in ~/.ipython/ipythonrc, users change the
2057 readline delimiters configuration to read:
2063 readline delimiters configuration to read:
2058
2064
2059 readline_remove_delims -/~
2065 readline_remove_delims -/~
2060
2066
2061
2067
2062 2005-05-31 *** Released version 0.6.14
2068 2005-05-31 *** Released version 0.6.14
2063
2069
2064 2005-05-29 Fernando Perez <fperez@colorado.edu>
2070 2005-05-29 Fernando Perez <fperez@colorado.edu>
2065
2071
2066 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2072 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2067 with files not on the filesystem. Reported by Eliyahu Sandler
2073 with files not on the filesystem. Reported by Eliyahu Sandler
2068 <eli@gondolin.net>
2074 <eli@gondolin.net>
2069
2075
2070 2005-05-22 Fernando Perez <fperez@colorado.edu>
2076 2005-05-22 Fernando Perez <fperez@colorado.edu>
2071
2077
2072 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2078 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2073 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2079 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2074
2080
2075 2005-05-19 Fernando Perez <fperez@colorado.edu>
2081 2005-05-19 Fernando Perez <fperez@colorado.edu>
2076
2082
2077 * IPython/iplib.py (safe_execfile): close a file which could be
2083 * IPython/iplib.py (safe_execfile): close a file which could be
2078 left open (causing problems in win32, which locks open files).
2084 left open (causing problems in win32, which locks open files).
2079 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2085 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2080
2086
2081 2005-05-18 Fernando Perez <fperez@colorado.edu>
2087 2005-05-18 Fernando Perez <fperez@colorado.edu>
2082
2088
2083 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2089 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2084 keyword arguments correctly to safe_execfile().
2090 keyword arguments correctly to safe_execfile().
2085
2091
2086 2005-05-13 Fernando Perez <fperez@colorado.edu>
2092 2005-05-13 Fernando Perez <fperez@colorado.edu>
2087
2093
2088 * ipython.1: Added info about Qt to manpage, and threads warning
2094 * ipython.1: Added info about Qt to manpage, and threads warning
2089 to usage page (invoked with --help).
2095 to usage page (invoked with --help).
2090
2096
2091 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2097 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2092 new matcher (it goes at the end of the priority list) to do
2098 new matcher (it goes at the end of the priority list) to do
2093 tab-completion on named function arguments. Submitted by George
2099 tab-completion on named function arguments. Submitted by George
2094 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2100 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2095 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2101 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2096 for more details.
2102 for more details.
2097
2103
2098 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2104 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2099 SystemExit exceptions in the script being run. Thanks to a report
2105 SystemExit exceptions in the script being run. Thanks to a report
2100 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2106 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2101 producing very annoying behavior when running unit tests.
2107 producing very annoying behavior when running unit tests.
2102
2108
2103 2005-05-12 Fernando Perez <fperez@colorado.edu>
2109 2005-05-12 Fernando Perez <fperez@colorado.edu>
2104
2110
2105 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2111 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2106 which I'd broken (again) due to a changed regexp. In the process,
2112 which I'd broken (again) due to a changed regexp. In the process,
2107 added ';' as an escape to auto-quote the whole line without
2113 added ';' as an escape to auto-quote the whole line without
2108 splitting its arguments. Thanks to a report by Jerry McRae
2114 splitting its arguments. Thanks to a report by Jerry McRae
2109 <qrs0xyc02-AT-sneakemail.com>.
2115 <qrs0xyc02-AT-sneakemail.com>.
2110
2116
2111 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2117 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2112 possible crashes caused by a TokenError. Reported by Ed Schofield
2118 possible crashes caused by a TokenError. Reported by Ed Schofield
2113 <schofield-AT-ftw.at>.
2119 <schofield-AT-ftw.at>.
2114
2120
2115 2005-05-06 Fernando Perez <fperez@colorado.edu>
2121 2005-05-06 Fernando Perez <fperez@colorado.edu>
2116
2122
2117 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2123 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2118
2124
2119 2005-04-29 Fernando Perez <fperez@colorado.edu>
2125 2005-04-29 Fernando Perez <fperez@colorado.edu>
2120
2126
2121 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2127 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2122 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2128 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2123 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2129 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2124 which provides support for Qt interactive usage (similar to the
2130 which provides support for Qt interactive usage (similar to the
2125 existing one for WX and GTK). This had been often requested.
2131 existing one for WX and GTK). This had been often requested.
2126
2132
2127 2005-04-14 *** Released version 0.6.13
2133 2005-04-14 *** Released version 0.6.13
2128
2134
2129 2005-04-08 Fernando Perez <fperez@colorado.edu>
2135 2005-04-08 Fernando Perez <fperez@colorado.edu>
2130
2136
2131 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2137 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2132 from _ofind, which gets called on almost every input line. Now,
2138 from _ofind, which gets called on almost every input line. Now,
2133 we only try to get docstrings if they are actually going to be
2139 we only try to get docstrings if they are actually going to be
2134 used (the overhead of fetching unnecessary docstrings can be
2140 used (the overhead of fetching unnecessary docstrings can be
2135 noticeable for certain objects, such as Pyro proxies).
2141 noticeable for certain objects, such as Pyro proxies).
2136
2142
2137 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2143 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2138 for completers. For some reason I had been passing them the state
2144 for completers. For some reason I had been passing them the state
2139 variable, which completers never actually need, and was in
2145 variable, which completers never actually need, and was in
2140 conflict with the rlcompleter API. Custom completers ONLY need to
2146 conflict with the rlcompleter API. Custom completers ONLY need to
2141 take the text parameter.
2147 take the text parameter.
2142
2148
2143 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2149 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2144 work correctly in pysh. I've also moved all the logic which used
2150 work correctly in pysh. I've also moved all the logic which used
2145 to be in pysh.py here, which will prevent problems with future
2151 to be in pysh.py here, which will prevent problems with future
2146 upgrades. However, this time I must warn users to update their
2152 upgrades. However, this time I must warn users to update their
2147 pysh profile to include the line
2153 pysh profile to include the line
2148
2154
2149 import_all IPython.Extensions.InterpreterExec
2155 import_all IPython.Extensions.InterpreterExec
2150
2156
2151 because otherwise things won't work for them. They MUST also
2157 because otherwise things won't work for them. They MUST also
2152 delete pysh.py and the line
2158 delete pysh.py and the line
2153
2159
2154 execfile pysh.py
2160 execfile pysh.py
2155
2161
2156 from their ipythonrc-pysh.
2162 from their ipythonrc-pysh.
2157
2163
2158 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2164 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2159 robust in the face of objects whose dir() returns non-strings
2165 robust in the face of objects whose dir() returns non-strings
2160 (which it shouldn't, but some broken libs like ITK do). Thanks to
2166 (which it shouldn't, but some broken libs like ITK do). Thanks to
2161 a patch by John Hunter (implemented differently, though). Also
2167 a patch by John Hunter (implemented differently, though). Also
2162 minor improvements by using .extend instead of + on lists.
2168 minor improvements by using .extend instead of + on lists.
2163
2169
2164 * pysh.py:
2170 * pysh.py:
2165
2171
2166 2005-04-06 Fernando Perez <fperez@colorado.edu>
2172 2005-04-06 Fernando Perez <fperez@colorado.edu>
2167
2173
2168 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2174 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2169 by default, so that all users benefit from it. Those who don't
2175 by default, so that all users benefit from it. Those who don't
2170 want it can still turn it off.
2176 want it can still turn it off.
2171
2177
2172 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2178 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2173 config file, I'd forgotten about this, so users were getting it
2179 config file, I'd forgotten about this, so users were getting it
2174 off by default.
2180 off by default.
2175
2181
2176 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2182 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2177 consistency. Now magics can be called in multiline statements,
2183 consistency. Now magics can be called in multiline statements,
2178 and python variables can be expanded in magic calls via $var.
2184 and python variables can be expanded in magic calls via $var.
2179 This makes the magic system behave just like aliases or !system
2185 This makes the magic system behave just like aliases or !system
2180 calls.
2186 calls.
2181
2187
2182 2005-03-28 Fernando Perez <fperez@colorado.edu>
2188 2005-03-28 Fernando Perez <fperez@colorado.edu>
2183
2189
2184 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2190 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2185 expensive string additions for building command. Add support for
2191 expensive string additions for building command. Add support for
2186 trailing ';' when autocall is used.
2192 trailing ';' when autocall is used.
2187
2193
2188 2005-03-26 Fernando Perez <fperez@colorado.edu>
2194 2005-03-26 Fernando Perez <fperez@colorado.edu>
2189
2195
2190 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2196 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2191 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2197 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2192 ipython.el robust against prompts with any number of spaces
2198 ipython.el robust against prompts with any number of spaces
2193 (including 0) after the ':' character.
2199 (including 0) after the ':' character.
2194
2200
2195 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2201 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2196 continuation prompt, which misled users to think the line was
2202 continuation prompt, which misled users to think the line was
2197 already indented. Closes debian Bug#300847, reported to me by
2203 already indented. Closes debian Bug#300847, reported to me by
2198 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2204 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2199
2205
2200 2005-03-23 Fernando Perez <fperez@colorado.edu>
2206 2005-03-23 Fernando Perez <fperez@colorado.edu>
2201
2207
2202 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2208 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2203 properly aligned if they have embedded newlines.
2209 properly aligned if they have embedded newlines.
2204
2210
2205 * IPython/iplib.py (runlines): Add a public method to expose
2211 * IPython/iplib.py (runlines): Add a public method to expose
2206 IPython's code execution machinery, so that users can run strings
2212 IPython's code execution machinery, so that users can run strings
2207 as if they had been typed at the prompt interactively.
2213 as if they had been typed at the prompt interactively.
2208 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2214 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2209 methods which can call the system shell, but with python variable
2215 methods which can call the system shell, but with python variable
2210 expansion. The three such methods are: __IPYTHON__.system,
2216 expansion. The three such methods are: __IPYTHON__.system,
2211 .getoutput and .getoutputerror. These need to be documented in a
2217 .getoutput and .getoutputerror. These need to be documented in a
2212 'public API' section (to be written) of the manual.
2218 'public API' section (to be written) of the manual.
2213
2219
2214 2005-03-20 Fernando Perez <fperez@colorado.edu>
2220 2005-03-20 Fernando Perez <fperez@colorado.edu>
2215
2221
2216 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2222 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2217 for custom exception handling. This is quite powerful, and it
2223 for custom exception handling. This is quite powerful, and it
2218 allows for user-installable exception handlers which can trap
2224 allows for user-installable exception handlers which can trap
2219 custom exceptions at runtime and treat them separately from
2225 custom exceptions at runtime and treat them separately from
2220 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2226 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2221 Mantegazza <mantegazza-AT-ill.fr>.
2227 Mantegazza <mantegazza-AT-ill.fr>.
2222 (InteractiveShell.set_custom_completer): public API function to
2228 (InteractiveShell.set_custom_completer): public API function to
2223 add new completers at runtime.
2229 add new completers at runtime.
2224
2230
2225 2005-03-19 Fernando Perez <fperez@colorado.edu>
2231 2005-03-19 Fernando Perez <fperez@colorado.edu>
2226
2232
2227 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2233 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2228 allow objects which provide their docstrings via non-standard
2234 allow objects which provide their docstrings via non-standard
2229 mechanisms (like Pyro proxies) to still be inspected by ipython's
2235 mechanisms (like Pyro proxies) to still be inspected by ipython's
2230 ? system.
2236 ? system.
2231
2237
2232 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2238 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2233 automatic capture system. I tried quite hard to make it work
2239 automatic capture system. I tried quite hard to make it work
2234 reliably, and simply failed. I tried many combinations with the
2240 reliably, and simply failed. I tried many combinations with the
2235 subprocess module, but eventually nothing worked in all needed
2241 subprocess module, but eventually nothing worked in all needed
2236 cases (not blocking stdin for the child, duplicating stdout
2242 cases (not blocking stdin for the child, duplicating stdout
2237 without blocking, etc). The new %sc/%sx still do capture to these
2243 without blocking, etc). The new %sc/%sx still do capture to these
2238 magical list/string objects which make shell use much more
2244 magical list/string objects which make shell use much more
2239 conveninent, so not all is lost.
2245 conveninent, so not all is lost.
2240
2246
2241 XXX - FIX MANUAL for the change above!
2247 XXX - FIX MANUAL for the change above!
2242
2248
2243 (runsource): I copied code.py's runsource() into ipython to modify
2249 (runsource): I copied code.py's runsource() into ipython to modify
2244 it a bit. Now the code object and source to be executed are
2250 it a bit. Now the code object and source to be executed are
2245 stored in ipython. This makes this info accessible to third-party
2251 stored in ipython. This makes this info accessible to third-party
2246 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2252 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2247 Mantegazza <mantegazza-AT-ill.fr>.
2253 Mantegazza <mantegazza-AT-ill.fr>.
2248
2254
2249 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2255 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2250 history-search via readline (like C-p/C-n). I'd wanted this for a
2256 history-search via readline (like C-p/C-n). I'd wanted this for a
2251 long time, but only recently found out how to do it. For users
2257 long time, but only recently found out how to do it. For users
2252 who already have their ipythonrc files made and want this, just
2258 who already have their ipythonrc files made and want this, just
2253 add:
2259 add:
2254
2260
2255 readline_parse_and_bind "\e[A": history-search-backward
2261 readline_parse_and_bind "\e[A": history-search-backward
2256 readline_parse_and_bind "\e[B": history-search-forward
2262 readline_parse_and_bind "\e[B": history-search-forward
2257
2263
2258 2005-03-18 Fernando Perez <fperez@colorado.edu>
2264 2005-03-18 Fernando Perez <fperez@colorado.edu>
2259
2265
2260 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2266 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2261 LSString and SList classes which allow transparent conversions
2267 LSString and SList classes which allow transparent conversions
2262 between list mode and whitespace-separated string.
2268 between list mode and whitespace-separated string.
2263 (magic_r): Fix recursion problem in %r.
2269 (magic_r): Fix recursion problem in %r.
2264
2270
2265 * IPython/genutils.py (LSString): New class to be used for
2271 * IPython/genutils.py (LSString): New class to be used for
2266 automatic storage of the results of all alias/system calls in _o
2272 automatic storage of the results of all alias/system calls in _o
2267 and _e (stdout/err). These provide a .l/.list attribute which
2273 and _e (stdout/err). These provide a .l/.list attribute which
2268 does automatic splitting on newlines. This means that for most
2274 does automatic splitting on newlines. This means that for most
2269 uses, you'll never need to do capturing of output with %sc/%sx
2275 uses, you'll never need to do capturing of output with %sc/%sx
2270 anymore, since ipython keeps this always done for you. Note that
2276 anymore, since ipython keeps this always done for you. Note that
2271 only the LAST results are stored, the _o/e variables are
2277 only the LAST results are stored, the _o/e variables are
2272 overwritten on each call. If you need to save their contents
2278 overwritten on each call. If you need to save their contents
2273 further, simply bind them to any other name.
2279 further, simply bind them to any other name.
2274
2280
2275 2005-03-17 Fernando Perez <fperez@colorado.edu>
2281 2005-03-17 Fernando Perez <fperez@colorado.edu>
2276
2282
2277 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2283 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2278 prompt namespace handling.
2284 prompt namespace handling.
2279
2285
2280 2005-03-16 Fernando Perez <fperez@colorado.edu>
2286 2005-03-16 Fernando Perez <fperez@colorado.edu>
2281
2287
2282 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2288 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2283 classic prompts to be '>>> ' (final space was missing, and it
2289 classic prompts to be '>>> ' (final space was missing, and it
2284 trips the emacs python mode).
2290 trips the emacs python mode).
2285 (BasePrompt.__str__): Added safe support for dynamic prompt
2291 (BasePrompt.__str__): Added safe support for dynamic prompt
2286 strings. Now you can set your prompt string to be '$x', and the
2292 strings. Now you can set your prompt string to be '$x', and the
2287 value of x will be printed from your interactive namespace. The
2293 value of x will be printed from your interactive namespace. The
2288 interpolation syntax includes the full Itpl support, so
2294 interpolation syntax includes the full Itpl support, so
2289 ${foo()+x+bar()} is a valid prompt string now, and the function
2295 ${foo()+x+bar()} is a valid prompt string now, and the function
2290 calls will be made at runtime.
2296 calls will be made at runtime.
2291
2297
2292 2005-03-15 Fernando Perez <fperez@colorado.edu>
2298 2005-03-15 Fernando Perez <fperez@colorado.edu>
2293
2299
2294 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2300 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2295 avoid name clashes in pylab. %hist still works, it just forwards
2301 avoid name clashes in pylab. %hist still works, it just forwards
2296 the call to %history.
2302 the call to %history.
2297
2303
2298 2005-03-02 *** Released version 0.6.12
2304 2005-03-02 *** Released version 0.6.12
2299
2305
2300 2005-03-02 Fernando Perez <fperez@colorado.edu>
2306 2005-03-02 Fernando Perez <fperez@colorado.edu>
2301
2307
2302 * IPython/iplib.py (handle_magic): log magic calls properly as
2308 * IPython/iplib.py (handle_magic): log magic calls properly as
2303 ipmagic() function calls.
2309 ipmagic() function calls.
2304
2310
2305 * IPython/Magic.py (magic_time): Improved %time to support
2311 * IPython/Magic.py (magic_time): Improved %time to support
2306 statements and provide wall-clock as well as CPU time.
2312 statements and provide wall-clock as well as CPU time.
2307
2313
2308 2005-02-27 Fernando Perez <fperez@colorado.edu>
2314 2005-02-27 Fernando Perez <fperez@colorado.edu>
2309
2315
2310 * IPython/hooks.py: New hooks module, to expose user-modifiable
2316 * IPython/hooks.py: New hooks module, to expose user-modifiable
2311 IPython functionality in a clean manner. For now only the editor
2317 IPython functionality in a clean manner. For now only the editor
2312 hook is actually written, and other thigns which I intend to turn
2318 hook is actually written, and other thigns which I intend to turn
2313 into proper hooks aren't yet there. The display and prefilter
2319 into proper hooks aren't yet there. The display and prefilter
2314 stuff, for example, should be hooks. But at least now the
2320 stuff, for example, should be hooks. But at least now the
2315 framework is in place, and the rest can be moved here with more
2321 framework is in place, and the rest can be moved here with more
2316 time later. IPython had had a .hooks variable for a long time for
2322 time later. IPython had had a .hooks variable for a long time for
2317 this purpose, but I'd never actually used it for anything.
2323 this purpose, but I'd never actually used it for anything.
2318
2324
2319 2005-02-26 Fernando Perez <fperez@colorado.edu>
2325 2005-02-26 Fernando Perez <fperez@colorado.edu>
2320
2326
2321 * IPython/ipmaker.py (make_IPython): make the default ipython
2327 * IPython/ipmaker.py (make_IPython): make the default ipython
2322 directory be called _ipython under win32, to follow more the
2328 directory be called _ipython under win32, to follow more the
2323 naming peculiarities of that platform (where buggy software like
2329 naming peculiarities of that platform (where buggy software like
2324 Visual Sourcesafe breaks with .named directories). Reported by
2330 Visual Sourcesafe breaks with .named directories). Reported by
2325 Ville Vainio.
2331 Ville Vainio.
2326
2332
2327 2005-02-23 Fernando Perez <fperez@colorado.edu>
2333 2005-02-23 Fernando Perez <fperez@colorado.edu>
2328
2334
2329 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2335 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2330 auto_aliases for win32 which were causing problems. Users can
2336 auto_aliases for win32 which were causing problems. Users can
2331 define the ones they personally like.
2337 define the ones they personally like.
2332
2338
2333 2005-02-21 Fernando Perez <fperez@colorado.edu>
2339 2005-02-21 Fernando Perez <fperez@colorado.edu>
2334
2340
2335 * IPython/Magic.py (magic_time): new magic to time execution of
2341 * IPython/Magic.py (magic_time): new magic to time execution of
2336 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2342 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2337
2343
2338 2005-02-19 Fernando Perez <fperez@colorado.edu>
2344 2005-02-19 Fernando Perez <fperez@colorado.edu>
2339
2345
2340 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2346 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2341 into keys (for prompts, for example).
2347 into keys (for prompts, for example).
2342
2348
2343 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2349 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2344 prompts in case users want them. This introduces a small behavior
2350 prompts in case users want them. This introduces a small behavior
2345 change: ipython does not automatically add a space to all prompts
2351 change: ipython does not automatically add a space to all prompts
2346 anymore. To get the old prompts with a space, users should add it
2352 anymore. To get the old prompts with a space, users should add it
2347 manually to their ipythonrc file, so for example prompt_in1 should
2353 manually to their ipythonrc file, so for example prompt_in1 should
2348 now read 'In [\#]: ' instead of 'In [\#]:'.
2354 now read 'In [\#]: ' instead of 'In [\#]:'.
2349 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2355 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2350 file) to control left-padding of secondary prompts.
2356 file) to control left-padding of secondary prompts.
2351
2357
2352 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2358 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2353 the profiler can't be imported. Fix for Debian, which removed
2359 the profiler can't be imported. Fix for Debian, which removed
2354 profile.py because of License issues. I applied a slightly
2360 profile.py because of License issues. I applied a slightly
2355 modified version of the original Debian patch at
2361 modified version of the original Debian patch at
2356 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2362 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2357
2363
2358 2005-02-17 Fernando Perez <fperez@colorado.edu>
2364 2005-02-17 Fernando Perez <fperez@colorado.edu>
2359
2365
2360 * IPython/genutils.py (native_line_ends): Fix bug which would
2366 * IPython/genutils.py (native_line_ends): Fix bug which would
2361 cause improper line-ends under win32 b/c I was not opening files
2367 cause improper line-ends under win32 b/c I was not opening files
2362 in binary mode. Bug report and fix thanks to Ville.
2368 in binary mode. Bug report and fix thanks to Ville.
2363
2369
2364 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2370 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2365 trying to catch spurious foo[1] autocalls. My fix actually broke
2371 trying to catch spurious foo[1] autocalls. My fix actually broke
2366 ',/' autoquote/call with explicit escape (bad regexp).
2372 ',/' autoquote/call with explicit escape (bad regexp).
2367
2373
2368 2005-02-15 *** Released version 0.6.11
2374 2005-02-15 *** Released version 0.6.11
2369
2375
2370 2005-02-14 Fernando Perez <fperez@colorado.edu>
2376 2005-02-14 Fernando Perez <fperez@colorado.edu>
2371
2377
2372 * IPython/background_jobs.py: New background job management
2378 * IPython/background_jobs.py: New background job management
2373 subsystem. This is implemented via a new set of classes, and
2379 subsystem. This is implemented via a new set of classes, and
2374 IPython now provides a builtin 'jobs' object for background job
2380 IPython now provides a builtin 'jobs' object for background job
2375 execution. A convenience %bg magic serves as a lightweight
2381 execution. A convenience %bg magic serves as a lightweight
2376 frontend for starting the more common type of calls. This was
2382 frontend for starting the more common type of calls. This was
2377 inspired by discussions with B. Granger and the BackgroundCommand
2383 inspired by discussions with B. Granger and the BackgroundCommand
2378 class described in the book Python Scripting for Computational
2384 class described in the book Python Scripting for Computational
2379 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2385 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2380 (although ultimately no code from this text was used, as IPython's
2386 (although ultimately no code from this text was used, as IPython's
2381 system is a separate implementation).
2387 system is a separate implementation).
2382
2388
2383 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2389 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2384 to control the completion of single/double underscore names
2390 to control the completion of single/double underscore names
2385 separately. As documented in the example ipytonrc file, the
2391 separately. As documented in the example ipytonrc file, the
2386 readline_omit__names variable can now be set to 2, to omit even
2392 readline_omit__names variable can now be set to 2, to omit even
2387 single underscore names. Thanks to a patch by Brian Wong
2393 single underscore names. Thanks to a patch by Brian Wong
2388 <BrianWong-AT-AirgoNetworks.Com>.
2394 <BrianWong-AT-AirgoNetworks.Com>.
2389 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2395 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2390 be autocalled as foo([1]) if foo were callable. A problem for
2396 be autocalled as foo([1]) if foo were callable. A problem for
2391 things which are both callable and implement __getitem__.
2397 things which are both callable and implement __getitem__.
2392 (init_readline): Fix autoindentation for win32. Thanks to a patch
2398 (init_readline): Fix autoindentation for win32. Thanks to a patch
2393 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2399 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2394
2400
2395 2005-02-12 Fernando Perez <fperez@colorado.edu>
2401 2005-02-12 Fernando Perez <fperez@colorado.edu>
2396
2402
2397 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2403 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2398 which I had written long ago to sort out user error messages which
2404 which I had written long ago to sort out user error messages which
2399 may occur during startup. This seemed like a good idea initially,
2405 may occur during startup. This seemed like a good idea initially,
2400 but it has proven a disaster in retrospect. I don't want to
2406 but it has proven a disaster in retrospect. I don't want to
2401 change much code for now, so my fix is to set the internal 'debug'
2407 change much code for now, so my fix is to set the internal 'debug'
2402 flag to true everywhere, whose only job was precisely to control
2408 flag to true everywhere, whose only job was precisely to control
2403 this subsystem. This closes issue 28 (as well as avoiding all
2409 this subsystem. This closes issue 28 (as well as avoiding all
2404 sorts of strange hangups which occur from time to time).
2410 sorts of strange hangups which occur from time to time).
2405
2411
2406 2005-02-07 Fernando Perez <fperez@colorado.edu>
2412 2005-02-07 Fernando Perez <fperez@colorado.edu>
2407
2413
2408 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2414 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2409 previous call produced a syntax error.
2415 previous call produced a syntax error.
2410
2416
2411 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2417 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2412 classes without constructor.
2418 classes without constructor.
2413
2419
2414 2005-02-06 Fernando Perez <fperez@colorado.edu>
2420 2005-02-06 Fernando Perez <fperez@colorado.edu>
2415
2421
2416 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2422 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2417 completions with the results of each matcher, so we return results
2423 completions with the results of each matcher, so we return results
2418 to the user from all namespaces. This breaks with ipython
2424 to the user from all namespaces. This breaks with ipython
2419 tradition, but I think it's a nicer behavior. Now you get all
2425 tradition, but I think it's a nicer behavior. Now you get all
2420 possible completions listed, from all possible namespaces (python,
2426 possible completions listed, from all possible namespaces (python,
2421 filesystem, magics...) After a request by John Hunter
2427 filesystem, magics...) After a request by John Hunter
2422 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2428 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2423
2429
2424 2005-02-05 Fernando Perez <fperez@colorado.edu>
2430 2005-02-05 Fernando Perez <fperez@colorado.edu>
2425
2431
2426 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2432 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2427 the call had quote characters in it (the quotes were stripped).
2433 the call had quote characters in it (the quotes were stripped).
2428
2434
2429 2005-01-31 Fernando Perez <fperez@colorado.edu>
2435 2005-01-31 Fernando Perez <fperez@colorado.edu>
2430
2436
2431 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2437 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2432 Itpl.itpl() to make the code more robust against psyco
2438 Itpl.itpl() to make the code more robust against psyco
2433 optimizations.
2439 optimizations.
2434
2440
2435 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2441 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2436 of causing an exception. Quicker, cleaner.
2442 of causing an exception. Quicker, cleaner.
2437
2443
2438 2005-01-28 Fernando Perez <fperez@colorado.edu>
2444 2005-01-28 Fernando Perez <fperez@colorado.edu>
2439
2445
2440 * scripts/ipython_win_post_install.py (install): hardcode
2446 * scripts/ipython_win_post_install.py (install): hardcode
2441 sys.prefix+'python.exe' as the executable path. It turns out that
2447 sys.prefix+'python.exe' as the executable path. It turns out that
2442 during the post-installation run, sys.executable resolves to the
2448 during the post-installation run, sys.executable resolves to the
2443 name of the binary installer! I should report this as a distutils
2449 name of the binary installer! I should report this as a distutils
2444 bug, I think. I updated the .10 release with this tiny fix, to
2450 bug, I think. I updated the .10 release with this tiny fix, to
2445 avoid annoying the lists further.
2451 avoid annoying the lists further.
2446
2452
2447 2005-01-27 *** Released version 0.6.10
2453 2005-01-27 *** Released version 0.6.10
2448
2454
2449 2005-01-27 Fernando Perez <fperez@colorado.edu>
2455 2005-01-27 Fernando Perez <fperez@colorado.edu>
2450
2456
2451 * IPython/numutils.py (norm): Added 'inf' as optional name for
2457 * IPython/numutils.py (norm): Added 'inf' as optional name for
2452 L-infinity norm, included references to mathworld.com for vector
2458 L-infinity norm, included references to mathworld.com for vector
2453 norm definitions.
2459 norm definitions.
2454 (amin/amax): added amin/amax for array min/max. Similar to what
2460 (amin/amax): added amin/amax for array min/max. Similar to what
2455 pylab ships with after the recent reorganization of names.
2461 pylab ships with after the recent reorganization of names.
2456 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2462 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2457
2463
2458 * ipython.el: committed Alex's recent fixes and improvements.
2464 * ipython.el: committed Alex's recent fixes and improvements.
2459 Tested with python-mode from CVS, and it looks excellent. Since
2465 Tested with python-mode from CVS, and it looks excellent. Since
2460 python-mode hasn't released anything in a while, I'm temporarily
2466 python-mode hasn't released anything in a while, I'm temporarily
2461 putting a copy of today's CVS (v 4.70) of python-mode in:
2467 putting a copy of today's CVS (v 4.70) of python-mode in:
2462 http://ipython.scipy.org/tmp/python-mode.el
2468 http://ipython.scipy.org/tmp/python-mode.el
2463
2469
2464 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2470 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2465 sys.executable for the executable name, instead of assuming it's
2471 sys.executable for the executable name, instead of assuming it's
2466 called 'python.exe' (the post-installer would have produced broken
2472 called 'python.exe' (the post-installer would have produced broken
2467 setups on systems with a differently named python binary).
2473 setups on systems with a differently named python binary).
2468
2474
2469 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2475 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2470 references to os.linesep, to make the code more
2476 references to os.linesep, to make the code more
2471 platform-independent. This is also part of the win32 coloring
2477 platform-independent. This is also part of the win32 coloring
2472 fixes.
2478 fixes.
2473
2479
2474 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2480 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2475 lines, which actually cause coloring bugs because the length of
2481 lines, which actually cause coloring bugs because the length of
2476 the line is very difficult to correctly compute with embedded
2482 the line is very difficult to correctly compute with embedded
2477 escapes. This was the source of all the coloring problems under
2483 escapes. This was the source of all the coloring problems under
2478 Win32. I think that _finally_, Win32 users have a properly
2484 Win32. I think that _finally_, Win32 users have a properly
2479 working ipython in all respects. This would never have happened
2485 working ipython in all respects. This would never have happened
2480 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2486 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2481
2487
2482 2005-01-26 *** Released version 0.6.9
2488 2005-01-26 *** Released version 0.6.9
2483
2489
2484 2005-01-25 Fernando Perez <fperez@colorado.edu>
2490 2005-01-25 Fernando Perez <fperez@colorado.edu>
2485
2491
2486 * setup.py: finally, we have a true Windows installer, thanks to
2492 * setup.py: finally, we have a true Windows installer, thanks to
2487 the excellent work of Viktor Ransmayr
2493 the excellent work of Viktor Ransmayr
2488 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2494 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2489 Windows users. The setup routine is quite a bit cleaner thanks to
2495 Windows users. The setup routine is quite a bit cleaner thanks to
2490 this, and the post-install script uses the proper functions to
2496 this, and the post-install script uses the proper functions to
2491 allow a clean de-installation using the standard Windows Control
2497 allow a clean de-installation using the standard Windows Control
2492 Panel.
2498 Panel.
2493
2499
2494 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2500 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2495 environment variable under all OSes (including win32) if
2501 environment variable under all OSes (including win32) if
2496 available. This will give consistency to win32 users who have set
2502 available. This will give consistency to win32 users who have set
2497 this variable for any reason. If os.environ['HOME'] fails, the
2503 this variable for any reason. If os.environ['HOME'] fails, the
2498 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2504 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2499
2505
2500 2005-01-24 Fernando Perez <fperez@colorado.edu>
2506 2005-01-24 Fernando Perez <fperez@colorado.edu>
2501
2507
2502 * IPython/numutils.py (empty_like): add empty_like(), similar to
2508 * IPython/numutils.py (empty_like): add empty_like(), similar to
2503 zeros_like() but taking advantage of the new empty() Numeric routine.
2509 zeros_like() but taking advantage of the new empty() Numeric routine.
2504
2510
2505 2005-01-23 *** Released version 0.6.8
2511 2005-01-23 *** Released version 0.6.8
2506
2512
2507 2005-01-22 Fernando Perez <fperez@colorado.edu>
2513 2005-01-22 Fernando Perez <fperez@colorado.edu>
2508
2514
2509 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2515 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2510 automatic show() calls. After discussing things with JDH, it
2516 automatic show() calls. After discussing things with JDH, it
2511 turns out there are too many corner cases where this can go wrong.
2517 turns out there are too many corner cases where this can go wrong.
2512 It's best not to try to be 'too smart', and simply have ipython
2518 It's best not to try to be 'too smart', and simply have ipython
2513 reproduce as much as possible the default behavior of a normal
2519 reproduce as much as possible the default behavior of a normal
2514 python shell.
2520 python shell.
2515
2521
2516 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2522 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2517 line-splitting regexp and _prefilter() to avoid calling getattr()
2523 line-splitting regexp and _prefilter() to avoid calling getattr()
2518 on assignments. This closes
2524 on assignments. This closes
2519 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2525 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2520 readline uses getattr(), so a simple <TAB> keypress is still
2526 readline uses getattr(), so a simple <TAB> keypress is still
2521 enough to trigger getattr() calls on an object.
2527 enough to trigger getattr() calls on an object.
2522
2528
2523 2005-01-21 Fernando Perez <fperez@colorado.edu>
2529 2005-01-21 Fernando Perez <fperez@colorado.edu>
2524
2530
2525 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2531 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2526 docstring under pylab so it doesn't mask the original.
2532 docstring under pylab so it doesn't mask the original.
2527
2533
2528 2005-01-21 *** Released version 0.6.7
2534 2005-01-21 *** Released version 0.6.7
2529
2535
2530 2005-01-21 Fernando Perez <fperez@colorado.edu>
2536 2005-01-21 Fernando Perez <fperez@colorado.edu>
2531
2537
2532 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2538 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2533 signal handling for win32 users in multithreaded mode.
2539 signal handling for win32 users in multithreaded mode.
2534
2540
2535 2005-01-17 Fernando Perez <fperez@colorado.edu>
2541 2005-01-17 Fernando Perez <fperez@colorado.edu>
2536
2542
2537 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2543 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2538 instances with no __init__. After a crash report by Norbert Nemec
2544 instances with no __init__. After a crash report by Norbert Nemec
2539 <Norbert-AT-nemec-online.de>.
2545 <Norbert-AT-nemec-online.de>.
2540
2546
2541 2005-01-14 Fernando Perez <fperez@colorado.edu>
2547 2005-01-14 Fernando Perez <fperez@colorado.edu>
2542
2548
2543 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2549 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2544 names for verbose exceptions, when multiple dotted names and the
2550 names for verbose exceptions, when multiple dotted names and the
2545 'parent' object were present on the same line.
2551 'parent' object were present on the same line.
2546
2552
2547 2005-01-11 Fernando Perez <fperez@colorado.edu>
2553 2005-01-11 Fernando Perez <fperez@colorado.edu>
2548
2554
2549 * IPython/genutils.py (flag_calls): new utility to trap and flag
2555 * IPython/genutils.py (flag_calls): new utility to trap and flag
2550 calls in functions. I need it to clean up matplotlib support.
2556 calls in functions. I need it to clean up matplotlib support.
2551 Also removed some deprecated code in genutils.
2557 Also removed some deprecated code in genutils.
2552
2558
2553 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2559 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2554 that matplotlib scripts called with %run, which don't call show()
2560 that matplotlib scripts called with %run, which don't call show()
2555 themselves, still have their plotting windows open.
2561 themselves, still have their plotting windows open.
2556
2562
2557 2005-01-05 Fernando Perez <fperez@colorado.edu>
2563 2005-01-05 Fernando Perez <fperez@colorado.edu>
2558
2564
2559 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2565 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2560 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2566 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2561
2567
2562 2004-12-19 Fernando Perez <fperez@colorado.edu>
2568 2004-12-19 Fernando Perez <fperez@colorado.edu>
2563
2569
2564 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2570 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2565 parent_runcode, which was an eyesore. The same result can be
2571 parent_runcode, which was an eyesore. The same result can be
2566 obtained with Python's regular superclass mechanisms.
2572 obtained with Python's regular superclass mechanisms.
2567
2573
2568 2004-12-17 Fernando Perez <fperez@colorado.edu>
2574 2004-12-17 Fernando Perez <fperez@colorado.edu>
2569
2575
2570 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2576 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2571 reported by Prabhu.
2577 reported by Prabhu.
2572 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2578 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2573 sys.stderr) instead of explicitly calling sys.stderr. This helps
2579 sys.stderr) instead of explicitly calling sys.stderr. This helps
2574 maintain our I/O abstractions clean, for future GUI embeddings.
2580 maintain our I/O abstractions clean, for future GUI embeddings.
2575
2581
2576 * IPython/genutils.py (info): added new utility for sys.stderr
2582 * IPython/genutils.py (info): added new utility for sys.stderr
2577 unified info message handling (thin wrapper around warn()).
2583 unified info message handling (thin wrapper around warn()).
2578
2584
2579 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2585 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2580 composite (dotted) names on verbose exceptions.
2586 composite (dotted) names on verbose exceptions.
2581 (VerboseTB.nullrepr): harden against another kind of errors which
2587 (VerboseTB.nullrepr): harden against another kind of errors which
2582 Python's inspect module can trigger, and which were crashing
2588 Python's inspect module can trigger, and which were crashing
2583 IPython. Thanks to a report by Marco Lombardi
2589 IPython. Thanks to a report by Marco Lombardi
2584 <mlombard-AT-ma010192.hq.eso.org>.
2590 <mlombard-AT-ma010192.hq.eso.org>.
2585
2591
2586 2004-12-13 *** Released version 0.6.6
2592 2004-12-13 *** Released version 0.6.6
2587
2593
2588 2004-12-12 Fernando Perez <fperez@colorado.edu>
2594 2004-12-12 Fernando Perez <fperez@colorado.edu>
2589
2595
2590 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2596 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2591 generated by pygtk upon initialization if it was built without
2597 generated by pygtk upon initialization if it was built without
2592 threads (for matplotlib users). After a crash reported by
2598 threads (for matplotlib users). After a crash reported by
2593 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2599 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2594
2600
2595 * IPython/ipmaker.py (make_IPython): fix small bug in the
2601 * IPython/ipmaker.py (make_IPython): fix small bug in the
2596 import_some parameter for multiple imports.
2602 import_some parameter for multiple imports.
2597
2603
2598 * IPython/iplib.py (ipmagic): simplified the interface of
2604 * IPython/iplib.py (ipmagic): simplified the interface of
2599 ipmagic() to take a single string argument, just as it would be
2605 ipmagic() to take a single string argument, just as it would be
2600 typed at the IPython cmd line.
2606 typed at the IPython cmd line.
2601 (ipalias): Added new ipalias() with an interface identical to
2607 (ipalias): Added new ipalias() with an interface identical to
2602 ipmagic(). This completes exposing a pure python interface to the
2608 ipmagic(). This completes exposing a pure python interface to the
2603 alias and magic system, which can be used in loops or more complex
2609 alias and magic system, which can be used in loops or more complex
2604 code where IPython's automatic line mangling is not active.
2610 code where IPython's automatic line mangling is not active.
2605
2611
2606 * IPython/genutils.py (timing): changed interface of timing to
2612 * IPython/genutils.py (timing): changed interface of timing to
2607 simply run code once, which is the most common case. timings()
2613 simply run code once, which is the most common case. timings()
2608 remains unchanged, for the cases where you want multiple runs.
2614 remains unchanged, for the cases where you want multiple runs.
2609
2615
2610 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2616 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2611 bug where Python2.2 crashes with exec'ing code which does not end
2617 bug where Python2.2 crashes with exec'ing code which does not end
2612 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2618 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2613 before.
2619 before.
2614
2620
2615 2004-12-10 Fernando Perez <fperez@colorado.edu>
2621 2004-12-10 Fernando Perez <fperez@colorado.edu>
2616
2622
2617 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2623 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2618 -t to -T, to accomodate the new -t flag in %run (the %run and
2624 -t to -T, to accomodate the new -t flag in %run (the %run and
2619 %prun options are kind of intermixed, and it's not easy to change
2625 %prun options are kind of intermixed, and it's not easy to change
2620 this with the limitations of python's getopt).
2626 this with the limitations of python's getopt).
2621
2627
2622 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2628 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2623 the execution of scripts. It's not as fine-tuned as timeit.py,
2629 the execution of scripts. It's not as fine-tuned as timeit.py,
2624 but it works from inside ipython (and under 2.2, which lacks
2630 but it works from inside ipython (and under 2.2, which lacks
2625 timeit.py). Optionally a number of runs > 1 can be given for
2631 timeit.py). Optionally a number of runs > 1 can be given for
2626 timing very short-running code.
2632 timing very short-running code.
2627
2633
2628 * IPython/genutils.py (uniq_stable): new routine which returns a
2634 * IPython/genutils.py (uniq_stable): new routine which returns a
2629 list of unique elements in any iterable, but in stable order of
2635 list of unique elements in any iterable, but in stable order of
2630 appearance. I needed this for the ultraTB fixes, and it's a handy
2636 appearance. I needed this for the ultraTB fixes, and it's a handy
2631 utility.
2637 utility.
2632
2638
2633 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2639 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2634 dotted names in Verbose exceptions. This had been broken since
2640 dotted names in Verbose exceptions. This had been broken since
2635 the very start, now x.y will properly be printed in a Verbose
2641 the very start, now x.y will properly be printed in a Verbose
2636 traceback, instead of x being shown and y appearing always as an
2642 traceback, instead of x being shown and y appearing always as an
2637 'undefined global'. Getting this to work was a bit tricky,
2643 'undefined global'. Getting this to work was a bit tricky,
2638 because by default python tokenizers are stateless. Saved by
2644 because by default python tokenizers are stateless. Saved by
2639 python's ability to easily add a bit of state to an arbitrary
2645 python's ability to easily add a bit of state to an arbitrary
2640 function (without needing to build a full-blown callable object).
2646 function (without needing to build a full-blown callable object).
2641
2647
2642 Also big cleanup of this code, which had horrendous runtime
2648 Also big cleanup of this code, which had horrendous runtime
2643 lookups of zillions of attributes for colorization. Moved all
2649 lookups of zillions of attributes for colorization. Moved all
2644 this code into a few templates, which make it cleaner and quicker.
2650 this code into a few templates, which make it cleaner and quicker.
2645
2651
2646 Printout quality was also improved for Verbose exceptions: one
2652 Printout quality was also improved for Verbose exceptions: one
2647 variable per line, and memory addresses are printed (this can be
2653 variable per line, and memory addresses are printed (this can be
2648 quite handy in nasty debugging situations, which is what Verbose
2654 quite handy in nasty debugging situations, which is what Verbose
2649 is for).
2655 is for).
2650
2656
2651 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2657 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2652 the command line as scripts to be loaded by embedded instances.
2658 the command line as scripts to be loaded by embedded instances.
2653 Doing so has the potential for an infinite recursion if there are
2659 Doing so has the potential for an infinite recursion if there are
2654 exceptions thrown in the process. This fixes a strange crash
2660 exceptions thrown in the process. This fixes a strange crash
2655 reported by Philippe MULLER <muller-AT-irit.fr>.
2661 reported by Philippe MULLER <muller-AT-irit.fr>.
2656
2662
2657 2004-12-09 Fernando Perez <fperez@colorado.edu>
2663 2004-12-09 Fernando Perez <fperez@colorado.edu>
2658
2664
2659 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2665 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2660 to reflect new names in matplotlib, which now expose the
2666 to reflect new names in matplotlib, which now expose the
2661 matlab-compatible interface via a pylab module instead of the
2667 matlab-compatible interface via a pylab module instead of the
2662 'matlab' name. The new code is backwards compatible, so users of
2668 'matlab' name. The new code is backwards compatible, so users of
2663 all matplotlib versions are OK. Patch by J. Hunter.
2669 all matplotlib versions are OK. Patch by J. Hunter.
2664
2670
2665 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2671 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2666 of __init__ docstrings for instances (class docstrings are already
2672 of __init__ docstrings for instances (class docstrings are already
2667 automatically printed). Instances with customized docstrings
2673 automatically printed). Instances with customized docstrings
2668 (indep. of the class) are also recognized and all 3 separate
2674 (indep. of the class) are also recognized and all 3 separate
2669 docstrings are printed (instance, class, constructor). After some
2675 docstrings are printed (instance, class, constructor). After some
2670 comments/suggestions by J. Hunter.
2676 comments/suggestions by J. Hunter.
2671
2677
2672 2004-12-05 Fernando Perez <fperez@colorado.edu>
2678 2004-12-05 Fernando Perez <fperez@colorado.edu>
2673
2679
2674 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2680 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2675 warnings when tab-completion fails and triggers an exception.
2681 warnings when tab-completion fails and triggers an exception.
2676
2682
2677 2004-12-03 Fernando Perez <fperez@colorado.edu>
2683 2004-12-03 Fernando Perez <fperez@colorado.edu>
2678
2684
2679 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2685 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2680 be triggered when using 'run -p'. An incorrect option flag was
2686 be triggered when using 'run -p'. An incorrect option flag was
2681 being set ('d' instead of 'D').
2687 being set ('d' instead of 'D').
2682 (manpage): fix missing escaped \- sign.
2688 (manpage): fix missing escaped \- sign.
2683
2689
2684 2004-11-30 *** Released version 0.6.5
2690 2004-11-30 *** Released version 0.6.5
2685
2691
2686 2004-11-30 Fernando Perez <fperez@colorado.edu>
2692 2004-11-30 Fernando Perez <fperez@colorado.edu>
2687
2693
2688 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2694 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2689 setting with -d option.
2695 setting with -d option.
2690
2696
2691 * setup.py (docfiles): Fix problem where the doc glob I was using
2697 * setup.py (docfiles): Fix problem where the doc glob I was using
2692 was COMPLETELY BROKEN. It was giving the right files by pure
2698 was COMPLETELY BROKEN. It was giving the right files by pure
2693 accident, but failed once I tried to include ipython.el. Note:
2699 accident, but failed once I tried to include ipython.el. Note:
2694 glob() does NOT allow you to do exclusion on multiple endings!
2700 glob() does NOT allow you to do exclusion on multiple endings!
2695
2701
2696 2004-11-29 Fernando Perez <fperez@colorado.edu>
2702 2004-11-29 Fernando Perez <fperez@colorado.edu>
2697
2703
2698 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2704 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2699 the manpage as the source. Better formatting & consistency.
2705 the manpage as the source. Better formatting & consistency.
2700
2706
2701 * IPython/Magic.py (magic_run): Added new -d option, to run
2707 * IPython/Magic.py (magic_run): Added new -d option, to run
2702 scripts under the control of the python pdb debugger. Note that
2708 scripts under the control of the python pdb debugger. Note that
2703 this required changing the %prun option -d to -D, to avoid a clash
2709 this required changing the %prun option -d to -D, to avoid a clash
2704 (since %run must pass options to %prun, and getopt is too dumb to
2710 (since %run must pass options to %prun, and getopt is too dumb to
2705 handle options with string values with embedded spaces). Thanks
2711 handle options with string values with embedded spaces). Thanks
2706 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2712 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2707 (magic_who_ls): added type matching to %who and %whos, so that one
2713 (magic_who_ls): added type matching to %who and %whos, so that one
2708 can filter their output to only include variables of certain
2714 can filter their output to only include variables of certain
2709 types. Another suggestion by Matthew.
2715 types. Another suggestion by Matthew.
2710 (magic_whos): Added memory summaries in kb and Mb for arrays.
2716 (magic_whos): Added memory summaries in kb and Mb for arrays.
2711 (magic_who): Improve formatting (break lines every 9 vars).
2717 (magic_who): Improve formatting (break lines every 9 vars).
2712
2718
2713 2004-11-28 Fernando Perez <fperez@colorado.edu>
2719 2004-11-28 Fernando Perez <fperez@colorado.edu>
2714
2720
2715 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2721 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2716 cache when empty lines were present.
2722 cache when empty lines were present.
2717
2723
2718 2004-11-24 Fernando Perez <fperez@colorado.edu>
2724 2004-11-24 Fernando Perez <fperez@colorado.edu>
2719
2725
2720 * IPython/usage.py (__doc__): document the re-activated threading
2726 * IPython/usage.py (__doc__): document the re-activated threading
2721 options for WX and GTK.
2727 options for WX and GTK.
2722
2728
2723 2004-11-23 Fernando Perez <fperez@colorado.edu>
2729 2004-11-23 Fernando Perez <fperez@colorado.edu>
2724
2730
2725 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2731 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2726 the -wthread and -gthread options, along with a new -tk one to try
2732 the -wthread and -gthread options, along with a new -tk one to try
2727 and coordinate Tk threading with wx/gtk. The tk support is very
2733 and coordinate Tk threading with wx/gtk. The tk support is very
2728 platform dependent, since it seems to require Tcl and Tk to be
2734 platform dependent, since it seems to require Tcl and Tk to be
2729 built with threads (Fedora1/2 appears NOT to have it, but in
2735 built with threads (Fedora1/2 appears NOT to have it, but in
2730 Prabhu's Debian boxes it works OK). But even with some Tk
2736 Prabhu's Debian boxes it works OK). But even with some Tk
2731 limitations, this is a great improvement.
2737 limitations, this is a great improvement.
2732
2738
2733 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2739 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2734 info in user prompts. Patch by Prabhu.
2740 info in user prompts. Patch by Prabhu.
2735
2741
2736 2004-11-18 Fernando Perez <fperez@colorado.edu>
2742 2004-11-18 Fernando Perez <fperez@colorado.edu>
2737
2743
2738 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2744 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2739 EOFErrors and bail, to avoid infinite loops if a non-terminating
2745 EOFErrors and bail, to avoid infinite loops if a non-terminating
2740 file is fed into ipython. Patch submitted in issue 19 by user,
2746 file is fed into ipython. Patch submitted in issue 19 by user,
2741 many thanks.
2747 many thanks.
2742
2748
2743 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2749 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2744 autoquote/parens in continuation prompts, which can cause lots of
2750 autoquote/parens in continuation prompts, which can cause lots of
2745 problems. Closes roundup issue 20.
2751 problems. Closes roundup issue 20.
2746
2752
2747 2004-11-17 Fernando Perez <fperez@colorado.edu>
2753 2004-11-17 Fernando Perez <fperez@colorado.edu>
2748
2754
2749 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2755 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2750 reported as debian bug #280505. I'm not sure my local changelog
2756 reported as debian bug #280505. I'm not sure my local changelog
2751 entry has the proper debian format (Jack?).
2757 entry has the proper debian format (Jack?).
2752
2758
2753 2004-11-08 *** Released version 0.6.4
2759 2004-11-08 *** Released version 0.6.4
2754
2760
2755 2004-11-08 Fernando Perez <fperez@colorado.edu>
2761 2004-11-08 Fernando Perez <fperez@colorado.edu>
2756
2762
2757 * IPython/iplib.py (init_readline): Fix exit message for Windows
2763 * IPython/iplib.py (init_readline): Fix exit message for Windows
2758 when readline is active. Thanks to a report by Eric Jones
2764 when readline is active. Thanks to a report by Eric Jones
2759 <eric-AT-enthought.com>.
2765 <eric-AT-enthought.com>.
2760
2766
2761 2004-11-07 Fernando Perez <fperez@colorado.edu>
2767 2004-11-07 Fernando Perez <fperez@colorado.edu>
2762
2768
2763 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2769 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2764 sometimes seen by win2k/cygwin users.
2770 sometimes seen by win2k/cygwin users.
2765
2771
2766 2004-11-06 Fernando Perez <fperez@colorado.edu>
2772 2004-11-06 Fernando Perez <fperez@colorado.edu>
2767
2773
2768 * IPython/iplib.py (interact): Change the handling of %Exit from
2774 * IPython/iplib.py (interact): Change the handling of %Exit from
2769 trying to propagate a SystemExit to an internal ipython flag.
2775 trying to propagate a SystemExit to an internal ipython flag.
2770 This is less elegant than using Python's exception mechanism, but
2776 This is less elegant than using Python's exception mechanism, but
2771 I can't get that to work reliably with threads, so under -pylab
2777 I can't get that to work reliably with threads, so under -pylab
2772 %Exit was hanging IPython. Cross-thread exception handling is
2778 %Exit was hanging IPython. Cross-thread exception handling is
2773 really a bitch. Thaks to a bug report by Stephen Walton
2779 really a bitch. Thaks to a bug report by Stephen Walton
2774 <stephen.walton-AT-csun.edu>.
2780 <stephen.walton-AT-csun.edu>.
2775
2781
2776 2004-11-04 Fernando Perez <fperez@colorado.edu>
2782 2004-11-04 Fernando Perez <fperez@colorado.edu>
2777
2783
2778 * IPython/iplib.py (raw_input_original): store a pointer to the
2784 * IPython/iplib.py (raw_input_original): store a pointer to the
2779 true raw_input to harden against code which can modify it
2785 true raw_input to harden against code which can modify it
2780 (wx.py.PyShell does this and would otherwise crash ipython).
2786 (wx.py.PyShell does this and would otherwise crash ipython).
2781 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2787 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2782
2788
2783 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2789 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2784 Ctrl-C problem, which does not mess up the input line.
2790 Ctrl-C problem, which does not mess up the input line.
2785
2791
2786 2004-11-03 Fernando Perez <fperez@colorado.edu>
2792 2004-11-03 Fernando Perez <fperez@colorado.edu>
2787
2793
2788 * IPython/Release.py: Changed licensing to BSD, in all files.
2794 * IPython/Release.py: Changed licensing to BSD, in all files.
2789 (name): lowercase name for tarball/RPM release.
2795 (name): lowercase name for tarball/RPM release.
2790
2796
2791 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2797 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2792 use throughout ipython.
2798 use throughout ipython.
2793
2799
2794 * IPython/Magic.py (Magic._ofind): Switch to using the new
2800 * IPython/Magic.py (Magic._ofind): Switch to using the new
2795 OInspect.getdoc() function.
2801 OInspect.getdoc() function.
2796
2802
2797 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2803 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2798 of the line currently being canceled via Ctrl-C. It's extremely
2804 of the line currently being canceled via Ctrl-C. It's extremely
2799 ugly, but I don't know how to do it better (the problem is one of
2805 ugly, but I don't know how to do it better (the problem is one of
2800 handling cross-thread exceptions).
2806 handling cross-thread exceptions).
2801
2807
2802 2004-10-28 Fernando Perez <fperez@colorado.edu>
2808 2004-10-28 Fernando Perez <fperez@colorado.edu>
2803
2809
2804 * IPython/Shell.py (signal_handler): add signal handlers to trap
2810 * IPython/Shell.py (signal_handler): add signal handlers to trap
2805 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2811 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2806 report by Francesc Alted.
2812 report by Francesc Alted.
2807
2813
2808 2004-10-21 Fernando Perez <fperez@colorado.edu>
2814 2004-10-21 Fernando Perez <fperez@colorado.edu>
2809
2815
2810 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2816 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2811 to % for pysh syntax extensions.
2817 to % for pysh syntax extensions.
2812
2818
2813 2004-10-09 Fernando Perez <fperez@colorado.edu>
2819 2004-10-09 Fernando Perez <fperez@colorado.edu>
2814
2820
2815 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2821 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2816 arrays to print a more useful summary, without calling str(arr).
2822 arrays to print a more useful summary, without calling str(arr).
2817 This avoids the problem of extremely lengthy computations which
2823 This avoids the problem of extremely lengthy computations which
2818 occur if arr is large, and appear to the user as a system lockup
2824 occur if arr is large, and appear to the user as a system lockup
2819 with 100% cpu activity. After a suggestion by Kristian Sandberg
2825 with 100% cpu activity. After a suggestion by Kristian Sandberg
2820 <Kristian.Sandberg@colorado.edu>.
2826 <Kristian.Sandberg@colorado.edu>.
2821 (Magic.__init__): fix bug in global magic escapes not being
2827 (Magic.__init__): fix bug in global magic escapes not being
2822 correctly set.
2828 correctly set.
2823
2829
2824 2004-10-08 Fernando Perez <fperez@colorado.edu>
2830 2004-10-08 Fernando Perez <fperez@colorado.edu>
2825
2831
2826 * IPython/Magic.py (__license__): change to absolute imports of
2832 * IPython/Magic.py (__license__): change to absolute imports of
2827 ipython's own internal packages, to start adapting to the absolute
2833 ipython's own internal packages, to start adapting to the absolute
2828 import requirement of PEP-328.
2834 import requirement of PEP-328.
2829
2835
2830 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2836 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2831 files, and standardize author/license marks through the Release
2837 files, and standardize author/license marks through the Release
2832 module instead of having per/file stuff (except for files with
2838 module instead of having per/file stuff (except for files with
2833 particular licenses, like the MIT/PSF-licensed codes).
2839 particular licenses, like the MIT/PSF-licensed codes).
2834
2840
2835 * IPython/Debugger.py: remove dead code for python 2.1
2841 * IPython/Debugger.py: remove dead code for python 2.1
2836
2842
2837 2004-10-04 Fernando Perez <fperez@colorado.edu>
2843 2004-10-04 Fernando Perez <fperez@colorado.edu>
2838
2844
2839 * IPython/iplib.py (ipmagic): New function for accessing magics
2845 * IPython/iplib.py (ipmagic): New function for accessing magics
2840 via a normal python function call.
2846 via a normal python function call.
2841
2847
2842 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2848 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2843 from '@' to '%', to accomodate the new @decorator syntax of python
2849 from '@' to '%', to accomodate the new @decorator syntax of python
2844 2.4.
2850 2.4.
2845
2851
2846 2004-09-29 Fernando Perez <fperez@colorado.edu>
2852 2004-09-29 Fernando Perez <fperez@colorado.edu>
2847
2853
2848 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2854 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2849 matplotlib.use to prevent running scripts which try to switch
2855 matplotlib.use to prevent running scripts which try to switch
2850 interactive backends from within ipython. This will just crash
2856 interactive backends from within ipython. This will just crash
2851 the python interpreter, so we can't allow it (but a detailed error
2857 the python interpreter, so we can't allow it (but a detailed error
2852 is given to the user).
2858 is given to the user).
2853
2859
2854 2004-09-28 Fernando Perez <fperez@colorado.edu>
2860 2004-09-28 Fernando Perez <fperez@colorado.edu>
2855
2861
2856 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2862 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2857 matplotlib-related fixes so that using @run with non-matplotlib
2863 matplotlib-related fixes so that using @run with non-matplotlib
2858 scripts doesn't pop up spurious plot windows. This requires
2864 scripts doesn't pop up spurious plot windows. This requires
2859 matplotlib >= 0.63, where I had to make some changes as well.
2865 matplotlib >= 0.63, where I had to make some changes as well.
2860
2866
2861 * IPython/ipmaker.py (make_IPython): update version requirement to
2867 * IPython/ipmaker.py (make_IPython): update version requirement to
2862 python 2.2.
2868 python 2.2.
2863
2869
2864 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2870 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2865 banner arg for embedded customization.
2871 banner arg for embedded customization.
2866
2872
2867 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2873 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2868 explicit uses of __IP as the IPython's instance name. Now things
2874 explicit uses of __IP as the IPython's instance name. Now things
2869 are properly handled via the shell.name value. The actual code
2875 are properly handled via the shell.name value. The actual code
2870 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2876 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2871 is much better than before. I'll clean things completely when the
2877 is much better than before. I'll clean things completely when the
2872 magic stuff gets a real overhaul.
2878 magic stuff gets a real overhaul.
2873
2879
2874 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2880 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2875 minor changes to debian dir.
2881 minor changes to debian dir.
2876
2882
2877 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2883 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2878 pointer to the shell itself in the interactive namespace even when
2884 pointer to the shell itself in the interactive namespace even when
2879 a user-supplied dict is provided. This is needed for embedding
2885 a user-supplied dict is provided. This is needed for embedding
2880 purposes (found by tests with Michel Sanner).
2886 purposes (found by tests with Michel Sanner).
2881
2887
2882 2004-09-27 Fernando Perez <fperez@colorado.edu>
2888 2004-09-27 Fernando Perez <fperez@colorado.edu>
2883
2889
2884 * IPython/UserConfig/ipythonrc: remove []{} from
2890 * IPython/UserConfig/ipythonrc: remove []{} from
2885 readline_remove_delims, so that things like [modname.<TAB> do
2891 readline_remove_delims, so that things like [modname.<TAB> do
2886 proper completion. This disables [].TAB, but that's a less common
2892 proper completion. This disables [].TAB, but that's a less common
2887 case than module names in list comprehensions, for example.
2893 case than module names in list comprehensions, for example.
2888 Thanks to a report by Andrea Riciputi.
2894 Thanks to a report by Andrea Riciputi.
2889
2895
2890 2004-09-09 Fernando Perez <fperez@colorado.edu>
2896 2004-09-09 Fernando Perez <fperez@colorado.edu>
2891
2897
2892 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2898 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2893 blocking problems in win32 and osx. Fix by John.
2899 blocking problems in win32 and osx. Fix by John.
2894
2900
2895 2004-09-08 Fernando Perez <fperez@colorado.edu>
2901 2004-09-08 Fernando Perez <fperez@colorado.edu>
2896
2902
2897 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2903 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2898 for Win32 and OSX. Fix by John Hunter.
2904 for Win32 and OSX. Fix by John Hunter.
2899
2905
2900 2004-08-30 *** Released version 0.6.3
2906 2004-08-30 *** Released version 0.6.3
2901
2907
2902 2004-08-30 Fernando Perez <fperez@colorado.edu>
2908 2004-08-30 Fernando Perez <fperez@colorado.edu>
2903
2909
2904 * setup.py (isfile): Add manpages to list of dependent files to be
2910 * setup.py (isfile): Add manpages to list of dependent files to be
2905 updated.
2911 updated.
2906
2912
2907 2004-08-27 Fernando Perez <fperez@colorado.edu>
2913 2004-08-27 Fernando Perez <fperez@colorado.edu>
2908
2914
2909 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2915 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2910 for now. They don't really work with standalone WX/GTK code
2916 for now. They don't really work with standalone WX/GTK code
2911 (though matplotlib IS working fine with both of those backends).
2917 (though matplotlib IS working fine with both of those backends).
2912 This will neeed much more testing. I disabled most things with
2918 This will neeed much more testing. I disabled most things with
2913 comments, so turning it back on later should be pretty easy.
2919 comments, so turning it back on later should be pretty easy.
2914
2920
2915 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2921 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2916 autocalling of expressions like r'foo', by modifying the line
2922 autocalling of expressions like r'foo', by modifying the line
2917 split regexp. Closes
2923 split regexp. Closes
2918 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2924 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2919 Riley <ipythonbugs-AT-sabi.net>.
2925 Riley <ipythonbugs-AT-sabi.net>.
2920 (InteractiveShell.mainloop): honor --nobanner with banner
2926 (InteractiveShell.mainloop): honor --nobanner with banner
2921 extensions.
2927 extensions.
2922
2928
2923 * IPython/Shell.py: Significant refactoring of all classes, so
2929 * IPython/Shell.py: Significant refactoring of all classes, so
2924 that we can really support ALL matplotlib backends and threading
2930 that we can really support ALL matplotlib backends and threading
2925 models (John spotted a bug with Tk which required this). Now we
2931 models (John spotted a bug with Tk which required this). Now we
2926 should support single-threaded, WX-threads and GTK-threads, both
2932 should support single-threaded, WX-threads and GTK-threads, both
2927 for generic code and for matplotlib.
2933 for generic code and for matplotlib.
2928
2934
2929 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2935 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2930 -pylab, to simplify things for users. Will also remove the pylab
2936 -pylab, to simplify things for users. Will also remove the pylab
2931 profile, since now all of matplotlib configuration is directly
2937 profile, since now all of matplotlib configuration is directly
2932 handled here. This also reduces startup time.
2938 handled here. This also reduces startup time.
2933
2939
2934 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2940 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2935 shell wasn't being correctly called. Also in IPShellWX.
2941 shell wasn't being correctly called. Also in IPShellWX.
2936
2942
2937 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2943 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2938 fine-tune banner.
2944 fine-tune banner.
2939
2945
2940 * IPython/numutils.py (spike): Deprecate these spike functions,
2946 * IPython/numutils.py (spike): Deprecate these spike functions,
2941 delete (long deprecated) gnuplot_exec handler.
2947 delete (long deprecated) gnuplot_exec handler.
2942
2948
2943 2004-08-26 Fernando Perez <fperez@colorado.edu>
2949 2004-08-26 Fernando Perez <fperez@colorado.edu>
2944
2950
2945 * ipython.1: Update for threading options, plus some others which
2951 * ipython.1: Update for threading options, plus some others which
2946 were missing.
2952 were missing.
2947
2953
2948 * IPython/ipmaker.py (__call__): Added -wthread option for
2954 * IPython/ipmaker.py (__call__): Added -wthread option for
2949 wxpython thread handling. Make sure threading options are only
2955 wxpython thread handling. Make sure threading options are only
2950 valid at the command line.
2956 valid at the command line.
2951
2957
2952 * scripts/ipython: moved shell selection into a factory function
2958 * scripts/ipython: moved shell selection into a factory function
2953 in Shell.py, to keep the starter script to a minimum.
2959 in Shell.py, to keep the starter script to a minimum.
2954
2960
2955 2004-08-25 Fernando Perez <fperez@colorado.edu>
2961 2004-08-25 Fernando Perez <fperez@colorado.edu>
2956
2962
2957 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2963 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2958 John. Along with some recent changes he made to matplotlib, the
2964 John. Along with some recent changes he made to matplotlib, the
2959 next versions of both systems should work very well together.
2965 next versions of both systems should work very well together.
2960
2966
2961 2004-08-24 Fernando Perez <fperez@colorado.edu>
2967 2004-08-24 Fernando Perez <fperez@colorado.edu>
2962
2968
2963 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2969 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2964 tried to switch the profiling to using hotshot, but I'm getting
2970 tried to switch the profiling to using hotshot, but I'm getting
2965 strange errors from prof.runctx() there. I may be misreading the
2971 strange errors from prof.runctx() there. I may be misreading the
2966 docs, but it looks weird. For now the profiling code will
2972 docs, but it looks weird. For now the profiling code will
2967 continue to use the standard profiler.
2973 continue to use the standard profiler.
2968
2974
2969 2004-08-23 Fernando Perez <fperez@colorado.edu>
2975 2004-08-23 Fernando Perez <fperez@colorado.edu>
2970
2976
2971 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2977 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2972 threaded shell, by John Hunter. It's not quite ready yet, but
2978 threaded shell, by John Hunter. It's not quite ready yet, but
2973 close.
2979 close.
2974
2980
2975 2004-08-22 Fernando Perez <fperez@colorado.edu>
2981 2004-08-22 Fernando Perez <fperez@colorado.edu>
2976
2982
2977 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2983 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2978 in Magic and ultraTB.
2984 in Magic and ultraTB.
2979
2985
2980 * ipython.1: document threading options in manpage.
2986 * ipython.1: document threading options in manpage.
2981
2987
2982 * scripts/ipython: Changed name of -thread option to -gthread,
2988 * scripts/ipython: Changed name of -thread option to -gthread,
2983 since this is GTK specific. I want to leave the door open for a
2989 since this is GTK specific. I want to leave the door open for a
2984 -wthread option for WX, which will most likely be necessary. This
2990 -wthread option for WX, which will most likely be necessary. This
2985 change affects usage and ipmaker as well.
2991 change affects usage and ipmaker as well.
2986
2992
2987 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2993 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2988 handle the matplotlib shell issues. Code by John Hunter
2994 handle the matplotlib shell issues. Code by John Hunter
2989 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2995 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2990 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2996 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2991 broken (and disabled for end users) for now, but it puts the
2997 broken (and disabled for end users) for now, but it puts the
2992 infrastructure in place.
2998 infrastructure in place.
2993
2999
2994 2004-08-21 Fernando Perez <fperez@colorado.edu>
3000 2004-08-21 Fernando Perez <fperez@colorado.edu>
2995
3001
2996 * ipythonrc-pylab: Add matplotlib support.
3002 * ipythonrc-pylab: Add matplotlib support.
2997
3003
2998 * matplotlib_config.py: new files for matplotlib support, part of
3004 * matplotlib_config.py: new files for matplotlib support, part of
2999 the pylab profile.
3005 the pylab profile.
3000
3006
3001 * IPython/usage.py (__doc__): documented the threading options.
3007 * IPython/usage.py (__doc__): documented the threading options.
3002
3008
3003 2004-08-20 Fernando Perez <fperez@colorado.edu>
3009 2004-08-20 Fernando Perez <fperez@colorado.edu>
3004
3010
3005 * ipython: Modified the main calling routine to handle the -thread
3011 * ipython: Modified the main calling routine to handle the -thread
3006 and -mpthread options. This needs to be done as a top-level hack,
3012 and -mpthread options. This needs to be done as a top-level hack,
3007 because it determines which class to instantiate for IPython
3013 because it determines which class to instantiate for IPython
3008 itself.
3014 itself.
3009
3015
3010 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3016 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3011 classes to support multithreaded GTK operation without blocking,
3017 classes to support multithreaded GTK operation without blocking,
3012 and matplotlib with all backends. This is a lot of still very
3018 and matplotlib with all backends. This is a lot of still very
3013 experimental code, and threads are tricky. So it may still have a
3019 experimental code, and threads are tricky. So it may still have a
3014 few rough edges... This code owes a lot to
3020 few rough edges... This code owes a lot to
3015 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3021 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3016 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3022 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3017 to John Hunter for all the matplotlib work.
3023 to John Hunter for all the matplotlib work.
3018
3024
3019 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3025 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3020 options for gtk thread and matplotlib support.
3026 options for gtk thread and matplotlib support.
3021
3027
3022 2004-08-16 Fernando Perez <fperez@colorado.edu>
3028 2004-08-16 Fernando Perez <fperez@colorado.edu>
3023
3029
3024 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3030 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3025 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3031 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3026 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3032 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3027
3033
3028 2004-08-11 Fernando Perez <fperez@colorado.edu>
3034 2004-08-11 Fernando Perez <fperez@colorado.edu>
3029
3035
3030 * setup.py (isfile): Fix build so documentation gets updated for
3036 * setup.py (isfile): Fix build so documentation gets updated for
3031 rpms (it was only done for .tgz builds).
3037 rpms (it was only done for .tgz builds).
3032
3038
3033 2004-08-10 Fernando Perez <fperez@colorado.edu>
3039 2004-08-10 Fernando Perez <fperez@colorado.edu>
3034
3040
3035 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3041 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3036
3042
3037 * iplib.py : Silence syntax error exceptions in tab-completion.
3043 * iplib.py : Silence syntax error exceptions in tab-completion.
3038
3044
3039 2004-08-05 Fernando Perez <fperez@colorado.edu>
3045 2004-08-05 Fernando Perez <fperez@colorado.edu>
3040
3046
3041 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3047 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3042 'color off' mark for continuation prompts. This was causing long
3048 'color off' mark for continuation prompts. This was causing long
3043 continuation lines to mis-wrap.
3049 continuation lines to mis-wrap.
3044
3050
3045 2004-08-01 Fernando Perez <fperez@colorado.edu>
3051 2004-08-01 Fernando Perez <fperez@colorado.edu>
3046
3052
3047 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3053 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3048 for building ipython to be a parameter. All this is necessary
3054 for building ipython to be a parameter. All this is necessary
3049 right now to have a multithreaded version, but this insane
3055 right now to have a multithreaded version, but this insane
3050 non-design will be cleaned up soon. For now, it's a hack that
3056 non-design will be cleaned up soon. For now, it's a hack that
3051 works.
3057 works.
3052
3058
3053 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3059 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3054 args in various places. No bugs so far, but it's a dangerous
3060 args in various places. No bugs so far, but it's a dangerous
3055 practice.
3061 practice.
3056
3062
3057 2004-07-31 Fernando Perez <fperez@colorado.edu>
3063 2004-07-31 Fernando Perez <fperez@colorado.edu>
3058
3064
3059 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3065 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3060 fix completion of files with dots in their names under most
3066 fix completion of files with dots in their names under most
3061 profiles (pysh was OK because the completion order is different).
3067 profiles (pysh was OK because the completion order is different).
3062
3068
3063 2004-07-27 Fernando Perez <fperez@colorado.edu>
3069 2004-07-27 Fernando Perez <fperez@colorado.edu>
3064
3070
3065 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3071 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3066 keywords manually, b/c the one in keyword.py was removed in python
3072 keywords manually, b/c the one in keyword.py was removed in python
3067 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3073 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3068 This is NOT a bug under python 2.3 and earlier.
3074 This is NOT a bug under python 2.3 and earlier.
3069
3075
3070 2004-07-26 Fernando Perez <fperez@colorado.edu>
3076 2004-07-26 Fernando Perez <fperez@colorado.edu>
3071
3077
3072 * IPython/ultraTB.py (VerboseTB.text): Add another
3078 * IPython/ultraTB.py (VerboseTB.text): Add another
3073 linecache.checkcache() call to try to prevent inspect.py from
3079 linecache.checkcache() call to try to prevent inspect.py from
3074 crashing under python 2.3. I think this fixes
3080 crashing under python 2.3. I think this fixes
3075 http://www.scipy.net/roundup/ipython/issue17.
3081 http://www.scipy.net/roundup/ipython/issue17.
3076
3082
3077 2004-07-26 *** Released version 0.6.2
3083 2004-07-26 *** Released version 0.6.2
3078
3084
3079 2004-07-26 Fernando Perez <fperez@colorado.edu>
3085 2004-07-26 Fernando Perez <fperez@colorado.edu>
3080
3086
3081 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3087 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3082 fail for any number.
3088 fail for any number.
3083 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3089 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3084 empty bookmarks.
3090 empty bookmarks.
3085
3091
3086 2004-07-26 *** Released version 0.6.1
3092 2004-07-26 *** Released version 0.6.1
3087
3093
3088 2004-07-26 Fernando Perez <fperez@colorado.edu>
3094 2004-07-26 Fernando Perez <fperez@colorado.edu>
3089
3095
3090 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3096 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3091
3097
3092 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3098 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3093 escaping '()[]{}' in filenames.
3099 escaping '()[]{}' in filenames.
3094
3100
3095 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3101 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3096 Python 2.2 users who lack a proper shlex.split.
3102 Python 2.2 users who lack a proper shlex.split.
3097
3103
3098 2004-07-19 Fernando Perez <fperez@colorado.edu>
3104 2004-07-19 Fernando Perez <fperez@colorado.edu>
3099
3105
3100 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3106 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3101 for reading readline's init file. I follow the normal chain:
3107 for reading readline's init file. I follow the normal chain:
3102 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3108 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3103 report by Mike Heeter. This closes
3109 report by Mike Heeter. This closes
3104 http://www.scipy.net/roundup/ipython/issue16.
3110 http://www.scipy.net/roundup/ipython/issue16.
3105
3111
3106 2004-07-18 Fernando Perez <fperez@colorado.edu>
3112 2004-07-18 Fernando Perez <fperez@colorado.edu>
3107
3113
3108 * IPython/iplib.py (__init__): Add better handling of '\' under
3114 * IPython/iplib.py (__init__): Add better handling of '\' under
3109 Win32 for filenames. After a patch by Ville.
3115 Win32 for filenames. After a patch by Ville.
3110
3116
3111 2004-07-17 Fernando Perez <fperez@colorado.edu>
3117 2004-07-17 Fernando Perez <fperez@colorado.edu>
3112
3118
3113 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3119 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3114 autocalling would be triggered for 'foo is bar' if foo is
3120 autocalling would be triggered for 'foo is bar' if foo is
3115 callable. I also cleaned up the autocall detection code to use a
3121 callable. I also cleaned up the autocall detection code to use a
3116 regexp, which is faster. Bug reported by Alexander Schmolck.
3122 regexp, which is faster. Bug reported by Alexander Schmolck.
3117
3123
3118 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3124 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3119 '?' in them would confuse the help system. Reported by Alex
3125 '?' in them would confuse the help system. Reported by Alex
3120 Schmolck.
3126 Schmolck.
3121
3127
3122 2004-07-16 Fernando Perez <fperez@colorado.edu>
3128 2004-07-16 Fernando Perez <fperez@colorado.edu>
3123
3129
3124 * IPython/GnuplotInteractive.py (__all__): added plot2.
3130 * IPython/GnuplotInteractive.py (__all__): added plot2.
3125
3131
3126 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3132 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3127 plotting dictionaries, lists or tuples of 1d arrays.
3133 plotting dictionaries, lists or tuples of 1d arrays.
3128
3134
3129 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3135 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3130 optimizations.
3136 optimizations.
3131
3137
3132 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3138 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3133 the information which was there from Janko's original IPP code:
3139 the information which was there from Janko's original IPP code:
3134
3140
3135 03.05.99 20:53 porto.ifm.uni-kiel.de
3141 03.05.99 20:53 porto.ifm.uni-kiel.de
3136 --Started changelog.
3142 --Started changelog.
3137 --make clear do what it say it does
3143 --make clear do what it say it does
3138 --added pretty output of lines from inputcache
3144 --added pretty output of lines from inputcache
3139 --Made Logger a mixin class, simplifies handling of switches
3145 --Made Logger a mixin class, simplifies handling of switches
3140 --Added own completer class. .string<TAB> expands to last history
3146 --Added own completer class. .string<TAB> expands to last history
3141 line which starts with string. The new expansion is also present
3147 line which starts with string. The new expansion is also present
3142 with Ctrl-r from the readline library. But this shows, who this
3148 with Ctrl-r from the readline library. But this shows, who this
3143 can be done for other cases.
3149 can be done for other cases.
3144 --Added convention that all shell functions should accept a
3150 --Added convention that all shell functions should accept a
3145 parameter_string This opens the door for different behaviour for
3151 parameter_string This opens the door for different behaviour for
3146 each function. @cd is a good example of this.
3152 each function. @cd is a good example of this.
3147
3153
3148 04.05.99 12:12 porto.ifm.uni-kiel.de
3154 04.05.99 12:12 porto.ifm.uni-kiel.de
3149 --added logfile rotation
3155 --added logfile rotation
3150 --added new mainloop method which freezes first the namespace
3156 --added new mainloop method which freezes first the namespace
3151
3157
3152 07.05.99 21:24 porto.ifm.uni-kiel.de
3158 07.05.99 21:24 porto.ifm.uni-kiel.de
3153 --added the docreader classes. Now there is a help system.
3159 --added the docreader classes. Now there is a help system.
3154 -This is only a first try. Currently it's not easy to put new
3160 -This is only a first try. Currently it's not easy to put new
3155 stuff in the indices. But this is the way to go. Info would be
3161 stuff in the indices. But this is the way to go. Info would be
3156 better, but HTML is every where and not everybody has an info
3162 better, but HTML is every where and not everybody has an info
3157 system installed and it's not so easy to change html-docs to info.
3163 system installed and it's not so easy to change html-docs to info.
3158 --added global logfile option
3164 --added global logfile option
3159 --there is now a hook for object inspection method pinfo needs to
3165 --there is now a hook for object inspection method pinfo needs to
3160 be provided for this. Can be reached by two '??'.
3166 be provided for this. Can be reached by two '??'.
3161
3167
3162 08.05.99 20:51 porto.ifm.uni-kiel.de
3168 08.05.99 20:51 porto.ifm.uni-kiel.de
3163 --added a README
3169 --added a README
3164 --bug in rc file. Something has changed so functions in the rc
3170 --bug in rc file. Something has changed so functions in the rc
3165 file need to reference the shell and not self. Not clear if it's a
3171 file need to reference the shell and not self. Not clear if it's a
3166 bug or feature.
3172 bug or feature.
3167 --changed rc file for new behavior
3173 --changed rc file for new behavior
3168
3174
3169 2004-07-15 Fernando Perez <fperez@colorado.edu>
3175 2004-07-15 Fernando Perez <fperez@colorado.edu>
3170
3176
3171 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3177 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3172 cache was falling out of sync in bizarre manners when multi-line
3178 cache was falling out of sync in bizarre manners when multi-line
3173 input was present. Minor optimizations and cleanup.
3179 input was present. Minor optimizations and cleanup.
3174
3180
3175 (Logger): Remove old Changelog info for cleanup. This is the
3181 (Logger): Remove old Changelog info for cleanup. This is the
3176 information which was there from Janko's original code:
3182 information which was there from Janko's original code:
3177
3183
3178 Changes to Logger: - made the default log filename a parameter
3184 Changes to Logger: - made the default log filename a parameter
3179
3185
3180 - put a check for lines beginning with !@? in log(). Needed
3186 - put a check for lines beginning with !@? in log(). Needed
3181 (even if the handlers properly log their lines) for mid-session
3187 (even if the handlers properly log their lines) for mid-session
3182 logging activation to work properly. Without this, lines logged
3188 logging activation to work properly. Without this, lines logged
3183 in mid session, which get read from the cache, would end up
3189 in mid session, which get read from the cache, would end up
3184 'bare' (with !@? in the open) in the log. Now they are caught
3190 'bare' (with !@? in the open) in the log. Now they are caught
3185 and prepended with a #.
3191 and prepended with a #.
3186
3192
3187 * IPython/iplib.py (InteractiveShell.init_readline): added check
3193 * IPython/iplib.py (InteractiveShell.init_readline): added check
3188 in case MagicCompleter fails to be defined, so we don't crash.
3194 in case MagicCompleter fails to be defined, so we don't crash.
3189
3195
3190 2004-07-13 Fernando Perez <fperez@colorado.edu>
3196 2004-07-13 Fernando Perez <fperez@colorado.edu>
3191
3197
3192 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3198 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3193 of EPS if the requested filename ends in '.eps'.
3199 of EPS if the requested filename ends in '.eps'.
3194
3200
3195 2004-07-04 Fernando Perez <fperez@colorado.edu>
3201 2004-07-04 Fernando Perez <fperez@colorado.edu>
3196
3202
3197 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3203 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3198 escaping of quotes when calling the shell.
3204 escaping of quotes when calling the shell.
3199
3205
3200 2004-07-02 Fernando Perez <fperez@colorado.edu>
3206 2004-07-02 Fernando Perez <fperez@colorado.edu>
3201
3207
3202 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3208 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3203 gettext not working because we were clobbering '_'. Fixes
3209 gettext not working because we were clobbering '_'. Fixes
3204 http://www.scipy.net/roundup/ipython/issue6.
3210 http://www.scipy.net/roundup/ipython/issue6.
3205
3211
3206 2004-07-01 Fernando Perez <fperez@colorado.edu>
3212 2004-07-01 Fernando Perez <fperez@colorado.edu>
3207
3213
3208 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3214 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3209 into @cd. Patch by Ville.
3215 into @cd. Patch by Ville.
3210
3216
3211 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3217 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3212 new function to store things after ipmaker runs. Patch by Ville.
3218 new function to store things after ipmaker runs. Patch by Ville.
3213 Eventually this will go away once ipmaker is removed and the class
3219 Eventually this will go away once ipmaker is removed and the class
3214 gets cleaned up, but for now it's ok. Key functionality here is
3220 gets cleaned up, but for now it's ok. Key functionality here is
3215 the addition of the persistent storage mechanism, a dict for
3221 the addition of the persistent storage mechanism, a dict for
3216 keeping data across sessions (for now just bookmarks, but more can
3222 keeping data across sessions (for now just bookmarks, but more can
3217 be implemented later).
3223 be implemented later).
3218
3224
3219 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3225 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3220 persistent across sections. Patch by Ville, I modified it
3226 persistent across sections. Patch by Ville, I modified it
3221 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3227 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3222 added a '-l' option to list all bookmarks.
3228 added a '-l' option to list all bookmarks.
3223
3229
3224 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3230 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3225 center for cleanup. Registered with atexit.register(). I moved
3231 center for cleanup. Registered with atexit.register(). I moved
3226 here the old exit_cleanup(). After a patch by Ville.
3232 here the old exit_cleanup(). After a patch by Ville.
3227
3233
3228 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3234 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3229 characters in the hacked shlex_split for python 2.2.
3235 characters in the hacked shlex_split for python 2.2.
3230
3236
3231 * IPython/iplib.py (file_matches): more fixes to filenames with
3237 * IPython/iplib.py (file_matches): more fixes to filenames with
3232 whitespace in them. It's not perfect, but limitations in python's
3238 whitespace in them. It's not perfect, but limitations in python's
3233 readline make it impossible to go further.
3239 readline make it impossible to go further.
3234
3240
3235 2004-06-29 Fernando Perez <fperez@colorado.edu>
3241 2004-06-29 Fernando Perez <fperez@colorado.edu>
3236
3242
3237 * IPython/iplib.py (file_matches): escape whitespace correctly in
3243 * IPython/iplib.py (file_matches): escape whitespace correctly in
3238 filename completions. Bug reported by Ville.
3244 filename completions. Bug reported by Ville.
3239
3245
3240 2004-06-28 Fernando Perez <fperez@colorado.edu>
3246 2004-06-28 Fernando Perez <fperez@colorado.edu>
3241
3247
3242 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3248 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3243 the history file will be called 'history-PROFNAME' (or just
3249 the history file will be called 'history-PROFNAME' (or just
3244 'history' if no profile is loaded). I was getting annoyed at
3250 'history' if no profile is loaded). I was getting annoyed at
3245 getting my Numerical work history clobbered by pysh sessions.
3251 getting my Numerical work history clobbered by pysh sessions.
3246
3252
3247 * IPython/iplib.py (InteractiveShell.__init__): Internal
3253 * IPython/iplib.py (InteractiveShell.__init__): Internal
3248 getoutputerror() function so that we can honor the system_verbose
3254 getoutputerror() function so that we can honor the system_verbose
3249 flag for _all_ system calls. I also added escaping of #
3255 flag for _all_ system calls. I also added escaping of #
3250 characters here to avoid confusing Itpl.
3256 characters here to avoid confusing Itpl.
3251
3257
3252 * IPython/Magic.py (shlex_split): removed call to shell in
3258 * IPython/Magic.py (shlex_split): removed call to shell in
3253 parse_options and replaced it with shlex.split(). The annoying
3259 parse_options and replaced it with shlex.split(). The annoying
3254 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3260 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3255 to backport it from 2.3, with several frail hacks (the shlex
3261 to backport it from 2.3, with several frail hacks (the shlex
3256 module is rather limited in 2.2). Thanks to a suggestion by Ville
3262 module is rather limited in 2.2). Thanks to a suggestion by Ville
3257 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3263 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3258 problem.
3264 problem.
3259
3265
3260 (Magic.magic_system_verbose): new toggle to print the actual
3266 (Magic.magic_system_verbose): new toggle to print the actual
3261 system calls made by ipython. Mainly for debugging purposes.
3267 system calls made by ipython. Mainly for debugging purposes.
3262
3268
3263 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3269 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3264 doesn't support persistence. Reported (and fix suggested) by
3270 doesn't support persistence. Reported (and fix suggested) by
3265 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3271 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3266
3272
3267 2004-06-26 Fernando Perez <fperez@colorado.edu>
3273 2004-06-26 Fernando Perez <fperez@colorado.edu>
3268
3274
3269 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3275 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3270 continue prompts.
3276 continue prompts.
3271
3277
3272 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3278 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3273 function (basically a big docstring) and a few more things here to
3279 function (basically a big docstring) and a few more things here to
3274 speedup startup. pysh.py is now very lightweight. We want because
3280 speedup startup. pysh.py is now very lightweight. We want because
3275 it gets execfile'd, while InterpreterExec gets imported, so
3281 it gets execfile'd, while InterpreterExec gets imported, so
3276 byte-compilation saves time.
3282 byte-compilation saves time.
3277
3283
3278 2004-06-25 Fernando Perez <fperez@colorado.edu>
3284 2004-06-25 Fernando Perez <fperez@colorado.edu>
3279
3285
3280 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3286 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3281 -NUM', which was recently broken.
3287 -NUM', which was recently broken.
3282
3288
3283 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3289 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3284 in multi-line input (but not !!, which doesn't make sense there).
3290 in multi-line input (but not !!, which doesn't make sense there).
3285
3291
3286 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3292 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3287 It's just too useful, and people can turn it off in the less
3293 It's just too useful, and people can turn it off in the less
3288 common cases where it's a problem.
3294 common cases where it's a problem.
3289
3295
3290 2004-06-24 Fernando Perez <fperez@colorado.edu>
3296 2004-06-24 Fernando Perez <fperez@colorado.edu>
3291
3297
3292 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3298 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3293 special syntaxes (like alias calling) is now allied in multi-line
3299 special syntaxes (like alias calling) is now allied in multi-line
3294 input. This is still _very_ experimental, but it's necessary for
3300 input. This is still _very_ experimental, but it's necessary for
3295 efficient shell usage combining python looping syntax with system
3301 efficient shell usage combining python looping syntax with system
3296 calls. For now it's restricted to aliases, I don't think it
3302 calls. For now it's restricted to aliases, I don't think it
3297 really even makes sense to have this for magics.
3303 really even makes sense to have this for magics.
3298
3304
3299 2004-06-23 Fernando Perez <fperez@colorado.edu>
3305 2004-06-23 Fernando Perez <fperez@colorado.edu>
3300
3306
3301 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3307 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3302 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3308 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3303
3309
3304 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3310 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3305 extensions under Windows (after code sent by Gary Bishop). The
3311 extensions under Windows (after code sent by Gary Bishop). The
3306 extensions considered 'executable' are stored in IPython's rc
3312 extensions considered 'executable' are stored in IPython's rc
3307 structure as win_exec_ext.
3313 structure as win_exec_ext.
3308
3314
3309 * IPython/genutils.py (shell): new function, like system() but
3315 * IPython/genutils.py (shell): new function, like system() but
3310 without return value. Very useful for interactive shell work.
3316 without return value. Very useful for interactive shell work.
3311
3317
3312 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3318 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3313 delete aliases.
3319 delete aliases.
3314
3320
3315 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3321 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3316 sure that the alias table doesn't contain python keywords.
3322 sure that the alias table doesn't contain python keywords.
3317
3323
3318 2004-06-21 Fernando Perez <fperez@colorado.edu>
3324 2004-06-21 Fernando Perez <fperez@colorado.edu>
3319
3325
3320 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3326 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3321 non-existent items are found in $PATH. Reported by Thorsten.
3327 non-existent items are found in $PATH. Reported by Thorsten.
3322
3328
3323 2004-06-20 Fernando Perez <fperez@colorado.edu>
3329 2004-06-20 Fernando Perez <fperez@colorado.edu>
3324
3330
3325 * IPython/iplib.py (complete): modified the completer so that the
3331 * IPython/iplib.py (complete): modified the completer so that the
3326 order of priorities can be easily changed at runtime.
3332 order of priorities can be easily changed at runtime.
3327
3333
3328 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3334 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3329 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3335 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3330
3336
3331 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3337 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3332 expand Python variables prepended with $ in all system calls. The
3338 expand Python variables prepended with $ in all system calls. The
3333 same was done to InteractiveShell.handle_shell_escape. Now all
3339 same was done to InteractiveShell.handle_shell_escape. Now all
3334 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3340 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3335 expansion of python variables and expressions according to the
3341 expansion of python variables and expressions according to the
3336 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3342 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3337
3343
3338 Though PEP-215 has been rejected, a similar (but simpler) one
3344 Though PEP-215 has been rejected, a similar (but simpler) one
3339 seems like it will go into Python 2.4, PEP-292 -
3345 seems like it will go into Python 2.4, PEP-292 -
3340 http://www.python.org/peps/pep-0292.html.
3346 http://www.python.org/peps/pep-0292.html.
3341
3347
3342 I'll keep the full syntax of PEP-215, since IPython has since the
3348 I'll keep the full syntax of PEP-215, since IPython has since the
3343 start used Ka-Ping Yee's reference implementation discussed there
3349 start used Ka-Ping Yee's reference implementation discussed there
3344 (Itpl), and I actually like the powerful semantics it offers.
3350 (Itpl), and I actually like the powerful semantics it offers.
3345
3351
3346 In order to access normal shell variables, the $ has to be escaped
3352 In order to access normal shell variables, the $ has to be escaped
3347 via an extra $. For example:
3353 via an extra $. For example:
3348
3354
3349 In [7]: PATH='a python variable'
3355 In [7]: PATH='a python variable'
3350
3356
3351 In [8]: !echo $PATH
3357 In [8]: !echo $PATH
3352 a python variable
3358 a python variable
3353
3359
3354 In [9]: !echo $$PATH
3360 In [9]: !echo $$PATH
3355 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3361 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3356
3362
3357 (Magic.parse_options): escape $ so the shell doesn't evaluate
3363 (Magic.parse_options): escape $ so the shell doesn't evaluate
3358 things prematurely.
3364 things prematurely.
3359
3365
3360 * IPython/iplib.py (InteractiveShell.call_alias): added the
3366 * IPython/iplib.py (InteractiveShell.call_alias): added the
3361 ability for aliases to expand python variables via $.
3367 ability for aliases to expand python variables via $.
3362
3368
3363 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3369 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3364 system, now there's a @rehash/@rehashx pair of magics. These work
3370 system, now there's a @rehash/@rehashx pair of magics. These work
3365 like the csh rehash command, and can be invoked at any time. They
3371 like the csh rehash command, and can be invoked at any time. They
3366 build a table of aliases to everything in the user's $PATH
3372 build a table of aliases to everything in the user's $PATH
3367 (@rehash uses everything, @rehashx is slower but only adds
3373 (@rehash uses everything, @rehashx is slower but only adds
3368 executable files). With this, the pysh.py-based shell profile can
3374 executable files). With this, the pysh.py-based shell profile can
3369 now simply call rehash upon startup, and full access to all
3375 now simply call rehash upon startup, and full access to all
3370 programs in the user's path is obtained.
3376 programs in the user's path is obtained.
3371
3377
3372 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3378 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3373 functionality is now fully in place. I removed the old dynamic
3379 functionality is now fully in place. I removed the old dynamic
3374 code generation based approach, in favor of a much lighter one
3380 code generation based approach, in favor of a much lighter one
3375 based on a simple dict. The advantage is that this allows me to
3381 based on a simple dict. The advantage is that this allows me to
3376 now have thousands of aliases with negligible cost (unthinkable
3382 now have thousands of aliases with negligible cost (unthinkable
3377 with the old system).
3383 with the old system).
3378
3384
3379 2004-06-19 Fernando Perez <fperez@colorado.edu>
3385 2004-06-19 Fernando Perez <fperez@colorado.edu>
3380
3386
3381 * IPython/iplib.py (__init__): extended MagicCompleter class to
3387 * IPython/iplib.py (__init__): extended MagicCompleter class to
3382 also complete (last in priority) on user aliases.
3388 also complete (last in priority) on user aliases.
3383
3389
3384 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3390 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3385 call to eval.
3391 call to eval.
3386 (ItplNS.__init__): Added a new class which functions like Itpl,
3392 (ItplNS.__init__): Added a new class which functions like Itpl,
3387 but allows configuring the namespace for the evaluation to occur
3393 but allows configuring the namespace for the evaluation to occur
3388 in.
3394 in.
3389
3395
3390 2004-06-18 Fernando Perez <fperez@colorado.edu>
3396 2004-06-18 Fernando Perez <fperez@colorado.edu>
3391
3397
3392 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3398 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3393 better message when 'exit' or 'quit' are typed (a common newbie
3399 better message when 'exit' or 'quit' are typed (a common newbie
3394 confusion).
3400 confusion).
3395
3401
3396 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3402 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3397 check for Windows users.
3403 check for Windows users.
3398
3404
3399 * IPython/iplib.py (InteractiveShell.user_setup): removed
3405 * IPython/iplib.py (InteractiveShell.user_setup): removed
3400 disabling of colors for Windows. I'll test at runtime and issue a
3406 disabling of colors for Windows. I'll test at runtime and issue a
3401 warning if Gary's readline isn't found, as to nudge users to
3407 warning if Gary's readline isn't found, as to nudge users to
3402 download it.
3408 download it.
3403
3409
3404 2004-06-16 Fernando Perez <fperez@colorado.edu>
3410 2004-06-16 Fernando Perez <fperez@colorado.edu>
3405
3411
3406 * IPython/genutils.py (Stream.__init__): changed to print errors
3412 * IPython/genutils.py (Stream.__init__): changed to print errors
3407 to sys.stderr. I had a circular dependency here. Now it's
3413 to sys.stderr. I had a circular dependency here. Now it's
3408 possible to run ipython as IDLE's shell (consider this pre-alpha,
3414 possible to run ipython as IDLE's shell (consider this pre-alpha,
3409 since true stdout things end up in the starting terminal instead
3415 since true stdout things end up in the starting terminal instead
3410 of IDLE's out).
3416 of IDLE's out).
3411
3417
3412 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3418 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3413 users who haven't # updated their prompt_in2 definitions. Remove
3419 users who haven't # updated their prompt_in2 definitions. Remove
3414 eventually.
3420 eventually.
3415 (multiple_replace): added credit to original ASPN recipe.
3421 (multiple_replace): added credit to original ASPN recipe.
3416
3422
3417 2004-06-15 Fernando Perez <fperez@colorado.edu>
3423 2004-06-15 Fernando Perez <fperez@colorado.edu>
3418
3424
3419 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3425 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3420 list of auto-defined aliases.
3426 list of auto-defined aliases.
3421
3427
3422 2004-06-13 Fernando Perez <fperez@colorado.edu>
3428 2004-06-13 Fernando Perez <fperez@colorado.edu>
3423
3429
3424 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3430 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3425 install was really requested (so setup.py can be used for other
3431 install was really requested (so setup.py can be used for other
3426 things under Windows).
3432 things under Windows).
3427
3433
3428 2004-06-10 Fernando Perez <fperez@colorado.edu>
3434 2004-06-10 Fernando Perez <fperez@colorado.edu>
3429
3435
3430 * IPython/Logger.py (Logger.create_log): Manually remove any old
3436 * IPython/Logger.py (Logger.create_log): Manually remove any old
3431 backup, since os.remove may fail under Windows. Fixes bug
3437 backup, since os.remove may fail under Windows. Fixes bug
3432 reported by Thorsten.
3438 reported by Thorsten.
3433
3439
3434 2004-06-09 Fernando Perez <fperez@colorado.edu>
3440 2004-06-09 Fernando Perez <fperez@colorado.edu>
3435
3441
3436 * examples/example-embed.py: fixed all references to %n (replaced
3442 * examples/example-embed.py: fixed all references to %n (replaced
3437 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3443 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3438 for all examples and the manual as well.
3444 for all examples and the manual as well.
3439
3445
3440 2004-06-08 Fernando Perez <fperez@colorado.edu>
3446 2004-06-08 Fernando Perez <fperez@colorado.edu>
3441
3447
3442 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3448 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3443 alignment and color management. All 3 prompt subsystems now
3449 alignment and color management. All 3 prompt subsystems now
3444 inherit from BasePrompt.
3450 inherit from BasePrompt.
3445
3451
3446 * tools/release: updates for windows installer build and tag rpms
3452 * tools/release: updates for windows installer build and tag rpms
3447 with python version (since paths are fixed).
3453 with python version (since paths are fixed).
3448
3454
3449 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3455 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3450 which will become eventually obsolete. Also fixed the default
3456 which will become eventually obsolete. Also fixed the default
3451 prompt_in2 to use \D, so at least new users start with the correct
3457 prompt_in2 to use \D, so at least new users start with the correct
3452 defaults.
3458 defaults.
3453 WARNING: Users with existing ipythonrc files will need to apply
3459 WARNING: Users with existing ipythonrc files will need to apply
3454 this fix manually!
3460 this fix manually!
3455
3461
3456 * setup.py: make windows installer (.exe). This is finally the
3462 * setup.py: make windows installer (.exe). This is finally the
3457 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3463 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3458 which I hadn't included because it required Python 2.3 (or recent
3464 which I hadn't included because it required Python 2.3 (or recent
3459 distutils).
3465 distutils).
3460
3466
3461 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3467 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3462 usage of new '\D' escape.
3468 usage of new '\D' escape.
3463
3469
3464 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3470 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3465 lacks os.getuid())
3471 lacks os.getuid())
3466 (CachedOutput.set_colors): Added the ability to turn coloring
3472 (CachedOutput.set_colors): Added the ability to turn coloring
3467 on/off with @colors even for manually defined prompt colors. It
3473 on/off with @colors even for manually defined prompt colors. It
3468 uses a nasty global, but it works safely and via the generic color
3474 uses a nasty global, but it works safely and via the generic color
3469 handling mechanism.
3475 handling mechanism.
3470 (Prompt2.__init__): Introduced new escape '\D' for continuation
3476 (Prompt2.__init__): Introduced new escape '\D' for continuation
3471 prompts. It represents the counter ('\#') as dots.
3477 prompts. It represents the counter ('\#') as dots.
3472 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3478 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3473 need to update their ipythonrc files and replace '%n' with '\D' in
3479 need to update their ipythonrc files and replace '%n' with '\D' in
3474 their prompt_in2 settings everywhere. Sorry, but there's
3480 their prompt_in2 settings everywhere. Sorry, but there's
3475 otherwise no clean way to get all prompts to properly align. The
3481 otherwise no clean way to get all prompts to properly align. The
3476 ipythonrc shipped with IPython has been updated.
3482 ipythonrc shipped with IPython has been updated.
3477
3483
3478 2004-06-07 Fernando Perez <fperez@colorado.edu>
3484 2004-06-07 Fernando Perez <fperez@colorado.edu>
3479
3485
3480 * setup.py (isfile): Pass local_icons option to latex2html, so the
3486 * setup.py (isfile): Pass local_icons option to latex2html, so the
3481 resulting HTML file is self-contained. Thanks to
3487 resulting HTML file is self-contained. Thanks to
3482 dryice-AT-liu.com.cn for the tip.
3488 dryice-AT-liu.com.cn for the tip.
3483
3489
3484 * pysh.py: I created a new profile 'shell', which implements a
3490 * pysh.py: I created a new profile 'shell', which implements a
3485 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3491 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3486 system shell, nor will it become one anytime soon. It's mainly
3492 system shell, nor will it become one anytime soon. It's mainly
3487 meant to illustrate the use of the new flexible bash-like prompts.
3493 meant to illustrate the use of the new flexible bash-like prompts.
3488 I guess it could be used by hardy souls for true shell management,
3494 I guess it could be used by hardy souls for true shell management,
3489 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3495 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3490 profile. This uses the InterpreterExec extension provided by
3496 profile. This uses the InterpreterExec extension provided by
3491 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3497 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3492
3498
3493 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3499 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3494 auto-align itself with the length of the previous input prompt
3500 auto-align itself with the length of the previous input prompt
3495 (taking into account the invisible color escapes).
3501 (taking into account the invisible color escapes).
3496 (CachedOutput.__init__): Large restructuring of this class. Now
3502 (CachedOutput.__init__): Large restructuring of this class. Now
3497 all three prompts (primary1, primary2, output) are proper objects,
3503 all three prompts (primary1, primary2, output) are proper objects,
3498 managed by the 'parent' CachedOutput class. The code is still a
3504 managed by the 'parent' CachedOutput class. The code is still a
3499 bit hackish (all prompts share state via a pointer to the cache),
3505 bit hackish (all prompts share state via a pointer to the cache),
3500 but it's overall far cleaner than before.
3506 but it's overall far cleaner than before.
3501
3507
3502 * IPython/genutils.py (getoutputerror): modified to add verbose,
3508 * IPython/genutils.py (getoutputerror): modified to add verbose,
3503 debug and header options. This makes the interface of all getout*
3509 debug and header options. This makes the interface of all getout*
3504 functions uniform.
3510 functions uniform.
3505 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3511 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3506
3512
3507 * IPython/Magic.py (Magic.default_option): added a function to
3513 * IPython/Magic.py (Magic.default_option): added a function to
3508 allow registering default options for any magic command. This
3514 allow registering default options for any magic command. This
3509 makes it easy to have profiles which customize the magics globally
3515 makes it easy to have profiles which customize the magics globally
3510 for a certain use. The values set through this function are
3516 for a certain use. The values set through this function are
3511 picked up by the parse_options() method, which all magics should
3517 picked up by the parse_options() method, which all magics should
3512 use to parse their options.
3518 use to parse their options.
3513
3519
3514 * IPython/genutils.py (warn): modified the warnings framework to
3520 * IPython/genutils.py (warn): modified the warnings framework to
3515 use the Term I/O class. I'm trying to slowly unify all of
3521 use the Term I/O class. I'm trying to slowly unify all of
3516 IPython's I/O operations to pass through Term.
3522 IPython's I/O operations to pass through Term.
3517
3523
3518 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3524 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3519 the secondary prompt to correctly match the length of the primary
3525 the secondary prompt to correctly match the length of the primary
3520 one for any prompt. Now multi-line code will properly line up
3526 one for any prompt. Now multi-line code will properly line up
3521 even for path dependent prompts, such as the new ones available
3527 even for path dependent prompts, such as the new ones available
3522 via the prompt_specials.
3528 via the prompt_specials.
3523
3529
3524 2004-06-06 Fernando Perez <fperez@colorado.edu>
3530 2004-06-06 Fernando Perez <fperez@colorado.edu>
3525
3531
3526 * IPython/Prompts.py (prompt_specials): Added the ability to have
3532 * IPython/Prompts.py (prompt_specials): Added the ability to have
3527 bash-like special sequences in the prompts, which get
3533 bash-like special sequences in the prompts, which get
3528 automatically expanded. Things like hostname, current working
3534 automatically expanded. Things like hostname, current working
3529 directory and username are implemented already, but it's easy to
3535 directory and username are implemented already, but it's easy to
3530 add more in the future. Thanks to a patch by W.J. van der Laan
3536 add more in the future. Thanks to a patch by W.J. van der Laan
3531 <gnufnork-AT-hetdigitalegat.nl>
3537 <gnufnork-AT-hetdigitalegat.nl>
3532 (prompt_specials): Added color support for prompt strings, so
3538 (prompt_specials): Added color support for prompt strings, so
3533 users can define arbitrary color setups for their prompts.
3539 users can define arbitrary color setups for their prompts.
3534
3540
3535 2004-06-05 Fernando Perez <fperez@colorado.edu>
3541 2004-06-05 Fernando Perez <fperez@colorado.edu>
3536
3542
3537 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3543 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3538 code to load Gary Bishop's readline and configure it
3544 code to load Gary Bishop's readline and configure it
3539 automatically. Thanks to Gary for help on this.
3545 automatically. Thanks to Gary for help on this.
3540
3546
3541 2004-06-01 Fernando Perez <fperez@colorado.edu>
3547 2004-06-01 Fernando Perez <fperez@colorado.edu>
3542
3548
3543 * IPython/Logger.py (Logger.create_log): fix bug for logging
3549 * IPython/Logger.py (Logger.create_log): fix bug for logging
3544 with no filename (previous fix was incomplete).
3550 with no filename (previous fix was incomplete).
3545
3551
3546 2004-05-25 Fernando Perez <fperez@colorado.edu>
3552 2004-05-25 Fernando Perez <fperez@colorado.edu>
3547
3553
3548 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3554 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3549 parens would get passed to the shell.
3555 parens would get passed to the shell.
3550
3556
3551 2004-05-20 Fernando Perez <fperez@colorado.edu>
3557 2004-05-20 Fernando Perez <fperez@colorado.edu>
3552
3558
3553 * IPython/Magic.py (Magic.magic_prun): changed default profile
3559 * IPython/Magic.py (Magic.magic_prun): changed default profile
3554 sort order to 'time' (the more common profiling need).
3560 sort order to 'time' (the more common profiling need).
3555
3561
3556 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3562 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3557 so that source code shown is guaranteed in sync with the file on
3563 so that source code shown is guaranteed in sync with the file on
3558 disk (also changed in psource). Similar fix to the one for
3564 disk (also changed in psource). Similar fix to the one for
3559 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3565 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3560 <yann.ledu-AT-noos.fr>.
3566 <yann.ledu-AT-noos.fr>.
3561
3567
3562 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3568 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3563 with a single option would not be correctly parsed. Closes
3569 with a single option would not be correctly parsed. Closes
3564 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3570 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3565 introduced in 0.6.0 (on 2004-05-06).
3571 introduced in 0.6.0 (on 2004-05-06).
3566
3572
3567 2004-05-13 *** Released version 0.6.0
3573 2004-05-13 *** Released version 0.6.0
3568
3574
3569 2004-05-13 Fernando Perez <fperez@colorado.edu>
3575 2004-05-13 Fernando Perez <fperez@colorado.edu>
3570
3576
3571 * debian/: Added debian/ directory to CVS, so that debian support
3577 * debian/: Added debian/ directory to CVS, so that debian support
3572 is publicly accessible. The debian package is maintained by Jack
3578 is publicly accessible. The debian package is maintained by Jack
3573 Moffit <jack-AT-xiph.org>.
3579 Moffit <jack-AT-xiph.org>.
3574
3580
3575 * Documentation: included the notes about an ipython-based system
3581 * Documentation: included the notes about an ipython-based system
3576 shell (the hypothetical 'pysh') into the new_design.pdf document,
3582 shell (the hypothetical 'pysh') into the new_design.pdf document,
3577 so that these ideas get distributed to users along with the
3583 so that these ideas get distributed to users along with the
3578 official documentation.
3584 official documentation.
3579
3585
3580 2004-05-10 Fernando Perez <fperez@colorado.edu>
3586 2004-05-10 Fernando Perez <fperez@colorado.edu>
3581
3587
3582 * IPython/Logger.py (Logger.create_log): fix recently introduced
3588 * IPython/Logger.py (Logger.create_log): fix recently introduced
3583 bug (misindented line) where logstart would fail when not given an
3589 bug (misindented line) where logstart would fail when not given an
3584 explicit filename.
3590 explicit filename.
3585
3591
3586 2004-05-09 Fernando Perez <fperez@colorado.edu>
3592 2004-05-09 Fernando Perez <fperez@colorado.edu>
3587
3593
3588 * IPython/Magic.py (Magic.parse_options): skip system call when
3594 * IPython/Magic.py (Magic.parse_options): skip system call when
3589 there are no options to look for. Faster, cleaner for the common
3595 there are no options to look for. Faster, cleaner for the common
3590 case.
3596 case.
3591
3597
3592 * Documentation: many updates to the manual: describing Windows
3598 * Documentation: many updates to the manual: describing Windows
3593 support better, Gnuplot updates, credits, misc small stuff. Also
3599 support better, Gnuplot updates, credits, misc small stuff. Also
3594 updated the new_design doc a bit.
3600 updated the new_design doc a bit.
3595
3601
3596 2004-05-06 *** Released version 0.6.0.rc1
3602 2004-05-06 *** Released version 0.6.0.rc1
3597
3603
3598 2004-05-06 Fernando Perez <fperez@colorado.edu>
3604 2004-05-06 Fernando Perez <fperez@colorado.edu>
3599
3605
3600 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3606 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3601 operations to use the vastly more efficient list/''.join() method.
3607 operations to use the vastly more efficient list/''.join() method.
3602 (FormattedTB.text): Fix
3608 (FormattedTB.text): Fix
3603 http://www.scipy.net/roundup/ipython/issue12 - exception source
3609 http://www.scipy.net/roundup/ipython/issue12 - exception source
3604 extract not updated after reload. Thanks to Mike Salib
3610 extract not updated after reload. Thanks to Mike Salib
3605 <msalib-AT-mit.edu> for pinning the source of the problem.
3611 <msalib-AT-mit.edu> for pinning the source of the problem.
3606 Fortunately, the solution works inside ipython and doesn't require
3612 Fortunately, the solution works inside ipython and doesn't require
3607 any changes to python proper.
3613 any changes to python proper.
3608
3614
3609 * IPython/Magic.py (Magic.parse_options): Improved to process the
3615 * IPython/Magic.py (Magic.parse_options): Improved to process the
3610 argument list as a true shell would (by actually using the
3616 argument list as a true shell would (by actually using the
3611 underlying system shell). This way, all @magics automatically get
3617 underlying system shell). This way, all @magics automatically get
3612 shell expansion for variables. Thanks to a comment by Alex
3618 shell expansion for variables. Thanks to a comment by Alex
3613 Schmolck.
3619 Schmolck.
3614
3620
3615 2004-04-04 Fernando Perez <fperez@colorado.edu>
3621 2004-04-04 Fernando Perez <fperez@colorado.edu>
3616
3622
3617 * IPython/iplib.py (InteractiveShell.interact): Added a special
3623 * IPython/iplib.py (InteractiveShell.interact): Added a special
3618 trap for a debugger quit exception, which is basically impossible
3624 trap for a debugger quit exception, which is basically impossible
3619 to handle by normal mechanisms, given what pdb does to the stack.
3625 to handle by normal mechanisms, given what pdb does to the stack.
3620 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3626 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3621
3627
3622 2004-04-03 Fernando Perez <fperez@colorado.edu>
3628 2004-04-03 Fernando Perez <fperez@colorado.edu>
3623
3629
3624 * IPython/genutils.py (Term): Standardized the names of the Term
3630 * IPython/genutils.py (Term): Standardized the names of the Term
3625 class streams to cin/cout/cerr, following C++ naming conventions
3631 class streams to cin/cout/cerr, following C++ naming conventions
3626 (I can't use in/out/err because 'in' is not a valid attribute
3632 (I can't use in/out/err because 'in' is not a valid attribute
3627 name).
3633 name).
3628
3634
3629 * IPython/iplib.py (InteractiveShell.interact): don't increment
3635 * IPython/iplib.py (InteractiveShell.interact): don't increment
3630 the prompt if there's no user input. By Daniel 'Dang' Griffith
3636 the prompt if there's no user input. By Daniel 'Dang' Griffith
3631 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3637 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3632 Francois Pinard.
3638 Francois Pinard.
3633
3639
3634 2004-04-02 Fernando Perez <fperez@colorado.edu>
3640 2004-04-02 Fernando Perez <fperez@colorado.edu>
3635
3641
3636 * IPython/genutils.py (Stream.__init__): Modified to survive at
3642 * IPython/genutils.py (Stream.__init__): Modified to survive at
3637 least importing in contexts where stdin/out/err aren't true file
3643 least importing in contexts where stdin/out/err aren't true file
3638 objects, such as PyCrust (they lack fileno() and mode). However,
3644 objects, such as PyCrust (they lack fileno() and mode). However,
3639 the recovery facilities which rely on these things existing will
3645 the recovery facilities which rely on these things existing will
3640 not work.
3646 not work.
3641
3647
3642 2004-04-01 Fernando Perez <fperez@colorado.edu>
3648 2004-04-01 Fernando Perez <fperez@colorado.edu>
3643
3649
3644 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3650 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3645 use the new getoutputerror() function, so it properly
3651 use the new getoutputerror() function, so it properly
3646 distinguishes stdout/err.
3652 distinguishes stdout/err.
3647
3653
3648 * IPython/genutils.py (getoutputerror): added a function to
3654 * IPython/genutils.py (getoutputerror): added a function to
3649 capture separately the standard output and error of a command.
3655 capture separately the standard output and error of a command.
3650 After a comment from dang on the mailing lists. This code is
3656 After a comment from dang on the mailing lists. This code is
3651 basically a modified version of commands.getstatusoutput(), from
3657 basically a modified version of commands.getstatusoutput(), from
3652 the standard library.
3658 the standard library.
3653
3659
3654 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3660 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3655 '!!' as a special syntax (shorthand) to access @sx.
3661 '!!' as a special syntax (shorthand) to access @sx.
3656
3662
3657 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3663 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3658 command and return its output as a list split on '\n'.
3664 command and return its output as a list split on '\n'.
3659
3665
3660 2004-03-31 Fernando Perez <fperez@colorado.edu>
3666 2004-03-31 Fernando Perez <fperez@colorado.edu>
3661
3667
3662 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3668 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3663 method to dictionaries used as FakeModule instances if they lack
3669 method to dictionaries used as FakeModule instances if they lack
3664 it. At least pydoc in python2.3 breaks for runtime-defined
3670 it. At least pydoc in python2.3 breaks for runtime-defined
3665 functions without this hack. At some point I need to _really_
3671 functions without this hack. At some point I need to _really_
3666 understand what FakeModule is doing, because it's a gross hack.
3672 understand what FakeModule is doing, because it's a gross hack.
3667 But it solves Arnd's problem for now...
3673 But it solves Arnd's problem for now...
3668
3674
3669 2004-02-27 Fernando Perez <fperez@colorado.edu>
3675 2004-02-27 Fernando Perez <fperez@colorado.edu>
3670
3676
3671 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3677 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3672 mode would behave erratically. Also increased the number of
3678 mode would behave erratically. Also increased the number of
3673 possible logs in rotate mod to 999. Thanks to Rod Holland
3679 possible logs in rotate mod to 999. Thanks to Rod Holland
3674 <rhh@StructureLABS.com> for the report and fixes.
3680 <rhh@StructureLABS.com> for the report and fixes.
3675
3681
3676 2004-02-26 Fernando Perez <fperez@colorado.edu>
3682 2004-02-26 Fernando Perez <fperez@colorado.edu>
3677
3683
3678 * IPython/genutils.py (page): Check that the curses module really
3684 * IPython/genutils.py (page): Check that the curses module really
3679 has the initscr attribute before trying to use it. For some
3685 has the initscr attribute before trying to use it. For some
3680 reason, the Solaris curses module is missing this. I think this
3686 reason, the Solaris curses module is missing this. I think this
3681 should be considered a Solaris python bug, but I'm not sure.
3687 should be considered a Solaris python bug, but I'm not sure.
3682
3688
3683 2004-01-17 Fernando Perez <fperez@colorado.edu>
3689 2004-01-17 Fernando Perez <fperez@colorado.edu>
3684
3690
3685 * IPython/genutils.py (Stream.__init__): Changes to try to make
3691 * IPython/genutils.py (Stream.__init__): Changes to try to make
3686 ipython robust against stdin/out/err being closed by the user.
3692 ipython robust against stdin/out/err being closed by the user.
3687 This is 'user error' (and blocks a normal python session, at least
3693 This is 'user error' (and blocks a normal python session, at least
3688 the stdout case). However, Ipython should be able to survive such
3694 the stdout case). However, Ipython should be able to survive such
3689 instances of abuse as gracefully as possible. To simplify the
3695 instances of abuse as gracefully as possible. To simplify the
3690 coding and maintain compatibility with Gary Bishop's Term
3696 coding and maintain compatibility with Gary Bishop's Term
3691 contributions, I've made use of classmethods for this. I think
3697 contributions, I've made use of classmethods for this. I think
3692 this introduces a dependency on python 2.2.
3698 this introduces a dependency on python 2.2.
3693
3699
3694 2004-01-13 Fernando Perez <fperez@colorado.edu>
3700 2004-01-13 Fernando Perez <fperez@colorado.edu>
3695
3701
3696 * IPython/numutils.py (exp_safe): simplified the code a bit and
3702 * IPython/numutils.py (exp_safe): simplified the code a bit and
3697 removed the need for importing the kinds module altogether.
3703 removed the need for importing the kinds module altogether.
3698
3704
3699 2004-01-06 Fernando Perez <fperez@colorado.edu>
3705 2004-01-06 Fernando Perez <fperez@colorado.edu>
3700
3706
3701 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3707 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3702 a magic function instead, after some community feedback. No
3708 a magic function instead, after some community feedback. No
3703 special syntax will exist for it, but its name is deliberately
3709 special syntax will exist for it, but its name is deliberately
3704 very short.
3710 very short.
3705
3711
3706 2003-12-20 Fernando Perez <fperez@colorado.edu>
3712 2003-12-20 Fernando Perez <fperez@colorado.edu>
3707
3713
3708 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3714 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3709 new functionality, to automagically assign the result of a shell
3715 new functionality, to automagically assign the result of a shell
3710 command to a variable. I'll solicit some community feedback on
3716 command to a variable. I'll solicit some community feedback on
3711 this before making it permanent.
3717 this before making it permanent.
3712
3718
3713 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3719 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3714 requested about callables for which inspect couldn't obtain a
3720 requested about callables for which inspect couldn't obtain a
3715 proper argspec. Thanks to a crash report sent by Etienne
3721 proper argspec. Thanks to a crash report sent by Etienne
3716 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3722 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3717
3723
3718 2003-12-09 Fernando Perez <fperez@colorado.edu>
3724 2003-12-09 Fernando Perez <fperez@colorado.edu>
3719
3725
3720 * IPython/genutils.py (page): patch for the pager to work across
3726 * IPython/genutils.py (page): patch for the pager to work across
3721 various versions of Windows. By Gary Bishop.
3727 various versions of Windows. By Gary Bishop.
3722
3728
3723 2003-12-04 Fernando Perez <fperez@colorado.edu>
3729 2003-12-04 Fernando Perez <fperez@colorado.edu>
3724
3730
3725 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3731 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3726 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3732 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3727 While I tested this and it looks ok, there may still be corner
3733 While I tested this and it looks ok, there may still be corner
3728 cases I've missed.
3734 cases I've missed.
3729
3735
3730 2003-12-01 Fernando Perez <fperez@colorado.edu>
3736 2003-12-01 Fernando Perez <fperez@colorado.edu>
3731
3737
3732 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3738 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3733 where a line like 'p,q=1,2' would fail because the automagic
3739 where a line like 'p,q=1,2' would fail because the automagic
3734 system would be triggered for @p.
3740 system would be triggered for @p.
3735
3741
3736 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3742 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3737 cleanups, code unmodified.
3743 cleanups, code unmodified.
3738
3744
3739 * IPython/genutils.py (Term): added a class for IPython to handle
3745 * IPython/genutils.py (Term): added a class for IPython to handle
3740 output. In most cases it will just be a proxy for stdout/err, but
3746 output. In most cases it will just be a proxy for stdout/err, but
3741 having this allows modifications to be made for some platforms,
3747 having this allows modifications to be made for some platforms,
3742 such as handling color escapes under Windows. All of this code
3748 such as handling color escapes under Windows. All of this code
3743 was contributed by Gary Bishop, with minor modifications by me.
3749 was contributed by Gary Bishop, with minor modifications by me.
3744 The actual changes affect many files.
3750 The actual changes affect many files.
3745
3751
3746 2003-11-30 Fernando Perez <fperez@colorado.edu>
3752 2003-11-30 Fernando Perez <fperez@colorado.edu>
3747
3753
3748 * IPython/iplib.py (file_matches): new completion code, courtesy
3754 * IPython/iplib.py (file_matches): new completion code, courtesy
3749 of Jeff Collins. This enables filename completion again under
3755 of Jeff Collins. This enables filename completion again under
3750 python 2.3, which disabled it at the C level.
3756 python 2.3, which disabled it at the C level.
3751
3757
3752 2003-11-11 Fernando Perez <fperez@colorado.edu>
3758 2003-11-11 Fernando Perez <fperez@colorado.edu>
3753
3759
3754 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3760 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3755 for Numeric.array(map(...)), but often convenient.
3761 for Numeric.array(map(...)), but often convenient.
3756
3762
3757 2003-11-05 Fernando Perez <fperez@colorado.edu>
3763 2003-11-05 Fernando Perez <fperez@colorado.edu>
3758
3764
3759 * IPython/numutils.py (frange): Changed a call from int() to
3765 * IPython/numutils.py (frange): Changed a call from int() to
3760 int(round()) to prevent a problem reported with arange() in the
3766 int(round()) to prevent a problem reported with arange() in the
3761 numpy list.
3767 numpy list.
3762
3768
3763 2003-10-06 Fernando Perez <fperez@colorado.edu>
3769 2003-10-06 Fernando Perez <fperez@colorado.edu>
3764
3770
3765 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3771 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3766 prevent crashes if sys lacks an argv attribute (it happens with
3772 prevent crashes if sys lacks an argv attribute (it happens with
3767 embedded interpreters which build a bare-bones sys module).
3773 embedded interpreters which build a bare-bones sys module).
3768 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3774 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3769
3775
3770 2003-09-24 Fernando Perez <fperez@colorado.edu>
3776 2003-09-24 Fernando Perez <fperez@colorado.edu>
3771
3777
3772 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3778 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3773 to protect against poorly written user objects where __getattr__
3779 to protect against poorly written user objects where __getattr__
3774 raises exceptions other than AttributeError. Thanks to a bug
3780 raises exceptions other than AttributeError. Thanks to a bug
3775 report by Oliver Sander <osander-AT-gmx.de>.
3781 report by Oliver Sander <osander-AT-gmx.de>.
3776
3782
3777 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3783 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3778 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3784 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3779
3785
3780 2003-09-09 Fernando Perez <fperez@colorado.edu>
3786 2003-09-09 Fernando Perez <fperez@colorado.edu>
3781
3787
3782 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3788 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3783 unpacking a list whith a callable as first element would
3789 unpacking a list whith a callable as first element would
3784 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3790 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3785 Collins.
3791 Collins.
3786
3792
3787 2003-08-25 *** Released version 0.5.0
3793 2003-08-25 *** Released version 0.5.0
3788
3794
3789 2003-08-22 Fernando Perez <fperez@colorado.edu>
3795 2003-08-22 Fernando Perez <fperez@colorado.edu>
3790
3796
3791 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3797 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3792 improperly defined user exceptions. Thanks to feedback from Mark
3798 improperly defined user exceptions. Thanks to feedback from Mark
3793 Russell <mrussell-AT-verio.net>.
3799 Russell <mrussell-AT-verio.net>.
3794
3800
3795 2003-08-20 Fernando Perez <fperez@colorado.edu>
3801 2003-08-20 Fernando Perez <fperez@colorado.edu>
3796
3802
3797 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3803 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3798 printing so that it would print multi-line string forms starting
3804 printing so that it would print multi-line string forms starting
3799 with a new line. This way the formatting is better respected for
3805 with a new line. This way the formatting is better respected for
3800 objects which work hard to make nice string forms.
3806 objects which work hard to make nice string forms.
3801
3807
3802 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3808 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3803 autocall would overtake data access for objects with both
3809 autocall would overtake data access for objects with both
3804 __getitem__ and __call__.
3810 __getitem__ and __call__.
3805
3811
3806 2003-08-19 *** Released version 0.5.0-rc1
3812 2003-08-19 *** Released version 0.5.0-rc1
3807
3813
3808 2003-08-19 Fernando Perez <fperez@colorado.edu>
3814 2003-08-19 Fernando Perez <fperez@colorado.edu>
3809
3815
3810 * IPython/deep_reload.py (load_tail): single tiny change here
3816 * IPython/deep_reload.py (load_tail): single tiny change here
3811 seems to fix the long-standing bug of dreload() failing to work
3817 seems to fix the long-standing bug of dreload() failing to work
3812 for dotted names. But this module is pretty tricky, so I may have
3818 for dotted names. But this module is pretty tricky, so I may have
3813 missed some subtlety. Needs more testing!.
3819 missed some subtlety. Needs more testing!.
3814
3820
3815 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3821 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3816 exceptions which have badly implemented __str__ methods.
3822 exceptions which have badly implemented __str__ methods.
3817 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3823 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3818 which I've been getting reports about from Python 2.3 users. I
3824 which I've been getting reports about from Python 2.3 users. I
3819 wish I had a simple test case to reproduce the problem, so I could
3825 wish I had a simple test case to reproduce the problem, so I could
3820 either write a cleaner workaround or file a bug report if
3826 either write a cleaner workaround or file a bug report if
3821 necessary.
3827 necessary.
3822
3828
3823 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3829 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3824 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3830 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3825 a bug report by Tjabo Kloppenburg.
3831 a bug report by Tjabo Kloppenburg.
3826
3832
3827 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3833 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3828 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3834 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3829 seems rather unstable. Thanks to a bug report by Tjabo
3835 seems rather unstable. Thanks to a bug report by Tjabo
3830 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3836 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3831
3837
3832 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3838 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3833 this out soon because of the critical fixes in the inner loop for
3839 this out soon because of the critical fixes in the inner loop for
3834 generators.
3840 generators.
3835
3841
3836 * IPython/Magic.py (Magic.getargspec): removed. This (and
3842 * IPython/Magic.py (Magic.getargspec): removed. This (and
3837 _get_def) have been obsoleted by OInspect for a long time, I
3843 _get_def) have been obsoleted by OInspect for a long time, I
3838 hadn't noticed that they were dead code.
3844 hadn't noticed that they were dead code.
3839 (Magic._ofind): restored _ofind functionality for a few literals
3845 (Magic._ofind): restored _ofind functionality for a few literals
3840 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3846 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3841 for things like "hello".capitalize?, since that would require a
3847 for things like "hello".capitalize?, since that would require a
3842 potentially dangerous eval() again.
3848 potentially dangerous eval() again.
3843
3849
3844 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3850 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3845 logic a bit more to clean up the escapes handling and minimize the
3851 logic a bit more to clean up the escapes handling and minimize the
3846 use of _ofind to only necessary cases. The interactive 'feel' of
3852 use of _ofind to only necessary cases. The interactive 'feel' of
3847 IPython should have improved quite a bit with the changes in
3853 IPython should have improved quite a bit with the changes in
3848 _prefilter and _ofind (besides being far safer than before).
3854 _prefilter and _ofind (besides being far safer than before).
3849
3855
3850 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3856 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3851 obscure, never reported). Edit would fail to find the object to
3857 obscure, never reported). Edit would fail to find the object to
3852 edit under some circumstances.
3858 edit under some circumstances.
3853 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3859 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3854 which were causing double-calling of generators. Those eval calls
3860 which were causing double-calling of generators. Those eval calls
3855 were _very_ dangerous, since code with side effects could be
3861 were _very_ dangerous, since code with side effects could be
3856 triggered. As they say, 'eval is evil'... These were the
3862 triggered. As they say, 'eval is evil'... These were the
3857 nastiest evals in IPython. Besides, _ofind is now far simpler,
3863 nastiest evals in IPython. Besides, _ofind is now far simpler,
3858 and it should also be quite a bit faster. Its use of inspect is
3864 and it should also be quite a bit faster. Its use of inspect is
3859 also safer, so perhaps some of the inspect-related crashes I've
3865 also safer, so perhaps some of the inspect-related crashes I've
3860 seen lately with Python 2.3 might be taken care of. That will
3866 seen lately with Python 2.3 might be taken care of. That will
3861 need more testing.
3867 need more testing.
3862
3868
3863 2003-08-17 Fernando Perez <fperez@colorado.edu>
3869 2003-08-17 Fernando Perez <fperez@colorado.edu>
3864
3870
3865 * IPython/iplib.py (InteractiveShell._prefilter): significant
3871 * IPython/iplib.py (InteractiveShell._prefilter): significant
3866 simplifications to the logic for handling user escapes. Faster
3872 simplifications to the logic for handling user escapes. Faster
3867 and simpler code.
3873 and simpler code.
3868
3874
3869 2003-08-14 Fernando Perez <fperez@colorado.edu>
3875 2003-08-14 Fernando Perez <fperez@colorado.edu>
3870
3876
3871 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3877 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3872 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3878 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3873 but it should be quite a bit faster. And the recursive version
3879 but it should be quite a bit faster. And the recursive version
3874 generated O(log N) intermediate storage for all rank>1 arrays,
3880 generated O(log N) intermediate storage for all rank>1 arrays,
3875 even if they were contiguous.
3881 even if they were contiguous.
3876 (l1norm): Added this function.
3882 (l1norm): Added this function.
3877 (norm): Added this function for arbitrary norms (including
3883 (norm): Added this function for arbitrary norms (including
3878 l-infinity). l1 and l2 are still special cases for convenience
3884 l-infinity). l1 and l2 are still special cases for convenience
3879 and speed.
3885 and speed.
3880
3886
3881 2003-08-03 Fernando Perez <fperez@colorado.edu>
3887 2003-08-03 Fernando Perez <fperez@colorado.edu>
3882
3888
3883 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3889 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3884 exceptions, which now raise PendingDeprecationWarnings in Python
3890 exceptions, which now raise PendingDeprecationWarnings in Python
3885 2.3. There were some in Magic and some in Gnuplot2.
3891 2.3. There were some in Magic and some in Gnuplot2.
3886
3892
3887 2003-06-30 Fernando Perez <fperez@colorado.edu>
3893 2003-06-30 Fernando Perez <fperez@colorado.edu>
3888
3894
3889 * IPython/genutils.py (page): modified to call curses only for
3895 * IPython/genutils.py (page): modified to call curses only for
3890 terminals where TERM=='xterm'. After problems under many other
3896 terminals where TERM=='xterm'. After problems under many other
3891 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3897 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3892
3898
3893 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3899 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3894 would be triggered when readline was absent. This was just an old
3900 would be triggered when readline was absent. This was just an old
3895 debugging statement I'd forgotten to take out.
3901 debugging statement I'd forgotten to take out.
3896
3902
3897 2003-06-20 Fernando Perez <fperez@colorado.edu>
3903 2003-06-20 Fernando Perez <fperez@colorado.edu>
3898
3904
3899 * IPython/genutils.py (clock): modified to return only user time
3905 * IPython/genutils.py (clock): modified to return only user time
3900 (not counting system time), after a discussion on scipy. While
3906 (not counting system time), after a discussion on scipy. While
3901 system time may be a useful quantity occasionally, it may much
3907 system time may be a useful quantity occasionally, it may much
3902 more easily be skewed by occasional swapping or other similar
3908 more easily be skewed by occasional swapping or other similar
3903 activity.
3909 activity.
3904
3910
3905 2003-06-05 Fernando Perez <fperez@colorado.edu>
3911 2003-06-05 Fernando Perez <fperez@colorado.edu>
3906
3912
3907 * IPython/numutils.py (identity): new function, for building
3913 * IPython/numutils.py (identity): new function, for building
3908 arbitrary rank Kronecker deltas (mostly backwards compatible with
3914 arbitrary rank Kronecker deltas (mostly backwards compatible with
3909 Numeric.identity)
3915 Numeric.identity)
3910
3916
3911 2003-06-03 Fernando Perez <fperez@colorado.edu>
3917 2003-06-03 Fernando Perez <fperez@colorado.edu>
3912
3918
3913 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3919 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3914 arguments passed to magics with spaces, to allow trailing '\' to
3920 arguments passed to magics with spaces, to allow trailing '\' to
3915 work normally (mainly for Windows users).
3921 work normally (mainly for Windows users).
3916
3922
3917 2003-05-29 Fernando Perez <fperez@colorado.edu>
3923 2003-05-29 Fernando Perez <fperez@colorado.edu>
3918
3924
3919 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3925 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3920 instead of pydoc.help. This fixes a bizarre behavior where
3926 instead of pydoc.help. This fixes a bizarre behavior where
3921 printing '%s' % locals() would trigger the help system. Now
3927 printing '%s' % locals() would trigger the help system. Now
3922 ipython behaves like normal python does.
3928 ipython behaves like normal python does.
3923
3929
3924 Note that if one does 'from pydoc import help', the bizarre
3930 Note that if one does 'from pydoc import help', the bizarre
3925 behavior returns, but this will also happen in normal python, so
3931 behavior returns, but this will also happen in normal python, so
3926 it's not an ipython bug anymore (it has to do with how pydoc.help
3932 it's not an ipython bug anymore (it has to do with how pydoc.help
3927 is implemented).
3933 is implemented).
3928
3934
3929 2003-05-22 Fernando Perez <fperez@colorado.edu>
3935 2003-05-22 Fernando Perez <fperez@colorado.edu>
3930
3936
3931 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3937 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3932 return [] instead of None when nothing matches, also match to end
3938 return [] instead of None when nothing matches, also match to end
3933 of line. Patch by Gary Bishop.
3939 of line. Patch by Gary Bishop.
3934
3940
3935 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3941 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3936 protection as before, for files passed on the command line. This
3942 protection as before, for files passed on the command line. This
3937 prevents the CrashHandler from kicking in if user files call into
3943 prevents the CrashHandler from kicking in if user files call into
3938 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3944 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3939 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3945 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3940
3946
3941 2003-05-20 *** Released version 0.4.0
3947 2003-05-20 *** Released version 0.4.0
3942
3948
3943 2003-05-20 Fernando Perez <fperez@colorado.edu>
3949 2003-05-20 Fernando Perez <fperez@colorado.edu>
3944
3950
3945 * setup.py: added support for manpages. It's a bit hackish b/c of
3951 * setup.py: added support for manpages. It's a bit hackish b/c of
3946 a bug in the way the bdist_rpm distutils target handles gzipped
3952 a bug in the way the bdist_rpm distutils target handles gzipped
3947 manpages, but it works. After a patch by Jack.
3953 manpages, but it works. After a patch by Jack.
3948
3954
3949 2003-05-19 Fernando Perez <fperez@colorado.edu>
3955 2003-05-19 Fernando Perez <fperez@colorado.edu>
3950
3956
3951 * IPython/numutils.py: added a mockup of the kinds module, since
3957 * IPython/numutils.py: added a mockup of the kinds module, since
3952 it was recently removed from Numeric. This way, numutils will
3958 it was recently removed from Numeric. This way, numutils will
3953 work for all users even if they are missing kinds.
3959 work for all users even if they are missing kinds.
3954
3960
3955 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3961 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3956 failure, which can occur with SWIG-wrapped extensions. After a
3962 failure, which can occur with SWIG-wrapped extensions. After a
3957 crash report from Prabhu.
3963 crash report from Prabhu.
3958
3964
3959 2003-05-16 Fernando Perez <fperez@colorado.edu>
3965 2003-05-16 Fernando Perez <fperez@colorado.edu>
3960
3966
3961 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3967 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3962 protect ipython from user code which may call directly
3968 protect ipython from user code which may call directly
3963 sys.excepthook (this looks like an ipython crash to the user, even
3969 sys.excepthook (this looks like an ipython crash to the user, even
3964 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3970 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3965 This is especially important to help users of WxWindows, but may
3971 This is especially important to help users of WxWindows, but may
3966 also be useful in other cases.
3972 also be useful in other cases.
3967
3973
3968 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3974 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3969 an optional tb_offset to be specified, and to preserve exception
3975 an optional tb_offset to be specified, and to preserve exception
3970 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3976 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3971
3977
3972 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3978 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3973
3979
3974 2003-05-15 Fernando Perez <fperez@colorado.edu>
3980 2003-05-15 Fernando Perez <fperez@colorado.edu>
3975
3981
3976 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3982 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3977 installing for a new user under Windows.
3983 installing for a new user under Windows.
3978
3984
3979 2003-05-12 Fernando Perez <fperez@colorado.edu>
3985 2003-05-12 Fernando Perez <fperez@colorado.edu>
3980
3986
3981 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3987 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3982 handler for Emacs comint-based lines. Currently it doesn't do
3988 handler for Emacs comint-based lines. Currently it doesn't do
3983 much (but importantly, it doesn't update the history cache). In
3989 much (but importantly, it doesn't update the history cache). In
3984 the future it may be expanded if Alex needs more functionality
3990 the future it may be expanded if Alex needs more functionality
3985 there.
3991 there.
3986
3992
3987 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3993 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3988 info to crash reports.
3994 info to crash reports.
3989
3995
3990 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3996 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3991 just like Python's -c. Also fixed crash with invalid -color
3997 just like Python's -c. Also fixed crash with invalid -color
3992 option value at startup. Thanks to Will French
3998 option value at startup. Thanks to Will French
3993 <wfrench-AT-bestweb.net> for the bug report.
3999 <wfrench-AT-bestweb.net> for the bug report.
3994
4000
3995 2003-05-09 Fernando Perez <fperez@colorado.edu>
4001 2003-05-09 Fernando Perez <fperez@colorado.edu>
3996
4002
3997 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4003 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3998 to EvalDict (it's a mapping, after all) and simplified its code
4004 to EvalDict (it's a mapping, after all) and simplified its code
3999 quite a bit, after a nice discussion on c.l.py where Gustavo
4005 quite a bit, after a nice discussion on c.l.py where Gustavo
4000 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4006 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4001
4007
4002 2003-04-30 Fernando Perez <fperez@colorado.edu>
4008 2003-04-30 Fernando Perez <fperez@colorado.edu>
4003
4009
4004 * IPython/genutils.py (timings_out): modified it to reduce its
4010 * IPython/genutils.py (timings_out): modified it to reduce its
4005 overhead in the common reps==1 case.
4011 overhead in the common reps==1 case.
4006
4012
4007 2003-04-29 Fernando Perez <fperez@colorado.edu>
4013 2003-04-29 Fernando Perez <fperez@colorado.edu>
4008
4014
4009 * IPython/genutils.py (timings_out): Modified to use the resource
4015 * IPython/genutils.py (timings_out): Modified to use the resource
4010 module, which avoids the wraparound problems of time.clock().
4016 module, which avoids the wraparound problems of time.clock().
4011
4017
4012 2003-04-17 *** Released version 0.2.15pre4
4018 2003-04-17 *** Released version 0.2.15pre4
4013
4019
4014 2003-04-17 Fernando Perez <fperez@colorado.edu>
4020 2003-04-17 Fernando Perez <fperez@colorado.edu>
4015
4021
4016 * setup.py (scriptfiles): Split windows-specific stuff over to a
4022 * setup.py (scriptfiles): Split windows-specific stuff over to a
4017 separate file, in an attempt to have a Windows GUI installer.
4023 separate file, in an attempt to have a Windows GUI installer.
4018 That didn't work, but part of the groundwork is done.
4024 That didn't work, but part of the groundwork is done.
4019
4025
4020 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4026 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4021 indent/unindent with 4 spaces. Particularly useful in combination
4027 indent/unindent with 4 spaces. Particularly useful in combination
4022 with the new auto-indent option.
4028 with the new auto-indent option.
4023
4029
4024 2003-04-16 Fernando Perez <fperez@colorado.edu>
4030 2003-04-16 Fernando Perez <fperez@colorado.edu>
4025
4031
4026 * IPython/Magic.py: various replacements of self.rc for
4032 * IPython/Magic.py: various replacements of self.rc for
4027 self.shell.rc. A lot more remains to be done to fully disentangle
4033 self.shell.rc. A lot more remains to be done to fully disentangle
4028 this class from the main Shell class.
4034 this class from the main Shell class.
4029
4035
4030 * IPython/GnuplotRuntime.py: added checks for mouse support so
4036 * IPython/GnuplotRuntime.py: added checks for mouse support so
4031 that we don't try to enable it if the current gnuplot doesn't
4037 that we don't try to enable it if the current gnuplot doesn't
4032 really support it. Also added checks so that we don't try to
4038 really support it. Also added checks so that we don't try to
4033 enable persist under Windows (where Gnuplot doesn't recognize the
4039 enable persist under Windows (where Gnuplot doesn't recognize the
4034 option).
4040 option).
4035
4041
4036 * IPython/iplib.py (InteractiveShell.interact): Added optional
4042 * IPython/iplib.py (InteractiveShell.interact): Added optional
4037 auto-indenting code, after a patch by King C. Shu
4043 auto-indenting code, after a patch by King C. Shu
4038 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4044 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4039 get along well with pasting indented code. If I ever figure out
4045 get along well with pasting indented code. If I ever figure out
4040 how to make that part go well, it will become on by default.
4046 how to make that part go well, it will become on by default.
4041
4047
4042 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4048 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4043 crash ipython if there was an unmatched '%' in the user's prompt
4049 crash ipython if there was an unmatched '%' in the user's prompt
4044 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4050 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4045
4051
4046 * IPython/iplib.py (InteractiveShell.interact): removed the
4052 * IPython/iplib.py (InteractiveShell.interact): removed the
4047 ability to ask the user whether he wants to crash or not at the
4053 ability to ask the user whether he wants to crash or not at the
4048 'last line' exception handler. Calling functions at that point
4054 'last line' exception handler. Calling functions at that point
4049 changes the stack, and the error reports would have incorrect
4055 changes the stack, and the error reports would have incorrect
4050 tracebacks.
4056 tracebacks.
4051
4057
4052 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4058 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4053 pass through a peger a pretty-printed form of any object. After a
4059 pass through a peger a pretty-printed form of any object. After a
4054 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4060 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4055
4061
4056 2003-04-14 Fernando Perez <fperez@colorado.edu>
4062 2003-04-14 Fernando Perez <fperez@colorado.edu>
4057
4063
4058 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4064 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4059 all files in ~ would be modified at first install (instead of
4065 all files in ~ would be modified at first install (instead of
4060 ~/.ipython). This could be potentially disastrous, as the
4066 ~/.ipython). This could be potentially disastrous, as the
4061 modification (make line-endings native) could damage binary files.
4067 modification (make line-endings native) could damage binary files.
4062
4068
4063 2003-04-10 Fernando Perez <fperez@colorado.edu>
4069 2003-04-10 Fernando Perez <fperez@colorado.edu>
4064
4070
4065 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4071 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4066 handle only lines which are invalid python. This now means that
4072 handle only lines which are invalid python. This now means that
4067 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4073 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4068 for the bug report.
4074 for the bug report.
4069
4075
4070 2003-04-01 Fernando Perez <fperez@colorado.edu>
4076 2003-04-01 Fernando Perez <fperez@colorado.edu>
4071
4077
4072 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4078 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4073 where failing to set sys.last_traceback would crash pdb.pm().
4079 where failing to set sys.last_traceback would crash pdb.pm().
4074 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4080 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4075 report.
4081 report.
4076
4082
4077 2003-03-25 Fernando Perez <fperez@colorado.edu>
4083 2003-03-25 Fernando Perez <fperez@colorado.edu>
4078
4084
4079 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4085 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4080 before printing it (it had a lot of spurious blank lines at the
4086 before printing it (it had a lot of spurious blank lines at the
4081 end).
4087 end).
4082
4088
4083 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4089 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4084 output would be sent 21 times! Obviously people don't use this
4090 output would be sent 21 times! Obviously people don't use this
4085 too often, or I would have heard about it.
4091 too often, or I would have heard about it.
4086
4092
4087 2003-03-24 Fernando Perez <fperez@colorado.edu>
4093 2003-03-24 Fernando Perez <fperez@colorado.edu>
4088
4094
4089 * setup.py (scriptfiles): renamed the data_files parameter from
4095 * setup.py (scriptfiles): renamed the data_files parameter from
4090 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4096 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4091 for the patch.
4097 for the patch.
4092
4098
4093 2003-03-20 Fernando Perez <fperez@colorado.edu>
4099 2003-03-20 Fernando Perez <fperez@colorado.edu>
4094
4100
4095 * IPython/genutils.py (error): added error() and fatal()
4101 * IPython/genutils.py (error): added error() and fatal()
4096 functions.
4102 functions.
4097
4103
4098 2003-03-18 *** Released version 0.2.15pre3
4104 2003-03-18 *** Released version 0.2.15pre3
4099
4105
4100 2003-03-18 Fernando Perez <fperez@colorado.edu>
4106 2003-03-18 Fernando Perez <fperez@colorado.edu>
4101
4107
4102 * setupext/install_data_ext.py
4108 * setupext/install_data_ext.py
4103 (install_data_ext.initialize_options): Class contributed by Jack
4109 (install_data_ext.initialize_options): Class contributed by Jack
4104 Moffit for fixing the old distutils hack. He is sending this to
4110 Moffit for fixing the old distutils hack. He is sending this to
4105 the distutils folks so in the future we may not need it as a
4111 the distutils folks so in the future we may not need it as a
4106 private fix.
4112 private fix.
4107
4113
4108 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4114 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4109 changes for Debian packaging. See his patch for full details.
4115 changes for Debian packaging. See his patch for full details.
4110 The old distutils hack of making the ipythonrc* files carry a
4116 The old distutils hack of making the ipythonrc* files carry a
4111 bogus .py extension is gone, at last. Examples were moved to a
4117 bogus .py extension is gone, at last. Examples were moved to a
4112 separate subdir under doc/, and the separate executable scripts
4118 separate subdir under doc/, and the separate executable scripts
4113 now live in their own directory. Overall a great cleanup. The
4119 now live in their own directory. Overall a great cleanup. The
4114 manual was updated to use the new files, and setup.py has been
4120 manual was updated to use the new files, and setup.py has been
4115 fixed for this setup.
4121 fixed for this setup.
4116
4122
4117 * IPython/PyColorize.py (Parser.usage): made non-executable and
4123 * IPython/PyColorize.py (Parser.usage): made non-executable and
4118 created a pycolor wrapper around it to be included as a script.
4124 created a pycolor wrapper around it to be included as a script.
4119
4125
4120 2003-03-12 *** Released version 0.2.15pre2
4126 2003-03-12 *** Released version 0.2.15pre2
4121
4127
4122 2003-03-12 Fernando Perez <fperez@colorado.edu>
4128 2003-03-12 Fernando Perez <fperez@colorado.edu>
4123
4129
4124 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4130 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4125 long-standing problem with garbage characters in some terminals.
4131 long-standing problem with garbage characters in some terminals.
4126 The issue was really that the \001 and \002 escapes must _only_ be
4132 The issue was really that the \001 and \002 escapes must _only_ be
4127 passed to input prompts (which call readline), but _never_ to
4133 passed to input prompts (which call readline), but _never_ to
4128 normal text to be printed on screen. I changed ColorANSI to have
4134 normal text to be printed on screen. I changed ColorANSI to have
4129 two classes: TermColors and InputTermColors, each with the
4135 two classes: TermColors and InputTermColors, each with the
4130 appropriate escapes for input prompts or normal text. The code in
4136 appropriate escapes for input prompts or normal text. The code in
4131 Prompts.py got slightly more complicated, but this very old and
4137 Prompts.py got slightly more complicated, but this very old and
4132 annoying bug is finally fixed.
4138 annoying bug is finally fixed.
4133
4139
4134 All the credit for nailing down the real origin of this problem
4140 All the credit for nailing down the real origin of this problem
4135 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4141 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4136 *Many* thanks to him for spending quite a bit of effort on this.
4142 *Many* thanks to him for spending quite a bit of effort on this.
4137
4143
4138 2003-03-05 *** Released version 0.2.15pre1
4144 2003-03-05 *** Released version 0.2.15pre1
4139
4145
4140 2003-03-03 Fernando Perez <fperez@colorado.edu>
4146 2003-03-03 Fernando Perez <fperez@colorado.edu>
4141
4147
4142 * IPython/FakeModule.py: Moved the former _FakeModule to a
4148 * IPython/FakeModule.py: Moved the former _FakeModule to a
4143 separate file, because it's also needed by Magic (to fix a similar
4149 separate file, because it's also needed by Magic (to fix a similar
4144 pickle-related issue in @run).
4150 pickle-related issue in @run).
4145
4151
4146 2003-03-02 Fernando Perez <fperez@colorado.edu>
4152 2003-03-02 Fernando Perez <fperez@colorado.edu>
4147
4153
4148 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4154 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4149 the autocall option at runtime.
4155 the autocall option at runtime.
4150 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4156 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4151 across Magic.py to start separating Magic from InteractiveShell.
4157 across Magic.py to start separating Magic from InteractiveShell.
4152 (Magic._ofind): Fixed to return proper namespace for dotted
4158 (Magic._ofind): Fixed to return proper namespace for dotted
4153 names. Before, a dotted name would always return 'not currently
4159 names. Before, a dotted name would always return 'not currently
4154 defined', because it would find the 'parent'. s.x would be found,
4160 defined', because it would find the 'parent'. s.x would be found,
4155 but since 'x' isn't defined by itself, it would get confused.
4161 but since 'x' isn't defined by itself, it would get confused.
4156 (Magic.magic_run): Fixed pickling problems reported by Ralf
4162 (Magic.magic_run): Fixed pickling problems reported by Ralf
4157 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4163 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4158 that I'd used when Mike Heeter reported similar issues at the
4164 that I'd used when Mike Heeter reported similar issues at the
4159 top-level, but now for @run. It boils down to injecting the
4165 top-level, but now for @run. It boils down to injecting the
4160 namespace where code is being executed with something that looks
4166 namespace where code is being executed with something that looks
4161 enough like a module to fool pickle.dump(). Since a pickle stores
4167 enough like a module to fool pickle.dump(). Since a pickle stores
4162 a named reference to the importing module, we need this for
4168 a named reference to the importing module, we need this for
4163 pickles to save something sensible.
4169 pickles to save something sensible.
4164
4170
4165 * IPython/ipmaker.py (make_IPython): added an autocall option.
4171 * IPython/ipmaker.py (make_IPython): added an autocall option.
4166
4172
4167 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4173 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4168 the auto-eval code. Now autocalling is an option, and the code is
4174 the auto-eval code. Now autocalling is an option, and the code is
4169 also vastly safer. There is no more eval() involved at all.
4175 also vastly safer. There is no more eval() involved at all.
4170
4176
4171 2003-03-01 Fernando Perez <fperez@colorado.edu>
4177 2003-03-01 Fernando Perez <fperez@colorado.edu>
4172
4178
4173 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4179 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4174 dict with named keys instead of a tuple.
4180 dict with named keys instead of a tuple.
4175
4181
4176 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4182 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4177
4183
4178 * setup.py (make_shortcut): Fixed message about directories
4184 * setup.py (make_shortcut): Fixed message about directories
4179 created during Windows installation (the directories were ok, just
4185 created during Windows installation (the directories were ok, just
4180 the printed message was misleading). Thanks to Chris Liechti
4186 the printed message was misleading). Thanks to Chris Liechti
4181 <cliechti-AT-gmx.net> for the heads up.
4187 <cliechti-AT-gmx.net> for the heads up.
4182
4188
4183 2003-02-21 Fernando Perez <fperez@colorado.edu>
4189 2003-02-21 Fernando Perez <fperez@colorado.edu>
4184
4190
4185 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4191 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4186 of ValueError exception when checking for auto-execution. This
4192 of ValueError exception when checking for auto-execution. This
4187 one is raised by things like Numeric arrays arr.flat when the
4193 one is raised by things like Numeric arrays arr.flat when the
4188 array is non-contiguous.
4194 array is non-contiguous.
4189
4195
4190 2003-01-31 Fernando Perez <fperez@colorado.edu>
4196 2003-01-31 Fernando Perez <fperez@colorado.edu>
4191
4197
4192 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4198 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4193 not return any value at all (even though the command would get
4199 not return any value at all (even though the command would get
4194 executed).
4200 executed).
4195 (xsys): Flush stdout right after printing the command to ensure
4201 (xsys): Flush stdout right after printing the command to ensure
4196 proper ordering of commands and command output in the total
4202 proper ordering of commands and command output in the total
4197 output.
4203 output.
4198 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4204 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4199 system/getoutput as defaults. The old ones are kept for
4205 system/getoutput as defaults. The old ones are kept for
4200 compatibility reasons, so no code which uses this library needs
4206 compatibility reasons, so no code which uses this library needs
4201 changing.
4207 changing.
4202
4208
4203 2003-01-27 *** Released version 0.2.14
4209 2003-01-27 *** Released version 0.2.14
4204
4210
4205 2003-01-25 Fernando Perez <fperez@colorado.edu>
4211 2003-01-25 Fernando Perez <fperez@colorado.edu>
4206
4212
4207 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4213 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4208 functions defined in previous edit sessions could not be re-edited
4214 functions defined in previous edit sessions could not be re-edited
4209 (because the temp files were immediately removed). Now temp files
4215 (because the temp files were immediately removed). Now temp files
4210 are removed only at IPython's exit.
4216 are removed only at IPython's exit.
4211 (Magic.magic_run): Improved @run to perform shell-like expansions
4217 (Magic.magic_run): Improved @run to perform shell-like expansions
4212 on its arguments (~users and $VARS). With this, @run becomes more
4218 on its arguments (~users and $VARS). With this, @run becomes more
4213 like a normal command-line.
4219 like a normal command-line.
4214
4220
4215 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4221 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4216 bugs related to embedding and cleaned up that code. A fairly
4222 bugs related to embedding and cleaned up that code. A fairly
4217 important one was the impossibility to access the global namespace
4223 important one was the impossibility to access the global namespace
4218 through the embedded IPython (only local variables were visible).
4224 through the embedded IPython (only local variables were visible).
4219
4225
4220 2003-01-14 Fernando Perez <fperez@colorado.edu>
4226 2003-01-14 Fernando Perez <fperez@colorado.edu>
4221
4227
4222 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4228 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4223 auto-calling to be a bit more conservative. Now it doesn't get
4229 auto-calling to be a bit more conservative. Now it doesn't get
4224 triggered if any of '!=()<>' are in the rest of the input line, to
4230 triggered if any of '!=()<>' are in the rest of the input line, to
4225 allow comparing callables. Thanks to Alex for the heads up.
4231 allow comparing callables. Thanks to Alex for the heads up.
4226
4232
4227 2003-01-07 Fernando Perez <fperez@colorado.edu>
4233 2003-01-07 Fernando Perez <fperez@colorado.edu>
4228
4234
4229 * IPython/genutils.py (page): fixed estimation of the number of
4235 * IPython/genutils.py (page): fixed estimation of the number of
4230 lines in a string to be paged to simply count newlines. This
4236 lines in a string to be paged to simply count newlines. This
4231 prevents over-guessing due to embedded escape sequences. A better
4237 prevents over-guessing due to embedded escape sequences. A better
4232 long-term solution would involve stripping out the control chars
4238 long-term solution would involve stripping out the control chars
4233 for the count, but it's potentially so expensive I just don't
4239 for the count, but it's potentially so expensive I just don't
4234 think it's worth doing.
4240 think it's worth doing.
4235
4241
4236 2002-12-19 *** Released version 0.2.14pre50
4242 2002-12-19 *** Released version 0.2.14pre50
4237
4243
4238 2002-12-19 Fernando Perez <fperez@colorado.edu>
4244 2002-12-19 Fernando Perez <fperez@colorado.edu>
4239
4245
4240 * tools/release (version): Changed release scripts to inform
4246 * tools/release (version): Changed release scripts to inform
4241 Andrea and build a NEWS file with a list of recent changes.
4247 Andrea and build a NEWS file with a list of recent changes.
4242
4248
4243 * IPython/ColorANSI.py (__all__): changed terminal detection
4249 * IPython/ColorANSI.py (__all__): changed terminal detection
4244 code. Seems to work better for xterms without breaking
4250 code. Seems to work better for xterms without breaking
4245 konsole. Will need more testing to determine if WinXP and Mac OSX
4251 konsole. Will need more testing to determine if WinXP and Mac OSX
4246 also work ok.
4252 also work ok.
4247
4253
4248 2002-12-18 *** Released version 0.2.14pre49
4254 2002-12-18 *** Released version 0.2.14pre49
4249
4255
4250 2002-12-18 Fernando Perez <fperez@colorado.edu>
4256 2002-12-18 Fernando Perez <fperez@colorado.edu>
4251
4257
4252 * Docs: added new info about Mac OSX, from Andrea.
4258 * Docs: added new info about Mac OSX, from Andrea.
4253
4259
4254 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4260 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4255 allow direct plotting of python strings whose format is the same
4261 allow direct plotting of python strings whose format is the same
4256 of gnuplot data files.
4262 of gnuplot data files.
4257
4263
4258 2002-12-16 Fernando Perez <fperez@colorado.edu>
4264 2002-12-16 Fernando Perez <fperez@colorado.edu>
4259
4265
4260 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4266 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4261 value of exit question to be acknowledged.
4267 value of exit question to be acknowledged.
4262
4268
4263 2002-12-03 Fernando Perez <fperez@colorado.edu>
4269 2002-12-03 Fernando Perez <fperez@colorado.edu>
4264
4270
4265 * IPython/ipmaker.py: removed generators, which had been added
4271 * IPython/ipmaker.py: removed generators, which had been added
4266 by mistake in an earlier debugging run. This was causing trouble
4272 by mistake in an earlier debugging run. This was causing trouble
4267 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4273 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4268 for pointing this out.
4274 for pointing this out.
4269
4275
4270 2002-11-17 Fernando Perez <fperez@colorado.edu>
4276 2002-11-17 Fernando Perez <fperez@colorado.edu>
4271
4277
4272 * Manual: updated the Gnuplot section.
4278 * Manual: updated the Gnuplot section.
4273
4279
4274 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4280 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4275 a much better split of what goes in Runtime and what goes in
4281 a much better split of what goes in Runtime and what goes in
4276 Interactive.
4282 Interactive.
4277
4283
4278 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4284 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4279 being imported from iplib.
4285 being imported from iplib.
4280
4286
4281 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4287 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4282 for command-passing. Now the global Gnuplot instance is called
4288 for command-passing. Now the global Gnuplot instance is called
4283 'gp' instead of 'g', which was really a far too fragile and
4289 'gp' instead of 'g', which was really a far too fragile and
4284 common name.
4290 common name.
4285
4291
4286 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4292 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4287 bounding boxes generated by Gnuplot for square plots.
4293 bounding boxes generated by Gnuplot for square plots.
4288
4294
4289 * IPython/genutils.py (popkey): new function added. I should
4295 * IPython/genutils.py (popkey): new function added. I should
4290 suggest this on c.l.py as a dict method, it seems useful.
4296 suggest this on c.l.py as a dict method, it seems useful.
4291
4297
4292 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4298 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4293 to transparently handle PostScript generation. MUCH better than
4299 to transparently handle PostScript generation. MUCH better than
4294 the previous plot_eps/replot_eps (which I removed now). The code
4300 the previous plot_eps/replot_eps (which I removed now). The code
4295 is also fairly clean and well documented now (including
4301 is also fairly clean and well documented now (including
4296 docstrings).
4302 docstrings).
4297
4303
4298 2002-11-13 Fernando Perez <fperez@colorado.edu>
4304 2002-11-13 Fernando Perez <fperez@colorado.edu>
4299
4305
4300 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4306 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4301 (inconsistent with options).
4307 (inconsistent with options).
4302
4308
4303 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4309 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4304 manually disabled, I don't know why. Fixed it.
4310 manually disabled, I don't know why. Fixed it.
4305 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4311 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4306 eps output.
4312 eps output.
4307
4313
4308 2002-11-12 Fernando Perez <fperez@colorado.edu>
4314 2002-11-12 Fernando Perez <fperez@colorado.edu>
4309
4315
4310 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4316 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4311 don't propagate up to caller. Fixes crash reported by François
4317 don't propagate up to caller. Fixes crash reported by François
4312 Pinard.
4318 Pinard.
4313
4319
4314 2002-11-09 Fernando Perez <fperez@colorado.edu>
4320 2002-11-09 Fernando Perez <fperez@colorado.edu>
4315
4321
4316 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4322 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4317 history file for new users.
4323 history file for new users.
4318 (make_IPython): fixed bug where initial install would leave the
4324 (make_IPython): fixed bug where initial install would leave the
4319 user running in the .ipython dir.
4325 user running in the .ipython dir.
4320 (make_IPython): fixed bug where config dir .ipython would be
4326 (make_IPython): fixed bug where config dir .ipython would be
4321 created regardless of the given -ipythondir option. Thanks to Cory
4327 created regardless of the given -ipythondir option. Thanks to Cory
4322 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4328 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4323
4329
4324 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4330 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4325 type confirmations. Will need to use it in all of IPython's code
4331 type confirmations. Will need to use it in all of IPython's code
4326 consistently.
4332 consistently.
4327
4333
4328 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4334 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4329 context to print 31 lines instead of the default 5. This will make
4335 context to print 31 lines instead of the default 5. This will make
4330 the crash reports extremely detailed in case the problem is in
4336 the crash reports extremely detailed in case the problem is in
4331 libraries I don't have access to.
4337 libraries I don't have access to.
4332
4338
4333 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4339 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4334 line of defense' code to still crash, but giving users fair
4340 line of defense' code to still crash, but giving users fair
4335 warning. I don't want internal errors to go unreported: if there's
4341 warning. I don't want internal errors to go unreported: if there's
4336 an internal problem, IPython should crash and generate a full
4342 an internal problem, IPython should crash and generate a full
4337 report.
4343 report.
4338
4344
4339 2002-11-08 Fernando Perez <fperez@colorado.edu>
4345 2002-11-08 Fernando Perez <fperez@colorado.edu>
4340
4346
4341 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4347 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4342 otherwise uncaught exceptions which can appear if people set
4348 otherwise uncaught exceptions which can appear if people set
4343 sys.stdout to something badly broken. Thanks to a crash report
4349 sys.stdout to something badly broken. Thanks to a crash report
4344 from henni-AT-mail.brainbot.com.
4350 from henni-AT-mail.brainbot.com.
4345
4351
4346 2002-11-04 Fernando Perez <fperez@colorado.edu>
4352 2002-11-04 Fernando Perez <fperez@colorado.edu>
4347
4353
4348 * IPython/iplib.py (InteractiveShell.interact): added
4354 * IPython/iplib.py (InteractiveShell.interact): added
4349 __IPYTHON__active to the builtins. It's a flag which goes on when
4355 __IPYTHON__active to the builtins. It's a flag which goes on when
4350 the interaction starts and goes off again when it stops. This
4356 the interaction starts and goes off again when it stops. This
4351 allows embedding code to detect being inside IPython. Before this
4357 allows embedding code to detect being inside IPython. Before this
4352 was done via __IPYTHON__, but that only shows that an IPython
4358 was done via __IPYTHON__, but that only shows that an IPython
4353 instance has been created.
4359 instance has been created.
4354
4360
4355 * IPython/Magic.py (Magic.magic_env): I realized that in a
4361 * IPython/Magic.py (Magic.magic_env): I realized that in a
4356 UserDict, instance.data holds the data as a normal dict. So I
4362 UserDict, instance.data holds the data as a normal dict. So I
4357 modified @env to return os.environ.data instead of rebuilding a
4363 modified @env to return os.environ.data instead of rebuilding a
4358 dict by hand.
4364 dict by hand.
4359
4365
4360 2002-11-02 Fernando Perez <fperez@colorado.edu>
4366 2002-11-02 Fernando Perez <fperez@colorado.edu>
4361
4367
4362 * IPython/genutils.py (warn): changed so that level 1 prints no
4368 * IPython/genutils.py (warn): changed so that level 1 prints no
4363 header. Level 2 is now the default (with 'WARNING' header, as
4369 header. Level 2 is now the default (with 'WARNING' header, as
4364 before). I think I tracked all places where changes were needed in
4370 before). I think I tracked all places where changes were needed in
4365 IPython, but outside code using the old level numbering may have
4371 IPython, but outside code using the old level numbering may have
4366 broken.
4372 broken.
4367
4373
4368 * IPython/iplib.py (InteractiveShell.runcode): added this to
4374 * IPython/iplib.py (InteractiveShell.runcode): added this to
4369 handle the tracebacks in SystemExit traps correctly. The previous
4375 handle the tracebacks in SystemExit traps correctly. The previous
4370 code (through interact) was printing more of the stack than
4376 code (through interact) was printing more of the stack than
4371 necessary, showing IPython internal code to the user.
4377 necessary, showing IPython internal code to the user.
4372
4378
4373 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4379 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4374 default. Now that the default at the confirmation prompt is yes,
4380 default. Now that the default at the confirmation prompt is yes,
4375 it's not so intrusive. François' argument that ipython sessions
4381 it's not so intrusive. François' argument that ipython sessions
4376 tend to be complex enough not to lose them from an accidental C-d,
4382 tend to be complex enough not to lose them from an accidental C-d,
4377 is a valid one.
4383 is a valid one.
4378
4384
4379 * IPython/iplib.py (InteractiveShell.interact): added a
4385 * IPython/iplib.py (InteractiveShell.interact): added a
4380 showtraceback() call to the SystemExit trap, and modified the exit
4386 showtraceback() call to the SystemExit trap, and modified the exit
4381 confirmation to have yes as the default.
4387 confirmation to have yes as the default.
4382
4388
4383 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4389 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4384 this file. It's been gone from the code for a long time, this was
4390 this file. It's been gone from the code for a long time, this was
4385 simply leftover junk.
4391 simply leftover junk.
4386
4392
4387 2002-11-01 Fernando Perez <fperez@colorado.edu>
4393 2002-11-01 Fernando Perez <fperez@colorado.edu>
4388
4394
4389 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4395 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4390 added. If set, IPython now traps EOF and asks for
4396 added. If set, IPython now traps EOF and asks for
4391 confirmation. After a request by François Pinard.
4397 confirmation. After a request by François Pinard.
4392
4398
4393 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4399 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4394 of @abort, and with a new (better) mechanism for handling the
4400 of @abort, and with a new (better) mechanism for handling the
4395 exceptions.
4401 exceptions.
4396
4402
4397 2002-10-27 Fernando Perez <fperez@colorado.edu>
4403 2002-10-27 Fernando Perez <fperez@colorado.edu>
4398
4404
4399 * IPython/usage.py (__doc__): updated the --help information and
4405 * IPython/usage.py (__doc__): updated the --help information and
4400 the ipythonrc file to indicate that -log generates
4406 the ipythonrc file to indicate that -log generates
4401 ./ipython.log. Also fixed the corresponding info in @logstart.
4407 ./ipython.log. Also fixed the corresponding info in @logstart.
4402 This and several other fixes in the manuals thanks to reports by
4408 This and several other fixes in the manuals thanks to reports by
4403 François Pinard <pinard-AT-iro.umontreal.ca>.
4409 François Pinard <pinard-AT-iro.umontreal.ca>.
4404
4410
4405 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4411 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4406 refer to @logstart (instead of @log, which doesn't exist).
4412 refer to @logstart (instead of @log, which doesn't exist).
4407
4413
4408 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4414 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4409 AttributeError crash. Thanks to Christopher Armstrong
4415 AttributeError crash. Thanks to Christopher Armstrong
4410 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4416 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4411 introduced recently (in 0.2.14pre37) with the fix to the eval
4417 introduced recently (in 0.2.14pre37) with the fix to the eval
4412 problem mentioned below.
4418 problem mentioned below.
4413
4419
4414 2002-10-17 Fernando Perez <fperez@colorado.edu>
4420 2002-10-17 Fernando Perez <fperez@colorado.edu>
4415
4421
4416 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4422 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4417 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4423 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4418
4424
4419 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4425 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4420 this function to fix a problem reported by Alex Schmolck. He saw
4426 this function to fix a problem reported by Alex Schmolck. He saw
4421 it with list comprehensions and generators, which were getting
4427 it with list comprehensions and generators, which were getting
4422 called twice. The real problem was an 'eval' call in testing for
4428 called twice. The real problem was an 'eval' call in testing for
4423 automagic which was evaluating the input line silently.
4429 automagic which was evaluating the input line silently.
4424
4430
4425 This is a potentially very nasty bug, if the input has side
4431 This is a potentially very nasty bug, if the input has side
4426 effects which must not be repeated. The code is much cleaner now,
4432 effects which must not be repeated. The code is much cleaner now,
4427 without any blanket 'except' left and with a regexp test for
4433 without any blanket 'except' left and with a regexp test for
4428 actual function names.
4434 actual function names.
4429
4435
4430 But an eval remains, which I'm not fully comfortable with. I just
4436 But an eval remains, which I'm not fully comfortable with. I just
4431 don't know how to find out if an expression could be a callable in
4437 don't know how to find out if an expression could be a callable in
4432 the user's namespace without doing an eval on the string. However
4438 the user's namespace without doing an eval on the string. However
4433 that string is now much more strictly checked so that no code
4439 that string is now much more strictly checked so that no code
4434 slips by, so the eval should only happen for things that can
4440 slips by, so the eval should only happen for things that can
4435 really be only function/method names.
4441 really be only function/method names.
4436
4442
4437 2002-10-15 Fernando Perez <fperez@colorado.edu>
4443 2002-10-15 Fernando Perez <fperez@colorado.edu>
4438
4444
4439 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4445 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4440 OSX information to main manual, removed README_Mac_OSX file from
4446 OSX information to main manual, removed README_Mac_OSX file from
4441 distribution. Also updated credits for recent additions.
4447 distribution. Also updated credits for recent additions.
4442
4448
4443 2002-10-10 Fernando Perez <fperez@colorado.edu>
4449 2002-10-10 Fernando Perez <fperez@colorado.edu>
4444
4450
4445 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4451 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4446 terminal-related issues. Many thanks to Andrea Riciputi
4452 terminal-related issues. Many thanks to Andrea Riciputi
4447 <andrea.riciputi-AT-libero.it> for writing it.
4453 <andrea.riciputi-AT-libero.it> for writing it.
4448
4454
4449 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4455 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4450 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4456 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4451
4457
4452 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4458 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4453 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4459 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4454 <syver-en-AT-online.no> who both submitted patches for this problem.
4460 <syver-en-AT-online.no> who both submitted patches for this problem.
4455
4461
4456 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4462 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4457 global embedding to make sure that things don't overwrite user
4463 global embedding to make sure that things don't overwrite user
4458 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4464 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4459
4465
4460 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4466 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4461 compatibility. Thanks to Hayden Callow
4467 compatibility. Thanks to Hayden Callow
4462 <h.callow-AT-elec.canterbury.ac.nz>
4468 <h.callow-AT-elec.canterbury.ac.nz>
4463
4469
4464 2002-10-04 Fernando Perez <fperez@colorado.edu>
4470 2002-10-04 Fernando Perez <fperez@colorado.edu>
4465
4471
4466 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4472 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4467 Gnuplot.File objects.
4473 Gnuplot.File objects.
4468
4474
4469 2002-07-23 Fernando Perez <fperez@colorado.edu>
4475 2002-07-23 Fernando Perez <fperez@colorado.edu>
4470
4476
4471 * IPython/genutils.py (timing): Added timings() and timing() for
4477 * IPython/genutils.py (timing): Added timings() and timing() for
4472 quick access to the most commonly needed data, the execution
4478 quick access to the most commonly needed data, the execution
4473 times. Old timing() renamed to timings_out().
4479 times. Old timing() renamed to timings_out().
4474
4480
4475 2002-07-18 Fernando Perez <fperez@colorado.edu>
4481 2002-07-18 Fernando Perez <fperez@colorado.edu>
4476
4482
4477 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4483 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4478 bug with nested instances disrupting the parent's tab completion.
4484 bug with nested instances disrupting the parent's tab completion.
4479
4485
4480 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4486 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4481 all_completions code to begin the emacs integration.
4487 all_completions code to begin the emacs integration.
4482
4488
4483 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4489 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4484 argument to allow titling individual arrays when plotting.
4490 argument to allow titling individual arrays when plotting.
4485
4491
4486 2002-07-15 Fernando Perez <fperez@colorado.edu>
4492 2002-07-15 Fernando Perez <fperez@colorado.edu>
4487
4493
4488 * setup.py (make_shortcut): changed to retrieve the value of
4494 * setup.py (make_shortcut): changed to retrieve the value of
4489 'Program Files' directory from the registry (this value changes in
4495 'Program Files' directory from the registry (this value changes in
4490 non-english versions of Windows). Thanks to Thomas Fanslau
4496 non-english versions of Windows). Thanks to Thomas Fanslau
4491 <tfanslau-AT-gmx.de> for the report.
4497 <tfanslau-AT-gmx.de> for the report.
4492
4498
4493 2002-07-10 Fernando Perez <fperez@colorado.edu>
4499 2002-07-10 Fernando Perez <fperez@colorado.edu>
4494
4500
4495 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4501 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4496 a bug in pdb, which crashes if a line with only whitespace is
4502 a bug in pdb, which crashes if a line with only whitespace is
4497 entered. Bug report submitted to sourceforge.
4503 entered. Bug report submitted to sourceforge.
4498
4504
4499 2002-07-09 Fernando Perez <fperez@colorado.edu>
4505 2002-07-09 Fernando Perez <fperez@colorado.edu>
4500
4506
4501 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4507 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4502 reporting exceptions (it's a bug in inspect.py, I just set a
4508 reporting exceptions (it's a bug in inspect.py, I just set a
4503 workaround).
4509 workaround).
4504
4510
4505 2002-07-08 Fernando Perez <fperez@colorado.edu>
4511 2002-07-08 Fernando Perez <fperez@colorado.edu>
4506
4512
4507 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4513 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4508 __IPYTHON__ in __builtins__ to show up in user_ns.
4514 __IPYTHON__ in __builtins__ to show up in user_ns.
4509
4515
4510 2002-07-03 Fernando Perez <fperez@colorado.edu>
4516 2002-07-03 Fernando Perez <fperez@colorado.edu>
4511
4517
4512 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4518 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4513 name from @gp_set_instance to @gp_set_default.
4519 name from @gp_set_instance to @gp_set_default.
4514
4520
4515 * IPython/ipmaker.py (make_IPython): default editor value set to
4521 * IPython/ipmaker.py (make_IPython): default editor value set to
4516 '0' (a string), to match the rc file. Otherwise will crash when
4522 '0' (a string), to match the rc file. Otherwise will crash when
4517 .strip() is called on it.
4523 .strip() is called on it.
4518
4524
4519
4525
4520 2002-06-28 Fernando Perez <fperez@colorado.edu>
4526 2002-06-28 Fernando Perez <fperez@colorado.edu>
4521
4527
4522 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4528 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4523 of files in current directory when a file is executed via
4529 of files in current directory when a file is executed via
4524 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4530 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4525
4531
4526 * setup.py (manfiles): fix for rpm builds, submitted by RA
4532 * setup.py (manfiles): fix for rpm builds, submitted by RA
4527 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4533 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4528
4534
4529 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4535 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4530 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4536 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4531 string!). A. Schmolck caught this one.
4537 string!). A. Schmolck caught this one.
4532
4538
4533 2002-06-27 Fernando Perez <fperez@colorado.edu>
4539 2002-06-27 Fernando Perez <fperez@colorado.edu>
4534
4540
4535 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4541 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4536 defined files at the cmd line. __name__ wasn't being set to
4542 defined files at the cmd line. __name__ wasn't being set to
4537 __main__.
4543 __main__.
4538
4544
4539 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4545 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4540 regular lists and tuples besides Numeric arrays.
4546 regular lists and tuples besides Numeric arrays.
4541
4547
4542 * IPython/Prompts.py (CachedOutput.__call__): Added output
4548 * IPython/Prompts.py (CachedOutput.__call__): Added output
4543 supression for input ending with ';'. Similar to Mathematica and
4549 supression for input ending with ';'. Similar to Mathematica and
4544 Matlab. The _* vars and Out[] list are still updated, just like
4550 Matlab. The _* vars and Out[] list are still updated, just like
4545 Mathematica behaves.
4551 Mathematica behaves.
4546
4552
4547 2002-06-25 Fernando Perez <fperez@colorado.edu>
4553 2002-06-25 Fernando Perez <fperez@colorado.edu>
4548
4554
4549 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4555 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4550 .ini extensions for profiels under Windows.
4556 .ini extensions for profiels under Windows.
4551
4557
4552 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4558 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4553 string form. Fix contributed by Alexander Schmolck
4559 string form. Fix contributed by Alexander Schmolck
4554 <a.schmolck-AT-gmx.net>
4560 <a.schmolck-AT-gmx.net>
4555
4561
4556 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4562 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4557 pre-configured Gnuplot instance.
4563 pre-configured Gnuplot instance.
4558
4564
4559 2002-06-21 Fernando Perez <fperez@colorado.edu>
4565 2002-06-21 Fernando Perez <fperez@colorado.edu>
4560
4566
4561 * IPython/numutils.py (exp_safe): new function, works around the
4567 * IPython/numutils.py (exp_safe): new function, works around the
4562 underflow problems in Numeric.
4568 underflow problems in Numeric.
4563 (log2): New fn. Safe log in base 2: returns exact integer answer
4569 (log2): New fn. Safe log in base 2: returns exact integer answer
4564 for exact integer powers of 2.
4570 for exact integer powers of 2.
4565
4571
4566 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4572 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4567 properly.
4573 properly.
4568
4574
4569 2002-06-20 Fernando Perez <fperez@colorado.edu>
4575 2002-06-20 Fernando Perez <fperez@colorado.edu>
4570
4576
4571 * IPython/genutils.py (timing): new function like
4577 * IPython/genutils.py (timing): new function like
4572 Mathematica's. Similar to time_test, but returns more info.
4578 Mathematica's. Similar to time_test, but returns more info.
4573
4579
4574 2002-06-18 Fernando Perez <fperez@colorado.edu>
4580 2002-06-18 Fernando Perez <fperez@colorado.edu>
4575
4581
4576 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4582 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4577 according to Mike Heeter's suggestions.
4583 according to Mike Heeter's suggestions.
4578
4584
4579 2002-06-16 Fernando Perez <fperez@colorado.edu>
4585 2002-06-16 Fernando Perez <fperez@colorado.edu>
4580
4586
4581 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4587 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4582 system. GnuplotMagic is gone as a user-directory option. New files
4588 system. GnuplotMagic is gone as a user-directory option. New files
4583 make it easier to use all the gnuplot stuff both from external
4589 make it easier to use all the gnuplot stuff both from external
4584 programs as well as from IPython. Had to rewrite part of
4590 programs as well as from IPython. Had to rewrite part of
4585 hardcopy() b/c of a strange bug: often the ps files simply don't
4591 hardcopy() b/c of a strange bug: often the ps files simply don't
4586 get created, and require a repeat of the command (often several
4592 get created, and require a repeat of the command (often several
4587 times).
4593 times).
4588
4594
4589 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4595 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4590 resolve output channel at call time, so that if sys.stderr has
4596 resolve output channel at call time, so that if sys.stderr has
4591 been redirected by user this gets honored.
4597 been redirected by user this gets honored.
4592
4598
4593 2002-06-13 Fernando Perez <fperez@colorado.edu>
4599 2002-06-13 Fernando Perez <fperez@colorado.edu>
4594
4600
4595 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4601 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4596 IPShell. Kept a copy with the old names to avoid breaking people's
4602 IPShell. Kept a copy with the old names to avoid breaking people's
4597 embedded code.
4603 embedded code.
4598
4604
4599 * IPython/ipython: simplified it to the bare minimum after
4605 * IPython/ipython: simplified it to the bare minimum after
4600 Holger's suggestions. Added info about how to use it in
4606 Holger's suggestions. Added info about how to use it in
4601 PYTHONSTARTUP.
4607 PYTHONSTARTUP.
4602
4608
4603 * IPython/Shell.py (IPythonShell): changed the options passing
4609 * IPython/Shell.py (IPythonShell): changed the options passing
4604 from a string with funky %s replacements to a straight list. Maybe
4610 from a string with funky %s replacements to a straight list. Maybe
4605 a bit more typing, but it follows sys.argv conventions, so there's
4611 a bit more typing, but it follows sys.argv conventions, so there's
4606 less special-casing to remember.
4612 less special-casing to remember.
4607
4613
4608 2002-06-12 Fernando Perez <fperez@colorado.edu>
4614 2002-06-12 Fernando Perez <fperez@colorado.edu>
4609
4615
4610 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4616 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4611 command. Thanks to a suggestion by Mike Heeter.
4617 command. Thanks to a suggestion by Mike Heeter.
4612 (Magic.magic_pfile): added behavior to look at filenames if given
4618 (Magic.magic_pfile): added behavior to look at filenames if given
4613 arg is not a defined object.
4619 arg is not a defined object.
4614 (Magic.magic_save): New @save function to save code snippets. Also
4620 (Magic.magic_save): New @save function to save code snippets. Also
4615 a Mike Heeter idea.
4621 a Mike Heeter idea.
4616
4622
4617 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4623 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4618 plot() and replot(). Much more convenient now, especially for
4624 plot() and replot(). Much more convenient now, especially for
4619 interactive use.
4625 interactive use.
4620
4626
4621 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4627 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4622 filenames.
4628 filenames.
4623
4629
4624 2002-06-02 Fernando Perez <fperez@colorado.edu>
4630 2002-06-02 Fernando Perez <fperez@colorado.edu>
4625
4631
4626 * IPython/Struct.py (Struct.__init__): modified to admit
4632 * IPython/Struct.py (Struct.__init__): modified to admit
4627 initialization via another struct.
4633 initialization via another struct.
4628
4634
4629 * IPython/genutils.py (SystemExec.__init__): New stateful
4635 * IPython/genutils.py (SystemExec.__init__): New stateful
4630 interface to xsys and bq. Useful for writing system scripts.
4636 interface to xsys and bq. Useful for writing system scripts.
4631
4637
4632 2002-05-30 Fernando Perez <fperez@colorado.edu>
4638 2002-05-30 Fernando Perez <fperez@colorado.edu>
4633
4639
4634 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4640 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4635 documents. This will make the user download smaller (it's getting
4641 documents. This will make the user download smaller (it's getting
4636 too big).
4642 too big).
4637
4643
4638 2002-05-29 Fernando Perez <fperez@colorado.edu>
4644 2002-05-29 Fernando Perez <fperez@colorado.edu>
4639
4645
4640 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4646 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4641 fix problems with shelve and pickle. Seems to work, but I don't
4647 fix problems with shelve and pickle. Seems to work, but I don't
4642 know if corner cases break it. Thanks to Mike Heeter
4648 know if corner cases break it. Thanks to Mike Heeter
4643 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4649 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4644
4650
4645 2002-05-24 Fernando Perez <fperez@colorado.edu>
4651 2002-05-24 Fernando Perez <fperez@colorado.edu>
4646
4652
4647 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4653 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4648 macros having broken.
4654 macros having broken.
4649
4655
4650 2002-05-21 Fernando Perez <fperez@colorado.edu>
4656 2002-05-21 Fernando Perez <fperez@colorado.edu>
4651
4657
4652 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4658 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4653 introduced logging bug: all history before logging started was
4659 introduced logging bug: all history before logging started was
4654 being written one character per line! This came from the redesign
4660 being written one character per line! This came from the redesign
4655 of the input history as a special list which slices to strings,
4661 of the input history as a special list which slices to strings,
4656 not to lists.
4662 not to lists.
4657
4663
4658 2002-05-20 Fernando Perez <fperez@colorado.edu>
4664 2002-05-20 Fernando Perez <fperez@colorado.edu>
4659
4665
4660 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4666 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4661 be an attribute of all classes in this module. The design of these
4667 be an attribute of all classes in this module. The design of these
4662 classes needs some serious overhauling.
4668 classes needs some serious overhauling.
4663
4669
4664 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4670 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4665 which was ignoring '_' in option names.
4671 which was ignoring '_' in option names.
4666
4672
4667 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4673 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4668 'Verbose_novars' to 'Context' and made it the new default. It's a
4674 'Verbose_novars' to 'Context' and made it the new default. It's a
4669 bit more readable and also safer than verbose.
4675 bit more readable and also safer than verbose.
4670
4676
4671 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4677 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4672 triple-quoted strings.
4678 triple-quoted strings.
4673
4679
4674 * IPython/OInspect.py (__all__): new module exposing the object
4680 * IPython/OInspect.py (__all__): new module exposing the object
4675 introspection facilities. Now the corresponding magics are dummy
4681 introspection facilities. Now the corresponding magics are dummy
4676 wrappers around this. Having this module will make it much easier
4682 wrappers around this. Having this module will make it much easier
4677 to put these functions into our modified pdb.
4683 to put these functions into our modified pdb.
4678 This new object inspector system uses the new colorizing module,
4684 This new object inspector system uses the new colorizing module,
4679 so source code and other things are nicely syntax highlighted.
4685 so source code and other things are nicely syntax highlighted.
4680
4686
4681 2002-05-18 Fernando Perez <fperez@colorado.edu>
4687 2002-05-18 Fernando Perez <fperez@colorado.edu>
4682
4688
4683 * IPython/ColorANSI.py: Split the coloring tools into a separate
4689 * IPython/ColorANSI.py: Split the coloring tools into a separate
4684 module so I can use them in other code easier (they were part of
4690 module so I can use them in other code easier (they were part of
4685 ultraTB).
4691 ultraTB).
4686
4692
4687 2002-05-17 Fernando Perez <fperez@colorado.edu>
4693 2002-05-17 Fernando Perez <fperez@colorado.edu>
4688
4694
4689 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4695 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4690 fixed it to set the global 'g' also to the called instance, as
4696 fixed it to set the global 'g' also to the called instance, as
4691 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4697 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4692 user's 'g' variables).
4698 user's 'g' variables).
4693
4699
4694 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4700 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4695 global variables (aliases to _ih,_oh) so that users which expect
4701 global variables (aliases to _ih,_oh) so that users which expect
4696 In[5] or Out[7] to work aren't unpleasantly surprised.
4702 In[5] or Out[7] to work aren't unpleasantly surprised.
4697 (InputList.__getslice__): new class to allow executing slices of
4703 (InputList.__getslice__): new class to allow executing slices of
4698 input history directly. Very simple class, complements the use of
4704 input history directly. Very simple class, complements the use of
4699 macros.
4705 macros.
4700
4706
4701 2002-05-16 Fernando Perez <fperez@colorado.edu>
4707 2002-05-16 Fernando Perez <fperez@colorado.edu>
4702
4708
4703 * setup.py (docdirbase): make doc directory be just doc/IPython
4709 * setup.py (docdirbase): make doc directory be just doc/IPython
4704 without version numbers, it will reduce clutter for users.
4710 without version numbers, it will reduce clutter for users.
4705
4711
4706 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4712 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4707 execfile call to prevent possible memory leak. See for details:
4713 execfile call to prevent possible memory leak. See for details:
4708 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4714 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4709
4715
4710 2002-05-15 Fernando Perez <fperez@colorado.edu>
4716 2002-05-15 Fernando Perez <fperez@colorado.edu>
4711
4717
4712 * IPython/Magic.py (Magic.magic_psource): made the object
4718 * IPython/Magic.py (Magic.magic_psource): made the object
4713 introspection names be more standard: pdoc, pdef, pfile and
4719 introspection names be more standard: pdoc, pdef, pfile and
4714 psource. They all print/page their output, and it makes
4720 psource. They all print/page their output, and it makes
4715 remembering them easier. Kept old names for compatibility as
4721 remembering them easier. Kept old names for compatibility as
4716 aliases.
4722 aliases.
4717
4723
4718 2002-05-14 Fernando Perez <fperez@colorado.edu>
4724 2002-05-14 Fernando Perez <fperez@colorado.edu>
4719
4725
4720 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4726 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4721 what the mouse problem was. The trick is to use gnuplot with temp
4727 what the mouse problem was. The trick is to use gnuplot with temp
4722 files and NOT with pipes (for data communication), because having
4728 files and NOT with pipes (for data communication), because having
4723 both pipes and the mouse on is bad news.
4729 both pipes and the mouse on is bad news.
4724
4730
4725 2002-05-13 Fernando Perez <fperez@colorado.edu>
4731 2002-05-13 Fernando Perez <fperez@colorado.edu>
4726
4732
4727 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4733 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4728 bug. Information would be reported about builtins even when
4734 bug. Information would be reported about builtins even when
4729 user-defined functions overrode them.
4735 user-defined functions overrode them.
4730
4736
4731 2002-05-11 Fernando Perez <fperez@colorado.edu>
4737 2002-05-11 Fernando Perez <fperez@colorado.edu>
4732
4738
4733 * IPython/__init__.py (__all__): removed FlexCompleter from
4739 * IPython/__init__.py (__all__): removed FlexCompleter from
4734 __all__ so that things don't fail in platforms without readline.
4740 __all__ so that things don't fail in platforms without readline.
4735
4741
4736 2002-05-10 Fernando Perez <fperez@colorado.edu>
4742 2002-05-10 Fernando Perez <fperez@colorado.edu>
4737
4743
4738 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4744 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4739 it requires Numeric, effectively making Numeric a dependency for
4745 it requires Numeric, effectively making Numeric a dependency for
4740 IPython.
4746 IPython.
4741
4747
4742 * Released 0.2.13
4748 * Released 0.2.13
4743
4749
4744 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4750 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4745 profiler interface. Now all the major options from the profiler
4751 profiler interface. Now all the major options from the profiler
4746 module are directly supported in IPython, both for single
4752 module are directly supported in IPython, both for single
4747 expressions (@prun) and for full programs (@run -p).
4753 expressions (@prun) and for full programs (@run -p).
4748
4754
4749 2002-05-09 Fernando Perez <fperez@colorado.edu>
4755 2002-05-09 Fernando Perez <fperez@colorado.edu>
4750
4756
4751 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4757 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4752 magic properly formatted for screen.
4758 magic properly formatted for screen.
4753
4759
4754 * setup.py (make_shortcut): Changed things to put pdf version in
4760 * setup.py (make_shortcut): Changed things to put pdf version in
4755 doc/ instead of doc/manual (had to change lyxport a bit).
4761 doc/ instead of doc/manual (had to change lyxport a bit).
4756
4762
4757 * IPython/Magic.py (Profile.string_stats): made profile runs go
4763 * IPython/Magic.py (Profile.string_stats): made profile runs go
4758 through pager (they are long and a pager allows searching, saving,
4764 through pager (they are long and a pager allows searching, saving,
4759 etc.)
4765 etc.)
4760
4766
4761 2002-05-08 Fernando Perez <fperez@colorado.edu>
4767 2002-05-08 Fernando Perez <fperez@colorado.edu>
4762
4768
4763 * Released 0.2.12
4769 * Released 0.2.12
4764
4770
4765 2002-05-06 Fernando Perez <fperez@colorado.edu>
4771 2002-05-06 Fernando Perez <fperez@colorado.edu>
4766
4772
4767 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4773 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4768 introduced); 'hist n1 n2' was broken.
4774 introduced); 'hist n1 n2' was broken.
4769 (Magic.magic_pdb): added optional on/off arguments to @pdb
4775 (Magic.magic_pdb): added optional on/off arguments to @pdb
4770 (Magic.magic_run): added option -i to @run, which executes code in
4776 (Magic.magic_run): added option -i to @run, which executes code in
4771 the IPython namespace instead of a clean one. Also added @irun as
4777 the IPython namespace instead of a clean one. Also added @irun as
4772 an alias to @run -i.
4778 an alias to @run -i.
4773
4779
4774 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4780 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4775 fixed (it didn't really do anything, the namespaces were wrong).
4781 fixed (it didn't really do anything, the namespaces were wrong).
4776
4782
4777 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4783 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4778
4784
4779 * IPython/__init__.py (__all__): Fixed package namespace, now
4785 * IPython/__init__.py (__all__): Fixed package namespace, now
4780 'import IPython' does give access to IPython.<all> as
4786 'import IPython' does give access to IPython.<all> as
4781 expected. Also renamed __release__ to Release.
4787 expected. Also renamed __release__ to Release.
4782
4788
4783 * IPython/Debugger.py (__license__): created new Pdb class which
4789 * IPython/Debugger.py (__license__): created new Pdb class which
4784 functions like a drop-in for the normal pdb.Pdb but does NOT
4790 functions like a drop-in for the normal pdb.Pdb but does NOT
4785 import readline by default. This way it doesn't muck up IPython's
4791 import readline by default. This way it doesn't muck up IPython's
4786 readline handling, and now tab-completion finally works in the
4792 readline handling, and now tab-completion finally works in the
4787 debugger -- sort of. It completes things globally visible, but the
4793 debugger -- sort of. It completes things globally visible, but the
4788 completer doesn't track the stack as pdb walks it. That's a bit
4794 completer doesn't track the stack as pdb walks it. That's a bit
4789 tricky, and I'll have to implement it later.
4795 tricky, and I'll have to implement it later.
4790
4796
4791 2002-05-05 Fernando Perez <fperez@colorado.edu>
4797 2002-05-05 Fernando Perez <fperez@colorado.edu>
4792
4798
4793 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4799 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4794 magic docstrings when printed via ? (explicit \'s were being
4800 magic docstrings when printed via ? (explicit \'s were being
4795 printed).
4801 printed).
4796
4802
4797 * IPython/ipmaker.py (make_IPython): fixed namespace
4803 * IPython/ipmaker.py (make_IPython): fixed namespace
4798 identification bug. Now variables loaded via logs or command-line
4804 identification bug. Now variables loaded via logs or command-line
4799 files are recognized in the interactive namespace by @who.
4805 files are recognized in the interactive namespace by @who.
4800
4806
4801 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4807 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4802 log replay system stemming from the string form of Structs.
4808 log replay system stemming from the string form of Structs.
4803
4809
4804 * IPython/Magic.py (Macro.__init__): improved macros to properly
4810 * IPython/Magic.py (Macro.__init__): improved macros to properly
4805 handle magic commands in them.
4811 handle magic commands in them.
4806 (Magic.magic_logstart): usernames are now expanded so 'logstart
4812 (Magic.magic_logstart): usernames are now expanded so 'logstart
4807 ~/mylog' now works.
4813 ~/mylog' now works.
4808
4814
4809 * IPython/iplib.py (complete): fixed bug where paths starting with
4815 * IPython/iplib.py (complete): fixed bug where paths starting with
4810 '/' would be completed as magic names.
4816 '/' would be completed as magic names.
4811
4817
4812 2002-05-04 Fernando Perez <fperez@colorado.edu>
4818 2002-05-04 Fernando Perez <fperez@colorado.edu>
4813
4819
4814 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4820 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4815 allow running full programs under the profiler's control.
4821 allow running full programs under the profiler's control.
4816
4822
4817 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4823 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4818 mode to report exceptions verbosely but without formatting
4824 mode to report exceptions verbosely but without formatting
4819 variables. This addresses the issue of ipython 'freezing' (it's
4825 variables. This addresses the issue of ipython 'freezing' (it's
4820 not frozen, but caught in an expensive formatting loop) when huge
4826 not frozen, but caught in an expensive formatting loop) when huge
4821 variables are in the context of an exception.
4827 variables are in the context of an exception.
4822 (VerboseTB.text): Added '--->' markers at line where exception was
4828 (VerboseTB.text): Added '--->' markers at line where exception was
4823 triggered. Much clearer to read, especially in NoColor modes.
4829 triggered. Much clearer to read, especially in NoColor modes.
4824
4830
4825 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4831 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4826 implemented in reverse when changing to the new parse_options().
4832 implemented in reverse when changing to the new parse_options().
4827
4833
4828 2002-05-03 Fernando Perez <fperez@colorado.edu>
4834 2002-05-03 Fernando Perez <fperez@colorado.edu>
4829
4835
4830 * IPython/Magic.py (Magic.parse_options): new function so that
4836 * IPython/Magic.py (Magic.parse_options): new function so that
4831 magics can parse options easier.
4837 magics can parse options easier.
4832 (Magic.magic_prun): new function similar to profile.run(),
4838 (Magic.magic_prun): new function similar to profile.run(),
4833 suggested by Chris Hart.
4839 suggested by Chris Hart.
4834 (Magic.magic_cd): fixed behavior so that it only changes if
4840 (Magic.magic_cd): fixed behavior so that it only changes if
4835 directory actually is in history.
4841 directory actually is in history.
4836
4842
4837 * IPython/usage.py (__doc__): added information about potential
4843 * IPython/usage.py (__doc__): added information about potential
4838 slowness of Verbose exception mode when there are huge data
4844 slowness of Verbose exception mode when there are huge data
4839 structures to be formatted (thanks to Archie Paulson).
4845 structures to be formatted (thanks to Archie Paulson).
4840
4846
4841 * IPython/ipmaker.py (make_IPython): Changed default logging
4847 * IPython/ipmaker.py (make_IPython): Changed default logging
4842 (when simply called with -log) to use curr_dir/ipython.log in
4848 (when simply called with -log) to use curr_dir/ipython.log in
4843 rotate mode. Fixed crash which was occuring with -log before
4849 rotate mode. Fixed crash which was occuring with -log before
4844 (thanks to Jim Boyle).
4850 (thanks to Jim Boyle).
4845
4851
4846 2002-05-01 Fernando Perez <fperez@colorado.edu>
4852 2002-05-01 Fernando Perez <fperez@colorado.edu>
4847
4853
4848 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4854 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4849 was nasty -- though somewhat of a corner case).
4855 was nasty -- though somewhat of a corner case).
4850
4856
4851 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4857 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4852 text (was a bug).
4858 text (was a bug).
4853
4859
4854 2002-04-30 Fernando Perez <fperez@colorado.edu>
4860 2002-04-30 Fernando Perez <fperez@colorado.edu>
4855
4861
4856 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4862 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4857 a print after ^D or ^C from the user so that the In[] prompt
4863 a print after ^D or ^C from the user so that the In[] prompt
4858 doesn't over-run the gnuplot one.
4864 doesn't over-run the gnuplot one.
4859
4865
4860 2002-04-29 Fernando Perez <fperez@colorado.edu>
4866 2002-04-29 Fernando Perez <fperez@colorado.edu>
4861
4867
4862 * Released 0.2.10
4868 * Released 0.2.10
4863
4869
4864 * IPython/__release__.py (version): get date dynamically.
4870 * IPython/__release__.py (version): get date dynamically.
4865
4871
4866 * Misc. documentation updates thanks to Arnd's comments. Also ran
4872 * Misc. documentation updates thanks to Arnd's comments. Also ran
4867 a full spellcheck on the manual (hadn't been done in a while).
4873 a full spellcheck on the manual (hadn't been done in a while).
4868
4874
4869 2002-04-27 Fernando Perez <fperez@colorado.edu>
4875 2002-04-27 Fernando Perez <fperez@colorado.edu>
4870
4876
4871 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4877 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4872 starting a log in mid-session would reset the input history list.
4878 starting a log in mid-session would reset the input history list.
4873
4879
4874 2002-04-26 Fernando Perez <fperez@colorado.edu>
4880 2002-04-26 Fernando Perez <fperez@colorado.edu>
4875
4881
4876 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4882 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4877 all files were being included in an update. Now anything in
4883 all files were being included in an update. Now anything in
4878 UserConfig that matches [A-Za-z]*.py will go (this excludes
4884 UserConfig that matches [A-Za-z]*.py will go (this excludes
4879 __init__.py)
4885 __init__.py)
4880
4886
4881 2002-04-25 Fernando Perez <fperez@colorado.edu>
4887 2002-04-25 Fernando Perez <fperez@colorado.edu>
4882
4888
4883 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4889 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4884 to __builtins__ so that any form of embedded or imported code can
4890 to __builtins__ so that any form of embedded or imported code can
4885 test for being inside IPython.
4891 test for being inside IPython.
4886
4892
4887 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4893 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4888 changed to GnuplotMagic because it's now an importable module,
4894 changed to GnuplotMagic because it's now an importable module,
4889 this makes the name follow that of the standard Gnuplot module.
4895 this makes the name follow that of the standard Gnuplot module.
4890 GnuplotMagic can now be loaded at any time in mid-session.
4896 GnuplotMagic can now be loaded at any time in mid-session.
4891
4897
4892 2002-04-24 Fernando Perez <fperez@colorado.edu>
4898 2002-04-24 Fernando Perez <fperez@colorado.edu>
4893
4899
4894 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4900 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4895 the globals (IPython has its own namespace) and the
4901 the globals (IPython has its own namespace) and the
4896 PhysicalQuantity stuff is much better anyway.
4902 PhysicalQuantity stuff is much better anyway.
4897
4903
4898 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4904 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4899 embedding example to standard user directory for
4905 embedding example to standard user directory for
4900 distribution. Also put it in the manual.
4906 distribution. Also put it in the manual.
4901
4907
4902 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4908 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4903 instance as first argument (so it doesn't rely on some obscure
4909 instance as first argument (so it doesn't rely on some obscure
4904 hidden global).
4910 hidden global).
4905
4911
4906 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4912 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4907 delimiters. While it prevents ().TAB from working, it allows
4913 delimiters. While it prevents ().TAB from working, it allows
4908 completions in open (... expressions. This is by far a more common
4914 completions in open (... expressions. This is by far a more common
4909 case.
4915 case.
4910
4916
4911 2002-04-23 Fernando Perez <fperez@colorado.edu>
4917 2002-04-23 Fernando Perez <fperez@colorado.edu>
4912
4918
4913 * IPython/Extensions/InterpreterPasteInput.py: new
4919 * IPython/Extensions/InterpreterPasteInput.py: new
4914 syntax-processing module for pasting lines with >>> or ... at the
4920 syntax-processing module for pasting lines with >>> or ... at the
4915 start.
4921 start.
4916
4922
4917 * IPython/Extensions/PhysicalQ_Interactive.py
4923 * IPython/Extensions/PhysicalQ_Interactive.py
4918 (PhysicalQuantityInteractive.__int__): fixed to work with either
4924 (PhysicalQuantityInteractive.__int__): fixed to work with either
4919 Numeric or math.
4925 Numeric or math.
4920
4926
4921 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4927 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4922 provided profiles. Now we have:
4928 provided profiles. Now we have:
4923 -math -> math module as * and cmath with its own namespace.
4929 -math -> math module as * and cmath with its own namespace.
4924 -numeric -> Numeric as *, plus gnuplot & grace
4930 -numeric -> Numeric as *, plus gnuplot & grace
4925 -physics -> same as before
4931 -physics -> same as before
4926
4932
4927 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4933 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4928 user-defined magics wouldn't be found by @magic if they were
4934 user-defined magics wouldn't be found by @magic if they were
4929 defined as class methods. Also cleaned up the namespace search
4935 defined as class methods. Also cleaned up the namespace search
4930 logic and the string building (to use %s instead of many repeated
4936 logic and the string building (to use %s instead of many repeated
4931 string adds).
4937 string adds).
4932
4938
4933 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4939 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4934 of user-defined magics to operate with class methods (cleaner, in
4940 of user-defined magics to operate with class methods (cleaner, in
4935 line with the gnuplot code).
4941 line with the gnuplot code).
4936
4942
4937 2002-04-22 Fernando Perez <fperez@colorado.edu>
4943 2002-04-22 Fernando Perez <fperez@colorado.edu>
4938
4944
4939 * setup.py: updated dependency list so that manual is updated when
4945 * setup.py: updated dependency list so that manual is updated when
4940 all included files change.
4946 all included files change.
4941
4947
4942 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4948 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4943 the delimiter removal option (the fix is ugly right now).
4949 the delimiter removal option (the fix is ugly right now).
4944
4950
4945 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4951 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4946 all of the math profile (quicker loading, no conflict between
4952 all of the math profile (quicker loading, no conflict between
4947 g-9.8 and g-gnuplot).
4953 g-9.8 and g-gnuplot).
4948
4954
4949 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4955 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4950 name of post-mortem files to IPython_crash_report.txt.
4956 name of post-mortem files to IPython_crash_report.txt.
4951
4957
4952 * Cleanup/update of the docs. Added all the new readline info and
4958 * Cleanup/update of the docs. Added all the new readline info and
4953 formatted all lists as 'real lists'.
4959 formatted all lists as 'real lists'.
4954
4960
4955 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4961 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4956 tab-completion options, since the full readline parse_and_bind is
4962 tab-completion options, since the full readline parse_and_bind is
4957 now accessible.
4963 now accessible.
4958
4964
4959 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4965 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4960 handling of readline options. Now users can specify any string to
4966 handling of readline options. Now users can specify any string to
4961 be passed to parse_and_bind(), as well as the delimiters to be
4967 be passed to parse_and_bind(), as well as the delimiters to be
4962 removed.
4968 removed.
4963 (InteractiveShell.__init__): Added __name__ to the global
4969 (InteractiveShell.__init__): Added __name__ to the global
4964 namespace so that things like Itpl which rely on its existence
4970 namespace so that things like Itpl which rely on its existence
4965 don't crash.
4971 don't crash.
4966 (InteractiveShell._prefilter): Defined the default with a _ so
4972 (InteractiveShell._prefilter): Defined the default with a _ so
4967 that prefilter() is easier to override, while the default one
4973 that prefilter() is easier to override, while the default one
4968 remains available.
4974 remains available.
4969
4975
4970 2002-04-18 Fernando Perez <fperez@colorado.edu>
4976 2002-04-18 Fernando Perez <fperez@colorado.edu>
4971
4977
4972 * Added information about pdb in the docs.
4978 * Added information about pdb in the docs.
4973
4979
4974 2002-04-17 Fernando Perez <fperez@colorado.edu>
4980 2002-04-17 Fernando Perez <fperez@colorado.edu>
4975
4981
4976 * IPython/ipmaker.py (make_IPython): added rc_override option to
4982 * IPython/ipmaker.py (make_IPython): added rc_override option to
4977 allow passing config options at creation time which may override
4983 allow passing config options at creation time which may override
4978 anything set in the config files or command line. This is
4984 anything set in the config files or command line. This is
4979 particularly useful for configuring embedded instances.
4985 particularly useful for configuring embedded instances.
4980
4986
4981 2002-04-15 Fernando Perez <fperez@colorado.edu>
4987 2002-04-15 Fernando Perez <fperez@colorado.edu>
4982
4988
4983 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4989 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4984 crash embedded instances because of the input cache falling out of
4990 crash embedded instances because of the input cache falling out of
4985 sync with the output counter.
4991 sync with the output counter.
4986
4992
4987 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4993 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4988 mode which calls pdb after an uncaught exception in IPython itself.
4994 mode which calls pdb after an uncaught exception in IPython itself.
4989
4995
4990 2002-04-14 Fernando Perez <fperez@colorado.edu>
4996 2002-04-14 Fernando Perez <fperez@colorado.edu>
4991
4997
4992 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4998 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4993 readline, fix it back after each call.
4999 readline, fix it back after each call.
4994
5000
4995 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5001 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4996 method to force all access via __call__(), which guarantees that
5002 method to force all access via __call__(), which guarantees that
4997 traceback references are properly deleted.
5003 traceback references are properly deleted.
4998
5004
4999 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5005 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5000 improve printing when pprint is in use.
5006 improve printing when pprint is in use.
5001
5007
5002 2002-04-13 Fernando Perez <fperez@colorado.edu>
5008 2002-04-13 Fernando Perez <fperez@colorado.edu>
5003
5009
5004 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5010 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5005 exceptions aren't caught anymore. If the user triggers one, he
5011 exceptions aren't caught anymore. If the user triggers one, he
5006 should know why he's doing it and it should go all the way up,
5012 should know why he's doing it and it should go all the way up,
5007 just like any other exception. So now @abort will fully kill the
5013 just like any other exception. So now @abort will fully kill the
5008 embedded interpreter and the embedding code (unless that happens
5014 embedded interpreter and the embedding code (unless that happens
5009 to catch SystemExit).
5015 to catch SystemExit).
5010
5016
5011 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5017 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5012 and a debugger() method to invoke the interactive pdb debugger
5018 and a debugger() method to invoke the interactive pdb debugger
5013 after printing exception information. Also added the corresponding
5019 after printing exception information. Also added the corresponding
5014 -pdb option and @pdb magic to control this feature, and updated
5020 -pdb option and @pdb magic to control this feature, and updated
5015 the docs. After a suggestion from Christopher Hart
5021 the docs. After a suggestion from Christopher Hart
5016 (hart-AT-caltech.edu).
5022 (hart-AT-caltech.edu).
5017
5023
5018 2002-04-12 Fernando Perez <fperez@colorado.edu>
5024 2002-04-12 Fernando Perez <fperez@colorado.edu>
5019
5025
5020 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5026 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5021 the exception handlers defined by the user (not the CrashHandler)
5027 the exception handlers defined by the user (not the CrashHandler)
5022 so that user exceptions don't trigger an ipython bug report.
5028 so that user exceptions don't trigger an ipython bug report.
5023
5029
5024 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5030 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5025 configurable (it should have always been so).
5031 configurable (it should have always been so).
5026
5032
5027 2002-03-26 Fernando Perez <fperez@colorado.edu>
5033 2002-03-26 Fernando Perez <fperez@colorado.edu>
5028
5034
5029 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5035 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5030 and there to fix embedding namespace issues. This should all be
5036 and there to fix embedding namespace issues. This should all be
5031 done in a more elegant way.
5037 done in a more elegant way.
5032
5038
5033 2002-03-25 Fernando Perez <fperez@colorado.edu>
5039 2002-03-25 Fernando Perez <fperez@colorado.edu>
5034
5040
5035 * IPython/genutils.py (get_home_dir): Try to make it work under
5041 * IPython/genutils.py (get_home_dir): Try to make it work under
5036 win9x also.
5042 win9x also.
5037
5043
5038 2002-03-20 Fernando Perez <fperez@colorado.edu>
5044 2002-03-20 Fernando Perez <fperez@colorado.edu>
5039
5045
5040 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5046 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5041 sys.displayhook untouched upon __init__.
5047 sys.displayhook untouched upon __init__.
5042
5048
5043 2002-03-19 Fernando Perez <fperez@colorado.edu>
5049 2002-03-19 Fernando Perez <fperez@colorado.edu>
5044
5050
5045 * Released 0.2.9 (for embedding bug, basically).
5051 * Released 0.2.9 (for embedding bug, basically).
5046
5052
5047 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5053 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5048 exceptions so that enclosing shell's state can be restored.
5054 exceptions so that enclosing shell's state can be restored.
5049
5055
5050 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5056 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5051 naming conventions in the .ipython/ dir.
5057 naming conventions in the .ipython/ dir.
5052
5058
5053 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5059 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5054 from delimiters list so filenames with - in them get expanded.
5060 from delimiters list so filenames with - in them get expanded.
5055
5061
5056 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5062 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5057 sys.displayhook not being properly restored after an embedded call.
5063 sys.displayhook not being properly restored after an embedded call.
5058
5064
5059 2002-03-18 Fernando Perez <fperez@colorado.edu>
5065 2002-03-18 Fernando Perez <fperez@colorado.edu>
5060
5066
5061 * Released 0.2.8
5067 * Released 0.2.8
5062
5068
5063 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5069 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5064 some files weren't being included in a -upgrade.
5070 some files weren't being included in a -upgrade.
5065 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5071 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5066 on' so that the first tab completes.
5072 on' so that the first tab completes.
5067 (InteractiveShell.handle_magic): fixed bug with spaces around
5073 (InteractiveShell.handle_magic): fixed bug with spaces around
5068 quotes breaking many magic commands.
5074 quotes breaking many magic commands.
5069
5075
5070 * setup.py: added note about ignoring the syntax error messages at
5076 * setup.py: added note about ignoring the syntax error messages at
5071 installation.
5077 installation.
5072
5078
5073 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5079 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5074 streamlining the gnuplot interface, now there's only one magic @gp.
5080 streamlining the gnuplot interface, now there's only one magic @gp.
5075
5081
5076 2002-03-17 Fernando Perez <fperez@colorado.edu>
5082 2002-03-17 Fernando Perez <fperez@colorado.edu>
5077
5083
5078 * IPython/UserConfig/magic_gnuplot.py: new name for the
5084 * IPython/UserConfig/magic_gnuplot.py: new name for the
5079 example-magic_pm.py file. Much enhanced system, now with a shell
5085 example-magic_pm.py file. Much enhanced system, now with a shell
5080 for communicating directly with gnuplot, one command at a time.
5086 for communicating directly with gnuplot, one command at a time.
5081
5087
5082 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5088 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5083 setting __name__=='__main__'.
5089 setting __name__=='__main__'.
5084
5090
5085 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5091 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5086 mini-shell for accessing gnuplot from inside ipython. Should
5092 mini-shell for accessing gnuplot from inside ipython. Should
5087 extend it later for grace access too. Inspired by Arnd's
5093 extend it later for grace access too. Inspired by Arnd's
5088 suggestion.
5094 suggestion.
5089
5095
5090 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5096 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5091 calling magic functions with () in their arguments. Thanks to Arnd
5097 calling magic functions with () in their arguments. Thanks to Arnd
5092 Baecker for pointing this to me.
5098 Baecker for pointing this to me.
5093
5099
5094 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5100 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5095 infinitely for integer or complex arrays (only worked with floats).
5101 infinitely for integer or complex arrays (only worked with floats).
5096
5102
5097 2002-03-16 Fernando Perez <fperez@colorado.edu>
5103 2002-03-16 Fernando Perez <fperez@colorado.edu>
5098
5104
5099 * setup.py: Merged setup and setup_windows into a single script
5105 * setup.py: Merged setup and setup_windows into a single script
5100 which properly handles things for windows users.
5106 which properly handles things for windows users.
5101
5107
5102 2002-03-15 Fernando Perez <fperez@colorado.edu>
5108 2002-03-15 Fernando Perez <fperez@colorado.edu>
5103
5109
5104 * Big change to the manual: now the magics are all automatically
5110 * Big change to the manual: now the magics are all automatically
5105 documented. This information is generated from their docstrings
5111 documented. This information is generated from their docstrings
5106 and put in a latex file included by the manual lyx file. This way
5112 and put in a latex file included by the manual lyx file. This way
5107 we get always up to date information for the magics. The manual
5113 we get always up to date information for the magics. The manual
5108 now also has proper version information, also auto-synced.
5114 now also has proper version information, also auto-synced.
5109
5115
5110 For this to work, an undocumented --magic_docstrings option was added.
5116 For this to work, an undocumented --magic_docstrings option was added.
5111
5117
5112 2002-03-13 Fernando Perez <fperez@colorado.edu>
5118 2002-03-13 Fernando Perez <fperez@colorado.edu>
5113
5119
5114 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5120 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5115 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5121 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5116
5122
5117 2002-03-12 Fernando Perez <fperez@colorado.edu>
5123 2002-03-12 Fernando Perez <fperez@colorado.edu>
5118
5124
5119 * IPython/ultraTB.py (TermColors): changed color escapes again to
5125 * IPython/ultraTB.py (TermColors): changed color escapes again to
5120 fix the (old, reintroduced) line-wrapping bug. Basically, if
5126 fix the (old, reintroduced) line-wrapping bug. Basically, if
5121 \001..\002 aren't given in the color escapes, lines get wrapped
5127 \001..\002 aren't given in the color escapes, lines get wrapped
5122 weirdly. But giving those screws up old xterms and emacs terms. So
5128 weirdly. But giving those screws up old xterms and emacs terms. So
5123 I added some logic for emacs terms to be ok, but I can't identify old
5129 I added some logic for emacs terms to be ok, but I can't identify old
5124 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5130 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5125
5131
5126 2002-03-10 Fernando Perez <fperez@colorado.edu>
5132 2002-03-10 Fernando Perez <fperez@colorado.edu>
5127
5133
5128 * IPython/usage.py (__doc__): Various documentation cleanups and
5134 * IPython/usage.py (__doc__): Various documentation cleanups and
5129 updates, both in usage docstrings and in the manual.
5135 updates, both in usage docstrings and in the manual.
5130
5136
5131 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5137 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5132 handling of caching. Set minimum acceptabe value for having a
5138 handling of caching. Set minimum acceptabe value for having a
5133 cache at 20 values.
5139 cache at 20 values.
5134
5140
5135 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5141 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5136 install_first_time function to a method, renamed it and added an
5142 install_first_time function to a method, renamed it and added an
5137 'upgrade' mode. Now people can update their config directory with
5143 'upgrade' mode. Now people can update their config directory with
5138 a simple command line switch (-upgrade, also new).
5144 a simple command line switch (-upgrade, also new).
5139
5145
5140 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5146 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5141 @file (convenient for automagic users under Python >= 2.2).
5147 @file (convenient for automagic users under Python >= 2.2).
5142 Removed @files (it seemed more like a plural than an abbrev. of
5148 Removed @files (it seemed more like a plural than an abbrev. of
5143 'file show').
5149 'file show').
5144
5150
5145 * IPython/iplib.py (install_first_time): Fixed crash if there were
5151 * IPython/iplib.py (install_first_time): Fixed crash if there were
5146 backup files ('~') in .ipython/ install directory.
5152 backup files ('~') in .ipython/ install directory.
5147
5153
5148 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5154 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5149 system. Things look fine, but these changes are fairly
5155 system. Things look fine, but these changes are fairly
5150 intrusive. Test them for a few days.
5156 intrusive. Test them for a few days.
5151
5157
5152 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5158 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5153 the prompts system. Now all in/out prompt strings are user
5159 the prompts system. Now all in/out prompt strings are user
5154 controllable. This is particularly useful for embedding, as one
5160 controllable. This is particularly useful for embedding, as one
5155 can tag embedded instances with particular prompts.
5161 can tag embedded instances with particular prompts.
5156
5162
5157 Also removed global use of sys.ps1/2, which now allows nested
5163 Also removed global use of sys.ps1/2, which now allows nested
5158 embeddings without any problems. Added command-line options for
5164 embeddings without any problems. Added command-line options for
5159 the prompt strings.
5165 the prompt strings.
5160
5166
5161 2002-03-08 Fernando Perez <fperez@colorado.edu>
5167 2002-03-08 Fernando Perez <fperez@colorado.edu>
5162
5168
5163 * IPython/UserConfig/example-embed-short.py (ipshell): added
5169 * IPython/UserConfig/example-embed-short.py (ipshell): added
5164 example file with the bare minimum code for embedding.
5170 example file with the bare minimum code for embedding.
5165
5171
5166 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5172 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5167 functionality for the embeddable shell to be activated/deactivated
5173 functionality for the embeddable shell to be activated/deactivated
5168 either globally or at each call.
5174 either globally or at each call.
5169
5175
5170 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5176 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5171 rewriting the prompt with '--->' for auto-inputs with proper
5177 rewriting the prompt with '--->' for auto-inputs with proper
5172 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5178 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5173 this is handled by the prompts class itself, as it should.
5179 this is handled by the prompts class itself, as it should.
5174
5180
5175 2002-03-05 Fernando Perez <fperez@colorado.edu>
5181 2002-03-05 Fernando Perez <fperez@colorado.edu>
5176
5182
5177 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5183 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5178 @logstart to avoid name clashes with the math log function.
5184 @logstart to avoid name clashes with the math log function.
5179
5185
5180 * Big updates to X/Emacs section of the manual.
5186 * Big updates to X/Emacs section of the manual.
5181
5187
5182 * Removed ipython_emacs. Milan explained to me how to pass
5188 * Removed ipython_emacs. Milan explained to me how to pass
5183 arguments to ipython through Emacs. Some day I'm going to end up
5189 arguments to ipython through Emacs. Some day I'm going to end up
5184 learning some lisp...
5190 learning some lisp...
5185
5191
5186 2002-03-04 Fernando Perez <fperez@colorado.edu>
5192 2002-03-04 Fernando Perez <fperez@colorado.edu>
5187
5193
5188 * IPython/ipython_emacs: Created script to be used as the
5194 * IPython/ipython_emacs: Created script to be used as the
5189 py-python-command Emacs variable so we can pass IPython
5195 py-python-command Emacs variable so we can pass IPython
5190 parameters. I can't figure out how to tell Emacs directly to pass
5196 parameters. I can't figure out how to tell Emacs directly to pass
5191 parameters to IPython, so a dummy shell script will do it.
5197 parameters to IPython, so a dummy shell script will do it.
5192
5198
5193 Other enhancements made for things to work better under Emacs'
5199 Other enhancements made for things to work better under Emacs'
5194 various types of terminals. Many thanks to Milan Zamazal
5200 various types of terminals. Many thanks to Milan Zamazal
5195 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5201 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5196
5202
5197 2002-03-01 Fernando Perez <fperez@colorado.edu>
5203 2002-03-01 Fernando Perez <fperez@colorado.edu>
5198
5204
5199 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5205 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5200 that loading of readline is now optional. This gives better
5206 that loading of readline is now optional. This gives better
5201 control to emacs users.
5207 control to emacs users.
5202
5208
5203 * IPython/ultraTB.py (__date__): Modified color escape sequences
5209 * IPython/ultraTB.py (__date__): Modified color escape sequences
5204 and now things work fine under xterm and in Emacs' term buffers
5210 and now things work fine under xterm and in Emacs' term buffers
5205 (though not shell ones). Well, in emacs you get colors, but all
5211 (though not shell ones). Well, in emacs you get colors, but all
5206 seem to be 'light' colors (no difference between dark and light
5212 seem to be 'light' colors (no difference between dark and light
5207 ones). But the garbage chars are gone, and also in xterms. It
5213 ones). But the garbage chars are gone, and also in xterms. It
5208 seems that now I'm using 'cleaner' ansi sequences.
5214 seems that now I'm using 'cleaner' ansi sequences.
5209
5215
5210 2002-02-21 Fernando Perez <fperez@colorado.edu>
5216 2002-02-21 Fernando Perez <fperez@colorado.edu>
5211
5217
5212 * Released 0.2.7 (mainly to publish the scoping fix).
5218 * Released 0.2.7 (mainly to publish the scoping fix).
5213
5219
5214 * IPython/Logger.py (Logger.logstate): added. A corresponding
5220 * IPython/Logger.py (Logger.logstate): added. A corresponding
5215 @logstate magic was created.
5221 @logstate magic was created.
5216
5222
5217 * IPython/Magic.py: fixed nested scoping problem under Python
5223 * IPython/Magic.py: fixed nested scoping problem under Python
5218 2.1.x (automagic wasn't working).
5224 2.1.x (automagic wasn't working).
5219
5225
5220 2002-02-20 Fernando Perez <fperez@colorado.edu>
5226 2002-02-20 Fernando Perez <fperez@colorado.edu>
5221
5227
5222 * Released 0.2.6.
5228 * Released 0.2.6.
5223
5229
5224 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5230 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5225 option so that logs can come out without any headers at all.
5231 option so that logs can come out without any headers at all.
5226
5232
5227 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5233 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5228 SciPy.
5234 SciPy.
5229
5235
5230 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5236 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5231 that embedded IPython calls don't require vars() to be explicitly
5237 that embedded IPython calls don't require vars() to be explicitly
5232 passed. Now they are extracted from the caller's frame (code
5238 passed. Now they are extracted from the caller's frame (code
5233 snatched from Eric Jones' weave). Added better documentation to
5239 snatched from Eric Jones' weave). Added better documentation to
5234 the section on embedding and the example file.
5240 the section on embedding and the example file.
5235
5241
5236 * IPython/genutils.py (page): Changed so that under emacs, it just
5242 * IPython/genutils.py (page): Changed so that under emacs, it just
5237 prints the string. You can then page up and down in the emacs
5243 prints the string. You can then page up and down in the emacs
5238 buffer itself. This is how the builtin help() works.
5244 buffer itself. This is how the builtin help() works.
5239
5245
5240 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5246 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5241 macro scoping: macros need to be executed in the user's namespace
5247 macro scoping: macros need to be executed in the user's namespace
5242 to work as if they had been typed by the user.
5248 to work as if they had been typed by the user.
5243
5249
5244 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5250 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5245 execute automatically (no need to type 'exec...'). They then
5251 execute automatically (no need to type 'exec...'). They then
5246 behave like 'true macros'. The printing system was also modified
5252 behave like 'true macros'. The printing system was also modified
5247 for this to work.
5253 for this to work.
5248
5254
5249 2002-02-19 Fernando Perez <fperez@colorado.edu>
5255 2002-02-19 Fernando Perez <fperez@colorado.edu>
5250
5256
5251 * IPython/genutils.py (page_file): new function for paging files
5257 * IPython/genutils.py (page_file): new function for paging files
5252 in an OS-independent way. Also necessary for file viewing to work
5258 in an OS-independent way. Also necessary for file viewing to work
5253 well inside Emacs buffers.
5259 well inside Emacs buffers.
5254 (page): Added checks for being in an emacs buffer.
5260 (page): Added checks for being in an emacs buffer.
5255 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5261 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5256 same bug in iplib.
5262 same bug in iplib.
5257
5263
5258 2002-02-18 Fernando Perez <fperez@colorado.edu>
5264 2002-02-18 Fernando Perez <fperez@colorado.edu>
5259
5265
5260 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5266 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5261 of readline so that IPython can work inside an Emacs buffer.
5267 of readline so that IPython can work inside an Emacs buffer.
5262
5268
5263 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5269 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5264 method signatures (they weren't really bugs, but it looks cleaner
5270 method signatures (they weren't really bugs, but it looks cleaner
5265 and keeps PyChecker happy).
5271 and keeps PyChecker happy).
5266
5272
5267 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5273 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5268 for implementing various user-defined hooks. Currently only
5274 for implementing various user-defined hooks. Currently only
5269 display is done.
5275 display is done.
5270
5276
5271 * IPython/Prompts.py (CachedOutput._display): changed display
5277 * IPython/Prompts.py (CachedOutput._display): changed display
5272 functions so that they can be dynamically changed by users easily.
5278 functions so that they can be dynamically changed by users easily.
5273
5279
5274 * IPython/Extensions/numeric_formats.py (num_display): added an
5280 * IPython/Extensions/numeric_formats.py (num_display): added an
5275 extension for printing NumPy arrays in flexible manners. It
5281 extension for printing NumPy arrays in flexible manners. It
5276 doesn't do anything yet, but all the structure is in
5282 doesn't do anything yet, but all the structure is in
5277 place. Ultimately the plan is to implement output format control
5283 place. Ultimately the plan is to implement output format control
5278 like in Octave.
5284 like in Octave.
5279
5285
5280 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5286 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5281 methods are found at run-time by all the automatic machinery.
5287 methods are found at run-time by all the automatic machinery.
5282
5288
5283 2002-02-17 Fernando Perez <fperez@colorado.edu>
5289 2002-02-17 Fernando Perez <fperez@colorado.edu>
5284
5290
5285 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5291 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5286 whole file a little.
5292 whole file a little.
5287
5293
5288 * ToDo: closed this document. Now there's a new_design.lyx
5294 * ToDo: closed this document. Now there's a new_design.lyx
5289 document for all new ideas. Added making a pdf of it for the
5295 document for all new ideas. Added making a pdf of it for the
5290 end-user distro.
5296 end-user distro.
5291
5297
5292 * IPython/Logger.py (Logger.switch_log): Created this to replace
5298 * IPython/Logger.py (Logger.switch_log): Created this to replace
5293 logon() and logoff(). It also fixes a nasty crash reported by
5299 logon() and logoff(). It also fixes a nasty crash reported by
5294 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5300 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5295
5301
5296 * IPython/iplib.py (complete): got auto-completion to work with
5302 * IPython/iplib.py (complete): got auto-completion to work with
5297 automagic (I had wanted this for a long time).
5303 automagic (I had wanted this for a long time).
5298
5304
5299 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5305 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5300 to @file, since file() is now a builtin and clashes with automagic
5306 to @file, since file() is now a builtin and clashes with automagic
5301 for @file.
5307 for @file.
5302
5308
5303 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5309 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5304 of this was previously in iplib, which had grown to more than 2000
5310 of this was previously in iplib, which had grown to more than 2000
5305 lines, way too long. No new functionality, but it makes managing
5311 lines, way too long. No new functionality, but it makes managing
5306 the code a bit easier.
5312 the code a bit easier.
5307
5313
5308 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5314 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5309 information to crash reports.
5315 information to crash reports.
5310
5316
5311 2002-02-12 Fernando Perez <fperez@colorado.edu>
5317 2002-02-12 Fernando Perez <fperez@colorado.edu>
5312
5318
5313 * Released 0.2.5.
5319 * Released 0.2.5.
5314
5320
5315 2002-02-11 Fernando Perez <fperez@colorado.edu>
5321 2002-02-11 Fernando Perez <fperez@colorado.edu>
5316
5322
5317 * Wrote a relatively complete Windows installer. It puts
5323 * Wrote a relatively complete Windows installer. It puts
5318 everything in place, creates Start Menu entries and fixes the
5324 everything in place, creates Start Menu entries and fixes the
5319 color issues. Nothing fancy, but it works.
5325 color issues. Nothing fancy, but it works.
5320
5326
5321 2002-02-10 Fernando Perez <fperez@colorado.edu>
5327 2002-02-10 Fernando Perez <fperez@colorado.edu>
5322
5328
5323 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5329 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5324 os.path.expanduser() call so that we can type @run ~/myfile.py and
5330 os.path.expanduser() call so that we can type @run ~/myfile.py and
5325 have thigs work as expected.
5331 have thigs work as expected.
5326
5332
5327 * IPython/genutils.py (page): fixed exception handling so things
5333 * IPython/genutils.py (page): fixed exception handling so things
5328 work both in Unix and Windows correctly. Quitting a pager triggers
5334 work both in Unix and Windows correctly. Quitting a pager triggers
5329 an IOError/broken pipe in Unix, and in windows not finding a pager
5335 an IOError/broken pipe in Unix, and in windows not finding a pager
5330 is also an IOError, so I had to actually look at the return value
5336 is also an IOError, so I had to actually look at the return value
5331 of the exception, not just the exception itself. Should be ok now.
5337 of the exception, not just the exception itself. Should be ok now.
5332
5338
5333 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5339 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5334 modified to allow case-insensitive color scheme changes.
5340 modified to allow case-insensitive color scheme changes.
5335
5341
5336 2002-02-09 Fernando Perez <fperez@colorado.edu>
5342 2002-02-09 Fernando Perez <fperez@colorado.edu>
5337
5343
5338 * IPython/genutils.py (native_line_ends): new function to leave
5344 * IPython/genutils.py (native_line_ends): new function to leave
5339 user config files with os-native line-endings.
5345 user config files with os-native line-endings.
5340
5346
5341 * README and manual updates.
5347 * README and manual updates.
5342
5348
5343 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5349 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5344 instead of StringType to catch Unicode strings.
5350 instead of StringType to catch Unicode strings.
5345
5351
5346 * IPython/genutils.py (filefind): fixed bug for paths with
5352 * IPython/genutils.py (filefind): fixed bug for paths with
5347 embedded spaces (very common in Windows).
5353 embedded spaces (very common in Windows).
5348
5354
5349 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5355 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5350 files under Windows, so that they get automatically associated
5356 files under Windows, so that they get automatically associated
5351 with a text editor. Windows makes it a pain to handle
5357 with a text editor. Windows makes it a pain to handle
5352 extension-less files.
5358 extension-less files.
5353
5359
5354 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5360 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5355 warning about readline only occur for Posix. In Windows there's no
5361 warning about readline only occur for Posix. In Windows there's no
5356 way to get readline, so why bother with the warning.
5362 way to get readline, so why bother with the warning.
5357
5363
5358 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5364 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5359 for __str__ instead of dir(self), since dir() changed in 2.2.
5365 for __str__ instead of dir(self), since dir() changed in 2.2.
5360
5366
5361 * Ported to Windows! Tested on XP, I suspect it should work fine
5367 * Ported to Windows! Tested on XP, I suspect it should work fine
5362 on NT/2000, but I don't think it will work on 98 et al. That
5368 on NT/2000, but I don't think it will work on 98 et al. That
5363 series of Windows is such a piece of junk anyway that I won't try
5369 series of Windows is such a piece of junk anyway that I won't try
5364 porting it there. The XP port was straightforward, showed a few
5370 porting it there. The XP port was straightforward, showed a few
5365 bugs here and there (fixed all), in particular some string
5371 bugs here and there (fixed all), in particular some string
5366 handling stuff which required considering Unicode strings (which
5372 handling stuff which required considering Unicode strings (which
5367 Windows uses). This is good, but hasn't been too tested :) No
5373 Windows uses). This is good, but hasn't been too tested :) No
5368 fancy installer yet, I'll put a note in the manual so people at
5374 fancy installer yet, I'll put a note in the manual so people at
5369 least make manually a shortcut.
5375 least make manually a shortcut.
5370
5376
5371 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5377 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5372 into a single one, "colors". This now controls both prompt and
5378 into a single one, "colors". This now controls both prompt and
5373 exception color schemes, and can be changed both at startup
5379 exception color schemes, and can be changed both at startup
5374 (either via command-line switches or via ipythonrc files) and at
5380 (either via command-line switches or via ipythonrc files) and at
5375 runtime, with @colors.
5381 runtime, with @colors.
5376 (Magic.magic_run): renamed @prun to @run and removed the old
5382 (Magic.magic_run): renamed @prun to @run and removed the old
5377 @run. The two were too similar to warrant keeping both.
5383 @run. The two were too similar to warrant keeping both.
5378
5384
5379 2002-02-03 Fernando Perez <fperez@colorado.edu>
5385 2002-02-03 Fernando Perez <fperez@colorado.edu>
5380
5386
5381 * IPython/iplib.py (install_first_time): Added comment on how to
5387 * IPython/iplib.py (install_first_time): Added comment on how to
5382 configure the color options for first-time users. Put a <return>
5388 configure the color options for first-time users. Put a <return>
5383 request at the end so that small-terminal users get a chance to
5389 request at the end so that small-terminal users get a chance to
5384 read the startup info.
5390 read the startup info.
5385
5391
5386 2002-01-23 Fernando Perez <fperez@colorado.edu>
5392 2002-01-23 Fernando Perez <fperez@colorado.edu>
5387
5393
5388 * IPython/iplib.py (CachedOutput.update): Changed output memory
5394 * IPython/iplib.py (CachedOutput.update): Changed output memory
5389 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5395 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5390 input history we still use _i. Did this b/c these variable are
5396 input history we still use _i. Did this b/c these variable are
5391 very commonly used in interactive work, so the less we need to
5397 very commonly used in interactive work, so the less we need to
5392 type the better off we are.
5398 type the better off we are.
5393 (Magic.magic_prun): updated @prun to better handle the namespaces
5399 (Magic.magic_prun): updated @prun to better handle the namespaces
5394 the file will run in, including a fix for __name__ not being set
5400 the file will run in, including a fix for __name__ not being set
5395 before.
5401 before.
5396
5402
5397 2002-01-20 Fernando Perez <fperez@colorado.edu>
5403 2002-01-20 Fernando Perez <fperez@colorado.edu>
5398
5404
5399 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5405 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5400 extra garbage for Python 2.2. Need to look more carefully into
5406 extra garbage for Python 2.2. Need to look more carefully into
5401 this later.
5407 this later.
5402
5408
5403 2002-01-19 Fernando Perez <fperez@colorado.edu>
5409 2002-01-19 Fernando Perez <fperez@colorado.edu>
5404
5410
5405 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5411 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5406 display SyntaxError exceptions properly formatted when they occur
5412 display SyntaxError exceptions properly formatted when they occur
5407 (they can be triggered by imported code).
5413 (they can be triggered by imported code).
5408
5414
5409 2002-01-18 Fernando Perez <fperez@colorado.edu>
5415 2002-01-18 Fernando Perez <fperez@colorado.edu>
5410
5416
5411 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5417 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5412 SyntaxError exceptions are reported nicely formatted, instead of
5418 SyntaxError exceptions are reported nicely formatted, instead of
5413 spitting out only offset information as before.
5419 spitting out only offset information as before.
5414 (Magic.magic_prun): Added the @prun function for executing
5420 (Magic.magic_prun): Added the @prun function for executing
5415 programs with command line args inside IPython.
5421 programs with command line args inside IPython.
5416
5422
5417 2002-01-16 Fernando Perez <fperez@colorado.edu>
5423 2002-01-16 Fernando Perez <fperez@colorado.edu>
5418
5424
5419 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5425 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5420 to *not* include the last item given in a range. This brings their
5426 to *not* include the last item given in a range. This brings their
5421 behavior in line with Python's slicing:
5427 behavior in line with Python's slicing:
5422 a[n1:n2] -> a[n1]...a[n2-1]
5428 a[n1:n2] -> a[n1]...a[n2-1]
5423 It may be a bit less convenient, but I prefer to stick to Python's
5429 It may be a bit less convenient, but I prefer to stick to Python's
5424 conventions *everywhere*, so users never have to wonder.
5430 conventions *everywhere*, so users never have to wonder.
5425 (Magic.magic_macro): Added @macro function to ease the creation of
5431 (Magic.magic_macro): Added @macro function to ease the creation of
5426 macros.
5432 macros.
5427
5433
5428 2002-01-05 Fernando Perez <fperez@colorado.edu>
5434 2002-01-05 Fernando Perez <fperez@colorado.edu>
5429
5435
5430 * Released 0.2.4.
5436 * Released 0.2.4.
5431
5437
5432 * IPython/iplib.py (Magic.magic_pdef):
5438 * IPython/iplib.py (Magic.magic_pdef):
5433 (InteractiveShell.safe_execfile): report magic lines and error
5439 (InteractiveShell.safe_execfile): report magic lines and error
5434 lines without line numbers so one can easily copy/paste them for
5440 lines without line numbers so one can easily copy/paste them for
5435 re-execution.
5441 re-execution.
5436
5442
5437 * Updated manual with recent changes.
5443 * Updated manual with recent changes.
5438
5444
5439 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5445 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5440 docstring printing when class? is called. Very handy for knowing
5446 docstring printing when class? is called. Very handy for knowing
5441 how to create class instances (as long as __init__ is well
5447 how to create class instances (as long as __init__ is well
5442 documented, of course :)
5448 documented, of course :)
5443 (Magic.magic_doc): print both class and constructor docstrings.
5449 (Magic.magic_doc): print both class and constructor docstrings.
5444 (Magic.magic_pdef): give constructor info if passed a class and
5450 (Magic.magic_pdef): give constructor info if passed a class and
5445 __call__ info for callable object instances.
5451 __call__ info for callable object instances.
5446
5452
5447 2002-01-04 Fernando Perez <fperez@colorado.edu>
5453 2002-01-04 Fernando Perez <fperez@colorado.edu>
5448
5454
5449 * Made deep_reload() off by default. It doesn't always work
5455 * Made deep_reload() off by default. It doesn't always work
5450 exactly as intended, so it's probably safer to have it off. It's
5456 exactly as intended, so it's probably safer to have it off. It's
5451 still available as dreload() anyway, so nothing is lost.
5457 still available as dreload() anyway, so nothing is lost.
5452
5458
5453 2002-01-02 Fernando Perez <fperez@colorado.edu>
5459 2002-01-02 Fernando Perez <fperez@colorado.edu>
5454
5460
5455 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5461 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5456 so I wanted an updated release).
5462 so I wanted an updated release).
5457
5463
5458 2001-12-27 Fernando Perez <fperez@colorado.edu>
5464 2001-12-27 Fernando Perez <fperez@colorado.edu>
5459
5465
5460 * IPython/iplib.py (InteractiveShell.interact): Added the original
5466 * IPython/iplib.py (InteractiveShell.interact): Added the original
5461 code from 'code.py' for this module in order to change the
5467 code from 'code.py' for this module in order to change the
5462 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5468 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5463 the history cache would break when the user hit Ctrl-C, and
5469 the history cache would break when the user hit Ctrl-C, and
5464 interact() offers no way to add any hooks to it.
5470 interact() offers no way to add any hooks to it.
5465
5471
5466 2001-12-23 Fernando Perez <fperez@colorado.edu>
5472 2001-12-23 Fernando Perez <fperez@colorado.edu>
5467
5473
5468 * setup.py: added check for 'MANIFEST' before trying to remove
5474 * setup.py: added check for 'MANIFEST' before trying to remove
5469 it. Thanks to Sean Reifschneider.
5475 it. Thanks to Sean Reifschneider.
5470
5476
5471 2001-12-22 Fernando Perez <fperez@colorado.edu>
5477 2001-12-22 Fernando Perez <fperez@colorado.edu>
5472
5478
5473 * Released 0.2.2.
5479 * Released 0.2.2.
5474
5480
5475 * Finished (reasonably) writing the manual. Later will add the
5481 * Finished (reasonably) writing the manual. Later will add the
5476 python-standard navigation stylesheets, but for the time being
5482 python-standard navigation stylesheets, but for the time being
5477 it's fairly complete. Distribution will include html and pdf
5483 it's fairly complete. Distribution will include html and pdf
5478 versions.
5484 versions.
5479
5485
5480 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5486 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5481 (MayaVi author).
5487 (MayaVi author).
5482
5488
5483 2001-12-21 Fernando Perez <fperez@colorado.edu>
5489 2001-12-21 Fernando Perez <fperez@colorado.edu>
5484
5490
5485 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5491 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5486 good public release, I think (with the manual and the distutils
5492 good public release, I think (with the manual and the distutils
5487 installer). The manual can use some work, but that can go
5493 installer). The manual can use some work, but that can go
5488 slowly. Otherwise I think it's quite nice for end users. Next
5494 slowly. Otherwise I think it's quite nice for end users. Next
5489 summer, rewrite the guts of it...
5495 summer, rewrite the guts of it...
5490
5496
5491 * Changed format of ipythonrc files to use whitespace as the
5497 * Changed format of ipythonrc files to use whitespace as the
5492 separator instead of an explicit '='. Cleaner.
5498 separator instead of an explicit '='. Cleaner.
5493
5499
5494 2001-12-20 Fernando Perez <fperez@colorado.edu>
5500 2001-12-20 Fernando Perez <fperez@colorado.edu>
5495
5501
5496 * Started a manual in LyX. For now it's just a quick merge of the
5502 * Started a manual in LyX. For now it's just a quick merge of the
5497 various internal docstrings and READMEs. Later it may grow into a
5503 various internal docstrings and READMEs. Later it may grow into a
5498 nice, full-blown manual.
5504 nice, full-blown manual.
5499
5505
5500 * Set up a distutils based installer. Installation should now be
5506 * Set up a distutils based installer. Installation should now be
5501 trivially simple for end-users.
5507 trivially simple for end-users.
5502
5508
5503 2001-12-11 Fernando Perez <fperez@colorado.edu>
5509 2001-12-11 Fernando Perez <fperez@colorado.edu>
5504
5510
5505 * Released 0.2.0. First public release, announced it at
5511 * Released 0.2.0. First public release, announced it at
5506 comp.lang.python. From now on, just bugfixes...
5512 comp.lang.python. From now on, just bugfixes...
5507
5513
5508 * Went through all the files, set copyright/license notices and
5514 * Went through all the files, set copyright/license notices and
5509 cleaned up things. Ready for release.
5515 cleaned up things. Ready for release.
5510
5516
5511 2001-12-10 Fernando Perez <fperez@colorado.edu>
5517 2001-12-10 Fernando Perez <fperez@colorado.edu>
5512
5518
5513 * Changed the first-time installer not to use tarfiles. It's more
5519 * Changed the first-time installer not to use tarfiles. It's more
5514 robust now and less unix-dependent. Also makes it easier for
5520 robust now and less unix-dependent. Also makes it easier for
5515 people to later upgrade versions.
5521 people to later upgrade versions.
5516
5522
5517 * Changed @exit to @abort to reflect the fact that it's pretty
5523 * Changed @exit to @abort to reflect the fact that it's pretty
5518 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5524 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5519 becomes significant only when IPyhton is embedded: in that case,
5525 becomes significant only when IPyhton is embedded: in that case,
5520 C-D closes IPython only, but @abort kills the enclosing program
5526 C-D closes IPython only, but @abort kills the enclosing program
5521 too (unless it had called IPython inside a try catching
5527 too (unless it had called IPython inside a try catching
5522 SystemExit).
5528 SystemExit).
5523
5529
5524 * Created Shell module which exposes the actuall IPython Shell
5530 * Created Shell module which exposes the actuall IPython Shell
5525 classes, currently the normal and the embeddable one. This at
5531 classes, currently the normal and the embeddable one. This at
5526 least offers a stable interface we won't need to change when
5532 least offers a stable interface we won't need to change when
5527 (later) the internals are rewritten. That rewrite will be confined
5533 (later) the internals are rewritten. That rewrite will be confined
5528 to iplib and ipmaker, but the Shell interface should remain as is.
5534 to iplib and ipmaker, but the Shell interface should remain as is.
5529
5535
5530 * Added embed module which offers an embeddable IPShell object,
5536 * Added embed module which offers an embeddable IPShell object,
5531 useful to fire up IPython *inside* a running program. Great for
5537 useful to fire up IPython *inside* a running program. Great for
5532 debugging or dynamical data analysis.
5538 debugging or dynamical data analysis.
5533
5539
5534 2001-12-08 Fernando Perez <fperez@colorado.edu>
5540 2001-12-08 Fernando Perez <fperez@colorado.edu>
5535
5541
5536 * Fixed small bug preventing seeing info from methods of defined
5542 * Fixed small bug preventing seeing info from methods of defined
5537 objects (incorrect namespace in _ofind()).
5543 objects (incorrect namespace in _ofind()).
5538
5544
5539 * Documentation cleanup. Moved the main usage docstrings to a
5545 * Documentation cleanup. Moved the main usage docstrings to a
5540 separate file, usage.py (cleaner to maintain, and hopefully in the
5546 separate file, usage.py (cleaner to maintain, and hopefully in the
5541 future some perlpod-like way of producing interactive, man and
5547 future some perlpod-like way of producing interactive, man and
5542 html docs out of it will be found).
5548 html docs out of it will be found).
5543
5549
5544 * Added @profile to see your profile at any time.
5550 * Added @profile to see your profile at any time.
5545
5551
5546 * Added @p as an alias for 'print'. It's especially convenient if
5552 * Added @p as an alias for 'print'. It's especially convenient if
5547 using automagic ('p x' prints x).
5553 using automagic ('p x' prints x).
5548
5554
5549 * Small cleanups and fixes after a pychecker run.
5555 * Small cleanups and fixes after a pychecker run.
5550
5556
5551 * Changed the @cd command to handle @cd - and @cd -<n> for
5557 * Changed the @cd command to handle @cd - and @cd -<n> for
5552 visiting any directory in _dh.
5558 visiting any directory in _dh.
5553
5559
5554 * Introduced _dh, a history of visited directories. @dhist prints
5560 * Introduced _dh, a history of visited directories. @dhist prints
5555 it out with numbers.
5561 it out with numbers.
5556
5562
5557 2001-12-07 Fernando Perez <fperez@colorado.edu>
5563 2001-12-07 Fernando Perez <fperez@colorado.edu>
5558
5564
5559 * Released 0.1.22
5565 * Released 0.1.22
5560
5566
5561 * Made initialization a bit more robust against invalid color
5567 * Made initialization a bit more robust against invalid color
5562 options in user input (exit, not traceback-crash).
5568 options in user input (exit, not traceback-crash).
5563
5569
5564 * Changed the bug crash reporter to write the report only in the
5570 * Changed the bug crash reporter to write the report only in the
5565 user's .ipython directory. That way IPython won't litter people's
5571 user's .ipython directory. That way IPython won't litter people's
5566 hard disks with crash files all over the place. Also print on
5572 hard disks with crash files all over the place. Also print on
5567 screen the necessary mail command.
5573 screen the necessary mail command.
5568
5574
5569 * With the new ultraTB, implemented LightBG color scheme for light
5575 * With the new ultraTB, implemented LightBG color scheme for light
5570 background terminals. A lot of people like white backgrounds, so I
5576 background terminals. A lot of people like white backgrounds, so I
5571 guess we should at least give them something readable.
5577 guess we should at least give them something readable.
5572
5578
5573 2001-12-06 Fernando Perez <fperez@colorado.edu>
5579 2001-12-06 Fernando Perez <fperez@colorado.edu>
5574
5580
5575 * Modified the structure of ultraTB. Now there's a proper class
5581 * Modified the structure of ultraTB. Now there's a proper class
5576 for tables of color schemes which allow adding schemes easily and
5582 for tables of color schemes which allow adding schemes easily and
5577 switching the active scheme without creating a new instance every
5583 switching the active scheme without creating a new instance every
5578 time (which was ridiculous). The syntax for creating new schemes
5584 time (which was ridiculous). The syntax for creating new schemes
5579 is also cleaner. I think ultraTB is finally done, with a clean
5585 is also cleaner. I think ultraTB is finally done, with a clean
5580 class structure. Names are also much cleaner (now there's proper
5586 class structure. Names are also much cleaner (now there's proper
5581 color tables, no need for every variable to also have 'color' in
5587 color tables, no need for every variable to also have 'color' in
5582 its name).
5588 its name).
5583
5589
5584 * Broke down genutils into separate files. Now genutils only
5590 * Broke down genutils into separate files. Now genutils only
5585 contains utility functions, and classes have been moved to their
5591 contains utility functions, and classes have been moved to their
5586 own files (they had enough independent functionality to warrant
5592 own files (they had enough independent functionality to warrant
5587 it): ConfigLoader, OutputTrap, Struct.
5593 it): ConfigLoader, OutputTrap, Struct.
5588
5594
5589 2001-12-05 Fernando Perez <fperez@colorado.edu>
5595 2001-12-05 Fernando Perez <fperez@colorado.edu>
5590
5596
5591 * IPython turns 21! Released version 0.1.21, as a candidate for
5597 * IPython turns 21! Released version 0.1.21, as a candidate for
5592 public consumption. If all goes well, release in a few days.
5598 public consumption. If all goes well, release in a few days.
5593
5599
5594 * Fixed path bug (files in Extensions/ directory wouldn't be found
5600 * Fixed path bug (files in Extensions/ directory wouldn't be found
5595 unless IPython/ was explicitly in sys.path).
5601 unless IPython/ was explicitly in sys.path).
5596
5602
5597 * Extended the FlexCompleter class as MagicCompleter to allow
5603 * Extended the FlexCompleter class as MagicCompleter to allow
5598 completion of @-starting lines.
5604 completion of @-starting lines.
5599
5605
5600 * Created __release__.py file as a central repository for release
5606 * Created __release__.py file as a central repository for release
5601 info that other files can read from.
5607 info that other files can read from.
5602
5608
5603 * Fixed small bug in logging: when logging was turned on in
5609 * Fixed small bug in logging: when logging was turned on in
5604 mid-session, old lines with special meanings (!@?) were being
5610 mid-session, old lines with special meanings (!@?) were being
5605 logged without the prepended comment, which is necessary since
5611 logged without the prepended comment, which is necessary since
5606 they are not truly valid python syntax. This should make session
5612 they are not truly valid python syntax. This should make session
5607 restores produce less errors.
5613 restores produce less errors.
5608
5614
5609 * The namespace cleanup forced me to make a FlexCompleter class
5615 * The namespace cleanup forced me to make a FlexCompleter class
5610 which is nothing but a ripoff of rlcompleter, but with selectable
5616 which is nothing but a ripoff of rlcompleter, but with selectable
5611 namespace (rlcompleter only works in __main__.__dict__). I'll try
5617 namespace (rlcompleter only works in __main__.__dict__). I'll try
5612 to submit a note to the authors to see if this change can be
5618 to submit a note to the authors to see if this change can be
5613 incorporated in future rlcompleter releases (Dec.6: done)
5619 incorporated in future rlcompleter releases (Dec.6: done)
5614
5620
5615 * More fixes to namespace handling. It was a mess! Now all
5621 * More fixes to namespace handling. It was a mess! Now all
5616 explicit references to __main__.__dict__ are gone (except when
5622 explicit references to __main__.__dict__ are gone (except when
5617 really needed) and everything is handled through the namespace
5623 really needed) and everything is handled through the namespace
5618 dicts in the IPython instance. We seem to be getting somewhere
5624 dicts in the IPython instance. We seem to be getting somewhere
5619 with this, finally...
5625 with this, finally...
5620
5626
5621 * Small documentation updates.
5627 * Small documentation updates.
5622
5628
5623 * Created the Extensions directory under IPython (with an
5629 * Created the Extensions directory under IPython (with an
5624 __init__.py). Put the PhysicalQ stuff there. This directory should
5630 __init__.py). Put the PhysicalQ stuff there. This directory should
5625 be used for all special-purpose extensions.
5631 be used for all special-purpose extensions.
5626
5632
5627 * File renaming:
5633 * File renaming:
5628 ipythonlib --> ipmaker
5634 ipythonlib --> ipmaker
5629 ipplib --> iplib
5635 ipplib --> iplib
5630 This makes a bit more sense in terms of what these files actually do.
5636 This makes a bit more sense in terms of what these files actually do.
5631
5637
5632 * Moved all the classes and functions in ipythonlib to ipplib, so
5638 * Moved all the classes and functions in ipythonlib to ipplib, so
5633 now ipythonlib only has make_IPython(). This will ease up its
5639 now ipythonlib only has make_IPython(). This will ease up its
5634 splitting in smaller functional chunks later.
5640 splitting in smaller functional chunks later.
5635
5641
5636 * Cleaned up (done, I think) output of @whos. Better column
5642 * Cleaned up (done, I think) output of @whos. Better column
5637 formatting, and now shows str(var) for as much as it can, which is
5643 formatting, and now shows str(var) for as much as it can, which is
5638 typically what one gets with a 'print var'.
5644 typically what one gets with a 'print var'.
5639
5645
5640 2001-12-04 Fernando Perez <fperez@colorado.edu>
5646 2001-12-04 Fernando Perez <fperez@colorado.edu>
5641
5647
5642 * Fixed namespace problems. Now builtin/IPyhton/user names get
5648 * Fixed namespace problems. Now builtin/IPyhton/user names get
5643 properly reported in their namespace. Internal namespace handling
5649 properly reported in their namespace. Internal namespace handling
5644 is finally getting decent (not perfect yet, but much better than
5650 is finally getting decent (not perfect yet, but much better than
5645 the ad-hoc mess we had).
5651 the ad-hoc mess we had).
5646
5652
5647 * Removed -exit option. If people just want to run a python
5653 * Removed -exit option. If people just want to run a python
5648 script, that's what the normal interpreter is for. Less
5654 script, that's what the normal interpreter is for. Less
5649 unnecessary options, less chances for bugs.
5655 unnecessary options, less chances for bugs.
5650
5656
5651 * Added a crash handler which generates a complete post-mortem if
5657 * Added a crash handler which generates a complete post-mortem if
5652 IPython crashes. This will help a lot in tracking bugs down the
5658 IPython crashes. This will help a lot in tracking bugs down the
5653 road.
5659 road.
5654
5660
5655 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5661 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5656 which were boud to functions being reassigned would bypass the
5662 which were boud to functions being reassigned would bypass the
5657 logger, breaking the sync of _il with the prompt counter. This
5663 logger, breaking the sync of _il with the prompt counter. This
5658 would then crash IPython later when a new line was logged.
5664 would then crash IPython later when a new line was logged.
5659
5665
5660 2001-12-02 Fernando Perez <fperez@colorado.edu>
5666 2001-12-02 Fernando Perez <fperez@colorado.edu>
5661
5667
5662 * Made IPython a package. This means people don't have to clutter
5668 * Made IPython a package. This means people don't have to clutter
5663 their sys.path with yet another directory. Changed the INSTALL
5669 their sys.path with yet another directory. Changed the INSTALL
5664 file accordingly.
5670 file accordingly.
5665
5671
5666 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5672 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5667 sorts its output (so @who shows it sorted) and @whos formats the
5673 sorts its output (so @who shows it sorted) and @whos formats the
5668 table according to the width of the first column. Nicer, easier to
5674 table according to the width of the first column. Nicer, easier to
5669 read. Todo: write a generic table_format() which takes a list of
5675 read. Todo: write a generic table_format() which takes a list of
5670 lists and prints it nicely formatted, with optional row/column
5676 lists and prints it nicely formatted, with optional row/column
5671 separators and proper padding and justification.
5677 separators and proper padding and justification.
5672
5678
5673 * Released 0.1.20
5679 * Released 0.1.20
5674
5680
5675 * Fixed bug in @log which would reverse the inputcache list (a
5681 * Fixed bug in @log which would reverse the inputcache list (a
5676 copy operation was missing).
5682 copy operation was missing).
5677
5683
5678 * Code cleanup. @config was changed to use page(). Better, since
5684 * Code cleanup. @config was changed to use page(). Better, since
5679 its output is always quite long.
5685 its output is always quite long.
5680
5686
5681 * Itpl is back as a dependency. I was having too many problems
5687 * Itpl is back as a dependency. I was having too many problems
5682 getting the parametric aliases to work reliably, and it's just
5688 getting the parametric aliases to work reliably, and it's just
5683 easier to code weird string operations with it than playing %()s
5689 easier to code weird string operations with it than playing %()s
5684 games. It's only ~6k, so I don't think it's too big a deal.
5690 games. It's only ~6k, so I don't think it's too big a deal.
5685
5691
5686 * Found (and fixed) a very nasty bug with history. !lines weren't
5692 * Found (and fixed) a very nasty bug with history. !lines weren't
5687 getting cached, and the out of sync caches would crash
5693 getting cached, and the out of sync caches would crash
5688 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5694 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5689 division of labor a bit better. Bug fixed, cleaner structure.
5695 division of labor a bit better. Bug fixed, cleaner structure.
5690
5696
5691 2001-12-01 Fernando Perez <fperez@colorado.edu>
5697 2001-12-01 Fernando Perez <fperez@colorado.edu>
5692
5698
5693 * Released 0.1.19
5699 * Released 0.1.19
5694
5700
5695 * Added option -n to @hist to prevent line number printing. Much
5701 * Added option -n to @hist to prevent line number printing. Much
5696 easier to copy/paste code this way.
5702 easier to copy/paste code this way.
5697
5703
5698 * Created global _il to hold the input list. Allows easy
5704 * Created global _il to hold the input list. Allows easy
5699 re-execution of blocks of code by slicing it (inspired by Janko's
5705 re-execution of blocks of code by slicing it (inspired by Janko's
5700 comment on 'macros').
5706 comment on 'macros').
5701
5707
5702 * Small fixes and doc updates.
5708 * Small fixes and doc updates.
5703
5709
5704 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5710 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5705 much too fragile with automagic. Handles properly multi-line
5711 much too fragile with automagic. Handles properly multi-line
5706 statements and takes parameters.
5712 statements and takes parameters.
5707
5713
5708 2001-11-30 Fernando Perez <fperez@colorado.edu>
5714 2001-11-30 Fernando Perez <fperez@colorado.edu>
5709
5715
5710 * Version 0.1.18 released.
5716 * Version 0.1.18 released.
5711
5717
5712 * Fixed nasty namespace bug in initial module imports.
5718 * Fixed nasty namespace bug in initial module imports.
5713
5719
5714 * Added copyright/license notes to all code files (except
5720 * Added copyright/license notes to all code files (except
5715 DPyGetOpt). For the time being, LGPL. That could change.
5721 DPyGetOpt). For the time being, LGPL. That could change.
5716
5722
5717 * Rewrote a much nicer README, updated INSTALL, cleaned up
5723 * Rewrote a much nicer README, updated INSTALL, cleaned up
5718 ipythonrc-* samples.
5724 ipythonrc-* samples.
5719
5725
5720 * Overall code/documentation cleanup. Basically ready for
5726 * Overall code/documentation cleanup. Basically ready for
5721 release. Only remaining thing: licence decision (LGPL?).
5727 release. Only remaining thing: licence decision (LGPL?).
5722
5728
5723 * Converted load_config to a class, ConfigLoader. Now recursion
5729 * Converted load_config to a class, ConfigLoader. Now recursion
5724 control is better organized. Doesn't include the same file twice.
5730 control is better organized. Doesn't include the same file twice.
5725
5731
5726 2001-11-29 Fernando Perez <fperez@colorado.edu>
5732 2001-11-29 Fernando Perez <fperez@colorado.edu>
5727
5733
5728 * Got input history working. Changed output history variables from
5734 * Got input history working. Changed output history variables from
5729 _p to _o so that _i is for input and _o for output. Just cleaner
5735 _p to _o so that _i is for input and _o for output. Just cleaner
5730 convention.
5736 convention.
5731
5737
5732 * Implemented parametric aliases. This pretty much allows the
5738 * Implemented parametric aliases. This pretty much allows the
5733 alias system to offer full-blown shell convenience, I think.
5739 alias system to offer full-blown shell convenience, I think.
5734
5740
5735 * Version 0.1.17 released, 0.1.18 opened.
5741 * Version 0.1.17 released, 0.1.18 opened.
5736
5742
5737 * dot_ipython/ipythonrc (alias): added documentation.
5743 * dot_ipython/ipythonrc (alias): added documentation.
5738 (xcolor): Fixed small bug (xcolors -> xcolor)
5744 (xcolor): Fixed small bug (xcolors -> xcolor)
5739
5745
5740 * Changed the alias system. Now alias is a magic command to define
5746 * Changed the alias system. Now alias is a magic command to define
5741 aliases just like the shell. Rationale: the builtin magics should
5747 aliases just like the shell. Rationale: the builtin magics should
5742 be there for things deeply connected to IPython's
5748 be there for things deeply connected to IPython's
5743 architecture. And this is a much lighter system for what I think
5749 architecture. And this is a much lighter system for what I think
5744 is the really important feature: allowing users to define quickly
5750 is the really important feature: allowing users to define quickly
5745 magics that will do shell things for them, so they can customize
5751 magics that will do shell things for them, so they can customize
5746 IPython easily to match their work habits. If someone is really
5752 IPython easily to match their work habits. If someone is really
5747 desperate to have another name for a builtin alias, they can
5753 desperate to have another name for a builtin alias, they can
5748 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5754 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5749 works.
5755 works.
5750
5756
5751 2001-11-28 Fernando Perez <fperez@colorado.edu>
5757 2001-11-28 Fernando Perez <fperez@colorado.edu>
5752
5758
5753 * Changed @file so that it opens the source file at the proper
5759 * Changed @file so that it opens the source file at the proper
5754 line. Since it uses less, if your EDITOR environment is
5760 line. Since it uses less, if your EDITOR environment is
5755 configured, typing v will immediately open your editor of choice
5761 configured, typing v will immediately open your editor of choice
5756 right at the line where the object is defined. Not as quick as
5762 right at the line where the object is defined. Not as quick as
5757 having a direct @edit command, but for all intents and purposes it
5763 having a direct @edit command, but for all intents and purposes it
5758 works. And I don't have to worry about writing @edit to deal with
5764 works. And I don't have to worry about writing @edit to deal with
5759 all the editors, less does that.
5765 all the editors, less does that.
5760
5766
5761 * Version 0.1.16 released, 0.1.17 opened.
5767 * Version 0.1.16 released, 0.1.17 opened.
5762
5768
5763 * Fixed some nasty bugs in the page/page_dumb combo that could
5769 * Fixed some nasty bugs in the page/page_dumb combo that could
5764 crash IPython.
5770 crash IPython.
5765
5771
5766 2001-11-27 Fernando Perez <fperez@colorado.edu>
5772 2001-11-27 Fernando Perez <fperez@colorado.edu>
5767
5773
5768 * Version 0.1.15 released, 0.1.16 opened.
5774 * Version 0.1.15 released, 0.1.16 opened.
5769
5775
5770 * Finally got ? and ?? to work for undefined things: now it's
5776 * Finally got ? and ?? to work for undefined things: now it's
5771 possible to type {}.get? and get information about the get method
5777 possible to type {}.get? and get information about the get method
5772 of dicts, or os.path? even if only os is defined (so technically
5778 of dicts, or os.path? even if only os is defined (so technically
5773 os.path isn't). Works at any level. For example, after import os,
5779 os.path isn't). Works at any level. For example, after import os,
5774 os?, os.path?, os.path.abspath? all work. This is great, took some
5780 os?, os.path?, os.path.abspath? all work. This is great, took some
5775 work in _ofind.
5781 work in _ofind.
5776
5782
5777 * Fixed more bugs with logging. The sanest way to do it was to add
5783 * Fixed more bugs with logging. The sanest way to do it was to add
5778 to @log a 'mode' parameter. Killed two in one shot (this mode
5784 to @log a 'mode' parameter. Killed two in one shot (this mode
5779 option was a request of Janko's). I think it's finally clean
5785 option was a request of Janko's). I think it's finally clean
5780 (famous last words).
5786 (famous last words).
5781
5787
5782 * Added a page_dumb() pager which does a decent job of paging on
5788 * Added a page_dumb() pager which does a decent job of paging on
5783 screen, if better things (like less) aren't available. One less
5789 screen, if better things (like less) aren't available. One less
5784 unix dependency (someday maybe somebody will port this to
5790 unix dependency (someday maybe somebody will port this to
5785 windows).
5791 windows).
5786
5792
5787 * Fixed problem in magic_log: would lock of logging out if log
5793 * Fixed problem in magic_log: would lock of logging out if log
5788 creation failed (because it would still think it had succeeded).
5794 creation failed (because it would still think it had succeeded).
5789
5795
5790 * Improved the page() function using curses to auto-detect screen
5796 * Improved the page() function using curses to auto-detect screen
5791 size. Now it can make a much better decision on whether to print
5797 size. Now it can make a much better decision on whether to print
5792 or page a string. Option screen_length was modified: a value 0
5798 or page a string. Option screen_length was modified: a value 0
5793 means auto-detect, and that's the default now.
5799 means auto-detect, and that's the default now.
5794
5800
5795 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5801 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5796 go out. I'll test it for a few days, then talk to Janko about
5802 go out. I'll test it for a few days, then talk to Janko about
5797 licences and announce it.
5803 licences and announce it.
5798
5804
5799 * Fixed the length of the auto-generated ---> prompt which appears
5805 * Fixed the length of the auto-generated ---> prompt which appears
5800 for auto-parens and auto-quotes. Getting this right isn't trivial,
5806 for auto-parens and auto-quotes. Getting this right isn't trivial,
5801 with all the color escapes, different prompt types and optional
5807 with all the color escapes, different prompt types and optional
5802 separators. But it seems to be working in all the combinations.
5808 separators. But it seems to be working in all the combinations.
5803
5809
5804 2001-11-26 Fernando Perez <fperez@colorado.edu>
5810 2001-11-26 Fernando Perez <fperez@colorado.edu>
5805
5811
5806 * Wrote a regexp filter to get option types from the option names
5812 * Wrote a regexp filter to get option types from the option names
5807 string. This eliminates the need to manually keep two duplicate
5813 string. This eliminates the need to manually keep two duplicate
5808 lists.
5814 lists.
5809
5815
5810 * Removed the unneeded check_option_names. Now options are handled
5816 * Removed the unneeded check_option_names. Now options are handled
5811 in a much saner manner and it's easy to visually check that things
5817 in a much saner manner and it's easy to visually check that things
5812 are ok.
5818 are ok.
5813
5819
5814 * Updated version numbers on all files I modified to carry a
5820 * Updated version numbers on all files I modified to carry a
5815 notice so Janko and Nathan have clear version markers.
5821 notice so Janko and Nathan have clear version markers.
5816
5822
5817 * Updated docstring for ultraTB with my changes. I should send
5823 * Updated docstring for ultraTB with my changes. I should send
5818 this to Nathan.
5824 this to Nathan.
5819
5825
5820 * Lots of small fixes. Ran everything through pychecker again.
5826 * Lots of small fixes. Ran everything through pychecker again.
5821
5827
5822 * Made loading of deep_reload an cmd line option. If it's not too
5828 * Made loading of deep_reload an cmd line option. If it's not too
5823 kosher, now people can just disable it. With -nodeep_reload it's
5829 kosher, now people can just disable it. With -nodeep_reload it's
5824 still available as dreload(), it just won't overwrite reload().
5830 still available as dreload(), it just won't overwrite reload().
5825
5831
5826 * Moved many options to the no| form (-opt and -noopt
5832 * Moved many options to the no| form (-opt and -noopt
5827 accepted). Cleaner.
5833 accepted). Cleaner.
5828
5834
5829 * Changed magic_log so that if called with no parameters, it uses
5835 * Changed magic_log so that if called with no parameters, it uses
5830 'rotate' mode. That way auto-generated logs aren't automatically
5836 'rotate' mode. That way auto-generated logs aren't automatically
5831 over-written. For normal logs, now a backup is made if it exists
5837 over-written. For normal logs, now a backup is made if it exists
5832 (only 1 level of backups). A new 'backup' mode was added to the
5838 (only 1 level of backups). A new 'backup' mode was added to the
5833 Logger class to support this. This was a request by Janko.
5839 Logger class to support this. This was a request by Janko.
5834
5840
5835 * Added @logoff/@logon to stop/restart an active log.
5841 * Added @logoff/@logon to stop/restart an active log.
5836
5842
5837 * Fixed a lot of bugs in log saving/replay. It was pretty
5843 * Fixed a lot of bugs in log saving/replay. It was pretty
5838 broken. Now special lines (!@,/) appear properly in the command
5844 broken. Now special lines (!@,/) appear properly in the command
5839 history after a log replay.
5845 history after a log replay.
5840
5846
5841 * Tried and failed to implement full session saving via pickle. My
5847 * Tried and failed to implement full session saving via pickle. My
5842 idea was to pickle __main__.__dict__, but modules can't be
5848 idea was to pickle __main__.__dict__, but modules can't be
5843 pickled. This would be a better alternative to replaying logs, but
5849 pickled. This would be a better alternative to replaying logs, but
5844 seems quite tricky to get to work. Changed -session to be called
5850 seems quite tricky to get to work. Changed -session to be called
5845 -logplay, which more accurately reflects what it does. And if we
5851 -logplay, which more accurately reflects what it does. And if we
5846 ever get real session saving working, -session is now available.
5852 ever get real session saving working, -session is now available.
5847
5853
5848 * Implemented color schemes for prompts also. As for tracebacks,
5854 * Implemented color schemes for prompts also. As for tracebacks,
5849 currently only NoColor and Linux are supported. But now the
5855 currently only NoColor and Linux are supported. But now the
5850 infrastructure is in place, based on a generic ColorScheme
5856 infrastructure is in place, based on a generic ColorScheme
5851 class. So writing and activating new schemes both for the prompts
5857 class. So writing and activating new schemes both for the prompts
5852 and the tracebacks should be straightforward.
5858 and the tracebacks should be straightforward.
5853
5859
5854 * Version 0.1.13 released, 0.1.14 opened.
5860 * Version 0.1.13 released, 0.1.14 opened.
5855
5861
5856 * Changed handling of options for output cache. Now counter is
5862 * Changed handling of options for output cache. Now counter is
5857 hardwired starting at 1 and one specifies the maximum number of
5863 hardwired starting at 1 and one specifies the maximum number of
5858 entries *in the outcache* (not the max prompt counter). This is
5864 entries *in the outcache* (not the max prompt counter). This is
5859 much better, since many statements won't increase the cache
5865 much better, since many statements won't increase the cache
5860 count. It also eliminated some confusing options, now there's only
5866 count. It also eliminated some confusing options, now there's only
5861 one: cache_size.
5867 one: cache_size.
5862
5868
5863 * Added 'alias' magic function and magic_alias option in the
5869 * Added 'alias' magic function and magic_alias option in the
5864 ipythonrc file. Now the user can easily define whatever names he
5870 ipythonrc file. Now the user can easily define whatever names he
5865 wants for the magic functions without having to play weird
5871 wants for the magic functions without having to play weird
5866 namespace games. This gives IPython a real shell-like feel.
5872 namespace games. This gives IPython a real shell-like feel.
5867
5873
5868 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5874 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5869 @ or not).
5875 @ or not).
5870
5876
5871 This was one of the last remaining 'visible' bugs (that I know
5877 This was one of the last remaining 'visible' bugs (that I know
5872 of). I think if I can clean up the session loading so it works
5878 of). I think if I can clean up the session loading so it works
5873 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5879 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5874 about licensing).
5880 about licensing).
5875
5881
5876 2001-11-25 Fernando Perez <fperez@colorado.edu>
5882 2001-11-25 Fernando Perez <fperez@colorado.edu>
5877
5883
5878 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5884 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5879 there's a cleaner distinction between what ? and ?? show.
5885 there's a cleaner distinction between what ? and ?? show.
5880
5886
5881 * Added screen_length option. Now the user can define his own
5887 * Added screen_length option. Now the user can define his own
5882 screen size for page() operations.
5888 screen size for page() operations.
5883
5889
5884 * Implemented magic shell-like functions with automatic code
5890 * Implemented magic shell-like functions with automatic code
5885 generation. Now adding another function is just a matter of adding
5891 generation. Now adding another function is just a matter of adding
5886 an entry to a dict, and the function is dynamically generated at
5892 an entry to a dict, and the function is dynamically generated at
5887 run-time. Python has some really cool features!
5893 run-time. Python has some really cool features!
5888
5894
5889 * Renamed many options to cleanup conventions a little. Now all
5895 * Renamed many options to cleanup conventions a little. Now all
5890 are lowercase, and only underscores where needed. Also in the code
5896 are lowercase, and only underscores where needed. Also in the code
5891 option name tables are clearer.
5897 option name tables are clearer.
5892
5898
5893 * Changed prompts a little. Now input is 'In [n]:' instead of
5899 * Changed prompts a little. Now input is 'In [n]:' instead of
5894 'In[n]:='. This allows it the numbers to be aligned with the
5900 'In[n]:='. This allows it the numbers to be aligned with the
5895 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5901 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5896 Python (it was a Mathematica thing). The '...' continuation prompt
5902 Python (it was a Mathematica thing). The '...' continuation prompt
5897 was also changed a little to align better.
5903 was also changed a little to align better.
5898
5904
5899 * Fixed bug when flushing output cache. Not all _p<n> variables
5905 * Fixed bug when flushing output cache. Not all _p<n> variables
5900 exist, so their deletion needs to be wrapped in a try:
5906 exist, so their deletion needs to be wrapped in a try:
5901
5907
5902 * Figured out how to properly use inspect.formatargspec() (it
5908 * Figured out how to properly use inspect.formatargspec() (it
5903 requires the args preceded by *). So I removed all the code from
5909 requires the args preceded by *). So I removed all the code from
5904 _get_pdef in Magic, which was just replicating that.
5910 _get_pdef in Magic, which was just replicating that.
5905
5911
5906 * Added test to prefilter to allow redefining magic function names
5912 * Added test to prefilter to allow redefining magic function names
5907 as variables. This is ok, since the @ form is always available,
5913 as variables. This is ok, since the @ form is always available,
5908 but whe should allow the user to define a variable called 'ls' if
5914 but whe should allow the user to define a variable called 'ls' if
5909 he needs it.
5915 he needs it.
5910
5916
5911 * Moved the ToDo information from README into a separate ToDo.
5917 * Moved the ToDo information from README into a separate ToDo.
5912
5918
5913 * General code cleanup and small bugfixes. I think it's close to a
5919 * General code cleanup and small bugfixes. I think it's close to a
5914 state where it can be released, obviously with a big 'beta'
5920 state where it can be released, obviously with a big 'beta'
5915 warning on it.
5921 warning on it.
5916
5922
5917 * Got the magic function split to work. Now all magics are defined
5923 * Got the magic function split to work. Now all magics are defined
5918 in a separate class. It just organizes things a bit, and now
5924 in a separate class. It just organizes things a bit, and now
5919 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5925 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5920 was too long).
5926 was too long).
5921
5927
5922 * Changed @clear to @reset to avoid potential confusions with
5928 * Changed @clear to @reset to avoid potential confusions with
5923 the shell command clear. Also renamed @cl to @clear, which does
5929 the shell command clear. Also renamed @cl to @clear, which does
5924 exactly what people expect it to from their shell experience.
5930 exactly what people expect it to from their shell experience.
5925
5931
5926 Added a check to the @reset command (since it's so
5932 Added a check to the @reset command (since it's so
5927 destructive, it's probably a good idea to ask for confirmation).
5933 destructive, it's probably a good idea to ask for confirmation).
5928 But now reset only works for full namespace resetting. Since the
5934 But now reset only works for full namespace resetting. Since the
5929 del keyword is already there for deleting a few specific
5935 del keyword is already there for deleting a few specific
5930 variables, I don't see the point of having a redundant magic
5936 variables, I don't see the point of having a redundant magic
5931 function for the same task.
5937 function for the same task.
5932
5938
5933 2001-11-24 Fernando Perez <fperez@colorado.edu>
5939 2001-11-24 Fernando Perez <fperez@colorado.edu>
5934
5940
5935 * Updated the builtin docs (esp. the ? ones).
5941 * Updated the builtin docs (esp. the ? ones).
5936
5942
5937 * Ran all the code through pychecker. Not terribly impressed with
5943 * Ran all the code through pychecker. Not terribly impressed with
5938 it: lots of spurious warnings and didn't really find anything of
5944 it: lots of spurious warnings and didn't really find anything of
5939 substance (just a few modules being imported and not used).
5945 substance (just a few modules being imported and not used).
5940
5946
5941 * Implemented the new ultraTB functionality into IPython. New
5947 * Implemented the new ultraTB functionality into IPython. New
5942 option: xcolors. This chooses color scheme. xmode now only selects
5948 option: xcolors. This chooses color scheme. xmode now only selects
5943 between Plain and Verbose. Better orthogonality.
5949 between Plain and Verbose. Better orthogonality.
5944
5950
5945 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5951 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5946 mode and color scheme for the exception handlers. Now it's
5952 mode and color scheme for the exception handlers. Now it's
5947 possible to have the verbose traceback with no coloring.
5953 possible to have the verbose traceback with no coloring.
5948
5954
5949 2001-11-23 Fernando Perez <fperez@colorado.edu>
5955 2001-11-23 Fernando Perez <fperez@colorado.edu>
5950
5956
5951 * Version 0.1.12 released, 0.1.13 opened.
5957 * Version 0.1.12 released, 0.1.13 opened.
5952
5958
5953 * Removed option to set auto-quote and auto-paren escapes by
5959 * Removed option to set auto-quote and auto-paren escapes by
5954 user. The chances of breaking valid syntax are just too high. If
5960 user. The chances of breaking valid syntax are just too high. If
5955 someone *really* wants, they can always dig into the code.
5961 someone *really* wants, they can always dig into the code.
5956
5962
5957 * Made prompt separators configurable.
5963 * Made prompt separators configurable.
5958
5964
5959 2001-11-22 Fernando Perez <fperez@colorado.edu>
5965 2001-11-22 Fernando Perez <fperez@colorado.edu>
5960
5966
5961 * Small bugfixes in many places.
5967 * Small bugfixes in many places.
5962
5968
5963 * Removed the MyCompleter class from ipplib. It seemed redundant
5969 * Removed the MyCompleter class from ipplib. It seemed redundant
5964 with the C-p,C-n history search functionality. Less code to
5970 with the C-p,C-n history search functionality. Less code to
5965 maintain.
5971 maintain.
5966
5972
5967 * Moved all the original ipython.py code into ipythonlib.py. Right
5973 * Moved all the original ipython.py code into ipythonlib.py. Right
5968 now it's just one big dump into a function called make_IPython, so
5974 now it's just one big dump into a function called make_IPython, so
5969 no real modularity has been gained. But at least it makes the
5975 no real modularity has been gained. But at least it makes the
5970 wrapper script tiny, and since ipythonlib is a module, it gets
5976 wrapper script tiny, and since ipythonlib is a module, it gets
5971 compiled and startup is much faster.
5977 compiled and startup is much faster.
5972
5978
5973 This is a reasobably 'deep' change, so we should test it for a
5979 This is a reasobably 'deep' change, so we should test it for a
5974 while without messing too much more with the code.
5980 while without messing too much more with the code.
5975
5981
5976 2001-11-21 Fernando Perez <fperez@colorado.edu>
5982 2001-11-21 Fernando Perez <fperez@colorado.edu>
5977
5983
5978 * Version 0.1.11 released, 0.1.12 opened for further work.
5984 * Version 0.1.11 released, 0.1.12 opened for further work.
5979
5985
5980 * Removed dependency on Itpl. It was only needed in one place. It
5986 * Removed dependency on Itpl. It was only needed in one place. It
5981 would be nice if this became part of python, though. It makes life
5987 would be nice if this became part of python, though. It makes life
5982 *a lot* easier in some cases.
5988 *a lot* easier in some cases.
5983
5989
5984 * Simplified the prefilter code a bit. Now all handlers are
5990 * Simplified the prefilter code a bit. Now all handlers are
5985 expected to explicitly return a value (at least a blank string).
5991 expected to explicitly return a value (at least a blank string).
5986
5992
5987 * Heavy edits in ipplib. Removed the help system altogether. Now
5993 * Heavy edits in ipplib. Removed the help system altogether. Now
5988 obj?/?? is used for inspecting objects, a magic @doc prints
5994 obj?/?? is used for inspecting objects, a magic @doc prints
5989 docstrings, and full-blown Python help is accessed via the 'help'
5995 docstrings, and full-blown Python help is accessed via the 'help'
5990 keyword. This cleans up a lot of code (less to maintain) and does
5996 keyword. This cleans up a lot of code (less to maintain) and does
5991 the job. Since 'help' is now a standard Python component, might as
5997 the job. Since 'help' is now a standard Python component, might as
5992 well use it and remove duplicate functionality.
5998 well use it and remove duplicate functionality.
5993
5999
5994 Also removed the option to use ipplib as a standalone program. By
6000 Also removed the option to use ipplib as a standalone program. By
5995 now it's too dependent on other parts of IPython to function alone.
6001 now it's too dependent on other parts of IPython to function alone.
5996
6002
5997 * Fixed bug in genutils.pager. It would crash if the pager was
6003 * Fixed bug in genutils.pager. It would crash if the pager was
5998 exited immediately after opening (broken pipe).
6004 exited immediately after opening (broken pipe).
5999
6005
6000 * Trimmed down the VerboseTB reporting a little. The header is
6006 * Trimmed down the VerboseTB reporting a little. The header is
6001 much shorter now and the repeated exception arguments at the end
6007 much shorter now and the repeated exception arguments at the end
6002 have been removed. For interactive use the old header seemed a bit
6008 have been removed. For interactive use the old header seemed a bit
6003 excessive.
6009 excessive.
6004
6010
6005 * Fixed small bug in output of @whos for variables with multi-word
6011 * Fixed small bug in output of @whos for variables with multi-word
6006 types (only first word was displayed).
6012 types (only first word was displayed).
6007
6013
6008 2001-11-17 Fernando Perez <fperez@colorado.edu>
6014 2001-11-17 Fernando Perez <fperez@colorado.edu>
6009
6015
6010 * Version 0.1.10 released, 0.1.11 opened for further work.
6016 * Version 0.1.10 released, 0.1.11 opened for further work.
6011
6017
6012 * Modified dirs and friends. dirs now *returns* the stack (not
6018 * Modified dirs and friends. dirs now *returns* the stack (not
6013 prints), so one can manipulate it as a variable. Convenient to
6019 prints), so one can manipulate it as a variable. Convenient to
6014 travel along many directories.
6020 travel along many directories.
6015
6021
6016 * Fixed bug in magic_pdef: would only work with functions with
6022 * Fixed bug in magic_pdef: would only work with functions with
6017 arguments with default values.
6023 arguments with default values.
6018
6024
6019 2001-11-14 Fernando Perez <fperez@colorado.edu>
6025 2001-11-14 Fernando Perez <fperez@colorado.edu>
6020
6026
6021 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6027 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6022 example with IPython. Various other minor fixes and cleanups.
6028 example with IPython. Various other minor fixes and cleanups.
6023
6029
6024 * Version 0.1.9 released, 0.1.10 opened for further work.
6030 * Version 0.1.9 released, 0.1.10 opened for further work.
6025
6031
6026 * Added sys.path to the list of directories searched in the
6032 * Added sys.path to the list of directories searched in the
6027 execfile= option. It used to be the current directory and the
6033 execfile= option. It used to be the current directory and the
6028 user's IPYTHONDIR only.
6034 user's IPYTHONDIR only.
6029
6035
6030 2001-11-13 Fernando Perez <fperez@colorado.edu>
6036 2001-11-13 Fernando Perez <fperez@colorado.edu>
6031
6037
6032 * Reinstated the raw_input/prefilter separation that Janko had
6038 * Reinstated the raw_input/prefilter separation that Janko had
6033 initially. This gives a more convenient setup for extending the
6039 initially. This gives a more convenient setup for extending the
6034 pre-processor from the outside: raw_input always gets a string,
6040 pre-processor from the outside: raw_input always gets a string,
6035 and prefilter has to process it. We can then redefine prefilter
6041 and prefilter has to process it. We can then redefine prefilter
6036 from the outside and implement extensions for special
6042 from the outside and implement extensions for special
6037 purposes.
6043 purposes.
6038
6044
6039 Today I got one for inputting PhysicalQuantity objects
6045 Today I got one for inputting PhysicalQuantity objects
6040 (from Scientific) without needing any function calls at
6046 (from Scientific) without needing any function calls at
6041 all. Extremely convenient, and it's all done as a user-level
6047 all. Extremely convenient, and it's all done as a user-level
6042 extension (no IPython code was touched). Now instead of:
6048 extension (no IPython code was touched). Now instead of:
6043 a = PhysicalQuantity(4.2,'m/s**2')
6049 a = PhysicalQuantity(4.2,'m/s**2')
6044 one can simply say
6050 one can simply say
6045 a = 4.2 m/s**2
6051 a = 4.2 m/s**2
6046 or even
6052 or even
6047 a = 4.2 m/s^2
6053 a = 4.2 m/s^2
6048
6054
6049 I use this, but it's also a proof of concept: IPython really is
6055 I use this, but it's also a proof of concept: IPython really is
6050 fully user-extensible, even at the level of the parsing of the
6056 fully user-extensible, even at the level of the parsing of the
6051 command line. It's not trivial, but it's perfectly doable.
6057 command line. It's not trivial, but it's perfectly doable.
6052
6058
6053 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6059 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6054 the problem of modules being loaded in the inverse order in which
6060 the problem of modules being loaded in the inverse order in which
6055 they were defined in
6061 they were defined in
6056
6062
6057 * Version 0.1.8 released, 0.1.9 opened for further work.
6063 * Version 0.1.8 released, 0.1.9 opened for further work.
6058
6064
6059 * Added magics pdef, source and file. They respectively show the
6065 * Added magics pdef, source and file. They respectively show the
6060 definition line ('prototype' in C), source code and full python
6066 definition line ('prototype' in C), source code and full python
6061 file for any callable object. The object inspector oinfo uses
6067 file for any callable object. The object inspector oinfo uses
6062 these to show the same information.
6068 these to show the same information.
6063
6069
6064 * Version 0.1.7 released, 0.1.8 opened for further work.
6070 * Version 0.1.7 released, 0.1.8 opened for further work.
6065
6071
6066 * Separated all the magic functions into a class called Magic. The
6072 * Separated all the magic functions into a class called Magic. The
6067 InteractiveShell class was becoming too big for Xemacs to handle
6073 InteractiveShell class was becoming too big for Xemacs to handle
6068 (de-indenting a line would lock it up for 10 seconds while it
6074 (de-indenting a line would lock it up for 10 seconds while it
6069 backtracked on the whole class!)
6075 backtracked on the whole class!)
6070
6076
6071 FIXME: didn't work. It can be done, but right now namespaces are
6077 FIXME: didn't work. It can be done, but right now namespaces are
6072 all messed up. Do it later (reverted it for now, so at least
6078 all messed up. Do it later (reverted it for now, so at least
6073 everything works as before).
6079 everything works as before).
6074
6080
6075 * Got the object introspection system (magic_oinfo) working! I
6081 * Got the object introspection system (magic_oinfo) working! I
6076 think this is pretty much ready for release to Janko, so he can
6082 think this is pretty much ready for release to Janko, so he can
6077 test it for a while and then announce it. Pretty much 100% of what
6083 test it for a while and then announce it. Pretty much 100% of what
6078 I wanted for the 'phase 1' release is ready. Happy, tired.
6084 I wanted for the 'phase 1' release is ready. Happy, tired.
6079
6085
6080 2001-11-12 Fernando Perez <fperez@colorado.edu>
6086 2001-11-12 Fernando Perez <fperez@colorado.edu>
6081
6087
6082 * Version 0.1.6 released, 0.1.7 opened for further work.
6088 * Version 0.1.6 released, 0.1.7 opened for further work.
6083
6089
6084 * Fixed bug in printing: it used to test for truth before
6090 * Fixed bug in printing: it used to test for truth before
6085 printing, so 0 wouldn't print. Now checks for None.
6091 printing, so 0 wouldn't print. Now checks for None.
6086
6092
6087 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6093 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6088 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6094 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6089 reaches by hand into the outputcache. Think of a better way to do
6095 reaches by hand into the outputcache. Think of a better way to do
6090 this later.
6096 this later.
6091
6097
6092 * Various small fixes thanks to Nathan's comments.
6098 * Various small fixes thanks to Nathan's comments.
6093
6099
6094 * Changed magic_pprint to magic_Pprint. This way it doesn't
6100 * Changed magic_pprint to magic_Pprint. This way it doesn't
6095 collide with pprint() and the name is consistent with the command
6101 collide with pprint() and the name is consistent with the command
6096 line option.
6102 line option.
6097
6103
6098 * Changed prompt counter behavior to be fully like
6104 * Changed prompt counter behavior to be fully like
6099 Mathematica's. That is, even input that doesn't return a result
6105 Mathematica's. That is, even input that doesn't return a result
6100 raises the prompt counter. The old behavior was kind of confusing
6106 raises the prompt counter. The old behavior was kind of confusing
6101 (getting the same prompt number several times if the operation
6107 (getting the same prompt number several times if the operation
6102 didn't return a result).
6108 didn't return a result).
6103
6109
6104 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6110 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6105
6111
6106 * Fixed -Classic mode (wasn't working anymore).
6112 * Fixed -Classic mode (wasn't working anymore).
6107
6113
6108 * Added colored prompts using Nathan's new code. Colors are
6114 * Added colored prompts using Nathan's new code. Colors are
6109 currently hardwired, they can be user-configurable. For
6115 currently hardwired, they can be user-configurable. For
6110 developers, they can be chosen in file ipythonlib.py, at the
6116 developers, they can be chosen in file ipythonlib.py, at the
6111 beginning of the CachedOutput class def.
6117 beginning of the CachedOutput class def.
6112
6118
6113 2001-11-11 Fernando Perez <fperez@colorado.edu>
6119 2001-11-11 Fernando Perez <fperez@colorado.edu>
6114
6120
6115 * Version 0.1.5 released, 0.1.6 opened for further work.
6121 * Version 0.1.5 released, 0.1.6 opened for further work.
6116
6122
6117 * Changed magic_env to *return* the environment as a dict (not to
6123 * Changed magic_env to *return* the environment as a dict (not to
6118 print it). This way it prints, but it can also be processed.
6124 print it). This way it prints, but it can also be processed.
6119
6125
6120 * Added Verbose exception reporting to interactive
6126 * Added Verbose exception reporting to interactive
6121 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6127 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6122 traceback. Had to make some changes to the ultraTB file. This is
6128 traceback. Had to make some changes to the ultraTB file. This is
6123 probably the last 'big' thing in my mental todo list. This ties
6129 probably the last 'big' thing in my mental todo list. This ties
6124 in with the next entry:
6130 in with the next entry:
6125
6131
6126 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6132 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6127 has to specify is Plain, Color or Verbose for all exception
6133 has to specify is Plain, Color or Verbose for all exception
6128 handling.
6134 handling.
6129
6135
6130 * Removed ShellServices option. All this can really be done via
6136 * Removed ShellServices option. All this can really be done via
6131 the magic system. It's easier to extend, cleaner and has automatic
6137 the magic system. It's easier to extend, cleaner and has automatic
6132 namespace protection and documentation.
6138 namespace protection and documentation.
6133
6139
6134 2001-11-09 Fernando Perez <fperez@colorado.edu>
6140 2001-11-09 Fernando Perez <fperez@colorado.edu>
6135
6141
6136 * Fixed bug in output cache flushing (missing parameter to
6142 * Fixed bug in output cache flushing (missing parameter to
6137 __init__). Other small bugs fixed (found using pychecker).
6143 __init__). Other small bugs fixed (found using pychecker).
6138
6144
6139 * Version 0.1.4 opened for bugfixing.
6145 * Version 0.1.4 opened for bugfixing.
6140
6146
6141 2001-11-07 Fernando Perez <fperez@colorado.edu>
6147 2001-11-07 Fernando Perez <fperez@colorado.edu>
6142
6148
6143 * Version 0.1.3 released, mainly because of the raw_input bug.
6149 * Version 0.1.3 released, mainly because of the raw_input bug.
6144
6150
6145 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6151 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6146 and when testing for whether things were callable, a call could
6152 and when testing for whether things were callable, a call could
6147 actually be made to certain functions. They would get called again
6153 actually be made to certain functions. They would get called again
6148 once 'really' executed, with a resulting double call. A disaster
6154 once 'really' executed, with a resulting double call. A disaster
6149 in many cases (list.reverse() would never work!).
6155 in many cases (list.reverse() would never work!).
6150
6156
6151 * Removed prefilter() function, moved its code to raw_input (which
6157 * Removed prefilter() function, moved its code to raw_input (which
6152 after all was just a near-empty caller for prefilter). This saves
6158 after all was just a near-empty caller for prefilter). This saves
6153 a function call on every prompt, and simplifies the class a tiny bit.
6159 a function call on every prompt, and simplifies the class a tiny bit.
6154
6160
6155 * Fix _ip to __ip name in magic example file.
6161 * Fix _ip to __ip name in magic example file.
6156
6162
6157 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6163 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6158 work with non-gnu versions of tar.
6164 work with non-gnu versions of tar.
6159
6165
6160 2001-11-06 Fernando Perez <fperez@colorado.edu>
6166 2001-11-06 Fernando Perez <fperez@colorado.edu>
6161
6167
6162 * Version 0.1.2. Just to keep track of the recent changes.
6168 * Version 0.1.2. Just to keep track of the recent changes.
6163
6169
6164 * Fixed nasty bug in output prompt routine. It used to check 'if
6170 * Fixed nasty bug in output prompt routine. It used to check 'if
6165 arg != None...'. Problem is, this fails if arg implements a
6171 arg != None...'. Problem is, this fails if arg implements a
6166 special comparison (__cmp__) which disallows comparing to
6172 special comparison (__cmp__) which disallows comparing to
6167 None. Found it when trying to use the PhysicalQuantity module from
6173 None. Found it when trying to use the PhysicalQuantity module from
6168 ScientificPython.
6174 ScientificPython.
6169
6175
6170 2001-11-05 Fernando Perez <fperez@colorado.edu>
6176 2001-11-05 Fernando Perez <fperez@colorado.edu>
6171
6177
6172 * Also added dirs. Now the pushd/popd/dirs family functions
6178 * Also added dirs. Now the pushd/popd/dirs family functions
6173 basically like the shell, with the added convenience of going home
6179 basically like the shell, with the added convenience of going home
6174 when called with no args.
6180 when called with no args.
6175
6181
6176 * pushd/popd slightly modified to mimic shell behavior more
6182 * pushd/popd slightly modified to mimic shell behavior more
6177 closely.
6183 closely.
6178
6184
6179 * Added env,pushd,popd from ShellServices as magic functions. I
6185 * Added env,pushd,popd from ShellServices as magic functions. I
6180 think the cleanest will be to port all desired functions from
6186 think the cleanest will be to port all desired functions from
6181 ShellServices as magics and remove ShellServices altogether. This
6187 ShellServices as magics and remove ShellServices altogether. This
6182 will provide a single, clean way of adding functionality
6188 will provide a single, clean way of adding functionality
6183 (shell-type or otherwise) to IP.
6189 (shell-type or otherwise) to IP.
6184
6190
6185 2001-11-04 Fernando Perez <fperez@colorado.edu>
6191 2001-11-04 Fernando Perez <fperez@colorado.edu>
6186
6192
6187 * Added .ipython/ directory to sys.path. This way users can keep
6193 * Added .ipython/ directory to sys.path. This way users can keep
6188 customizations there and access them via import.
6194 customizations there and access them via import.
6189
6195
6190 2001-11-03 Fernando Perez <fperez@colorado.edu>
6196 2001-11-03 Fernando Perez <fperez@colorado.edu>
6191
6197
6192 * Opened version 0.1.1 for new changes.
6198 * Opened version 0.1.1 for new changes.
6193
6199
6194 * Changed version number to 0.1.0: first 'public' release, sent to
6200 * Changed version number to 0.1.0: first 'public' release, sent to
6195 Nathan and Janko.
6201 Nathan and Janko.
6196
6202
6197 * Lots of small fixes and tweaks.
6203 * Lots of small fixes and tweaks.
6198
6204
6199 * Minor changes to whos format. Now strings are shown, snipped if
6205 * Minor changes to whos format. Now strings are shown, snipped if
6200 too long.
6206 too long.
6201
6207
6202 * Changed ShellServices to work on __main__ so they show up in @who
6208 * Changed ShellServices to work on __main__ so they show up in @who
6203
6209
6204 * Help also works with ? at the end of a line:
6210 * Help also works with ? at the end of a line:
6205 ?sin and sin?
6211 ?sin and sin?
6206 both produce the same effect. This is nice, as often I use the
6212 both produce the same effect. This is nice, as often I use the
6207 tab-complete to find the name of a method, but I used to then have
6213 tab-complete to find the name of a method, but I used to then have
6208 to go to the beginning of the line to put a ? if I wanted more
6214 to go to the beginning of the line to put a ? if I wanted more
6209 info. Now I can just add the ? and hit return. Convenient.
6215 info. Now I can just add the ? and hit return. Convenient.
6210
6216
6211 2001-11-02 Fernando Perez <fperez@colorado.edu>
6217 2001-11-02 Fernando Perez <fperez@colorado.edu>
6212
6218
6213 * Python version check (>=2.1) added.
6219 * Python version check (>=2.1) added.
6214
6220
6215 * Added LazyPython documentation. At this point the docs are quite
6221 * Added LazyPython documentation. At this point the docs are quite
6216 a mess. A cleanup is in order.
6222 a mess. A cleanup is in order.
6217
6223
6218 * Auto-installer created. For some bizarre reason, the zipfiles
6224 * Auto-installer created. For some bizarre reason, the zipfiles
6219 module isn't working on my system. So I made a tar version
6225 module isn't working on my system. So I made a tar version
6220 (hopefully the command line options in various systems won't kill
6226 (hopefully the command line options in various systems won't kill
6221 me).
6227 me).
6222
6228
6223 * Fixes to Struct in genutils. Now all dictionary-like methods are
6229 * Fixes to Struct in genutils. Now all dictionary-like methods are
6224 protected (reasonably).
6230 protected (reasonably).
6225
6231
6226 * Added pager function to genutils and changed ? to print usage
6232 * Added pager function to genutils and changed ? to print usage
6227 note through it (it was too long).
6233 note through it (it was too long).
6228
6234
6229 * Added the LazyPython functionality. Works great! I changed the
6235 * Added the LazyPython functionality. Works great! I changed the
6230 auto-quote escape to ';', it's on home row and next to '. But
6236 auto-quote escape to ';', it's on home row and next to '. But
6231 both auto-quote and auto-paren (still /) escapes are command-line
6237 both auto-quote and auto-paren (still /) escapes are command-line
6232 parameters.
6238 parameters.
6233
6239
6234
6240
6235 2001-11-01 Fernando Perez <fperez@colorado.edu>
6241 2001-11-01 Fernando Perez <fperez@colorado.edu>
6236
6242
6237 * Version changed to 0.0.7. Fairly large change: configuration now
6243 * Version changed to 0.0.7. Fairly large change: configuration now
6238 is all stored in a directory, by default .ipython. There, all
6244 is all stored in a directory, by default .ipython. There, all
6239 config files have normal looking names (not .names)
6245 config files have normal looking names (not .names)
6240
6246
6241 * Version 0.0.6 Released first to Lucas and Archie as a test
6247 * Version 0.0.6 Released first to Lucas and Archie as a test
6242 run. Since it's the first 'semi-public' release, change version to
6248 run. Since it's the first 'semi-public' release, change version to
6243 > 0.0.6 for any changes now.
6249 > 0.0.6 for any changes now.
6244
6250
6245 * Stuff I had put in the ipplib.py changelog:
6251 * Stuff I had put in the ipplib.py changelog:
6246
6252
6247 Changes to InteractiveShell:
6253 Changes to InteractiveShell:
6248
6254
6249 - Made the usage message a parameter.
6255 - Made the usage message a parameter.
6250
6256
6251 - Require the name of the shell variable to be given. It's a bit
6257 - Require the name of the shell variable to be given. It's a bit
6252 of a hack, but allows the name 'shell' not to be hardwired in the
6258 of a hack, but allows the name 'shell' not to be hardwired in the
6253 magic (@) handler, which is problematic b/c it requires
6259 magic (@) handler, which is problematic b/c it requires
6254 polluting the global namespace with 'shell'. This in turn is
6260 polluting the global namespace with 'shell'. This in turn is
6255 fragile: if a user redefines a variable called shell, things
6261 fragile: if a user redefines a variable called shell, things
6256 break.
6262 break.
6257
6263
6258 - magic @: all functions available through @ need to be defined
6264 - magic @: all functions available through @ need to be defined
6259 as magic_<name>, even though they can be called simply as
6265 as magic_<name>, even though they can be called simply as
6260 @<name>. This allows the special command @magic to gather
6266 @<name>. This allows the special command @magic to gather
6261 information automatically about all existing magic functions,
6267 information automatically about all existing magic functions,
6262 even if they are run-time user extensions, by parsing the shell
6268 even if they are run-time user extensions, by parsing the shell
6263 instance __dict__ looking for special magic_ names.
6269 instance __dict__ looking for special magic_ names.
6264
6270
6265 - mainloop: added *two* local namespace parameters. This allows
6271 - mainloop: added *two* local namespace parameters. This allows
6266 the class to differentiate between parameters which were there
6272 the class to differentiate between parameters which were there
6267 before and after command line initialization was processed. This
6273 before and after command line initialization was processed. This
6268 way, later @who can show things loaded at startup by the
6274 way, later @who can show things loaded at startup by the
6269 user. This trick was necessary to make session saving/reloading
6275 user. This trick was necessary to make session saving/reloading
6270 really work: ideally after saving/exiting/reloading a session,
6276 really work: ideally after saving/exiting/reloading a session,
6271 *everything* should look the same, including the output of @who. I
6277 *everything* should look the same, including the output of @who. I
6272 was only able to make this work with this double namespace
6278 was only able to make this work with this double namespace
6273 trick.
6279 trick.
6274
6280
6275 - added a header to the logfile which allows (almost) full
6281 - added a header to the logfile which allows (almost) full
6276 session restoring.
6282 session restoring.
6277
6283
6278 - prepend lines beginning with @ or !, with a and log
6284 - prepend lines beginning with @ or !, with a and log
6279 them. Why? !lines: may be useful to know what you did @lines:
6285 them. Why? !lines: may be useful to know what you did @lines:
6280 they may affect session state. So when restoring a session, at
6286 they may affect session state. So when restoring a session, at
6281 least inform the user of their presence. I couldn't quite get
6287 least inform the user of their presence. I couldn't quite get
6282 them to properly re-execute, but at least the user is warned.
6288 them to properly re-execute, but at least the user is warned.
6283
6289
6284 * Started ChangeLog.
6290 * Started ChangeLog.
@@ -1,381 +1,383 b''
1 """
1 """
2 Test which prefilter transformations get called for various input lines.
2 Test which prefilter transformations get called for various input lines.
3 Note that this does *not* test the transformations themselves -- it's just
3 Note that this does *not* test the transformations themselves -- it's just
4 verifying that a particular combination of, e.g. config options and escape
4 verifying that a particular combination of, e.g. config options and escape
5 chars trigger the proper handle_X transform of the input line.
5 chars trigger the proper handle_X transform of the input line.
6
6
7 Usage: run from the command line with *normal* python, not ipython:
7 Usage: run from the command line with *normal* python, not ipython:
8 > python test_prefilter.py
8 > python test_prefilter.py
9
9
10 Fairly quiet output by default. Pass in -v to get everyone's favorite dots.
10 Fairly quiet output by default. Pass in -v to get everyone's favorite dots.
11 """
11 """
12
12
13 # The prefilter always ends in a call to some self.handle_X method. We swap
13 # The prefilter always ends in a call to some self.handle_X method. We swap
14 # all of those out so that we can capture which one was called.
14 # all of those out so that we can capture which one was called.
15
15
16 import sys
16 import sys
17 import IPython
17 import IPython
18 import IPython.ipapi
18 import IPython.ipapi
19 import sys
19 import sys
20
20
21 verbose = False
21 verbose = False
22 if len(sys.argv) > 1:
22 if len(sys.argv) > 1:
23 if sys.argv[1] == '-v':
23 if sys.argv[1] == '-v':
24 sys.argv = sys.argv[:-1] # IPython is confused by -v, apparently
24 sys.argv = sys.argv[:-1] # IPython is confused by -v, apparently
25 verbose = True
25 verbose = True
26
26
27 IPython.Shell.start()
27 IPython.Shell.start()
28
28
29 ip = IPython.ipapi.get()
29 ip = IPython.ipapi.get()
30
30
31 # Collect failed tests + stats and print them at the end
31 # Collect failed tests + stats and print them at the end
32 failures = []
32 failures = []
33 num_tests = 0
33 num_tests = 0
34
34
35 # Store the results in module vars as we go
35 # Store the results in module vars as we go
36 last_line = None
36 last_line = None
37 handler_called = None
37 handler_called = None
38 def install_mock_handler(name):
38 def install_mock_handler(name):
39 """Swap out one of the IP.handle_x methods with a function which can
39 """Swap out one of the IP.handle_x methods with a function which can
40 record which handler was called and what line was produced. The mock
40 record which handler was called and what line was produced. The mock
41 handler func always returns '', which causes ipython to cease handling
41 handler func always returns '', which causes ipython to cease handling
42 the string immediately. That way, that it doesn't echo output, raise
42 the string immediately. That way, that it doesn't echo output, raise
43 exceptions, etc. But do note that testing multiline strings thus gets
43 exceptions, etc. But do note that testing multiline strings thus gets
44 a bit hard."""
44 a bit hard."""
45 def mock_handler(self, line, continue_prompt=None,
45 def mock_handler(self, line, continue_prompt=None,
46 pre=None,iFun=None,theRest=None,
46 pre=None,iFun=None,theRest=None,
47 obj=None):
47 obj=None):
48 #print "Inside %s with '%s'" % (name, line)
48 #print "Inside %s with '%s'" % (name, line)
49 global last_line, handler_called
49 global last_line, handler_called
50 last_line = line
50 last_line = line
51 handler_called = name
51 handler_called = name
52 return ''
52 return ''
53 mock_handler.name = name
53 mock_handler.name = name
54 setattr(IPython.iplib.InteractiveShell, name, mock_handler)
54 setattr(IPython.iplib.InteractiveShell, name, mock_handler)
55
55
56 install_mock_handler('handle_normal')
56 install_mock_handler('handle_normal')
57 install_mock_handler('handle_auto')
57 install_mock_handler('handle_auto')
58 install_mock_handler('handle_magic')
58 install_mock_handler('handle_magic')
59 install_mock_handler('handle_help')
59 install_mock_handler('handle_help')
60 install_mock_handler('handle_shell_escape')
60 install_mock_handler('handle_shell_escape')
61 install_mock_handler('handle_alias')
61 install_mock_handler('handle_alias')
62 install_mock_handler('handle_emacs')
62 install_mock_handler('handle_emacs')
63
63
64
64
65 def reset_esc_handlers():
65 def reset_esc_handlers():
66 """The escape handlers are stored in a hash (as an attribute of the
66 """The escape handlers are stored in a hash (as an attribute of the
67 InteractiveShell *instance*), so we have to rebuild that hash to get our
67 InteractiveShell *instance*), so we have to rebuild that hash to get our
68 new handlers in there."""
68 new handlers in there."""
69 s = ip.IP
69 s = ip.IP
70 s.esc_handlers = {s.ESC_PAREN : s.handle_auto,
70 s.esc_handlers = {s.ESC_PAREN : s.handle_auto,
71 s.ESC_QUOTE : s.handle_auto,
71 s.ESC_QUOTE : s.handle_auto,
72 s.ESC_QUOTE2 : s.handle_auto,
72 s.ESC_QUOTE2 : s.handle_auto,
73 s.ESC_MAGIC : s.handle_magic,
73 s.ESC_MAGIC : s.handle_magic,
74 s.ESC_HELP : s.handle_help,
74 s.ESC_HELP : s.handle_help,
75 s.ESC_SHELL : s.handle_shell_escape,
75 s.ESC_SHELL : s.handle_shell_escape,
76 }
76 }
77 reset_esc_handlers()
77 reset_esc_handlers()
78
78
79 # This is so I don't have to quote over and over. Gotta be a better way.
79 # This is so I don't have to quote over and over. Gotta be a better way.
80 handle_normal = 'handle_normal'
80 handle_normal = 'handle_normal'
81 handle_auto = 'handle_auto'
81 handle_auto = 'handle_auto'
82 handle_magic = 'handle_magic'
82 handle_magic = 'handle_magic'
83 handle_help = 'handle_help'
83 handle_help = 'handle_help'
84 handle_shell_escape = 'handle_shell_escape'
84 handle_shell_escape = 'handle_shell_escape'
85 handle_alias = 'handle_alias'
85 handle_alias = 'handle_alias'
86 handle_emacs = 'handle_emacs'
86 handle_emacs = 'handle_emacs'
87
87
88 def check(assertion, failure_msg):
88 def check(assertion, failure_msg):
89 """Check a boolean assertion and fail with a message if necessary. Store
89 """Check a boolean assertion and fail with a message if necessary. Store
90 an error essage in module-level failures list in case of failure. Print
90 an error essage in module-level failures list in case of failure. Print
91 '.' or 'F' if module var Verbose is true.
91 '.' or 'F' if module var Verbose is true.
92 """
92 """
93 global num_tests
93 global num_tests
94 num_tests += 1
94 num_tests += 1
95 if assertion:
95 if assertion:
96 if verbose:
96 if verbose:
97 sys.stdout.write('.')
97 sys.stdout.write('.')
98 sys.stdout.flush()
98 sys.stdout.flush()
99 else:
99 else:
100 if verbose:
100 if verbose:
101 sys.stdout.write('F')
101 sys.stdout.write('F')
102 sys.stdout.flush()
102 sys.stdout.flush()
103 failures.append(failure_msg)
103 failures.append(failure_msg)
104
104
105
105
106 def check_handler(expected_handler, line):
106 def check_handler(expected_handler, line):
107 """Verify that the expected hander was called (for the given line,
107 """Verify that the expected hander was called (for the given line,
108 passed in for failure reporting).
108 passed in for failure reporting).
109
109
110 Pulled out to its own function so that tests which don't use
110 Pulled out to its own function so that tests which don't use
111 run_handler_tests can still take advantage of it."""
111 run_handler_tests can still take advantage of it."""
112 check(handler_called == expected_handler,
112 check(handler_called == expected_handler,
113 "Expected %s to be called for %s, "
113 "Expected %s to be called for %s, "
114 "instead %s called" % (expected_handler,
114 "instead %s called" % (expected_handler,
115 repr(line),
115 repr(line),
116 handler_called))
116 handler_called))
117
117
118
118
119 def run_handler_tests(h_tests):
119 def run_handler_tests(h_tests):
120 """Loop through a series of (input_line, handler_name) pairs, verifying
120 """Loop through a series of (input_line, handler_name) pairs, verifying
121 that, for each ip calls the given handler for the given line.
121 that, for each ip calls the given handler for the given line.
122
122
123 The verbose complaint includes the line passed in, so if that line can
123 The verbose complaint includes the line passed in, so if that line can
124 include enough info to find the error, the tests are modestly
124 include enough info to find the error, the tests are modestly
125 self-documenting.
125 self-documenting.
126 """
126 """
127 for ln, expected_handler in h_tests:
127 for ln, expected_handler in h_tests:
128 global handler_called
128 global handler_called
129 handler_called = None
129 handler_called = None
130 ip.runlines(ln)
130 ip.runlines(ln)
131 check_handler(expected_handler, ln)
131 check_handler(expected_handler, ln)
132
132
133 def run_one_test(ln, expected_handler):
133 def run_one_test(ln, expected_handler):
134 run_handler_tests([(ln, expected_handler)])
134 run_handler_tests([(ln, expected_handler)])
135
135
136
136
137 # =========================================
137 # =========================================
138 # Tests
138 # Tests
139 # =========================================
139 # =========================================
140
140
141
141
142 # Fundamental escape characters + whitespace & misc
142 # Fundamental escape characters + whitespace & misc
143 # =================================================
143 # =================================================
144 esc_handler_tests = [
144 esc_handler_tests = [
145 ( '?thing', handle_help, ),
145 ( '?thing', handle_help, ),
146 ( 'thing?', handle_help ), # '?' can trail...
146 ( 'thing?', handle_help ), # '?' can trail...
147 ( 'thing!', handle_normal), # but only '?' can trail
147 ( 'thing!', handle_normal), # but only '?' can trail
148 ( '!thing?', handle_help), # trailing '?' wins if more than one
148 ( '!thing?', handle_help), # trailing '?' wins if more than one
149 ( ' ?thing', handle_help), # ignore leading whitespace
149 ( ' ?thing', handle_help), # ignore leading whitespace
150 ( '!ls', handle_shell_escape ),
150 ( '!ls', handle_shell_escape ),
151 ( '%magic', handle_magic),
151 ( '%magic', handle_magic),
152 # Possibly, add test for /,; once those are unhooked from %autocall
152 # Possibly, add test for /,; once those are unhooked from %autocall
153 ( 'emacs_mode # PYTHON-MODE', handle_emacs ),
153 ( 'emacs_mode # PYTHON-MODE', handle_emacs ),
154 ( ' ', handle_normal),
154 ( ' ', handle_normal),
155 ]
155 ]
156 run_handler_tests(esc_handler_tests)
156 run_handler_tests(esc_handler_tests)
157
157
158
158
159
159
160 # Shell Escapes in Multi-line statements
160 # Shell Escapes in Multi-line statements
161 # ======================================
161 # ======================================
162 #
162 #
163 # We can't test this via runlines, since the hacked over-handlers all
163 # We can't test this via runlines, since the hacked over-handlers all
164 # return None, so continue_prompt never becomes true. Instead we drop
164 # return None, so continue_prompt never becomes true. Instead we drop
165 # into prefilter directly and pass in continue_prompt.
165 # into prefilter directly and pass in continue_prompt.
166
166
167 old_mls = ip.options.multi_line_specials
167 old_mls = ip.options.multi_line_specials
168 ln = '!ls $f multi_line_specials on'
168 ln = '!ls $f multi_line_specials on'
169 ignore = ip.IP.prefilter(ln, continue_prompt=True)
169 ignore = ip.IP.prefilter(ln, continue_prompt=True)
170 check_handler(handle_shell_escape, ln)
170 check_handler(handle_shell_escape, ln)
171
171
172 ip.options.multi_line_specials = 0
172 ip.options.multi_line_specials = 0
173 ln = '!ls $f multi_line_specials off'
173 ln = '!ls $f multi_line_specials off'
174 ignore = ip.IP.prefilter(ln, continue_prompt=True)
174 ignore = ip.IP.prefilter(ln, continue_prompt=True)
175 check_handler(handle_normal, ln)
175 check_handler(handle_normal, ln)
176
176
177 ip.options.multi_line_specials = old_mls
177 ip.options.multi_line_specials = old_mls
178
178
179
179
180 # Automagic
180 # Automagic
181 # =========
181 # =========
182
182
183 # Pick one magic fun and one non_magic fun, make sure both exist
183 # Pick one magic fun and one non_magic fun, make sure both exist
184 assert hasattr(ip.IP, "magic_cpaste")
184 assert hasattr(ip.IP, "magic_cpaste")
185 assert not hasattr(ip.IP, "magic_does_not_exist")
185 assert not hasattr(ip.IP, "magic_does_not_exist")
186 ip.options.automagic = 0
186 ip.options.automagic = 0
187 run_handler_tests([
187 run_handler_tests([
188 # Without automagic, only shows up with explicit escape
188 # Without automagic, only shows up with explicit escape
189 ( 'cpaste', handle_normal),
189 ( 'cpaste', handle_normal),
190 ( '%cpaste', handle_magic),
190 ( '%cpaste', handle_magic),
191 ( '%does_not_exist', handle_magic)
191 ( '%does_not_exist', handle_magic)
192 ])
192 ])
193 ip.options.automagic = 1
193 ip.options.automagic = 1
194 run_handler_tests([
194 run_handler_tests([
195 ( 'cpaste', handle_magic),
195 ( 'cpaste', handle_magic),
196 ( '%cpaste', handle_magic),
196 ( '%cpaste', handle_magic),
197 ( 'does_not_exist', handle_normal),
197 ( 'does_not_exist', handle_normal),
198 ( '%does_not_exist', handle_magic)])
198 ( '%does_not_exist', handle_magic)])
199
199
200 # If next elt starts with anything that could be an assignment, func call,
200 # If next elt starts with anything that could be an assignment, func call,
201 # etc, we don't call the magic func, unless explicitly escaped to do so.
201 # etc, we don't call the magic func, unless explicitly escaped to do so.
202 magic_killing_tests = []
202 magic_killing_tests = []
203 for c in list('!=()<>,'):
203 for c in list('!=()<>,'):
204 magic_killing_tests.append(('cpaste %s killed_automagic' % c, handle_normal))
204 magic_killing_tests.append(('cpaste %s killed_automagic' % c, handle_normal))
205 magic_killing_tests.append(('%%cpaste %s escaped_magic' % c, handle_magic))
205 magic_killing_tests.append(('%%cpaste %s escaped_magic' % c, handle_magic))
206 run_handler_tests(magic_killing_tests)
206 run_handler_tests(magic_killing_tests)
207
207
208 # magic on indented continuation lines -- on iff multi_line_specials == 1
208 # magic on indented continuation lines -- on iff multi_line_specials == 1
209 ip.options.multi_line_specials = 0
209 ip.options.multi_line_specials = 0
210 ln = 'cpaste multi_line off kills magic'
210 ln = 'cpaste multi_line off kills magic'
211 ignore = ip.IP.prefilter(ln, continue_prompt=True)
211 ignore = ip.IP.prefilter(ln, continue_prompt=True)
212 check_handler(handle_normal, ln)
212 check_handler(handle_normal, ln)
213
213
214 ip.options.multi_line_specials = 1
214 ip.options.multi_line_specials = 1
215 ln = 'cpaste multi_line on enables magic'
215 ln = 'cpaste multi_line on enables magic'
216 ignore = ip.IP.prefilter(ln, continue_prompt=True)
216 ignore = ip.IP.prefilter(ln, continue_prompt=True)
217 check_handler(handle_magic, ln)
217 check_handler(handle_magic, ln)
218
218
219 # user namespace shadows the magic one unless shell escaped
219 # user namespace shadows the magic one unless shell escaped
220 ip.user_ns['cpaste'] = 'user_ns'
220 ip.user_ns['cpaste'] = 'user_ns'
221 run_handler_tests([
221 run_handler_tests([
222 ( 'cpaste', handle_normal),
222 ( 'cpaste', handle_normal),
223 ( '%cpaste', handle_magic)])
223 ( '%cpaste', handle_magic)])
224 del ip.user_ns['cpaste']
224 del ip.user_ns['cpaste']
225
225
226
226
227 # Check for !=() turning off .ofind
227 # Check for !=() turning off .ofind
228 # =================================
228 # =================================
229 class AttributeMutator(object):
229 class AttributeMutator(object):
230 """A class which will be modified on attribute access, to test ofind"""
230 """A class which will be modified on attribute access, to test ofind"""
231 def __init__(self):
231 def __init__(self):
232 self.called = False
232 self.called = False
233
233
234 def getFoo(self): self.called = True
234 def getFoo(self): self.called = True
235 foo = property(getFoo)
235 foo = property(getFoo)
236
236
237 attr_mutator = AttributeMutator()
237 attr_mutator = AttributeMutator()
238 ip.to_user_ns('attr_mutator')
238 ip.to_user_ns('attr_mutator')
239
239
240 ip.options.autocall = 1
240 ip.options.autocall = 1
241
241
242 run_one_test('attr_mutator.foo should mutate', handle_normal)
242 run_one_test('attr_mutator.foo should mutate', handle_normal)
243 check(attr_mutator.called, 'ofind should be called in absence of assign characters')
243 check(attr_mutator.called, 'ofind should be called in absence of assign characters')
244
244
245 for c in list('!=()'): # XXX What about <> -- they *are* important above
245 for c in list('!=()'): # XXX What about <> -- they *are* important above
246 attr_mutator.called = False
246 attr_mutator.called = False
247 run_one_test('attr_mutator.foo %s should *not* mutate' % c, handle_normal)
247 run_one_test('attr_mutator.foo %s should *not* mutate' % c, handle_normal)
248 run_one_test('attr_mutator.foo%s should *not* mutate' % c, handle_normal)
249
248 check(not attr_mutator.called,
250 check(not attr_mutator.called,
249 'ofind should not be called near character %s' % c)
251 'ofind should not be called near character %s' % c)
250
252
251
253
252
254
253 # Alias expansion
255 # Alias expansion
254 # ===============
256 # ===============
255
257
256 # With autocall on or off, aliases should be shadowed by user, internal and
258 # With autocall on or off, aliases should be shadowed by user, internal and
257 # __builtin__ namespaces
259 # __builtin__ namespaces
258 #
260 #
259 # XXX Can aliases have '.' in their name? With autocall off, that works,
261 # XXX Can aliases have '.' in their name? With autocall off, that works,
260 # with autocall on, it doesn't. Hmmm.
262 # with autocall on, it doesn't. Hmmm.
261 import __builtin__
263 import __builtin__
262 for ac_state in [0,1]:
264 for ac_state in [0,1]:
263 ip.options.autocall = ac_state
265 ip.options.autocall = ac_state
264 ip.IP.alias_table['alias_cmd'] = 'alias_result'
266 ip.IP.alias_table['alias_cmd'] = 'alias_result'
265 ip.IP.alias_table['alias_head.with_dot'] = 'alias_result'
267 ip.IP.alias_table['alias_head.with_dot'] = 'alias_result'
266 run_handler_tests([
268 run_handler_tests([
267 ("alias_cmd", handle_alias),
269 ("alias_cmd", handle_alias),
268 # XXX See note above
270 # XXX See note above
269 #("alias_head.with_dot unshadowed, autocall=%s" % ac_state, handle_alias),
271 #("alias_head.with_dot unshadowed, autocall=%s" % ac_state, handle_alias),
270 ("alias_cmd.something aliases must match whole expr", handle_normal),
272 ("alias_cmd.something aliases must match whole expr", handle_normal),
271 ])
273 ])
272
274
273 for ns in [ip.user_ns, ip.IP.internal_ns, __builtin__.__dict__ ]:
275 for ns in [ip.user_ns, ip.IP.internal_ns, __builtin__.__dict__ ]:
274 ns['alias_cmd'] = 'a user value'
276 ns['alias_cmd'] = 'a user value'
275 ns['alias_head'] = 'a user value'
277 ns['alias_head'] = 'a user value'
276 run_handler_tests([
278 run_handler_tests([
277 ("alias_cmd", handle_normal),
279 ("alias_cmd", handle_normal),
278 ("alias_head.with_dot", handle_normal)])
280 ("alias_head.with_dot", handle_normal)])
279 del ns['alias_cmd']
281 del ns['alias_cmd']
280 del ns['alias_head']
282 del ns['alias_head']
281
283
282 ip.options.autocall = 1
284 ip.options.autocall = 1
283
285
284
286
285
287
286
288
287 # Autocall
289 # Autocall
288 # ========
290 # ========
289
291
290 # First, with autocalling fully off
292 # First, with autocalling fully off
291 ip.options.autocall = 0
293 ip.options.autocall = 0
292 run_handler_tests( [
294 run_handler_tests( [
293 # Since len is callable, these *should* get auto-called
295 # Since len is callable, these *should* get auto-called
294
296
295 # XXX Except, at the moment, they're *not*, because the code is wrong
297 # XXX Except, at the moment, they're *not*, because the code is wrong
296 # XXX So I'm commenting 'em out to keep the tests quiet
298 # XXX So I'm commenting 'em out to keep the tests quiet
297
299
298 #( '/len autocall_0', handle_auto),
300 #( '/len autocall_0', handle_auto),
299 #( ',len autocall_0 b0', handle_auto),
301 #( ',len autocall_0 b0', handle_auto),
300 #( ';len autocall_0 b0', handle_auto),
302 #( ';len autocall_0 b0', handle_auto),
301
303
302 # But these, since fun is not a callable, should *not* get auto-called
304 # But these, since fun is not a callable, should *not* get auto-called
303 ( '/fun autocall_0', handle_normal),
305 ( '/fun autocall_0', handle_normal),
304 ( ',fun autocall_0 b0', handle_normal),
306 ( ',fun autocall_0 b0', handle_normal),
305 ( ';fun autocall_0 b0', handle_normal),
307 ( ';fun autocall_0 b0', handle_normal),
306
308
307 # With no escapes, no autocalling should happen, callable or not
309 # With no escapes, no autocalling should happen, callable or not
308 ( 'len autocall_0', handle_normal),
310 ( 'len autocall_0', handle_normal),
309 ( 'fun autocall_0', handle_normal),
311 ( 'fun autocall_0', handle_normal),
310 ])
312 ])
311
313
312
314
313 # Now, with autocall in default, 'smart' mode
315 # Now, with autocall in default, 'smart' mode
314 ip.options.autocall = 1
316 ip.options.autocall = 1
315 run_handler_tests( [
317 run_handler_tests( [
316 # Since len is callable, these *do* get auto-called
318 # Since len is callable, these *do* get auto-called
317 ( '/len a1', handle_auto),
319 ( '/len a1', handle_auto),
318 ( ',len a1 b1', handle_auto),
320 ( ',len a1 b1', handle_auto),
319 ( ';len a1 b1', handle_auto),
321 ( ';len a1 b1', handle_auto),
320 # But these, since fun is not a callable, should *not* get auto-called
322 # But these, since fun is not a callable, should *not* get auto-called
321 ( '/fun a1', handle_normal),
323 ( '/fun a1', handle_normal),
322 ( ',fun a1 b1', handle_normal),
324 ( ',fun a1 b1', handle_normal),
323 ( ';fun a1 b1', handle_normal),
325 ( ';fun a1 b1', handle_normal),
324 # Autocalls without escapes
326 # Autocalls without escapes
325 ( 'len a1', handle_auto),
327 ( 'len a1', handle_auto),
326 ( 'fun a1', handle_normal), # Not callable -> no add
328 ( 'fun a1', handle_normal), # Not callable -> no add
327 # Autocalls only happen on things which look like funcs, even if
329 # Autocalls only happen on things which look like funcs, even if
328 # explicitly requested. Which, in this case means they look like a
330 # explicitly requested. Which, in this case means they look like a
329 # sequence of identifiers and . attribute references. So the second
331 # sequence of identifiers and . attribute references. So the second
330 # test should pass, but it's not at the moment (meaning, IPython is
332 # test should pass, but it's not at the moment (meaning, IPython is
331 # attempting to run an autocall). Though it does blow up in ipython
333 # attempting to run an autocall). Though it does blow up in ipython
332 # later (because of how lines are split, I think).
334 # later (because of how lines are split, I think).
333 ( '"abc".join range(4)', handle_normal),
335 ( '"abc".join range(4)', handle_normal),
334 # XXX ( '/"abc".join range(4)', handle_normal),
336 # XXX ( '/"abc".join range(4)', handle_normal),
335 ])
337 ])
336
338
337
339
338 # No tests for autocall = 2, since the extra magic there happens inside the
340 # No tests for autocall = 2, since the extra magic there happens inside the
339 # handle_auto function, which our test doesn't examine.
341 # handle_auto function, which our test doesn't examine.
340
342
341 # Note that we leave autocall in default, 1, 'smart' mode
343 # Note that we leave autocall in default, 1, 'smart' mode
342
344
343
345
344 # Autocall / Binary operators
346 # Autocall / Binary operators
345 # ==========================
347 # ==========================
346
348
347 # Even with autocall on, 'len in thing' won't transform.
349 # Even with autocall on, 'len in thing' won't transform.
348 # But ';len in thing' will
350 # But ';len in thing' will
349
351
350 # Note, the tests below don't check for multi-char ops. It could.
352 # Note, the tests below don't check for multi-char ops. It could.
351
353
352 # XXX % is a binary op and should be in the list, too, but fails
354 # XXX % is a binary op and should be in the list, too, but fails
353 bin_ops = list(r'<>,&^|*/+-') + 'is not in and or'.split()
355 bin_ops = list(r'<>,&^|*/+-') + 'is not in and or'.split()
354 bin_tests = []
356 bin_tests = []
355 for b in bin_ops:
357 for b in bin_ops:
356 bin_tests.append(('len %s binop_autocall' % b, handle_normal))
358 bin_tests.append(('len %s binop_autocall' % b, handle_normal))
357 bin_tests.append((';len %s binop_autocall' % b, handle_auto))
359 bin_tests.append((';len %s binop_autocall' % b, handle_auto))
358 bin_tests.append((',len %s binop_autocall' % b, handle_auto))
360 bin_tests.append((',len %s binop_autocall' % b, handle_auto))
359 bin_tests.append(('/len %s binop_autocall' % b, handle_auto))
361 bin_tests.append(('/len %s binop_autocall' % b, handle_auto))
360
362
361 # Who loves auto-generating tests?
363 # Who loves auto-generating tests?
362 run_handler_tests(bin_tests)
364 run_handler_tests(bin_tests)
363
365
364
366
365 # Possibly add tests for namespace shadowing (really ofind's business?).
367 # Possibly add tests for namespace shadowing (really ofind's business?).
366 #
368 #
367 # user > ipython internal > python builtin > alias > magic
369 # user > ipython internal > python builtin > alias > magic
368
370
369
371
370 # ============
372 # ============
371 # Test Summary
373 # Test Summary
372 # ============
374 # ============
373 num_f = len(failures)
375 num_f = len(failures)
374 if verbose:
376 if verbose:
375 print
377 print
376 print "%s tests run, %s failure%s" % (num_tests,
378 print "%s tests run, %s failure%s" % (num_tests,
377 num_f,
379 num_f,
378 num_f != 1 and "s" or "")
380 num_f != 1 and "s" or "")
379 for f in failures:
381 for f in failures:
380 print f
382 print f
381
383
General Comments 0
You need to be logged in to leave comments. Login now