##// END OF EJS Templates
/f 1 2 -> f(1,2), not f(1 2). I.e. autoparen fixes
vivainio -
Show More
@@ -1,2263 +1,2267 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 1091 2006-01-27 22:19:22Z vivainio $
9 $Id: iplib.py 1093 2006-01-28 00:18:49Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from __future__ import generators # for 2.2 backwards-compatibility
31 from __future__ import generators # for 2.2 backwards-compatibility
32
32
33 from IPython import Release
33 from IPython import Release
34 __author__ = '%s <%s>\n%s <%s>' % \
34 __author__ = '%s <%s>\n%s <%s>' % \
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
36 __license__ = Release.license
36 __license__ = Release.license
37 __version__ = Release.version
37 __version__ = Release.version
38
38
39 # Python standard modules
39 # Python standard modules
40 import __main__
40 import __main__
41 import __builtin__
41 import __builtin__
42 import StringIO
42 import StringIO
43 import bdb
43 import bdb
44 import cPickle as pickle
44 import cPickle as pickle
45 import codeop
45 import codeop
46 import exceptions
46 import exceptions
47 import glob
47 import glob
48 import inspect
48 import inspect
49 import keyword
49 import keyword
50 import new
50 import new
51 import os
51 import os
52 import pdb
52 import pdb
53 import pydoc
53 import pydoc
54 import re
54 import re
55 import shutil
55 import shutil
56 import string
56 import string
57 import sys
57 import sys
58 import tempfile
58 import tempfile
59 import traceback
59 import traceback
60 import types
60 import types
61
61
62 from pprint import pprint, pformat
62 from pprint import pprint, pformat
63
63
64 # IPython's own modules
64 # IPython's own modules
65 import IPython
65 import IPython
66 from IPython import OInspect,PyColorize,ultraTB
66 from IPython import OInspect,PyColorize,ultraTB
67 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
68 from IPython.FakeModule import FakeModule
68 from IPython.FakeModule import FakeModule
69 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
70 from IPython.Logger import Logger
70 from IPython.Logger import Logger
71 from IPython.Magic import Magic
71 from IPython.Magic import Magic
72 from IPython.Prompts import CachedOutput
72 from IPython.Prompts import CachedOutput
73 from IPython.ipstruct import Struct
73 from IPython.ipstruct import Struct
74 from IPython.background_jobs import BackgroundJobManager
74 from IPython.background_jobs import BackgroundJobManager
75 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.usage import cmd_line_usage,interactive_usage
76 from IPython.genutils import *
76 from IPython.genutils import *
77 import IPython.ipapi
77 import IPython.ipapi
78
78
79 # Globals
79 # Globals
80
80
81 # store the builtin raw_input globally, and use this always, in case user code
81 # store the builtin raw_input globally, and use this always, in case user code
82 # overwrites it (like wx.py.PyShell does)
82 # overwrites it (like wx.py.PyShell does)
83 raw_input_original = raw_input
83 raw_input_original = raw_input
84
84
85 # compiled regexps for autoindent management
85 # compiled regexps for autoindent management
86 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
87
87
88
88
89 #****************************************************************************
89 #****************************************************************************
90 # Some utility function definitions
90 # Some utility function definitions
91
91
92 ini_spaces_re = re.compile(r'^(\s+)')
92 ini_spaces_re = re.compile(r'^(\s+)')
93
93
94 def num_ini_spaces(strng):
94 def num_ini_spaces(strng):
95 """Return the number of initial spaces in a string"""
95 """Return the number of initial spaces in a string"""
96
96
97 ini_spaces = ini_spaces_re.match(strng)
97 ini_spaces = ini_spaces_re.match(strng)
98 if ini_spaces:
98 if ini_spaces:
99 return ini_spaces.end()
99 return ini_spaces.end()
100 else:
100 else:
101 return 0
101 return 0
102
102
103 def softspace(file, newvalue):
103 def softspace(file, newvalue):
104 """Copied from code.py, to remove the dependency"""
104 """Copied from code.py, to remove the dependency"""
105
105
106 oldvalue = 0
106 oldvalue = 0
107 try:
107 try:
108 oldvalue = file.softspace
108 oldvalue = file.softspace
109 except AttributeError:
109 except AttributeError:
110 pass
110 pass
111 try:
111 try:
112 file.softspace = newvalue
112 file.softspace = newvalue
113 except (AttributeError, TypeError):
113 except (AttributeError, TypeError):
114 # "attribute-less object" or "read-only attributes"
114 # "attribute-less object" or "read-only attributes"
115 pass
115 pass
116 return oldvalue
116 return oldvalue
117
117
118
118
119 #****************************************************************************
119 #****************************************************************************
120 # Local use exceptions
120 # Local use exceptions
121 class SpaceInInput(exceptions.Exception): pass
121 class SpaceInInput(exceptions.Exception): pass
122
122
123
123
124 #****************************************************************************
124 #****************************************************************************
125 # Local use classes
125 # Local use classes
126 class Bunch: pass
126 class Bunch: pass
127
127
128 class Undefined: pass
128 class Undefined: pass
129
129
130 class InputList(list):
130 class InputList(list):
131 """Class to store user input.
131 """Class to store user input.
132
132
133 It's basically a list, but slices return a string instead of a list, thus
133 It's basically a list, but slices return a string instead of a list, thus
134 allowing things like (assuming 'In' is an instance):
134 allowing things like (assuming 'In' is an instance):
135
135
136 exec In[4:7]
136 exec In[4:7]
137
137
138 or
138 or
139
139
140 exec In[5:9] + In[14] + In[21:25]"""
140 exec In[5:9] + In[14] + In[21:25]"""
141
141
142 def __getslice__(self,i,j):
142 def __getslice__(self,i,j):
143 return ''.join(list.__getslice__(self,i,j))
143 return ''.join(list.__getslice__(self,i,j))
144
144
145 class SyntaxTB(ultraTB.ListTB):
145 class SyntaxTB(ultraTB.ListTB):
146 """Extension which holds some state: the last exception value"""
146 """Extension which holds some state: the last exception value"""
147
147
148 def __init__(self,color_scheme = 'NoColor'):
148 def __init__(self,color_scheme = 'NoColor'):
149 ultraTB.ListTB.__init__(self,color_scheme)
149 ultraTB.ListTB.__init__(self,color_scheme)
150 self.last_syntax_error = None
150 self.last_syntax_error = None
151
151
152 def __call__(self, etype, value, elist):
152 def __call__(self, etype, value, elist):
153 self.last_syntax_error = value
153 self.last_syntax_error = value
154 ultraTB.ListTB.__call__(self,etype,value,elist)
154 ultraTB.ListTB.__call__(self,etype,value,elist)
155
155
156 def clear_err_state(self):
156 def clear_err_state(self):
157 """Return the current error state and clear it"""
157 """Return the current error state and clear it"""
158 e = self.last_syntax_error
158 e = self.last_syntax_error
159 self.last_syntax_error = None
159 self.last_syntax_error = None
160 return e
160 return e
161
161
162 #****************************************************************************
162 #****************************************************************************
163 # Main IPython class
163 # Main IPython class
164
164
165 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
165 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
166 # until a full rewrite is made. I've cleaned all cross-class uses of
166 # until a full rewrite is made. I've cleaned all cross-class uses of
167 # attributes and methods, but too much user code out there relies on the
167 # attributes and methods, but too much user code out there relies on the
168 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
168 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
169 #
169 #
170 # But at least now, all the pieces have been separated and we could, in
170 # But at least now, all the pieces have been separated and we could, in
171 # principle, stop using the mixin. This will ease the transition to the
171 # principle, stop using the mixin. This will ease the transition to the
172 # chainsaw branch.
172 # chainsaw branch.
173
173
174 # For reference, the following is the list of 'self.foo' uses in the Magic
174 # For reference, the following is the list of 'self.foo' uses in the Magic
175 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
175 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
176 # class, to prevent clashes.
176 # class, to prevent clashes.
177
177
178 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
178 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
179 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
179 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
180 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
180 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
181 # 'self.value']
181 # 'self.value']
182
182
183 class InteractiveShell(object,Magic):
183 class InteractiveShell(object,Magic):
184 """An enhanced console for Python."""
184 """An enhanced console for Python."""
185
185
186 # class attribute to indicate whether the class supports threads or not.
186 # class attribute to indicate whether the class supports threads or not.
187 # Subclasses with thread support should override this as needed.
187 # Subclasses with thread support should override this as needed.
188 isthreaded = False
188 isthreaded = False
189
189
190 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
190 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
191 user_ns = None,user_global_ns=None,banner2='',
191 user_ns = None,user_global_ns=None,banner2='',
192 custom_exceptions=((),None),embedded=False):
192 custom_exceptions=((),None),embedded=False):
193
193
194 # log system
194 # log system
195 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
195 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
196
196
197 # Produce a public API instance
197 # Produce a public API instance
198
198
199 self.api = IPython.ipapi.IPApi(self)
199 self.api = IPython.ipapi.IPApi(self)
200
200
201 # some minimal strict typechecks. For some core data structures, I
201 # some minimal strict typechecks. For some core data structures, I
202 # want actual basic python types, not just anything that looks like
202 # want actual basic python types, not just anything that looks like
203 # one. This is especially true for namespaces.
203 # one. This is especially true for namespaces.
204 for ns in (user_ns,user_global_ns):
204 for ns in (user_ns,user_global_ns):
205 if ns is not None and type(ns) != types.DictType:
205 if ns is not None and type(ns) != types.DictType:
206 raise TypeError,'namespace must be a dictionary'
206 raise TypeError,'namespace must be a dictionary'
207
207
208 # Job manager (for jobs run as background threads)
208 # Job manager (for jobs run as background threads)
209 self.jobs = BackgroundJobManager()
209 self.jobs = BackgroundJobManager()
210
210
211 # track which builtins we add, so we can clean up later
211 # track which builtins we add, so we can clean up later
212 self.builtins_added = {}
212 self.builtins_added = {}
213 # This method will add the necessary builtins for operation, but
213 # This method will add the necessary builtins for operation, but
214 # tracking what it did via the builtins_added dict.
214 # tracking what it did via the builtins_added dict.
215 self.add_builtins()
215 self.add_builtins()
216
216
217 # Do the intuitively correct thing for quit/exit: we remove the
217 # Do the intuitively correct thing for quit/exit: we remove the
218 # builtins if they exist, and our own magics will deal with this
218 # builtins if they exist, and our own magics will deal with this
219 try:
219 try:
220 del __builtin__.exit, __builtin__.quit
220 del __builtin__.exit, __builtin__.quit
221 except AttributeError:
221 except AttributeError:
222 pass
222 pass
223
223
224 # Store the actual shell's name
224 # Store the actual shell's name
225 self.name = name
225 self.name = name
226
226
227 # We need to know whether the instance is meant for embedding, since
227 # We need to know whether the instance is meant for embedding, since
228 # global/local namespaces need to be handled differently in that case
228 # global/local namespaces need to be handled differently in that case
229 self.embedded = embedded
229 self.embedded = embedded
230
230
231 # command compiler
231 # command compiler
232 self.compile = codeop.CommandCompiler()
232 self.compile = codeop.CommandCompiler()
233
233
234 # User input buffer
234 # User input buffer
235 self.buffer = []
235 self.buffer = []
236
236
237 # Default name given in compilation of code
237 # Default name given in compilation of code
238 self.filename = '<ipython console>'
238 self.filename = '<ipython console>'
239
239
240 # Make an empty namespace, which extension writers can rely on both
240 # Make an empty namespace, which extension writers can rely on both
241 # existing and NEVER being used by ipython itself. This gives them a
241 # existing and NEVER being used by ipython itself. This gives them a
242 # convenient location for storing additional information and state
242 # convenient location for storing additional information and state
243 # their extensions may require, without fear of collisions with other
243 # their extensions may require, without fear of collisions with other
244 # ipython names that may develop later.
244 # ipython names that may develop later.
245 self.meta = Struct()
245 self.meta = Struct()
246
246
247 # Create the namespace where the user will operate. user_ns is
247 # Create the namespace where the user will operate. user_ns is
248 # normally the only one used, and it is passed to the exec calls as
248 # normally the only one used, and it is passed to the exec calls as
249 # the locals argument. But we do carry a user_global_ns namespace
249 # the locals argument. But we do carry a user_global_ns namespace
250 # given as the exec 'globals' argument, This is useful in embedding
250 # given as the exec 'globals' argument, This is useful in embedding
251 # situations where the ipython shell opens in a context where the
251 # situations where the ipython shell opens in a context where the
252 # distinction between locals and globals is meaningful.
252 # distinction between locals and globals is meaningful.
253
253
254 # FIXME. For some strange reason, __builtins__ is showing up at user
254 # FIXME. For some strange reason, __builtins__ is showing up at user
255 # level as a dict instead of a module. This is a manual fix, but I
255 # level as a dict instead of a module. This is a manual fix, but I
256 # should really track down where the problem is coming from. Alex
256 # should really track down where the problem is coming from. Alex
257 # Schmolck reported this problem first.
257 # Schmolck reported this problem first.
258
258
259 # A useful post by Alex Martelli on this topic:
259 # A useful post by Alex Martelli on this topic:
260 # Re: inconsistent value from __builtins__
260 # Re: inconsistent value from __builtins__
261 # Von: Alex Martelli <aleaxit@yahoo.com>
261 # Von: Alex Martelli <aleaxit@yahoo.com>
262 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
262 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
263 # Gruppen: comp.lang.python
263 # Gruppen: comp.lang.python
264
264
265 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
265 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
266 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
266 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
267 # > <type 'dict'>
267 # > <type 'dict'>
268 # > >>> print type(__builtins__)
268 # > >>> print type(__builtins__)
269 # > <type 'module'>
269 # > <type 'module'>
270 # > Is this difference in return value intentional?
270 # > Is this difference in return value intentional?
271
271
272 # Well, it's documented that '__builtins__' can be either a dictionary
272 # Well, it's documented that '__builtins__' can be either a dictionary
273 # or a module, and it's been that way for a long time. Whether it's
273 # or a module, and it's been that way for a long time. Whether it's
274 # intentional (or sensible), I don't know. In any case, the idea is
274 # intentional (or sensible), I don't know. In any case, the idea is
275 # that if you need to access the built-in namespace directly, you
275 # that if you need to access the built-in namespace directly, you
276 # should start with "import __builtin__" (note, no 's') which will
276 # should start with "import __builtin__" (note, no 's') which will
277 # definitely give you a module. Yeah, it's somewhat confusing:-(.
277 # definitely give you a module. Yeah, it's somewhat confusing:-(.
278
278
279 if user_ns is None:
279 if user_ns is None:
280 # Set __name__ to __main__ to better match the behavior of the
280 # Set __name__ to __main__ to better match the behavior of the
281 # normal interpreter.
281 # normal interpreter.
282 user_ns = {'__name__' :'__main__',
282 user_ns = {'__name__' :'__main__',
283 '__builtins__' : __builtin__,
283 '__builtins__' : __builtin__,
284 }
284 }
285
285
286 if user_global_ns is None:
286 if user_global_ns is None:
287 user_global_ns = {}
287 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 # Set all default hooks, defined in the IPython.hooks module.
408 # Set all default hooks, defined in the IPython.hooks module.
409 hooks = IPython.hooks
409 hooks = IPython.hooks
410 for hook_name in hooks.__all__:
410 for hook_name in hooks.__all__:
411 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
411 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
412 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
412 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
413 #print "bound hook",hook_name
413 #print "bound hook",hook_name
414
414
415 # Flag to mark unconditional exit
415 # Flag to mark unconditional exit
416 self.exit_now = False
416 self.exit_now = False
417
417
418 self.usage_min = """\
418 self.usage_min = """\
419 An enhanced console for Python.
419 An enhanced console for Python.
420 Some of its features are:
420 Some of its features are:
421 - Readline support if the readline library is present.
421 - Readline support if the readline library is present.
422 - Tab completion in the local namespace.
422 - Tab completion in the local namespace.
423 - Logging of input, see command-line options.
423 - Logging of input, see command-line options.
424 - System shell escape via ! , eg !ls.
424 - System shell escape via ! , eg !ls.
425 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
425 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
426 - Keeps track of locally defined variables via %who, %whos.
426 - Keeps track of locally defined variables via %who, %whos.
427 - Show object information with a ? eg ?x or x? (use ?? for more info).
427 - Show object information with a ? eg ?x or x? (use ?? for more info).
428 """
428 """
429 if usage: self.usage = usage
429 if usage: self.usage = usage
430 else: self.usage = self.usage_min
430 else: self.usage = self.usage_min
431
431
432 # Storage
432 # Storage
433 self.rc = rc # This will hold all configuration information
433 self.rc = rc # This will hold all configuration information
434 self.pager = 'less'
434 self.pager = 'less'
435 # temporary files used for various purposes. Deleted at exit.
435 # temporary files used for various purposes. Deleted at exit.
436 self.tempfiles = []
436 self.tempfiles = []
437
437
438 # Keep track of readline usage (later set by init_readline)
438 # Keep track of readline usage (later set by init_readline)
439 self.has_readline = False
439 self.has_readline = False
440
440
441 # template for logfile headers. It gets resolved at runtime by the
441 # template for logfile headers. It gets resolved at runtime by the
442 # logstart method.
442 # logstart method.
443 self.loghead_tpl = \
443 self.loghead_tpl = \
444 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
444 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
445 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
445 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
446 #log# opts = %s
446 #log# opts = %s
447 #log# args = %s
447 #log# args = %s
448 #log# It is safe to make manual edits below here.
448 #log# It is safe to make manual edits below here.
449 #log#-----------------------------------------------------------------------
449 #log#-----------------------------------------------------------------------
450 """
450 """
451 # for pushd/popd management
451 # for pushd/popd management
452 try:
452 try:
453 self.home_dir = get_home_dir()
453 self.home_dir = get_home_dir()
454 except HomeDirError,msg:
454 except HomeDirError,msg:
455 fatal(msg)
455 fatal(msg)
456
456
457 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
457 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
458
458
459 # Functions to call the underlying shell.
459 # Functions to call the underlying shell.
460
460
461 # utility to expand user variables via Itpl
461 # utility to expand user variables via Itpl
462 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
462 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
463 self.user_ns))
463 self.user_ns))
464 # The first is similar to os.system, but it doesn't return a value,
464 # The first is similar to os.system, but it doesn't return a value,
465 # and it allows interpolation of variables in the user's namespace.
465 # and it allows interpolation of variables in the user's namespace.
466 self.system = lambda cmd: shell(self.var_expand(cmd),
466 self.system = lambda cmd: shell(self.var_expand(cmd),
467 header='IPython system call: ',
467 header='IPython system call: ',
468 verbose=self.rc.system_verbose)
468 verbose=self.rc.system_verbose)
469 # These are for getoutput and getoutputerror:
469 # These are for getoutput and getoutputerror:
470 self.getoutput = lambda cmd: \
470 self.getoutput = lambda cmd: \
471 getoutput(self.var_expand(cmd),
471 getoutput(self.var_expand(cmd),
472 header='IPython system call: ',
472 header='IPython system call: ',
473 verbose=self.rc.system_verbose)
473 verbose=self.rc.system_verbose)
474 self.getoutputerror = lambda cmd: \
474 self.getoutputerror = lambda cmd: \
475 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
475 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
476 self.user_ns)),
476 self.user_ns)),
477 header='IPython system call: ',
477 header='IPython system call: ',
478 verbose=self.rc.system_verbose)
478 verbose=self.rc.system_verbose)
479
479
480 # RegExp for splitting line contents into pre-char//first
480 # RegExp for splitting line contents into pre-char//first
481 # word-method//rest. For clarity, each group in on one line.
481 # word-method//rest. For clarity, each group in on one line.
482
482
483 # WARNING: update the regexp if the above escapes are changed, as they
483 # WARNING: update the regexp if the above escapes are changed, as they
484 # are hardwired in.
484 # are hardwired in.
485
485
486 # Don't get carried away with trying to make the autocalling catch too
486 # Don't get carried away with trying to make the autocalling catch too
487 # much: it's better to be conservative rather than to trigger hidden
487 # much: it's better to be conservative rather than to trigger hidden
488 # evals() somewhere and end up causing side effects.
488 # evals() somewhere and end up causing side effects.
489
489
490 self.line_split = re.compile(r'^([\s*,;/])'
490 self.line_split = re.compile(r'^([\s*,;/])'
491 r'([\?\w\.]+\w*\s*)'
491 r'([\?\w\.]+\w*\s*)'
492 r'(\(?.*$)')
492 r'(\(?.*$)')
493
493
494 # Original re, keep around for a while in case changes break something
494 # Original re, keep around for a while in case changes break something
495 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
495 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
496 # r'(\s*[\?\w\.]+\w*\s*)'
496 # r'(\s*[\?\w\.]+\w*\s*)'
497 # r'(\(?.*$)')
497 # r'(\(?.*$)')
498
498
499 # RegExp to identify potential function names
499 # RegExp to identify potential function names
500 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
500 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
501
501
502 # RegExp to exclude strings with this start from autocalling. In
502 # RegExp to exclude strings with this start from autocalling. In
503 # particular, all binary operators should be excluded, so that if foo
503 # particular, all binary operators should be excluded, so that if foo
504 # is callable, foo OP bar doesn't become foo(OP bar), which is
504 # is callable, foo OP bar doesn't become foo(OP bar), which is
505 # invalid. The characters '!=()' don't need to be checked for, as the
505 # invalid. The characters '!=()' don't need to be checked for, as the
506 # _prefilter routine explicitely does so, to catch direct calls and
506 # _prefilter routine explicitely does so, to catch direct calls and
507 # rebindings of existing names.
507 # rebindings of existing names.
508
508
509 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
509 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
510 # it affects the rest of the group in square brackets.
510 # it affects the rest of the group in square brackets.
511 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
511 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
512 '|^is |^not |^in |^and |^or ')
512 '|^is |^not |^in |^and |^or ')
513
513
514 # try to catch also methods for stuff in lists/tuples/dicts: off
514 # try to catch also methods for stuff in lists/tuples/dicts: off
515 # (experimental). For this to work, the line_split regexp would need
515 # (experimental). For this to work, the line_split regexp would need
516 # to be modified so it wouldn't break things at '['. That line is
516 # to be modified so it wouldn't break things at '['. That line is
517 # nasty enough that I shouldn't change it until I can test it _well_.
517 # nasty enough that I shouldn't change it until I can test it _well_.
518 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
518 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
519
519
520 # keep track of where we started running (mainly for crash post-mortem)
520 # keep track of where we started running (mainly for crash post-mortem)
521 self.starting_dir = os.getcwd()
521 self.starting_dir = os.getcwd()
522
522
523 # Various switches which can be set
523 # Various switches which can be set
524 self.CACHELENGTH = 5000 # this is cheap, it's just text
524 self.CACHELENGTH = 5000 # this is cheap, it's just text
525 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
525 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
526 self.banner2 = banner2
526 self.banner2 = banner2
527
527
528 # TraceBack handlers:
528 # TraceBack handlers:
529
529
530 # Syntax error handler.
530 # Syntax error handler.
531 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
531 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
532
532
533 # The interactive one is initialized with an offset, meaning we always
533 # The interactive one is initialized with an offset, meaning we always
534 # want to remove the topmost item in the traceback, which is our own
534 # want to remove the topmost item in the traceback, which is our own
535 # internal code. Valid modes: ['Plain','Context','Verbose']
535 # internal code. Valid modes: ['Plain','Context','Verbose']
536 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
536 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
537 color_scheme='NoColor',
537 color_scheme='NoColor',
538 tb_offset = 1)
538 tb_offset = 1)
539
539
540 # IPython itself shouldn't crash. This will produce a detailed
540 # IPython itself shouldn't crash. This will produce a detailed
541 # post-mortem if it does. But we only install the crash handler for
541 # post-mortem if it does. But we only install the crash handler for
542 # non-threaded shells, the threaded ones use a normal verbose reporter
542 # non-threaded shells, the threaded ones use a normal verbose reporter
543 # and lose the crash handler. This is because exceptions in the main
543 # and lose the crash handler. This is because exceptions in the main
544 # thread (such as in GUI code) propagate directly to sys.excepthook,
544 # thread (such as in GUI code) propagate directly to sys.excepthook,
545 # and there's no point in printing crash dumps for every user exception.
545 # and there's no point in printing crash dumps for every user exception.
546 if self.isthreaded:
546 if self.isthreaded:
547 sys.excepthook = ultraTB.FormattedTB()
547 sys.excepthook = ultraTB.FormattedTB()
548 else:
548 else:
549 from IPython import CrashHandler
549 from IPython import CrashHandler
550 sys.excepthook = CrashHandler.CrashHandler(self)
550 sys.excepthook = CrashHandler.CrashHandler(self)
551
551
552 # The instance will store a pointer to this, so that runtime code
552 # The instance will store a pointer to this, so that runtime code
553 # (such as magics) can access it. This is because during the
553 # (such as magics) can access it. This is because during the
554 # read-eval loop, it gets temporarily overwritten (to deal with GUI
554 # read-eval loop, it gets temporarily overwritten (to deal with GUI
555 # frameworks).
555 # frameworks).
556 self.sys_excepthook = sys.excepthook
556 self.sys_excepthook = sys.excepthook
557
557
558 # and add any custom exception handlers the user may have specified
558 # and add any custom exception handlers the user may have specified
559 self.set_custom_exc(*custom_exceptions)
559 self.set_custom_exc(*custom_exceptions)
560
560
561 # Object inspector
561 # Object inspector
562 self.inspector = OInspect.Inspector(OInspect.InspectColors,
562 self.inspector = OInspect.Inspector(OInspect.InspectColors,
563 PyColorize.ANSICodeColors,
563 PyColorize.ANSICodeColors,
564 'NoColor')
564 'NoColor')
565 # indentation management
565 # indentation management
566 self.autoindent = False
566 self.autoindent = False
567 self.indent_current_nsp = 0
567 self.indent_current_nsp = 0
568
568
569 # Make some aliases automatically
569 # Make some aliases automatically
570 # Prepare list of shell aliases to auto-define
570 # Prepare list of shell aliases to auto-define
571 if os.name == 'posix':
571 if os.name == 'posix':
572 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
572 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
573 'mv mv -i','rm rm -i','cp cp -i',
573 'mv mv -i','rm rm -i','cp cp -i',
574 'cat cat','less less','clear clear',
574 'cat cat','less less','clear clear',
575 # a better ls
575 # a better ls
576 'ls ls -F',
576 'ls ls -F',
577 # long ls
577 # long ls
578 'll ls -lF',
578 'll ls -lF',
579 # color ls
579 # color ls
580 'lc ls -F -o --color',
580 'lc ls -F -o --color',
581 # ls normal files only
581 # ls normal files only
582 'lf ls -F -o --color %l | grep ^-',
582 'lf ls -F -o --color %l | grep ^-',
583 # ls symbolic links
583 # ls symbolic links
584 'lk ls -F -o --color %l | grep ^l',
584 'lk ls -F -o --color %l | grep ^l',
585 # directories or links to directories,
585 # directories or links to directories,
586 'ldir ls -F -o --color %l | grep /$',
586 'ldir ls -F -o --color %l | grep /$',
587 # things which are executable
587 # things which are executable
588 'lx ls -F -o --color %l | grep ^-..x',
588 'lx ls -F -o --color %l | grep ^-..x',
589 )
589 )
590 elif os.name in ['nt','dos']:
590 elif os.name in ['nt','dos']:
591 auto_alias = ('dir dir /on', 'ls dir /on',
591 auto_alias = ('dir dir /on', 'ls dir /on',
592 'ddir dir /ad /on', 'ldir dir /ad /on',
592 'ddir dir /ad /on', 'ldir dir /ad /on',
593 'mkdir mkdir','rmdir rmdir','echo echo',
593 'mkdir mkdir','rmdir rmdir','echo echo',
594 'ren ren','cls cls','copy copy')
594 'ren ren','cls cls','copy copy')
595 else:
595 else:
596 auto_alias = ()
596 auto_alias = ()
597 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
597 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
598 # Call the actual (public) initializer
598 # Call the actual (public) initializer
599 self.init_auto_alias()
599 self.init_auto_alias()
600 # end __init__
600 # end __init__
601
601
602 def post_config_initialization(self):
602 def post_config_initialization(self):
603 """Post configuration init method
603 """Post configuration init method
604
604
605 This is called after the configuration files have been processed to
605 This is called after the configuration files have been processed to
606 'finalize' the initialization."""
606 'finalize' the initialization."""
607
607
608 rc = self.rc
608 rc = self.rc
609
609
610 # Load readline proper
610 # Load readline proper
611 if rc.readline:
611 if rc.readline:
612 self.init_readline()
612 self.init_readline()
613
613
614 # local shortcut, this is used a LOT
614 # local shortcut, this is used a LOT
615 self.log = self.logger.log
615 self.log = self.logger.log
616
616
617 # Initialize cache, set in/out prompts and printing system
617 # Initialize cache, set in/out prompts and printing system
618 self.outputcache = CachedOutput(self,
618 self.outputcache = CachedOutput(self,
619 rc.cache_size,
619 rc.cache_size,
620 rc.pprint,
620 rc.pprint,
621 input_sep = rc.separate_in,
621 input_sep = rc.separate_in,
622 output_sep = rc.separate_out,
622 output_sep = rc.separate_out,
623 output_sep2 = rc.separate_out2,
623 output_sep2 = rc.separate_out2,
624 ps1 = rc.prompt_in1,
624 ps1 = rc.prompt_in1,
625 ps2 = rc.prompt_in2,
625 ps2 = rc.prompt_in2,
626 ps_out = rc.prompt_out,
626 ps_out = rc.prompt_out,
627 pad_left = rc.prompts_pad_left)
627 pad_left = rc.prompts_pad_left)
628
628
629 # user may have over-ridden the default print hook:
629 # user may have over-ridden the default print hook:
630 try:
630 try:
631 self.outputcache.__class__.display = self.hooks.display
631 self.outputcache.__class__.display = self.hooks.display
632 except AttributeError:
632 except AttributeError:
633 pass
633 pass
634
634
635 # I don't like assigning globally to sys, because it means when embedding
635 # I don't like assigning globally to sys, because it means when embedding
636 # instances, each embedded instance overrides the previous choice. But
636 # instances, each embedded instance overrides the previous choice. But
637 # sys.displayhook seems to be called internally by exec, so I don't see a
637 # sys.displayhook seems to be called internally by exec, so I don't see a
638 # way around it.
638 # way around it.
639 sys.displayhook = self.outputcache
639 sys.displayhook = self.outputcache
640
640
641 # Set user colors (don't do it in the constructor above so that it
641 # Set user colors (don't do it in the constructor above so that it
642 # doesn't crash if colors option is invalid)
642 # doesn't crash if colors option is invalid)
643 self.magic_colors(rc.colors)
643 self.magic_colors(rc.colors)
644
644
645 # Set calling of pdb on exceptions
645 # Set calling of pdb on exceptions
646 self.call_pdb = rc.pdb
646 self.call_pdb = rc.pdb
647
647
648 # Load user aliases
648 # Load user aliases
649 for alias in rc.alias:
649 for alias in rc.alias:
650 self.magic_alias(alias)
650 self.magic_alias(alias)
651
651
652 # dynamic data that survives through sessions
652 # dynamic data that survives through sessions
653 # XXX make the filename a config option?
653 # XXX make the filename a config option?
654 persist_base = 'persist'
654 persist_base = 'persist'
655 if rc.profile:
655 if rc.profile:
656 persist_base += '_%s' % rc.profile
656 persist_base += '_%s' % rc.profile
657 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
657 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
658
658
659 try:
659 try:
660 self.persist = pickle.load(file(self.persist_fname))
660 self.persist = pickle.load(file(self.persist_fname))
661 except:
661 except:
662 self.persist = {}
662 self.persist = {}
663
663
664
664
665 for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]:
665 for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]:
666 try:
666 try:
667 obj = pickle.loads(value)
667 obj = pickle.loads(value)
668 except:
668 except:
669
669
670 print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key
670 print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key
671 print "The error was:",sys.exc_info()[0]
671 print "The error was:",sys.exc_info()[0]
672 continue
672 continue
673
673
674
674
675 self.user_ns[key] = obj
675 self.user_ns[key] = obj
676
676
677 def add_builtins(self):
677 def add_builtins(self):
678 """Store ipython references into the builtin namespace.
678 """Store ipython references into the builtin namespace.
679
679
680 Some parts of ipython operate via builtins injected here, which hold a
680 Some parts of ipython operate via builtins injected here, which hold a
681 reference to IPython itself."""
681 reference to IPython itself."""
682
682
683 builtins_new = dict(__IPYTHON__ = self,
683 builtins_new = dict(__IPYTHON__ = self,
684 ip_set_hook = self.set_hook,
684 ip_set_hook = self.set_hook,
685 jobs = self.jobs,
685 jobs = self.jobs,
686 ipmagic = self.ipmagic,
686 ipmagic = self.ipmagic,
687 ipalias = self.ipalias,
687 ipalias = self.ipalias,
688 ipsystem = self.ipsystem,
688 ipsystem = self.ipsystem,
689 )
689 )
690 for biname,bival in builtins_new.items():
690 for biname,bival in builtins_new.items():
691 try:
691 try:
692 # store the orignal value so we can restore it
692 # store the orignal value so we can restore it
693 self.builtins_added[biname] = __builtin__.__dict__[biname]
693 self.builtins_added[biname] = __builtin__.__dict__[biname]
694 except KeyError:
694 except KeyError:
695 # or mark that it wasn't defined, and we'll just delete it at
695 # or mark that it wasn't defined, and we'll just delete it at
696 # cleanup
696 # cleanup
697 self.builtins_added[biname] = Undefined
697 self.builtins_added[biname] = Undefined
698 __builtin__.__dict__[biname] = bival
698 __builtin__.__dict__[biname] = bival
699
699
700 # Keep in the builtins a flag for when IPython is active. We set it
700 # Keep in the builtins a flag for when IPython is active. We set it
701 # with setdefault so that multiple nested IPythons don't clobber one
701 # with setdefault so that multiple nested IPythons don't clobber one
702 # another. Each will increase its value by one upon being activated,
702 # another. Each will increase its value by one upon being activated,
703 # which also gives us a way to determine the nesting level.
703 # which also gives us a way to determine the nesting level.
704 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
704 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
705
705
706 def clean_builtins(self):
706 def clean_builtins(self):
707 """Remove any builtins which might have been added by add_builtins, or
707 """Remove any builtins which might have been added by add_builtins, or
708 restore overwritten ones to their previous values."""
708 restore overwritten ones to their previous values."""
709 for biname,bival in self.builtins_added.items():
709 for biname,bival in self.builtins_added.items():
710 if bival is Undefined:
710 if bival is Undefined:
711 del __builtin__.__dict__[biname]
711 del __builtin__.__dict__[biname]
712 else:
712 else:
713 __builtin__.__dict__[biname] = bival
713 __builtin__.__dict__[biname] = bival
714 self.builtins_added.clear()
714 self.builtins_added.clear()
715
715
716 def set_hook(self,name,hook, priority = 50):
716 def set_hook(self,name,hook, priority = 50):
717 """set_hook(name,hook) -> sets an internal IPython hook.
717 """set_hook(name,hook) -> sets an internal IPython hook.
718
718
719 IPython exposes some of its internal API as user-modifiable hooks. By
719 IPython exposes some of its internal API as user-modifiable hooks. By
720 adding your function to one of these hooks, you can modify IPython's
720 adding your function to one of these hooks, you can modify IPython's
721 behavior to call at runtime your own routines."""
721 behavior to call at runtime your own routines."""
722
722
723 # At some point in the future, this should validate the hook before it
723 # At some point in the future, this should validate the hook before it
724 # accepts it. Probably at least check that the hook takes the number
724 # accepts it. Probably at least check that the hook takes the number
725 # of args it's supposed to.
725 # of args it's supposed to.
726 dp = getattr(self.hooks, name, None)
726 dp = getattr(self.hooks, name, None)
727 if name not in IPython.hooks.__all__:
727 if name not in IPython.hooks.__all__:
728 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
728 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
729 if not dp:
729 if not dp:
730 dp = IPython.hooks.CommandChainDispatcher()
730 dp = IPython.hooks.CommandChainDispatcher()
731
731
732 f = new.instancemethod(hook,self,self.__class__)
732 f = new.instancemethod(hook,self,self.__class__)
733 try:
733 try:
734 dp.add(f,priority)
734 dp.add(f,priority)
735 except AttributeError:
735 except AttributeError:
736 # it was not commandchain, plain old func - replace
736 # it was not commandchain, plain old func - replace
737 dp = f
737 dp = f
738
738
739 setattr(self.hooks,name, dp)
739 setattr(self.hooks,name, dp)
740
740
741
741
742 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
742 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
743
743
744 def set_custom_exc(self,exc_tuple,handler):
744 def set_custom_exc(self,exc_tuple,handler):
745 """set_custom_exc(exc_tuple,handler)
745 """set_custom_exc(exc_tuple,handler)
746
746
747 Set a custom exception handler, which will be called if any of the
747 Set a custom exception handler, which will be called if any of the
748 exceptions in exc_tuple occur in the mainloop (specifically, in the
748 exceptions in exc_tuple occur in the mainloop (specifically, in the
749 runcode() method.
749 runcode() method.
750
750
751 Inputs:
751 Inputs:
752
752
753 - exc_tuple: a *tuple* of valid exceptions to call the defined
753 - exc_tuple: a *tuple* of valid exceptions to call the defined
754 handler for. It is very important that you use a tuple, and NOT A
754 handler for. It is very important that you use a tuple, and NOT A
755 LIST here, because of the way Python's except statement works. If
755 LIST here, because of the way Python's except statement works. If
756 you only want to trap a single exception, use a singleton tuple:
756 you only want to trap a single exception, use a singleton tuple:
757
757
758 exc_tuple == (MyCustomException,)
758 exc_tuple == (MyCustomException,)
759
759
760 - handler: this must be defined as a function with the following
760 - handler: this must be defined as a function with the following
761 basic interface: def my_handler(self,etype,value,tb).
761 basic interface: def my_handler(self,etype,value,tb).
762
762
763 This will be made into an instance method (via new.instancemethod)
763 This will be made into an instance method (via new.instancemethod)
764 of IPython itself, and it will be called if any of the exceptions
764 of IPython itself, and it will be called if any of the exceptions
765 listed in the exc_tuple are caught. If the handler is None, an
765 listed in the exc_tuple are caught. If the handler is None, an
766 internal basic one is used, which just prints basic info.
766 internal basic one is used, which just prints basic info.
767
767
768 WARNING: by putting in your own exception handler into IPython's main
768 WARNING: by putting in your own exception handler into IPython's main
769 execution loop, you run a very good chance of nasty crashes. This
769 execution loop, you run a very good chance of nasty crashes. This
770 facility should only be used if you really know what you are doing."""
770 facility should only be used if you really know what you are doing."""
771
771
772 assert type(exc_tuple)==type(()) , \
772 assert type(exc_tuple)==type(()) , \
773 "The custom exceptions must be given AS A TUPLE."
773 "The custom exceptions must be given AS A TUPLE."
774
774
775 def dummy_handler(self,etype,value,tb):
775 def dummy_handler(self,etype,value,tb):
776 print '*** Simple custom exception handler ***'
776 print '*** Simple custom exception handler ***'
777 print 'Exception type :',etype
777 print 'Exception type :',etype
778 print 'Exception value:',value
778 print 'Exception value:',value
779 print 'Traceback :',tb
779 print 'Traceback :',tb
780 print 'Source code :','\n'.join(self.buffer)
780 print 'Source code :','\n'.join(self.buffer)
781
781
782 if handler is None: handler = dummy_handler
782 if handler is None: handler = dummy_handler
783
783
784 self.CustomTB = new.instancemethod(handler,self,self.__class__)
784 self.CustomTB = new.instancemethod(handler,self,self.__class__)
785 self.custom_exceptions = exc_tuple
785 self.custom_exceptions = exc_tuple
786
786
787 def set_custom_completer(self,completer,pos=0):
787 def set_custom_completer(self,completer,pos=0):
788 """set_custom_completer(completer,pos=0)
788 """set_custom_completer(completer,pos=0)
789
789
790 Adds a new custom completer function.
790 Adds a new custom completer function.
791
791
792 The position argument (defaults to 0) is the index in the completers
792 The position argument (defaults to 0) is the index in the completers
793 list where you want the completer to be inserted."""
793 list where you want the completer to be inserted."""
794
794
795 newcomp = new.instancemethod(completer,self.Completer,
795 newcomp = new.instancemethod(completer,self.Completer,
796 self.Completer.__class__)
796 self.Completer.__class__)
797 self.Completer.matchers.insert(pos,newcomp)
797 self.Completer.matchers.insert(pos,newcomp)
798
798
799 def _get_call_pdb(self):
799 def _get_call_pdb(self):
800 return self._call_pdb
800 return self._call_pdb
801
801
802 def _set_call_pdb(self,val):
802 def _set_call_pdb(self,val):
803
803
804 if val not in (0,1,False,True):
804 if val not in (0,1,False,True):
805 raise ValueError,'new call_pdb value must be boolean'
805 raise ValueError,'new call_pdb value must be boolean'
806
806
807 # store value in instance
807 # store value in instance
808 self._call_pdb = val
808 self._call_pdb = val
809
809
810 # notify the actual exception handlers
810 # notify the actual exception handlers
811 self.InteractiveTB.call_pdb = val
811 self.InteractiveTB.call_pdb = val
812 if self.isthreaded:
812 if self.isthreaded:
813 try:
813 try:
814 self.sys_excepthook.call_pdb = val
814 self.sys_excepthook.call_pdb = val
815 except:
815 except:
816 warn('Failed to activate pdb for threaded exception handler')
816 warn('Failed to activate pdb for threaded exception handler')
817
817
818 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
818 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
819 'Control auto-activation of pdb at exceptions')
819 'Control auto-activation of pdb at exceptions')
820
820
821
821
822 # These special functions get installed in the builtin namespace, to
822 # These special functions get installed in the builtin namespace, to
823 # provide programmatic (pure python) access to magics, aliases and system
823 # provide programmatic (pure python) access to magics, aliases and system
824 # calls. This is important for logging, user scripting, and more.
824 # calls. This is important for logging, user scripting, and more.
825
825
826 # We are basically exposing, via normal python functions, the three
826 # We are basically exposing, via normal python functions, the three
827 # mechanisms in which ipython offers special call modes (magics for
827 # mechanisms in which ipython offers special call modes (magics for
828 # internal control, aliases for direct system access via pre-selected
828 # internal control, aliases for direct system access via pre-selected
829 # names, and !cmd for calling arbitrary system commands).
829 # names, and !cmd for calling arbitrary system commands).
830
830
831 def ipmagic(self,arg_s):
831 def ipmagic(self,arg_s):
832 """Call a magic function by name.
832 """Call a magic function by name.
833
833
834 Input: a string containing the name of the magic function to call and any
834 Input: a string containing the name of the magic function to call and any
835 additional arguments to be passed to the magic.
835 additional arguments to be passed to the magic.
836
836
837 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
837 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
838 prompt:
838 prompt:
839
839
840 In[1]: %name -opt foo bar
840 In[1]: %name -opt foo bar
841
841
842 To call a magic without arguments, simply use ipmagic('name').
842 To call a magic without arguments, simply use ipmagic('name').
843
843
844 This provides a proper Python function to call IPython's magics in any
844 This provides a proper Python function to call IPython's magics in any
845 valid Python code you can type at the interpreter, including loops and
845 valid Python code you can type at the interpreter, including loops and
846 compound statements. It is added by IPython to the Python builtin
846 compound statements. It is added by IPython to the Python builtin
847 namespace upon initialization."""
847 namespace upon initialization."""
848
848
849 args = arg_s.split(' ',1)
849 args = arg_s.split(' ',1)
850 magic_name = args[0]
850 magic_name = args[0]
851 magic_name = magic_name.lstrip(self.ESC_MAGIC)
851 magic_name = magic_name.lstrip(self.ESC_MAGIC)
852
852
853 try:
853 try:
854 magic_args = args[1]
854 magic_args = args[1]
855 except IndexError:
855 except IndexError:
856 magic_args = ''
856 magic_args = ''
857 fn = getattr(self,'magic_'+magic_name,None)
857 fn = getattr(self,'magic_'+magic_name,None)
858 if fn is None:
858 if fn is None:
859 error("Magic function `%s` not found." % magic_name)
859 error("Magic function `%s` not found." % magic_name)
860 else:
860 else:
861 magic_args = self.var_expand(magic_args)
861 magic_args = self.var_expand(magic_args)
862 return fn(magic_args)
862 return fn(magic_args)
863
863
864 def ipalias(self,arg_s):
864 def ipalias(self,arg_s):
865 """Call an alias by name.
865 """Call an alias by name.
866
866
867 Input: a string containing the name of the alias to call and any
867 Input: a string containing the name of the alias to call and any
868 additional arguments to be passed to the magic.
868 additional arguments to be passed to the magic.
869
869
870 ipalias('name -opt foo bar') is equivalent to typing at the ipython
870 ipalias('name -opt foo bar') is equivalent to typing at the ipython
871 prompt:
871 prompt:
872
872
873 In[1]: name -opt foo bar
873 In[1]: name -opt foo bar
874
874
875 To call an alias without arguments, simply use ipalias('name').
875 To call an alias without arguments, simply use ipalias('name').
876
876
877 This provides a proper Python function to call IPython's aliases in any
877 This provides a proper Python function to call IPython's aliases in any
878 valid Python code you can type at the interpreter, including loops and
878 valid Python code you can type at the interpreter, including loops and
879 compound statements. It is added by IPython to the Python builtin
879 compound statements. It is added by IPython to the Python builtin
880 namespace upon initialization."""
880 namespace upon initialization."""
881
881
882 args = arg_s.split(' ',1)
882 args = arg_s.split(' ',1)
883 alias_name = args[0]
883 alias_name = args[0]
884 try:
884 try:
885 alias_args = args[1]
885 alias_args = args[1]
886 except IndexError:
886 except IndexError:
887 alias_args = ''
887 alias_args = ''
888 if alias_name in self.alias_table:
888 if alias_name in self.alias_table:
889 self.call_alias(alias_name,alias_args)
889 self.call_alias(alias_name,alias_args)
890 else:
890 else:
891 error("Alias `%s` not found." % alias_name)
891 error("Alias `%s` not found." % alias_name)
892
892
893 def ipsystem(self,arg_s):
893 def ipsystem(self,arg_s):
894 """Make a system call, using IPython."""
894 """Make a system call, using IPython."""
895
895
896 self.system(arg_s)
896 self.system(arg_s)
897
897
898 def complete(self,text):
898 def complete(self,text):
899 """Return a sorted list of all possible completions on text.
899 """Return a sorted list of all possible completions on text.
900
900
901 Inputs:
901 Inputs:
902
902
903 - text: a string of text to be completed on.
903 - text: a string of text to be completed on.
904
904
905 This is a wrapper around the completion mechanism, similar to what
905 This is a wrapper around the completion mechanism, similar to what
906 readline does at the command line when the TAB key is hit. By
906 readline does at the command line when the TAB key is hit. By
907 exposing it as a method, it can be used by other non-readline
907 exposing it as a method, it can be used by other non-readline
908 environments (such as GUIs) for text completion.
908 environments (such as GUIs) for text completion.
909
909
910 Simple usage example:
910 Simple usage example:
911
911
912 In [1]: x = 'hello'
912 In [1]: x = 'hello'
913
913
914 In [2]: __IP.complete('x.l')
914 In [2]: __IP.complete('x.l')
915 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
915 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
916
916
917 complete = self.Completer.complete
917 complete = self.Completer.complete
918 state = 0
918 state = 0
919 # use a dict so we get unique keys, since ipyhton's multiple
919 # use a dict so we get unique keys, since ipyhton's multiple
920 # completers can return duplicates.
920 # completers can return duplicates.
921 comps = {}
921 comps = {}
922 while True:
922 while True:
923 newcomp = complete(text,state)
923 newcomp = complete(text,state)
924 if newcomp is None:
924 if newcomp is None:
925 break
925 break
926 comps[newcomp] = 1
926 comps[newcomp] = 1
927 state += 1
927 state += 1
928 outcomps = comps.keys()
928 outcomps = comps.keys()
929 outcomps.sort()
929 outcomps.sort()
930 return outcomps
930 return outcomps
931
931
932 def set_completer_frame(self, frame=None):
932 def set_completer_frame(self, frame=None):
933 if frame:
933 if frame:
934 self.Completer.namespace = frame.f_locals
934 self.Completer.namespace = frame.f_locals
935 self.Completer.global_namespace = frame.f_globals
935 self.Completer.global_namespace = frame.f_globals
936 else:
936 else:
937 self.Completer.namespace = self.user_ns
937 self.Completer.namespace = self.user_ns
938 self.Completer.global_namespace = self.user_global_ns
938 self.Completer.global_namespace = self.user_global_ns
939
939
940 def init_auto_alias(self):
940 def init_auto_alias(self):
941 """Define some aliases automatically.
941 """Define some aliases automatically.
942
942
943 These are ALL parameter-less aliases"""
943 These are ALL parameter-less aliases"""
944
944
945 for alias,cmd in self.auto_alias:
945 for alias,cmd in self.auto_alias:
946 self.alias_table[alias] = (0,cmd)
946 self.alias_table[alias] = (0,cmd)
947
947
948 def alias_table_validate(self,verbose=0):
948 def alias_table_validate(self,verbose=0):
949 """Update information about the alias table.
949 """Update information about the alias table.
950
950
951 In particular, make sure no Python keywords/builtins are in it."""
951 In particular, make sure no Python keywords/builtins are in it."""
952
952
953 no_alias = self.no_alias
953 no_alias = self.no_alias
954 for k in self.alias_table.keys():
954 for k in self.alias_table.keys():
955 if k in no_alias:
955 if k in no_alias:
956 del self.alias_table[k]
956 del self.alias_table[k]
957 if verbose:
957 if verbose:
958 print ("Deleting alias <%s>, it's a Python "
958 print ("Deleting alias <%s>, it's a Python "
959 "keyword or builtin." % k)
959 "keyword or builtin." % k)
960
960
961 def set_autoindent(self,value=None):
961 def set_autoindent(self,value=None):
962 """Set the autoindent flag, checking for readline support.
962 """Set the autoindent flag, checking for readline support.
963
963
964 If called with no arguments, it acts as a toggle."""
964 If called with no arguments, it acts as a toggle."""
965
965
966 if not self.has_readline:
966 if not self.has_readline:
967 if os.name == 'posix':
967 if os.name == 'posix':
968 warn("The auto-indent feature requires the readline library")
968 warn("The auto-indent feature requires the readline library")
969 self.autoindent = 0
969 self.autoindent = 0
970 return
970 return
971 if value is None:
971 if value is None:
972 self.autoindent = not self.autoindent
972 self.autoindent = not self.autoindent
973 else:
973 else:
974 self.autoindent = value
974 self.autoindent = value
975
975
976 def rc_set_toggle(self,rc_field,value=None):
976 def rc_set_toggle(self,rc_field,value=None):
977 """Set or toggle a field in IPython's rc config. structure.
977 """Set or toggle a field in IPython's rc config. structure.
978
978
979 If called with no arguments, it acts as a toggle.
979 If called with no arguments, it acts as a toggle.
980
980
981 If called with a non-existent field, the resulting AttributeError
981 If called with a non-existent field, the resulting AttributeError
982 exception will propagate out."""
982 exception will propagate out."""
983
983
984 rc_val = getattr(self.rc,rc_field)
984 rc_val = getattr(self.rc,rc_field)
985 if value is None:
985 if value is None:
986 value = not rc_val
986 value = not rc_val
987 setattr(self.rc,rc_field,value)
987 setattr(self.rc,rc_field,value)
988
988
989 def user_setup(self,ipythondir,rc_suffix,mode='install'):
989 def user_setup(self,ipythondir,rc_suffix,mode='install'):
990 """Install the user configuration directory.
990 """Install the user configuration directory.
991
991
992 Can be called when running for the first time or to upgrade the user's
992 Can be called when running for the first time or to upgrade the user's
993 .ipython/ directory with the mode parameter. Valid modes are 'install'
993 .ipython/ directory with the mode parameter. Valid modes are 'install'
994 and 'upgrade'."""
994 and 'upgrade'."""
995
995
996 def wait():
996 def wait():
997 try:
997 try:
998 raw_input("Please press <RETURN> to start IPython.")
998 raw_input("Please press <RETURN> to start IPython.")
999 except EOFError:
999 except EOFError:
1000 print >> Term.cout
1000 print >> Term.cout
1001 print '*'*70
1001 print '*'*70
1002
1002
1003 cwd = os.getcwd() # remember where we started
1003 cwd = os.getcwd() # remember where we started
1004 glb = glob.glob
1004 glb = glob.glob
1005 print '*'*70
1005 print '*'*70
1006 if mode == 'install':
1006 if mode == 'install':
1007 print \
1007 print \
1008 """Welcome to IPython. I will try to create a personal configuration directory
1008 """Welcome to IPython. I will try to create a personal configuration directory
1009 where you can customize many aspects of IPython's functionality in:\n"""
1009 where you can customize many aspects of IPython's functionality in:\n"""
1010 else:
1010 else:
1011 print 'I am going to upgrade your configuration in:'
1011 print 'I am going to upgrade your configuration in:'
1012
1012
1013 print ipythondir
1013 print ipythondir
1014
1014
1015 rcdirend = os.path.join('IPython','UserConfig')
1015 rcdirend = os.path.join('IPython','UserConfig')
1016 cfg = lambda d: os.path.join(d,rcdirend)
1016 cfg = lambda d: os.path.join(d,rcdirend)
1017 try:
1017 try:
1018 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1018 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1019 except IOError:
1019 except IOError:
1020 warning = """
1020 warning = """
1021 Installation error. IPython's directory was not found.
1021 Installation error. IPython's directory was not found.
1022
1022
1023 Check the following:
1023 Check the following:
1024
1024
1025 The ipython/IPython directory should be in a directory belonging to your
1025 The ipython/IPython directory should be in a directory belonging to your
1026 PYTHONPATH environment variable (that is, it should be in a directory
1026 PYTHONPATH environment variable (that is, it should be in a directory
1027 belonging to sys.path). You can copy it explicitly there or just link to it.
1027 belonging to sys.path). You can copy it explicitly there or just link to it.
1028
1028
1029 IPython will proceed with builtin defaults.
1029 IPython will proceed with builtin defaults.
1030 """
1030 """
1031 warn(warning)
1031 warn(warning)
1032 wait()
1032 wait()
1033 return
1033 return
1034
1034
1035 if mode == 'install':
1035 if mode == 'install':
1036 try:
1036 try:
1037 shutil.copytree(rcdir,ipythondir)
1037 shutil.copytree(rcdir,ipythondir)
1038 os.chdir(ipythondir)
1038 os.chdir(ipythondir)
1039 rc_files = glb("ipythonrc*")
1039 rc_files = glb("ipythonrc*")
1040 for rc_file in rc_files:
1040 for rc_file in rc_files:
1041 os.rename(rc_file,rc_file+rc_suffix)
1041 os.rename(rc_file,rc_file+rc_suffix)
1042 except:
1042 except:
1043 warning = """
1043 warning = """
1044
1044
1045 There was a problem with the installation:
1045 There was a problem with the installation:
1046 %s
1046 %s
1047 Try to correct it or contact the developers if you think it's a bug.
1047 Try to correct it or contact the developers if you think it's a bug.
1048 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1048 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1049 warn(warning)
1049 warn(warning)
1050 wait()
1050 wait()
1051 return
1051 return
1052
1052
1053 elif mode == 'upgrade':
1053 elif mode == 'upgrade':
1054 try:
1054 try:
1055 os.chdir(ipythondir)
1055 os.chdir(ipythondir)
1056 except:
1056 except:
1057 print """
1057 print """
1058 Can not upgrade: changing to directory %s failed. Details:
1058 Can not upgrade: changing to directory %s failed. Details:
1059 %s
1059 %s
1060 """ % (ipythondir,sys.exc_info()[1])
1060 """ % (ipythondir,sys.exc_info()[1])
1061 wait()
1061 wait()
1062 return
1062 return
1063 else:
1063 else:
1064 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1064 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1065 for new_full_path in sources:
1065 for new_full_path in sources:
1066 new_filename = os.path.basename(new_full_path)
1066 new_filename = os.path.basename(new_full_path)
1067 if new_filename.startswith('ipythonrc'):
1067 if new_filename.startswith('ipythonrc'):
1068 new_filename = new_filename + rc_suffix
1068 new_filename = new_filename + rc_suffix
1069 # The config directory should only contain files, skip any
1069 # The config directory should only contain files, skip any
1070 # directories which may be there (like CVS)
1070 # directories which may be there (like CVS)
1071 if os.path.isdir(new_full_path):
1071 if os.path.isdir(new_full_path):
1072 continue
1072 continue
1073 if os.path.exists(new_filename):
1073 if os.path.exists(new_filename):
1074 old_file = new_filename+'.old'
1074 old_file = new_filename+'.old'
1075 if os.path.exists(old_file):
1075 if os.path.exists(old_file):
1076 os.remove(old_file)
1076 os.remove(old_file)
1077 os.rename(new_filename,old_file)
1077 os.rename(new_filename,old_file)
1078 shutil.copy(new_full_path,new_filename)
1078 shutil.copy(new_full_path,new_filename)
1079 else:
1079 else:
1080 raise ValueError,'unrecognized mode for install:',`mode`
1080 raise ValueError,'unrecognized mode for install:',`mode`
1081
1081
1082 # Fix line-endings to those native to each platform in the config
1082 # Fix line-endings to those native to each platform in the config
1083 # directory.
1083 # directory.
1084 try:
1084 try:
1085 os.chdir(ipythondir)
1085 os.chdir(ipythondir)
1086 except:
1086 except:
1087 print """
1087 print """
1088 Problem: changing to directory %s failed.
1088 Problem: changing to directory %s failed.
1089 Details:
1089 Details:
1090 %s
1090 %s
1091
1091
1092 Some configuration files may have incorrect line endings. This should not
1092 Some configuration files may have incorrect line endings. This should not
1093 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1093 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1094 wait()
1094 wait()
1095 else:
1095 else:
1096 for fname in glb('ipythonrc*'):
1096 for fname in glb('ipythonrc*'):
1097 try:
1097 try:
1098 native_line_ends(fname,backup=0)
1098 native_line_ends(fname,backup=0)
1099 except IOError:
1099 except IOError:
1100 pass
1100 pass
1101
1101
1102 if mode == 'install':
1102 if mode == 'install':
1103 print """
1103 print """
1104 Successful installation!
1104 Successful installation!
1105
1105
1106 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1106 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1107 IPython manual (there are both HTML and PDF versions supplied with the
1107 IPython manual (there are both HTML and PDF versions supplied with the
1108 distribution) to make sure that your system environment is properly configured
1108 distribution) to make sure that your system environment is properly configured
1109 to take advantage of IPython's features.
1109 to take advantage of IPython's features.
1110
1110
1111 Important note: the configuration system has changed! The old system is
1111 Important note: the configuration system has changed! The old system is
1112 still in place, but its setting may be partly overridden by the settings in
1112 still in place, but its setting may be partly overridden by the settings in
1113 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1113 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1114 if some of the new settings bother you.
1114 if some of the new settings bother you.
1115
1115
1116 """
1116 """
1117 else:
1117 else:
1118 print """
1118 print """
1119 Successful upgrade!
1119 Successful upgrade!
1120
1120
1121 All files in your directory:
1121 All files in your directory:
1122 %(ipythondir)s
1122 %(ipythondir)s
1123 which would have been overwritten by the upgrade were backed up with a .old
1123 which would have been overwritten by the upgrade were backed up with a .old
1124 extension. If you had made particular customizations in those files you may
1124 extension. If you had made particular customizations in those files you may
1125 want to merge them back into the new files.""" % locals()
1125 want to merge them back into the new files.""" % locals()
1126 wait()
1126 wait()
1127 os.chdir(cwd)
1127 os.chdir(cwd)
1128 # end user_setup()
1128 # end user_setup()
1129
1129
1130 def atexit_operations(self):
1130 def atexit_operations(self):
1131 """This will be executed at the time of exit.
1131 """This will be executed at the time of exit.
1132
1132
1133 Saving of persistent data should be performed here. """
1133 Saving of persistent data should be performed here. """
1134
1134
1135 #print '*** IPython exit cleanup ***' # dbg
1135 #print '*** IPython exit cleanup ***' # dbg
1136 # input history
1136 # input history
1137 self.savehist()
1137 self.savehist()
1138
1138
1139 # Cleanup all tempfiles left around
1139 # Cleanup all tempfiles left around
1140 for tfile in self.tempfiles:
1140 for tfile in self.tempfiles:
1141 try:
1141 try:
1142 os.unlink(tfile)
1142 os.unlink(tfile)
1143 except OSError:
1143 except OSError:
1144 pass
1144 pass
1145
1145
1146 # save the "persistent data" catch-all dictionary
1146 # save the "persistent data" catch-all dictionary
1147 try:
1147 try:
1148 pickle.dump(self.persist, open(self.persist_fname,"w"))
1148 pickle.dump(self.persist, open(self.persist_fname,"w"))
1149 except:
1149 except:
1150 print "*** ERROR *** persistent data saving failed."
1150 print "*** ERROR *** persistent data saving failed."
1151
1151
1152 def savehist(self):
1152 def savehist(self):
1153 """Save input history to a file (via readline library)."""
1153 """Save input history to a file (via readline library)."""
1154 try:
1154 try:
1155 self.readline.write_history_file(self.histfile)
1155 self.readline.write_history_file(self.histfile)
1156 except:
1156 except:
1157 print 'Unable to save IPython command history to file: ' + \
1157 print 'Unable to save IPython command history to file: ' + \
1158 `self.histfile`
1158 `self.histfile`
1159
1159
1160 def pre_readline(self):
1160 def pre_readline(self):
1161 """readline hook to be used at the start of each line.
1161 """readline hook to be used at the start of each line.
1162
1162
1163 Currently it handles auto-indent only."""
1163 Currently it handles auto-indent only."""
1164
1164
1165 #debugx('self.indent_current_nsp','pre_readline:')
1165 #debugx('self.indent_current_nsp','pre_readline:')
1166 self.readline.insert_text(self.indent_current_str())
1166 self.readline.insert_text(self.indent_current_str())
1167
1167
1168 def init_readline(self):
1168 def init_readline(self):
1169 """Command history completion/saving/reloading."""
1169 """Command history completion/saving/reloading."""
1170 try:
1170 try:
1171 import readline
1171 import readline
1172 except ImportError:
1172 except ImportError:
1173 self.has_readline = 0
1173 self.has_readline = 0
1174 self.readline = None
1174 self.readline = None
1175 # no point in bugging windows users with this every time:
1175 # no point in bugging windows users with this every time:
1176 if os.name == 'posix':
1176 if os.name == 'posix':
1177 warn('Readline services not available on this platform.')
1177 warn('Readline services not available on this platform.')
1178 else:
1178 else:
1179 import atexit
1179 import atexit
1180 from IPython.completer import IPCompleter
1180 from IPython.completer import IPCompleter
1181 self.Completer = IPCompleter(self,
1181 self.Completer = IPCompleter(self,
1182 self.user_ns,
1182 self.user_ns,
1183 self.user_global_ns,
1183 self.user_global_ns,
1184 self.rc.readline_omit__names,
1184 self.rc.readline_omit__names,
1185 self.alias_table)
1185 self.alias_table)
1186
1186
1187 # Platform-specific configuration
1187 # Platform-specific configuration
1188 if os.name == 'nt':
1188 if os.name == 'nt':
1189 self.readline_startup_hook = readline.set_pre_input_hook
1189 self.readline_startup_hook = readline.set_pre_input_hook
1190 else:
1190 else:
1191 self.readline_startup_hook = readline.set_startup_hook
1191 self.readline_startup_hook = readline.set_startup_hook
1192
1192
1193 # Load user's initrc file (readline config)
1193 # Load user's initrc file (readline config)
1194 inputrc_name = os.environ.get('INPUTRC')
1194 inputrc_name = os.environ.get('INPUTRC')
1195 if inputrc_name is None:
1195 if inputrc_name is None:
1196 home_dir = get_home_dir()
1196 home_dir = get_home_dir()
1197 if home_dir is not None:
1197 if home_dir is not None:
1198 inputrc_name = os.path.join(home_dir,'.inputrc')
1198 inputrc_name = os.path.join(home_dir,'.inputrc')
1199 if os.path.isfile(inputrc_name):
1199 if os.path.isfile(inputrc_name):
1200 try:
1200 try:
1201 readline.read_init_file(inputrc_name)
1201 readline.read_init_file(inputrc_name)
1202 except:
1202 except:
1203 warn('Problems reading readline initialization file <%s>'
1203 warn('Problems reading readline initialization file <%s>'
1204 % inputrc_name)
1204 % inputrc_name)
1205
1205
1206 self.has_readline = 1
1206 self.has_readline = 1
1207 self.readline = readline
1207 self.readline = readline
1208 # save this in sys so embedded copies can restore it properly
1208 # save this in sys so embedded copies can restore it properly
1209 sys.ipcompleter = self.Completer.complete
1209 sys.ipcompleter = self.Completer.complete
1210 readline.set_completer(self.Completer.complete)
1210 readline.set_completer(self.Completer.complete)
1211
1211
1212 # Configure readline according to user's prefs
1212 # Configure readline according to user's prefs
1213 for rlcommand in self.rc.readline_parse_and_bind:
1213 for rlcommand in self.rc.readline_parse_and_bind:
1214 readline.parse_and_bind(rlcommand)
1214 readline.parse_and_bind(rlcommand)
1215
1215
1216 # remove some chars from the delimiters list
1216 # remove some chars from the delimiters list
1217 delims = readline.get_completer_delims()
1217 delims = readline.get_completer_delims()
1218 delims = delims.translate(string._idmap,
1218 delims = delims.translate(string._idmap,
1219 self.rc.readline_remove_delims)
1219 self.rc.readline_remove_delims)
1220 readline.set_completer_delims(delims)
1220 readline.set_completer_delims(delims)
1221 # otherwise we end up with a monster history after a while:
1221 # otherwise we end up with a monster history after a while:
1222 readline.set_history_length(1000)
1222 readline.set_history_length(1000)
1223 try:
1223 try:
1224 #print '*** Reading readline history' # dbg
1224 #print '*** Reading readline history' # dbg
1225 readline.read_history_file(self.histfile)
1225 readline.read_history_file(self.histfile)
1226 except IOError:
1226 except IOError:
1227 pass # It doesn't exist yet.
1227 pass # It doesn't exist yet.
1228
1228
1229 atexit.register(self.atexit_operations)
1229 atexit.register(self.atexit_operations)
1230 del atexit
1230 del atexit
1231
1231
1232 # Configure auto-indent for all platforms
1232 # Configure auto-indent for all platforms
1233 self.set_autoindent(self.rc.autoindent)
1233 self.set_autoindent(self.rc.autoindent)
1234
1234
1235 def _should_recompile(self,e):
1235 def _should_recompile(self,e):
1236 """Utility routine for edit_syntax_error"""
1236 """Utility routine for edit_syntax_error"""
1237
1237
1238 if e.filename in ('<ipython console>','<input>','<string>',
1238 if e.filename in ('<ipython console>','<input>','<string>',
1239 '<console>',None):
1239 '<console>',None):
1240
1240
1241 return False
1241 return False
1242 try:
1242 try:
1243 if not ask_yes_no('Return to editor to correct syntax error? '
1243 if not ask_yes_no('Return to editor to correct syntax error? '
1244 '[Y/n] ','y'):
1244 '[Y/n] ','y'):
1245 return False
1245 return False
1246 except EOFError:
1246 except EOFError:
1247 return False
1247 return False
1248
1248
1249 def int0(x):
1249 def int0(x):
1250 try:
1250 try:
1251 return int(x)
1251 return int(x)
1252 except TypeError:
1252 except TypeError:
1253 return 0
1253 return 0
1254 # always pass integer line and offset values to editor hook
1254 # always pass integer line and offset values to editor hook
1255 self.hooks.fix_error_editor(e.filename,
1255 self.hooks.fix_error_editor(e.filename,
1256 int0(e.lineno),int0(e.offset),e.msg)
1256 int0(e.lineno),int0(e.offset),e.msg)
1257 return True
1257 return True
1258
1258
1259 def edit_syntax_error(self):
1259 def edit_syntax_error(self):
1260 """The bottom half of the syntax error handler called in the main loop.
1260 """The bottom half of the syntax error handler called in the main loop.
1261
1261
1262 Loop until syntax error is fixed or user cancels.
1262 Loop until syntax error is fixed or user cancels.
1263 """
1263 """
1264
1264
1265 while self.SyntaxTB.last_syntax_error:
1265 while self.SyntaxTB.last_syntax_error:
1266 # copy and clear last_syntax_error
1266 # copy and clear last_syntax_error
1267 err = self.SyntaxTB.clear_err_state()
1267 err = self.SyntaxTB.clear_err_state()
1268 if not self._should_recompile(err):
1268 if not self._should_recompile(err):
1269 return
1269 return
1270 try:
1270 try:
1271 # may set last_syntax_error again if a SyntaxError is raised
1271 # may set last_syntax_error again if a SyntaxError is raised
1272 self.safe_execfile(err.filename,self.shell.user_ns)
1272 self.safe_execfile(err.filename,self.shell.user_ns)
1273 except:
1273 except:
1274 self.showtraceback()
1274 self.showtraceback()
1275 else:
1275 else:
1276 f = file(err.filename)
1276 f = file(err.filename)
1277 try:
1277 try:
1278 sys.displayhook(f.read())
1278 sys.displayhook(f.read())
1279 finally:
1279 finally:
1280 f.close()
1280 f.close()
1281
1281
1282 def showsyntaxerror(self, filename=None):
1282 def showsyntaxerror(self, filename=None):
1283 """Display the syntax error that just occurred.
1283 """Display the syntax error that just occurred.
1284
1284
1285 This doesn't display a stack trace because there isn't one.
1285 This doesn't display a stack trace because there isn't one.
1286
1286
1287 If a filename is given, it is stuffed in the exception instead
1287 If a filename is given, it is stuffed in the exception instead
1288 of what was there before (because Python's parser always uses
1288 of what was there before (because Python's parser always uses
1289 "<string>" when reading from a string).
1289 "<string>" when reading from a string).
1290 """
1290 """
1291 etype, value, last_traceback = sys.exc_info()
1291 etype, value, last_traceback = sys.exc_info()
1292 if filename and etype is SyntaxError:
1292 if filename and etype is SyntaxError:
1293 # Work hard to stuff the correct filename in the exception
1293 # Work hard to stuff the correct filename in the exception
1294 try:
1294 try:
1295 msg, (dummy_filename, lineno, offset, line) = value
1295 msg, (dummy_filename, lineno, offset, line) = value
1296 except:
1296 except:
1297 # Not the format we expect; leave it alone
1297 # Not the format we expect; leave it alone
1298 pass
1298 pass
1299 else:
1299 else:
1300 # Stuff in the right filename
1300 # Stuff in the right filename
1301 try:
1301 try:
1302 # Assume SyntaxError is a class exception
1302 # Assume SyntaxError is a class exception
1303 value = SyntaxError(msg, (filename, lineno, offset, line))
1303 value = SyntaxError(msg, (filename, lineno, offset, line))
1304 except:
1304 except:
1305 # If that failed, assume SyntaxError is a string
1305 # If that failed, assume SyntaxError is a string
1306 value = msg, (filename, lineno, offset, line)
1306 value = msg, (filename, lineno, offset, line)
1307 self.SyntaxTB(etype,value,[])
1307 self.SyntaxTB(etype,value,[])
1308
1308
1309 def debugger(self):
1309 def debugger(self):
1310 """Call the pdb debugger."""
1310 """Call the pdb debugger."""
1311
1311
1312 if not self.rc.pdb:
1312 if not self.rc.pdb:
1313 return
1313 return
1314 pdb.pm()
1314 pdb.pm()
1315
1315
1316 def showtraceback(self,exc_tuple = None,filename=None):
1316 def showtraceback(self,exc_tuple = None,filename=None):
1317 """Display the exception that just occurred."""
1317 """Display the exception that just occurred."""
1318
1318
1319 # Though this won't be called by syntax errors in the input line,
1319 # Though this won't be called by syntax errors in the input line,
1320 # there may be SyntaxError cases whith imported code.
1320 # there may be SyntaxError cases whith imported code.
1321 if exc_tuple is None:
1321 if exc_tuple is None:
1322 type, value, tb = sys.exc_info()
1322 type, value, tb = sys.exc_info()
1323 else:
1323 else:
1324 type, value, tb = exc_tuple
1324 type, value, tb = exc_tuple
1325 if type is SyntaxError:
1325 if type is SyntaxError:
1326 self.showsyntaxerror(filename)
1326 self.showsyntaxerror(filename)
1327 else:
1327 else:
1328 self.InteractiveTB()
1328 self.InteractiveTB()
1329 if self.InteractiveTB.call_pdb and self.has_readline:
1329 if self.InteractiveTB.call_pdb and self.has_readline:
1330 # pdb mucks up readline, fix it back
1330 # pdb mucks up readline, fix it back
1331 self.readline.set_completer(self.Completer.complete)
1331 self.readline.set_completer(self.Completer.complete)
1332
1332
1333 def mainloop(self,banner=None):
1333 def mainloop(self,banner=None):
1334 """Creates the local namespace and starts the mainloop.
1334 """Creates the local namespace and starts the mainloop.
1335
1335
1336 If an optional banner argument is given, it will override the
1336 If an optional banner argument is given, it will override the
1337 internally created default banner."""
1337 internally created default banner."""
1338
1338
1339 if self.rc.c: # Emulate Python's -c option
1339 if self.rc.c: # Emulate Python's -c option
1340 self.exec_init_cmd()
1340 self.exec_init_cmd()
1341 if banner is None:
1341 if banner is None:
1342 if self.rc.banner:
1342 if self.rc.banner:
1343 banner = self.BANNER+self.banner2
1343 banner = self.BANNER+self.banner2
1344 else:
1344 else:
1345 banner = ''
1345 banner = ''
1346 self.interact(banner)
1346 self.interact(banner)
1347
1347
1348 def exec_init_cmd(self):
1348 def exec_init_cmd(self):
1349 """Execute a command given at the command line.
1349 """Execute a command given at the command line.
1350
1350
1351 This emulates Python's -c option."""
1351 This emulates Python's -c option."""
1352
1352
1353 #sys.argv = ['-c']
1353 #sys.argv = ['-c']
1354 self.push(self.rc.c)
1354 self.push(self.rc.c)
1355
1355
1356 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1356 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1357 """Embeds IPython into a running python program.
1357 """Embeds IPython into a running python program.
1358
1358
1359 Input:
1359 Input:
1360
1360
1361 - header: An optional header message can be specified.
1361 - header: An optional header message can be specified.
1362
1362
1363 - local_ns, global_ns: working namespaces. If given as None, the
1363 - local_ns, global_ns: working namespaces. If given as None, the
1364 IPython-initialized one is updated with __main__.__dict__, so that
1364 IPython-initialized one is updated with __main__.__dict__, so that
1365 program variables become visible but user-specific configuration
1365 program variables become visible but user-specific configuration
1366 remains possible.
1366 remains possible.
1367
1367
1368 - stack_depth: specifies how many levels in the stack to go to
1368 - stack_depth: specifies how many levels in the stack to go to
1369 looking for namespaces (when local_ns and global_ns are None). This
1369 looking for namespaces (when local_ns and global_ns are None). This
1370 allows an intermediate caller to make sure that this function gets
1370 allows an intermediate caller to make sure that this function gets
1371 the namespace from the intended level in the stack. By default (0)
1371 the namespace from the intended level in the stack. By default (0)
1372 it will get its locals and globals from the immediate caller.
1372 it will get its locals and globals from the immediate caller.
1373
1373
1374 Warning: it's possible to use this in a program which is being run by
1374 Warning: it's possible to use this in a program which is being run by
1375 IPython itself (via %run), but some funny things will happen (a few
1375 IPython itself (via %run), but some funny things will happen (a few
1376 globals get overwritten). In the future this will be cleaned up, as
1376 globals get overwritten). In the future this will be cleaned up, as
1377 there is no fundamental reason why it can't work perfectly."""
1377 there is no fundamental reason why it can't work perfectly."""
1378
1378
1379 # Get locals and globals from caller
1379 # Get locals and globals from caller
1380 if local_ns is None or global_ns is None:
1380 if local_ns is None or global_ns is None:
1381 call_frame = sys._getframe(stack_depth).f_back
1381 call_frame = sys._getframe(stack_depth).f_back
1382
1382
1383 if local_ns is None:
1383 if local_ns is None:
1384 local_ns = call_frame.f_locals
1384 local_ns = call_frame.f_locals
1385 if global_ns is None:
1385 if global_ns is None:
1386 global_ns = call_frame.f_globals
1386 global_ns = call_frame.f_globals
1387
1387
1388 # Update namespaces and fire up interpreter
1388 # Update namespaces and fire up interpreter
1389
1389
1390 # The global one is easy, we can just throw it in
1390 # The global one is easy, we can just throw it in
1391 self.user_global_ns = global_ns
1391 self.user_global_ns = global_ns
1392
1392
1393 # but the user/local one is tricky: ipython needs it to store internal
1393 # but the user/local one is tricky: ipython needs it to store internal
1394 # data, but we also need the locals. We'll copy locals in the user
1394 # data, but we also need the locals. We'll copy locals in the user
1395 # one, but will track what got copied so we can delete them at exit.
1395 # one, but will track what got copied so we can delete them at exit.
1396 # This is so that a later embedded call doesn't see locals from a
1396 # This is so that a later embedded call doesn't see locals from a
1397 # previous call (which most likely existed in a separate scope).
1397 # previous call (which most likely existed in a separate scope).
1398 local_varnames = local_ns.keys()
1398 local_varnames = local_ns.keys()
1399 self.user_ns.update(local_ns)
1399 self.user_ns.update(local_ns)
1400
1400
1401 # Patch for global embedding to make sure that things don't overwrite
1401 # Patch for global embedding to make sure that things don't overwrite
1402 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1402 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1403 # FIXME. Test this a bit more carefully (the if.. is new)
1403 # FIXME. Test this a bit more carefully (the if.. is new)
1404 if local_ns is None and global_ns is None:
1404 if local_ns is None and global_ns is None:
1405 self.user_global_ns.update(__main__.__dict__)
1405 self.user_global_ns.update(__main__.__dict__)
1406
1406
1407 # make sure the tab-completer has the correct frame information, so it
1407 # make sure the tab-completer has the correct frame information, so it
1408 # actually completes using the frame's locals/globals
1408 # actually completes using the frame's locals/globals
1409 self.set_completer_frame()
1409 self.set_completer_frame()
1410
1410
1411 # before activating the interactive mode, we need to make sure that
1411 # before activating the interactive mode, we need to make sure that
1412 # all names in the builtin namespace needed by ipython point to
1412 # all names in the builtin namespace needed by ipython point to
1413 # ourselves, and not to other instances.
1413 # ourselves, and not to other instances.
1414 self.add_builtins()
1414 self.add_builtins()
1415
1415
1416 self.interact(header)
1416 self.interact(header)
1417
1417
1418 # now, purge out the user namespace from anything we might have added
1418 # now, purge out the user namespace from anything we might have added
1419 # from the caller's local namespace
1419 # from the caller's local namespace
1420 delvar = self.user_ns.pop
1420 delvar = self.user_ns.pop
1421 for var in local_varnames:
1421 for var in local_varnames:
1422 delvar(var,None)
1422 delvar(var,None)
1423 # and clean builtins we may have overridden
1423 # and clean builtins we may have overridden
1424 self.clean_builtins()
1424 self.clean_builtins()
1425
1425
1426 def interact(self, banner=None):
1426 def interact(self, banner=None):
1427 """Closely emulate the interactive Python console.
1427 """Closely emulate the interactive Python console.
1428
1428
1429 The optional banner argument specify the banner to print
1429 The optional banner argument specify the banner to print
1430 before the first interaction; by default it prints a banner
1430 before the first interaction; by default it prints a banner
1431 similar to the one printed by the real Python interpreter,
1431 similar to the one printed by the real Python interpreter,
1432 followed by the current class name in parentheses (so as not
1432 followed by the current class name in parentheses (so as not
1433 to confuse this with the real interpreter -- since it's so
1433 to confuse this with the real interpreter -- since it's so
1434 close!).
1434 close!).
1435
1435
1436 """
1436 """
1437 cprt = 'Type "copyright", "credits" or "license" for more information.'
1437 cprt = 'Type "copyright", "credits" or "license" for more information.'
1438 if banner is None:
1438 if banner is None:
1439 self.write("Python %s on %s\n%s\n(%s)\n" %
1439 self.write("Python %s on %s\n%s\n(%s)\n" %
1440 (sys.version, sys.platform, cprt,
1440 (sys.version, sys.platform, cprt,
1441 self.__class__.__name__))
1441 self.__class__.__name__))
1442 else:
1442 else:
1443 self.write(banner)
1443 self.write(banner)
1444
1444
1445 more = 0
1445 more = 0
1446
1446
1447 # Mark activity in the builtins
1447 # Mark activity in the builtins
1448 __builtin__.__dict__['__IPYTHON__active'] += 1
1448 __builtin__.__dict__['__IPYTHON__active'] += 1
1449
1449
1450 # exit_now is set by a call to %Exit or %Quit
1450 # exit_now is set by a call to %Exit or %Quit
1451 self.exit_now = False
1451 self.exit_now = False
1452 while not self.exit_now:
1452 while not self.exit_now:
1453
1453
1454 try:
1454 try:
1455 if more:
1455 if more:
1456 prompt = self.outputcache.prompt2
1456 prompt = self.outputcache.prompt2
1457 if self.autoindent:
1457 if self.autoindent:
1458 self.readline_startup_hook(self.pre_readline)
1458 self.readline_startup_hook(self.pre_readline)
1459 else:
1459 else:
1460 prompt = self.outputcache.prompt1
1460 prompt = self.outputcache.prompt1
1461 try:
1461 try:
1462 line = self.raw_input(prompt,more)
1462 line = self.raw_input(prompt,more)
1463 if self.autoindent:
1463 if self.autoindent:
1464 self.readline_startup_hook(None)
1464 self.readline_startup_hook(None)
1465 except EOFError:
1465 except EOFError:
1466 if self.autoindent:
1466 if self.autoindent:
1467 self.readline_startup_hook(None)
1467 self.readline_startup_hook(None)
1468 self.write("\n")
1468 self.write("\n")
1469 self.exit()
1469 self.exit()
1470 except:
1470 except:
1471 # exceptions here are VERY RARE, but they can be triggered
1471 # exceptions here are VERY RARE, but they can be triggered
1472 # asynchronously by signal handlers, for example.
1472 # asynchronously by signal handlers, for example.
1473 self.showtraceback()
1473 self.showtraceback()
1474 else:
1474 else:
1475 more = self.push(line)
1475 more = self.push(line)
1476
1476
1477 if (self.SyntaxTB.last_syntax_error and
1477 if (self.SyntaxTB.last_syntax_error and
1478 self.rc.autoedit_syntax):
1478 self.rc.autoedit_syntax):
1479 self.edit_syntax_error()
1479 self.edit_syntax_error()
1480
1480
1481 except KeyboardInterrupt:
1481 except KeyboardInterrupt:
1482 self.write("\nKeyboardInterrupt\n")
1482 self.write("\nKeyboardInterrupt\n")
1483 self.resetbuffer()
1483 self.resetbuffer()
1484 more = 0
1484 more = 0
1485 # keep cache in sync with the prompt counter:
1485 # keep cache in sync with the prompt counter:
1486 self.outputcache.prompt_count -= 1
1486 self.outputcache.prompt_count -= 1
1487
1487
1488 if self.autoindent:
1488 if self.autoindent:
1489 self.indent_current_nsp = 0
1489 self.indent_current_nsp = 0
1490
1490
1491 except bdb.BdbQuit:
1491 except bdb.BdbQuit:
1492 warn("The Python debugger has exited with a BdbQuit exception.\n"
1492 warn("The Python debugger has exited with a BdbQuit exception.\n"
1493 "Because of how pdb handles the stack, it is impossible\n"
1493 "Because of how pdb handles the stack, it is impossible\n"
1494 "for IPython to properly format this particular exception.\n"
1494 "for IPython to properly format this particular exception.\n"
1495 "IPython will resume normal operation.")
1495 "IPython will resume normal operation.")
1496
1496
1497 # We are off again...
1497 # We are off again...
1498 __builtin__.__dict__['__IPYTHON__active'] -= 1
1498 __builtin__.__dict__['__IPYTHON__active'] -= 1
1499
1499
1500 def excepthook(self, type, value, tb):
1500 def excepthook(self, type, value, tb):
1501 """One more defense for GUI apps that call sys.excepthook.
1501 """One more defense for GUI apps that call sys.excepthook.
1502
1502
1503 GUI frameworks like wxPython trap exceptions and call
1503 GUI frameworks like wxPython trap exceptions and call
1504 sys.excepthook themselves. I guess this is a feature that
1504 sys.excepthook themselves. I guess this is a feature that
1505 enables them to keep running after exceptions that would
1505 enables them to keep running after exceptions that would
1506 otherwise kill their mainloop. This is a bother for IPython
1506 otherwise kill their mainloop. This is a bother for IPython
1507 which excepts to catch all of the program exceptions with a try:
1507 which excepts to catch all of the program exceptions with a try:
1508 except: statement.
1508 except: statement.
1509
1509
1510 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1510 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1511 any app directly invokes sys.excepthook, it will look to the user like
1511 any app directly invokes sys.excepthook, it will look to the user like
1512 IPython crashed. In order to work around this, we can disable the
1512 IPython crashed. In order to work around this, we can disable the
1513 CrashHandler and replace it with this excepthook instead, which prints a
1513 CrashHandler and replace it with this excepthook instead, which prints a
1514 regular traceback using our InteractiveTB. In this fashion, apps which
1514 regular traceback using our InteractiveTB. In this fashion, apps which
1515 call sys.excepthook will generate a regular-looking exception from
1515 call sys.excepthook will generate a regular-looking exception from
1516 IPython, and the CrashHandler will only be triggered by real IPython
1516 IPython, and the CrashHandler will only be triggered by real IPython
1517 crashes.
1517 crashes.
1518
1518
1519 This hook should be used sparingly, only in places which are not likely
1519 This hook should be used sparingly, only in places which are not likely
1520 to be true IPython errors.
1520 to be true IPython errors.
1521 """
1521 """
1522
1522
1523 self.InteractiveTB(type, value, tb, tb_offset=0)
1523 self.InteractiveTB(type, value, tb, tb_offset=0)
1524 if self.InteractiveTB.call_pdb and self.has_readline:
1524 if self.InteractiveTB.call_pdb and self.has_readline:
1525 self.readline.set_completer(self.Completer.complete)
1525 self.readline.set_completer(self.Completer.complete)
1526
1526
1527 def call_alias(self,alias,rest=''):
1527 def call_alias(self,alias,rest=''):
1528 """Call an alias given its name and the rest of the line.
1528 """Call an alias given its name and the rest of the line.
1529
1529
1530 This function MUST be given a proper alias, because it doesn't make
1530 This function MUST be given a proper alias, because it doesn't make
1531 any checks when looking up into the alias table. The caller is
1531 any checks when looking up into the alias table. The caller is
1532 responsible for invoking it only with a valid alias."""
1532 responsible for invoking it only with a valid alias."""
1533
1533
1534 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1534 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1535 nargs,cmd = self.alias_table[alias]
1535 nargs,cmd = self.alias_table[alias]
1536 # Expand the %l special to be the user's input line
1536 # Expand the %l special to be the user's input line
1537 if cmd.find('%l') >= 0:
1537 if cmd.find('%l') >= 0:
1538 cmd = cmd.replace('%l',rest)
1538 cmd = cmd.replace('%l',rest)
1539 rest = ''
1539 rest = ''
1540 if nargs==0:
1540 if nargs==0:
1541 # Simple, argument-less aliases
1541 # Simple, argument-less aliases
1542 cmd = '%s %s' % (cmd,rest)
1542 cmd = '%s %s' % (cmd,rest)
1543 else:
1543 else:
1544 # Handle aliases with positional arguments
1544 # Handle aliases with positional arguments
1545 args = rest.split(None,nargs)
1545 args = rest.split(None,nargs)
1546 if len(args)< nargs:
1546 if len(args)< nargs:
1547 error('Alias <%s> requires %s arguments, %s given.' %
1547 error('Alias <%s> requires %s arguments, %s given.' %
1548 (alias,nargs,len(args)))
1548 (alias,nargs,len(args)))
1549 return
1549 return
1550 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1550 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1551 # Now call the macro, evaluating in the user's namespace
1551 # Now call the macro, evaluating in the user's namespace
1552 try:
1552 try:
1553 self.system(cmd)
1553 self.system(cmd)
1554 except:
1554 except:
1555 self.showtraceback()
1555 self.showtraceback()
1556
1556
1557 def indent_current_str(self):
1557 def indent_current_str(self):
1558 """return the current level of indentation as a string"""
1558 """return the current level of indentation as a string"""
1559 return self.indent_current_nsp * ' '
1559 return self.indent_current_nsp * ' '
1560
1560
1561 def autoindent_update(self,line):
1561 def autoindent_update(self,line):
1562 """Keep track of the indent level."""
1562 """Keep track of the indent level."""
1563
1563
1564 #debugx('line')
1564 #debugx('line')
1565 #debugx('self.indent_current_nsp')
1565 #debugx('self.indent_current_nsp')
1566 if self.autoindent:
1566 if self.autoindent:
1567 if line:
1567 if line:
1568 inisp = num_ini_spaces(line)
1568 inisp = num_ini_spaces(line)
1569 if inisp < self.indent_current_nsp:
1569 if inisp < self.indent_current_nsp:
1570 self.indent_current_nsp = inisp
1570 self.indent_current_nsp = inisp
1571
1571
1572 if line[-1] == ':':
1572 if line[-1] == ':':
1573 self.indent_current_nsp += 4
1573 self.indent_current_nsp += 4
1574 elif dedent_re.match(line):
1574 elif dedent_re.match(line):
1575 self.indent_current_nsp -= 4
1575 self.indent_current_nsp -= 4
1576 else:
1576 else:
1577 self.indent_current_nsp = 0
1577 self.indent_current_nsp = 0
1578
1578
1579 def runlines(self,lines):
1579 def runlines(self,lines):
1580 """Run a string of one or more lines of source.
1580 """Run a string of one or more lines of source.
1581
1581
1582 This method is capable of running a string containing multiple source
1582 This method is capable of running a string containing multiple source
1583 lines, as if they had been entered at the IPython prompt. Since it
1583 lines, as if they had been entered at the IPython prompt. Since it
1584 exposes IPython's processing machinery, the given strings can contain
1584 exposes IPython's processing machinery, the given strings can contain
1585 magic calls (%magic), special shell access (!cmd), etc."""
1585 magic calls (%magic), special shell access (!cmd), etc."""
1586
1586
1587 # We must start with a clean buffer, in case this is run from an
1587 # We must start with a clean buffer, in case this is run from an
1588 # interactive IPython session (via a magic, for example).
1588 # interactive IPython session (via a magic, for example).
1589 self.resetbuffer()
1589 self.resetbuffer()
1590 lines = lines.split('\n')
1590 lines = lines.split('\n')
1591 more = 0
1591 more = 0
1592 for line in lines:
1592 for line in lines:
1593 # skip blank lines so we don't mess up the prompt counter, but do
1593 # skip blank lines so we don't mess up the prompt counter, but do
1594 # NOT skip even a blank line if we are in a code block (more is
1594 # NOT skip even a blank line if we are in a code block (more is
1595 # true)
1595 # true)
1596 if line or more:
1596 if line or more:
1597 more = self.push(self.prefilter(line,more))
1597 more = self.push(self.prefilter(line,more))
1598 # IPython's runsource returns None if there was an error
1598 # IPython's runsource returns None if there was an error
1599 # compiling the code. This allows us to stop processing right
1599 # compiling the code. This allows us to stop processing right
1600 # away, so the user gets the error message at the right place.
1600 # away, so the user gets the error message at the right place.
1601 if more is None:
1601 if more is None:
1602 break
1602 break
1603 # final newline in case the input didn't have it, so that the code
1603 # final newline in case the input didn't have it, so that the code
1604 # actually does get executed
1604 # actually does get executed
1605 if more:
1605 if more:
1606 self.push('\n')
1606 self.push('\n')
1607
1607
1608 def runsource(self, source, filename='<input>', symbol='single'):
1608 def runsource(self, source, filename='<input>', symbol='single'):
1609 """Compile and run some source in the interpreter.
1609 """Compile and run some source in the interpreter.
1610
1610
1611 Arguments are as for compile_command().
1611 Arguments are as for compile_command().
1612
1612
1613 One several things can happen:
1613 One several things can happen:
1614
1614
1615 1) The input is incorrect; compile_command() raised an
1615 1) The input is incorrect; compile_command() raised an
1616 exception (SyntaxError or OverflowError). A syntax traceback
1616 exception (SyntaxError or OverflowError). A syntax traceback
1617 will be printed by calling the showsyntaxerror() method.
1617 will be printed by calling the showsyntaxerror() method.
1618
1618
1619 2) The input is incomplete, and more input is required;
1619 2) The input is incomplete, and more input is required;
1620 compile_command() returned None. Nothing happens.
1620 compile_command() returned None. Nothing happens.
1621
1621
1622 3) The input is complete; compile_command() returned a code
1622 3) The input is complete; compile_command() returned a code
1623 object. The code is executed by calling self.runcode() (which
1623 object. The code is executed by calling self.runcode() (which
1624 also handles run-time exceptions, except for SystemExit).
1624 also handles run-time exceptions, except for SystemExit).
1625
1625
1626 The return value is:
1626 The return value is:
1627
1627
1628 - True in case 2
1628 - True in case 2
1629
1629
1630 - False in the other cases, unless an exception is raised, where
1630 - False in the other cases, unless an exception is raised, where
1631 None is returned instead. This can be used by external callers to
1631 None is returned instead. This can be used by external callers to
1632 know whether to continue feeding input or not.
1632 know whether to continue feeding input or not.
1633
1633
1634 The return value can be used to decide whether to use sys.ps1 or
1634 The return value can be used to decide whether to use sys.ps1 or
1635 sys.ps2 to prompt the next line."""
1635 sys.ps2 to prompt the next line."""
1636
1636
1637 try:
1637 try:
1638 code = self.compile(source,filename,symbol)
1638 code = self.compile(source,filename,symbol)
1639 except (OverflowError, SyntaxError, ValueError):
1639 except (OverflowError, SyntaxError, ValueError):
1640 # Case 1
1640 # Case 1
1641 self.showsyntaxerror(filename)
1641 self.showsyntaxerror(filename)
1642 return None
1642 return None
1643
1643
1644 if code is None:
1644 if code is None:
1645 # Case 2
1645 # Case 2
1646 return True
1646 return True
1647
1647
1648 # Case 3
1648 # Case 3
1649 # We store the code object so that threaded shells and
1649 # We store the code object so that threaded shells and
1650 # custom exception handlers can access all this info if needed.
1650 # custom exception handlers can access all this info if needed.
1651 # The source corresponding to this can be obtained from the
1651 # The source corresponding to this can be obtained from the
1652 # buffer attribute as '\n'.join(self.buffer).
1652 # buffer attribute as '\n'.join(self.buffer).
1653 self.code_to_run = code
1653 self.code_to_run = code
1654 # now actually execute the code object
1654 # now actually execute the code object
1655 if self.runcode(code) == 0:
1655 if self.runcode(code) == 0:
1656 return False
1656 return False
1657 else:
1657 else:
1658 return None
1658 return None
1659
1659
1660 def runcode(self,code_obj):
1660 def runcode(self,code_obj):
1661 """Execute a code object.
1661 """Execute a code object.
1662
1662
1663 When an exception occurs, self.showtraceback() is called to display a
1663 When an exception occurs, self.showtraceback() is called to display a
1664 traceback.
1664 traceback.
1665
1665
1666 Return value: a flag indicating whether the code to be run completed
1666 Return value: a flag indicating whether the code to be run completed
1667 successfully:
1667 successfully:
1668
1668
1669 - 0: successful execution.
1669 - 0: successful execution.
1670 - 1: an error occurred.
1670 - 1: an error occurred.
1671 """
1671 """
1672
1672
1673 # Set our own excepthook in case the user code tries to call it
1673 # Set our own excepthook in case the user code tries to call it
1674 # directly, so that the IPython crash handler doesn't get triggered
1674 # directly, so that the IPython crash handler doesn't get triggered
1675 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1675 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1676
1676
1677 # we save the original sys.excepthook in the instance, in case config
1677 # we save the original sys.excepthook in the instance, in case config
1678 # code (such as magics) needs access to it.
1678 # code (such as magics) needs access to it.
1679 self.sys_excepthook = old_excepthook
1679 self.sys_excepthook = old_excepthook
1680 outflag = 1 # happens in more places, so it's easier as default
1680 outflag = 1 # happens in more places, so it's easier as default
1681 try:
1681 try:
1682 try:
1682 try:
1683 # Embedded instances require separate global/local namespaces
1683 # Embedded instances require separate global/local namespaces
1684 # so they can see both the surrounding (local) namespace and
1684 # so they can see both the surrounding (local) namespace and
1685 # the module-level globals when called inside another function.
1685 # the module-level globals when called inside another function.
1686 if self.embedded:
1686 if self.embedded:
1687 exec code_obj in self.user_global_ns, self.user_ns
1687 exec code_obj in self.user_global_ns, self.user_ns
1688 # Normal (non-embedded) instances should only have a single
1688 # Normal (non-embedded) instances should only have a single
1689 # namespace for user code execution, otherwise functions won't
1689 # namespace for user code execution, otherwise functions won't
1690 # see interactive top-level globals.
1690 # see interactive top-level globals.
1691 else:
1691 else:
1692 exec code_obj in self.user_ns
1692 exec code_obj in self.user_ns
1693 finally:
1693 finally:
1694 # Reset our crash handler in place
1694 # Reset our crash handler in place
1695 sys.excepthook = old_excepthook
1695 sys.excepthook = old_excepthook
1696 except SystemExit:
1696 except SystemExit:
1697 self.resetbuffer()
1697 self.resetbuffer()
1698 self.showtraceback()
1698 self.showtraceback()
1699 warn("Type exit or quit to exit IPython "
1699 warn("Type exit or quit to exit IPython "
1700 "(%Exit or %Quit do so unconditionally).",level=1)
1700 "(%Exit or %Quit do so unconditionally).",level=1)
1701 except self.custom_exceptions:
1701 except self.custom_exceptions:
1702 etype,value,tb = sys.exc_info()
1702 etype,value,tb = sys.exc_info()
1703 self.CustomTB(etype,value,tb)
1703 self.CustomTB(etype,value,tb)
1704 except:
1704 except:
1705 self.showtraceback()
1705 self.showtraceback()
1706 else:
1706 else:
1707 outflag = 0
1707 outflag = 0
1708 if softspace(sys.stdout, 0):
1708 if softspace(sys.stdout, 0):
1709 print
1709 print
1710 # Flush out code object which has been run (and source)
1710 # Flush out code object which has been run (and source)
1711 self.code_to_run = None
1711 self.code_to_run = None
1712 return outflag
1712 return outflag
1713
1713
1714 def push(self, line):
1714 def push(self, line):
1715 """Push a line to the interpreter.
1715 """Push a line to the interpreter.
1716
1716
1717 The line should not have a trailing newline; it may have
1717 The line should not have a trailing newline; it may have
1718 internal newlines. The line is appended to a buffer and the
1718 internal newlines. The line is appended to a buffer and the
1719 interpreter's runsource() method is called with the
1719 interpreter's runsource() method is called with the
1720 concatenated contents of the buffer as source. If this
1720 concatenated contents of the buffer as source. If this
1721 indicates that the command was executed or invalid, the buffer
1721 indicates that the command was executed or invalid, the buffer
1722 is reset; otherwise, the command is incomplete, and the buffer
1722 is reset; otherwise, the command is incomplete, and the buffer
1723 is left as it was after the line was appended. The return
1723 is left as it was after the line was appended. The return
1724 value is 1 if more input is required, 0 if the line was dealt
1724 value is 1 if more input is required, 0 if the line was dealt
1725 with in some way (this is the same as runsource()).
1725 with in some way (this is the same as runsource()).
1726 """
1726 """
1727
1727
1728 # autoindent management should be done here, and not in the
1728 # autoindent management should be done here, and not in the
1729 # interactive loop, since that one is only seen by keyboard input. We
1729 # interactive loop, since that one is only seen by keyboard input. We
1730 # need this done correctly even for code run via runlines (which uses
1730 # need this done correctly even for code run via runlines (which uses
1731 # push).
1731 # push).
1732
1732
1733 #print 'push line: <%s>' % line # dbg
1733 #print 'push line: <%s>' % line # dbg
1734 self.autoindent_update(line)
1734 self.autoindent_update(line)
1735
1735
1736 self.buffer.append(line)
1736 self.buffer.append(line)
1737 more = self.runsource('\n'.join(self.buffer), self.filename)
1737 more = self.runsource('\n'.join(self.buffer), self.filename)
1738 if not more:
1738 if not more:
1739 self.resetbuffer()
1739 self.resetbuffer()
1740 return more
1740 return more
1741
1741
1742 def resetbuffer(self):
1742 def resetbuffer(self):
1743 """Reset the input buffer."""
1743 """Reset the input buffer."""
1744 self.buffer[:] = []
1744 self.buffer[:] = []
1745
1745
1746 def raw_input(self,prompt='',continue_prompt=False):
1746 def raw_input(self,prompt='',continue_prompt=False):
1747 """Write a prompt and read a line.
1747 """Write a prompt and read a line.
1748
1748
1749 The returned line does not include the trailing newline.
1749 The returned line does not include the trailing newline.
1750 When the user enters the EOF key sequence, EOFError is raised.
1750 When the user enters the EOF key sequence, EOFError is raised.
1751
1751
1752 Optional inputs:
1752 Optional inputs:
1753
1753
1754 - prompt(''): a string to be printed to prompt the user.
1754 - prompt(''): a string to be printed to prompt the user.
1755
1755
1756 - continue_prompt(False): whether this line is the first one or a
1756 - continue_prompt(False): whether this line is the first one or a
1757 continuation in a sequence of inputs.
1757 continuation in a sequence of inputs.
1758 """
1758 """
1759
1759
1760 line = raw_input_original(prompt)
1760 line = raw_input_original(prompt)
1761 # Try to be reasonably smart about not re-indenting pasted input more
1761 # Try to be reasonably smart about not re-indenting pasted input more
1762 # than necessary. We do this by trimming out the auto-indent initial
1762 # than necessary. We do this by trimming out the auto-indent initial
1763 # spaces, if the user's actual input started itself with whitespace.
1763 # spaces, if the user's actual input started itself with whitespace.
1764 #debugx('self.buffer[-1]')
1764 #debugx('self.buffer[-1]')
1765
1765
1766 if self.autoindent:
1766 if self.autoindent:
1767 if num_ini_spaces(line) > self.indent_current_nsp:
1767 if num_ini_spaces(line) > self.indent_current_nsp:
1768 line = line[self.indent_current_nsp:]
1768 line = line[self.indent_current_nsp:]
1769 self.indent_current_nsp = 0
1769 self.indent_current_nsp = 0
1770
1770
1771 # store the unfiltered input before the user has any chance to modify
1771 # store the unfiltered input before the user has any chance to modify
1772 # it.
1772 # it.
1773 if line.strip():
1773 if line.strip():
1774 if continue_prompt:
1774 if continue_prompt:
1775 self.input_hist_raw[-1] += '%s\n' % line
1775 self.input_hist_raw[-1] += '%s\n' % line
1776 else:
1776 else:
1777 self.input_hist_raw.append('%s\n' % line)
1777 self.input_hist_raw.append('%s\n' % line)
1778
1778
1779 lineout = self.prefilter(line,continue_prompt)
1779 lineout = self.prefilter(line,continue_prompt)
1780 return lineout
1780 return lineout
1781
1781
1782 def split_user_input(self,line):
1782 def split_user_input(self,line):
1783 """Split user input into pre-char, function part and rest."""
1783 """Split user input into pre-char, function part and rest."""
1784
1784
1785 lsplit = self.line_split.match(line)
1785 lsplit = self.line_split.match(line)
1786 if lsplit is None: # no regexp match returns None
1786 if lsplit is None: # no regexp match returns None
1787 try:
1787 try:
1788 iFun,theRest = line.split(None,1)
1788 iFun,theRest = line.split(None,1)
1789 except ValueError:
1789 except ValueError:
1790 iFun,theRest = line,''
1790 iFun,theRest = line,''
1791 pre = re.match('^(\s*)(.*)',line).groups()[0]
1791 pre = re.match('^(\s*)(.*)',line).groups()[0]
1792 else:
1792 else:
1793 pre,iFun,theRest = lsplit.groups()
1793 pre,iFun,theRest = lsplit.groups()
1794
1794
1795 #print 'line:<%s>' % line # dbg
1795 #print 'line:<%s>' % line # dbg
1796 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1796 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1797 return pre,iFun.strip(),theRest
1797 return pre,iFun.strip(),theRest
1798
1798
1799 def _prefilter(self, line, continue_prompt):
1799 def _prefilter(self, line, continue_prompt):
1800 """Calls different preprocessors, depending on the form of line."""
1800 """Calls different preprocessors, depending on the form of line."""
1801
1801
1802 # All handlers *must* return a value, even if it's blank ('').
1802 # All handlers *must* return a value, even if it's blank ('').
1803
1803
1804 # Lines are NOT logged here. Handlers should process the line as
1804 # Lines are NOT logged here. Handlers should process the line as
1805 # needed, update the cache AND log it (so that the input cache array
1805 # needed, update the cache AND log it (so that the input cache array
1806 # stays synced).
1806 # stays synced).
1807
1807
1808 # This function is _very_ delicate, and since it's also the one which
1808 # This function is _very_ delicate, and since it's also the one which
1809 # determines IPython's response to user input, it must be as efficient
1809 # determines IPython's response to user input, it must be as efficient
1810 # as possible. For this reason it has _many_ returns in it, trying
1810 # as possible. For this reason it has _many_ returns in it, trying
1811 # always to exit as quickly as it can figure out what it needs to do.
1811 # always to exit as quickly as it can figure out what it needs to do.
1812
1812
1813 # This function is the main responsible for maintaining IPython's
1813 # This function is the main responsible for maintaining IPython's
1814 # behavior respectful of Python's semantics. So be _very_ careful if
1814 # behavior respectful of Python's semantics. So be _very_ careful if
1815 # making changes to anything here.
1815 # making changes to anything here.
1816
1816
1817 #.....................................................................
1817 #.....................................................................
1818 # Code begins
1818 # Code begins
1819
1819
1820 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1820 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1821
1821
1822 # save the line away in case we crash, so the post-mortem handler can
1822 # save the line away in case we crash, so the post-mortem handler can
1823 # record it
1823 # record it
1824 self._last_input_line = line
1824 self._last_input_line = line
1825
1825
1826 #print '***line: <%s>' % line # dbg
1826 #print '***line: <%s>' % line # dbg
1827
1827
1828 # the input history needs to track even empty lines
1828 # the input history needs to track even empty lines
1829 stripped = line.strip()
1829 stripped = line.strip()
1830
1830
1831 if not stripped:
1831 if not stripped:
1832 if not continue_prompt:
1832 if not continue_prompt:
1833 self.outputcache.prompt_count -= 1
1833 self.outputcache.prompt_count -= 1
1834 return self.handle_normal(line,continue_prompt)
1834 return self.handle_normal(line,continue_prompt)
1835 #return self.handle_normal('',continue_prompt)
1835 #return self.handle_normal('',continue_prompt)
1836
1836
1837 # print '***cont',continue_prompt # dbg
1837 # print '***cont',continue_prompt # dbg
1838 # special handlers are only allowed for single line statements
1838 # special handlers are only allowed for single line statements
1839 if continue_prompt and not self.rc.multi_line_specials:
1839 if continue_prompt and not self.rc.multi_line_specials:
1840 return self.handle_normal(line,continue_prompt)
1840 return self.handle_normal(line,continue_prompt)
1841
1841
1842
1842
1843 # For the rest, we need the structure of the input
1843 # For the rest, we need the structure of the input
1844 pre,iFun,theRest = self.split_user_input(line)
1844 pre,iFun,theRest = self.split_user_input(line)
1845
1845
1846 # See whether any pre-existing handler can take care of it
1846 # See whether any pre-existing handler can take care of it
1847
1847
1848 rewritten = self.hooks.input_prefilter(stripped)
1848 rewritten = self.hooks.input_prefilter(stripped)
1849 if rewritten != stripped: # ok, some prefilter did something
1849 if rewritten != stripped: # ok, some prefilter did something
1850 rewritten = pre + rewritten # add indentation
1850 rewritten = pre + rewritten # add indentation
1851 return self.handle_normal(rewritten)
1851 return self.handle_normal(rewritten)
1852
1852
1853
1853
1854
1854
1855
1855
1856 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1856 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1857
1857
1858 # First check for explicit escapes in the last/first character
1858 # First check for explicit escapes in the last/first character
1859 handler = None
1859 handler = None
1860 if line[-1] == self.ESC_HELP:
1860 if line[-1] == self.ESC_HELP:
1861 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1861 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1862 if handler is None:
1862 if handler is None:
1863 # look at the first character of iFun, NOT of line, so we skip
1863 # look at the first character of iFun, NOT of line, so we skip
1864 # leading whitespace in multiline input
1864 # leading whitespace in multiline input
1865 handler = self.esc_handlers.get(iFun[0:1])
1865 handler = self.esc_handlers.get(iFun[0:1])
1866 if handler is not None:
1866 if handler is not None:
1867 return handler(line,continue_prompt,pre,iFun,theRest)
1867 return handler(line,continue_prompt,pre,iFun,theRest)
1868 # Emacs ipython-mode tags certain input lines
1868 # Emacs ipython-mode tags certain input lines
1869 if line.endswith('# PYTHON-MODE'):
1869 if line.endswith('# PYTHON-MODE'):
1870 return self.handle_emacs(line,continue_prompt)
1870 return self.handle_emacs(line,continue_prompt)
1871
1871
1872 # Next, check if we can automatically execute this thing
1872 # Next, check if we can automatically execute this thing
1873
1873
1874 # Allow ! in multi-line statements if multi_line_specials is on:
1874 # Allow ! in multi-line statements if multi_line_specials is on:
1875 if continue_prompt and self.rc.multi_line_specials and \
1875 if continue_prompt and self.rc.multi_line_specials and \
1876 iFun.startswith(self.ESC_SHELL):
1876 iFun.startswith(self.ESC_SHELL):
1877 return self.handle_shell_escape(line,continue_prompt,
1877 return self.handle_shell_escape(line,continue_prompt,
1878 pre=pre,iFun=iFun,
1878 pre=pre,iFun=iFun,
1879 theRest=theRest)
1879 theRest=theRest)
1880
1880
1881 # Let's try to find if the input line is a magic fn
1881 # Let's try to find if the input line is a magic fn
1882 oinfo = None
1882 oinfo = None
1883 if hasattr(self,'magic_'+iFun):
1883 if hasattr(self,'magic_'+iFun):
1884 # WARNING: _ofind uses getattr(), so it can consume generators and
1884 # WARNING: _ofind uses getattr(), so it can consume generators and
1885 # cause other side effects.
1885 # cause other side effects.
1886 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1886 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1887 if oinfo['ismagic']:
1887 if oinfo['ismagic']:
1888 # Be careful not to call magics when a variable assignment is
1888 # Be careful not to call magics when a variable assignment is
1889 # being made (ls='hi', for example)
1889 # being made (ls='hi', for example)
1890 if self.rc.automagic and \
1890 if self.rc.automagic and \
1891 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1891 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1892 (self.rc.multi_line_specials or not continue_prompt):
1892 (self.rc.multi_line_specials or not continue_prompt):
1893 return self.handle_magic(line,continue_prompt,
1893 return self.handle_magic(line,continue_prompt,
1894 pre,iFun,theRest)
1894 pre,iFun,theRest)
1895 else:
1895 else:
1896 return self.handle_normal(line,continue_prompt)
1896 return self.handle_normal(line,continue_prompt)
1897
1897
1898 # If the rest of the line begins with an (in)equality, assginment or
1898 # If the rest of the line begins with an (in)equality, assginment or
1899 # function call, we should not call _ofind but simply execute it.
1899 # function call, we should not call _ofind but simply execute it.
1900 # This avoids spurious geattr() accesses on objects upon assignment.
1900 # This avoids spurious geattr() accesses on objects upon assignment.
1901 #
1901 #
1902 # It also allows users to assign to either alias or magic names true
1902 # It also allows users to assign to either alias or magic names true
1903 # python variables (the magic/alias systems always take second seat to
1903 # python variables (the magic/alias systems always take second seat to
1904 # true python code).
1904 # true python code).
1905 if theRest and theRest[0] in '!=()':
1905 if theRest and theRest[0] in '!=()':
1906 return self.handle_normal(line,continue_prompt)
1906 return self.handle_normal(line,continue_prompt)
1907
1907
1908 if oinfo is None:
1908 if oinfo is None:
1909 # let's try to ensure that _oinfo is ONLY called when autocall is
1909 # let's try to ensure that _oinfo is ONLY called when autocall is
1910 # on. Since it has inevitable potential side effects, at least
1910 # on. Since it has inevitable potential side effects, at least
1911 # having autocall off should be a guarantee to the user that no
1911 # having autocall off should be a guarantee to the user that no
1912 # weird things will happen.
1912 # weird things will happen.
1913
1913
1914 if self.rc.autocall:
1914 if self.rc.autocall:
1915 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1915 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1916 else:
1916 else:
1917 # in this case, all that's left is either an alias or
1917 # in this case, all that's left is either an alias or
1918 # processing the line normally.
1918 # processing the line normally.
1919 if iFun in self.alias_table:
1919 if iFun in self.alias_table:
1920 return self.handle_alias(line,continue_prompt,
1920 return self.handle_alias(line,continue_prompt,
1921 pre,iFun,theRest)
1921 pre,iFun,theRest)
1922
1922
1923 else:
1923 else:
1924 return self.handle_normal(line,continue_prompt)
1924 return self.handle_normal(line,continue_prompt)
1925
1925
1926 if not oinfo['found']:
1926 if not oinfo['found']:
1927 return self.handle_normal(line,continue_prompt)
1927 return self.handle_normal(line,continue_prompt)
1928 else:
1928 else:
1929 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1929 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1930 if oinfo['isalias']:
1930 if oinfo['isalias']:
1931 return self.handle_alias(line,continue_prompt,
1931 return self.handle_alias(line,continue_prompt,
1932 pre,iFun,theRest)
1932 pre,iFun,theRest)
1933
1933
1934 if (self.rc.autocall
1934 if (self.rc.autocall
1935 and
1935 and
1936 (
1936 (
1937 #only consider exclusion re if not "," or ";" autoquoting
1937 #only consider exclusion re if not "," or ";" autoquoting
1938 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2) or
1938 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1939 or pre == self.ESC_PAREN) or
1939 (not self.re_exclude_auto.match(theRest)))
1940 (not self.re_exclude_auto.match(theRest)))
1940 and
1941 and
1941 self.re_fun_name.match(iFun) and
1942 self.re_fun_name.match(iFun) and
1942 callable(oinfo['obj'])) :
1943 callable(oinfo['obj'])) :
1943 #print 'going auto' # dbg
1944 #print 'going auto' # dbg
1944 return self.handle_auto(line,continue_prompt,
1945 return self.handle_auto(line,continue_prompt,
1945 pre,iFun,theRest,oinfo['obj'])
1946 pre,iFun,theRest,oinfo['obj'])
1946 else:
1947 else:
1947 #print 'was callable?', callable(oinfo['obj']) # dbg
1948 #print 'was callable?', callable(oinfo['obj']) # dbg
1948 return self.handle_normal(line,continue_prompt)
1949 return self.handle_normal(line,continue_prompt)
1949
1950
1950 # If we get here, we have a normal Python line. Log and return.
1951 # If we get here, we have a normal Python line. Log and return.
1951 return self.handle_normal(line,continue_prompt)
1952 return self.handle_normal(line,continue_prompt)
1952
1953
1953 def _prefilter_dumb(self, line, continue_prompt):
1954 def _prefilter_dumb(self, line, continue_prompt):
1954 """simple prefilter function, for debugging"""
1955 """simple prefilter function, for debugging"""
1955 return self.handle_normal(line,continue_prompt)
1956 return self.handle_normal(line,continue_prompt)
1956
1957
1957 # Set the default prefilter() function (this can be user-overridden)
1958 # Set the default prefilter() function (this can be user-overridden)
1958 prefilter = _prefilter
1959 prefilter = _prefilter
1959
1960
1960 def handle_normal(self,line,continue_prompt=None,
1961 def handle_normal(self,line,continue_prompt=None,
1961 pre=None,iFun=None,theRest=None):
1962 pre=None,iFun=None,theRest=None):
1962 """Handle normal input lines. Use as a template for handlers."""
1963 """Handle normal input lines. Use as a template for handlers."""
1963
1964
1964 # With autoindent on, we need some way to exit the input loop, and I
1965 # With autoindent on, we need some way to exit the input loop, and I
1965 # don't want to force the user to have to backspace all the way to
1966 # don't want to force the user to have to backspace all the way to
1966 # clear the line. The rule will be in this case, that either two
1967 # clear the line. The rule will be in this case, that either two
1967 # lines of pure whitespace in a row, or a line of pure whitespace but
1968 # lines of pure whitespace in a row, or a line of pure whitespace but
1968 # of a size different to the indent level, will exit the input loop.
1969 # of a size different to the indent level, will exit the input loop.
1969
1970
1970 if (continue_prompt and self.autoindent and line.isspace() and
1971 if (continue_prompt and self.autoindent and line.isspace() and
1971 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1972 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1972 (self.buffer[-1]).isspace() )):
1973 (self.buffer[-1]).isspace() )):
1973 line = ''
1974 line = ''
1974
1975
1975 self.log(line,continue_prompt)
1976 self.log(line,continue_prompt)
1976 return line
1977 return line
1977
1978
1978 def handle_alias(self,line,continue_prompt=None,
1979 def handle_alias(self,line,continue_prompt=None,
1979 pre=None,iFun=None,theRest=None):
1980 pre=None,iFun=None,theRest=None):
1980 """Handle alias input lines. """
1981 """Handle alias input lines. """
1981
1982
1982 # pre is needed, because it carries the leading whitespace. Otherwise
1983 # pre is needed, because it carries the leading whitespace. Otherwise
1983 # aliases won't work in indented sections.
1984 # aliases won't work in indented sections.
1984 line_out = '%sipalias(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
1985 line_out = '%sipalias(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
1985 self.log(line_out,continue_prompt)
1986 self.log(line_out,continue_prompt)
1986 return line_out
1987 return line_out
1987
1988
1988 def handle_shell_escape(self, line, continue_prompt=None,
1989 def handle_shell_escape(self, line, continue_prompt=None,
1989 pre=None,iFun=None,theRest=None):
1990 pre=None,iFun=None,theRest=None):
1990 """Execute the line in a shell, empty return value"""
1991 """Execute the line in a shell, empty return value"""
1991
1992
1992 #print 'line in :', `line` # dbg
1993 #print 'line in :', `line` # dbg
1993 # Example of a special handler. Others follow a similar pattern.
1994 # Example of a special handler. Others follow a similar pattern.
1994 if line.lstrip().startswith('!!'):
1995 if line.lstrip().startswith('!!'):
1995 # rewrite iFun/theRest to properly hold the call to %sx and
1996 # rewrite iFun/theRest to properly hold the call to %sx and
1996 # the actual command to be executed, so handle_magic can work
1997 # the actual command to be executed, so handle_magic can work
1997 # correctly
1998 # correctly
1998 theRest = '%s %s' % (iFun[2:],theRest)
1999 theRest = '%s %s' % (iFun[2:],theRest)
1999 iFun = 'sx'
2000 iFun = 'sx'
2000 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2001 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2001 line.lstrip()[2:]),
2002 line.lstrip()[2:]),
2002 continue_prompt,pre,iFun,theRest)
2003 continue_prompt,pre,iFun,theRest)
2003 else:
2004 else:
2004 cmd=line.lstrip().lstrip('!')
2005 cmd=line.lstrip().lstrip('!')
2005 line_out = '%sipsystem(%s)' % (pre,make_quoted_expr(cmd))
2006 line_out = '%sipsystem(%s)' % (pre,make_quoted_expr(cmd))
2006 # update cache/log and return
2007 # update cache/log and return
2007 self.log(line_out,continue_prompt)
2008 self.log(line_out,continue_prompt)
2008 return line_out
2009 return line_out
2009
2010
2010 def handle_magic(self, line, continue_prompt=None,
2011 def handle_magic(self, line, continue_prompt=None,
2011 pre=None,iFun=None,theRest=None):
2012 pre=None,iFun=None,theRest=None):
2012 """Execute magic functions."""
2013 """Execute magic functions."""
2013
2014
2014
2015
2015 cmd = '%sipmagic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2016 cmd = '%sipmagic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2016 self.log(cmd,continue_prompt)
2017 self.log(cmd,continue_prompt)
2017 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2018 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2018 return cmd
2019 return cmd
2019
2020
2020 def handle_auto(self, line, continue_prompt=None,
2021 def handle_auto(self, line, continue_prompt=None,
2021 pre=None,iFun=None,theRest=None,obj=None):
2022 pre=None,iFun=None,theRest=None,obj=None):
2022 """Hande lines which can be auto-executed, quoting if requested."""
2023 """Hande lines which can be auto-executed, quoting if requested."""
2023
2024
2024 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2025 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2025
2026
2026 # This should only be active for single-line input!
2027 # This should only be active for single-line input!
2027 if continue_prompt:
2028 if continue_prompt:
2028 self.log(line,continue_prompt)
2029 self.log(line,continue_prompt)
2029 return line
2030 return line
2030
2031
2031 auto_rewrite = True
2032 auto_rewrite = True
2033
2032 if pre == self.ESC_QUOTE:
2034 if pre == self.ESC_QUOTE:
2033 # Auto-quote splitting on whitespace
2035 # Auto-quote splitting on whitespace
2034 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2036 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2035 elif pre == self.ESC_QUOTE2:
2037 elif pre == self.ESC_QUOTE2:
2036 # Auto-quote whole string
2038 # Auto-quote whole string
2037 newcmd = '%s("%s")' % (iFun,theRest)
2039 newcmd = '%s("%s")' % (iFun,theRest)
2040 elif pre == self.ESC_PAREN:
2041 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2038 else:
2042 else:
2039 # Auto-paren.
2043 # Auto-paren.
2040 # We only apply it to argument-less calls if the autocall
2044 # We only apply it to argument-less calls if the autocall
2041 # parameter is set to 2. We only need to check that autocall is <
2045 # parameter is set to 2. We only need to check that autocall is <
2042 # 2, since this function isn't called unless it's at least 1.
2046 # 2, since this function isn't called unless it's at least 1.
2043 if not theRest and (self.rc.autocall < 2):
2047 if not theRest and (self.rc.autocall < 2):
2044 newcmd = '%s %s' % (iFun,theRest)
2048 newcmd = '%s %s' % (iFun,theRest)
2045 auto_rewrite = False
2049 auto_rewrite = False
2046 else:
2050 else:
2047 if theRest.startswith('['):
2051 if theRest.startswith('['):
2048 if hasattr(obj,'__getitem__'):
2052 if hasattr(obj,'__getitem__'):
2049 # Don't autocall in this case: item access for an object
2053 # Don't autocall in this case: item access for an object
2050 # which is BOTH callable and implements __getitem__.
2054 # which is BOTH callable and implements __getitem__.
2051 newcmd = '%s %s' % (iFun,theRest)
2055 newcmd = '%s %s' % (iFun,theRest)
2052 auto_rewrite = False
2056 auto_rewrite = False
2053 else:
2057 else:
2054 # if the object doesn't support [] access, go ahead and
2058 # if the object doesn't support [] access, go ahead and
2055 # autocall
2059 # autocall
2056 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2060 newcmd = '%s(%s)' % (iFun.rstrip(),",".join(theRest.split()))
2057 elif theRest.endswith(';'):
2061 elif theRest.endswith(';'):
2058 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2062 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2059 else:
2063 else:
2060 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2064 newcmd = '%s(%s)' % (iFun.rstrip(),",".join(theRest.split()))
2061
2065
2062 if auto_rewrite:
2066 if auto_rewrite:
2063 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2067 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2064 # log what is now valid Python, not the actual user input (without the
2068 # log what is now valid Python, not the actual user input (without the
2065 # final newline)
2069 # final newline)
2066 self.log(newcmd,continue_prompt)
2070 self.log(newcmd,continue_prompt)
2067 return newcmd
2071 return newcmd
2068
2072
2069 def handle_help(self, line, continue_prompt=None,
2073 def handle_help(self, line, continue_prompt=None,
2070 pre=None,iFun=None,theRest=None):
2074 pre=None,iFun=None,theRest=None):
2071 """Try to get some help for the object.
2075 """Try to get some help for the object.
2072
2076
2073 obj? or ?obj -> basic information.
2077 obj? or ?obj -> basic information.
2074 obj?? or ??obj -> more details.
2078 obj?? or ??obj -> more details.
2075 """
2079 """
2076
2080
2077 # We need to make sure that we don't process lines which would be
2081 # We need to make sure that we don't process lines which would be
2078 # otherwise valid python, such as "x=1 # what?"
2082 # otherwise valid python, such as "x=1 # what?"
2079 try:
2083 try:
2080 codeop.compile_command(line)
2084 codeop.compile_command(line)
2081 except SyntaxError:
2085 except SyntaxError:
2082 # We should only handle as help stuff which is NOT valid syntax
2086 # We should only handle as help stuff which is NOT valid syntax
2083 if line[0]==self.ESC_HELP:
2087 if line[0]==self.ESC_HELP:
2084 line = line[1:]
2088 line = line[1:]
2085 elif line[-1]==self.ESC_HELP:
2089 elif line[-1]==self.ESC_HELP:
2086 line = line[:-1]
2090 line = line[:-1]
2087 self.log('#?'+line)
2091 self.log('#?'+line)
2088 if line:
2092 if line:
2089 self.magic_pinfo(line)
2093 self.magic_pinfo(line)
2090 else:
2094 else:
2091 page(self.usage,screen_lines=self.rc.screen_length)
2095 page(self.usage,screen_lines=self.rc.screen_length)
2092 return '' # Empty string is needed here!
2096 return '' # Empty string is needed here!
2093 except:
2097 except:
2094 # Pass any other exceptions through to the normal handler
2098 # Pass any other exceptions through to the normal handler
2095 return self.handle_normal(line,continue_prompt)
2099 return self.handle_normal(line,continue_prompt)
2096 else:
2100 else:
2097 # If the code compiles ok, we should handle it normally
2101 # If the code compiles ok, we should handle it normally
2098 return self.handle_normal(line,continue_prompt)
2102 return self.handle_normal(line,continue_prompt)
2099
2103
2100 def getapi(self):
2104 def getapi(self):
2101 """ Get an IPApi object for this shell instance
2105 """ Get an IPApi object for this shell instance
2102
2106
2103 Getting an IPApi object is always preferable to accessing the shell
2107 Getting an IPApi object is always preferable to accessing the shell
2104 directly, but this holds true especially for extensions.
2108 directly, but this holds true especially for extensions.
2105
2109
2106 It should always be possible to implement an extension with IPApi
2110 It should always be possible to implement an extension with IPApi
2107 alone. If not, contact maintainer to request an addition.
2111 alone. If not, contact maintainer to request an addition.
2108
2112
2109 """
2113 """
2110 return self.api
2114 return self.api
2111
2115
2112 def handle_emacs(self,line,continue_prompt=None,
2116 def handle_emacs(self,line,continue_prompt=None,
2113 pre=None,iFun=None,theRest=None):
2117 pre=None,iFun=None,theRest=None):
2114 """Handle input lines marked by python-mode."""
2118 """Handle input lines marked by python-mode."""
2115
2119
2116 # Currently, nothing is done. Later more functionality can be added
2120 # Currently, nothing is done. Later more functionality can be added
2117 # here if needed.
2121 # here if needed.
2118
2122
2119 # The input cache shouldn't be updated
2123 # The input cache shouldn't be updated
2120
2124
2121 return line
2125 return line
2122
2126
2123 def mktempfile(self,data=None):
2127 def mktempfile(self,data=None):
2124 """Make a new tempfile and return its filename.
2128 """Make a new tempfile and return its filename.
2125
2129
2126 This makes a call to tempfile.mktemp, but it registers the created
2130 This makes a call to tempfile.mktemp, but it registers the created
2127 filename internally so ipython cleans it up at exit time.
2131 filename internally so ipython cleans it up at exit time.
2128
2132
2129 Optional inputs:
2133 Optional inputs:
2130
2134
2131 - data(None): if data is given, it gets written out to the temp file
2135 - data(None): if data is given, it gets written out to the temp file
2132 immediately, and the file is closed again."""
2136 immediately, and the file is closed again."""
2133
2137
2134 filename = tempfile.mktemp('.py','ipython_edit_')
2138 filename = tempfile.mktemp('.py','ipython_edit_')
2135 self.tempfiles.append(filename)
2139 self.tempfiles.append(filename)
2136
2140
2137 if data:
2141 if data:
2138 tmp_file = open(filename,'w')
2142 tmp_file = open(filename,'w')
2139 tmp_file.write(data)
2143 tmp_file.write(data)
2140 tmp_file.close()
2144 tmp_file.close()
2141 return filename
2145 return filename
2142
2146
2143 def write(self,data):
2147 def write(self,data):
2144 """Write a string to the default output"""
2148 """Write a string to the default output"""
2145 Term.cout.write(data)
2149 Term.cout.write(data)
2146
2150
2147 def write_err(self,data):
2151 def write_err(self,data):
2148 """Write a string to the default error output"""
2152 """Write a string to the default error output"""
2149 Term.cerr.write(data)
2153 Term.cerr.write(data)
2150
2154
2151 def exit(self):
2155 def exit(self):
2152 """Handle interactive exit.
2156 """Handle interactive exit.
2153
2157
2154 This method sets the exit_now attribute."""
2158 This method sets the exit_now attribute."""
2155
2159
2156 if self.rc.confirm_exit:
2160 if self.rc.confirm_exit:
2157 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2161 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2158 self.exit_now = True
2162 self.exit_now = True
2159 else:
2163 else:
2160 self.exit_now = True
2164 self.exit_now = True
2161 return self.exit_now
2165 return self.exit_now
2162
2166
2163 def safe_execfile(self,fname,*where,**kw):
2167 def safe_execfile(self,fname,*where,**kw):
2164 fname = os.path.expanduser(fname)
2168 fname = os.path.expanduser(fname)
2165
2169
2166 # find things also in current directory
2170 # find things also in current directory
2167 dname = os.path.dirname(fname)
2171 dname = os.path.dirname(fname)
2168 if not sys.path.count(dname):
2172 if not sys.path.count(dname):
2169 sys.path.append(dname)
2173 sys.path.append(dname)
2170
2174
2171 try:
2175 try:
2172 xfile = open(fname)
2176 xfile = open(fname)
2173 except:
2177 except:
2174 print >> Term.cerr, \
2178 print >> Term.cerr, \
2175 'Could not open file <%s> for safe execution.' % fname
2179 'Could not open file <%s> for safe execution.' % fname
2176 return None
2180 return None
2177
2181
2178 kw.setdefault('islog',0)
2182 kw.setdefault('islog',0)
2179 kw.setdefault('quiet',1)
2183 kw.setdefault('quiet',1)
2180 kw.setdefault('exit_ignore',0)
2184 kw.setdefault('exit_ignore',0)
2181 first = xfile.readline()
2185 first = xfile.readline()
2182 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2186 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2183 xfile.close()
2187 xfile.close()
2184 # line by line execution
2188 # line by line execution
2185 if first.startswith(loghead) or kw['islog']:
2189 if first.startswith(loghead) or kw['islog']:
2186 print 'Loading log file <%s> one line at a time...' % fname
2190 print 'Loading log file <%s> one line at a time...' % fname
2187 if kw['quiet']:
2191 if kw['quiet']:
2188 stdout_save = sys.stdout
2192 stdout_save = sys.stdout
2189 sys.stdout = StringIO.StringIO()
2193 sys.stdout = StringIO.StringIO()
2190 try:
2194 try:
2191 globs,locs = where[0:2]
2195 globs,locs = where[0:2]
2192 except:
2196 except:
2193 try:
2197 try:
2194 globs = locs = where[0]
2198 globs = locs = where[0]
2195 except:
2199 except:
2196 globs = locs = globals()
2200 globs = locs = globals()
2197 badblocks = []
2201 badblocks = []
2198
2202
2199 # we also need to identify indented blocks of code when replaying
2203 # we also need to identify indented blocks of code when replaying
2200 # logs and put them together before passing them to an exec
2204 # logs and put them together before passing them to an exec
2201 # statement. This takes a bit of regexp and look-ahead work in the
2205 # statement. This takes a bit of regexp and look-ahead work in the
2202 # file. It's easiest if we swallow the whole thing in memory
2206 # file. It's easiest if we swallow the whole thing in memory
2203 # first, and manually walk through the lines list moving the
2207 # first, and manually walk through the lines list moving the
2204 # counter ourselves.
2208 # counter ourselves.
2205 indent_re = re.compile('\s+\S')
2209 indent_re = re.compile('\s+\S')
2206 xfile = open(fname)
2210 xfile = open(fname)
2207 filelines = xfile.readlines()
2211 filelines = xfile.readlines()
2208 xfile.close()
2212 xfile.close()
2209 nlines = len(filelines)
2213 nlines = len(filelines)
2210 lnum = 0
2214 lnum = 0
2211 while lnum < nlines:
2215 while lnum < nlines:
2212 line = filelines[lnum]
2216 line = filelines[lnum]
2213 lnum += 1
2217 lnum += 1
2214 # don't re-insert logger status info into cache
2218 # don't re-insert logger status info into cache
2215 if line.startswith('#log#'):
2219 if line.startswith('#log#'):
2216 continue
2220 continue
2217 else:
2221 else:
2218 # build a block of code (maybe a single line) for execution
2222 # build a block of code (maybe a single line) for execution
2219 block = line
2223 block = line
2220 try:
2224 try:
2221 next = filelines[lnum] # lnum has already incremented
2225 next = filelines[lnum] # lnum has already incremented
2222 except:
2226 except:
2223 next = None
2227 next = None
2224 while next and indent_re.match(next):
2228 while next and indent_re.match(next):
2225 block += next
2229 block += next
2226 lnum += 1
2230 lnum += 1
2227 try:
2231 try:
2228 next = filelines[lnum]
2232 next = filelines[lnum]
2229 except:
2233 except:
2230 next = None
2234 next = None
2231 # now execute the block of one or more lines
2235 # now execute the block of one or more lines
2232 try:
2236 try:
2233 exec block in globs,locs
2237 exec block in globs,locs
2234 except SystemExit:
2238 except SystemExit:
2235 pass
2239 pass
2236 except:
2240 except:
2237 badblocks.append(block.rstrip())
2241 badblocks.append(block.rstrip())
2238 if kw['quiet']: # restore stdout
2242 if kw['quiet']: # restore stdout
2239 sys.stdout.close()
2243 sys.stdout.close()
2240 sys.stdout = stdout_save
2244 sys.stdout = stdout_save
2241 print 'Finished replaying log file <%s>' % fname
2245 print 'Finished replaying log file <%s>' % fname
2242 if badblocks:
2246 if badblocks:
2243 print >> sys.stderr, ('\nThe following lines/blocks in file '
2247 print >> sys.stderr, ('\nThe following lines/blocks in file '
2244 '<%s> reported errors:' % fname)
2248 '<%s> reported errors:' % fname)
2245
2249
2246 for badline in badblocks:
2250 for badline in badblocks:
2247 print >> sys.stderr, badline
2251 print >> sys.stderr, badline
2248 else: # regular file execution
2252 else: # regular file execution
2249 try:
2253 try:
2250 execfile(fname,*where)
2254 execfile(fname,*where)
2251 except SyntaxError:
2255 except SyntaxError:
2252 etype,evalue = sys.exc_info()[:2]
2256 etype,evalue = sys.exc_info()[:2]
2253 self.SyntaxTB(etype,evalue,[])
2257 self.SyntaxTB(etype,evalue,[])
2254 warn('Failure executing file: <%s>' % fname)
2258 warn('Failure executing file: <%s>' % fname)
2255 except SystemExit,status:
2259 except SystemExit,status:
2256 if not kw['exit_ignore']:
2260 if not kw['exit_ignore']:
2257 self.InteractiveTB()
2261 self.InteractiveTB()
2258 warn('Failure executing file: <%s>' % fname)
2262 warn('Failure executing file: <%s>' % fname)
2259 except:
2263 except:
2260 self.InteractiveTB()
2264 self.InteractiveTB()
2261 warn('Failure executing file: <%s>' % fname)
2265 warn('Failure executing file: <%s>' % fname)
2262
2266
2263 #************************* end of file <iplib.py> *****************************
2267 #************************* end of file <iplib.py> *****************************
@@ -1,5100 +1,5102 b''
1 2006-01-27 Ville Vainio <vivainio@gmail.com>
1 2006-01-27 Ville Vainio <vivainio@gmail.com>
2
2
3 * ipmaker.py: Give "realistic" sys.argv for scripts (without
3 * ipmaker.py: Give "realistic" sys.argv for scripts (without
4 'ipython' at argv[0]) executed through command line.
4 'ipython' at argv[0]) executed through command line.
5 NOTE: this DEPRECATES calling ipython with multiple scripts
5 NOTE: this DEPRECATES calling ipython with multiple scripts
6 ("ipython a.py b.py c.py")
6 ("ipython a.py b.py c.py")
7
7
8 * iplib.py, hooks.py: Added configurable input prefilter,
8 * iplib.py, hooks.py: Added configurable input prefilter,
9 named 'input_prefilter'. See ext_rescapture.py for example
9 named 'input_prefilter'. See ext_rescapture.py for example
10 usage.
10 usage.
11
11
12 * ext_rescapture.py, Magic.py: Better system command output capture
12 * ext_rescapture.py, Magic.py: Better system command output capture
13 through 'var = !ls' (deprecates user-visible %sc). Same notation
13 through 'var = !ls' (deprecates user-visible %sc). Same notation
14 applies for magics, 'var = %alias' assigns alias list to var.
14 applies for magics, 'var = %alias' assigns alias list to var.
15
15
16 * ipapi.py: added meta() for accessing extension-usable data store.
16 * ipapi.py: added meta() for accessing extension-usable data store.
17
17
18 * iplib.py: added InteractiveShell.getapi(). New magics should be
18 * iplib.py: added InteractiveShell.getapi(). New magics should be
19 written doing self.getapi() instead of using the shell directly.
19 written doing self.getapi() instead of using the shell directly.
20
20
21 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
21 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
22 %store foo >> ~/myfoo.txt to store variables to files (in clean
22 %store foo >> ~/myfoo.txt to store variables to files (in clean
23 textual form, not a restorable pickle).
23 textual form, not a restorable pickle).
24
24
25 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
25 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
26
26
27 * usage.py, Magic.py: added %quickref
27 * usage.py, Magic.py: added %quickref
28
28
29 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
30
29 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
31 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
30
32
31 * IPython/demo.py (Demo.show): Flush stdout after each block, so
33 * IPython/demo.py (Demo.show): Flush stdout after each block, so
32 computationally intensive blocks don't appear to stall the demo.
34 computationally intensive blocks don't appear to stall the demo.
33
35
34 2006-01-24 Ville Vainio <vivainio@gmail.com>
36 2006-01-24 Ville Vainio <vivainio@gmail.com>
35
37
36 * iplib.py, hooks.py: 'result_display' hook can return a non-None
38 * iplib.py, hooks.py: 'result_display' hook can return a non-None
37 value to manipulate resulting history entry.
39 value to manipulate resulting history entry.
38
40
39 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
41 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
40 to instance methods of IPApi class, to make extending an embedded
42 to instance methods of IPApi class, to make extending an embedded
41 IPython feasible. See ext_rehashdir.py for example usage.
43 IPython feasible. See ext_rehashdir.py for example usage.
42
44
43 * Merged 1071-1076 from banches/0.7.1
45 * Merged 1071-1076 from banches/0.7.1
44
46
45
47
46 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
48 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
47
49
48 * tools/release (daystamp): Fix build tools to use the new
50 * tools/release (daystamp): Fix build tools to use the new
49 eggsetup.py script to build lightweight eggs.
51 eggsetup.py script to build lightweight eggs.
50
52
51 * Applied changesets 1062 and 1064 before 0.7.1 release.
53 * Applied changesets 1062 and 1064 before 0.7.1 release.
52
54
53 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
55 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
54 see the raw input history (without conversions like %ls ->
56 see the raw input history (without conversions like %ls ->
55 ipmagic("ls")). After a request from W. Stein, SAGE
57 ipmagic("ls")). After a request from W. Stein, SAGE
56 (http://modular.ucsd.edu/sage) developer. This information is
58 (http://modular.ucsd.edu/sage) developer. This information is
57 stored in the input_hist_raw attribute of the IPython instance, so
59 stored in the input_hist_raw attribute of the IPython instance, so
58 developers can access it if needed (it's an InputList instance).
60 developers can access it if needed (it's an InputList instance).
59
61
60 * Versionstring = 0.7.2.svn
62 * Versionstring = 0.7.2.svn
61
63
62 * eggsetup.py: A separate script for constructing eggs, creates
64 * eggsetup.py: A separate script for constructing eggs, creates
63 proper launch scripts even on Windows (an .exe file in
65 proper launch scripts even on Windows (an .exe file in
64 \python24\scripts).
66 \python24\scripts).
65
67
66 * ipapi.py: launch_new_instance, launch entry point needed for the
68 * ipapi.py: launch_new_instance, launch entry point needed for the
67 egg.
69 egg.
68
70
69 2006-01-23 Ville Vainio <vivainio@gmail.com>
71 2006-01-23 Ville Vainio <vivainio@gmail.com>
70
72
71 * Added %cpaste magic for pasting python code
73 * Added %cpaste magic for pasting python code
72
74
73 2006-01-22 Ville Vainio <vivainio@gmail.com>
75 2006-01-22 Ville Vainio <vivainio@gmail.com>
74
76
75 * Merge from branches/0.7.1 into trunk, revs 1052-1057
77 * Merge from branches/0.7.1 into trunk, revs 1052-1057
76
78
77 * Versionstring = 0.7.2.svn
79 * Versionstring = 0.7.2.svn
78
80
79 * eggsetup.py: A separate script for constructing eggs, creates
81 * eggsetup.py: A separate script for constructing eggs, creates
80 proper launch scripts even on Windows (an .exe file in
82 proper launch scripts even on Windows (an .exe file in
81 \python24\scripts).
83 \python24\scripts).
82
84
83 * ipapi.py: launch_new_instance, launch entry point needed for the
85 * ipapi.py: launch_new_instance, launch entry point needed for the
84 egg.
86 egg.
85
87
86 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
88 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
87
89
88 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
90 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
89 %pfile foo would print the file for foo even if it was a binary.
91 %pfile foo would print the file for foo even if it was a binary.
90 Now, extensions '.so' and '.dll' are skipped.
92 Now, extensions '.so' and '.dll' are skipped.
91
93
92 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
94 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
93 bug, where macros would fail in all threaded modes. I'm not 100%
95 bug, where macros would fail in all threaded modes. I'm not 100%
94 sure, so I'm going to put out an rc instead of making a release
96 sure, so I'm going to put out an rc instead of making a release
95 today, and wait for feedback for at least a few days.
97 today, and wait for feedback for at least a few days.
96
98
97 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
99 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
98 it...) the handling of pasting external code with autoindent on.
100 it...) the handling of pasting external code with autoindent on.
99 To get out of a multiline input, the rule will appear for most
101 To get out of a multiline input, the rule will appear for most
100 users unchanged: two blank lines or change the indent level
102 users unchanged: two blank lines or change the indent level
101 proposed by IPython. But there is a twist now: you can
103 proposed by IPython. But there is a twist now: you can
102 add/subtract only *one or two spaces*. If you add/subtract three
104 add/subtract only *one or two spaces*. If you add/subtract three
103 or more (unless you completely delete the line), IPython will
105 or more (unless you completely delete the line), IPython will
104 accept that line, and you'll need to enter a second one of pure
106 accept that line, and you'll need to enter a second one of pure
105 whitespace. I know it sounds complicated, but I can't find a
107 whitespace. I know it sounds complicated, but I can't find a
106 different solution that covers all the cases, with the right
108 different solution that covers all the cases, with the right
107 heuristics. Hopefully in actual use, nobody will really notice
109 heuristics. Hopefully in actual use, nobody will really notice
108 all these strange rules and things will 'just work'.
110 all these strange rules and things will 'just work'.
109
111
110 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
112 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
111
113
112 * IPython/iplib.py (interact): catch exceptions which can be
114 * IPython/iplib.py (interact): catch exceptions which can be
113 triggered asynchronously by signal handlers. Thanks to an
115 triggered asynchronously by signal handlers. Thanks to an
114 automatic crash report, submitted by Colin Kingsley
116 automatic crash report, submitted by Colin Kingsley
115 <tercel-AT-gentoo.org>.
117 <tercel-AT-gentoo.org>.
116
118
117 2006-01-20 Ville Vainio <vivainio@gmail.com>
119 2006-01-20 Ville Vainio <vivainio@gmail.com>
118
120
119 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
121 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
120 (%rehashdir, very useful, try it out) of how to extend ipython
122 (%rehashdir, very useful, try it out) of how to extend ipython
121 with new magics. Also added Extensions dir to pythonpath to make
123 with new magics. Also added Extensions dir to pythonpath to make
122 importing extensions easy.
124 importing extensions easy.
123
125
124 * %store now complains when trying to store interactively declared
126 * %store now complains when trying to store interactively declared
125 classes / instances of those classes.
127 classes / instances of those classes.
126
128
127 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
129 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
128 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
130 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
129 if they exist, and ipy_user_conf.py with some defaults is created for
131 if they exist, and ipy_user_conf.py with some defaults is created for
130 the user.
132 the user.
131
133
132 * Startup rehashing done by the config file, not InterpreterExec.
134 * Startup rehashing done by the config file, not InterpreterExec.
133 This means system commands are available even without selecting the
135 This means system commands are available even without selecting the
134 pysh profile. It's the sensible default after all.
136 pysh profile. It's the sensible default after all.
135
137
136 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
138 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
137
139
138 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
140 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
139 multiline code with autoindent on working. But I am really not
141 multiline code with autoindent on working. But I am really not
140 sure, so this needs more testing. Will commit a debug-enabled
142 sure, so this needs more testing. Will commit a debug-enabled
141 version for now, while I test it some more, so that Ville and
143 version for now, while I test it some more, so that Ville and
142 others may also catch any problems. Also made
144 others may also catch any problems. Also made
143 self.indent_current_str() a method, to ensure that there's no
145 self.indent_current_str() a method, to ensure that there's no
144 chance of the indent space count and the corresponding string
146 chance of the indent space count and the corresponding string
145 falling out of sync. All code needing the string should just call
147 falling out of sync. All code needing the string should just call
146 the method.
148 the method.
147
149
148 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
150 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
149
151
150 * IPython/Magic.py (magic_edit): fix check for when users don't
152 * IPython/Magic.py (magic_edit): fix check for when users don't
151 save their output files, the try/except was in the wrong section.
153 save their output files, the try/except was in the wrong section.
152
154
153 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
155 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
154
156
155 * IPython/Magic.py (magic_run): fix __file__ global missing from
157 * IPython/Magic.py (magic_run): fix __file__ global missing from
156 script's namespace when executed via %run. After a report by
158 script's namespace when executed via %run. After a report by
157 Vivian.
159 Vivian.
158
160
159 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
161 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
160 when using python 2.4. The parent constructor changed in 2.4, and
162 when using python 2.4. The parent constructor changed in 2.4, and
161 we need to track it directly (we can't call it, as it messes up
163 we need to track it directly (we can't call it, as it messes up
162 readline and tab-completion inside our pdb would stop working).
164 readline and tab-completion inside our pdb would stop working).
163 After a bug report by R. Bernstein <rocky-AT-panix.com>.
165 After a bug report by R. Bernstein <rocky-AT-panix.com>.
164
166
165 2006-01-16 Ville Vainio <vivainio@gmail.com>
167 2006-01-16 Ville Vainio <vivainio@gmail.com>
166
168
167 * Ipython/magic.py:Reverted back to old %edit functionality
169 * Ipython/magic.py:Reverted back to old %edit functionality
168 that returns file contents on exit.
170 that returns file contents on exit.
169
171
170 * IPython/path.py: Added Jason Orendorff's "path" module to
172 * IPython/path.py: Added Jason Orendorff's "path" module to
171 IPython tree, http://www.jorendorff.com/articles/python/path/.
173 IPython tree, http://www.jorendorff.com/articles/python/path/.
172 You can get path objects conveniently through %sc, and !!, e.g.:
174 You can get path objects conveniently through %sc, and !!, e.g.:
173 sc files=ls
175 sc files=ls
174 for p in files.paths: # or files.p
176 for p in files.paths: # or files.p
175 print p,p.mtime
177 print p,p.mtime
176
178
177 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
179 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
178 now work again without considering the exclusion regexp -
180 now work again without considering the exclusion regexp -
179 hence, things like ',foo my/path' turn to 'foo("my/path")'
181 hence, things like ',foo my/path' turn to 'foo("my/path")'
180 instead of syntax error.
182 instead of syntax error.
181
183
182
184
183 2006-01-14 Ville Vainio <vivainio@gmail.com>
185 2006-01-14 Ville Vainio <vivainio@gmail.com>
184
186
185 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
187 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
186 ipapi decorators for python 2.4 users, options() provides access to rc
188 ipapi decorators for python 2.4 users, options() provides access to rc
187 data.
189 data.
188
190
189 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
191 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
190 as path separators (even on Linux ;-). Space character after
192 as path separators (even on Linux ;-). Space character after
191 backslash (as yielded by tab completer) is still space;
193 backslash (as yielded by tab completer) is still space;
192 "%cd long\ name" works as expected.
194 "%cd long\ name" works as expected.
193
195
194 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
196 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
195 as "chain of command", with priority. API stays the same,
197 as "chain of command", with priority. API stays the same,
196 TryNext exception raised by a hook function signals that
198 TryNext exception raised by a hook function signals that
197 current hook failed and next hook should try handling it, as
199 current hook failed and next hook should try handling it, as
198 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
200 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
199 requested configurable display hook, which is now implemented.
201 requested configurable display hook, which is now implemented.
200
202
201 2006-01-13 Ville Vainio <vivainio@gmail.com>
203 2006-01-13 Ville Vainio <vivainio@gmail.com>
202
204
203 * IPython/platutils*.py: platform specific utility functions,
205 * IPython/platutils*.py: platform specific utility functions,
204 so far only set_term_title is implemented (change terminal
206 so far only set_term_title is implemented (change terminal
205 label in windowing systems). %cd now changes the title to
207 label in windowing systems). %cd now changes the title to
206 current dir.
208 current dir.
207
209
208 * IPython/Release.py: Added myself to "authors" list,
210 * IPython/Release.py: Added myself to "authors" list,
209 had to create new files.
211 had to create new files.
210
212
211 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
213 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
212 shell escape; not a known bug but had potential to be one in the
214 shell escape; not a known bug but had potential to be one in the
213 future.
215 future.
214
216
215 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
217 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
216 extension API for IPython! See the module for usage example. Fix
218 extension API for IPython! See the module for usage example. Fix
217 OInspect for docstring-less magic functions.
219 OInspect for docstring-less magic functions.
218
220
219
221
220 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
222 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
221
223
222 * IPython/iplib.py (raw_input): temporarily deactivate all
224 * IPython/iplib.py (raw_input): temporarily deactivate all
223 attempts at allowing pasting of code with autoindent on. It
225 attempts at allowing pasting of code with autoindent on. It
224 introduced bugs (reported by Prabhu) and I can't seem to find a
226 introduced bugs (reported by Prabhu) and I can't seem to find a
225 robust combination which works in all cases. Will have to revisit
227 robust combination which works in all cases. Will have to revisit
226 later.
228 later.
227
229
228 * IPython/genutils.py: remove isspace() function. We've dropped
230 * IPython/genutils.py: remove isspace() function. We've dropped
229 2.2 compatibility, so it's OK to use the string method.
231 2.2 compatibility, so it's OK to use the string method.
230
232
231 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
233 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
232
234
233 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
235 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
234 matching what NOT to autocall on, to include all python binary
236 matching what NOT to autocall on, to include all python binary
235 operators (including things like 'and', 'or', 'is' and 'in').
237 operators (including things like 'and', 'or', 'is' and 'in').
236 Prompted by a bug report on 'foo & bar', but I realized we had
238 Prompted by a bug report on 'foo & bar', but I realized we had
237 many more potential bug cases with other operators. The regexp is
239 many more potential bug cases with other operators. The regexp is
238 self.re_exclude_auto, it's fairly commented.
240 self.re_exclude_auto, it's fairly commented.
239
241
240 2006-01-12 Ville Vainio <vivainio@gmail.com>
242 2006-01-12 Ville Vainio <vivainio@gmail.com>
241
243
242 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
244 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
243 Prettified and hardened string/backslash quoting with ipsystem(),
245 Prettified and hardened string/backslash quoting with ipsystem(),
244 ipalias() and ipmagic(). Now even \ characters are passed to
246 ipalias() and ipmagic(). Now even \ characters are passed to
245 %magics, !shell escapes and aliases exactly as they are in the
247 %magics, !shell escapes and aliases exactly as they are in the
246 ipython command line. Should improve backslash experience,
248 ipython command line. Should improve backslash experience,
247 particularly in Windows (path delimiter for some commands that
249 particularly in Windows (path delimiter for some commands that
248 won't understand '/'), but Unix benefits as well (regexps). %cd
250 won't understand '/'), but Unix benefits as well (regexps). %cd
249 magic still doesn't support backslash path delimiters, though. Also
251 magic still doesn't support backslash path delimiters, though. Also
250 deleted all pretense of supporting multiline command strings in
252 deleted all pretense of supporting multiline command strings in
251 !system or %magic commands. Thanks to Jerry McRae for suggestions.
253 !system or %magic commands. Thanks to Jerry McRae for suggestions.
252
254
253 * doc/build_doc_instructions.txt added. Documentation on how to
255 * doc/build_doc_instructions.txt added. Documentation on how to
254 use doc/update_manual.py, added yesterday. Both files contributed
256 use doc/update_manual.py, added yesterday. Both files contributed
255 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
257 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
256 doc/*.sh for deprecation at a later date.
258 doc/*.sh for deprecation at a later date.
257
259
258 * /ipython.py Added ipython.py to root directory for
260 * /ipython.py Added ipython.py to root directory for
259 zero-installation (tar xzvf ipython.tgz; cd ipython; python
261 zero-installation (tar xzvf ipython.tgz; cd ipython; python
260 ipython.py) and development convenience (no need to kee doing
262 ipython.py) and development convenience (no need to kee doing
261 "setup.py install" between changes).
263 "setup.py install" between changes).
262
264
263 * Made ! and !! shell escapes work (again) in multiline expressions:
265 * Made ! and !! shell escapes work (again) in multiline expressions:
264 if 1:
266 if 1:
265 !ls
267 !ls
266 !!ls
268 !!ls
267
269
268 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
270 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
269
271
270 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
272 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
271 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
273 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
272 module in case-insensitive installation. Was causing crashes
274 module in case-insensitive installation. Was causing crashes
273 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
275 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
274
276
275 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
277 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
276 <marienz-AT-gentoo.org>, closes
278 <marienz-AT-gentoo.org>, closes
277 http://www.scipy.net/roundup/ipython/issue51.
279 http://www.scipy.net/roundup/ipython/issue51.
278
280
279 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
281 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
280
282
281 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
283 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
282 problem of excessive CPU usage under *nix and keyboard lag under
284 problem of excessive CPU usage under *nix and keyboard lag under
283 win32.
285 win32.
284
286
285 2006-01-10 *** Released version 0.7.0
287 2006-01-10 *** Released version 0.7.0
286
288
287 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
289 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
288
290
289 * IPython/Release.py (revision): tag version number to 0.7.0,
291 * IPython/Release.py (revision): tag version number to 0.7.0,
290 ready for release.
292 ready for release.
291
293
292 * IPython/Magic.py (magic_edit): Add print statement to %edit so
294 * IPython/Magic.py (magic_edit): Add print statement to %edit so
293 it informs the user of the name of the temp. file used. This can
295 it informs the user of the name of the temp. file used. This can
294 help if you decide later to reuse that same file, so you know
296 help if you decide later to reuse that same file, so you know
295 where to copy the info from.
297 where to copy the info from.
296
298
297 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
299 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
298
300
299 * setup_bdist_egg.py: little script to build an egg. Added
301 * setup_bdist_egg.py: little script to build an egg. Added
300 support in the release tools as well.
302 support in the release tools as well.
301
303
302 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
304 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
303
305
304 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
306 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
305 version selection (new -wxversion command line and ipythonrc
307 version selection (new -wxversion command line and ipythonrc
306 parameter). Patch contributed by Arnd Baecker
308 parameter). Patch contributed by Arnd Baecker
307 <arnd.baecker-AT-web.de>.
309 <arnd.baecker-AT-web.de>.
308
310
309 * IPython/iplib.py (embed_mainloop): fix tab-completion in
311 * IPython/iplib.py (embed_mainloop): fix tab-completion in
310 embedded instances, for variables defined at the interactive
312 embedded instances, for variables defined at the interactive
311 prompt of the embedded ipython. Reported by Arnd.
313 prompt of the embedded ipython. Reported by Arnd.
312
314
313 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
315 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
314 it can be used as a (stateful) toggle, or with a direct parameter.
316 it can be used as a (stateful) toggle, or with a direct parameter.
315
317
316 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
318 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
317 could be triggered in certain cases and cause the traceback
319 could be triggered in certain cases and cause the traceback
318 printer not to work.
320 printer not to work.
319
321
320 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
322 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
321
323
322 * IPython/iplib.py (_should_recompile): Small fix, closes
324 * IPython/iplib.py (_should_recompile): Small fix, closes
323 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
325 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
324
326
325 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
327 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
326
328
327 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
329 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
328 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
330 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
329 Moad for help with tracking it down.
331 Moad for help with tracking it down.
330
332
331 * IPython/iplib.py (handle_auto): fix autocall handling for
333 * IPython/iplib.py (handle_auto): fix autocall handling for
332 objects which support BOTH __getitem__ and __call__ (so that f [x]
334 objects which support BOTH __getitem__ and __call__ (so that f [x]
333 is left alone, instead of becoming f([x]) automatically).
335 is left alone, instead of becoming f([x]) automatically).
334
336
335 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
337 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
336 Ville's patch.
338 Ville's patch.
337
339
338 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
340 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
339
341
340 * IPython/iplib.py (handle_auto): changed autocall semantics to
342 * IPython/iplib.py (handle_auto): changed autocall semantics to
341 include 'smart' mode, where the autocall transformation is NOT
343 include 'smart' mode, where the autocall transformation is NOT
342 applied if there are no arguments on the line. This allows you to
344 applied if there are no arguments on the line. This allows you to
343 just type 'foo' if foo is a callable to see its internal form,
345 just type 'foo' if foo is a callable to see its internal form,
344 instead of having it called with no arguments (typically a
346 instead of having it called with no arguments (typically a
345 mistake). The old 'full' autocall still exists: for that, you
347 mistake). The old 'full' autocall still exists: for that, you
346 need to set the 'autocall' parameter to 2 in your ipythonrc file.
348 need to set the 'autocall' parameter to 2 in your ipythonrc file.
347
349
348 * IPython/completer.py (Completer.attr_matches): add
350 * IPython/completer.py (Completer.attr_matches): add
349 tab-completion support for Enthoughts' traits. After a report by
351 tab-completion support for Enthoughts' traits. After a report by
350 Arnd and a patch by Prabhu.
352 Arnd and a patch by Prabhu.
351
353
352 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
354 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
353
355
354 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
356 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
355 Schmolck's patch to fix inspect.getinnerframes().
357 Schmolck's patch to fix inspect.getinnerframes().
356
358
357 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
359 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
358 for embedded instances, regarding handling of namespaces and items
360 for embedded instances, regarding handling of namespaces and items
359 added to the __builtin__ one. Multiple embedded instances and
361 added to the __builtin__ one. Multiple embedded instances and
360 recursive embeddings should work better now (though I'm not sure
362 recursive embeddings should work better now (though I'm not sure
361 I've got all the corner cases fixed, that code is a bit of a brain
363 I've got all the corner cases fixed, that code is a bit of a brain
362 twister).
364 twister).
363
365
364 * IPython/Magic.py (magic_edit): added support to edit in-memory
366 * IPython/Magic.py (magic_edit): added support to edit in-memory
365 macros (automatically creates the necessary temp files). %edit
367 macros (automatically creates the necessary temp files). %edit
366 also doesn't return the file contents anymore, it's just noise.
368 also doesn't return the file contents anymore, it's just noise.
367
369
368 * IPython/completer.py (Completer.attr_matches): revert change to
370 * IPython/completer.py (Completer.attr_matches): revert change to
369 complete only on attributes listed in __all__. I realized it
371 complete only on attributes listed in __all__. I realized it
370 cripples the tab-completion system as a tool for exploring the
372 cripples the tab-completion system as a tool for exploring the
371 internals of unknown libraries (it renders any non-__all__
373 internals of unknown libraries (it renders any non-__all__
372 attribute off-limits). I got bit by this when trying to see
374 attribute off-limits). I got bit by this when trying to see
373 something inside the dis module.
375 something inside the dis module.
374
376
375 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
377 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
376
378
377 * IPython/iplib.py (InteractiveShell.__init__): add .meta
379 * IPython/iplib.py (InteractiveShell.__init__): add .meta
378 namespace for users and extension writers to hold data in. This
380 namespace for users and extension writers to hold data in. This
379 follows the discussion in
381 follows the discussion in
380 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
382 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
381
383
382 * IPython/completer.py (IPCompleter.complete): small patch to help
384 * IPython/completer.py (IPCompleter.complete): small patch to help
383 tab-completion under Emacs, after a suggestion by John Barnard
385 tab-completion under Emacs, after a suggestion by John Barnard
384 <barnarj-AT-ccf.org>.
386 <barnarj-AT-ccf.org>.
385
387
386 * IPython/Magic.py (Magic.extract_input_slices): added support for
388 * IPython/Magic.py (Magic.extract_input_slices): added support for
387 the slice notation in magics to use N-M to represent numbers N...M
389 the slice notation in magics to use N-M to represent numbers N...M
388 (closed endpoints). This is used by %macro and %save.
390 (closed endpoints). This is used by %macro and %save.
389
391
390 * IPython/completer.py (Completer.attr_matches): for modules which
392 * IPython/completer.py (Completer.attr_matches): for modules which
391 define __all__, complete only on those. After a patch by Jeffrey
393 define __all__, complete only on those. After a patch by Jeffrey
392 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
394 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
393 speed up this routine.
395 speed up this routine.
394
396
395 * IPython/Logger.py (Logger.log): fix a history handling bug. I
397 * IPython/Logger.py (Logger.log): fix a history handling bug. I
396 don't know if this is the end of it, but the behavior now is
398 don't know if this is the end of it, but the behavior now is
397 certainly much more correct. Note that coupled with macros,
399 certainly much more correct. Note that coupled with macros,
398 slightly surprising (at first) behavior may occur: a macro will in
400 slightly surprising (at first) behavior may occur: a macro will in
399 general expand to multiple lines of input, so upon exiting, the
401 general expand to multiple lines of input, so upon exiting, the
400 in/out counters will both be bumped by the corresponding amount
402 in/out counters will both be bumped by the corresponding amount
401 (as if the macro's contents had been typed interactively). Typing
403 (as if the macro's contents had been typed interactively). Typing
402 %hist will reveal the intermediate (silently processed) lines.
404 %hist will reveal the intermediate (silently processed) lines.
403
405
404 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
406 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
405 pickle to fail (%run was overwriting __main__ and not restoring
407 pickle to fail (%run was overwriting __main__ and not restoring
406 it, but pickle relies on __main__ to operate).
408 it, but pickle relies on __main__ to operate).
407
409
408 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
410 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
409 using properties, but forgot to make the main InteractiveShell
411 using properties, but forgot to make the main InteractiveShell
410 class a new-style class. Properties fail silently, and
412 class a new-style class. Properties fail silently, and
411 misteriously, with old-style class (getters work, but
413 misteriously, with old-style class (getters work, but
412 setters don't do anything).
414 setters don't do anything).
413
415
414 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
416 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
415
417
416 * IPython/Magic.py (magic_history): fix history reporting bug (I
418 * IPython/Magic.py (magic_history): fix history reporting bug (I
417 know some nasties are still there, I just can't seem to find a
419 know some nasties are still there, I just can't seem to find a
418 reproducible test case to track them down; the input history is
420 reproducible test case to track them down; the input history is
419 falling out of sync...)
421 falling out of sync...)
420
422
421 * IPython/iplib.py (handle_shell_escape): fix bug where both
423 * IPython/iplib.py (handle_shell_escape): fix bug where both
422 aliases and system accesses where broken for indented code (such
424 aliases and system accesses where broken for indented code (such
423 as loops).
425 as loops).
424
426
425 * IPython/genutils.py (shell): fix small but critical bug for
427 * IPython/genutils.py (shell): fix small but critical bug for
426 win32 system access.
428 win32 system access.
427
429
428 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
430 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
429
431
430 * IPython/iplib.py (showtraceback): remove use of the
432 * IPython/iplib.py (showtraceback): remove use of the
431 sys.last_{type/value/traceback} structures, which are non
433 sys.last_{type/value/traceback} structures, which are non
432 thread-safe.
434 thread-safe.
433 (_prefilter): change control flow to ensure that we NEVER
435 (_prefilter): change control flow to ensure that we NEVER
434 introspect objects when autocall is off. This will guarantee that
436 introspect objects when autocall is off. This will guarantee that
435 having an input line of the form 'x.y', where access to attribute
437 having an input line of the form 'x.y', where access to attribute
436 'y' has side effects, doesn't trigger the side effect TWICE. It
438 'y' has side effects, doesn't trigger the side effect TWICE. It
437 is important to note that, with autocall on, these side effects
439 is important to note that, with autocall on, these side effects
438 can still happen.
440 can still happen.
439 (ipsystem): new builtin, to complete the ip{magic/alias/system}
441 (ipsystem): new builtin, to complete the ip{magic/alias/system}
440 trio. IPython offers these three kinds of special calls which are
442 trio. IPython offers these three kinds of special calls which are
441 not python code, and it's a good thing to have their call method
443 not python code, and it's a good thing to have their call method
442 be accessible as pure python functions (not just special syntax at
444 be accessible as pure python functions (not just special syntax at
443 the command line). It gives us a better internal implementation
445 the command line). It gives us a better internal implementation
444 structure, as well as exposing these for user scripting more
446 structure, as well as exposing these for user scripting more
445 cleanly.
447 cleanly.
446
448
447 * IPython/macro.py (Macro.__init__): moved macros to a standalone
449 * IPython/macro.py (Macro.__init__): moved macros to a standalone
448 file. Now that they'll be more likely to be used with the
450 file. Now that they'll be more likely to be used with the
449 persistance system (%store), I want to make sure their module path
451 persistance system (%store), I want to make sure their module path
450 doesn't change in the future, so that we don't break things for
452 doesn't change in the future, so that we don't break things for
451 users' persisted data.
453 users' persisted data.
452
454
453 * IPython/iplib.py (autoindent_update): move indentation
455 * IPython/iplib.py (autoindent_update): move indentation
454 management into the _text_ processing loop, not the keyboard
456 management into the _text_ processing loop, not the keyboard
455 interactive one. This is necessary to correctly process non-typed
457 interactive one. This is necessary to correctly process non-typed
456 multiline input (such as macros).
458 multiline input (such as macros).
457
459
458 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
460 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
459 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
461 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
460 which was producing problems in the resulting manual.
462 which was producing problems in the resulting manual.
461 (magic_whos): improve reporting of instances (show their class,
463 (magic_whos): improve reporting of instances (show their class,
462 instead of simply printing 'instance' which isn't terribly
464 instead of simply printing 'instance' which isn't terribly
463 informative).
465 informative).
464
466
465 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
467 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
466 (minor mods) to support network shares under win32.
468 (minor mods) to support network shares under win32.
467
469
468 * IPython/winconsole.py (get_console_size): add new winconsole
470 * IPython/winconsole.py (get_console_size): add new winconsole
469 module and fixes to page_dumb() to improve its behavior under
471 module and fixes to page_dumb() to improve its behavior under
470 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
472 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
471
473
472 * IPython/Magic.py (Macro): simplified Macro class to just
474 * IPython/Magic.py (Macro): simplified Macro class to just
473 subclass list. We've had only 2.2 compatibility for a very long
475 subclass list. We've had only 2.2 compatibility for a very long
474 time, yet I was still avoiding subclassing the builtin types. No
476 time, yet I was still avoiding subclassing the builtin types. No
475 more (I'm also starting to use properties, though I won't shift to
477 more (I'm also starting to use properties, though I won't shift to
476 2.3-specific features quite yet).
478 2.3-specific features quite yet).
477 (magic_store): added Ville's patch for lightweight variable
479 (magic_store): added Ville's patch for lightweight variable
478 persistence, after a request on the user list by Matt Wilkie
480 persistence, after a request on the user list by Matt Wilkie
479 <maphew-AT-gmail.com>. The new %store magic's docstring has full
481 <maphew-AT-gmail.com>. The new %store magic's docstring has full
480 details.
482 details.
481
483
482 * IPython/iplib.py (InteractiveShell.post_config_initialization):
484 * IPython/iplib.py (InteractiveShell.post_config_initialization):
483 changed the default logfile name from 'ipython.log' to
485 changed the default logfile name from 'ipython.log' to
484 'ipython_log.py'. These logs are real python files, and now that
486 'ipython_log.py'. These logs are real python files, and now that
485 we have much better multiline support, people are more likely to
487 we have much better multiline support, people are more likely to
486 want to use them as such. Might as well name them correctly.
488 want to use them as such. Might as well name them correctly.
487
489
488 * IPython/Magic.py: substantial cleanup. While we can't stop
490 * IPython/Magic.py: substantial cleanup. While we can't stop
489 using magics as mixins, due to the existing customizations 'out
491 using magics as mixins, due to the existing customizations 'out
490 there' which rely on the mixin naming conventions, at least I
492 there' which rely on the mixin naming conventions, at least I
491 cleaned out all cross-class name usage. So once we are OK with
493 cleaned out all cross-class name usage. So once we are OK with
492 breaking compatibility, the two systems can be separated.
494 breaking compatibility, the two systems can be separated.
493
495
494 * IPython/Logger.py: major cleanup. This one is NOT a mixin
496 * IPython/Logger.py: major cleanup. This one is NOT a mixin
495 anymore, and the class is a fair bit less hideous as well. New
497 anymore, and the class is a fair bit less hideous as well. New
496 features were also introduced: timestamping of input, and logging
498 features were also introduced: timestamping of input, and logging
497 of output results. These are user-visible with the -t and -o
499 of output results. These are user-visible with the -t and -o
498 options to %logstart. Closes
500 options to %logstart. Closes
499 http://www.scipy.net/roundup/ipython/issue11 and a request by
501 http://www.scipy.net/roundup/ipython/issue11 and a request by
500 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
502 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
501
503
502 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
504 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
503
505
504 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
506 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
505 better hadnle backslashes in paths. See the thread 'More Windows
507 better hadnle backslashes in paths. See the thread 'More Windows
506 questions part 2 - \/ characters revisited' on the iypthon user
508 questions part 2 - \/ characters revisited' on the iypthon user
507 list:
509 list:
508 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
510 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
509
511
510 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
512 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
511
513
512 (InteractiveShell.__init__): change threaded shells to not use the
514 (InteractiveShell.__init__): change threaded shells to not use the
513 ipython crash handler. This was causing more problems than not,
515 ipython crash handler. This was causing more problems than not,
514 as exceptions in the main thread (GUI code, typically) would
516 as exceptions in the main thread (GUI code, typically) would
515 always show up as a 'crash', when they really weren't.
517 always show up as a 'crash', when they really weren't.
516
518
517 The colors and exception mode commands (%colors/%xmode) have been
519 The colors and exception mode commands (%colors/%xmode) have been
518 synchronized to also take this into account, so users can get
520 synchronized to also take this into account, so users can get
519 verbose exceptions for their threaded code as well. I also added
521 verbose exceptions for their threaded code as well. I also added
520 support for activating pdb inside this exception handler as well,
522 support for activating pdb inside this exception handler as well,
521 so now GUI authors can use IPython's enhanced pdb at runtime.
523 so now GUI authors can use IPython's enhanced pdb at runtime.
522
524
523 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
525 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
524 true by default, and add it to the shipped ipythonrc file. Since
526 true by default, and add it to the shipped ipythonrc file. Since
525 this asks the user before proceeding, I think it's OK to make it
527 this asks the user before proceeding, I think it's OK to make it
526 true by default.
528 true by default.
527
529
528 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
530 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
529 of the previous special-casing of input in the eval loop. I think
531 of the previous special-casing of input in the eval loop. I think
530 this is cleaner, as they really are commands and shouldn't have
532 this is cleaner, as they really are commands and shouldn't have
531 a special role in the middle of the core code.
533 a special role in the middle of the core code.
532
534
533 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
535 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
534
536
535 * IPython/iplib.py (edit_syntax_error): added support for
537 * IPython/iplib.py (edit_syntax_error): added support for
536 automatically reopening the editor if the file had a syntax error
538 automatically reopening the editor if the file had a syntax error
537 in it. Thanks to scottt who provided the patch at:
539 in it. Thanks to scottt who provided the patch at:
538 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
540 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
539 version committed).
541 version committed).
540
542
541 * IPython/iplib.py (handle_normal): add suport for multi-line
543 * IPython/iplib.py (handle_normal): add suport for multi-line
542 input with emtpy lines. This fixes
544 input with emtpy lines. This fixes
543 http://www.scipy.net/roundup/ipython/issue43 and a similar
545 http://www.scipy.net/roundup/ipython/issue43 and a similar
544 discussion on the user list.
546 discussion on the user list.
545
547
546 WARNING: a behavior change is necessarily introduced to support
548 WARNING: a behavior change is necessarily introduced to support
547 blank lines: now a single blank line with whitespace does NOT
549 blank lines: now a single blank line with whitespace does NOT
548 break the input loop, which means that when autoindent is on, by
550 break the input loop, which means that when autoindent is on, by
549 default hitting return on the next (indented) line does NOT exit.
551 default hitting return on the next (indented) line does NOT exit.
550
552
551 Instead, to exit a multiline input you can either have:
553 Instead, to exit a multiline input you can either have:
552
554
553 - TWO whitespace lines (just hit return again), or
555 - TWO whitespace lines (just hit return again), or
554 - a single whitespace line of a different length than provided
556 - a single whitespace line of a different length than provided
555 by the autoindent (add or remove a space).
557 by the autoindent (add or remove a space).
556
558
557 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
559 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
558 module to better organize all readline-related functionality.
560 module to better organize all readline-related functionality.
559 I've deleted FlexCompleter and put all completion clases here.
561 I've deleted FlexCompleter and put all completion clases here.
560
562
561 * IPython/iplib.py (raw_input): improve indentation management.
563 * IPython/iplib.py (raw_input): improve indentation management.
562 It is now possible to paste indented code with autoindent on, and
564 It is now possible to paste indented code with autoindent on, and
563 the code is interpreted correctly (though it still looks bad on
565 the code is interpreted correctly (though it still looks bad on
564 screen, due to the line-oriented nature of ipython).
566 screen, due to the line-oriented nature of ipython).
565 (MagicCompleter.complete): change behavior so that a TAB key on an
567 (MagicCompleter.complete): change behavior so that a TAB key on an
566 otherwise empty line actually inserts a tab, instead of completing
568 otherwise empty line actually inserts a tab, instead of completing
567 on the entire global namespace. This makes it easier to use the
569 on the entire global namespace. This makes it easier to use the
568 TAB key for indentation. After a request by Hans Meine
570 TAB key for indentation. After a request by Hans Meine
569 <hans_meine-AT-gmx.net>
571 <hans_meine-AT-gmx.net>
570 (_prefilter): add support so that typing plain 'exit' or 'quit'
572 (_prefilter): add support so that typing plain 'exit' or 'quit'
571 does a sensible thing. Originally I tried to deviate as little as
573 does a sensible thing. Originally I tried to deviate as little as
572 possible from the default python behavior, but even that one may
574 possible from the default python behavior, but even that one may
573 change in this direction (thread on python-dev to that effect).
575 change in this direction (thread on python-dev to that effect).
574 Regardless, ipython should do the right thing even if CPython's
576 Regardless, ipython should do the right thing even if CPython's
575 '>>>' prompt doesn't.
577 '>>>' prompt doesn't.
576 (InteractiveShell): removed subclassing code.InteractiveConsole
578 (InteractiveShell): removed subclassing code.InteractiveConsole
577 class. By now we'd overridden just about all of its methods: I've
579 class. By now we'd overridden just about all of its methods: I've
578 copied the remaining two over, and now ipython is a standalone
580 copied the remaining two over, and now ipython is a standalone
579 class. This will provide a clearer picture for the chainsaw
581 class. This will provide a clearer picture for the chainsaw
580 branch refactoring.
582 branch refactoring.
581
583
582 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
584 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
583
585
584 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
586 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
585 failures for objects which break when dir() is called on them.
587 failures for objects which break when dir() is called on them.
586
588
587 * IPython/FlexCompleter.py (Completer.__init__): Added support for
589 * IPython/FlexCompleter.py (Completer.__init__): Added support for
588 distinct local and global namespaces in the completer API. This
590 distinct local and global namespaces in the completer API. This
589 change allows us top properly handle completion with distinct
591 change allows us top properly handle completion with distinct
590 scopes, including in embedded instances (this had never really
592 scopes, including in embedded instances (this had never really
591 worked correctly).
593 worked correctly).
592
594
593 Note: this introduces a change in the constructor for
595 Note: this introduces a change in the constructor for
594 MagicCompleter, as a new global_namespace parameter is now the
596 MagicCompleter, as a new global_namespace parameter is now the
595 second argument (the others were bumped one position).
597 second argument (the others were bumped one position).
596
598
597 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
599 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
598
600
599 * IPython/iplib.py (embed_mainloop): fix tab-completion in
601 * IPython/iplib.py (embed_mainloop): fix tab-completion in
600 embedded instances (which can be done now thanks to Vivian's
602 embedded instances (which can be done now thanks to Vivian's
601 frame-handling fixes for pdb).
603 frame-handling fixes for pdb).
602 (InteractiveShell.__init__): Fix namespace handling problem in
604 (InteractiveShell.__init__): Fix namespace handling problem in
603 embedded instances. We were overwriting __main__ unconditionally,
605 embedded instances. We were overwriting __main__ unconditionally,
604 and this should only be done for 'full' (non-embedded) IPython;
606 and this should only be done for 'full' (non-embedded) IPython;
605 embedded instances must respect the caller's __main__. Thanks to
607 embedded instances must respect the caller's __main__. Thanks to
606 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
608 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
607
609
608 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
610 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
609
611
610 * setup.py: added download_url to setup(). This registers the
612 * setup.py: added download_url to setup(). This registers the
611 download address at PyPI, which is not only useful to humans
613 download address at PyPI, which is not only useful to humans
612 browsing the site, but is also picked up by setuptools (the Eggs
614 browsing the site, but is also picked up by setuptools (the Eggs
613 machinery). Thanks to Ville and R. Kern for the info/discussion
615 machinery). Thanks to Ville and R. Kern for the info/discussion
614 on this.
616 on this.
615
617
616 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
618 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
617
619
618 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
620 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
619 This brings a lot of nice functionality to the pdb mode, which now
621 This brings a lot of nice functionality to the pdb mode, which now
620 has tab-completion, syntax highlighting, and better stack handling
622 has tab-completion, syntax highlighting, and better stack handling
621 than before. Many thanks to Vivian De Smedt
623 than before. Many thanks to Vivian De Smedt
622 <vivian-AT-vdesmedt.com> for the original patches.
624 <vivian-AT-vdesmedt.com> for the original patches.
623
625
624 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
626 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
625
627
626 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
628 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
627 sequence to consistently accept the banner argument. The
629 sequence to consistently accept the banner argument. The
628 inconsistency was tripping SAGE, thanks to Gary Zablackis
630 inconsistency was tripping SAGE, thanks to Gary Zablackis
629 <gzabl-AT-yahoo.com> for the report.
631 <gzabl-AT-yahoo.com> for the report.
630
632
631 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
633 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
632
634
633 * IPython/iplib.py (InteractiveShell.post_config_initialization):
635 * IPython/iplib.py (InteractiveShell.post_config_initialization):
634 Fix bug where a naked 'alias' call in the ipythonrc file would
636 Fix bug where a naked 'alias' call in the ipythonrc file would
635 cause a crash. Bug reported by Jorgen Stenarson.
637 cause a crash. Bug reported by Jorgen Stenarson.
636
638
637 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
639 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
638
640
639 * IPython/ipmaker.py (make_IPython): cleanups which should improve
641 * IPython/ipmaker.py (make_IPython): cleanups which should improve
640 startup time.
642 startup time.
641
643
642 * IPython/iplib.py (runcode): my globals 'fix' for embedded
644 * IPython/iplib.py (runcode): my globals 'fix' for embedded
643 instances had introduced a bug with globals in normal code. Now
645 instances had introduced a bug with globals in normal code. Now
644 it's working in all cases.
646 it's working in all cases.
645
647
646 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
648 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
647 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
649 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
648 has been introduced to set the default case sensitivity of the
650 has been introduced to set the default case sensitivity of the
649 searches. Users can still select either mode at runtime on a
651 searches. Users can still select either mode at runtime on a
650 per-search basis.
652 per-search basis.
651
653
652 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
654 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
653
655
654 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
656 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
655 attributes in wildcard searches for subclasses. Modified version
657 attributes in wildcard searches for subclasses. Modified version
656 of a patch by Jorgen.
658 of a patch by Jorgen.
657
659
658 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
660 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
659
661
660 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
662 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
661 embedded instances. I added a user_global_ns attribute to the
663 embedded instances. I added a user_global_ns attribute to the
662 InteractiveShell class to handle this.
664 InteractiveShell class to handle this.
663
665
664 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
666 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
665
667
666 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
668 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
667 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
669 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
668 (reported under win32, but may happen also in other platforms).
670 (reported under win32, but may happen also in other platforms).
669 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
671 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
670
672
671 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
673 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
672
674
673 * IPython/Magic.py (magic_psearch): new support for wildcard
675 * IPython/Magic.py (magic_psearch): new support for wildcard
674 patterns. Now, typing ?a*b will list all names which begin with a
676 patterns. Now, typing ?a*b will list all names which begin with a
675 and end in b, for example. The %psearch magic has full
677 and end in b, for example. The %psearch magic has full
676 docstrings. Many thanks to JΓΆrgen Stenarson
678 docstrings. Many thanks to JΓΆrgen Stenarson
677 <jorgen.stenarson-AT-bostream.nu>, author of the patches
679 <jorgen.stenarson-AT-bostream.nu>, author of the patches
678 implementing this functionality.
680 implementing this functionality.
679
681
680 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
682 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
681
683
682 * Manual: fixed long-standing annoyance of double-dashes (as in
684 * Manual: fixed long-standing annoyance of double-dashes (as in
683 --prefix=~, for example) being stripped in the HTML version. This
685 --prefix=~, for example) being stripped in the HTML version. This
684 is a latex2html bug, but a workaround was provided. Many thanks
686 is a latex2html bug, but a workaround was provided. Many thanks
685 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
687 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
686 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
688 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
687 rolling. This seemingly small issue had tripped a number of users
689 rolling. This seemingly small issue had tripped a number of users
688 when first installing, so I'm glad to see it gone.
690 when first installing, so I'm glad to see it gone.
689
691
690 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
692 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
691
693
692 * IPython/Extensions/numeric_formats.py: fix missing import,
694 * IPython/Extensions/numeric_formats.py: fix missing import,
693 reported by Stephen Walton.
695 reported by Stephen Walton.
694
696
695 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
697 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
696
698
697 * IPython/demo.py: finish demo module, fully documented now.
699 * IPython/demo.py: finish demo module, fully documented now.
698
700
699 * IPython/genutils.py (file_read): simple little utility to read a
701 * IPython/genutils.py (file_read): simple little utility to read a
700 file and ensure it's closed afterwards.
702 file and ensure it's closed afterwards.
701
703
702 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
704 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
703
705
704 * IPython/demo.py (Demo.__init__): added support for individually
706 * IPython/demo.py (Demo.__init__): added support for individually
705 tagging blocks for automatic execution.
707 tagging blocks for automatic execution.
706
708
707 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
709 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
708 syntax-highlighted python sources, requested by John.
710 syntax-highlighted python sources, requested by John.
709
711
710 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
712 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
711
713
712 * IPython/demo.py (Demo.again): fix bug where again() blocks after
714 * IPython/demo.py (Demo.again): fix bug where again() blocks after
713 finishing.
715 finishing.
714
716
715 * IPython/genutils.py (shlex_split): moved from Magic to here,
717 * IPython/genutils.py (shlex_split): moved from Magic to here,
716 where all 2.2 compatibility stuff lives. I needed it for demo.py.
718 where all 2.2 compatibility stuff lives. I needed it for demo.py.
717
719
718 * IPython/demo.py (Demo.__init__): added support for silent
720 * IPython/demo.py (Demo.__init__): added support for silent
719 blocks, improved marks as regexps, docstrings written.
721 blocks, improved marks as regexps, docstrings written.
720 (Demo.__init__): better docstring, added support for sys.argv.
722 (Demo.__init__): better docstring, added support for sys.argv.
721
723
722 * IPython/genutils.py (marquee): little utility used by the demo
724 * IPython/genutils.py (marquee): little utility used by the demo
723 code, handy in general.
725 code, handy in general.
724
726
725 * IPython/demo.py (Demo.__init__): new class for interactive
727 * IPython/demo.py (Demo.__init__): new class for interactive
726 demos. Not documented yet, I just wrote it in a hurry for
728 demos. Not documented yet, I just wrote it in a hurry for
727 scipy'05. Will docstring later.
729 scipy'05. Will docstring later.
728
730
729 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
731 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
730
732
731 * IPython/Shell.py (sigint_handler): Drastic simplification which
733 * IPython/Shell.py (sigint_handler): Drastic simplification which
732 also seems to make Ctrl-C work correctly across threads! This is
734 also seems to make Ctrl-C work correctly across threads! This is
733 so simple, that I can't beleive I'd missed it before. Needs more
735 so simple, that I can't beleive I'd missed it before. Needs more
734 testing, though.
736 testing, though.
735 (KBINT): Never mind, revert changes. I'm sure I'd tried something
737 (KBINT): Never mind, revert changes. I'm sure I'd tried something
736 like this before...
738 like this before...
737
739
738 * IPython/genutils.py (get_home_dir): add protection against
740 * IPython/genutils.py (get_home_dir): add protection against
739 non-dirs in win32 registry.
741 non-dirs in win32 registry.
740
742
741 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
743 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
742 bug where dict was mutated while iterating (pysh crash).
744 bug where dict was mutated while iterating (pysh crash).
743
745
744 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
746 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
745
747
746 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
748 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
747 spurious newlines added by this routine. After a report by
749 spurious newlines added by this routine. After a report by
748 F. Mantegazza.
750 F. Mantegazza.
749
751
750 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
752 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
751
753
752 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
754 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
753 calls. These were a leftover from the GTK 1.x days, and can cause
755 calls. These were a leftover from the GTK 1.x days, and can cause
754 problems in certain cases (after a report by John Hunter).
756 problems in certain cases (after a report by John Hunter).
755
757
756 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
758 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
757 os.getcwd() fails at init time. Thanks to patch from David Remahl
759 os.getcwd() fails at init time. Thanks to patch from David Remahl
758 <chmod007-AT-mac.com>.
760 <chmod007-AT-mac.com>.
759 (InteractiveShell.__init__): prevent certain special magics from
761 (InteractiveShell.__init__): prevent certain special magics from
760 being shadowed by aliases. Closes
762 being shadowed by aliases. Closes
761 http://www.scipy.net/roundup/ipython/issue41.
763 http://www.scipy.net/roundup/ipython/issue41.
762
764
763 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
765 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
764
766
765 * IPython/iplib.py (InteractiveShell.complete): Added new
767 * IPython/iplib.py (InteractiveShell.complete): Added new
766 top-level completion method to expose the completion mechanism
768 top-level completion method to expose the completion mechanism
767 beyond readline-based environments.
769 beyond readline-based environments.
768
770
769 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
771 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
770
772
771 * tools/ipsvnc (svnversion): fix svnversion capture.
773 * tools/ipsvnc (svnversion): fix svnversion capture.
772
774
773 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
775 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
774 attribute to self, which was missing. Before, it was set by a
776 attribute to self, which was missing. Before, it was set by a
775 routine which in certain cases wasn't being called, so the
777 routine which in certain cases wasn't being called, so the
776 instance could end up missing the attribute. This caused a crash.
778 instance could end up missing the attribute. This caused a crash.
777 Closes http://www.scipy.net/roundup/ipython/issue40.
779 Closes http://www.scipy.net/roundup/ipython/issue40.
778
780
779 2005-08-16 Fernando Perez <fperez@colorado.edu>
781 2005-08-16 Fernando Perez <fperez@colorado.edu>
780
782
781 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
783 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
782 contains non-string attribute. Closes
784 contains non-string attribute. Closes
783 http://www.scipy.net/roundup/ipython/issue38.
785 http://www.scipy.net/roundup/ipython/issue38.
784
786
785 2005-08-14 Fernando Perez <fperez@colorado.edu>
787 2005-08-14 Fernando Perez <fperez@colorado.edu>
786
788
787 * tools/ipsvnc: Minor improvements, to add changeset info.
789 * tools/ipsvnc: Minor improvements, to add changeset info.
788
790
789 2005-08-12 Fernando Perez <fperez@colorado.edu>
791 2005-08-12 Fernando Perez <fperez@colorado.edu>
790
792
791 * IPython/iplib.py (runsource): remove self.code_to_run_src
793 * IPython/iplib.py (runsource): remove self.code_to_run_src
792 attribute. I realized this is nothing more than
794 attribute. I realized this is nothing more than
793 '\n'.join(self.buffer), and having the same data in two different
795 '\n'.join(self.buffer), and having the same data in two different
794 places is just asking for synchronization bugs. This may impact
796 places is just asking for synchronization bugs. This may impact
795 people who have custom exception handlers, so I need to warn
797 people who have custom exception handlers, so I need to warn
796 ipython-dev about it (F. Mantegazza may use them).
798 ipython-dev about it (F. Mantegazza may use them).
797
799
798 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
800 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
799
801
800 * IPython/genutils.py: fix 2.2 compatibility (generators)
802 * IPython/genutils.py: fix 2.2 compatibility (generators)
801
803
802 2005-07-18 Fernando Perez <fperez@colorado.edu>
804 2005-07-18 Fernando Perez <fperez@colorado.edu>
803
805
804 * IPython/genutils.py (get_home_dir): fix to help users with
806 * IPython/genutils.py (get_home_dir): fix to help users with
805 invalid $HOME under win32.
807 invalid $HOME under win32.
806
808
807 2005-07-17 Fernando Perez <fperez@colorado.edu>
809 2005-07-17 Fernando Perez <fperez@colorado.edu>
808
810
809 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
811 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
810 some old hacks and clean up a bit other routines; code should be
812 some old hacks and clean up a bit other routines; code should be
811 simpler and a bit faster.
813 simpler and a bit faster.
812
814
813 * IPython/iplib.py (interact): removed some last-resort attempts
815 * IPython/iplib.py (interact): removed some last-resort attempts
814 to survive broken stdout/stderr. That code was only making it
816 to survive broken stdout/stderr. That code was only making it
815 harder to abstract out the i/o (necessary for gui integration),
817 harder to abstract out the i/o (necessary for gui integration),
816 and the crashes it could prevent were extremely rare in practice
818 and the crashes it could prevent were extremely rare in practice
817 (besides being fully user-induced in a pretty violent manner).
819 (besides being fully user-induced in a pretty violent manner).
818
820
819 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
821 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
820 Nothing major yet, but the code is simpler to read; this should
822 Nothing major yet, but the code is simpler to read; this should
821 make it easier to do more serious modifications in the future.
823 make it easier to do more serious modifications in the future.
822
824
823 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
825 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
824 which broke in .15 (thanks to a report by Ville).
826 which broke in .15 (thanks to a report by Ville).
825
827
826 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
828 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
827 be quite correct, I know next to nothing about unicode). This
829 be quite correct, I know next to nothing about unicode). This
828 will allow unicode strings to be used in prompts, amongst other
830 will allow unicode strings to be used in prompts, amongst other
829 cases. It also will prevent ipython from crashing when unicode
831 cases. It also will prevent ipython from crashing when unicode
830 shows up unexpectedly in many places. If ascii encoding fails, we
832 shows up unexpectedly in many places. If ascii encoding fails, we
831 assume utf_8. Currently the encoding is not a user-visible
833 assume utf_8. Currently the encoding is not a user-visible
832 setting, though it could be made so if there is demand for it.
834 setting, though it could be made so if there is demand for it.
833
835
834 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
836 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
835
837
836 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
838 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
837
839
838 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
840 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
839
841
840 * IPython/genutils.py: Add 2.2 compatibility here, so all other
842 * IPython/genutils.py: Add 2.2 compatibility here, so all other
841 code can work transparently for 2.2/2.3.
843 code can work transparently for 2.2/2.3.
842
844
843 2005-07-16 Fernando Perez <fperez@colorado.edu>
845 2005-07-16 Fernando Perez <fperez@colorado.edu>
844
846
845 * IPython/ultraTB.py (ExceptionColors): Make a global variable
847 * IPython/ultraTB.py (ExceptionColors): Make a global variable
846 out of the color scheme table used for coloring exception
848 out of the color scheme table used for coloring exception
847 tracebacks. This allows user code to add new schemes at runtime.
849 tracebacks. This allows user code to add new schemes at runtime.
848 This is a minimally modified version of the patch at
850 This is a minimally modified version of the patch at
849 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
851 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
850 for the contribution.
852 for the contribution.
851
853
852 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
854 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
853 slightly modified version of the patch in
855 slightly modified version of the patch in
854 http://www.scipy.net/roundup/ipython/issue34, which also allows me
856 http://www.scipy.net/roundup/ipython/issue34, which also allows me
855 to remove the previous try/except solution (which was costlier).
857 to remove the previous try/except solution (which was costlier).
856 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
858 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
857
859
858 2005-06-08 Fernando Perez <fperez@colorado.edu>
860 2005-06-08 Fernando Perez <fperez@colorado.edu>
859
861
860 * IPython/iplib.py (write/write_err): Add methods to abstract all
862 * IPython/iplib.py (write/write_err): Add methods to abstract all
861 I/O a bit more.
863 I/O a bit more.
862
864
863 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
865 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
864 warning, reported by Aric Hagberg, fix by JD Hunter.
866 warning, reported by Aric Hagberg, fix by JD Hunter.
865
867
866 2005-06-02 *** Released version 0.6.15
868 2005-06-02 *** Released version 0.6.15
867
869
868 2005-06-01 Fernando Perez <fperez@colorado.edu>
870 2005-06-01 Fernando Perez <fperez@colorado.edu>
869
871
870 * IPython/iplib.py (MagicCompleter.file_matches): Fix
872 * IPython/iplib.py (MagicCompleter.file_matches): Fix
871 tab-completion of filenames within open-quoted strings. Note that
873 tab-completion of filenames within open-quoted strings. Note that
872 this requires that in ~/.ipython/ipythonrc, users change the
874 this requires that in ~/.ipython/ipythonrc, users change the
873 readline delimiters configuration to read:
875 readline delimiters configuration to read:
874
876
875 readline_remove_delims -/~
877 readline_remove_delims -/~
876
878
877
879
878 2005-05-31 *** Released version 0.6.14
880 2005-05-31 *** Released version 0.6.14
879
881
880 2005-05-29 Fernando Perez <fperez@colorado.edu>
882 2005-05-29 Fernando Perez <fperez@colorado.edu>
881
883
882 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
884 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
883 with files not on the filesystem. Reported by Eliyahu Sandler
885 with files not on the filesystem. Reported by Eliyahu Sandler
884 <eli@gondolin.net>
886 <eli@gondolin.net>
885
887
886 2005-05-22 Fernando Perez <fperez@colorado.edu>
888 2005-05-22 Fernando Perez <fperez@colorado.edu>
887
889
888 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
890 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
889 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
891 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
890
892
891 2005-05-19 Fernando Perez <fperez@colorado.edu>
893 2005-05-19 Fernando Perez <fperez@colorado.edu>
892
894
893 * IPython/iplib.py (safe_execfile): close a file which could be
895 * IPython/iplib.py (safe_execfile): close a file which could be
894 left open (causing problems in win32, which locks open files).
896 left open (causing problems in win32, which locks open files).
895 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
897 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
896
898
897 2005-05-18 Fernando Perez <fperez@colorado.edu>
899 2005-05-18 Fernando Perez <fperez@colorado.edu>
898
900
899 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
901 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
900 keyword arguments correctly to safe_execfile().
902 keyword arguments correctly to safe_execfile().
901
903
902 2005-05-13 Fernando Perez <fperez@colorado.edu>
904 2005-05-13 Fernando Perez <fperez@colorado.edu>
903
905
904 * ipython.1: Added info about Qt to manpage, and threads warning
906 * ipython.1: Added info about Qt to manpage, and threads warning
905 to usage page (invoked with --help).
907 to usage page (invoked with --help).
906
908
907 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
909 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
908 new matcher (it goes at the end of the priority list) to do
910 new matcher (it goes at the end of the priority list) to do
909 tab-completion on named function arguments. Submitted by George
911 tab-completion on named function arguments. Submitted by George
910 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
912 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
911 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
913 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
912 for more details.
914 for more details.
913
915
914 * IPython/Magic.py (magic_run): Added new -e flag to ignore
916 * IPython/Magic.py (magic_run): Added new -e flag to ignore
915 SystemExit exceptions in the script being run. Thanks to a report
917 SystemExit exceptions in the script being run. Thanks to a report
916 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
918 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
917 producing very annoying behavior when running unit tests.
919 producing very annoying behavior when running unit tests.
918
920
919 2005-05-12 Fernando Perez <fperez@colorado.edu>
921 2005-05-12 Fernando Perez <fperez@colorado.edu>
920
922
921 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
923 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
922 which I'd broken (again) due to a changed regexp. In the process,
924 which I'd broken (again) due to a changed regexp. In the process,
923 added ';' as an escape to auto-quote the whole line without
925 added ';' as an escape to auto-quote the whole line without
924 splitting its arguments. Thanks to a report by Jerry McRae
926 splitting its arguments. Thanks to a report by Jerry McRae
925 <qrs0xyc02-AT-sneakemail.com>.
927 <qrs0xyc02-AT-sneakemail.com>.
926
928
927 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
929 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
928 possible crashes caused by a TokenError. Reported by Ed Schofield
930 possible crashes caused by a TokenError. Reported by Ed Schofield
929 <schofield-AT-ftw.at>.
931 <schofield-AT-ftw.at>.
930
932
931 2005-05-06 Fernando Perez <fperez@colorado.edu>
933 2005-05-06 Fernando Perez <fperez@colorado.edu>
932
934
933 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
935 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
934
936
935 2005-04-29 Fernando Perez <fperez@colorado.edu>
937 2005-04-29 Fernando Perez <fperez@colorado.edu>
936
938
937 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
939 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
938 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
940 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
939 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
941 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
940 which provides support for Qt interactive usage (similar to the
942 which provides support for Qt interactive usage (similar to the
941 existing one for WX and GTK). This had been often requested.
943 existing one for WX and GTK). This had been often requested.
942
944
943 2005-04-14 *** Released version 0.6.13
945 2005-04-14 *** Released version 0.6.13
944
946
945 2005-04-08 Fernando Perez <fperez@colorado.edu>
947 2005-04-08 Fernando Perez <fperez@colorado.edu>
946
948
947 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
949 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
948 from _ofind, which gets called on almost every input line. Now,
950 from _ofind, which gets called on almost every input line. Now,
949 we only try to get docstrings if they are actually going to be
951 we only try to get docstrings if they are actually going to be
950 used (the overhead of fetching unnecessary docstrings can be
952 used (the overhead of fetching unnecessary docstrings can be
951 noticeable for certain objects, such as Pyro proxies).
953 noticeable for certain objects, such as Pyro proxies).
952
954
953 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
955 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
954 for completers. For some reason I had been passing them the state
956 for completers. For some reason I had been passing them the state
955 variable, which completers never actually need, and was in
957 variable, which completers never actually need, and was in
956 conflict with the rlcompleter API. Custom completers ONLY need to
958 conflict with the rlcompleter API. Custom completers ONLY need to
957 take the text parameter.
959 take the text parameter.
958
960
959 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
961 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
960 work correctly in pysh. I've also moved all the logic which used
962 work correctly in pysh. I've also moved all the logic which used
961 to be in pysh.py here, which will prevent problems with future
963 to be in pysh.py here, which will prevent problems with future
962 upgrades. However, this time I must warn users to update their
964 upgrades. However, this time I must warn users to update their
963 pysh profile to include the line
965 pysh profile to include the line
964
966
965 import_all IPython.Extensions.InterpreterExec
967 import_all IPython.Extensions.InterpreterExec
966
968
967 because otherwise things won't work for them. They MUST also
969 because otherwise things won't work for them. They MUST also
968 delete pysh.py and the line
970 delete pysh.py and the line
969
971
970 execfile pysh.py
972 execfile pysh.py
971
973
972 from their ipythonrc-pysh.
974 from their ipythonrc-pysh.
973
975
974 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
976 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
975 robust in the face of objects whose dir() returns non-strings
977 robust in the face of objects whose dir() returns non-strings
976 (which it shouldn't, but some broken libs like ITK do). Thanks to
978 (which it shouldn't, but some broken libs like ITK do). Thanks to
977 a patch by John Hunter (implemented differently, though). Also
979 a patch by John Hunter (implemented differently, though). Also
978 minor improvements by using .extend instead of + on lists.
980 minor improvements by using .extend instead of + on lists.
979
981
980 * pysh.py:
982 * pysh.py:
981
983
982 2005-04-06 Fernando Perez <fperez@colorado.edu>
984 2005-04-06 Fernando Perez <fperez@colorado.edu>
983
985
984 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
986 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
985 by default, so that all users benefit from it. Those who don't
987 by default, so that all users benefit from it. Those who don't
986 want it can still turn it off.
988 want it can still turn it off.
987
989
988 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
990 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
989 config file, I'd forgotten about this, so users were getting it
991 config file, I'd forgotten about this, so users were getting it
990 off by default.
992 off by default.
991
993
992 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
994 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
993 consistency. Now magics can be called in multiline statements,
995 consistency. Now magics can be called in multiline statements,
994 and python variables can be expanded in magic calls via $var.
996 and python variables can be expanded in magic calls via $var.
995 This makes the magic system behave just like aliases or !system
997 This makes the magic system behave just like aliases or !system
996 calls.
998 calls.
997
999
998 2005-03-28 Fernando Perez <fperez@colorado.edu>
1000 2005-03-28 Fernando Perez <fperez@colorado.edu>
999
1001
1000 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1002 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1001 expensive string additions for building command. Add support for
1003 expensive string additions for building command. Add support for
1002 trailing ';' when autocall is used.
1004 trailing ';' when autocall is used.
1003
1005
1004 2005-03-26 Fernando Perez <fperez@colorado.edu>
1006 2005-03-26 Fernando Perez <fperez@colorado.edu>
1005
1007
1006 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1008 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1007 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1009 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1008 ipython.el robust against prompts with any number of spaces
1010 ipython.el robust against prompts with any number of spaces
1009 (including 0) after the ':' character.
1011 (including 0) after the ':' character.
1010
1012
1011 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1013 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1012 continuation prompt, which misled users to think the line was
1014 continuation prompt, which misled users to think the line was
1013 already indented. Closes debian Bug#300847, reported to me by
1015 already indented. Closes debian Bug#300847, reported to me by
1014 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1016 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1015
1017
1016 2005-03-23 Fernando Perez <fperez@colorado.edu>
1018 2005-03-23 Fernando Perez <fperez@colorado.edu>
1017
1019
1018 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1020 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1019 properly aligned if they have embedded newlines.
1021 properly aligned if they have embedded newlines.
1020
1022
1021 * IPython/iplib.py (runlines): Add a public method to expose
1023 * IPython/iplib.py (runlines): Add a public method to expose
1022 IPython's code execution machinery, so that users can run strings
1024 IPython's code execution machinery, so that users can run strings
1023 as if they had been typed at the prompt interactively.
1025 as if they had been typed at the prompt interactively.
1024 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1026 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1025 methods which can call the system shell, but with python variable
1027 methods which can call the system shell, but with python variable
1026 expansion. The three such methods are: __IPYTHON__.system,
1028 expansion. The three such methods are: __IPYTHON__.system,
1027 .getoutput and .getoutputerror. These need to be documented in a
1029 .getoutput and .getoutputerror. These need to be documented in a
1028 'public API' section (to be written) of the manual.
1030 'public API' section (to be written) of the manual.
1029
1031
1030 2005-03-20 Fernando Perez <fperez@colorado.edu>
1032 2005-03-20 Fernando Perez <fperez@colorado.edu>
1031
1033
1032 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1034 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1033 for custom exception handling. This is quite powerful, and it
1035 for custom exception handling. This is quite powerful, and it
1034 allows for user-installable exception handlers which can trap
1036 allows for user-installable exception handlers which can trap
1035 custom exceptions at runtime and treat them separately from
1037 custom exceptions at runtime and treat them separately from
1036 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1038 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1037 Mantegazza <mantegazza-AT-ill.fr>.
1039 Mantegazza <mantegazza-AT-ill.fr>.
1038 (InteractiveShell.set_custom_completer): public API function to
1040 (InteractiveShell.set_custom_completer): public API function to
1039 add new completers at runtime.
1041 add new completers at runtime.
1040
1042
1041 2005-03-19 Fernando Perez <fperez@colorado.edu>
1043 2005-03-19 Fernando Perez <fperez@colorado.edu>
1042
1044
1043 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1045 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1044 allow objects which provide their docstrings via non-standard
1046 allow objects which provide their docstrings via non-standard
1045 mechanisms (like Pyro proxies) to still be inspected by ipython's
1047 mechanisms (like Pyro proxies) to still be inspected by ipython's
1046 ? system.
1048 ? system.
1047
1049
1048 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1050 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1049 automatic capture system. I tried quite hard to make it work
1051 automatic capture system. I tried quite hard to make it work
1050 reliably, and simply failed. I tried many combinations with the
1052 reliably, and simply failed. I tried many combinations with the
1051 subprocess module, but eventually nothing worked in all needed
1053 subprocess module, but eventually nothing worked in all needed
1052 cases (not blocking stdin for the child, duplicating stdout
1054 cases (not blocking stdin for the child, duplicating stdout
1053 without blocking, etc). The new %sc/%sx still do capture to these
1055 without blocking, etc). The new %sc/%sx still do capture to these
1054 magical list/string objects which make shell use much more
1056 magical list/string objects which make shell use much more
1055 conveninent, so not all is lost.
1057 conveninent, so not all is lost.
1056
1058
1057 XXX - FIX MANUAL for the change above!
1059 XXX - FIX MANUAL for the change above!
1058
1060
1059 (runsource): I copied code.py's runsource() into ipython to modify
1061 (runsource): I copied code.py's runsource() into ipython to modify
1060 it a bit. Now the code object and source to be executed are
1062 it a bit. Now the code object and source to be executed are
1061 stored in ipython. This makes this info accessible to third-party
1063 stored in ipython. This makes this info accessible to third-party
1062 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1064 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1063 Mantegazza <mantegazza-AT-ill.fr>.
1065 Mantegazza <mantegazza-AT-ill.fr>.
1064
1066
1065 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1067 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1066 history-search via readline (like C-p/C-n). I'd wanted this for a
1068 history-search via readline (like C-p/C-n). I'd wanted this for a
1067 long time, but only recently found out how to do it. For users
1069 long time, but only recently found out how to do it. For users
1068 who already have their ipythonrc files made and want this, just
1070 who already have their ipythonrc files made and want this, just
1069 add:
1071 add:
1070
1072
1071 readline_parse_and_bind "\e[A": history-search-backward
1073 readline_parse_and_bind "\e[A": history-search-backward
1072 readline_parse_and_bind "\e[B": history-search-forward
1074 readline_parse_and_bind "\e[B": history-search-forward
1073
1075
1074 2005-03-18 Fernando Perez <fperez@colorado.edu>
1076 2005-03-18 Fernando Perez <fperez@colorado.edu>
1075
1077
1076 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1078 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1077 LSString and SList classes which allow transparent conversions
1079 LSString and SList classes which allow transparent conversions
1078 between list mode and whitespace-separated string.
1080 between list mode and whitespace-separated string.
1079 (magic_r): Fix recursion problem in %r.
1081 (magic_r): Fix recursion problem in %r.
1080
1082
1081 * IPython/genutils.py (LSString): New class to be used for
1083 * IPython/genutils.py (LSString): New class to be used for
1082 automatic storage of the results of all alias/system calls in _o
1084 automatic storage of the results of all alias/system calls in _o
1083 and _e (stdout/err). These provide a .l/.list attribute which
1085 and _e (stdout/err). These provide a .l/.list attribute which
1084 does automatic splitting on newlines. This means that for most
1086 does automatic splitting on newlines. This means that for most
1085 uses, you'll never need to do capturing of output with %sc/%sx
1087 uses, you'll never need to do capturing of output with %sc/%sx
1086 anymore, since ipython keeps this always done for you. Note that
1088 anymore, since ipython keeps this always done for you. Note that
1087 only the LAST results are stored, the _o/e variables are
1089 only the LAST results are stored, the _o/e variables are
1088 overwritten on each call. If you need to save their contents
1090 overwritten on each call. If you need to save their contents
1089 further, simply bind them to any other name.
1091 further, simply bind them to any other name.
1090
1092
1091 2005-03-17 Fernando Perez <fperez@colorado.edu>
1093 2005-03-17 Fernando Perez <fperez@colorado.edu>
1092
1094
1093 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1095 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1094 prompt namespace handling.
1096 prompt namespace handling.
1095
1097
1096 2005-03-16 Fernando Perez <fperez@colorado.edu>
1098 2005-03-16 Fernando Perez <fperez@colorado.edu>
1097
1099
1098 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1100 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1099 classic prompts to be '>>> ' (final space was missing, and it
1101 classic prompts to be '>>> ' (final space was missing, and it
1100 trips the emacs python mode).
1102 trips the emacs python mode).
1101 (BasePrompt.__str__): Added safe support for dynamic prompt
1103 (BasePrompt.__str__): Added safe support for dynamic prompt
1102 strings. Now you can set your prompt string to be '$x', and the
1104 strings. Now you can set your prompt string to be '$x', and the
1103 value of x will be printed from your interactive namespace. The
1105 value of x will be printed from your interactive namespace. The
1104 interpolation syntax includes the full Itpl support, so
1106 interpolation syntax includes the full Itpl support, so
1105 ${foo()+x+bar()} is a valid prompt string now, and the function
1107 ${foo()+x+bar()} is a valid prompt string now, and the function
1106 calls will be made at runtime.
1108 calls will be made at runtime.
1107
1109
1108 2005-03-15 Fernando Perez <fperez@colorado.edu>
1110 2005-03-15 Fernando Perez <fperez@colorado.edu>
1109
1111
1110 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1112 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1111 avoid name clashes in pylab. %hist still works, it just forwards
1113 avoid name clashes in pylab. %hist still works, it just forwards
1112 the call to %history.
1114 the call to %history.
1113
1115
1114 2005-03-02 *** Released version 0.6.12
1116 2005-03-02 *** Released version 0.6.12
1115
1117
1116 2005-03-02 Fernando Perez <fperez@colorado.edu>
1118 2005-03-02 Fernando Perez <fperez@colorado.edu>
1117
1119
1118 * IPython/iplib.py (handle_magic): log magic calls properly as
1120 * IPython/iplib.py (handle_magic): log magic calls properly as
1119 ipmagic() function calls.
1121 ipmagic() function calls.
1120
1122
1121 * IPython/Magic.py (magic_time): Improved %time to support
1123 * IPython/Magic.py (magic_time): Improved %time to support
1122 statements and provide wall-clock as well as CPU time.
1124 statements and provide wall-clock as well as CPU time.
1123
1125
1124 2005-02-27 Fernando Perez <fperez@colorado.edu>
1126 2005-02-27 Fernando Perez <fperez@colorado.edu>
1125
1127
1126 * IPython/hooks.py: New hooks module, to expose user-modifiable
1128 * IPython/hooks.py: New hooks module, to expose user-modifiable
1127 IPython functionality in a clean manner. For now only the editor
1129 IPython functionality in a clean manner. For now only the editor
1128 hook is actually written, and other thigns which I intend to turn
1130 hook is actually written, and other thigns which I intend to turn
1129 into proper hooks aren't yet there. The display and prefilter
1131 into proper hooks aren't yet there. The display and prefilter
1130 stuff, for example, should be hooks. But at least now the
1132 stuff, for example, should be hooks. But at least now the
1131 framework is in place, and the rest can be moved here with more
1133 framework is in place, and the rest can be moved here with more
1132 time later. IPython had had a .hooks variable for a long time for
1134 time later. IPython had had a .hooks variable for a long time for
1133 this purpose, but I'd never actually used it for anything.
1135 this purpose, but I'd never actually used it for anything.
1134
1136
1135 2005-02-26 Fernando Perez <fperez@colorado.edu>
1137 2005-02-26 Fernando Perez <fperez@colorado.edu>
1136
1138
1137 * IPython/ipmaker.py (make_IPython): make the default ipython
1139 * IPython/ipmaker.py (make_IPython): make the default ipython
1138 directory be called _ipython under win32, to follow more the
1140 directory be called _ipython under win32, to follow more the
1139 naming peculiarities of that platform (where buggy software like
1141 naming peculiarities of that platform (where buggy software like
1140 Visual Sourcesafe breaks with .named directories). Reported by
1142 Visual Sourcesafe breaks with .named directories). Reported by
1141 Ville Vainio.
1143 Ville Vainio.
1142
1144
1143 2005-02-23 Fernando Perez <fperez@colorado.edu>
1145 2005-02-23 Fernando Perez <fperez@colorado.edu>
1144
1146
1145 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1147 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1146 auto_aliases for win32 which were causing problems. Users can
1148 auto_aliases for win32 which were causing problems. Users can
1147 define the ones they personally like.
1149 define the ones they personally like.
1148
1150
1149 2005-02-21 Fernando Perez <fperez@colorado.edu>
1151 2005-02-21 Fernando Perez <fperez@colorado.edu>
1150
1152
1151 * IPython/Magic.py (magic_time): new magic to time execution of
1153 * IPython/Magic.py (magic_time): new magic to time execution of
1152 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1154 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1153
1155
1154 2005-02-19 Fernando Perez <fperez@colorado.edu>
1156 2005-02-19 Fernando Perez <fperez@colorado.edu>
1155
1157
1156 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1158 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1157 into keys (for prompts, for example).
1159 into keys (for prompts, for example).
1158
1160
1159 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1161 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1160 prompts in case users want them. This introduces a small behavior
1162 prompts in case users want them. This introduces a small behavior
1161 change: ipython does not automatically add a space to all prompts
1163 change: ipython does not automatically add a space to all prompts
1162 anymore. To get the old prompts with a space, users should add it
1164 anymore. To get the old prompts with a space, users should add it
1163 manually to their ipythonrc file, so for example prompt_in1 should
1165 manually to their ipythonrc file, so for example prompt_in1 should
1164 now read 'In [\#]: ' instead of 'In [\#]:'.
1166 now read 'In [\#]: ' instead of 'In [\#]:'.
1165 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1167 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1166 file) to control left-padding of secondary prompts.
1168 file) to control left-padding of secondary prompts.
1167
1169
1168 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1170 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1169 the profiler can't be imported. Fix for Debian, which removed
1171 the profiler can't be imported. Fix for Debian, which removed
1170 profile.py because of License issues. I applied a slightly
1172 profile.py because of License issues. I applied a slightly
1171 modified version of the original Debian patch at
1173 modified version of the original Debian patch at
1172 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1174 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1173
1175
1174 2005-02-17 Fernando Perez <fperez@colorado.edu>
1176 2005-02-17 Fernando Perez <fperez@colorado.edu>
1175
1177
1176 * IPython/genutils.py (native_line_ends): Fix bug which would
1178 * IPython/genutils.py (native_line_ends): Fix bug which would
1177 cause improper line-ends under win32 b/c I was not opening files
1179 cause improper line-ends under win32 b/c I was not opening files
1178 in binary mode. Bug report and fix thanks to Ville.
1180 in binary mode. Bug report and fix thanks to Ville.
1179
1181
1180 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1182 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1181 trying to catch spurious foo[1] autocalls. My fix actually broke
1183 trying to catch spurious foo[1] autocalls. My fix actually broke
1182 ',/' autoquote/call with explicit escape (bad regexp).
1184 ',/' autoquote/call with explicit escape (bad regexp).
1183
1185
1184 2005-02-15 *** Released version 0.6.11
1186 2005-02-15 *** Released version 0.6.11
1185
1187
1186 2005-02-14 Fernando Perez <fperez@colorado.edu>
1188 2005-02-14 Fernando Perez <fperez@colorado.edu>
1187
1189
1188 * IPython/background_jobs.py: New background job management
1190 * IPython/background_jobs.py: New background job management
1189 subsystem. This is implemented via a new set of classes, and
1191 subsystem. This is implemented via a new set of classes, and
1190 IPython now provides a builtin 'jobs' object for background job
1192 IPython now provides a builtin 'jobs' object for background job
1191 execution. A convenience %bg magic serves as a lightweight
1193 execution. A convenience %bg magic serves as a lightweight
1192 frontend for starting the more common type of calls. This was
1194 frontend for starting the more common type of calls. This was
1193 inspired by discussions with B. Granger and the BackgroundCommand
1195 inspired by discussions with B. Granger and the BackgroundCommand
1194 class described in the book Python Scripting for Computational
1196 class described in the book Python Scripting for Computational
1195 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1197 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1196 (although ultimately no code from this text was used, as IPython's
1198 (although ultimately no code from this text was used, as IPython's
1197 system is a separate implementation).
1199 system is a separate implementation).
1198
1200
1199 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1201 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1200 to control the completion of single/double underscore names
1202 to control the completion of single/double underscore names
1201 separately. As documented in the example ipytonrc file, the
1203 separately. As documented in the example ipytonrc file, the
1202 readline_omit__names variable can now be set to 2, to omit even
1204 readline_omit__names variable can now be set to 2, to omit even
1203 single underscore names. Thanks to a patch by Brian Wong
1205 single underscore names. Thanks to a patch by Brian Wong
1204 <BrianWong-AT-AirgoNetworks.Com>.
1206 <BrianWong-AT-AirgoNetworks.Com>.
1205 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1207 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1206 be autocalled as foo([1]) if foo were callable. A problem for
1208 be autocalled as foo([1]) if foo were callable. A problem for
1207 things which are both callable and implement __getitem__.
1209 things which are both callable and implement __getitem__.
1208 (init_readline): Fix autoindentation for win32. Thanks to a patch
1210 (init_readline): Fix autoindentation for win32. Thanks to a patch
1209 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1211 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1210
1212
1211 2005-02-12 Fernando Perez <fperez@colorado.edu>
1213 2005-02-12 Fernando Perez <fperez@colorado.edu>
1212
1214
1213 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1215 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1214 which I had written long ago to sort out user error messages which
1216 which I had written long ago to sort out user error messages which
1215 may occur during startup. This seemed like a good idea initially,
1217 may occur during startup. This seemed like a good idea initially,
1216 but it has proven a disaster in retrospect. I don't want to
1218 but it has proven a disaster in retrospect. I don't want to
1217 change much code for now, so my fix is to set the internal 'debug'
1219 change much code for now, so my fix is to set the internal 'debug'
1218 flag to true everywhere, whose only job was precisely to control
1220 flag to true everywhere, whose only job was precisely to control
1219 this subsystem. This closes issue 28 (as well as avoiding all
1221 this subsystem. This closes issue 28 (as well as avoiding all
1220 sorts of strange hangups which occur from time to time).
1222 sorts of strange hangups which occur from time to time).
1221
1223
1222 2005-02-07 Fernando Perez <fperez@colorado.edu>
1224 2005-02-07 Fernando Perez <fperez@colorado.edu>
1223
1225
1224 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1226 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1225 previous call produced a syntax error.
1227 previous call produced a syntax error.
1226
1228
1227 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1229 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1228 classes without constructor.
1230 classes without constructor.
1229
1231
1230 2005-02-06 Fernando Perez <fperez@colorado.edu>
1232 2005-02-06 Fernando Perez <fperez@colorado.edu>
1231
1233
1232 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1234 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1233 completions with the results of each matcher, so we return results
1235 completions with the results of each matcher, so we return results
1234 to the user from all namespaces. This breaks with ipython
1236 to the user from all namespaces. This breaks with ipython
1235 tradition, but I think it's a nicer behavior. Now you get all
1237 tradition, but I think it's a nicer behavior. Now you get all
1236 possible completions listed, from all possible namespaces (python,
1238 possible completions listed, from all possible namespaces (python,
1237 filesystem, magics...) After a request by John Hunter
1239 filesystem, magics...) After a request by John Hunter
1238 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1240 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1239
1241
1240 2005-02-05 Fernando Perez <fperez@colorado.edu>
1242 2005-02-05 Fernando Perez <fperez@colorado.edu>
1241
1243
1242 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1244 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1243 the call had quote characters in it (the quotes were stripped).
1245 the call had quote characters in it (the quotes were stripped).
1244
1246
1245 2005-01-31 Fernando Perez <fperez@colorado.edu>
1247 2005-01-31 Fernando Perez <fperez@colorado.edu>
1246
1248
1247 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1249 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1248 Itpl.itpl() to make the code more robust against psyco
1250 Itpl.itpl() to make the code more robust against psyco
1249 optimizations.
1251 optimizations.
1250
1252
1251 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1253 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1252 of causing an exception. Quicker, cleaner.
1254 of causing an exception. Quicker, cleaner.
1253
1255
1254 2005-01-28 Fernando Perez <fperez@colorado.edu>
1256 2005-01-28 Fernando Perez <fperez@colorado.edu>
1255
1257
1256 * scripts/ipython_win_post_install.py (install): hardcode
1258 * scripts/ipython_win_post_install.py (install): hardcode
1257 sys.prefix+'python.exe' as the executable path. It turns out that
1259 sys.prefix+'python.exe' as the executable path. It turns out that
1258 during the post-installation run, sys.executable resolves to the
1260 during the post-installation run, sys.executable resolves to the
1259 name of the binary installer! I should report this as a distutils
1261 name of the binary installer! I should report this as a distutils
1260 bug, I think. I updated the .10 release with this tiny fix, to
1262 bug, I think. I updated the .10 release with this tiny fix, to
1261 avoid annoying the lists further.
1263 avoid annoying the lists further.
1262
1264
1263 2005-01-27 *** Released version 0.6.10
1265 2005-01-27 *** Released version 0.6.10
1264
1266
1265 2005-01-27 Fernando Perez <fperez@colorado.edu>
1267 2005-01-27 Fernando Perez <fperez@colorado.edu>
1266
1268
1267 * IPython/numutils.py (norm): Added 'inf' as optional name for
1269 * IPython/numutils.py (norm): Added 'inf' as optional name for
1268 L-infinity norm, included references to mathworld.com for vector
1270 L-infinity norm, included references to mathworld.com for vector
1269 norm definitions.
1271 norm definitions.
1270 (amin/amax): added amin/amax for array min/max. Similar to what
1272 (amin/amax): added amin/amax for array min/max. Similar to what
1271 pylab ships with after the recent reorganization of names.
1273 pylab ships with after the recent reorganization of names.
1272 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1274 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1273
1275
1274 * ipython.el: committed Alex's recent fixes and improvements.
1276 * ipython.el: committed Alex's recent fixes and improvements.
1275 Tested with python-mode from CVS, and it looks excellent. Since
1277 Tested with python-mode from CVS, and it looks excellent. Since
1276 python-mode hasn't released anything in a while, I'm temporarily
1278 python-mode hasn't released anything in a while, I'm temporarily
1277 putting a copy of today's CVS (v 4.70) of python-mode in:
1279 putting a copy of today's CVS (v 4.70) of python-mode in:
1278 http://ipython.scipy.org/tmp/python-mode.el
1280 http://ipython.scipy.org/tmp/python-mode.el
1279
1281
1280 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1282 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1281 sys.executable for the executable name, instead of assuming it's
1283 sys.executable for the executable name, instead of assuming it's
1282 called 'python.exe' (the post-installer would have produced broken
1284 called 'python.exe' (the post-installer would have produced broken
1283 setups on systems with a differently named python binary).
1285 setups on systems with a differently named python binary).
1284
1286
1285 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1287 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1286 references to os.linesep, to make the code more
1288 references to os.linesep, to make the code more
1287 platform-independent. This is also part of the win32 coloring
1289 platform-independent. This is also part of the win32 coloring
1288 fixes.
1290 fixes.
1289
1291
1290 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1292 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1291 lines, which actually cause coloring bugs because the length of
1293 lines, which actually cause coloring bugs because the length of
1292 the line is very difficult to correctly compute with embedded
1294 the line is very difficult to correctly compute with embedded
1293 escapes. This was the source of all the coloring problems under
1295 escapes. This was the source of all the coloring problems under
1294 Win32. I think that _finally_, Win32 users have a properly
1296 Win32. I think that _finally_, Win32 users have a properly
1295 working ipython in all respects. This would never have happened
1297 working ipython in all respects. This would never have happened
1296 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1298 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1297
1299
1298 2005-01-26 *** Released version 0.6.9
1300 2005-01-26 *** Released version 0.6.9
1299
1301
1300 2005-01-25 Fernando Perez <fperez@colorado.edu>
1302 2005-01-25 Fernando Perez <fperez@colorado.edu>
1301
1303
1302 * setup.py: finally, we have a true Windows installer, thanks to
1304 * setup.py: finally, we have a true Windows installer, thanks to
1303 the excellent work of Viktor Ransmayr
1305 the excellent work of Viktor Ransmayr
1304 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1306 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1305 Windows users. The setup routine is quite a bit cleaner thanks to
1307 Windows users. The setup routine is quite a bit cleaner thanks to
1306 this, and the post-install script uses the proper functions to
1308 this, and the post-install script uses the proper functions to
1307 allow a clean de-installation using the standard Windows Control
1309 allow a clean de-installation using the standard Windows Control
1308 Panel.
1310 Panel.
1309
1311
1310 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1312 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1311 environment variable under all OSes (including win32) if
1313 environment variable under all OSes (including win32) if
1312 available. This will give consistency to win32 users who have set
1314 available. This will give consistency to win32 users who have set
1313 this variable for any reason. If os.environ['HOME'] fails, the
1315 this variable for any reason. If os.environ['HOME'] fails, the
1314 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1316 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1315
1317
1316 2005-01-24 Fernando Perez <fperez@colorado.edu>
1318 2005-01-24 Fernando Perez <fperez@colorado.edu>
1317
1319
1318 * IPython/numutils.py (empty_like): add empty_like(), similar to
1320 * IPython/numutils.py (empty_like): add empty_like(), similar to
1319 zeros_like() but taking advantage of the new empty() Numeric routine.
1321 zeros_like() but taking advantage of the new empty() Numeric routine.
1320
1322
1321 2005-01-23 *** Released version 0.6.8
1323 2005-01-23 *** Released version 0.6.8
1322
1324
1323 2005-01-22 Fernando Perez <fperez@colorado.edu>
1325 2005-01-22 Fernando Perez <fperez@colorado.edu>
1324
1326
1325 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1327 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1326 automatic show() calls. After discussing things with JDH, it
1328 automatic show() calls. After discussing things with JDH, it
1327 turns out there are too many corner cases where this can go wrong.
1329 turns out there are too many corner cases where this can go wrong.
1328 It's best not to try to be 'too smart', and simply have ipython
1330 It's best not to try to be 'too smart', and simply have ipython
1329 reproduce as much as possible the default behavior of a normal
1331 reproduce as much as possible the default behavior of a normal
1330 python shell.
1332 python shell.
1331
1333
1332 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1334 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1333 line-splitting regexp and _prefilter() to avoid calling getattr()
1335 line-splitting regexp and _prefilter() to avoid calling getattr()
1334 on assignments. This closes
1336 on assignments. This closes
1335 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1337 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1336 readline uses getattr(), so a simple <TAB> keypress is still
1338 readline uses getattr(), so a simple <TAB> keypress is still
1337 enough to trigger getattr() calls on an object.
1339 enough to trigger getattr() calls on an object.
1338
1340
1339 2005-01-21 Fernando Perez <fperez@colorado.edu>
1341 2005-01-21 Fernando Perez <fperez@colorado.edu>
1340
1342
1341 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1343 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1342 docstring under pylab so it doesn't mask the original.
1344 docstring under pylab so it doesn't mask the original.
1343
1345
1344 2005-01-21 *** Released version 0.6.7
1346 2005-01-21 *** Released version 0.6.7
1345
1347
1346 2005-01-21 Fernando Perez <fperez@colorado.edu>
1348 2005-01-21 Fernando Perez <fperez@colorado.edu>
1347
1349
1348 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1350 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1349 signal handling for win32 users in multithreaded mode.
1351 signal handling for win32 users in multithreaded mode.
1350
1352
1351 2005-01-17 Fernando Perez <fperez@colorado.edu>
1353 2005-01-17 Fernando Perez <fperez@colorado.edu>
1352
1354
1353 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1355 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1354 instances with no __init__. After a crash report by Norbert Nemec
1356 instances with no __init__. After a crash report by Norbert Nemec
1355 <Norbert-AT-nemec-online.de>.
1357 <Norbert-AT-nemec-online.de>.
1356
1358
1357 2005-01-14 Fernando Perez <fperez@colorado.edu>
1359 2005-01-14 Fernando Perez <fperez@colorado.edu>
1358
1360
1359 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1361 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1360 names for verbose exceptions, when multiple dotted names and the
1362 names for verbose exceptions, when multiple dotted names and the
1361 'parent' object were present on the same line.
1363 'parent' object were present on the same line.
1362
1364
1363 2005-01-11 Fernando Perez <fperez@colorado.edu>
1365 2005-01-11 Fernando Perez <fperez@colorado.edu>
1364
1366
1365 * IPython/genutils.py (flag_calls): new utility to trap and flag
1367 * IPython/genutils.py (flag_calls): new utility to trap and flag
1366 calls in functions. I need it to clean up matplotlib support.
1368 calls in functions. I need it to clean up matplotlib support.
1367 Also removed some deprecated code in genutils.
1369 Also removed some deprecated code in genutils.
1368
1370
1369 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1371 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1370 that matplotlib scripts called with %run, which don't call show()
1372 that matplotlib scripts called with %run, which don't call show()
1371 themselves, still have their plotting windows open.
1373 themselves, still have their plotting windows open.
1372
1374
1373 2005-01-05 Fernando Perez <fperez@colorado.edu>
1375 2005-01-05 Fernando Perez <fperez@colorado.edu>
1374
1376
1375 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1377 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1376 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1378 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1377
1379
1378 2004-12-19 Fernando Perez <fperez@colorado.edu>
1380 2004-12-19 Fernando Perez <fperez@colorado.edu>
1379
1381
1380 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1382 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1381 parent_runcode, which was an eyesore. The same result can be
1383 parent_runcode, which was an eyesore. The same result can be
1382 obtained with Python's regular superclass mechanisms.
1384 obtained with Python's regular superclass mechanisms.
1383
1385
1384 2004-12-17 Fernando Perez <fperez@colorado.edu>
1386 2004-12-17 Fernando Perez <fperez@colorado.edu>
1385
1387
1386 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1388 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1387 reported by Prabhu.
1389 reported by Prabhu.
1388 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1390 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1389 sys.stderr) instead of explicitly calling sys.stderr. This helps
1391 sys.stderr) instead of explicitly calling sys.stderr. This helps
1390 maintain our I/O abstractions clean, for future GUI embeddings.
1392 maintain our I/O abstractions clean, for future GUI embeddings.
1391
1393
1392 * IPython/genutils.py (info): added new utility for sys.stderr
1394 * IPython/genutils.py (info): added new utility for sys.stderr
1393 unified info message handling (thin wrapper around warn()).
1395 unified info message handling (thin wrapper around warn()).
1394
1396
1395 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1397 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1396 composite (dotted) names on verbose exceptions.
1398 composite (dotted) names on verbose exceptions.
1397 (VerboseTB.nullrepr): harden against another kind of errors which
1399 (VerboseTB.nullrepr): harden against another kind of errors which
1398 Python's inspect module can trigger, and which were crashing
1400 Python's inspect module can trigger, and which were crashing
1399 IPython. Thanks to a report by Marco Lombardi
1401 IPython. Thanks to a report by Marco Lombardi
1400 <mlombard-AT-ma010192.hq.eso.org>.
1402 <mlombard-AT-ma010192.hq.eso.org>.
1401
1403
1402 2004-12-13 *** Released version 0.6.6
1404 2004-12-13 *** Released version 0.6.6
1403
1405
1404 2004-12-12 Fernando Perez <fperez@colorado.edu>
1406 2004-12-12 Fernando Perez <fperez@colorado.edu>
1405
1407
1406 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1408 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1407 generated by pygtk upon initialization if it was built without
1409 generated by pygtk upon initialization if it was built without
1408 threads (for matplotlib users). After a crash reported by
1410 threads (for matplotlib users). After a crash reported by
1409 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1411 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1410
1412
1411 * IPython/ipmaker.py (make_IPython): fix small bug in the
1413 * IPython/ipmaker.py (make_IPython): fix small bug in the
1412 import_some parameter for multiple imports.
1414 import_some parameter for multiple imports.
1413
1415
1414 * IPython/iplib.py (ipmagic): simplified the interface of
1416 * IPython/iplib.py (ipmagic): simplified the interface of
1415 ipmagic() to take a single string argument, just as it would be
1417 ipmagic() to take a single string argument, just as it would be
1416 typed at the IPython cmd line.
1418 typed at the IPython cmd line.
1417 (ipalias): Added new ipalias() with an interface identical to
1419 (ipalias): Added new ipalias() with an interface identical to
1418 ipmagic(). This completes exposing a pure python interface to the
1420 ipmagic(). This completes exposing a pure python interface to the
1419 alias and magic system, which can be used in loops or more complex
1421 alias and magic system, which can be used in loops or more complex
1420 code where IPython's automatic line mangling is not active.
1422 code where IPython's automatic line mangling is not active.
1421
1423
1422 * IPython/genutils.py (timing): changed interface of timing to
1424 * IPython/genutils.py (timing): changed interface of timing to
1423 simply run code once, which is the most common case. timings()
1425 simply run code once, which is the most common case. timings()
1424 remains unchanged, for the cases where you want multiple runs.
1426 remains unchanged, for the cases where you want multiple runs.
1425
1427
1426 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1428 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1427 bug where Python2.2 crashes with exec'ing code which does not end
1429 bug where Python2.2 crashes with exec'ing code which does not end
1428 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1430 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1429 before.
1431 before.
1430
1432
1431 2004-12-10 Fernando Perez <fperez@colorado.edu>
1433 2004-12-10 Fernando Perez <fperez@colorado.edu>
1432
1434
1433 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1435 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1434 -t to -T, to accomodate the new -t flag in %run (the %run and
1436 -t to -T, to accomodate the new -t flag in %run (the %run and
1435 %prun options are kind of intermixed, and it's not easy to change
1437 %prun options are kind of intermixed, and it's not easy to change
1436 this with the limitations of python's getopt).
1438 this with the limitations of python's getopt).
1437
1439
1438 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1440 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1439 the execution of scripts. It's not as fine-tuned as timeit.py,
1441 the execution of scripts. It's not as fine-tuned as timeit.py,
1440 but it works from inside ipython (and under 2.2, which lacks
1442 but it works from inside ipython (and under 2.2, which lacks
1441 timeit.py). Optionally a number of runs > 1 can be given for
1443 timeit.py). Optionally a number of runs > 1 can be given for
1442 timing very short-running code.
1444 timing very short-running code.
1443
1445
1444 * IPython/genutils.py (uniq_stable): new routine which returns a
1446 * IPython/genutils.py (uniq_stable): new routine which returns a
1445 list of unique elements in any iterable, but in stable order of
1447 list of unique elements in any iterable, but in stable order of
1446 appearance. I needed this for the ultraTB fixes, and it's a handy
1448 appearance. I needed this for the ultraTB fixes, and it's a handy
1447 utility.
1449 utility.
1448
1450
1449 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1451 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1450 dotted names in Verbose exceptions. This had been broken since
1452 dotted names in Verbose exceptions. This had been broken since
1451 the very start, now x.y will properly be printed in a Verbose
1453 the very start, now x.y will properly be printed in a Verbose
1452 traceback, instead of x being shown and y appearing always as an
1454 traceback, instead of x being shown and y appearing always as an
1453 'undefined global'. Getting this to work was a bit tricky,
1455 'undefined global'. Getting this to work was a bit tricky,
1454 because by default python tokenizers are stateless. Saved by
1456 because by default python tokenizers are stateless. Saved by
1455 python's ability to easily add a bit of state to an arbitrary
1457 python's ability to easily add a bit of state to an arbitrary
1456 function (without needing to build a full-blown callable object).
1458 function (without needing to build a full-blown callable object).
1457
1459
1458 Also big cleanup of this code, which had horrendous runtime
1460 Also big cleanup of this code, which had horrendous runtime
1459 lookups of zillions of attributes for colorization. Moved all
1461 lookups of zillions of attributes for colorization. Moved all
1460 this code into a few templates, which make it cleaner and quicker.
1462 this code into a few templates, which make it cleaner and quicker.
1461
1463
1462 Printout quality was also improved for Verbose exceptions: one
1464 Printout quality was also improved for Verbose exceptions: one
1463 variable per line, and memory addresses are printed (this can be
1465 variable per line, and memory addresses are printed (this can be
1464 quite handy in nasty debugging situations, which is what Verbose
1466 quite handy in nasty debugging situations, which is what Verbose
1465 is for).
1467 is for).
1466
1468
1467 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1469 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1468 the command line as scripts to be loaded by embedded instances.
1470 the command line as scripts to be loaded by embedded instances.
1469 Doing so has the potential for an infinite recursion if there are
1471 Doing so has the potential for an infinite recursion if there are
1470 exceptions thrown in the process. This fixes a strange crash
1472 exceptions thrown in the process. This fixes a strange crash
1471 reported by Philippe MULLER <muller-AT-irit.fr>.
1473 reported by Philippe MULLER <muller-AT-irit.fr>.
1472
1474
1473 2004-12-09 Fernando Perez <fperez@colorado.edu>
1475 2004-12-09 Fernando Perez <fperez@colorado.edu>
1474
1476
1475 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1477 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1476 to reflect new names in matplotlib, which now expose the
1478 to reflect new names in matplotlib, which now expose the
1477 matlab-compatible interface via a pylab module instead of the
1479 matlab-compatible interface via a pylab module instead of the
1478 'matlab' name. The new code is backwards compatible, so users of
1480 'matlab' name. The new code is backwards compatible, so users of
1479 all matplotlib versions are OK. Patch by J. Hunter.
1481 all matplotlib versions are OK. Patch by J. Hunter.
1480
1482
1481 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1483 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1482 of __init__ docstrings for instances (class docstrings are already
1484 of __init__ docstrings for instances (class docstrings are already
1483 automatically printed). Instances with customized docstrings
1485 automatically printed). Instances with customized docstrings
1484 (indep. of the class) are also recognized and all 3 separate
1486 (indep. of the class) are also recognized and all 3 separate
1485 docstrings are printed (instance, class, constructor). After some
1487 docstrings are printed (instance, class, constructor). After some
1486 comments/suggestions by J. Hunter.
1488 comments/suggestions by J. Hunter.
1487
1489
1488 2004-12-05 Fernando Perez <fperez@colorado.edu>
1490 2004-12-05 Fernando Perez <fperez@colorado.edu>
1489
1491
1490 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1492 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1491 warnings when tab-completion fails and triggers an exception.
1493 warnings when tab-completion fails and triggers an exception.
1492
1494
1493 2004-12-03 Fernando Perez <fperez@colorado.edu>
1495 2004-12-03 Fernando Perez <fperez@colorado.edu>
1494
1496
1495 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1497 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1496 be triggered when using 'run -p'. An incorrect option flag was
1498 be triggered when using 'run -p'. An incorrect option flag was
1497 being set ('d' instead of 'D').
1499 being set ('d' instead of 'D').
1498 (manpage): fix missing escaped \- sign.
1500 (manpage): fix missing escaped \- sign.
1499
1501
1500 2004-11-30 *** Released version 0.6.5
1502 2004-11-30 *** Released version 0.6.5
1501
1503
1502 2004-11-30 Fernando Perez <fperez@colorado.edu>
1504 2004-11-30 Fernando Perez <fperez@colorado.edu>
1503
1505
1504 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1506 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1505 setting with -d option.
1507 setting with -d option.
1506
1508
1507 * setup.py (docfiles): Fix problem where the doc glob I was using
1509 * setup.py (docfiles): Fix problem where the doc glob I was using
1508 was COMPLETELY BROKEN. It was giving the right files by pure
1510 was COMPLETELY BROKEN. It was giving the right files by pure
1509 accident, but failed once I tried to include ipython.el. Note:
1511 accident, but failed once I tried to include ipython.el. Note:
1510 glob() does NOT allow you to do exclusion on multiple endings!
1512 glob() does NOT allow you to do exclusion on multiple endings!
1511
1513
1512 2004-11-29 Fernando Perez <fperez@colorado.edu>
1514 2004-11-29 Fernando Perez <fperez@colorado.edu>
1513
1515
1514 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1516 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1515 the manpage as the source. Better formatting & consistency.
1517 the manpage as the source. Better formatting & consistency.
1516
1518
1517 * IPython/Magic.py (magic_run): Added new -d option, to run
1519 * IPython/Magic.py (magic_run): Added new -d option, to run
1518 scripts under the control of the python pdb debugger. Note that
1520 scripts under the control of the python pdb debugger. Note that
1519 this required changing the %prun option -d to -D, to avoid a clash
1521 this required changing the %prun option -d to -D, to avoid a clash
1520 (since %run must pass options to %prun, and getopt is too dumb to
1522 (since %run must pass options to %prun, and getopt is too dumb to
1521 handle options with string values with embedded spaces). Thanks
1523 handle options with string values with embedded spaces). Thanks
1522 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1524 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1523 (magic_who_ls): added type matching to %who and %whos, so that one
1525 (magic_who_ls): added type matching to %who and %whos, so that one
1524 can filter their output to only include variables of certain
1526 can filter their output to only include variables of certain
1525 types. Another suggestion by Matthew.
1527 types. Another suggestion by Matthew.
1526 (magic_whos): Added memory summaries in kb and Mb for arrays.
1528 (magic_whos): Added memory summaries in kb and Mb for arrays.
1527 (magic_who): Improve formatting (break lines every 9 vars).
1529 (magic_who): Improve formatting (break lines every 9 vars).
1528
1530
1529 2004-11-28 Fernando Perez <fperez@colorado.edu>
1531 2004-11-28 Fernando Perez <fperez@colorado.edu>
1530
1532
1531 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1533 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1532 cache when empty lines were present.
1534 cache when empty lines were present.
1533
1535
1534 2004-11-24 Fernando Perez <fperez@colorado.edu>
1536 2004-11-24 Fernando Perez <fperez@colorado.edu>
1535
1537
1536 * IPython/usage.py (__doc__): document the re-activated threading
1538 * IPython/usage.py (__doc__): document the re-activated threading
1537 options for WX and GTK.
1539 options for WX and GTK.
1538
1540
1539 2004-11-23 Fernando Perez <fperez@colorado.edu>
1541 2004-11-23 Fernando Perez <fperez@colorado.edu>
1540
1542
1541 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1543 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1542 the -wthread and -gthread options, along with a new -tk one to try
1544 the -wthread and -gthread options, along with a new -tk one to try
1543 and coordinate Tk threading with wx/gtk. The tk support is very
1545 and coordinate Tk threading with wx/gtk. The tk support is very
1544 platform dependent, since it seems to require Tcl and Tk to be
1546 platform dependent, since it seems to require Tcl and Tk to be
1545 built with threads (Fedora1/2 appears NOT to have it, but in
1547 built with threads (Fedora1/2 appears NOT to have it, but in
1546 Prabhu's Debian boxes it works OK). But even with some Tk
1548 Prabhu's Debian boxes it works OK). But even with some Tk
1547 limitations, this is a great improvement.
1549 limitations, this is a great improvement.
1548
1550
1549 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1551 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1550 info in user prompts. Patch by Prabhu.
1552 info in user prompts. Patch by Prabhu.
1551
1553
1552 2004-11-18 Fernando Perez <fperez@colorado.edu>
1554 2004-11-18 Fernando Perez <fperez@colorado.edu>
1553
1555
1554 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1556 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1555 EOFErrors and bail, to avoid infinite loops if a non-terminating
1557 EOFErrors and bail, to avoid infinite loops if a non-terminating
1556 file is fed into ipython. Patch submitted in issue 19 by user,
1558 file is fed into ipython. Patch submitted in issue 19 by user,
1557 many thanks.
1559 many thanks.
1558
1560
1559 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1561 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1560 autoquote/parens in continuation prompts, which can cause lots of
1562 autoquote/parens in continuation prompts, which can cause lots of
1561 problems. Closes roundup issue 20.
1563 problems. Closes roundup issue 20.
1562
1564
1563 2004-11-17 Fernando Perez <fperez@colorado.edu>
1565 2004-11-17 Fernando Perez <fperez@colorado.edu>
1564
1566
1565 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1567 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1566 reported as debian bug #280505. I'm not sure my local changelog
1568 reported as debian bug #280505. I'm not sure my local changelog
1567 entry has the proper debian format (Jack?).
1569 entry has the proper debian format (Jack?).
1568
1570
1569 2004-11-08 *** Released version 0.6.4
1571 2004-11-08 *** Released version 0.6.4
1570
1572
1571 2004-11-08 Fernando Perez <fperez@colorado.edu>
1573 2004-11-08 Fernando Perez <fperez@colorado.edu>
1572
1574
1573 * IPython/iplib.py (init_readline): Fix exit message for Windows
1575 * IPython/iplib.py (init_readline): Fix exit message for Windows
1574 when readline is active. Thanks to a report by Eric Jones
1576 when readline is active. Thanks to a report by Eric Jones
1575 <eric-AT-enthought.com>.
1577 <eric-AT-enthought.com>.
1576
1578
1577 2004-11-07 Fernando Perez <fperez@colorado.edu>
1579 2004-11-07 Fernando Perez <fperez@colorado.edu>
1578
1580
1579 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1581 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1580 sometimes seen by win2k/cygwin users.
1582 sometimes seen by win2k/cygwin users.
1581
1583
1582 2004-11-06 Fernando Perez <fperez@colorado.edu>
1584 2004-11-06 Fernando Perez <fperez@colorado.edu>
1583
1585
1584 * IPython/iplib.py (interact): Change the handling of %Exit from
1586 * IPython/iplib.py (interact): Change the handling of %Exit from
1585 trying to propagate a SystemExit to an internal ipython flag.
1587 trying to propagate a SystemExit to an internal ipython flag.
1586 This is less elegant than using Python's exception mechanism, but
1588 This is less elegant than using Python's exception mechanism, but
1587 I can't get that to work reliably with threads, so under -pylab
1589 I can't get that to work reliably with threads, so under -pylab
1588 %Exit was hanging IPython. Cross-thread exception handling is
1590 %Exit was hanging IPython. Cross-thread exception handling is
1589 really a bitch. Thaks to a bug report by Stephen Walton
1591 really a bitch. Thaks to a bug report by Stephen Walton
1590 <stephen.walton-AT-csun.edu>.
1592 <stephen.walton-AT-csun.edu>.
1591
1593
1592 2004-11-04 Fernando Perez <fperez@colorado.edu>
1594 2004-11-04 Fernando Perez <fperez@colorado.edu>
1593
1595
1594 * IPython/iplib.py (raw_input_original): store a pointer to the
1596 * IPython/iplib.py (raw_input_original): store a pointer to the
1595 true raw_input to harden against code which can modify it
1597 true raw_input to harden against code which can modify it
1596 (wx.py.PyShell does this and would otherwise crash ipython).
1598 (wx.py.PyShell does this and would otherwise crash ipython).
1597 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1599 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1598
1600
1599 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1601 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1600 Ctrl-C problem, which does not mess up the input line.
1602 Ctrl-C problem, which does not mess up the input line.
1601
1603
1602 2004-11-03 Fernando Perez <fperez@colorado.edu>
1604 2004-11-03 Fernando Perez <fperez@colorado.edu>
1603
1605
1604 * IPython/Release.py: Changed licensing to BSD, in all files.
1606 * IPython/Release.py: Changed licensing to BSD, in all files.
1605 (name): lowercase name for tarball/RPM release.
1607 (name): lowercase name for tarball/RPM release.
1606
1608
1607 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1609 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1608 use throughout ipython.
1610 use throughout ipython.
1609
1611
1610 * IPython/Magic.py (Magic._ofind): Switch to using the new
1612 * IPython/Magic.py (Magic._ofind): Switch to using the new
1611 OInspect.getdoc() function.
1613 OInspect.getdoc() function.
1612
1614
1613 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1615 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1614 of the line currently being canceled via Ctrl-C. It's extremely
1616 of the line currently being canceled via Ctrl-C. It's extremely
1615 ugly, but I don't know how to do it better (the problem is one of
1617 ugly, but I don't know how to do it better (the problem is one of
1616 handling cross-thread exceptions).
1618 handling cross-thread exceptions).
1617
1619
1618 2004-10-28 Fernando Perez <fperez@colorado.edu>
1620 2004-10-28 Fernando Perez <fperez@colorado.edu>
1619
1621
1620 * IPython/Shell.py (signal_handler): add signal handlers to trap
1622 * IPython/Shell.py (signal_handler): add signal handlers to trap
1621 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1623 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1622 report by Francesc Alted.
1624 report by Francesc Alted.
1623
1625
1624 2004-10-21 Fernando Perez <fperez@colorado.edu>
1626 2004-10-21 Fernando Perez <fperez@colorado.edu>
1625
1627
1626 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1628 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1627 to % for pysh syntax extensions.
1629 to % for pysh syntax extensions.
1628
1630
1629 2004-10-09 Fernando Perez <fperez@colorado.edu>
1631 2004-10-09 Fernando Perez <fperez@colorado.edu>
1630
1632
1631 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1633 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1632 arrays to print a more useful summary, without calling str(arr).
1634 arrays to print a more useful summary, without calling str(arr).
1633 This avoids the problem of extremely lengthy computations which
1635 This avoids the problem of extremely lengthy computations which
1634 occur if arr is large, and appear to the user as a system lockup
1636 occur if arr is large, and appear to the user as a system lockup
1635 with 100% cpu activity. After a suggestion by Kristian Sandberg
1637 with 100% cpu activity. After a suggestion by Kristian Sandberg
1636 <Kristian.Sandberg@colorado.edu>.
1638 <Kristian.Sandberg@colorado.edu>.
1637 (Magic.__init__): fix bug in global magic escapes not being
1639 (Magic.__init__): fix bug in global magic escapes not being
1638 correctly set.
1640 correctly set.
1639
1641
1640 2004-10-08 Fernando Perez <fperez@colorado.edu>
1642 2004-10-08 Fernando Perez <fperez@colorado.edu>
1641
1643
1642 * IPython/Magic.py (__license__): change to absolute imports of
1644 * IPython/Magic.py (__license__): change to absolute imports of
1643 ipython's own internal packages, to start adapting to the absolute
1645 ipython's own internal packages, to start adapting to the absolute
1644 import requirement of PEP-328.
1646 import requirement of PEP-328.
1645
1647
1646 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1648 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1647 files, and standardize author/license marks through the Release
1649 files, and standardize author/license marks through the Release
1648 module instead of having per/file stuff (except for files with
1650 module instead of having per/file stuff (except for files with
1649 particular licenses, like the MIT/PSF-licensed codes).
1651 particular licenses, like the MIT/PSF-licensed codes).
1650
1652
1651 * IPython/Debugger.py: remove dead code for python 2.1
1653 * IPython/Debugger.py: remove dead code for python 2.1
1652
1654
1653 2004-10-04 Fernando Perez <fperez@colorado.edu>
1655 2004-10-04 Fernando Perez <fperez@colorado.edu>
1654
1656
1655 * IPython/iplib.py (ipmagic): New function for accessing magics
1657 * IPython/iplib.py (ipmagic): New function for accessing magics
1656 via a normal python function call.
1658 via a normal python function call.
1657
1659
1658 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1660 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1659 from '@' to '%', to accomodate the new @decorator syntax of python
1661 from '@' to '%', to accomodate the new @decorator syntax of python
1660 2.4.
1662 2.4.
1661
1663
1662 2004-09-29 Fernando Perez <fperez@colorado.edu>
1664 2004-09-29 Fernando Perez <fperez@colorado.edu>
1663
1665
1664 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1666 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1665 matplotlib.use to prevent running scripts which try to switch
1667 matplotlib.use to prevent running scripts which try to switch
1666 interactive backends from within ipython. This will just crash
1668 interactive backends from within ipython. This will just crash
1667 the python interpreter, so we can't allow it (but a detailed error
1669 the python interpreter, so we can't allow it (but a detailed error
1668 is given to the user).
1670 is given to the user).
1669
1671
1670 2004-09-28 Fernando Perez <fperez@colorado.edu>
1672 2004-09-28 Fernando Perez <fperez@colorado.edu>
1671
1673
1672 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1674 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1673 matplotlib-related fixes so that using @run with non-matplotlib
1675 matplotlib-related fixes so that using @run with non-matplotlib
1674 scripts doesn't pop up spurious plot windows. This requires
1676 scripts doesn't pop up spurious plot windows. This requires
1675 matplotlib >= 0.63, where I had to make some changes as well.
1677 matplotlib >= 0.63, where I had to make some changes as well.
1676
1678
1677 * IPython/ipmaker.py (make_IPython): update version requirement to
1679 * IPython/ipmaker.py (make_IPython): update version requirement to
1678 python 2.2.
1680 python 2.2.
1679
1681
1680 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1682 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1681 banner arg for embedded customization.
1683 banner arg for embedded customization.
1682
1684
1683 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1685 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1684 explicit uses of __IP as the IPython's instance name. Now things
1686 explicit uses of __IP as the IPython's instance name. Now things
1685 are properly handled via the shell.name value. The actual code
1687 are properly handled via the shell.name value. The actual code
1686 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1688 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1687 is much better than before. I'll clean things completely when the
1689 is much better than before. I'll clean things completely when the
1688 magic stuff gets a real overhaul.
1690 magic stuff gets a real overhaul.
1689
1691
1690 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1692 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1691 minor changes to debian dir.
1693 minor changes to debian dir.
1692
1694
1693 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1695 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1694 pointer to the shell itself in the interactive namespace even when
1696 pointer to the shell itself in the interactive namespace even when
1695 a user-supplied dict is provided. This is needed for embedding
1697 a user-supplied dict is provided. This is needed for embedding
1696 purposes (found by tests with Michel Sanner).
1698 purposes (found by tests with Michel Sanner).
1697
1699
1698 2004-09-27 Fernando Perez <fperez@colorado.edu>
1700 2004-09-27 Fernando Perez <fperez@colorado.edu>
1699
1701
1700 * IPython/UserConfig/ipythonrc: remove []{} from
1702 * IPython/UserConfig/ipythonrc: remove []{} from
1701 readline_remove_delims, so that things like [modname.<TAB> do
1703 readline_remove_delims, so that things like [modname.<TAB> do
1702 proper completion. This disables [].TAB, but that's a less common
1704 proper completion. This disables [].TAB, but that's a less common
1703 case than module names in list comprehensions, for example.
1705 case than module names in list comprehensions, for example.
1704 Thanks to a report by Andrea Riciputi.
1706 Thanks to a report by Andrea Riciputi.
1705
1707
1706 2004-09-09 Fernando Perez <fperez@colorado.edu>
1708 2004-09-09 Fernando Perez <fperez@colorado.edu>
1707
1709
1708 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1710 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1709 blocking problems in win32 and osx. Fix by John.
1711 blocking problems in win32 and osx. Fix by John.
1710
1712
1711 2004-09-08 Fernando Perez <fperez@colorado.edu>
1713 2004-09-08 Fernando Perez <fperez@colorado.edu>
1712
1714
1713 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1715 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1714 for Win32 and OSX. Fix by John Hunter.
1716 for Win32 and OSX. Fix by John Hunter.
1715
1717
1716 2004-08-30 *** Released version 0.6.3
1718 2004-08-30 *** Released version 0.6.3
1717
1719
1718 2004-08-30 Fernando Perez <fperez@colorado.edu>
1720 2004-08-30 Fernando Perez <fperez@colorado.edu>
1719
1721
1720 * setup.py (isfile): Add manpages to list of dependent files to be
1722 * setup.py (isfile): Add manpages to list of dependent files to be
1721 updated.
1723 updated.
1722
1724
1723 2004-08-27 Fernando Perez <fperez@colorado.edu>
1725 2004-08-27 Fernando Perez <fperez@colorado.edu>
1724
1726
1725 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1727 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1726 for now. They don't really work with standalone WX/GTK code
1728 for now. They don't really work with standalone WX/GTK code
1727 (though matplotlib IS working fine with both of those backends).
1729 (though matplotlib IS working fine with both of those backends).
1728 This will neeed much more testing. I disabled most things with
1730 This will neeed much more testing. I disabled most things with
1729 comments, so turning it back on later should be pretty easy.
1731 comments, so turning it back on later should be pretty easy.
1730
1732
1731 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1733 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1732 autocalling of expressions like r'foo', by modifying the line
1734 autocalling of expressions like r'foo', by modifying the line
1733 split regexp. Closes
1735 split regexp. Closes
1734 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1736 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1735 Riley <ipythonbugs-AT-sabi.net>.
1737 Riley <ipythonbugs-AT-sabi.net>.
1736 (InteractiveShell.mainloop): honor --nobanner with banner
1738 (InteractiveShell.mainloop): honor --nobanner with banner
1737 extensions.
1739 extensions.
1738
1740
1739 * IPython/Shell.py: Significant refactoring of all classes, so
1741 * IPython/Shell.py: Significant refactoring of all classes, so
1740 that we can really support ALL matplotlib backends and threading
1742 that we can really support ALL matplotlib backends and threading
1741 models (John spotted a bug with Tk which required this). Now we
1743 models (John spotted a bug with Tk which required this). Now we
1742 should support single-threaded, WX-threads and GTK-threads, both
1744 should support single-threaded, WX-threads and GTK-threads, both
1743 for generic code and for matplotlib.
1745 for generic code and for matplotlib.
1744
1746
1745 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1747 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1746 -pylab, to simplify things for users. Will also remove the pylab
1748 -pylab, to simplify things for users. Will also remove the pylab
1747 profile, since now all of matplotlib configuration is directly
1749 profile, since now all of matplotlib configuration is directly
1748 handled here. This also reduces startup time.
1750 handled here. This also reduces startup time.
1749
1751
1750 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1752 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1751 shell wasn't being correctly called. Also in IPShellWX.
1753 shell wasn't being correctly called. Also in IPShellWX.
1752
1754
1753 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1755 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1754 fine-tune banner.
1756 fine-tune banner.
1755
1757
1756 * IPython/numutils.py (spike): Deprecate these spike functions,
1758 * IPython/numutils.py (spike): Deprecate these spike functions,
1757 delete (long deprecated) gnuplot_exec handler.
1759 delete (long deprecated) gnuplot_exec handler.
1758
1760
1759 2004-08-26 Fernando Perez <fperez@colorado.edu>
1761 2004-08-26 Fernando Perez <fperez@colorado.edu>
1760
1762
1761 * ipython.1: Update for threading options, plus some others which
1763 * ipython.1: Update for threading options, plus some others which
1762 were missing.
1764 were missing.
1763
1765
1764 * IPython/ipmaker.py (__call__): Added -wthread option for
1766 * IPython/ipmaker.py (__call__): Added -wthread option for
1765 wxpython thread handling. Make sure threading options are only
1767 wxpython thread handling. Make sure threading options are only
1766 valid at the command line.
1768 valid at the command line.
1767
1769
1768 * scripts/ipython: moved shell selection into a factory function
1770 * scripts/ipython: moved shell selection into a factory function
1769 in Shell.py, to keep the starter script to a minimum.
1771 in Shell.py, to keep the starter script to a minimum.
1770
1772
1771 2004-08-25 Fernando Perez <fperez@colorado.edu>
1773 2004-08-25 Fernando Perez <fperez@colorado.edu>
1772
1774
1773 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1775 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1774 John. Along with some recent changes he made to matplotlib, the
1776 John. Along with some recent changes he made to matplotlib, the
1775 next versions of both systems should work very well together.
1777 next versions of both systems should work very well together.
1776
1778
1777 2004-08-24 Fernando Perez <fperez@colorado.edu>
1779 2004-08-24 Fernando Perez <fperez@colorado.edu>
1778
1780
1779 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1781 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1780 tried to switch the profiling to using hotshot, but I'm getting
1782 tried to switch the profiling to using hotshot, but I'm getting
1781 strange errors from prof.runctx() there. I may be misreading the
1783 strange errors from prof.runctx() there. I may be misreading the
1782 docs, but it looks weird. For now the profiling code will
1784 docs, but it looks weird. For now the profiling code will
1783 continue to use the standard profiler.
1785 continue to use the standard profiler.
1784
1786
1785 2004-08-23 Fernando Perez <fperez@colorado.edu>
1787 2004-08-23 Fernando Perez <fperez@colorado.edu>
1786
1788
1787 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1789 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1788 threaded shell, by John Hunter. It's not quite ready yet, but
1790 threaded shell, by John Hunter. It's not quite ready yet, but
1789 close.
1791 close.
1790
1792
1791 2004-08-22 Fernando Perez <fperez@colorado.edu>
1793 2004-08-22 Fernando Perez <fperez@colorado.edu>
1792
1794
1793 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1795 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1794 in Magic and ultraTB.
1796 in Magic and ultraTB.
1795
1797
1796 * ipython.1: document threading options in manpage.
1798 * ipython.1: document threading options in manpage.
1797
1799
1798 * scripts/ipython: Changed name of -thread option to -gthread,
1800 * scripts/ipython: Changed name of -thread option to -gthread,
1799 since this is GTK specific. I want to leave the door open for a
1801 since this is GTK specific. I want to leave the door open for a
1800 -wthread option for WX, which will most likely be necessary. This
1802 -wthread option for WX, which will most likely be necessary. This
1801 change affects usage and ipmaker as well.
1803 change affects usage and ipmaker as well.
1802
1804
1803 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1805 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1804 handle the matplotlib shell issues. Code by John Hunter
1806 handle the matplotlib shell issues. Code by John Hunter
1805 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1807 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1806 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1808 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1807 broken (and disabled for end users) for now, but it puts the
1809 broken (and disabled for end users) for now, but it puts the
1808 infrastructure in place.
1810 infrastructure in place.
1809
1811
1810 2004-08-21 Fernando Perez <fperez@colorado.edu>
1812 2004-08-21 Fernando Perez <fperez@colorado.edu>
1811
1813
1812 * ipythonrc-pylab: Add matplotlib support.
1814 * ipythonrc-pylab: Add matplotlib support.
1813
1815
1814 * matplotlib_config.py: new files for matplotlib support, part of
1816 * matplotlib_config.py: new files for matplotlib support, part of
1815 the pylab profile.
1817 the pylab profile.
1816
1818
1817 * IPython/usage.py (__doc__): documented the threading options.
1819 * IPython/usage.py (__doc__): documented the threading options.
1818
1820
1819 2004-08-20 Fernando Perez <fperez@colorado.edu>
1821 2004-08-20 Fernando Perez <fperez@colorado.edu>
1820
1822
1821 * ipython: Modified the main calling routine to handle the -thread
1823 * ipython: Modified the main calling routine to handle the -thread
1822 and -mpthread options. This needs to be done as a top-level hack,
1824 and -mpthread options. This needs to be done as a top-level hack,
1823 because it determines which class to instantiate for IPython
1825 because it determines which class to instantiate for IPython
1824 itself.
1826 itself.
1825
1827
1826 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1828 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1827 classes to support multithreaded GTK operation without blocking,
1829 classes to support multithreaded GTK operation without blocking,
1828 and matplotlib with all backends. This is a lot of still very
1830 and matplotlib with all backends. This is a lot of still very
1829 experimental code, and threads are tricky. So it may still have a
1831 experimental code, and threads are tricky. So it may still have a
1830 few rough edges... This code owes a lot to
1832 few rough edges... This code owes a lot to
1831 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1833 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1832 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1834 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1833 to John Hunter for all the matplotlib work.
1835 to John Hunter for all the matplotlib work.
1834
1836
1835 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1837 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1836 options for gtk thread and matplotlib support.
1838 options for gtk thread and matplotlib support.
1837
1839
1838 2004-08-16 Fernando Perez <fperez@colorado.edu>
1840 2004-08-16 Fernando Perez <fperez@colorado.edu>
1839
1841
1840 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1842 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1841 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1843 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1842 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1844 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1843
1845
1844 2004-08-11 Fernando Perez <fperez@colorado.edu>
1846 2004-08-11 Fernando Perez <fperez@colorado.edu>
1845
1847
1846 * setup.py (isfile): Fix build so documentation gets updated for
1848 * setup.py (isfile): Fix build so documentation gets updated for
1847 rpms (it was only done for .tgz builds).
1849 rpms (it was only done for .tgz builds).
1848
1850
1849 2004-08-10 Fernando Perez <fperez@colorado.edu>
1851 2004-08-10 Fernando Perez <fperez@colorado.edu>
1850
1852
1851 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1853 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1852
1854
1853 * iplib.py : Silence syntax error exceptions in tab-completion.
1855 * iplib.py : Silence syntax error exceptions in tab-completion.
1854
1856
1855 2004-08-05 Fernando Perez <fperez@colorado.edu>
1857 2004-08-05 Fernando Perez <fperez@colorado.edu>
1856
1858
1857 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1859 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1858 'color off' mark for continuation prompts. This was causing long
1860 'color off' mark for continuation prompts. This was causing long
1859 continuation lines to mis-wrap.
1861 continuation lines to mis-wrap.
1860
1862
1861 2004-08-01 Fernando Perez <fperez@colorado.edu>
1863 2004-08-01 Fernando Perez <fperez@colorado.edu>
1862
1864
1863 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1865 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1864 for building ipython to be a parameter. All this is necessary
1866 for building ipython to be a parameter. All this is necessary
1865 right now to have a multithreaded version, but this insane
1867 right now to have a multithreaded version, but this insane
1866 non-design will be cleaned up soon. For now, it's a hack that
1868 non-design will be cleaned up soon. For now, it's a hack that
1867 works.
1869 works.
1868
1870
1869 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1871 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1870 args in various places. No bugs so far, but it's a dangerous
1872 args in various places. No bugs so far, but it's a dangerous
1871 practice.
1873 practice.
1872
1874
1873 2004-07-31 Fernando Perez <fperez@colorado.edu>
1875 2004-07-31 Fernando Perez <fperez@colorado.edu>
1874
1876
1875 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1877 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1876 fix completion of files with dots in their names under most
1878 fix completion of files with dots in their names under most
1877 profiles (pysh was OK because the completion order is different).
1879 profiles (pysh was OK because the completion order is different).
1878
1880
1879 2004-07-27 Fernando Perez <fperez@colorado.edu>
1881 2004-07-27 Fernando Perez <fperez@colorado.edu>
1880
1882
1881 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1883 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1882 keywords manually, b/c the one in keyword.py was removed in python
1884 keywords manually, b/c the one in keyword.py was removed in python
1883 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1885 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1884 This is NOT a bug under python 2.3 and earlier.
1886 This is NOT a bug under python 2.3 and earlier.
1885
1887
1886 2004-07-26 Fernando Perez <fperez@colorado.edu>
1888 2004-07-26 Fernando Perez <fperez@colorado.edu>
1887
1889
1888 * IPython/ultraTB.py (VerboseTB.text): Add another
1890 * IPython/ultraTB.py (VerboseTB.text): Add another
1889 linecache.checkcache() call to try to prevent inspect.py from
1891 linecache.checkcache() call to try to prevent inspect.py from
1890 crashing under python 2.3. I think this fixes
1892 crashing under python 2.3. I think this fixes
1891 http://www.scipy.net/roundup/ipython/issue17.
1893 http://www.scipy.net/roundup/ipython/issue17.
1892
1894
1893 2004-07-26 *** Released version 0.6.2
1895 2004-07-26 *** Released version 0.6.2
1894
1896
1895 2004-07-26 Fernando Perez <fperez@colorado.edu>
1897 2004-07-26 Fernando Perez <fperez@colorado.edu>
1896
1898
1897 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1899 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1898 fail for any number.
1900 fail for any number.
1899 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1901 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1900 empty bookmarks.
1902 empty bookmarks.
1901
1903
1902 2004-07-26 *** Released version 0.6.1
1904 2004-07-26 *** Released version 0.6.1
1903
1905
1904 2004-07-26 Fernando Perez <fperez@colorado.edu>
1906 2004-07-26 Fernando Perez <fperez@colorado.edu>
1905
1907
1906 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1908 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1907
1909
1908 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1910 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1909 escaping '()[]{}' in filenames.
1911 escaping '()[]{}' in filenames.
1910
1912
1911 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1913 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1912 Python 2.2 users who lack a proper shlex.split.
1914 Python 2.2 users who lack a proper shlex.split.
1913
1915
1914 2004-07-19 Fernando Perez <fperez@colorado.edu>
1916 2004-07-19 Fernando Perez <fperez@colorado.edu>
1915
1917
1916 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1918 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1917 for reading readline's init file. I follow the normal chain:
1919 for reading readline's init file. I follow the normal chain:
1918 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1920 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1919 report by Mike Heeter. This closes
1921 report by Mike Heeter. This closes
1920 http://www.scipy.net/roundup/ipython/issue16.
1922 http://www.scipy.net/roundup/ipython/issue16.
1921
1923
1922 2004-07-18 Fernando Perez <fperez@colorado.edu>
1924 2004-07-18 Fernando Perez <fperez@colorado.edu>
1923
1925
1924 * IPython/iplib.py (__init__): Add better handling of '\' under
1926 * IPython/iplib.py (__init__): Add better handling of '\' under
1925 Win32 for filenames. After a patch by Ville.
1927 Win32 for filenames. After a patch by Ville.
1926
1928
1927 2004-07-17 Fernando Perez <fperez@colorado.edu>
1929 2004-07-17 Fernando Perez <fperez@colorado.edu>
1928
1930
1929 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1931 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1930 autocalling would be triggered for 'foo is bar' if foo is
1932 autocalling would be triggered for 'foo is bar' if foo is
1931 callable. I also cleaned up the autocall detection code to use a
1933 callable. I also cleaned up the autocall detection code to use a
1932 regexp, which is faster. Bug reported by Alexander Schmolck.
1934 regexp, which is faster. Bug reported by Alexander Schmolck.
1933
1935
1934 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1936 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1935 '?' in them would confuse the help system. Reported by Alex
1937 '?' in them would confuse the help system. Reported by Alex
1936 Schmolck.
1938 Schmolck.
1937
1939
1938 2004-07-16 Fernando Perez <fperez@colorado.edu>
1940 2004-07-16 Fernando Perez <fperez@colorado.edu>
1939
1941
1940 * IPython/GnuplotInteractive.py (__all__): added plot2.
1942 * IPython/GnuplotInteractive.py (__all__): added plot2.
1941
1943
1942 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1944 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1943 plotting dictionaries, lists or tuples of 1d arrays.
1945 plotting dictionaries, lists or tuples of 1d arrays.
1944
1946
1945 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1947 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1946 optimizations.
1948 optimizations.
1947
1949
1948 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1950 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1949 the information which was there from Janko's original IPP code:
1951 the information which was there from Janko's original IPP code:
1950
1952
1951 03.05.99 20:53 porto.ifm.uni-kiel.de
1953 03.05.99 20:53 porto.ifm.uni-kiel.de
1952 --Started changelog.
1954 --Started changelog.
1953 --make clear do what it say it does
1955 --make clear do what it say it does
1954 --added pretty output of lines from inputcache
1956 --added pretty output of lines from inputcache
1955 --Made Logger a mixin class, simplifies handling of switches
1957 --Made Logger a mixin class, simplifies handling of switches
1956 --Added own completer class. .string<TAB> expands to last history
1958 --Added own completer class. .string<TAB> expands to last history
1957 line which starts with string. The new expansion is also present
1959 line which starts with string. The new expansion is also present
1958 with Ctrl-r from the readline library. But this shows, who this
1960 with Ctrl-r from the readline library. But this shows, who this
1959 can be done for other cases.
1961 can be done for other cases.
1960 --Added convention that all shell functions should accept a
1962 --Added convention that all shell functions should accept a
1961 parameter_string This opens the door for different behaviour for
1963 parameter_string This opens the door for different behaviour for
1962 each function. @cd is a good example of this.
1964 each function. @cd is a good example of this.
1963
1965
1964 04.05.99 12:12 porto.ifm.uni-kiel.de
1966 04.05.99 12:12 porto.ifm.uni-kiel.de
1965 --added logfile rotation
1967 --added logfile rotation
1966 --added new mainloop method which freezes first the namespace
1968 --added new mainloop method which freezes first the namespace
1967
1969
1968 07.05.99 21:24 porto.ifm.uni-kiel.de
1970 07.05.99 21:24 porto.ifm.uni-kiel.de
1969 --added the docreader classes. Now there is a help system.
1971 --added the docreader classes. Now there is a help system.
1970 -This is only a first try. Currently it's not easy to put new
1972 -This is only a first try. Currently it's not easy to put new
1971 stuff in the indices. But this is the way to go. Info would be
1973 stuff in the indices. But this is the way to go. Info would be
1972 better, but HTML is every where and not everybody has an info
1974 better, but HTML is every where and not everybody has an info
1973 system installed and it's not so easy to change html-docs to info.
1975 system installed and it's not so easy to change html-docs to info.
1974 --added global logfile option
1976 --added global logfile option
1975 --there is now a hook for object inspection method pinfo needs to
1977 --there is now a hook for object inspection method pinfo needs to
1976 be provided for this. Can be reached by two '??'.
1978 be provided for this. Can be reached by two '??'.
1977
1979
1978 08.05.99 20:51 porto.ifm.uni-kiel.de
1980 08.05.99 20:51 porto.ifm.uni-kiel.de
1979 --added a README
1981 --added a README
1980 --bug in rc file. Something has changed so functions in the rc
1982 --bug in rc file. Something has changed so functions in the rc
1981 file need to reference the shell and not self. Not clear if it's a
1983 file need to reference the shell and not self. Not clear if it's a
1982 bug or feature.
1984 bug or feature.
1983 --changed rc file for new behavior
1985 --changed rc file for new behavior
1984
1986
1985 2004-07-15 Fernando Perez <fperez@colorado.edu>
1987 2004-07-15 Fernando Perez <fperez@colorado.edu>
1986
1988
1987 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1989 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1988 cache was falling out of sync in bizarre manners when multi-line
1990 cache was falling out of sync in bizarre manners when multi-line
1989 input was present. Minor optimizations and cleanup.
1991 input was present. Minor optimizations and cleanup.
1990
1992
1991 (Logger): Remove old Changelog info for cleanup. This is the
1993 (Logger): Remove old Changelog info for cleanup. This is the
1992 information which was there from Janko's original code:
1994 information which was there from Janko's original code:
1993
1995
1994 Changes to Logger: - made the default log filename a parameter
1996 Changes to Logger: - made the default log filename a parameter
1995
1997
1996 - put a check for lines beginning with !@? in log(). Needed
1998 - put a check for lines beginning with !@? in log(). Needed
1997 (even if the handlers properly log their lines) for mid-session
1999 (even if the handlers properly log their lines) for mid-session
1998 logging activation to work properly. Without this, lines logged
2000 logging activation to work properly. Without this, lines logged
1999 in mid session, which get read from the cache, would end up
2001 in mid session, which get read from the cache, would end up
2000 'bare' (with !@? in the open) in the log. Now they are caught
2002 'bare' (with !@? in the open) in the log. Now they are caught
2001 and prepended with a #.
2003 and prepended with a #.
2002
2004
2003 * IPython/iplib.py (InteractiveShell.init_readline): added check
2005 * IPython/iplib.py (InteractiveShell.init_readline): added check
2004 in case MagicCompleter fails to be defined, so we don't crash.
2006 in case MagicCompleter fails to be defined, so we don't crash.
2005
2007
2006 2004-07-13 Fernando Perez <fperez@colorado.edu>
2008 2004-07-13 Fernando Perez <fperez@colorado.edu>
2007
2009
2008 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2010 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2009 of EPS if the requested filename ends in '.eps'.
2011 of EPS if the requested filename ends in '.eps'.
2010
2012
2011 2004-07-04 Fernando Perez <fperez@colorado.edu>
2013 2004-07-04 Fernando Perez <fperez@colorado.edu>
2012
2014
2013 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2015 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2014 escaping of quotes when calling the shell.
2016 escaping of quotes when calling the shell.
2015
2017
2016 2004-07-02 Fernando Perez <fperez@colorado.edu>
2018 2004-07-02 Fernando Perez <fperez@colorado.edu>
2017
2019
2018 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2020 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2019 gettext not working because we were clobbering '_'. Fixes
2021 gettext not working because we were clobbering '_'. Fixes
2020 http://www.scipy.net/roundup/ipython/issue6.
2022 http://www.scipy.net/roundup/ipython/issue6.
2021
2023
2022 2004-07-01 Fernando Perez <fperez@colorado.edu>
2024 2004-07-01 Fernando Perez <fperez@colorado.edu>
2023
2025
2024 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2026 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2025 into @cd. Patch by Ville.
2027 into @cd. Patch by Ville.
2026
2028
2027 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2029 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2028 new function to store things after ipmaker runs. Patch by Ville.
2030 new function to store things after ipmaker runs. Patch by Ville.
2029 Eventually this will go away once ipmaker is removed and the class
2031 Eventually this will go away once ipmaker is removed and the class
2030 gets cleaned up, but for now it's ok. Key functionality here is
2032 gets cleaned up, but for now it's ok. Key functionality here is
2031 the addition of the persistent storage mechanism, a dict for
2033 the addition of the persistent storage mechanism, a dict for
2032 keeping data across sessions (for now just bookmarks, but more can
2034 keeping data across sessions (for now just bookmarks, but more can
2033 be implemented later).
2035 be implemented later).
2034
2036
2035 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2037 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2036 persistent across sections. Patch by Ville, I modified it
2038 persistent across sections. Patch by Ville, I modified it
2037 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2039 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2038 added a '-l' option to list all bookmarks.
2040 added a '-l' option to list all bookmarks.
2039
2041
2040 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2042 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2041 center for cleanup. Registered with atexit.register(). I moved
2043 center for cleanup. Registered with atexit.register(). I moved
2042 here the old exit_cleanup(). After a patch by Ville.
2044 here the old exit_cleanup(). After a patch by Ville.
2043
2045
2044 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2046 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2045 characters in the hacked shlex_split for python 2.2.
2047 characters in the hacked shlex_split for python 2.2.
2046
2048
2047 * IPython/iplib.py (file_matches): more fixes to filenames with
2049 * IPython/iplib.py (file_matches): more fixes to filenames with
2048 whitespace in them. It's not perfect, but limitations in python's
2050 whitespace in them. It's not perfect, but limitations in python's
2049 readline make it impossible to go further.
2051 readline make it impossible to go further.
2050
2052
2051 2004-06-29 Fernando Perez <fperez@colorado.edu>
2053 2004-06-29 Fernando Perez <fperez@colorado.edu>
2052
2054
2053 * IPython/iplib.py (file_matches): escape whitespace correctly in
2055 * IPython/iplib.py (file_matches): escape whitespace correctly in
2054 filename completions. Bug reported by Ville.
2056 filename completions. Bug reported by Ville.
2055
2057
2056 2004-06-28 Fernando Perez <fperez@colorado.edu>
2058 2004-06-28 Fernando Perez <fperez@colorado.edu>
2057
2059
2058 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2060 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2059 the history file will be called 'history-PROFNAME' (or just
2061 the history file will be called 'history-PROFNAME' (or just
2060 'history' if no profile is loaded). I was getting annoyed at
2062 'history' if no profile is loaded). I was getting annoyed at
2061 getting my Numerical work history clobbered by pysh sessions.
2063 getting my Numerical work history clobbered by pysh sessions.
2062
2064
2063 * IPython/iplib.py (InteractiveShell.__init__): Internal
2065 * IPython/iplib.py (InteractiveShell.__init__): Internal
2064 getoutputerror() function so that we can honor the system_verbose
2066 getoutputerror() function so that we can honor the system_verbose
2065 flag for _all_ system calls. I also added escaping of #
2067 flag for _all_ system calls. I also added escaping of #
2066 characters here to avoid confusing Itpl.
2068 characters here to avoid confusing Itpl.
2067
2069
2068 * IPython/Magic.py (shlex_split): removed call to shell in
2070 * IPython/Magic.py (shlex_split): removed call to shell in
2069 parse_options and replaced it with shlex.split(). The annoying
2071 parse_options and replaced it with shlex.split(). The annoying
2070 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2072 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2071 to backport it from 2.3, with several frail hacks (the shlex
2073 to backport it from 2.3, with several frail hacks (the shlex
2072 module is rather limited in 2.2). Thanks to a suggestion by Ville
2074 module is rather limited in 2.2). Thanks to a suggestion by Ville
2073 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2075 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2074 problem.
2076 problem.
2075
2077
2076 (Magic.magic_system_verbose): new toggle to print the actual
2078 (Magic.magic_system_verbose): new toggle to print the actual
2077 system calls made by ipython. Mainly for debugging purposes.
2079 system calls made by ipython. Mainly for debugging purposes.
2078
2080
2079 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2081 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2080 doesn't support persistence. Reported (and fix suggested) by
2082 doesn't support persistence. Reported (and fix suggested) by
2081 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2083 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2082
2084
2083 2004-06-26 Fernando Perez <fperez@colorado.edu>
2085 2004-06-26 Fernando Perez <fperez@colorado.edu>
2084
2086
2085 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2087 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2086 continue prompts.
2088 continue prompts.
2087
2089
2088 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2090 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2089 function (basically a big docstring) and a few more things here to
2091 function (basically a big docstring) and a few more things here to
2090 speedup startup. pysh.py is now very lightweight. We want because
2092 speedup startup. pysh.py is now very lightweight. We want because
2091 it gets execfile'd, while InterpreterExec gets imported, so
2093 it gets execfile'd, while InterpreterExec gets imported, so
2092 byte-compilation saves time.
2094 byte-compilation saves time.
2093
2095
2094 2004-06-25 Fernando Perez <fperez@colorado.edu>
2096 2004-06-25 Fernando Perez <fperez@colorado.edu>
2095
2097
2096 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2098 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2097 -NUM', which was recently broken.
2099 -NUM', which was recently broken.
2098
2100
2099 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2101 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2100 in multi-line input (but not !!, which doesn't make sense there).
2102 in multi-line input (but not !!, which doesn't make sense there).
2101
2103
2102 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2104 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2103 It's just too useful, and people can turn it off in the less
2105 It's just too useful, and people can turn it off in the less
2104 common cases where it's a problem.
2106 common cases where it's a problem.
2105
2107
2106 2004-06-24 Fernando Perez <fperez@colorado.edu>
2108 2004-06-24 Fernando Perez <fperez@colorado.edu>
2107
2109
2108 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2110 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2109 special syntaxes (like alias calling) is now allied in multi-line
2111 special syntaxes (like alias calling) is now allied in multi-line
2110 input. This is still _very_ experimental, but it's necessary for
2112 input. This is still _very_ experimental, but it's necessary for
2111 efficient shell usage combining python looping syntax with system
2113 efficient shell usage combining python looping syntax with system
2112 calls. For now it's restricted to aliases, I don't think it
2114 calls. For now it's restricted to aliases, I don't think it
2113 really even makes sense to have this for magics.
2115 really even makes sense to have this for magics.
2114
2116
2115 2004-06-23 Fernando Perez <fperez@colorado.edu>
2117 2004-06-23 Fernando Perez <fperez@colorado.edu>
2116
2118
2117 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2119 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2118 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2120 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2119
2121
2120 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2122 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2121 extensions under Windows (after code sent by Gary Bishop). The
2123 extensions under Windows (after code sent by Gary Bishop). The
2122 extensions considered 'executable' are stored in IPython's rc
2124 extensions considered 'executable' are stored in IPython's rc
2123 structure as win_exec_ext.
2125 structure as win_exec_ext.
2124
2126
2125 * IPython/genutils.py (shell): new function, like system() but
2127 * IPython/genutils.py (shell): new function, like system() but
2126 without return value. Very useful for interactive shell work.
2128 without return value. Very useful for interactive shell work.
2127
2129
2128 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2130 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2129 delete aliases.
2131 delete aliases.
2130
2132
2131 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2133 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2132 sure that the alias table doesn't contain python keywords.
2134 sure that the alias table doesn't contain python keywords.
2133
2135
2134 2004-06-21 Fernando Perez <fperez@colorado.edu>
2136 2004-06-21 Fernando Perez <fperez@colorado.edu>
2135
2137
2136 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2138 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2137 non-existent items are found in $PATH. Reported by Thorsten.
2139 non-existent items are found in $PATH. Reported by Thorsten.
2138
2140
2139 2004-06-20 Fernando Perez <fperez@colorado.edu>
2141 2004-06-20 Fernando Perez <fperez@colorado.edu>
2140
2142
2141 * IPython/iplib.py (complete): modified the completer so that the
2143 * IPython/iplib.py (complete): modified the completer so that the
2142 order of priorities can be easily changed at runtime.
2144 order of priorities can be easily changed at runtime.
2143
2145
2144 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2146 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2145 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2147 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2146
2148
2147 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2149 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2148 expand Python variables prepended with $ in all system calls. The
2150 expand Python variables prepended with $ in all system calls. The
2149 same was done to InteractiveShell.handle_shell_escape. Now all
2151 same was done to InteractiveShell.handle_shell_escape. Now all
2150 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2152 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2151 expansion of python variables and expressions according to the
2153 expansion of python variables and expressions according to the
2152 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2154 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2153
2155
2154 Though PEP-215 has been rejected, a similar (but simpler) one
2156 Though PEP-215 has been rejected, a similar (but simpler) one
2155 seems like it will go into Python 2.4, PEP-292 -
2157 seems like it will go into Python 2.4, PEP-292 -
2156 http://www.python.org/peps/pep-0292.html.
2158 http://www.python.org/peps/pep-0292.html.
2157
2159
2158 I'll keep the full syntax of PEP-215, since IPython has since the
2160 I'll keep the full syntax of PEP-215, since IPython has since the
2159 start used Ka-Ping Yee's reference implementation discussed there
2161 start used Ka-Ping Yee's reference implementation discussed there
2160 (Itpl), and I actually like the powerful semantics it offers.
2162 (Itpl), and I actually like the powerful semantics it offers.
2161
2163
2162 In order to access normal shell variables, the $ has to be escaped
2164 In order to access normal shell variables, the $ has to be escaped
2163 via an extra $. For example:
2165 via an extra $. For example:
2164
2166
2165 In [7]: PATH='a python variable'
2167 In [7]: PATH='a python variable'
2166
2168
2167 In [8]: !echo $PATH
2169 In [8]: !echo $PATH
2168 a python variable
2170 a python variable
2169
2171
2170 In [9]: !echo $$PATH
2172 In [9]: !echo $$PATH
2171 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2173 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2172
2174
2173 (Magic.parse_options): escape $ so the shell doesn't evaluate
2175 (Magic.parse_options): escape $ so the shell doesn't evaluate
2174 things prematurely.
2176 things prematurely.
2175
2177
2176 * IPython/iplib.py (InteractiveShell.call_alias): added the
2178 * IPython/iplib.py (InteractiveShell.call_alias): added the
2177 ability for aliases to expand python variables via $.
2179 ability for aliases to expand python variables via $.
2178
2180
2179 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2181 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2180 system, now there's a @rehash/@rehashx pair of magics. These work
2182 system, now there's a @rehash/@rehashx pair of magics. These work
2181 like the csh rehash command, and can be invoked at any time. They
2183 like the csh rehash command, and can be invoked at any time. They
2182 build a table of aliases to everything in the user's $PATH
2184 build a table of aliases to everything in the user's $PATH
2183 (@rehash uses everything, @rehashx is slower but only adds
2185 (@rehash uses everything, @rehashx is slower but only adds
2184 executable files). With this, the pysh.py-based shell profile can
2186 executable files). With this, the pysh.py-based shell profile can
2185 now simply call rehash upon startup, and full access to all
2187 now simply call rehash upon startup, and full access to all
2186 programs in the user's path is obtained.
2188 programs in the user's path is obtained.
2187
2189
2188 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2190 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2189 functionality is now fully in place. I removed the old dynamic
2191 functionality is now fully in place. I removed the old dynamic
2190 code generation based approach, in favor of a much lighter one
2192 code generation based approach, in favor of a much lighter one
2191 based on a simple dict. The advantage is that this allows me to
2193 based on a simple dict. The advantage is that this allows me to
2192 now have thousands of aliases with negligible cost (unthinkable
2194 now have thousands of aliases with negligible cost (unthinkable
2193 with the old system).
2195 with the old system).
2194
2196
2195 2004-06-19 Fernando Perez <fperez@colorado.edu>
2197 2004-06-19 Fernando Perez <fperez@colorado.edu>
2196
2198
2197 * IPython/iplib.py (__init__): extended MagicCompleter class to
2199 * IPython/iplib.py (__init__): extended MagicCompleter class to
2198 also complete (last in priority) on user aliases.
2200 also complete (last in priority) on user aliases.
2199
2201
2200 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2202 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2201 call to eval.
2203 call to eval.
2202 (ItplNS.__init__): Added a new class which functions like Itpl,
2204 (ItplNS.__init__): Added a new class which functions like Itpl,
2203 but allows configuring the namespace for the evaluation to occur
2205 but allows configuring the namespace for the evaluation to occur
2204 in.
2206 in.
2205
2207
2206 2004-06-18 Fernando Perez <fperez@colorado.edu>
2208 2004-06-18 Fernando Perez <fperez@colorado.edu>
2207
2209
2208 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2210 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2209 better message when 'exit' or 'quit' are typed (a common newbie
2211 better message when 'exit' or 'quit' are typed (a common newbie
2210 confusion).
2212 confusion).
2211
2213
2212 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2214 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2213 check for Windows users.
2215 check for Windows users.
2214
2216
2215 * IPython/iplib.py (InteractiveShell.user_setup): removed
2217 * IPython/iplib.py (InteractiveShell.user_setup): removed
2216 disabling of colors for Windows. I'll test at runtime and issue a
2218 disabling of colors for Windows. I'll test at runtime and issue a
2217 warning if Gary's readline isn't found, as to nudge users to
2219 warning if Gary's readline isn't found, as to nudge users to
2218 download it.
2220 download it.
2219
2221
2220 2004-06-16 Fernando Perez <fperez@colorado.edu>
2222 2004-06-16 Fernando Perez <fperez@colorado.edu>
2221
2223
2222 * IPython/genutils.py (Stream.__init__): changed to print errors
2224 * IPython/genutils.py (Stream.__init__): changed to print errors
2223 to sys.stderr. I had a circular dependency here. Now it's
2225 to sys.stderr. I had a circular dependency here. Now it's
2224 possible to run ipython as IDLE's shell (consider this pre-alpha,
2226 possible to run ipython as IDLE's shell (consider this pre-alpha,
2225 since true stdout things end up in the starting terminal instead
2227 since true stdout things end up in the starting terminal instead
2226 of IDLE's out).
2228 of IDLE's out).
2227
2229
2228 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2230 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2229 users who haven't # updated their prompt_in2 definitions. Remove
2231 users who haven't # updated their prompt_in2 definitions. Remove
2230 eventually.
2232 eventually.
2231 (multiple_replace): added credit to original ASPN recipe.
2233 (multiple_replace): added credit to original ASPN recipe.
2232
2234
2233 2004-06-15 Fernando Perez <fperez@colorado.edu>
2235 2004-06-15 Fernando Perez <fperez@colorado.edu>
2234
2236
2235 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2237 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2236 list of auto-defined aliases.
2238 list of auto-defined aliases.
2237
2239
2238 2004-06-13 Fernando Perez <fperez@colorado.edu>
2240 2004-06-13 Fernando Perez <fperez@colorado.edu>
2239
2241
2240 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2242 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2241 install was really requested (so setup.py can be used for other
2243 install was really requested (so setup.py can be used for other
2242 things under Windows).
2244 things under Windows).
2243
2245
2244 2004-06-10 Fernando Perez <fperez@colorado.edu>
2246 2004-06-10 Fernando Perez <fperez@colorado.edu>
2245
2247
2246 * IPython/Logger.py (Logger.create_log): Manually remove any old
2248 * IPython/Logger.py (Logger.create_log): Manually remove any old
2247 backup, since os.remove may fail under Windows. Fixes bug
2249 backup, since os.remove may fail under Windows. Fixes bug
2248 reported by Thorsten.
2250 reported by Thorsten.
2249
2251
2250 2004-06-09 Fernando Perez <fperez@colorado.edu>
2252 2004-06-09 Fernando Perez <fperez@colorado.edu>
2251
2253
2252 * examples/example-embed.py: fixed all references to %n (replaced
2254 * examples/example-embed.py: fixed all references to %n (replaced
2253 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2255 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2254 for all examples and the manual as well.
2256 for all examples and the manual as well.
2255
2257
2256 2004-06-08 Fernando Perez <fperez@colorado.edu>
2258 2004-06-08 Fernando Perez <fperez@colorado.edu>
2257
2259
2258 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2260 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2259 alignment and color management. All 3 prompt subsystems now
2261 alignment and color management. All 3 prompt subsystems now
2260 inherit from BasePrompt.
2262 inherit from BasePrompt.
2261
2263
2262 * tools/release: updates for windows installer build and tag rpms
2264 * tools/release: updates for windows installer build and tag rpms
2263 with python version (since paths are fixed).
2265 with python version (since paths are fixed).
2264
2266
2265 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2267 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2266 which will become eventually obsolete. Also fixed the default
2268 which will become eventually obsolete. Also fixed the default
2267 prompt_in2 to use \D, so at least new users start with the correct
2269 prompt_in2 to use \D, so at least new users start with the correct
2268 defaults.
2270 defaults.
2269 WARNING: Users with existing ipythonrc files will need to apply
2271 WARNING: Users with existing ipythonrc files will need to apply
2270 this fix manually!
2272 this fix manually!
2271
2273
2272 * setup.py: make windows installer (.exe). This is finally the
2274 * setup.py: make windows installer (.exe). This is finally the
2273 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2275 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2274 which I hadn't included because it required Python 2.3 (or recent
2276 which I hadn't included because it required Python 2.3 (or recent
2275 distutils).
2277 distutils).
2276
2278
2277 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2279 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2278 usage of new '\D' escape.
2280 usage of new '\D' escape.
2279
2281
2280 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2282 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2281 lacks os.getuid())
2283 lacks os.getuid())
2282 (CachedOutput.set_colors): Added the ability to turn coloring
2284 (CachedOutput.set_colors): Added the ability to turn coloring
2283 on/off with @colors even for manually defined prompt colors. It
2285 on/off with @colors even for manually defined prompt colors. It
2284 uses a nasty global, but it works safely and via the generic color
2286 uses a nasty global, but it works safely and via the generic color
2285 handling mechanism.
2287 handling mechanism.
2286 (Prompt2.__init__): Introduced new escape '\D' for continuation
2288 (Prompt2.__init__): Introduced new escape '\D' for continuation
2287 prompts. It represents the counter ('\#') as dots.
2289 prompts. It represents the counter ('\#') as dots.
2288 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2290 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2289 need to update their ipythonrc files and replace '%n' with '\D' in
2291 need to update their ipythonrc files and replace '%n' with '\D' in
2290 their prompt_in2 settings everywhere. Sorry, but there's
2292 their prompt_in2 settings everywhere. Sorry, but there's
2291 otherwise no clean way to get all prompts to properly align. The
2293 otherwise no clean way to get all prompts to properly align. The
2292 ipythonrc shipped with IPython has been updated.
2294 ipythonrc shipped with IPython has been updated.
2293
2295
2294 2004-06-07 Fernando Perez <fperez@colorado.edu>
2296 2004-06-07 Fernando Perez <fperez@colorado.edu>
2295
2297
2296 * setup.py (isfile): Pass local_icons option to latex2html, so the
2298 * setup.py (isfile): Pass local_icons option to latex2html, so the
2297 resulting HTML file is self-contained. Thanks to
2299 resulting HTML file is self-contained. Thanks to
2298 dryice-AT-liu.com.cn for the tip.
2300 dryice-AT-liu.com.cn for the tip.
2299
2301
2300 * pysh.py: I created a new profile 'shell', which implements a
2302 * pysh.py: I created a new profile 'shell', which implements a
2301 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2303 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2302 system shell, nor will it become one anytime soon. It's mainly
2304 system shell, nor will it become one anytime soon. It's mainly
2303 meant to illustrate the use of the new flexible bash-like prompts.
2305 meant to illustrate the use of the new flexible bash-like prompts.
2304 I guess it could be used by hardy souls for true shell management,
2306 I guess it could be used by hardy souls for true shell management,
2305 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2307 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2306 profile. This uses the InterpreterExec extension provided by
2308 profile. This uses the InterpreterExec extension provided by
2307 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2309 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2308
2310
2309 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2311 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2310 auto-align itself with the length of the previous input prompt
2312 auto-align itself with the length of the previous input prompt
2311 (taking into account the invisible color escapes).
2313 (taking into account the invisible color escapes).
2312 (CachedOutput.__init__): Large restructuring of this class. Now
2314 (CachedOutput.__init__): Large restructuring of this class. Now
2313 all three prompts (primary1, primary2, output) are proper objects,
2315 all three prompts (primary1, primary2, output) are proper objects,
2314 managed by the 'parent' CachedOutput class. The code is still a
2316 managed by the 'parent' CachedOutput class. The code is still a
2315 bit hackish (all prompts share state via a pointer to the cache),
2317 bit hackish (all prompts share state via a pointer to the cache),
2316 but it's overall far cleaner than before.
2318 but it's overall far cleaner than before.
2317
2319
2318 * IPython/genutils.py (getoutputerror): modified to add verbose,
2320 * IPython/genutils.py (getoutputerror): modified to add verbose,
2319 debug and header options. This makes the interface of all getout*
2321 debug and header options. This makes the interface of all getout*
2320 functions uniform.
2322 functions uniform.
2321 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2323 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2322
2324
2323 * IPython/Magic.py (Magic.default_option): added a function to
2325 * IPython/Magic.py (Magic.default_option): added a function to
2324 allow registering default options for any magic command. This
2326 allow registering default options for any magic command. This
2325 makes it easy to have profiles which customize the magics globally
2327 makes it easy to have profiles which customize the magics globally
2326 for a certain use. The values set through this function are
2328 for a certain use. The values set through this function are
2327 picked up by the parse_options() method, which all magics should
2329 picked up by the parse_options() method, which all magics should
2328 use to parse their options.
2330 use to parse their options.
2329
2331
2330 * IPython/genutils.py (warn): modified the warnings framework to
2332 * IPython/genutils.py (warn): modified the warnings framework to
2331 use the Term I/O class. I'm trying to slowly unify all of
2333 use the Term I/O class. I'm trying to slowly unify all of
2332 IPython's I/O operations to pass through Term.
2334 IPython's I/O operations to pass through Term.
2333
2335
2334 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2336 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2335 the secondary prompt to correctly match the length of the primary
2337 the secondary prompt to correctly match the length of the primary
2336 one for any prompt. Now multi-line code will properly line up
2338 one for any prompt. Now multi-line code will properly line up
2337 even for path dependent prompts, such as the new ones available
2339 even for path dependent prompts, such as the new ones available
2338 via the prompt_specials.
2340 via the prompt_specials.
2339
2341
2340 2004-06-06 Fernando Perez <fperez@colorado.edu>
2342 2004-06-06 Fernando Perez <fperez@colorado.edu>
2341
2343
2342 * IPython/Prompts.py (prompt_specials): Added the ability to have
2344 * IPython/Prompts.py (prompt_specials): Added the ability to have
2343 bash-like special sequences in the prompts, which get
2345 bash-like special sequences in the prompts, which get
2344 automatically expanded. Things like hostname, current working
2346 automatically expanded. Things like hostname, current working
2345 directory and username are implemented already, but it's easy to
2347 directory and username are implemented already, but it's easy to
2346 add more in the future. Thanks to a patch by W.J. van der Laan
2348 add more in the future. Thanks to a patch by W.J. van der Laan
2347 <gnufnork-AT-hetdigitalegat.nl>
2349 <gnufnork-AT-hetdigitalegat.nl>
2348 (prompt_specials): Added color support for prompt strings, so
2350 (prompt_specials): Added color support for prompt strings, so
2349 users can define arbitrary color setups for their prompts.
2351 users can define arbitrary color setups for their prompts.
2350
2352
2351 2004-06-05 Fernando Perez <fperez@colorado.edu>
2353 2004-06-05 Fernando Perez <fperez@colorado.edu>
2352
2354
2353 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2355 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2354 code to load Gary Bishop's readline and configure it
2356 code to load Gary Bishop's readline and configure it
2355 automatically. Thanks to Gary for help on this.
2357 automatically. Thanks to Gary for help on this.
2356
2358
2357 2004-06-01 Fernando Perez <fperez@colorado.edu>
2359 2004-06-01 Fernando Perez <fperez@colorado.edu>
2358
2360
2359 * IPython/Logger.py (Logger.create_log): fix bug for logging
2361 * IPython/Logger.py (Logger.create_log): fix bug for logging
2360 with no filename (previous fix was incomplete).
2362 with no filename (previous fix was incomplete).
2361
2363
2362 2004-05-25 Fernando Perez <fperez@colorado.edu>
2364 2004-05-25 Fernando Perez <fperez@colorado.edu>
2363
2365
2364 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2366 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2365 parens would get passed to the shell.
2367 parens would get passed to the shell.
2366
2368
2367 2004-05-20 Fernando Perez <fperez@colorado.edu>
2369 2004-05-20 Fernando Perez <fperez@colorado.edu>
2368
2370
2369 * IPython/Magic.py (Magic.magic_prun): changed default profile
2371 * IPython/Magic.py (Magic.magic_prun): changed default profile
2370 sort order to 'time' (the more common profiling need).
2372 sort order to 'time' (the more common profiling need).
2371
2373
2372 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2374 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2373 so that source code shown is guaranteed in sync with the file on
2375 so that source code shown is guaranteed in sync with the file on
2374 disk (also changed in psource). Similar fix to the one for
2376 disk (also changed in psource). Similar fix to the one for
2375 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2377 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2376 <yann.ledu-AT-noos.fr>.
2378 <yann.ledu-AT-noos.fr>.
2377
2379
2378 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2380 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2379 with a single option would not be correctly parsed. Closes
2381 with a single option would not be correctly parsed. Closes
2380 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2382 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2381 introduced in 0.6.0 (on 2004-05-06).
2383 introduced in 0.6.0 (on 2004-05-06).
2382
2384
2383 2004-05-13 *** Released version 0.6.0
2385 2004-05-13 *** Released version 0.6.0
2384
2386
2385 2004-05-13 Fernando Perez <fperez@colorado.edu>
2387 2004-05-13 Fernando Perez <fperez@colorado.edu>
2386
2388
2387 * debian/: Added debian/ directory to CVS, so that debian support
2389 * debian/: Added debian/ directory to CVS, so that debian support
2388 is publicly accessible. The debian package is maintained by Jack
2390 is publicly accessible. The debian package is maintained by Jack
2389 Moffit <jack-AT-xiph.org>.
2391 Moffit <jack-AT-xiph.org>.
2390
2392
2391 * Documentation: included the notes about an ipython-based system
2393 * Documentation: included the notes about an ipython-based system
2392 shell (the hypothetical 'pysh') into the new_design.pdf document,
2394 shell (the hypothetical 'pysh') into the new_design.pdf document,
2393 so that these ideas get distributed to users along with the
2395 so that these ideas get distributed to users along with the
2394 official documentation.
2396 official documentation.
2395
2397
2396 2004-05-10 Fernando Perez <fperez@colorado.edu>
2398 2004-05-10 Fernando Perez <fperez@colorado.edu>
2397
2399
2398 * IPython/Logger.py (Logger.create_log): fix recently introduced
2400 * IPython/Logger.py (Logger.create_log): fix recently introduced
2399 bug (misindented line) where logstart would fail when not given an
2401 bug (misindented line) where logstart would fail when not given an
2400 explicit filename.
2402 explicit filename.
2401
2403
2402 2004-05-09 Fernando Perez <fperez@colorado.edu>
2404 2004-05-09 Fernando Perez <fperez@colorado.edu>
2403
2405
2404 * IPython/Magic.py (Magic.parse_options): skip system call when
2406 * IPython/Magic.py (Magic.parse_options): skip system call when
2405 there are no options to look for. Faster, cleaner for the common
2407 there are no options to look for. Faster, cleaner for the common
2406 case.
2408 case.
2407
2409
2408 * Documentation: many updates to the manual: describing Windows
2410 * Documentation: many updates to the manual: describing Windows
2409 support better, Gnuplot updates, credits, misc small stuff. Also
2411 support better, Gnuplot updates, credits, misc small stuff. Also
2410 updated the new_design doc a bit.
2412 updated the new_design doc a bit.
2411
2413
2412 2004-05-06 *** Released version 0.6.0.rc1
2414 2004-05-06 *** Released version 0.6.0.rc1
2413
2415
2414 2004-05-06 Fernando Perez <fperez@colorado.edu>
2416 2004-05-06 Fernando Perez <fperez@colorado.edu>
2415
2417
2416 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2418 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2417 operations to use the vastly more efficient list/''.join() method.
2419 operations to use the vastly more efficient list/''.join() method.
2418 (FormattedTB.text): Fix
2420 (FormattedTB.text): Fix
2419 http://www.scipy.net/roundup/ipython/issue12 - exception source
2421 http://www.scipy.net/roundup/ipython/issue12 - exception source
2420 extract not updated after reload. Thanks to Mike Salib
2422 extract not updated after reload. Thanks to Mike Salib
2421 <msalib-AT-mit.edu> for pinning the source of the problem.
2423 <msalib-AT-mit.edu> for pinning the source of the problem.
2422 Fortunately, the solution works inside ipython and doesn't require
2424 Fortunately, the solution works inside ipython and doesn't require
2423 any changes to python proper.
2425 any changes to python proper.
2424
2426
2425 * IPython/Magic.py (Magic.parse_options): Improved to process the
2427 * IPython/Magic.py (Magic.parse_options): Improved to process the
2426 argument list as a true shell would (by actually using the
2428 argument list as a true shell would (by actually using the
2427 underlying system shell). This way, all @magics automatically get
2429 underlying system shell). This way, all @magics automatically get
2428 shell expansion for variables. Thanks to a comment by Alex
2430 shell expansion for variables. Thanks to a comment by Alex
2429 Schmolck.
2431 Schmolck.
2430
2432
2431 2004-04-04 Fernando Perez <fperez@colorado.edu>
2433 2004-04-04 Fernando Perez <fperez@colorado.edu>
2432
2434
2433 * IPython/iplib.py (InteractiveShell.interact): Added a special
2435 * IPython/iplib.py (InteractiveShell.interact): Added a special
2434 trap for a debugger quit exception, which is basically impossible
2436 trap for a debugger quit exception, which is basically impossible
2435 to handle by normal mechanisms, given what pdb does to the stack.
2437 to handle by normal mechanisms, given what pdb does to the stack.
2436 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2438 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2437
2439
2438 2004-04-03 Fernando Perez <fperez@colorado.edu>
2440 2004-04-03 Fernando Perez <fperez@colorado.edu>
2439
2441
2440 * IPython/genutils.py (Term): Standardized the names of the Term
2442 * IPython/genutils.py (Term): Standardized the names of the Term
2441 class streams to cin/cout/cerr, following C++ naming conventions
2443 class streams to cin/cout/cerr, following C++ naming conventions
2442 (I can't use in/out/err because 'in' is not a valid attribute
2444 (I can't use in/out/err because 'in' is not a valid attribute
2443 name).
2445 name).
2444
2446
2445 * IPython/iplib.py (InteractiveShell.interact): don't increment
2447 * IPython/iplib.py (InteractiveShell.interact): don't increment
2446 the prompt if there's no user input. By Daniel 'Dang' Griffith
2448 the prompt if there's no user input. By Daniel 'Dang' Griffith
2447 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2449 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2448 Francois Pinard.
2450 Francois Pinard.
2449
2451
2450 2004-04-02 Fernando Perez <fperez@colorado.edu>
2452 2004-04-02 Fernando Perez <fperez@colorado.edu>
2451
2453
2452 * IPython/genutils.py (Stream.__init__): Modified to survive at
2454 * IPython/genutils.py (Stream.__init__): Modified to survive at
2453 least importing in contexts where stdin/out/err aren't true file
2455 least importing in contexts where stdin/out/err aren't true file
2454 objects, such as PyCrust (they lack fileno() and mode). However,
2456 objects, such as PyCrust (they lack fileno() and mode). However,
2455 the recovery facilities which rely on these things existing will
2457 the recovery facilities which rely on these things existing will
2456 not work.
2458 not work.
2457
2459
2458 2004-04-01 Fernando Perez <fperez@colorado.edu>
2460 2004-04-01 Fernando Perez <fperez@colorado.edu>
2459
2461
2460 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2462 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2461 use the new getoutputerror() function, so it properly
2463 use the new getoutputerror() function, so it properly
2462 distinguishes stdout/err.
2464 distinguishes stdout/err.
2463
2465
2464 * IPython/genutils.py (getoutputerror): added a function to
2466 * IPython/genutils.py (getoutputerror): added a function to
2465 capture separately the standard output and error of a command.
2467 capture separately the standard output and error of a command.
2466 After a comment from dang on the mailing lists. This code is
2468 After a comment from dang on the mailing lists. This code is
2467 basically a modified version of commands.getstatusoutput(), from
2469 basically a modified version of commands.getstatusoutput(), from
2468 the standard library.
2470 the standard library.
2469
2471
2470 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2472 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2471 '!!' as a special syntax (shorthand) to access @sx.
2473 '!!' as a special syntax (shorthand) to access @sx.
2472
2474
2473 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2475 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2474 command and return its output as a list split on '\n'.
2476 command and return its output as a list split on '\n'.
2475
2477
2476 2004-03-31 Fernando Perez <fperez@colorado.edu>
2478 2004-03-31 Fernando Perez <fperez@colorado.edu>
2477
2479
2478 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2480 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2479 method to dictionaries used as FakeModule instances if they lack
2481 method to dictionaries used as FakeModule instances if they lack
2480 it. At least pydoc in python2.3 breaks for runtime-defined
2482 it. At least pydoc in python2.3 breaks for runtime-defined
2481 functions without this hack. At some point I need to _really_
2483 functions without this hack. At some point I need to _really_
2482 understand what FakeModule is doing, because it's a gross hack.
2484 understand what FakeModule is doing, because it's a gross hack.
2483 But it solves Arnd's problem for now...
2485 But it solves Arnd's problem for now...
2484
2486
2485 2004-02-27 Fernando Perez <fperez@colorado.edu>
2487 2004-02-27 Fernando Perez <fperez@colorado.edu>
2486
2488
2487 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2489 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2488 mode would behave erratically. Also increased the number of
2490 mode would behave erratically. Also increased the number of
2489 possible logs in rotate mod to 999. Thanks to Rod Holland
2491 possible logs in rotate mod to 999. Thanks to Rod Holland
2490 <rhh@StructureLABS.com> for the report and fixes.
2492 <rhh@StructureLABS.com> for the report and fixes.
2491
2493
2492 2004-02-26 Fernando Perez <fperez@colorado.edu>
2494 2004-02-26 Fernando Perez <fperez@colorado.edu>
2493
2495
2494 * IPython/genutils.py (page): Check that the curses module really
2496 * IPython/genutils.py (page): Check that the curses module really
2495 has the initscr attribute before trying to use it. For some
2497 has the initscr attribute before trying to use it. For some
2496 reason, the Solaris curses module is missing this. I think this
2498 reason, the Solaris curses module is missing this. I think this
2497 should be considered a Solaris python bug, but I'm not sure.
2499 should be considered a Solaris python bug, but I'm not sure.
2498
2500
2499 2004-01-17 Fernando Perez <fperez@colorado.edu>
2501 2004-01-17 Fernando Perez <fperez@colorado.edu>
2500
2502
2501 * IPython/genutils.py (Stream.__init__): Changes to try to make
2503 * IPython/genutils.py (Stream.__init__): Changes to try to make
2502 ipython robust against stdin/out/err being closed by the user.
2504 ipython robust against stdin/out/err being closed by the user.
2503 This is 'user error' (and blocks a normal python session, at least
2505 This is 'user error' (and blocks a normal python session, at least
2504 the stdout case). However, Ipython should be able to survive such
2506 the stdout case). However, Ipython should be able to survive such
2505 instances of abuse as gracefully as possible. To simplify the
2507 instances of abuse as gracefully as possible. To simplify the
2506 coding and maintain compatibility with Gary Bishop's Term
2508 coding and maintain compatibility with Gary Bishop's Term
2507 contributions, I've made use of classmethods for this. I think
2509 contributions, I've made use of classmethods for this. I think
2508 this introduces a dependency on python 2.2.
2510 this introduces a dependency on python 2.2.
2509
2511
2510 2004-01-13 Fernando Perez <fperez@colorado.edu>
2512 2004-01-13 Fernando Perez <fperez@colorado.edu>
2511
2513
2512 * IPython/numutils.py (exp_safe): simplified the code a bit and
2514 * IPython/numutils.py (exp_safe): simplified the code a bit and
2513 removed the need for importing the kinds module altogether.
2515 removed the need for importing the kinds module altogether.
2514
2516
2515 2004-01-06 Fernando Perez <fperez@colorado.edu>
2517 2004-01-06 Fernando Perez <fperez@colorado.edu>
2516
2518
2517 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2519 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2518 a magic function instead, after some community feedback. No
2520 a magic function instead, after some community feedback. No
2519 special syntax will exist for it, but its name is deliberately
2521 special syntax will exist for it, but its name is deliberately
2520 very short.
2522 very short.
2521
2523
2522 2003-12-20 Fernando Perez <fperez@colorado.edu>
2524 2003-12-20 Fernando Perez <fperez@colorado.edu>
2523
2525
2524 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2526 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2525 new functionality, to automagically assign the result of a shell
2527 new functionality, to automagically assign the result of a shell
2526 command to a variable. I'll solicit some community feedback on
2528 command to a variable. I'll solicit some community feedback on
2527 this before making it permanent.
2529 this before making it permanent.
2528
2530
2529 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2531 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2530 requested about callables for which inspect couldn't obtain a
2532 requested about callables for which inspect couldn't obtain a
2531 proper argspec. Thanks to a crash report sent by Etienne
2533 proper argspec. Thanks to a crash report sent by Etienne
2532 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2534 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2533
2535
2534 2003-12-09 Fernando Perez <fperez@colorado.edu>
2536 2003-12-09 Fernando Perez <fperez@colorado.edu>
2535
2537
2536 * IPython/genutils.py (page): patch for the pager to work across
2538 * IPython/genutils.py (page): patch for the pager to work across
2537 various versions of Windows. By Gary Bishop.
2539 various versions of Windows. By Gary Bishop.
2538
2540
2539 2003-12-04 Fernando Perez <fperez@colorado.edu>
2541 2003-12-04 Fernando Perez <fperez@colorado.edu>
2540
2542
2541 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2543 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2542 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2544 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2543 While I tested this and it looks ok, there may still be corner
2545 While I tested this and it looks ok, there may still be corner
2544 cases I've missed.
2546 cases I've missed.
2545
2547
2546 2003-12-01 Fernando Perez <fperez@colorado.edu>
2548 2003-12-01 Fernando Perez <fperez@colorado.edu>
2547
2549
2548 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2550 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2549 where a line like 'p,q=1,2' would fail because the automagic
2551 where a line like 'p,q=1,2' would fail because the automagic
2550 system would be triggered for @p.
2552 system would be triggered for @p.
2551
2553
2552 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2554 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2553 cleanups, code unmodified.
2555 cleanups, code unmodified.
2554
2556
2555 * IPython/genutils.py (Term): added a class for IPython to handle
2557 * IPython/genutils.py (Term): added a class for IPython to handle
2556 output. In most cases it will just be a proxy for stdout/err, but
2558 output. In most cases it will just be a proxy for stdout/err, but
2557 having this allows modifications to be made for some platforms,
2559 having this allows modifications to be made for some platforms,
2558 such as handling color escapes under Windows. All of this code
2560 such as handling color escapes under Windows. All of this code
2559 was contributed by Gary Bishop, with minor modifications by me.
2561 was contributed by Gary Bishop, with minor modifications by me.
2560 The actual changes affect many files.
2562 The actual changes affect many files.
2561
2563
2562 2003-11-30 Fernando Perez <fperez@colorado.edu>
2564 2003-11-30 Fernando Perez <fperez@colorado.edu>
2563
2565
2564 * IPython/iplib.py (file_matches): new completion code, courtesy
2566 * IPython/iplib.py (file_matches): new completion code, courtesy
2565 of Jeff Collins. This enables filename completion again under
2567 of Jeff Collins. This enables filename completion again under
2566 python 2.3, which disabled it at the C level.
2568 python 2.3, which disabled it at the C level.
2567
2569
2568 2003-11-11 Fernando Perez <fperez@colorado.edu>
2570 2003-11-11 Fernando Perez <fperez@colorado.edu>
2569
2571
2570 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2572 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2571 for Numeric.array(map(...)), but often convenient.
2573 for Numeric.array(map(...)), but often convenient.
2572
2574
2573 2003-11-05 Fernando Perez <fperez@colorado.edu>
2575 2003-11-05 Fernando Perez <fperez@colorado.edu>
2574
2576
2575 * IPython/numutils.py (frange): Changed a call from int() to
2577 * IPython/numutils.py (frange): Changed a call from int() to
2576 int(round()) to prevent a problem reported with arange() in the
2578 int(round()) to prevent a problem reported with arange() in the
2577 numpy list.
2579 numpy list.
2578
2580
2579 2003-10-06 Fernando Perez <fperez@colorado.edu>
2581 2003-10-06 Fernando Perez <fperez@colorado.edu>
2580
2582
2581 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2583 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2582 prevent crashes if sys lacks an argv attribute (it happens with
2584 prevent crashes if sys lacks an argv attribute (it happens with
2583 embedded interpreters which build a bare-bones sys module).
2585 embedded interpreters which build a bare-bones sys module).
2584 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2586 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2585
2587
2586 2003-09-24 Fernando Perez <fperez@colorado.edu>
2588 2003-09-24 Fernando Perez <fperez@colorado.edu>
2587
2589
2588 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2590 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2589 to protect against poorly written user objects where __getattr__
2591 to protect against poorly written user objects where __getattr__
2590 raises exceptions other than AttributeError. Thanks to a bug
2592 raises exceptions other than AttributeError. Thanks to a bug
2591 report by Oliver Sander <osander-AT-gmx.de>.
2593 report by Oliver Sander <osander-AT-gmx.de>.
2592
2594
2593 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2595 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2594 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2596 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2595
2597
2596 2003-09-09 Fernando Perez <fperez@colorado.edu>
2598 2003-09-09 Fernando Perez <fperez@colorado.edu>
2597
2599
2598 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2600 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2599 unpacking a list whith a callable as first element would
2601 unpacking a list whith a callable as first element would
2600 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2602 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2601 Collins.
2603 Collins.
2602
2604
2603 2003-08-25 *** Released version 0.5.0
2605 2003-08-25 *** Released version 0.5.0
2604
2606
2605 2003-08-22 Fernando Perez <fperez@colorado.edu>
2607 2003-08-22 Fernando Perez <fperez@colorado.edu>
2606
2608
2607 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2609 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2608 improperly defined user exceptions. Thanks to feedback from Mark
2610 improperly defined user exceptions. Thanks to feedback from Mark
2609 Russell <mrussell-AT-verio.net>.
2611 Russell <mrussell-AT-verio.net>.
2610
2612
2611 2003-08-20 Fernando Perez <fperez@colorado.edu>
2613 2003-08-20 Fernando Perez <fperez@colorado.edu>
2612
2614
2613 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2615 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2614 printing so that it would print multi-line string forms starting
2616 printing so that it would print multi-line string forms starting
2615 with a new line. This way the formatting is better respected for
2617 with a new line. This way the formatting is better respected for
2616 objects which work hard to make nice string forms.
2618 objects which work hard to make nice string forms.
2617
2619
2618 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2620 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2619 autocall would overtake data access for objects with both
2621 autocall would overtake data access for objects with both
2620 __getitem__ and __call__.
2622 __getitem__ and __call__.
2621
2623
2622 2003-08-19 *** Released version 0.5.0-rc1
2624 2003-08-19 *** Released version 0.5.0-rc1
2623
2625
2624 2003-08-19 Fernando Perez <fperez@colorado.edu>
2626 2003-08-19 Fernando Perez <fperez@colorado.edu>
2625
2627
2626 * IPython/deep_reload.py (load_tail): single tiny change here
2628 * IPython/deep_reload.py (load_tail): single tiny change here
2627 seems to fix the long-standing bug of dreload() failing to work
2629 seems to fix the long-standing bug of dreload() failing to work
2628 for dotted names. But this module is pretty tricky, so I may have
2630 for dotted names. But this module is pretty tricky, so I may have
2629 missed some subtlety. Needs more testing!.
2631 missed some subtlety. Needs more testing!.
2630
2632
2631 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2633 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2632 exceptions which have badly implemented __str__ methods.
2634 exceptions which have badly implemented __str__ methods.
2633 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2635 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2634 which I've been getting reports about from Python 2.3 users. I
2636 which I've been getting reports about from Python 2.3 users. I
2635 wish I had a simple test case to reproduce the problem, so I could
2637 wish I had a simple test case to reproduce the problem, so I could
2636 either write a cleaner workaround or file a bug report if
2638 either write a cleaner workaround or file a bug report if
2637 necessary.
2639 necessary.
2638
2640
2639 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2641 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2640 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2642 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2641 a bug report by Tjabo Kloppenburg.
2643 a bug report by Tjabo Kloppenburg.
2642
2644
2643 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2645 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2644 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2646 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2645 seems rather unstable. Thanks to a bug report by Tjabo
2647 seems rather unstable. Thanks to a bug report by Tjabo
2646 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2648 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2647
2649
2648 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2650 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2649 this out soon because of the critical fixes in the inner loop for
2651 this out soon because of the critical fixes in the inner loop for
2650 generators.
2652 generators.
2651
2653
2652 * IPython/Magic.py (Magic.getargspec): removed. This (and
2654 * IPython/Magic.py (Magic.getargspec): removed. This (and
2653 _get_def) have been obsoleted by OInspect for a long time, I
2655 _get_def) have been obsoleted by OInspect for a long time, I
2654 hadn't noticed that they were dead code.
2656 hadn't noticed that they were dead code.
2655 (Magic._ofind): restored _ofind functionality for a few literals
2657 (Magic._ofind): restored _ofind functionality for a few literals
2656 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2658 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2657 for things like "hello".capitalize?, since that would require a
2659 for things like "hello".capitalize?, since that would require a
2658 potentially dangerous eval() again.
2660 potentially dangerous eval() again.
2659
2661
2660 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2662 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2661 logic a bit more to clean up the escapes handling and minimize the
2663 logic a bit more to clean up the escapes handling and minimize the
2662 use of _ofind to only necessary cases. The interactive 'feel' of
2664 use of _ofind to only necessary cases. The interactive 'feel' of
2663 IPython should have improved quite a bit with the changes in
2665 IPython should have improved quite a bit with the changes in
2664 _prefilter and _ofind (besides being far safer than before).
2666 _prefilter and _ofind (besides being far safer than before).
2665
2667
2666 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2668 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2667 obscure, never reported). Edit would fail to find the object to
2669 obscure, never reported). Edit would fail to find the object to
2668 edit under some circumstances.
2670 edit under some circumstances.
2669 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2671 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2670 which were causing double-calling of generators. Those eval calls
2672 which were causing double-calling of generators. Those eval calls
2671 were _very_ dangerous, since code with side effects could be
2673 were _very_ dangerous, since code with side effects could be
2672 triggered. As they say, 'eval is evil'... These were the
2674 triggered. As they say, 'eval is evil'... These were the
2673 nastiest evals in IPython. Besides, _ofind is now far simpler,
2675 nastiest evals in IPython. Besides, _ofind is now far simpler,
2674 and it should also be quite a bit faster. Its use of inspect is
2676 and it should also be quite a bit faster. Its use of inspect is
2675 also safer, so perhaps some of the inspect-related crashes I've
2677 also safer, so perhaps some of the inspect-related crashes I've
2676 seen lately with Python 2.3 might be taken care of. That will
2678 seen lately with Python 2.3 might be taken care of. That will
2677 need more testing.
2679 need more testing.
2678
2680
2679 2003-08-17 Fernando Perez <fperez@colorado.edu>
2681 2003-08-17 Fernando Perez <fperez@colorado.edu>
2680
2682
2681 * IPython/iplib.py (InteractiveShell._prefilter): significant
2683 * IPython/iplib.py (InteractiveShell._prefilter): significant
2682 simplifications to the logic for handling user escapes. Faster
2684 simplifications to the logic for handling user escapes. Faster
2683 and simpler code.
2685 and simpler code.
2684
2686
2685 2003-08-14 Fernando Perez <fperez@colorado.edu>
2687 2003-08-14 Fernando Perez <fperez@colorado.edu>
2686
2688
2687 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2689 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2688 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2690 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2689 but it should be quite a bit faster. And the recursive version
2691 but it should be quite a bit faster. And the recursive version
2690 generated O(log N) intermediate storage for all rank>1 arrays,
2692 generated O(log N) intermediate storage for all rank>1 arrays,
2691 even if they were contiguous.
2693 even if they were contiguous.
2692 (l1norm): Added this function.
2694 (l1norm): Added this function.
2693 (norm): Added this function for arbitrary norms (including
2695 (norm): Added this function for arbitrary norms (including
2694 l-infinity). l1 and l2 are still special cases for convenience
2696 l-infinity). l1 and l2 are still special cases for convenience
2695 and speed.
2697 and speed.
2696
2698
2697 2003-08-03 Fernando Perez <fperez@colorado.edu>
2699 2003-08-03 Fernando Perez <fperez@colorado.edu>
2698
2700
2699 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2701 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2700 exceptions, which now raise PendingDeprecationWarnings in Python
2702 exceptions, which now raise PendingDeprecationWarnings in Python
2701 2.3. There were some in Magic and some in Gnuplot2.
2703 2.3. There were some in Magic and some in Gnuplot2.
2702
2704
2703 2003-06-30 Fernando Perez <fperez@colorado.edu>
2705 2003-06-30 Fernando Perez <fperez@colorado.edu>
2704
2706
2705 * IPython/genutils.py (page): modified to call curses only for
2707 * IPython/genutils.py (page): modified to call curses only for
2706 terminals where TERM=='xterm'. After problems under many other
2708 terminals where TERM=='xterm'. After problems under many other
2707 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2709 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2708
2710
2709 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2711 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2710 would be triggered when readline was absent. This was just an old
2712 would be triggered when readline was absent. This was just an old
2711 debugging statement I'd forgotten to take out.
2713 debugging statement I'd forgotten to take out.
2712
2714
2713 2003-06-20 Fernando Perez <fperez@colorado.edu>
2715 2003-06-20 Fernando Perez <fperez@colorado.edu>
2714
2716
2715 * IPython/genutils.py (clock): modified to return only user time
2717 * IPython/genutils.py (clock): modified to return only user time
2716 (not counting system time), after a discussion on scipy. While
2718 (not counting system time), after a discussion on scipy. While
2717 system time may be a useful quantity occasionally, it may much
2719 system time may be a useful quantity occasionally, it may much
2718 more easily be skewed by occasional swapping or other similar
2720 more easily be skewed by occasional swapping or other similar
2719 activity.
2721 activity.
2720
2722
2721 2003-06-05 Fernando Perez <fperez@colorado.edu>
2723 2003-06-05 Fernando Perez <fperez@colorado.edu>
2722
2724
2723 * IPython/numutils.py (identity): new function, for building
2725 * IPython/numutils.py (identity): new function, for building
2724 arbitrary rank Kronecker deltas (mostly backwards compatible with
2726 arbitrary rank Kronecker deltas (mostly backwards compatible with
2725 Numeric.identity)
2727 Numeric.identity)
2726
2728
2727 2003-06-03 Fernando Perez <fperez@colorado.edu>
2729 2003-06-03 Fernando Perez <fperez@colorado.edu>
2728
2730
2729 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2731 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2730 arguments passed to magics with spaces, to allow trailing '\' to
2732 arguments passed to magics with spaces, to allow trailing '\' to
2731 work normally (mainly for Windows users).
2733 work normally (mainly for Windows users).
2732
2734
2733 2003-05-29 Fernando Perez <fperez@colorado.edu>
2735 2003-05-29 Fernando Perez <fperez@colorado.edu>
2734
2736
2735 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2737 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2736 instead of pydoc.help. This fixes a bizarre behavior where
2738 instead of pydoc.help. This fixes a bizarre behavior where
2737 printing '%s' % locals() would trigger the help system. Now
2739 printing '%s' % locals() would trigger the help system. Now
2738 ipython behaves like normal python does.
2740 ipython behaves like normal python does.
2739
2741
2740 Note that if one does 'from pydoc import help', the bizarre
2742 Note that if one does 'from pydoc import help', the bizarre
2741 behavior returns, but this will also happen in normal python, so
2743 behavior returns, but this will also happen in normal python, so
2742 it's not an ipython bug anymore (it has to do with how pydoc.help
2744 it's not an ipython bug anymore (it has to do with how pydoc.help
2743 is implemented).
2745 is implemented).
2744
2746
2745 2003-05-22 Fernando Perez <fperez@colorado.edu>
2747 2003-05-22 Fernando Perez <fperez@colorado.edu>
2746
2748
2747 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2749 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2748 return [] instead of None when nothing matches, also match to end
2750 return [] instead of None when nothing matches, also match to end
2749 of line. Patch by Gary Bishop.
2751 of line. Patch by Gary Bishop.
2750
2752
2751 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2753 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2752 protection as before, for files passed on the command line. This
2754 protection as before, for files passed on the command line. This
2753 prevents the CrashHandler from kicking in if user files call into
2755 prevents the CrashHandler from kicking in if user files call into
2754 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2756 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2755 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2757 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2756
2758
2757 2003-05-20 *** Released version 0.4.0
2759 2003-05-20 *** Released version 0.4.0
2758
2760
2759 2003-05-20 Fernando Perez <fperez@colorado.edu>
2761 2003-05-20 Fernando Perez <fperez@colorado.edu>
2760
2762
2761 * setup.py: added support for manpages. It's a bit hackish b/c of
2763 * setup.py: added support for manpages. It's a bit hackish b/c of
2762 a bug in the way the bdist_rpm distutils target handles gzipped
2764 a bug in the way the bdist_rpm distutils target handles gzipped
2763 manpages, but it works. After a patch by Jack.
2765 manpages, but it works. After a patch by Jack.
2764
2766
2765 2003-05-19 Fernando Perez <fperez@colorado.edu>
2767 2003-05-19 Fernando Perez <fperez@colorado.edu>
2766
2768
2767 * IPython/numutils.py: added a mockup of the kinds module, since
2769 * IPython/numutils.py: added a mockup of the kinds module, since
2768 it was recently removed from Numeric. This way, numutils will
2770 it was recently removed from Numeric. This way, numutils will
2769 work for all users even if they are missing kinds.
2771 work for all users even if they are missing kinds.
2770
2772
2771 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2773 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2772 failure, which can occur with SWIG-wrapped extensions. After a
2774 failure, which can occur with SWIG-wrapped extensions. After a
2773 crash report from Prabhu.
2775 crash report from Prabhu.
2774
2776
2775 2003-05-16 Fernando Perez <fperez@colorado.edu>
2777 2003-05-16 Fernando Perez <fperez@colorado.edu>
2776
2778
2777 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2779 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2778 protect ipython from user code which may call directly
2780 protect ipython from user code which may call directly
2779 sys.excepthook (this looks like an ipython crash to the user, even
2781 sys.excepthook (this looks like an ipython crash to the user, even
2780 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2782 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2781 This is especially important to help users of WxWindows, but may
2783 This is especially important to help users of WxWindows, but may
2782 also be useful in other cases.
2784 also be useful in other cases.
2783
2785
2784 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2786 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2785 an optional tb_offset to be specified, and to preserve exception
2787 an optional tb_offset to be specified, and to preserve exception
2786 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2788 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2787
2789
2788 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2790 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2789
2791
2790 2003-05-15 Fernando Perez <fperez@colorado.edu>
2792 2003-05-15 Fernando Perez <fperez@colorado.edu>
2791
2793
2792 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2794 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2793 installing for a new user under Windows.
2795 installing for a new user under Windows.
2794
2796
2795 2003-05-12 Fernando Perez <fperez@colorado.edu>
2797 2003-05-12 Fernando Perez <fperez@colorado.edu>
2796
2798
2797 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2799 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2798 handler for Emacs comint-based lines. Currently it doesn't do
2800 handler for Emacs comint-based lines. Currently it doesn't do
2799 much (but importantly, it doesn't update the history cache). In
2801 much (but importantly, it doesn't update the history cache). In
2800 the future it may be expanded if Alex needs more functionality
2802 the future it may be expanded if Alex needs more functionality
2801 there.
2803 there.
2802
2804
2803 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2805 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2804 info to crash reports.
2806 info to crash reports.
2805
2807
2806 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2808 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2807 just like Python's -c. Also fixed crash with invalid -color
2809 just like Python's -c. Also fixed crash with invalid -color
2808 option value at startup. Thanks to Will French
2810 option value at startup. Thanks to Will French
2809 <wfrench-AT-bestweb.net> for the bug report.
2811 <wfrench-AT-bestweb.net> for the bug report.
2810
2812
2811 2003-05-09 Fernando Perez <fperez@colorado.edu>
2813 2003-05-09 Fernando Perez <fperez@colorado.edu>
2812
2814
2813 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2815 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2814 to EvalDict (it's a mapping, after all) and simplified its code
2816 to EvalDict (it's a mapping, after all) and simplified its code
2815 quite a bit, after a nice discussion on c.l.py where Gustavo
2817 quite a bit, after a nice discussion on c.l.py where Gustavo
2816 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2818 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2817
2819
2818 2003-04-30 Fernando Perez <fperez@colorado.edu>
2820 2003-04-30 Fernando Perez <fperez@colorado.edu>
2819
2821
2820 * IPython/genutils.py (timings_out): modified it to reduce its
2822 * IPython/genutils.py (timings_out): modified it to reduce its
2821 overhead in the common reps==1 case.
2823 overhead in the common reps==1 case.
2822
2824
2823 2003-04-29 Fernando Perez <fperez@colorado.edu>
2825 2003-04-29 Fernando Perez <fperez@colorado.edu>
2824
2826
2825 * IPython/genutils.py (timings_out): Modified to use the resource
2827 * IPython/genutils.py (timings_out): Modified to use the resource
2826 module, which avoids the wraparound problems of time.clock().
2828 module, which avoids the wraparound problems of time.clock().
2827
2829
2828 2003-04-17 *** Released version 0.2.15pre4
2830 2003-04-17 *** Released version 0.2.15pre4
2829
2831
2830 2003-04-17 Fernando Perez <fperez@colorado.edu>
2832 2003-04-17 Fernando Perez <fperez@colorado.edu>
2831
2833
2832 * setup.py (scriptfiles): Split windows-specific stuff over to a
2834 * setup.py (scriptfiles): Split windows-specific stuff over to a
2833 separate file, in an attempt to have a Windows GUI installer.
2835 separate file, in an attempt to have a Windows GUI installer.
2834 That didn't work, but part of the groundwork is done.
2836 That didn't work, but part of the groundwork is done.
2835
2837
2836 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2838 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2837 indent/unindent with 4 spaces. Particularly useful in combination
2839 indent/unindent with 4 spaces. Particularly useful in combination
2838 with the new auto-indent option.
2840 with the new auto-indent option.
2839
2841
2840 2003-04-16 Fernando Perez <fperez@colorado.edu>
2842 2003-04-16 Fernando Perez <fperez@colorado.edu>
2841
2843
2842 * IPython/Magic.py: various replacements of self.rc for
2844 * IPython/Magic.py: various replacements of self.rc for
2843 self.shell.rc. A lot more remains to be done to fully disentangle
2845 self.shell.rc. A lot more remains to be done to fully disentangle
2844 this class from the main Shell class.
2846 this class from the main Shell class.
2845
2847
2846 * IPython/GnuplotRuntime.py: added checks for mouse support so
2848 * IPython/GnuplotRuntime.py: added checks for mouse support so
2847 that we don't try to enable it if the current gnuplot doesn't
2849 that we don't try to enable it if the current gnuplot doesn't
2848 really support it. Also added checks so that we don't try to
2850 really support it. Also added checks so that we don't try to
2849 enable persist under Windows (where Gnuplot doesn't recognize the
2851 enable persist under Windows (where Gnuplot doesn't recognize the
2850 option).
2852 option).
2851
2853
2852 * IPython/iplib.py (InteractiveShell.interact): Added optional
2854 * IPython/iplib.py (InteractiveShell.interact): Added optional
2853 auto-indenting code, after a patch by King C. Shu
2855 auto-indenting code, after a patch by King C. Shu
2854 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2856 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2855 get along well with pasting indented code. If I ever figure out
2857 get along well with pasting indented code. If I ever figure out
2856 how to make that part go well, it will become on by default.
2858 how to make that part go well, it will become on by default.
2857
2859
2858 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2860 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2859 crash ipython if there was an unmatched '%' in the user's prompt
2861 crash ipython if there was an unmatched '%' in the user's prompt
2860 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2862 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2861
2863
2862 * IPython/iplib.py (InteractiveShell.interact): removed the
2864 * IPython/iplib.py (InteractiveShell.interact): removed the
2863 ability to ask the user whether he wants to crash or not at the
2865 ability to ask the user whether he wants to crash or not at the
2864 'last line' exception handler. Calling functions at that point
2866 'last line' exception handler. Calling functions at that point
2865 changes the stack, and the error reports would have incorrect
2867 changes the stack, and the error reports would have incorrect
2866 tracebacks.
2868 tracebacks.
2867
2869
2868 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2870 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2869 pass through a peger a pretty-printed form of any object. After a
2871 pass through a peger a pretty-printed form of any object. After a
2870 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2872 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2871
2873
2872 2003-04-14 Fernando Perez <fperez@colorado.edu>
2874 2003-04-14 Fernando Perez <fperez@colorado.edu>
2873
2875
2874 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2876 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2875 all files in ~ would be modified at first install (instead of
2877 all files in ~ would be modified at first install (instead of
2876 ~/.ipython). This could be potentially disastrous, as the
2878 ~/.ipython). This could be potentially disastrous, as the
2877 modification (make line-endings native) could damage binary files.
2879 modification (make line-endings native) could damage binary files.
2878
2880
2879 2003-04-10 Fernando Perez <fperez@colorado.edu>
2881 2003-04-10 Fernando Perez <fperez@colorado.edu>
2880
2882
2881 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2883 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2882 handle only lines which are invalid python. This now means that
2884 handle only lines which are invalid python. This now means that
2883 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2885 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2884 for the bug report.
2886 for the bug report.
2885
2887
2886 2003-04-01 Fernando Perez <fperez@colorado.edu>
2888 2003-04-01 Fernando Perez <fperez@colorado.edu>
2887
2889
2888 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2890 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2889 where failing to set sys.last_traceback would crash pdb.pm().
2891 where failing to set sys.last_traceback would crash pdb.pm().
2890 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2892 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2891 report.
2893 report.
2892
2894
2893 2003-03-25 Fernando Perez <fperez@colorado.edu>
2895 2003-03-25 Fernando Perez <fperez@colorado.edu>
2894
2896
2895 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2897 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2896 before printing it (it had a lot of spurious blank lines at the
2898 before printing it (it had a lot of spurious blank lines at the
2897 end).
2899 end).
2898
2900
2899 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2901 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2900 output would be sent 21 times! Obviously people don't use this
2902 output would be sent 21 times! Obviously people don't use this
2901 too often, or I would have heard about it.
2903 too often, or I would have heard about it.
2902
2904
2903 2003-03-24 Fernando Perez <fperez@colorado.edu>
2905 2003-03-24 Fernando Perez <fperez@colorado.edu>
2904
2906
2905 * setup.py (scriptfiles): renamed the data_files parameter from
2907 * setup.py (scriptfiles): renamed the data_files parameter from
2906 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2908 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2907 for the patch.
2909 for the patch.
2908
2910
2909 2003-03-20 Fernando Perez <fperez@colorado.edu>
2911 2003-03-20 Fernando Perez <fperez@colorado.edu>
2910
2912
2911 * IPython/genutils.py (error): added error() and fatal()
2913 * IPython/genutils.py (error): added error() and fatal()
2912 functions.
2914 functions.
2913
2915
2914 2003-03-18 *** Released version 0.2.15pre3
2916 2003-03-18 *** Released version 0.2.15pre3
2915
2917
2916 2003-03-18 Fernando Perez <fperez@colorado.edu>
2918 2003-03-18 Fernando Perez <fperez@colorado.edu>
2917
2919
2918 * setupext/install_data_ext.py
2920 * setupext/install_data_ext.py
2919 (install_data_ext.initialize_options): Class contributed by Jack
2921 (install_data_ext.initialize_options): Class contributed by Jack
2920 Moffit for fixing the old distutils hack. He is sending this to
2922 Moffit for fixing the old distutils hack. He is sending this to
2921 the distutils folks so in the future we may not need it as a
2923 the distutils folks so in the future we may not need it as a
2922 private fix.
2924 private fix.
2923
2925
2924 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2926 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2925 changes for Debian packaging. See his patch for full details.
2927 changes for Debian packaging. See his patch for full details.
2926 The old distutils hack of making the ipythonrc* files carry a
2928 The old distutils hack of making the ipythonrc* files carry a
2927 bogus .py extension is gone, at last. Examples were moved to a
2929 bogus .py extension is gone, at last. Examples were moved to a
2928 separate subdir under doc/, and the separate executable scripts
2930 separate subdir under doc/, and the separate executable scripts
2929 now live in their own directory. Overall a great cleanup. The
2931 now live in their own directory. Overall a great cleanup. The
2930 manual was updated to use the new files, and setup.py has been
2932 manual was updated to use the new files, and setup.py has been
2931 fixed for this setup.
2933 fixed for this setup.
2932
2934
2933 * IPython/PyColorize.py (Parser.usage): made non-executable and
2935 * IPython/PyColorize.py (Parser.usage): made non-executable and
2934 created a pycolor wrapper around it to be included as a script.
2936 created a pycolor wrapper around it to be included as a script.
2935
2937
2936 2003-03-12 *** Released version 0.2.15pre2
2938 2003-03-12 *** Released version 0.2.15pre2
2937
2939
2938 2003-03-12 Fernando Perez <fperez@colorado.edu>
2940 2003-03-12 Fernando Perez <fperez@colorado.edu>
2939
2941
2940 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2942 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2941 long-standing problem with garbage characters in some terminals.
2943 long-standing problem with garbage characters in some terminals.
2942 The issue was really that the \001 and \002 escapes must _only_ be
2944 The issue was really that the \001 and \002 escapes must _only_ be
2943 passed to input prompts (which call readline), but _never_ to
2945 passed to input prompts (which call readline), but _never_ to
2944 normal text to be printed on screen. I changed ColorANSI to have
2946 normal text to be printed on screen. I changed ColorANSI to have
2945 two classes: TermColors and InputTermColors, each with the
2947 two classes: TermColors and InputTermColors, each with the
2946 appropriate escapes for input prompts or normal text. The code in
2948 appropriate escapes for input prompts or normal text. The code in
2947 Prompts.py got slightly more complicated, but this very old and
2949 Prompts.py got slightly more complicated, but this very old and
2948 annoying bug is finally fixed.
2950 annoying bug is finally fixed.
2949
2951
2950 All the credit for nailing down the real origin of this problem
2952 All the credit for nailing down the real origin of this problem
2951 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2953 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2952 *Many* thanks to him for spending quite a bit of effort on this.
2954 *Many* thanks to him for spending quite a bit of effort on this.
2953
2955
2954 2003-03-05 *** Released version 0.2.15pre1
2956 2003-03-05 *** Released version 0.2.15pre1
2955
2957
2956 2003-03-03 Fernando Perez <fperez@colorado.edu>
2958 2003-03-03 Fernando Perez <fperez@colorado.edu>
2957
2959
2958 * IPython/FakeModule.py: Moved the former _FakeModule to a
2960 * IPython/FakeModule.py: Moved the former _FakeModule to a
2959 separate file, because it's also needed by Magic (to fix a similar
2961 separate file, because it's also needed by Magic (to fix a similar
2960 pickle-related issue in @run).
2962 pickle-related issue in @run).
2961
2963
2962 2003-03-02 Fernando Perez <fperez@colorado.edu>
2964 2003-03-02 Fernando Perez <fperez@colorado.edu>
2963
2965
2964 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2966 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2965 the autocall option at runtime.
2967 the autocall option at runtime.
2966 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2968 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2967 across Magic.py to start separating Magic from InteractiveShell.
2969 across Magic.py to start separating Magic from InteractiveShell.
2968 (Magic._ofind): Fixed to return proper namespace for dotted
2970 (Magic._ofind): Fixed to return proper namespace for dotted
2969 names. Before, a dotted name would always return 'not currently
2971 names. Before, a dotted name would always return 'not currently
2970 defined', because it would find the 'parent'. s.x would be found,
2972 defined', because it would find the 'parent'. s.x would be found,
2971 but since 'x' isn't defined by itself, it would get confused.
2973 but since 'x' isn't defined by itself, it would get confused.
2972 (Magic.magic_run): Fixed pickling problems reported by Ralf
2974 (Magic.magic_run): Fixed pickling problems reported by Ralf
2973 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2975 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2974 that I'd used when Mike Heeter reported similar issues at the
2976 that I'd used when Mike Heeter reported similar issues at the
2975 top-level, but now for @run. It boils down to injecting the
2977 top-level, but now for @run. It boils down to injecting the
2976 namespace where code is being executed with something that looks
2978 namespace where code is being executed with something that looks
2977 enough like a module to fool pickle.dump(). Since a pickle stores
2979 enough like a module to fool pickle.dump(). Since a pickle stores
2978 a named reference to the importing module, we need this for
2980 a named reference to the importing module, we need this for
2979 pickles to save something sensible.
2981 pickles to save something sensible.
2980
2982
2981 * IPython/ipmaker.py (make_IPython): added an autocall option.
2983 * IPython/ipmaker.py (make_IPython): added an autocall option.
2982
2984
2983 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2985 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2984 the auto-eval code. Now autocalling is an option, and the code is
2986 the auto-eval code. Now autocalling is an option, and the code is
2985 also vastly safer. There is no more eval() involved at all.
2987 also vastly safer. There is no more eval() involved at all.
2986
2988
2987 2003-03-01 Fernando Perez <fperez@colorado.edu>
2989 2003-03-01 Fernando Perez <fperez@colorado.edu>
2988
2990
2989 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2991 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2990 dict with named keys instead of a tuple.
2992 dict with named keys instead of a tuple.
2991
2993
2992 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2994 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2993
2995
2994 * setup.py (make_shortcut): Fixed message about directories
2996 * setup.py (make_shortcut): Fixed message about directories
2995 created during Windows installation (the directories were ok, just
2997 created during Windows installation (the directories were ok, just
2996 the printed message was misleading). Thanks to Chris Liechti
2998 the printed message was misleading). Thanks to Chris Liechti
2997 <cliechti-AT-gmx.net> for the heads up.
2999 <cliechti-AT-gmx.net> for the heads up.
2998
3000
2999 2003-02-21 Fernando Perez <fperez@colorado.edu>
3001 2003-02-21 Fernando Perez <fperez@colorado.edu>
3000
3002
3001 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3003 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3002 of ValueError exception when checking for auto-execution. This
3004 of ValueError exception when checking for auto-execution. This
3003 one is raised by things like Numeric arrays arr.flat when the
3005 one is raised by things like Numeric arrays arr.flat when the
3004 array is non-contiguous.
3006 array is non-contiguous.
3005
3007
3006 2003-01-31 Fernando Perez <fperez@colorado.edu>
3008 2003-01-31 Fernando Perez <fperez@colorado.edu>
3007
3009
3008 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3010 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3009 not return any value at all (even though the command would get
3011 not return any value at all (even though the command would get
3010 executed).
3012 executed).
3011 (xsys): Flush stdout right after printing the command to ensure
3013 (xsys): Flush stdout right after printing the command to ensure
3012 proper ordering of commands and command output in the total
3014 proper ordering of commands and command output in the total
3013 output.
3015 output.
3014 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3016 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3015 system/getoutput as defaults. The old ones are kept for
3017 system/getoutput as defaults. The old ones are kept for
3016 compatibility reasons, so no code which uses this library needs
3018 compatibility reasons, so no code which uses this library needs
3017 changing.
3019 changing.
3018
3020
3019 2003-01-27 *** Released version 0.2.14
3021 2003-01-27 *** Released version 0.2.14
3020
3022
3021 2003-01-25 Fernando Perez <fperez@colorado.edu>
3023 2003-01-25 Fernando Perez <fperez@colorado.edu>
3022
3024
3023 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3025 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3024 functions defined in previous edit sessions could not be re-edited
3026 functions defined in previous edit sessions could not be re-edited
3025 (because the temp files were immediately removed). Now temp files
3027 (because the temp files were immediately removed). Now temp files
3026 are removed only at IPython's exit.
3028 are removed only at IPython's exit.
3027 (Magic.magic_run): Improved @run to perform shell-like expansions
3029 (Magic.magic_run): Improved @run to perform shell-like expansions
3028 on its arguments (~users and $VARS). With this, @run becomes more
3030 on its arguments (~users and $VARS). With this, @run becomes more
3029 like a normal command-line.
3031 like a normal command-line.
3030
3032
3031 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3033 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3032 bugs related to embedding and cleaned up that code. A fairly
3034 bugs related to embedding and cleaned up that code. A fairly
3033 important one was the impossibility to access the global namespace
3035 important one was the impossibility to access the global namespace
3034 through the embedded IPython (only local variables were visible).
3036 through the embedded IPython (only local variables were visible).
3035
3037
3036 2003-01-14 Fernando Perez <fperez@colorado.edu>
3038 2003-01-14 Fernando Perez <fperez@colorado.edu>
3037
3039
3038 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3040 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3039 auto-calling to be a bit more conservative. Now it doesn't get
3041 auto-calling to be a bit more conservative. Now it doesn't get
3040 triggered if any of '!=()<>' are in the rest of the input line, to
3042 triggered if any of '!=()<>' are in the rest of the input line, to
3041 allow comparing callables. Thanks to Alex for the heads up.
3043 allow comparing callables. Thanks to Alex for the heads up.
3042
3044
3043 2003-01-07 Fernando Perez <fperez@colorado.edu>
3045 2003-01-07 Fernando Perez <fperez@colorado.edu>
3044
3046
3045 * IPython/genutils.py (page): fixed estimation of the number of
3047 * IPython/genutils.py (page): fixed estimation of the number of
3046 lines in a string to be paged to simply count newlines. This
3048 lines in a string to be paged to simply count newlines. This
3047 prevents over-guessing due to embedded escape sequences. A better
3049 prevents over-guessing due to embedded escape sequences. A better
3048 long-term solution would involve stripping out the control chars
3050 long-term solution would involve stripping out the control chars
3049 for the count, but it's potentially so expensive I just don't
3051 for the count, but it's potentially so expensive I just don't
3050 think it's worth doing.
3052 think it's worth doing.
3051
3053
3052 2002-12-19 *** Released version 0.2.14pre50
3054 2002-12-19 *** Released version 0.2.14pre50
3053
3055
3054 2002-12-19 Fernando Perez <fperez@colorado.edu>
3056 2002-12-19 Fernando Perez <fperez@colorado.edu>
3055
3057
3056 * tools/release (version): Changed release scripts to inform
3058 * tools/release (version): Changed release scripts to inform
3057 Andrea and build a NEWS file with a list of recent changes.
3059 Andrea and build a NEWS file with a list of recent changes.
3058
3060
3059 * IPython/ColorANSI.py (__all__): changed terminal detection
3061 * IPython/ColorANSI.py (__all__): changed terminal detection
3060 code. Seems to work better for xterms without breaking
3062 code. Seems to work better for xterms without breaking
3061 konsole. Will need more testing to determine if WinXP and Mac OSX
3063 konsole. Will need more testing to determine if WinXP and Mac OSX
3062 also work ok.
3064 also work ok.
3063
3065
3064 2002-12-18 *** Released version 0.2.14pre49
3066 2002-12-18 *** Released version 0.2.14pre49
3065
3067
3066 2002-12-18 Fernando Perez <fperez@colorado.edu>
3068 2002-12-18 Fernando Perez <fperez@colorado.edu>
3067
3069
3068 * Docs: added new info about Mac OSX, from Andrea.
3070 * Docs: added new info about Mac OSX, from Andrea.
3069
3071
3070 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3072 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3071 allow direct plotting of python strings whose format is the same
3073 allow direct plotting of python strings whose format is the same
3072 of gnuplot data files.
3074 of gnuplot data files.
3073
3075
3074 2002-12-16 Fernando Perez <fperez@colorado.edu>
3076 2002-12-16 Fernando Perez <fperez@colorado.edu>
3075
3077
3076 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3078 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3077 value of exit question to be acknowledged.
3079 value of exit question to be acknowledged.
3078
3080
3079 2002-12-03 Fernando Perez <fperez@colorado.edu>
3081 2002-12-03 Fernando Perez <fperez@colorado.edu>
3080
3082
3081 * IPython/ipmaker.py: removed generators, which had been added
3083 * IPython/ipmaker.py: removed generators, which had been added
3082 by mistake in an earlier debugging run. This was causing trouble
3084 by mistake in an earlier debugging run. This was causing trouble
3083 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3085 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3084 for pointing this out.
3086 for pointing this out.
3085
3087
3086 2002-11-17 Fernando Perez <fperez@colorado.edu>
3088 2002-11-17 Fernando Perez <fperez@colorado.edu>
3087
3089
3088 * Manual: updated the Gnuplot section.
3090 * Manual: updated the Gnuplot section.
3089
3091
3090 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3092 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3091 a much better split of what goes in Runtime and what goes in
3093 a much better split of what goes in Runtime and what goes in
3092 Interactive.
3094 Interactive.
3093
3095
3094 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3096 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3095 being imported from iplib.
3097 being imported from iplib.
3096
3098
3097 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3099 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3098 for command-passing. Now the global Gnuplot instance is called
3100 for command-passing. Now the global Gnuplot instance is called
3099 'gp' instead of 'g', which was really a far too fragile and
3101 'gp' instead of 'g', which was really a far too fragile and
3100 common name.
3102 common name.
3101
3103
3102 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3104 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3103 bounding boxes generated by Gnuplot for square plots.
3105 bounding boxes generated by Gnuplot for square plots.
3104
3106
3105 * IPython/genutils.py (popkey): new function added. I should
3107 * IPython/genutils.py (popkey): new function added. I should
3106 suggest this on c.l.py as a dict method, it seems useful.
3108 suggest this on c.l.py as a dict method, it seems useful.
3107
3109
3108 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3110 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3109 to transparently handle PostScript generation. MUCH better than
3111 to transparently handle PostScript generation. MUCH better than
3110 the previous plot_eps/replot_eps (which I removed now). The code
3112 the previous plot_eps/replot_eps (which I removed now). The code
3111 is also fairly clean and well documented now (including
3113 is also fairly clean and well documented now (including
3112 docstrings).
3114 docstrings).
3113
3115
3114 2002-11-13 Fernando Perez <fperez@colorado.edu>
3116 2002-11-13 Fernando Perez <fperez@colorado.edu>
3115
3117
3116 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3118 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3117 (inconsistent with options).
3119 (inconsistent with options).
3118
3120
3119 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3121 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3120 manually disabled, I don't know why. Fixed it.
3122 manually disabled, I don't know why. Fixed it.
3121 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3123 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3122 eps output.
3124 eps output.
3123
3125
3124 2002-11-12 Fernando Perez <fperez@colorado.edu>
3126 2002-11-12 Fernando Perez <fperez@colorado.edu>
3125
3127
3126 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3128 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3127 don't propagate up to caller. Fixes crash reported by François
3129 don't propagate up to caller. Fixes crash reported by François
3128 Pinard.
3130 Pinard.
3129
3131
3130 2002-11-09 Fernando Perez <fperez@colorado.edu>
3132 2002-11-09 Fernando Perez <fperez@colorado.edu>
3131
3133
3132 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3134 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3133 history file for new users.
3135 history file for new users.
3134 (make_IPython): fixed bug where initial install would leave the
3136 (make_IPython): fixed bug where initial install would leave the
3135 user running in the .ipython dir.
3137 user running in the .ipython dir.
3136 (make_IPython): fixed bug where config dir .ipython would be
3138 (make_IPython): fixed bug where config dir .ipython would be
3137 created regardless of the given -ipythondir option. Thanks to Cory
3139 created regardless of the given -ipythondir option. Thanks to Cory
3138 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3140 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3139
3141
3140 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3142 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3141 type confirmations. Will need to use it in all of IPython's code
3143 type confirmations. Will need to use it in all of IPython's code
3142 consistently.
3144 consistently.
3143
3145
3144 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3146 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3145 context to print 31 lines instead of the default 5. This will make
3147 context to print 31 lines instead of the default 5. This will make
3146 the crash reports extremely detailed in case the problem is in
3148 the crash reports extremely detailed in case the problem is in
3147 libraries I don't have access to.
3149 libraries I don't have access to.
3148
3150
3149 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3151 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3150 line of defense' code to still crash, but giving users fair
3152 line of defense' code to still crash, but giving users fair
3151 warning. I don't want internal errors to go unreported: if there's
3153 warning. I don't want internal errors to go unreported: if there's
3152 an internal problem, IPython should crash and generate a full
3154 an internal problem, IPython should crash and generate a full
3153 report.
3155 report.
3154
3156
3155 2002-11-08 Fernando Perez <fperez@colorado.edu>
3157 2002-11-08 Fernando Perez <fperez@colorado.edu>
3156
3158
3157 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3159 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3158 otherwise uncaught exceptions which can appear if people set
3160 otherwise uncaught exceptions which can appear if people set
3159 sys.stdout to something badly broken. Thanks to a crash report
3161 sys.stdout to something badly broken. Thanks to a crash report
3160 from henni-AT-mail.brainbot.com.
3162 from henni-AT-mail.brainbot.com.
3161
3163
3162 2002-11-04 Fernando Perez <fperez@colorado.edu>
3164 2002-11-04 Fernando Perez <fperez@colorado.edu>
3163
3165
3164 * IPython/iplib.py (InteractiveShell.interact): added
3166 * IPython/iplib.py (InteractiveShell.interact): added
3165 __IPYTHON__active to the builtins. It's a flag which goes on when
3167 __IPYTHON__active to the builtins. It's a flag which goes on when
3166 the interaction starts and goes off again when it stops. This
3168 the interaction starts and goes off again when it stops. This
3167 allows embedding code to detect being inside IPython. Before this
3169 allows embedding code to detect being inside IPython. Before this
3168 was done via __IPYTHON__, but that only shows that an IPython
3170 was done via __IPYTHON__, but that only shows that an IPython
3169 instance has been created.
3171 instance has been created.
3170
3172
3171 * IPython/Magic.py (Magic.magic_env): I realized that in a
3173 * IPython/Magic.py (Magic.magic_env): I realized that in a
3172 UserDict, instance.data holds the data as a normal dict. So I
3174 UserDict, instance.data holds the data as a normal dict. So I
3173 modified @env to return os.environ.data instead of rebuilding a
3175 modified @env to return os.environ.data instead of rebuilding a
3174 dict by hand.
3176 dict by hand.
3175
3177
3176 2002-11-02 Fernando Perez <fperez@colorado.edu>
3178 2002-11-02 Fernando Perez <fperez@colorado.edu>
3177
3179
3178 * IPython/genutils.py (warn): changed so that level 1 prints no
3180 * IPython/genutils.py (warn): changed so that level 1 prints no
3179 header. Level 2 is now the default (with 'WARNING' header, as
3181 header. Level 2 is now the default (with 'WARNING' header, as
3180 before). I think I tracked all places where changes were needed in
3182 before). I think I tracked all places where changes were needed in
3181 IPython, but outside code using the old level numbering may have
3183 IPython, but outside code using the old level numbering may have
3182 broken.
3184 broken.
3183
3185
3184 * IPython/iplib.py (InteractiveShell.runcode): added this to
3186 * IPython/iplib.py (InteractiveShell.runcode): added this to
3185 handle the tracebacks in SystemExit traps correctly. The previous
3187 handle the tracebacks in SystemExit traps correctly. The previous
3186 code (through interact) was printing more of the stack than
3188 code (through interact) was printing more of the stack than
3187 necessary, showing IPython internal code to the user.
3189 necessary, showing IPython internal code to the user.
3188
3190
3189 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3191 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3190 default. Now that the default at the confirmation prompt is yes,
3192 default. Now that the default at the confirmation prompt is yes,
3191 it's not so intrusive. François' argument that ipython sessions
3193 it's not so intrusive. François' argument that ipython sessions
3192 tend to be complex enough not to lose them from an accidental C-d,
3194 tend to be complex enough not to lose them from an accidental C-d,
3193 is a valid one.
3195 is a valid one.
3194
3196
3195 * IPython/iplib.py (InteractiveShell.interact): added a
3197 * IPython/iplib.py (InteractiveShell.interact): added a
3196 showtraceback() call to the SystemExit trap, and modified the exit
3198 showtraceback() call to the SystemExit trap, and modified the exit
3197 confirmation to have yes as the default.
3199 confirmation to have yes as the default.
3198
3200
3199 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3201 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3200 this file. It's been gone from the code for a long time, this was
3202 this file. It's been gone from the code for a long time, this was
3201 simply leftover junk.
3203 simply leftover junk.
3202
3204
3203 2002-11-01 Fernando Perez <fperez@colorado.edu>
3205 2002-11-01 Fernando Perez <fperez@colorado.edu>
3204
3206
3205 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3207 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3206 added. If set, IPython now traps EOF and asks for
3208 added. If set, IPython now traps EOF and asks for
3207 confirmation. After a request by François Pinard.
3209 confirmation. After a request by François Pinard.
3208
3210
3209 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3211 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3210 of @abort, and with a new (better) mechanism for handling the
3212 of @abort, and with a new (better) mechanism for handling the
3211 exceptions.
3213 exceptions.
3212
3214
3213 2002-10-27 Fernando Perez <fperez@colorado.edu>
3215 2002-10-27 Fernando Perez <fperez@colorado.edu>
3214
3216
3215 * IPython/usage.py (__doc__): updated the --help information and
3217 * IPython/usage.py (__doc__): updated the --help information and
3216 the ipythonrc file to indicate that -log generates
3218 the ipythonrc file to indicate that -log generates
3217 ./ipython.log. Also fixed the corresponding info in @logstart.
3219 ./ipython.log. Also fixed the corresponding info in @logstart.
3218 This and several other fixes in the manuals thanks to reports by
3220 This and several other fixes in the manuals thanks to reports by
3219 François Pinard <pinard-AT-iro.umontreal.ca>.
3221 François Pinard <pinard-AT-iro.umontreal.ca>.
3220
3222
3221 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3223 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3222 refer to @logstart (instead of @log, which doesn't exist).
3224 refer to @logstart (instead of @log, which doesn't exist).
3223
3225
3224 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3226 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3225 AttributeError crash. Thanks to Christopher Armstrong
3227 AttributeError crash. Thanks to Christopher Armstrong
3226 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3228 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3227 introduced recently (in 0.2.14pre37) with the fix to the eval
3229 introduced recently (in 0.2.14pre37) with the fix to the eval
3228 problem mentioned below.
3230 problem mentioned below.
3229
3231
3230 2002-10-17 Fernando Perez <fperez@colorado.edu>
3232 2002-10-17 Fernando Perez <fperez@colorado.edu>
3231
3233
3232 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3234 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3233 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3235 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3234
3236
3235 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3237 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3236 this function to fix a problem reported by Alex Schmolck. He saw
3238 this function to fix a problem reported by Alex Schmolck. He saw
3237 it with list comprehensions and generators, which were getting
3239 it with list comprehensions and generators, which were getting
3238 called twice. The real problem was an 'eval' call in testing for
3240 called twice. The real problem was an 'eval' call in testing for
3239 automagic which was evaluating the input line silently.
3241 automagic which was evaluating the input line silently.
3240
3242
3241 This is a potentially very nasty bug, if the input has side
3243 This is a potentially very nasty bug, if the input has side
3242 effects which must not be repeated. The code is much cleaner now,
3244 effects which must not be repeated. The code is much cleaner now,
3243 without any blanket 'except' left and with a regexp test for
3245 without any blanket 'except' left and with a regexp test for
3244 actual function names.
3246 actual function names.
3245
3247
3246 But an eval remains, which I'm not fully comfortable with. I just
3248 But an eval remains, which I'm not fully comfortable with. I just
3247 don't know how to find out if an expression could be a callable in
3249 don't know how to find out if an expression could be a callable in
3248 the user's namespace without doing an eval on the string. However
3250 the user's namespace without doing an eval on the string. However
3249 that string is now much more strictly checked so that no code
3251 that string is now much more strictly checked so that no code
3250 slips by, so the eval should only happen for things that can
3252 slips by, so the eval should only happen for things that can
3251 really be only function/method names.
3253 really be only function/method names.
3252
3254
3253 2002-10-15 Fernando Perez <fperez@colorado.edu>
3255 2002-10-15 Fernando Perez <fperez@colorado.edu>
3254
3256
3255 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3257 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3256 OSX information to main manual, removed README_Mac_OSX file from
3258 OSX information to main manual, removed README_Mac_OSX file from
3257 distribution. Also updated credits for recent additions.
3259 distribution. Also updated credits for recent additions.
3258
3260
3259 2002-10-10 Fernando Perez <fperez@colorado.edu>
3261 2002-10-10 Fernando Perez <fperez@colorado.edu>
3260
3262
3261 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3263 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3262 terminal-related issues. Many thanks to Andrea Riciputi
3264 terminal-related issues. Many thanks to Andrea Riciputi
3263 <andrea.riciputi-AT-libero.it> for writing it.
3265 <andrea.riciputi-AT-libero.it> for writing it.
3264
3266
3265 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3267 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3266 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3268 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3267
3269
3268 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3270 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3269 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3271 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3270 <syver-en-AT-online.no> who both submitted patches for this problem.
3272 <syver-en-AT-online.no> who both submitted patches for this problem.
3271
3273
3272 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3274 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3273 global embedding to make sure that things don't overwrite user
3275 global embedding to make sure that things don't overwrite user
3274 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3276 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3275
3277
3276 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3278 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3277 compatibility. Thanks to Hayden Callow
3279 compatibility. Thanks to Hayden Callow
3278 <h.callow-AT-elec.canterbury.ac.nz>
3280 <h.callow-AT-elec.canterbury.ac.nz>
3279
3281
3280 2002-10-04 Fernando Perez <fperez@colorado.edu>
3282 2002-10-04 Fernando Perez <fperez@colorado.edu>
3281
3283
3282 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3284 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3283 Gnuplot.File objects.
3285 Gnuplot.File objects.
3284
3286
3285 2002-07-23 Fernando Perez <fperez@colorado.edu>
3287 2002-07-23 Fernando Perez <fperez@colorado.edu>
3286
3288
3287 * IPython/genutils.py (timing): Added timings() and timing() for
3289 * IPython/genutils.py (timing): Added timings() and timing() for
3288 quick access to the most commonly needed data, the execution
3290 quick access to the most commonly needed data, the execution
3289 times. Old timing() renamed to timings_out().
3291 times. Old timing() renamed to timings_out().
3290
3292
3291 2002-07-18 Fernando Perez <fperez@colorado.edu>
3293 2002-07-18 Fernando Perez <fperez@colorado.edu>
3292
3294
3293 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3295 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3294 bug with nested instances disrupting the parent's tab completion.
3296 bug with nested instances disrupting the parent's tab completion.
3295
3297
3296 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3298 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3297 all_completions code to begin the emacs integration.
3299 all_completions code to begin the emacs integration.
3298
3300
3299 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3301 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3300 argument to allow titling individual arrays when plotting.
3302 argument to allow titling individual arrays when plotting.
3301
3303
3302 2002-07-15 Fernando Perez <fperez@colorado.edu>
3304 2002-07-15 Fernando Perez <fperez@colorado.edu>
3303
3305
3304 * setup.py (make_shortcut): changed to retrieve the value of
3306 * setup.py (make_shortcut): changed to retrieve the value of
3305 'Program Files' directory from the registry (this value changes in
3307 'Program Files' directory from the registry (this value changes in
3306 non-english versions of Windows). Thanks to Thomas Fanslau
3308 non-english versions of Windows). Thanks to Thomas Fanslau
3307 <tfanslau-AT-gmx.de> for the report.
3309 <tfanslau-AT-gmx.de> for the report.
3308
3310
3309 2002-07-10 Fernando Perez <fperez@colorado.edu>
3311 2002-07-10 Fernando Perez <fperez@colorado.edu>
3310
3312
3311 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3313 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3312 a bug in pdb, which crashes if a line with only whitespace is
3314 a bug in pdb, which crashes if a line with only whitespace is
3313 entered. Bug report submitted to sourceforge.
3315 entered. Bug report submitted to sourceforge.
3314
3316
3315 2002-07-09 Fernando Perez <fperez@colorado.edu>
3317 2002-07-09 Fernando Perez <fperez@colorado.edu>
3316
3318
3317 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3319 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3318 reporting exceptions (it's a bug in inspect.py, I just set a
3320 reporting exceptions (it's a bug in inspect.py, I just set a
3319 workaround).
3321 workaround).
3320
3322
3321 2002-07-08 Fernando Perez <fperez@colorado.edu>
3323 2002-07-08 Fernando Perez <fperez@colorado.edu>
3322
3324
3323 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3325 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3324 __IPYTHON__ in __builtins__ to show up in user_ns.
3326 __IPYTHON__ in __builtins__ to show up in user_ns.
3325
3327
3326 2002-07-03 Fernando Perez <fperez@colorado.edu>
3328 2002-07-03 Fernando Perez <fperez@colorado.edu>
3327
3329
3328 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3330 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3329 name from @gp_set_instance to @gp_set_default.
3331 name from @gp_set_instance to @gp_set_default.
3330
3332
3331 * IPython/ipmaker.py (make_IPython): default editor value set to
3333 * IPython/ipmaker.py (make_IPython): default editor value set to
3332 '0' (a string), to match the rc file. Otherwise will crash when
3334 '0' (a string), to match the rc file. Otherwise will crash when
3333 .strip() is called on it.
3335 .strip() is called on it.
3334
3336
3335
3337
3336 2002-06-28 Fernando Perez <fperez@colorado.edu>
3338 2002-06-28 Fernando Perez <fperez@colorado.edu>
3337
3339
3338 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3340 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3339 of files in current directory when a file is executed via
3341 of files in current directory when a file is executed via
3340 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3342 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3341
3343
3342 * setup.py (manfiles): fix for rpm builds, submitted by RA
3344 * setup.py (manfiles): fix for rpm builds, submitted by RA
3343 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3345 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3344
3346
3345 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3347 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3346 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3348 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3347 string!). A. Schmolck caught this one.
3349 string!). A. Schmolck caught this one.
3348
3350
3349 2002-06-27 Fernando Perez <fperez@colorado.edu>
3351 2002-06-27 Fernando Perez <fperez@colorado.edu>
3350
3352
3351 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3353 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3352 defined files at the cmd line. __name__ wasn't being set to
3354 defined files at the cmd line. __name__ wasn't being set to
3353 __main__.
3355 __main__.
3354
3356
3355 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3357 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3356 regular lists and tuples besides Numeric arrays.
3358 regular lists and tuples besides Numeric arrays.
3357
3359
3358 * IPython/Prompts.py (CachedOutput.__call__): Added output
3360 * IPython/Prompts.py (CachedOutput.__call__): Added output
3359 supression for input ending with ';'. Similar to Mathematica and
3361 supression for input ending with ';'. Similar to Mathematica and
3360 Matlab. The _* vars and Out[] list are still updated, just like
3362 Matlab. The _* vars and Out[] list are still updated, just like
3361 Mathematica behaves.
3363 Mathematica behaves.
3362
3364
3363 2002-06-25 Fernando Perez <fperez@colorado.edu>
3365 2002-06-25 Fernando Perez <fperez@colorado.edu>
3364
3366
3365 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3367 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3366 .ini extensions for profiels under Windows.
3368 .ini extensions for profiels under Windows.
3367
3369
3368 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3370 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3369 string form. Fix contributed by Alexander Schmolck
3371 string form. Fix contributed by Alexander Schmolck
3370 <a.schmolck-AT-gmx.net>
3372 <a.schmolck-AT-gmx.net>
3371
3373
3372 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3374 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3373 pre-configured Gnuplot instance.
3375 pre-configured Gnuplot instance.
3374
3376
3375 2002-06-21 Fernando Perez <fperez@colorado.edu>
3377 2002-06-21 Fernando Perez <fperez@colorado.edu>
3376
3378
3377 * IPython/numutils.py (exp_safe): new function, works around the
3379 * IPython/numutils.py (exp_safe): new function, works around the
3378 underflow problems in Numeric.
3380 underflow problems in Numeric.
3379 (log2): New fn. Safe log in base 2: returns exact integer answer
3381 (log2): New fn. Safe log in base 2: returns exact integer answer
3380 for exact integer powers of 2.
3382 for exact integer powers of 2.
3381
3383
3382 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3384 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3383 properly.
3385 properly.
3384
3386
3385 2002-06-20 Fernando Perez <fperez@colorado.edu>
3387 2002-06-20 Fernando Perez <fperez@colorado.edu>
3386
3388
3387 * IPython/genutils.py (timing): new function like
3389 * IPython/genutils.py (timing): new function like
3388 Mathematica's. Similar to time_test, but returns more info.
3390 Mathematica's. Similar to time_test, but returns more info.
3389
3391
3390 2002-06-18 Fernando Perez <fperez@colorado.edu>
3392 2002-06-18 Fernando Perez <fperez@colorado.edu>
3391
3393
3392 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3394 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3393 according to Mike Heeter's suggestions.
3395 according to Mike Heeter's suggestions.
3394
3396
3395 2002-06-16 Fernando Perez <fperez@colorado.edu>
3397 2002-06-16 Fernando Perez <fperez@colorado.edu>
3396
3398
3397 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3399 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3398 system. GnuplotMagic is gone as a user-directory option. New files
3400 system. GnuplotMagic is gone as a user-directory option. New files
3399 make it easier to use all the gnuplot stuff both from external
3401 make it easier to use all the gnuplot stuff both from external
3400 programs as well as from IPython. Had to rewrite part of
3402 programs as well as from IPython. Had to rewrite part of
3401 hardcopy() b/c of a strange bug: often the ps files simply don't
3403 hardcopy() b/c of a strange bug: often the ps files simply don't
3402 get created, and require a repeat of the command (often several
3404 get created, and require a repeat of the command (often several
3403 times).
3405 times).
3404
3406
3405 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3407 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3406 resolve output channel at call time, so that if sys.stderr has
3408 resolve output channel at call time, so that if sys.stderr has
3407 been redirected by user this gets honored.
3409 been redirected by user this gets honored.
3408
3410
3409 2002-06-13 Fernando Perez <fperez@colorado.edu>
3411 2002-06-13 Fernando Perez <fperez@colorado.edu>
3410
3412
3411 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3413 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3412 IPShell. Kept a copy with the old names to avoid breaking people's
3414 IPShell. Kept a copy with the old names to avoid breaking people's
3413 embedded code.
3415 embedded code.
3414
3416
3415 * IPython/ipython: simplified it to the bare minimum after
3417 * IPython/ipython: simplified it to the bare minimum after
3416 Holger's suggestions. Added info about how to use it in
3418 Holger's suggestions. Added info about how to use it in
3417 PYTHONSTARTUP.
3419 PYTHONSTARTUP.
3418
3420
3419 * IPython/Shell.py (IPythonShell): changed the options passing
3421 * IPython/Shell.py (IPythonShell): changed the options passing
3420 from a string with funky %s replacements to a straight list. Maybe
3422 from a string with funky %s replacements to a straight list. Maybe
3421 a bit more typing, but it follows sys.argv conventions, so there's
3423 a bit more typing, but it follows sys.argv conventions, so there's
3422 less special-casing to remember.
3424 less special-casing to remember.
3423
3425
3424 2002-06-12 Fernando Perez <fperez@colorado.edu>
3426 2002-06-12 Fernando Perez <fperez@colorado.edu>
3425
3427
3426 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3428 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3427 command. Thanks to a suggestion by Mike Heeter.
3429 command. Thanks to a suggestion by Mike Heeter.
3428 (Magic.magic_pfile): added behavior to look at filenames if given
3430 (Magic.magic_pfile): added behavior to look at filenames if given
3429 arg is not a defined object.
3431 arg is not a defined object.
3430 (Magic.magic_save): New @save function to save code snippets. Also
3432 (Magic.magic_save): New @save function to save code snippets. Also
3431 a Mike Heeter idea.
3433 a Mike Heeter idea.
3432
3434
3433 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3435 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3434 plot() and replot(). Much more convenient now, especially for
3436 plot() and replot(). Much more convenient now, especially for
3435 interactive use.
3437 interactive use.
3436
3438
3437 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3439 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3438 filenames.
3440 filenames.
3439
3441
3440 2002-06-02 Fernando Perez <fperez@colorado.edu>
3442 2002-06-02 Fernando Perez <fperez@colorado.edu>
3441
3443
3442 * IPython/Struct.py (Struct.__init__): modified to admit
3444 * IPython/Struct.py (Struct.__init__): modified to admit
3443 initialization via another struct.
3445 initialization via another struct.
3444
3446
3445 * IPython/genutils.py (SystemExec.__init__): New stateful
3447 * IPython/genutils.py (SystemExec.__init__): New stateful
3446 interface to xsys and bq. Useful for writing system scripts.
3448 interface to xsys and bq. Useful for writing system scripts.
3447
3449
3448 2002-05-30 Fernando Perez <fperez@colorado.edu>
3450 2002-05-30 Fernando Perez <fperez@colorado.edu>
3449
3451
3450 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3452 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3451 documents. This will make the user download smaller (it's getting
3453 documents. This will make the user download smaller (it's getting
3452 too big).
3454 too big).
3453
3455
3454 2002-05-29 Fernando Perez <fperez@colorado.edu>
3456 2002-05-29 Fernando Perez <fperez@colorado.edu>
3455
3457
3456 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3458 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3457 fix problems with shelve and pickle. Seems to work, but I don't
3459 fix problems with shelve and pickle. Seems to work, but I don't
3458 know if corner cases break it. Thanks to Mike Heeter
3460 know if corner cases break it. Thanks to Mike Heeter
3459 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3461 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3460
3462
3461 2002-05-24 Fernando Perez <fperez@colorado.edu>
3463 2002-05-24 Fernando Perez <fperez@colorado.edu>
3462
3464
3463 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3465 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3464 macros having broken.
3466 macros having broken.
3465
3467
3466 2002-05-21 Fernando Perez <fperez@colorado.edu>
3468 2002-05-21 Fernando Perez <fperez@colorado.edu>
3467
3469
3468 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3470 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3469 introduced logging bug: all history before logging started was
3471 introduced logging bug: all history before logging started was
3470 being written one character per line! This came from the redesign
3472 being written one character per line! This came from the redesign
3471 of the input history as a special list which slices to strings,
3473 of the input history as a special list which slices to strings,
3472 not to lists.
3474 not to lists.
3473
3475
3474 2002-05-20 Fernando Perez <fperez@colorado.edu>
3476 2002-05-20 Fernando Perez <fperez@colorado.edu>
3475
3477
3476 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3478 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3477 be an attribute of all classes in this module. The design of these
3479 be an attribute of all classes in this module. The design of these
3478 classes needs some serious overhauling.
3480 classes needs some serious overhauling.
3479
3481
3480 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3482 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3481 which was ignoring '_' in option names.
3483 which was ignoring '_' in option names.
3482
3484
3483 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3485 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3484 'Verbose_novars' to 'Context' and made it the new default. It's a
3486 'Verbose_novars' to 'Context' and made it the new default. It's a
3485 bit more readable and also safer than verbose.
3487 bit more readable and also safer than verbose.
3486
3488
3487 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3489 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3488 triple-quoted strings.
3490 triple-quoted strings.
3489
3491
3490 * IPython/OInspect.py (__all__): new module exposing the object
3492 * IPython/OInspect.py (__all__): new module exposing the object
3491 introspection facilities. Now the corresponding magics are dummy
3493 introspection facilities. Now the corresponding magics are dummy
3492 wrappers around this. Having this module will make it much easier
3494 wrappers around this. Having this module will make it much easier
3493 to put these functions into our modified pdb.
3495 to put these functions into our modified pdb.
3494 This new object inspector system uses the new colorizing module,
3496 This new object inspector system uses the new colorizing module,
3495 so source code and other things are nicely syntax highlighted.
3497 so source code and other things are nicely syntax highlighted.
3496
3498
3497 2002-05-18 Fernando Perez <fperez@colorado.edu>
3499 2002-05-18 Fernando Perez <fperez@colorado.edu>
3498
3500
3499 * IPython/ColorANSI.py: Split the coloring tools into a separate
3501 * IPython/ColorANSI.py: Split the coloring tools into a separate
3500 module so I can use them in other code easier (they were part of
3502 module so I can use them in other code easier (they were part of
3501 ultraTB).
3503 ultraTB).
3502
3504
3503 2002-05-17 Fernando Perez <fperez@colorado.edu>
3505 2002-05-17 Fernando Perez <fperez@colorado.edu>
3504
3506
3505 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3507 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3506 fixed it to set the global 'g' also to the called instance, as
3508 fixed it to set the global 'g' also to the called instance, as
3507 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3509 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3508 user's 'g' variables).
3510 user's 'g' variables).
3509
3511
3510 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3512 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3511 global variables (aliases to _ih,_oh) so that users which expect
3513 global variables (aliases to _ih,_oh) so that users which expect
3512 In[5] or Out[7] to work aren't unpleasantly surprised.
3514 In[5] or Out[7] to work aren't unpleasantly surprised.
3513 (InputList.__getslice__): new class to allow executing slices of
3515 (InputList.__getslice__): new class to allow executing slices of
3514 input history directly. Very simple class, complements the use of
3516 input history directly. Very simple class, complements the use of
3515 macros.
3517 macros.
3516
3518
3517 2002-05-16 Fernando Perez <fperez@colorado.edu>
3519 2002-05-16 Fernando Perez <fperez@colorado.edu>
3518
3520
3519 * setup.py (docdirbase): make doc directory be just doc/IPython
3521 * setup.py (docdirbase): make doc directory be just doc/IPython
3520 without version numbers, it will reduce clutter for users.
3522 without version numbers, it will reduce clutter for users.
3521
3523
3522 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3524 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3523 execfile call to prevent possible memory leak. See for details:
3525 execfile call to prevent possible memory leak. See for details:
3524 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3526 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3525
3527
3526 2002-05-15 Fernando Perez <fperez@colorado.edu>
3528 2002-05-15 Fernando Perez <fperez@colorado.edu>
3527
3529
3528 * IPython/Magic.py (Magic.magic_psource): made the object
3530 * IPython/Magic.py (Magic.magic_psource): made the object
3529 introspection names be more standard: pdoc, pdef, pfile and
3531 introspection names be more standard: pdoc, pdef, pfile and
3530 psource. They all print/page their output, and it makes
3532 psource. They all print/page their output, and it makes
3531 remembering them easier. Kept old names for compatibility as
3533 remembering them easier. Kept old names for compatibility as
3532 aliases.
3534 aliases.
3533
3535
3534 2002-05-14 Fernando Perez <fperez@colorado.edu>
3536 2002-05-14 Fernando Perez <fperez@colorado.edu>
3535
3537
3536 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3538 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3537 what the mouse problem was. The trick is to use gnuplot with temp
3539 what the mouse problem was. The trick is to use gnuplot with temp
3538 files and NOT with pipes (for data communication), because having
3540 files and NOT with pipes (for data communication), because having
3539 both pipes and the mouse on is bad news.
3541 both pipes and the mouse on is bad news.
3540
3542
3541 2002-05-13 Fernando Perez <fperez@colorado.edu>
3543 2002-05-13 Fernando Perez <fperez@colorado.edu>
3542
3544
3543 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3545 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3544 bug. Information would be reported about builtins even when
3546 bug. Information would be reported about builtins even when
3545 user-defined functions overrode them.
3547 user-defined functions overrode them.
3546
3548
3547 2002-05-11 Fernando Perez <fperez@colorado.edu>
3549 2002-05-11 Fernando Perez <fperez@colorado.edu>
3548
3550
3549 * IPython/__init__.py (__all__): removed FlexCompleter from
3551 * IPython/__init__.py (__all__): removed FlexCompleter from
3550 __all__ so that things don't fail in platforms without readline.
3552 __all__ so that things don't fail in platforms without readline.
3551
3553
3552 2002-05-10 Fernando Perez <fperez@colorado.edu>
3554 2002-05-10 Fernando Perez <fperez@colorado.edu>
3553
3555
3554 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3556 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3555 it requires Numeric, effectively making Numeric a dependency for
3557 it requires Numeric, effectively making Numeric a dependency for
3556 IPython.
3558 IPython.
3557
3559
3558 * Released 0.2.13
3560 * Released 0.2.13
3559
3561
3560 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3562 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3561 profiler interface. Now all the major options from the profiler
3563 profiler interface. Now all the major options from the profiler
3562 module are directly supported in IPython, both for single
3564 module are directly supported in IPython, both for single
3563 expressions (@prun) and for full programs (@run -p).
3565 expressions (@prun) and for full programs (@run -p).
3564
3566
3565 2002-05-09 Fernando Perez <fperez@colorado.edu>
3567 2002-05-09 Fernando Perez <fperez@colorado.edu>
3566
3568
3567 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3569 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3568 magic properly formatted for screen.
3570 magic properly formatted for screen.
3569
3571
3570 * setup.py (make_shortcut): Changed things to put pdf version in
3572 * setup.py (make_shortcut): Changed things to put pdf version in
3571 doc/ instead of doc/manual (had to change lyxport a bit).
3573 doc/ instead of doc/manual (had to change lyxport a bit).
3572
3574
3573 * IPython/Magic.py (Profile.string_stats): made profile runs go
3575 * IPython/Magic.py (Profile.string_stats): made profile runs go
3574 through pager (they are long and a pager allows searching, saving,
3576 through pager (they are long and a pager allows searching, saving,
3575 etc.)
3577 etc.)
3576
3578
3577 2002-05-08 Fernando Perez <fperez@colorado.edu>
3579 2002-05-08 Fernando Perez <fperez@colorado.edu>
3578
3580
3579 * Released 0.2.12
3581 * Released 0.2.12
3580
3582
3581 2002-05-06 Fernando Perez <fperez@colorado.edu>
3583 2002-05-06 Fernando Perez <fperez@colorado.edu>
3582
3584
3583 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3585 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3584 introduced); 'hist n1 n2' was broken.
3586 introduced); 'hist n1 n2' was broken.
3585 (Magic.magic_pdb): added optional on/off arguments to @pdb
3587 (Magic.magic_pdb): added optional on/off arguments to @pdb
3586 (Magic.magic_run): added option -i to @run, which executes code in
3588 (Magic.magic_run): added option -i to @run, which executes code in
3587 the IPython namespace instead of a clean one. Also added @irun as
3589 the IPython namespace instead of a clean one. Also added @irun as
3588 an alias to @run -i.
3590 an alias to @run -i.
3589
3591
3590 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3592 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3591 fixed (it didn't really do anything, the namespaces were wrong).
3593 fixed (it didn't really do anything, the namespaces were wrong).
3592
3594
3593 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3595 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3594
3596
3595 * IPython/__init__.py (__all__): Fixed package namespace, now
3597 * IPython/__init__.py (__all__): Fixed package namespace, now
3596 'import IPython' does give access to IPython.<all> as
3598 'import IPython' does give access to IPython.<all> as
3597 expected. Also renamed __release__ to Release.
3599 expected. Also renamed __release__ to Release.
3598
3600
3599 * IPython/Debugger.py (__license__): created new Pdb class which
3601 * IPython/Debugger.py (__license__): created new Pdb class which
3600 functions like a drop-in for the normal pdb.Pdb but does NOT
3602 functions like a drop-in for the normal pdb.Pdb but does NOT
3601 import readline by default. This way it doesn't muck up IPython's
3603 import readline by default. This way it doesn't muck up IPython's
3602 readline handling, and now tab-completion finally works in the
3604 readline handling, and now tab-completion finally works in the
3603 debugger -- sort of. It completes things globally visible, but the
3605 debugger -- sort of. It completes things globally visible, but the
3604 completer doesn't track the stack as pdb walks it. That's a bit
3606 completer doesn't track the stack as pdb walks it. That's a bit
3605 tricky, and I'll have to implement it later.
3607 tricky, and I'll have to implement it later.
3606
3608
3607 2002-05-05 Fernando Perez <fperez@colorado.edu>
3609 2002-05-05 Fernando Perez <fperez@colorado.edu>
3608
3610
3609 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3611 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3610 magic docstrings when printed via ? (explicit \'s were being
3612 magic docstrings when printed via ? (explicit \'s were being
3611 printed).
3613 printed).
3612
3614
3613 * IPython/ipmaker.py (make_IPython): fixed namespace
3615 * IPython/ipmaker.py (make_IPython): fixed namespace
3614 identification bug. Now variables loaded via logs or command-line
3616 identification bug. Now variables loaded via logs or command-line
3615 files are recognized in the interactive namespace by @who.
3617 files are recognized in the interactive namespace by @who.
3616
3618
3617 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3619 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3618 log replay system stemming from the string form of Structs.
3620 log replay system stemming from the string form of Structs.
3619
3621
3620 * IPython/Magic.py (Macro.__init__): improved macros to properly
3622 * IPython/Magic.py (Macro.__init__): improved macros to properly
3621 handle magic commands in them.
3623 handle magic commands in them.
3622 (Magic.magic_logstart): usernames are now expanded so 'logstart
3624 (Magic.magic_logstart): usernames are now expanded so 'logstart
3623 ~/mylog' now works.
3625 ~/mylog' now works.
3624
3626
3625 * IPython/iplib.py (complete): fixed bug where paths starting with
3627 * IPython/iplib.py (complete): fixed bug where paths starting with
3626 '/' would be completed as magic names.
3628 '/' would be completed as magic names.
3627
3629
3628 2002-05-04 Fernando Perez <fperez@colorado.edu>
3630 2002-05-04 Fernando Perez <fperez@colorado.edu>
3629
3631
3630 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3632 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3631 allow running full programs under the profiler's control.
3633 allow running full programs under the profiler's control.
3632
3634
3633 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3635 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3634 mode to report exceptions verbosely but without formatting
3636 mode to report exceptions verbosely but without formatting
3635 variables. This addresses the issue of ipython 'freezing' (it's
3637 variables. This addresses the issue of ipython 'freezing' (it's
3636 not frozen, but caught in an expensive formatting loop) when huge
3638 not frozen, but caught in an expensive formatting loop) when huge
3637 variables are in the context of an exception.
3639 variables are in the context of an exception.
3638 (VerboseTB.text): Added '--->' markers at line where exception was
3640 (VerboseTB.text): Added '--->' markers at line where exception was
3639 triggered. Much clearer to read, especially in NoColor modes.
3641 triggered. Much clearer to read, especially in NoColor modes.
3640
3642
3641 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3643 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3642 implemented in reverse when changing to the new parse_options().
3644 implemented in reverse when changing to the new parse_options().
3643
3645
3644 2002-05-03 Fernando Perez <fperez@colorado.edu>
3646 2002-05-03 Fernando Perez <fperez@colorado.edu>
3645
3647
3646 * IPython/Magic.py (Magic.parse_options): new function so that
3648 * IPython/Magic.py (Magic.parse_options): new function so that
3647 magics can parse options easier.
3649 magics can parse options easier.
3648 (Magic.magic_prun): new function similar to profile.run(),
3650 (Magic.magic_prun): new function similar to profile.run(),
3649 suggested by Chris Hart.
3651 suggested by Chris Hart.
3650 (Magic.magic_cd): fixed behavior so that it only changes if
3652 (Magic.magic_cd): fixed behavior so that it only changes if
3651 directory actually is in history.
3653 directory actually is in history.
3652
3654
3653 * IPython/usage.py (__doc__): added information about potential
3655 * IPython/usage.py (__doc__): added information about potential
3654 slowness of Verbose exception mode when there are huge data
3656 slowness of Verbose exception mode when there are huge data
3655 structures to be formatted (thanks to Archie Paulson).
3657 structures to be formatted (thanks to Archie Paulson).
3656
3658
3657 * IPython/ipmaker.py (make_IPython): Changed default logging
3659 * IPython/ipmaker.py (make_IPython): Changed default logging
3658 (when simply called with -log) to use curr_dir/ipython.log in
3660 (when simply called with -log) to use curr_dir/ipython.log in
3659 rotate mode. Fixed crash which was occuring with -log before
3661 rotate mode. Fixed crash which was occuring with -log before
3660 (thanks to Jim Boyle).
3662 (thanks to Jim Boyle).
3661
3663
3662 2002-05-01 Fernando Perez <fperez@colorado.edu>
3664 2002-05-01 Fernando Perez <fperez@colorado.edu>
3663
3665
3664 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3666 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3665 was nasty -- though somewhat of a corner case).
3667 was nasty -- though somewhat of a corner case).
3666
3668
3667 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3669 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3668 text (was a bug).
3670 text (was a bug).
3669
3671
3670 2002-04-30 Fernando Perez <fperez@colorado.edu>
3672 2002-04-30 Fernando Perez <fperez@colorado.edu>
3671
3673
3672 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3674 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3673 a print after ^D or ^C from the user so that the In[] prompt
3675 a print after ^D or ^C from the user so that the In[] prompt
3674 doesn't over-run the gnuplot one.
3676 doesn't over-run the gnuplot one.
3675
3677
3676 2002-04-29 Fernando Perez <fperez@colorado.edu>
3678 2002-04-29 Fernando Perez <fperez@colorado.edu>
3677
3679
3678 * Released 0.2.10
3680 * Released 0.2.10
3679
3681
3680 * IPython/__release__.py (version): get date dynamically.
3682 * IPython/__release__.py (version): get date dynamically.
3681
3683
3682 * Misc. documentation updates thanks to Arnd's comments. Also ran
3684 * Misc. documentation updates thanks to Arnd's comments. Also ran
3683 a full spellcheck on the manual (hadn't been done in a while).
3685 a full spellcheck on the manual (hadn't been done in a while).
3684
3686
3685 2002-04-27 Fernando Perez <fperez@colorado.edu>
3687 2002-04-27 Fernando Perez <fperez@colorado.edu>
3686
3688
3687 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3689 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3688 starting a log in mid-session would reset the input history list.
3690 starting a log in mid-session would reset the input history list.
3689
3691
3690 2002-04-26 Fernando Perez <fperez@colorado.edu>
3692 2002-04-26 Fernando Perez <fperez@colorado.edu>
3691
3693
3692 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3694 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3693 all files were being included in an update. Now anything in
3695 all files were being included in an update. Now anything in
3694 UserConfig that matches [A-Za-z]*.py will go (this excludes
3696 UserConfig that matches [A-Za-z]*.py will go (this excludes
3695 __init__.py)
3697 __init__.py)
3696
3698
3697 2002-04-25 Fernando Perez <fperez@colorado.edu>
3699 2002-04-25 Fernando Perez <fperez@colorado.edu>
3698
3700
3699 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3701 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3700 to __builtins__ so that any form of embedded or imported code can
3702 to __builtins__ so that any form of embedded or imported code can
3701 test for being inside IPython.
3703 test for being inside IPython.
3702
3704
3703 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3705 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3704 changed to GnuplotMagic because it's now an importable module,
3706 changed to GnuplotMagic because it's now an importable module,
3705 this makes the name follow that of the standard Gnuplot module.
3707 this makes the name follow that of the standard Gnuplot module.
3706 GnuplotMagic can now be loaded at any time in mid-session.
3708 GnuplotMagic can now be loaded at any time in mid-session.
3707
3709
3708 2002-04-24 Fernando Perez <fperez@colorado.edu>
3710 2002-04-24 Fernando Perez <fperez@colorado.edu>
3709
3711
3710 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3712 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3711 the globals (IPython has its own namespace) and the
3713 the globals (IPython has its own namespace) and the
3712 PhysicalQuantity stuff is much better anyway.
3714 PhysicalQuantity stuff is much better anyway.
3713
3715
3714 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3716 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3715 embedding example to standard user directory for
3717 embedding example to standard user directory for
3716 distribution. Also put it in the manual.
3718 distribution. Also put it in the manual.
3717
3719
3718 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3720 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3719 instance as first argument (so it doesn't rely on some obscure
3721 instance as first argument (so it doesn't rely on some obscure
3720 hidden global).
3722 hidden global).
3721
3723
3722 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3724 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3723 delimiters. While it prevents ().TAB from working, it allows
3725 delimiters. While it prevents ().TAB from working, it allows
3724 completions in open (... expressions. This is by far a more common
3726 completions in open (... expressions. This is by far a more common
3725 case.
3727 case.
3726
3728
3727 2002-04-23 Fernando Perez <fperez@colorado.edu>
3729 2002-04-23 Fernando Perez <fperez@colorado.edu>
3728
3730
3729 * IPython/Extensions/InterpreterPasteInput.py: new
3731 * IPython/Extensions/InterpreterPasteInput.py: new
3730 syntax-processing module for pasting lines with >>> or ... at the
3732 syntax-processing module for pasting lines with >>> or ... at the
3731 start.
3733 start.
3732
3734
3733 * IPython/Extensions/PhysicalQ_Interactive.py
3735 * IPython/Extensions/PhysicalQ_Interactive.py
3734 (PhysicalQuantityInteractive.__int__): fixed to work with either
3736 (PhysicalQuantityInteractive.__int__): fixed to work with either
3735 Numeric or math.
3737 Numeric or math.
3736
3738
3737 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3739 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3738 provided profiles. Now we have:
3740 provided profiles. Now we have:
3739 -math -> math module as * and cmath with its own namespace.
3741 -math -> math module as * and cmath with its own namespace.
3740 -numeric -> Numeric as *, plus gnuplot & grace
3742 -numeric -> Numeric as *, plus gnuplot & grace
3741 -physics -> same as before
3743 -physics -> same as before
3742
3744
3743 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3745 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3744 user-defined magics wouldn't be found by @magic if they were
3746 user-defined magics wouldn't be found by @magic if they were
3745 defined as class methods. Also cleaned up the namespace search
3747 defined as class methods. Also cleaned up the namespace search
3746 logic and the string building (to use %s instead of many repeated
3748 logic and the string building (to use %s instead of many repeated
3747 string adds).
3749 string adds).
3748
3750
3749 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3751 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3750 of user-defined magics to operate with class methods (cleaner, in
3752 of user-defined magics to operate with class methods (cleaner, in
3751 line with the gnuplot code).
3753 line with the gnuplot code).
3752
3754
3753 2002-04-22 Fernando Perez <fperez@colorado.edu>
3755 2002-04-22 Fernando Perez <fperez@colorado.edu>
3754
3756
3755 * setup.py: updated dependency list so that manual is updated when
3757 * setup.py: updated dependency list so that manual is updated when
3756 all included files change.
3758 all included files change.
3757
3759
3758 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3760 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3759 the delimiter removal option (the fix is ugly right now).
3761 the delimiter removal option (the fix is ugly right now).
3760
3762
3761 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3763 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3762 all of the math profile (quicker loading, no conflict between
3764 all of the math profile (quicker loading, no conflict between
3763 g-9.8 and g-gnuplot).
3765 g-9.8 and g-gnuplot).
3764
3766
3765 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3767 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3766 name of post-mortem files to IPython_crash_report.txt.
3768 name of post-mortem files to IPython_crash_report.txt.
3767
3769
3768 * Cleanup/update of the docs. Added all the new readline info and
3770 * Cleanup/update of the docs. Added all the new readline info and
3769 formatted all lists as 'real lists'.
3771 formatted all lists as 'real lists'.
3770
3772
3771 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3773 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3772 tab-completion options, since the full readline parse_and_bind is
3774 tab-completion options, since the full readline parse_and_bind is
3773 now accessible.
3775 now accessible.
3774
3776
3775 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3777 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3776 handling of readline options. Now users can specify any string to
3778 handling of readline options. Now users can specify any string to
3777 be passed to parse_and_bind(), as well as the delimiters to be
3779 be passed to parse_and_bind(), as well as the delimiters to be
3778 removed.
3780 removed.
3779 (InteractiveShell.__init__): Added __name__ to the global
3781 (InteractiveShell.__init__): Added __name__ to the global
3780 namespace so that things like Itpl which rely on its existence
3782 namespace so that things like Itpl which rely on its existence
3781 don't crash.
3783 don't crash.
3782 (InteractiveShell._prefilter): Defined the default with a _ so
3784 (InteractiveShell._prefilter): Defined the default with a _ so
3783 that prefilter() is easier to override, while the default one
3785 that prefilter() is easier to override, while the default one
3784 remains available.
3786 remains available.
3785
3787
3786 2002-04-18 Fernando Perez <fperez@colorado.edu>
3788 2002-04-18 Fernando Perez <fperez@colorado.edu>
3787
3789
3788 * Added information about pdb in the docs.
3790 * Added information about pdb in the docs.
3789
3791
3790 2002-04-17 Fernando Perez <fperez@colorado.edu>
3792 2002-04-17 Fernando Perez <fperez@colorado.edu>
3791
3793
3792 * IPython/ipmaker.py (make_IPython): added rc_override option to
3794 * IPython/ipmaker.py (make_IPython): added rc_override option to
3793 allow passing config options at creation time which may override
3795 allow passing config options at creation time which may override
3794 anything set in the config files or command line. This is
3796 anything set in the config files or command line. This is
3795 particularly useful for configuring embedded instances.
3797 particularly useful for configuring embedded instances.
3796
3798
3797 2002-04-15 Fernando Perez <fperez@colorado.edu>
3799 2002-04-15 Fernando Perez <fperez@colorado.edu>
3798
3800
3799 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3801 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3800 crash embedded instances because of the input cache falling out of
3802 crash embedded instances because of the input cache falling out of
3801 sync with the output counter.
3803 sync with the output counter.
3802
3804
3803 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3805 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3804 mode which calls pdb after an uncaught exception in IPython itself.
3806 mode which calls pdb after an uncaught exception in IPython itself.
3805
3807
3806 2002-04-14 Fernando Perez <fperez@colorado.edu>
3808 2002-04-14 Fernando Perez <fperez@colorado.edu>
3807
3809
3808 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3810 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3809 readline, fix it back after each call.
3811 readline, fix it back after each call.
3810
3812
3811 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3813 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3812 method to force all access via __call__(), which guarantees that
3814 method to force all access via __call__(), which guarantees that
3813 traceback references are properly deleted.
3815 traceback references are properly deleted.
3814
3816
3815 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3817 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3816 improve printing when pprint is in use.
3818 improve printing when pprint is in use.
3817
3819
3818 2002-04-13 Fernando Perez <fperez@colorado.edu>
3820 2002-04-13 Fernando Perez <fperez@colorado.edu>
3819
3821
3820 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3822 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3821 exceptions aren't caught anymore. If the user triggers one, he
3823 exceptions aren't caught anymore. If the user triggers one, he
3822 should know why he's doing it and it should go all the way up,
3824 should know why he's doing it and it should go all the way up,
3823 just like any other exception. So now @abort will fully kill the
3825 just like any other exception. So now @abort will fully kill the
3824 embedded interpreter and the embedding code (unless that happens
3826 embedded interpreter and the embedding code (unless that happens
3825 to catch SystemExit).
3827 to catch SystemExit).
3826
3828
3827 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3829 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3828 and a debugger() method to invoke the interactive pdb debugger
3830 and a debugger() method to invoke the interactive pdb debugger
3829 after printing exception information. Also added the corresponding
3831 after printing exception information. Also added the corresponding
3830 -pdb option and @pdb magic to control this feature, and updated
3832 -pdb option and @pdb magic to control this feature, and updated
3831 the docs. After a suggestion from Christopher Hart
3833 the docs. After a suggestion from Christopher Hart
3832 (hart-AT-caltech.edu).
3834 (hart-AT-caltech.edu).
3833
3835
3834 2002-04-12 Fernando Perez <fperez@colorado.edu>
3836 2002-04-12 Fernando Perez <fperez@colorado.edu>
3835
3837
3836 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3838 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3837 the exception handlers defined by the user (not the CrashHandler)
3839 the exception handlers defined by the user (not the CrashHandler)
3838 so that user exceptions don't trigger an ipython bug report.
3840 so that user exceptions don't trigger an ipython bug report.
3839
3841
3840 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3842 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3841 configurable (it should have always been so).
3843 configurable (it should have always been so).
3842
3844
3843 2002-03-26 Fernando Perez <fperez@colorado.edu>
3845 2002-03-26 Fernando Perez <fperez@colorado.edu>
3844
3846
3845 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3847 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3846 and there to fix embedding namespace issues. This should all be
3848 and there to fix embedding namespace issues. This should all be
3847 done in a more elegant way.
3849 done in a more elegant way.
3848
3850
3849 2002-03-25 Fernando Perez <fperez@colorado.edu>
3851 2002-03-25 Fernando Perez <fperez@colorado.edu>
3850
3852
3851 * IPython/genutils.py (get_home_dir): Try to make it work under
3853 * IPython/genutils.py (get_home_dir): Try to make it work under
3852 win9x also.
3854 win9x also.
3853
3855
3854 2002-03-20 Fernando Perez <fperez@colorado.edu>
3856 2002-03-20 Fernando Perez <fperez@colorado.edu>
3855
3857
3856 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3858 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3857 sys.displayhook untouched upon __init__.
3859 sys.displayhook untouched upon __init__.
3858
3860
3859 2002-03-19 Fernando Perez <fperez@colorado.edu>
3861 2002-03-19 Fernando Perez <fperez@colorado.edu>
3860
3862
3861 * Released 0.2.9 (for embedding bug, basically).
3863 * Released 0.2.9 (for embedding bug, basically).
3862
3864
3863 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3865 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3864 exceptions so that enclosing shell's state can be restored.
3866 exceptions so that enclosing shell's state can be restored.
3865
3867
3866 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3868 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3867 naming conventions in the .ipython/ dir.
3869 naming conventions in the .ipython/ dir.
3868
3870
3869 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3871 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3870 from delimiters list so filenames with - in them get expanded.
3872 from delimiters list so filenames with - in them get expanded.
3871
3873
3872 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3874 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3873 sys.displayhook not being properly restored after an embedded call.
3875 sys.displayhook not being properly restored after an embedded call.
3874
3876
3875 2002-03-18 Fernando Perez <fperez@colorado.edu>
3877 2002-03-18 Fernando Perez <fperez@colorado.edu>
3876
3878
3877 * Released 0.2.8
3879 * Released 0.2.8
3878
3880
3879 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3881 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3880 some files weren't being included in a -upgrade.
3882 some files weren't being included in a -upgrade.
3881 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3883 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3882 on' so that the first tab completes.
3884 on' so that the first tab completes.
3883 (InteractiveShell.handle_magic): fixed bug with spaces around
3885 (InteractiveShell.handle_magic): fixed bug with spaces around
3884 quotes breaking many magic commands.
3886 quotes breaking many magic commands.
3885
3887
3886 * setup.py: added note about ignoring the syntax error messages at
3888 * setup.py: added note about ignoring the syntax error messages at
3887 installation.
3889 installation.
3888
3890
3889 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3891 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3890 streamlining the gnuplot interface, now there's only one magic @gp.
3892 streamlining the gnuplot interface, now there's only one magic @gp.
3891
3893
3892 2002-03-17 Fernando Perez <fperez@colorado.edu>
3894 2002-03-17 Fernando Perez <fperez@colorado.edu>
3893
3895
3894 * IPython/UserConfig/magic_gnuplot.py: new name for the
3896 * IPython/UserConfig/magic_gnuplot.py: new name for the
3895 example-magic_pm.py file. Much enhanced system, now with a shell
3897 example-magic_pm.py file. Much enhanced system, now with a shell
3896 for communicating directly with gnuplot, one command at a time.
3898 for communicating directly with gnuplot, one command at a time.
3897
3899
3898 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3900 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3899 setting __name__=='__main__'.
3901 setting __name__=='__main__'.
3900
3902
3901 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3903 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3902 mini-shell for accessing gnuplot from inside ipython. Should
3904 mini-shell for accessing gnuplot from inside ipython. Should
3903 extend it later for grace access too. Inspired by Arnd's
3905 extend it later for grace access too. Inspired by Arnd's
3904 suggestion.
3906 suggestion.
3905
3907
3906 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3908 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3907 calling magic functions with () in their arguments. Thanks to Arnd
3909 calling magic functions with () in their arguments. Thanks to Arnd
3908 Baecker for pointing this to me.
3910 Baecker for pointing this to me.
3909
3911
3910 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3912 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3911 infinitely for integer or complex arrays (only worked with floats).
3913 infinitely for integer or complex arrays (only worked with floats).
3912
3914
3913 2002-03-16 Fernando Perez <fperez@colorado.edu>
3915 2002-03-16 Fernando Perez <fperez@colorado.edu>
3914
3916
3915 * setup.py: Merged setup and setup_windows into a single script
3917 * setup.py: Merged setup and setup_windows into a single script
3916 which properly handles things for windows users.
3918 which properly handles things for windows users.
3917
3919
3918 2002-03-15 Fernando Perez <fperez@colorado.edu>
3920 2002-03-15 Fernando Perez <fperez@colorado.edu>
3919
3921
3920 * Big change to the manual: now the magics are all automatically
3922 * Big change to the manual: now the magics are all automatically
3921 documented. This information is generated from their docstrings
3923 documented. This information is generated from their docstrings
3922 and put in a latex file included by the manual lyx file. This way
3924 and put in a latex file included by the manual lyx file. This way
3923 we get always up to date information for the magics. The manual
3925 we get always up to date information for the magics. The manual
3924 now also has proper version information, also auto-synced.
3926 now also has proper version information, also auto-synced.
3925
3927
3926 For this to work, an undocumented --magic_docstrings option was added.
3928 For this to work, an undocumented --magic_docstrings option was added.
3927
3929
3928 2002-03-13 Fernando Perez <fperez@colorado.edu>
3930 2002-03-13 Fernando Perez <fperez@colorado.edu>
3929
3931
3930 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3932 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3931 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3933 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3932
3934
3933 2002-03-12 Fernando Perez <fperez@colorado.edu>
3935 2002-03-12 Fernando Perez <fperez@colorado.edu>
3934
3936
3935 * IPython/ultraTB.py (TermColors): changed color escapes again to
3937 * IPython/ultraTB.py (TermColors): changed color escapes again to
3936 fix the (old, reintroduced) line-wrapping bug. Basically, if
3938 fix the (old, reintroduced) line-wrapping bug. Basically, if
3937 \001..\002 aren't given in the color escapes, lines get wrapped
3939 \001..\002 aren't given in the color escapes, lines get wrapped
3938 weirdly. But giving those screws up old xterms and emacs terms. So
3940 weirdly. But giving those screws up old xterms and emacs terms. So
3939 I added some logic for emacs terms to be ok, but I can't identify old
3941 I added some logic for emacs terms to be ok, but I can't identify old
3940 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3942 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3941
3943
3942 2002-03-10 Fernando Perez <fperez@colorado.edu>
3944 2002-03-10 Fernando Perez <fperez@colorado.edu>
3943
3945
3944 * IPython/usage.py (__doc__): Various documentation cleanups and
3946 * IPython/usage.py (__doc__): Various documentation cleanups and
3945 updates, both in usage docstrings and in the manual.
3947 updates, both in usage docstrings and in the manual.
3946
3948
3947 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3949 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3948 handling of caching. Set minimum acceptabe value for having a
3950 handling of caching. Set minimum acceptabe value for having a
3949 cache at 20 values.
3951 cache at 20 values.
3950
3952
3951 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3953 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3952 install_first_time function to a method, renamed it and added an
3954 install_first_time function to a method, renamed it and added an
3953 'upgrade' mode. Now people can update their config directory with
3955 'upgrade' mode. Now people can update their config directory with
3954 a simple command line switch (-upgrade, also new).
3956 a simple command line switch (-upgrade, also new).
3955
3957
3956 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3958 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3957 @file (convenient for automagic users under Python >= 2.2).
3959 @file (convenient for automagic users under Python >= 2.2).
3958 Removed @files (it seemed more like a plural than an abbrev. of
3960 Removed @files (it seemed more like a plural than an abbrev. of
3959 'file show').
3961 'file show').
3960
3962
3961 * IPython/iplib.py (install_first_time): Fixed crash if there were
3963 * IPython/iplib.py (install_first_time): Fixed crash if there were
3962 backup files ('~') in .ipython/ install directory.
3964 backup files ('~') in .ipython/ install directory.
3963
3965
3964 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3966 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3965 system. Things look fine, but these changes are fairly
3967 system. Things look fine, but these changes are fairly
3966 intrusive. Test them for a few days.
3968 intrusive. Test them for a few days.
3967
3969
3968 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3970 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3969 the prompts system. Now all in/out prompt strings are user
3971 the prompts system. Now all in/out prompt strings are user
3970 controllable. This is particularly useful for embedding, as one
3972 controllable. This is particularly useful for embedding, as one
3971 can tag embedded instances with particular prompts.
3973 can tag embedded instances with particular prompts.
3972
3974
3973 Also removed global use of sys.ps1/2, which now allows nested
3975 Also removed global use of sys.ps1/2, which now allows nested
3974 embeddings without any problems. Added command-line options for
3976 embeddings without any problems. Added command-line options for
3975 the prompt strings.
3977 the prompt strings.
3976
3978
3977 2002-03-08 Fernando Perez <fperez@colorado.edu>
3979 2002-03-08 Fernando Perez <fperez@colorado.edu>
3978
3980
3979 * IPython/UserConfig/example-embed-short.py (ipshell): added
3981 * IPython/UserConfig/example-embed-short.py (ipshell): added
3980 example file with the bare minimum code for embedding.
3982 example file with the bare minimum code for embedding.
3981
3983
3982 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3984 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3983 functionality for the embeddable shell to be activated/deactivated
3985 functionality for the embeddable shell to be activated/deactivated
3984 either globally or at each call.
3986 either globally or at each call.
3985
3987
3986 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3988 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3987 rewriting the prompt with '--->' for auto-inputs with proper
3989 rewriting the prompt with '--->' for auto-inputs with proper
3988 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3990 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3989 this is handled by the prompts class itself, as it should.
3991 this is handled by the prompts class itself, as it should.
3990
3992
3991 2002-03-05 Fernando Perez <fperez@colorado.edu>
3993 2002-03-05 Fernando Perez <fperez@colorado.edu>
3992
3994
3993 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3995 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3994 @logstart to avoid name clashes with the math log function.
3996 @logstart to avoid name clashes with the math log function.
3995
3997
3996 * Big updates to X/Emacs section of the manual.
3998 * Big updates to X/Emacs section of the manual.
3997
3999
3998 * Removed ipython_emacs. Milan explained to me how to pass
4000 * Removed ipython_emacs. Milan explained to me how to pass
3999 arguments to ipython through Emacs. Some day I'm going to end up
4001 arguments to ipython through Emacs. Some day I'm going to end up
4000 learning some lisp...
4002 learning some lisp...
4001
4003
4002 2002-03-04 Fernando Perez <fperez@colorado.edu>
4004 2002-03-04 Fernando Perez <fperez@colorado.edu>
4003
4005
4004 * IPython/ipython_emacs: Created script to be used as the
4006 * IPython/ipython_emacs: Created script to be used as the
4005 py-python-command Emacs variable so we can pass IPython
4007 py-python-command Emacs variable so we can pass IPython
4006 parameters. I can't figure out how to tell Emacs directly to pass
4008 parameters. I can't figure out how to tell Emacs directly to pass
4007 parameters to IPython, so a dummy shell script will do it.
4009 parameters to IPython, so a dummy shell script will do it.
4008
4010
4009 Other enhancements made for things to work better under Emacs'
4011 Other enhancements made for things to work better under Emacs'
4010 various types of terminals. Many thanks to Milan Zamazal
4012 various types of terminals. Many thanks to Milan Zamazal
4011 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4013 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4012
4014
4013 2002-03-01 Fernando Perez <fperez@colorado.edu>
4015 2002-03-01 Fernando Perez <fperez@colorado.edu>
4014
4016
4015 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4017 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4016 that loading of readline is now optional. This gives better
4018 that loading of readline is now optional. This gives better
4017 control to emacs users.
4019 control to emacs users.
4018
4020
4019 * IPython/ultraTB.py (__date__): Modified color escape sequences
4021 * IPython/ultraTB.py (__date__): Modified color escape sequences
4020 and now things work fine under xterm and in Emacs' term buffers
4022 and now things work fine under xterm and in Emacs' term buffers
4021 (though not shell ones). Well, in emacs you get colors, but all
4023 (though not shell ones). Well, in emacs you get colors, but all
4022 seem to be 'light' colors (no difference between dark and light
4024 seem to be 'light' colors (no difference between dark and light
4023 ones). But the garbage chars are gone, and also in xterms. It
4025 ones). But the garbage chars are gone, and also in xterms. It
4024 seems that now I'm using 'cleaner' ansi sequences.
4026 seems that now I'm using 'cleaner' ansi sequences.
4025
4027
4026 2002-02-21 Fernando Perez <fperez@colorado.edu>
4028 2002-02-21 Fernando Perez <fperez@colorado.edu>
4027
4029
4028 * Released 0.2.7 (mainly to publish the scoping fix).
4030 * Released 0.2.7 (mainly to publish the scoping fix).
4029
4031
4030 * IPython/Logger.py (Logger.logstate): added. A corresponding
4032 * IPython/Logger.py (Logger.logstate): added. A corresponding
4031 @logstate magic was created.
4033 @logstate magic was created.
4032
4034
4033 * IPython/Magic.py: fixed nested scoping problem under Python
4035 * IPython/Magic.py: fixed nested scoping problem under Python
4034 2.1.x (automagic wasn't working).
4036 2.1.x (automagic wasn't working).
4035
4037
4036 2002-02-20 Fernando Perez <fperez@colorado.edu>
4038 2002-02-20 Fernando Perez <fperez@colorado.edu>
4037
4039
4038 * Released 0.2.6.
4040 * Released 0.2.6.
4039
4041
4040 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4042 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4041 option so that logs can come out without any headers at all.
4043 option so that logs can come out without any headers at all.
4042
4044
4043 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4045 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4044 SciPy.
4046 SciPy.
4045
4047
4046 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4048 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4047 that embedded IPython calls don't require vars() to be explicitly
4049 that embedded IPython calls don't require vars() to be explicitly
4048 passed. Now they are extracted from the caller's frame (code
4050 passed. Now they are extracted from the caller's frame (code
4049 snatched from Eric Jones' weave). Added better documentation to
4051 snatched from Eric Jones' weave). Added better documentation to
4050 the section on embedding and the example file.
4052 the section on embedding and the example file.
4051
4053
4052 * IPython/genutils.py (page): Changed so that under emacs, it just
4054 * IPython/genutils.py (page): Changed so that under emacs, it just
4053 prints the string. You can then page up and down in the emacs
4055 prints the string. You can then page up and down in the emacs
4054 buffer itself. This is how the builtin help() works.
4056 buffer itself. This is how the builtin help() works.
4055
4057
4056 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4058 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4057 macro scoping: macros need to be executed in the user's namespace
4059 macro scoping: macros need to be executed in the user's namespace
4058 to work as if they had been typed by the user.
4060 to work as if they had been typed by the user.
4059
4061
4060 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4062 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4061 execute automatically (no need to type 'exec...'). They then
4063 execute automatically (no need to type 'exec...'). They then
4062 behave like 'true macros'. The printing system was also modified
4064 behave like 'true macros'. The printing system was also modified
4063 for this to work.
4065 for this to work.
4064
4066
4065 2002-02-19 Fernando Perez <fperez@colorado.edu>
4067 2002-02-19 Fernando Perez <fperez@colorado.edu>
4066
4068
4067 * IPython/genutils.py (page_file): new function for paging files
4069 * IPython/genutils.py (page_file): new function for paging files
4068 in an OS-independent way. Also necessary for file viewing to work
4070 in an OS-independent way. Also necessary for file viewing to work
4069 well inside Emacs buffers.
4071 well inside Emacs buffers.
4070 (page): Added checks for being in an emacs buffer.
4072 (page): Added checks for being in an emacs buffer.
4071 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4073 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4072 same bug in iplib.
4074 same bug in iplib.
4073
4075
4074 2002-02-18 Fernando Perez <fperez@colorado.edu>
4076 2002-02-18 Fernando Perez <fperez@colorado.edu>
4075
4077
4076 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4078 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4077 of readline so that IPython can work inside an Emacs buffer.
4079 of readline so that IPython can work inside an Emacs buffer.
4078
4080
4079 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4081 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4080 method signatures (they weren't really bugs, but it looks cleaner
4082 method signatures (they weren't really bugs, but it looks cleaner
4081 and keeps PyChecker happy).
4083 and keeps PyChecker happy).
4082
4084
4083 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4085 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4084 for implementing various user-defined hooks. Currently only
4086 for implementing various user-defined hooks. Currently only
4085 display is done.
4087 display is done.
4086
4088
4087 * IPython/Prompts.py (CachedOutput._display): changed display
4089 * IPython/Prompts.py (CachedOutput._display): changed display
4088 functions so that they can be dynamically changed by users easily.
4090 functions so that they can be dynamically changed by users easily.
4089
4091
4090 * IPython/Extensions/numeric_formats.py (num_display): added an
4092 * IPython/Extensions/numeric_formats.py (num_display): added an
4091 extension for printing NumPy arrays in flexible manners. It
4093 extension for printing NumPy arrays in flexible manners. It
4092 doesn't do anything yet, but all the structure is in
4094 doesn't do anything yet, but all the structure is in
4093 place. Ultimately the plan is to implement output format control
4095 place. Ultimately the plan is to implement output format control
4094 like in Octave.
4096 like in Octave.
4095
4097
4096 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4098 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4097 methods are found at run-time by all the automatic machinery.
4099 methods are found at run-time by all the automatic machinery.
4098
4100
4099 2002-02-17 Fernando Perez <fperez@colorado.edu>
4101 2002-02-17 Fernando Perez <fperez@colorado.edu>
4100
4102
4101 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4103 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4102 whole file a little.
4104 whole file a little.
4103
4105
4104 * ToDo: closed this document. Now there's a new_design.lyx
4106 * ToDo: closed this document. Now there's a new_design.lyx
4105 document for all new ideas. Added making a pdf of it for the
4107 document for all new ideas. Added making a pdf of it for the
4106 end-user distro.
4108 end-user distro.
4107
4109
4108 * IPython/Logger.py (Logger.switch_log): Created this to replace
4110 * IPython/Logger.py (Logger.switch_log): Created this to replace
4109 logon() and logoff(). It also fixes a nasty crash reported by
4111 logon() and logoff(). It also fixes a nasty crash reported by
4110 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4112 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4111
4113
4112 * IPython/iplib.py (complete): got auto-completion to work with
4114 * IPython/iplib.py (complete): got auto-completion to work with
4113 automagic (I had wanted this for a long time).
4115 automagic (I had wanted this for a long time).
4114
4116
4115 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4117 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4116 to @file, since file() is now a builtin and clashes with automagic
4118 to @file, since file() is now a builtin and clashes with automagic
4117 for @file.
4119 for @file.
4118
4120
4119 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4121 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4120 of this was previously in iplib, which had grown to more than 2000
4122 of this was previously in iplib, which had grown to more than 2000
4121 lines, way too long. No new functionality, but it makes managing
4123 lines, way too long. No new functionality, but it makes managing
4122 the code a bit easier.
4124 the code a bit easier.
4123
4125
4124 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4126 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4125 information to crash reports.
4127 information to crash reports.
4126
4128
4127 2002-02-12 Fernando Perez <fperez@colorado.edu>
4129 2002-02-12 Fernando Perez <fperez@colorado.edu>
4128
4130
4129 * Released 0.2.5.
4131 * Released 0.2.5.
4130
4132
4131 2002-02-11 Fernando Perez <fperez@colorado.edu>
4133 2002-02-11 Fernando Perez <fperez@colorado.edu>
4132
4134
4133 * Wrote a relatively complete Windows installer. It puts
4135 * Wrote a relatively complete Windows installer. It puts
4134 everything in place, creates Start Menu entries and fixes the
4136 everything in place, creates Start Menu entries and fixes the
4135 color issues. Nothing fancy, but it works.
4137 color issues. Nothing fancy, but it works.
4136
4138
4137 2002-02-10 Fernando Perez <fperez@colorado.edu>
4139 2002-02-10 Fernando Perez <fperez@colorado.edu>
4138
4140
4139 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4141 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4140 os.path.expanduser() call so that we can type @run ~/myfile.py and
4142 os.path.expanduser() call so that we can type @run ~/myfile.py and
4141 have thigs work as expected.
4143 have thigs work as expected.
4142
4144
4143 * IPython/genutils.py (page): fixed exception handling so things
4145 * IPython/genutils.py (page): fixed exception handling so things
4144 work both in Unix and Windows correctly. Quitting a pager triggers
4146 work both in Unix and Windows correctly. Quitting a pager triggers
4145 an IOError/broken pipe in Unix, and in windows not finding a pager
4147 an IOError/broken pipe in Unix, and in windows not finding a pager
4146 is also an IOError, so I had to actually look at the return value
4148 is also an IOError, so I had to actually look at the return value
4147 of the exception, not just the exception itself. Should be ok now.
4149 of the exception, not just the exception itself. Should be ok now.
4148
4150
4149 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4151 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4150 modified to allow case-insensitive color scheme changes.
4152 modified to allow case-insensitive color scheme changes.
4151
4153
4152 2002-02-09 Fernando Perez <fperez@colorado.edu>
4154 2002-02-09 Fernando Perez <fperez@colorado.edu>
4153
4155
4154 * IPython/genutils.py (native_line_ends): new function to leave
4156 * IPython/genutils.py (native_line_ends): new function to leave
4155 user config files with os-native line-endings.
4157 user config files with os-native line-endings.
4156
4158
4157 * README and manual updates.
4159 * README and manual updates.
4158
4160
4159 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4161 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4160 instead of StringType to catch Unicode strings.
4162 instead of StringType to catch Unicode strings.
4161
4163
4162 * IPython/genutils.py (filefind): fixed bug for paths with
4164 * IPython/genutils.py (filefind): fixed bug for paths with
4163 embedded spaces (very common in Windows).
4165 embedded spaces (very common in Windows).
4164
4166
4165 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4167 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4166 files under Windows, so that they get automatically associated
4168 files under Windows, so that they get automatically associated
4167 with a text editor. Windows makes it a pain to handle
4169 with a text editor. Windows makes it a pain to handle
4168 extension-less files.
4170 extension-less files.
4169
4171
4170 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4172 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4171 warning about readline only occur for Posix. In Windows there's no
4173 warning about readline only occur for Posix. In Windows there's no
4172 way to get readline, so why bother with the warning.
4174 way to get readline, so why bother with the warning.
4173
4175
4174 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4176 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4175 for __str__ instead of dir(self), since dir() changed in 2.2.
4177 for __str__ instead of dir(self), since dir() changed in 2.2.
4176
4178
4177 * Ported to Windows! Tested on XP, I suspect it should work fine
4179 * Ported to Windows! Tested on XP, I suspect it should work fine
4178 on NT/2000, but I don't think it will work on 98 et al. That
4180 on NT/2000, but I don't think it will work on 98 et al. That
4179 series of Windows is such a piece of junk anyway that I won't try
4181 series of Windows is such a piece of junk anyway that I won't try
4180 porting it there. The XP port was straightforward, showed a few
4182 porting it there. The XP port was straightforward, showed a few
4181 bugs here and there (fixed all), in particular some string
4183 bugs here and there (fixed all), in particular some string
4182 handling stuff which required considering Unicode strings (which
4184 handling stuff which required considering Unicode strings (which
4183 Windows uses). This is good, but hasn't been too tested :) No
4185 Windows uses). This is good, but hasn't been too tested :) No
4184 fancy installer yet, I'll put a note in the manual so people at
4186 fancy installer yet, I'll put a note in the manual so people at
4185 least make manually a shortcut.
4187 least make manually a shortcut.
4186
4188
4187 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4189 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4188 into a single one, "colors". This now controls both prompt and
4190 into a single one, "colors". This now controls both prompt and
4189 exception color schemes, and can be changed both at startup
4191 exception color schemes, and can be changed both at startup
4190 (either via command-line switches or via ipythonrc files) and at
4192 (either via command-line switches or via ipythonrc files) and at
4191 runtime, with @colors.
4193 runtime, with @colors.
4192 (Magic.magic_run): renamed @prun to @run and removed the old
4194 (Magic.magic_run): renamed @prun to @run and removed the old
4193 @run. The two were too similar to warrant keeping both.
4195 @run. The two were too similar to warrant keeping both.
4194
4196
4195 2002-02-03 Fernando Perez <fperez@colorado.edu>
4197 2002-02-03 Fernando Perez <fperez@colorado.edu>
4196
4198
4197 * IPython/iplib.py (install_first_time): Added comment on how to
4199 * IPython/iplib.py (install_first_time): Added comment on how to
4198 configure the color options for first-time users. Put a <return>
4200 configure the color options for first-time users. Put a <return>
4199 request at the end so that small-terminal users get a chance to
4201 request at the end so that small-terminal users get a chance to
4200 read the startup info.
4202 read the startup info.
4201
4203
4202 2002-01-23 Fernando Perez <fperez@colorado.edu>
4204 2002-01-23 Fernando Perez <fperez@colorado.edu>
4203
4205
4204 * IPython/iplib.py (CachedOutput.update): Changed output memory
4206 * IPython/iplib.py (CachedOutput.update): Changed output memory
4205 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4207 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4206 input history we still use _i. Did this b/c these variable are
4208 input history we still use _i. Did this b/c these variable are
4207 very commonly used in interactive work, so the less we need to
4209 very commonly used in interactive work, so the less we need to
4208 type the better off we are.
4210 type the better off we are.
4209 (Magic.magic_prun): updated @prun to better handle the namespaces
4211 (Magic.magic_prun): updated @prun to better handle the namespaces
4210 the file will run in, including a fix for __name__ not being set
4212 the file will run in, including a fix for __name__ not being set
4211 before.
4213 before.
4212
4214
4213 2002-01-20 Fernando Perez <fperez@colorado.edu>
4215 2002-01-20 Fernando Perez <fperez@colorado.edu>
4214
4216
4215 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4217 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4216 extra garbage for Python 2.2. Need to look more carefully into
4218 extra garbage for Python 2.2. Need to look more carefully into
4217 this later.
4219 this later.
4218
4220
4219 2002-01-19 Fernando Perez <fperez@colorado.edu>
4221 2002-01-19 Fernando Perez <fperez@colorado.edu>
4220
4222
4221 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4223 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4222 display SyntaxError exceptions properly formatted when they occur
4224 display SyntaxError exceptions properly formatted when they occur
4223 (they can be triggered by imported code).
4225 (they can be triggered by imported code).
4224
4226
4225 2002-01-18 Fernando Perez <fperez@colorado.edu>
4227 2002-01-18 Fernando Perez <fperez@colorado.edu>
4226
4228
4227 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4229 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4228 SyntaxError exceptions are reported nicely formatted, instead of
4230 SyntaxError exceptions are reported nicely formatted, instead of
4229 spitting out only offset information as before.
4231 spitting out only offset information as before.
4230 (Magic.magic_prun): Added the @prun function for executing
4232 (Magic.magic_prun): Added the @prun function for executing
4231 programs with command line args inside IPython.
4233 programs with command line args inside IPython.
4232
4234
4233 2002-01-16 Fernando Perez <fperez@colorado.edu>
4235 2002-01-16 Fernando Perez <fperez@colorado.edu>
4234
4236
4235 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4237 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4236 to *not* include the last item given in a range. This brings their
4238 to *not* include the last item given in a range. This brings their
4237 behavior in line with Python's slicing:
4239 behavior in line with Python's slicing:
4238 a[n1:n2] -> a[n1]...a[n2-1]
4240 a[n1:n2] -> a[n1]...a[n2-1]
4239 It may be a bit less convenient, but I prefer to stick to Python's
4241 It may be a bit less convenient, but I prefer to stick to Python's
4240 conventions *everywhere*, so users never have to wonder.
4242 conventions *everywhere*, so users never have to wonder.
4241 (Magic.magic_macro): Added @macro function to ease the creation of
4243 (Magic.magic_macro): Added @macro function to ease the creation of
4242 macros.
4244 macros.
4243
4245
4244 2002-01-05 Fernando Perez <fperez@colorado.edu>
4246 2002-01-05 Fernando Perez <fperez@colorado.edu>
4245
4247
4246 * Released 0.2.4.
4248 * Released 0.2.4.
4247
4249
4248 * IPython/iplib.py (Magic.magic_pdef):
4250 * IPython/iplib.py (Magic.magic_pdef):
4249 (InteractiveShell.safe_execfile): report magic lines and error
4251 (InteractiveShell.safe_execfile): report magic lines and error
4250 lines without line numbers so one can easily copy/paste them for
4252 lines without line numbers so one can easily copy/paste them for
4251 re-execution.
4253 re-execution.
4252
4254
4253 * Updated manual with recent changes.
4255 * Updated manual with recent changes.
4254
4256
4255 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4257 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4256 docstring printing when class? is called. Very handy for knowing
4258 docstring printing when class? is called. Very handy for knowing
4257 how to create class instances (as long as __init__ is well
4259 how to create class instances (as long as __init__ is well
4258 documented, of course :)
4260 documented, of course :)
4259 (Magic.magic_doc): print both class and constructor docstrings.
4261 (Magic.magic_doc): print both class and constructor docstrings.
4260 (Magic.magic_pdef): give constructor info if passed a class and
4262 (Magic.magic_pdef): give constructor info if passed a class and
4261 __call__ info for callable object instances.
4263 __call__ info for callable object instances.
4262
4264
4263 2002-01-04 Fernando Perez <fperez@colorado.edu>
4265 2002-01-04 Fernando Perez <fperez@colorado.edu>
4264
4266
4265 * Made deep_reload() off by default. It doesn't always work
4267 * Made deep_reload() off by default. It doesn't always work
4266 exactly as intended, so it's probably safer to have it off. It's
4268 exactly as intended, so it's probably safer to have it off. It's
4267 still available as dreload() anyway, so nothing is lost.
4269 still available as dreload() anyway, so nothing is lost.
4268
4270
4269 2002-01-02 Fernando Perez <fperez@colorado.edu>
4271 2002-01-02 Fernando Perez <fperez@colorado.edu>
4270
4272
4271 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4273 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4272 so I wanted an updated release).
4274 so I wanted an updated release).
4273
4275
4274 2001-12-27 Fernando Perez <fperez@colorado.edu>
4276 2001-12-27 Fernando Perez <fperez@colorado.edu>
4275
4277
4276 * IPython/iplib.py (InteractiveShell.interact): Added the original
4278 * IPython/iplib.py (InteractiveShell.interact): Added the original
4277 code from 'code.py' for this module in order to change the
4279 code from 'code.py' for this module in order to change the
4278 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4280 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4279 the history cache would break when the user hit Ctrl-C, and
4281 the history cache would break when the user hit Ctrl-C, and
4280 interact() offers no way to add any hooks to it.
4282 interact() offers no way to add any hooks to it.
4281
4283
4282 2001-12-23 Fernando Perez <fperez@colorado.edu>
4284 2001-12-23 Fernando Perez <fperez@colorado.edu>
4283
4285
4284 * setup.py: added check for 'MANIFEST' before trying to remove
4286 * setup.py: added check for 'MANIFEST' before trying to remove
4285 it. Thanks to Sean Reifschneider.
4287 it. Thanks to Sean Reifschneider.
4286
4288
4287 2001-12-22 Fernando Perez <fperez@colorado.edu>
4289 2001-12-22 Fernando Perez <fperez@colorado.edu>
4288
4290
4289 * Released 0.2.2.
4291 * Released 0.2.2.
4290
4292
4291 * Finished (reasonably) writing the manual. Later will add the
4293 * Finished (reasonably) writing the manual. Later will add the
4292 python-standard navigation stylesheets, but for the time being
4294 python-standard navigation stylesheets, but for the time being
4293 it's fairly complete. Distribution will include html and pdf
4295 it's fairly complete. Distribution will include html and pdf
4294 versions.
4296 versions.
4295
4297
4296 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4298 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4297 (MayaVi author).
4299 (MayaVi author).
4298
4300
4299 2001-12-21 Fernando Perez <fperez@colorado.edu>
4301 2001-12-21 Fernando Perez <fperez@colorado.edu>
4300
4302
4301 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4303 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4302 good public release, I think (with the manual and the distutils
4304 good public release, I think (with the manual and the distutils
4303 installer). The manual can use some work, but that can go
4305 installer). The manual can use some work, but that can go
4304 slowly. Otherwise I think it's quite nice for end users. Next
4306 slowly. Otherwise I think it's quite nice for end users. Next
4305 summer, rewrite the guts of it...
4307 summer, rewrite the guts of it...
4306
4308
4307 * Changed format of ipythonrc files to use whitespace as the
4309 * Changed format of ipythonrc files to use whitespace as the
4308 separator instead of an explicit '='. Cleaner.
4310 separator instead of an explicit '='. Cleaner.
4309
4311
4310 2001-12-20 Fernando Perez <fperez@colorado.edu>
4312 2001-12-20 Fernando Perez <fperez@colorado.edu>
4311
4313
4312 * Started a manual in LyX. For now it's just a quick merge of the
4314 * Started a manual in LyX. For now it's just a quick merge of the
4313 various internal docstrings and READMEs. Later it may grow into a
4315 various internal docstrings and READMEs. Later it may grow into a
4314 nice, full-blown manual.
4316 nice, full-blown manual.
4315
4317
4316 * Set up a distutils based installer. Installation should now be
4318 * Set up a distutils based installer. Installation should now be
4317 trivially simple for end-users.
4319 trivially simple for end-users.
4318
4320
4319 2001-12-11 Fernando Perez <fperez@colorado.edu>
4321 2001-12-11 Fernando Perez <fperez@colorado.edu>
4320
4322
4321 * Released 0.2.0. First public release, announced it at
4323 * Released 0.2.0. First public release, announced it at
4322 comp.lang.python. From now on, just bugfixes...
4324 comp.lang.python. From now on, just bugfixes...
4323
4325
4324 * Went through all the files, set copyright/license notices and
4326 * Went through all the files, set copyright/license notices and
4325 cleaned up things. Ready for release.
4327 cleaned up things. Ready for release.
4326
4328
4327 2001-12-10 Fernando Perez <fperez@colorado.edu>
4329 2001-12-10 Fernando Perez <fperez@colorado.edu>
4328
4330
4329 * Changed the first-time installer not to use tarfiles. It's more
4331 * Changed the first-time installer not to use tarfiles. It's more
4330 robust now and less unix-dependent. Also makes it easier for
4332 robust now and less unix-dependent. Also makes it easier for
4331 people to later upgrade versions.
4333 people to later upgrade versions.
4332
4334
4333 * Changed @exit to @abort to reflect the fact that it's pretty
4335 * Changed @exit to @abort to reflect the fact that it's pretty
4334 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4336 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4335 becomes significant only when IPyhton is embedded: in that case,
4337 becomes significant only when IPyhton is embedded: in that case,
4336 C-D closes IPython only, but @abort kills the enclosing program
4338 C-D closes IPython only, but @abort kills the enclosing program
4337 too (unless it had called IPython inside a try catching
4339 too (unless it had called IPython inside a try catching
4338 SystemExit).
4340 SystemExit).
4339
4341
4340 * Created Shell module which exposes the actuall IPython Shell
4342 * Created Shell module which exposes the actuall IPython Shell
4341 classes, currently the normal and the embeddable one. This at
4343 classes, currently the normal and the embeddable one. This at
4342 least offers a stable interface we won't need to change when
4344 least offers a stable interface we won't need to change when
4343 (later) the internals are rewritten. That rewrite will be confined
4345 (later) the internals are rewritten. That rewrite will be confined
4344 to iplib and ipmaker, but the Shell interface should remain as is.
4346 to iplib and ipmaker, but the Shell interface should remain as is.
4345
4347
4346 * Added embed module which offers an embeddable IPShell object,
4348 * Added embed module which offers an embeddable IPShell object,
4347 useful to fire up IPython *inside* a running program. Great for
4349 useful to fire up IPython *inside* a running program. Great for
4348 debugging or dynamical data analysis.
4350 debugging or dynamical data analysis.
4349
4351
4350 2001-12-08 Fernando Perez <fperez@colorado.edu>
4352 2001-12-08 Fernando Perez <fperez@colorado.edu>
4351
4353
4352 * Fixed small bug preventing seeing info from methods of defined
4354 * Fixed small bug preventing seeing info from methods of defined
4353 objects (incorrect namespace in _ofind()).
4355 objects (incorrect namespace in _ofind()).
4354
4356
4355 * Documentation cleanup. Moved the main usage docstrings to a
4357 * Documentation cleanup. Moved the main usage docstrings to a
4356 separate file, usage.py (cleaner to maintain, and hopefully in the
4358 separate file, usage.py (cleaner to maintain, and hopefully in the
4357 future some perlpod-like way of producing interactive, man and
4359 future some perlpod-like way of producing interactive, man and
4358 html docs out of it will be found).
4360 html docs out of it will be found).
4359
4361
4360 * Added @profile to see your profile at any time.
4362 * Added @profile to see your profile at any time.
4361
4363
4362 * Added @p as an alias for 'print'. It's especially convenient if
4364 * Added @p as an alias for 'print'. It's especially convenient if
4363 using automagic ('p x' prints x).
4365 using automagic ('p x' prints x).
4364
4366
4365 * Small cleanups and fixes after a pychecker run.
4367 * Small cleanups and fixes after a pychecker run.
4366
4368
4367 * Changed the @cd command to handle @cd - and @cd -<n> for
4369 * Changed the @cd command to handle @cd - and @cd -<n> for
4368 visiting any directory in _dh.
4370 visiting any directory in _dh.
4369
4371
4370 * Introduced _dh, a history of visited directories. @dhist prints
4372 * Introduced _dh, a history of visited directories. @dhist prints
4371 it out with numbers.
4373 it out with numbers.
4372
4374
4373 2001-12-07 Fernando Perez <fperez@colorado.edu>
4375 2001-12-07 Fernando Perez <fperez@colorado.edu>
4374
4376
4375 * Released 0.1.22
4377 * Released 0.1.22
4376
4378
4377 * Made initialization a bit more robust against invalid color
4379 * Made initialization a bit more robust against invalid color
4378 options in user input (exit, not traceback-crash).
4380 options in user input (exit, not traceback-crash).
4379
4381
4380 * Changed the bug crash reporter to write the report only in the
4382 * Changed the bug crash reporter to write the report only in the
4381 user's .ipython directory. That way IPython won't litter people's
4383 user's .ipython directory. That way IPython won't litter people's
4382 hard disks with crash files all over the place. Also print on
4384 hard disks with crash files all over the place. Also print on
4383 screen the necessary mail command.
4385 screen the necessary mail command.
4384
4386
4385 * With the new ultraTB, implemented LightBG color scheme for light
4387 * With the new ultraTB, implemented LightBG color scheme for light
4386 background terminals. A lot of people like white backgrounds, so I
4388 background terminals. A lot of people like white backgrounds, so I
4387 guess we should at least give them something readable.
4389 guess we should at least give them something readable.
4388
4390
4389 2001-12-06 Fernando Perez <fperez@colorado.edu>
4391 2001-12-06 Fernando Perez <fperez@colorado.edu>
4390
4392
4391 * Modified the structure of ultraTB. Now there's a proper class
4393 * Modified the structure of ultraTB. Now there's a proper class
4392 for tables of color schemes which allow adding schemes easily and
4394 for tables of color schemes which allow adding schemes easily and
4393 switching the active scheme without creating a new instance every
4395 switching the active scheme without creating a new instance every
4394 time (which was ridiculous). The syntax for creating new schemes
4396 time (which was ridiculous). The syntax for creating new schemes
4395 is also cleaner. I think ultraTB is finally done, with a clean
4397 is also cleaner. I think ultraTB is finally done, with a clean
4396 class structure. Names are also much cleaner (now there's proper
4398 class structure. Names are also much cleaner (now there's proper
4397 color tables, no need for every variable to also have 'color' in
4399 color tables, no need for every variable to also have 'color' in
4398 its name).
4400 its name).
4399
4401
4400 * Broke down genutils into separate files. Now genutils only
4402 * Broke down genutils into separate files. Now genutils only
4401 contains utility functions, and classes have been moved to their
4403 contains utility functions, and classes have been moved to their
4402 own files (they had enough independent functionality to warrant
4404 own files (they had enough independent functionality to warrant
4403 it): ConfigLoader, OutputTrap, Struct.
4405 it): ConfigLoader, OutputTrap, Struct.
4404
4406
4405 2001-12-05 Fernando Perez <fperez@colorado.edu>
4407 2001-12-05 Fernando Perez <fperez@colorado.edu>
4406
4408
4407 * IPython turns 21! Released version 0.1.21, as a candidate for
4409 * IPython turns 21! Released version 0.1.21, as a candidate for
4408 public consumption. If all goes well, release in a few days.
4410 public consumption. If all goes well, release in a few days.
4409
4411
4410 * Fixed path bug (files in Extensions/ directory wouldn't be found
4412 * Fixed path bug (files in Extensions/ directory wouldn't be found
4411 unless IPython/ was explicitly in sys.path).
4413 unless IPython/ was explicitly in sys.path).
4412
4414
4413 * Extended the FlexCompleter class as MagicCompleter to allow
4415 * Extended the FlexCompleter class as MagicCompleter to allow
4414 completion of @-starting lines.
4416 completion of @-starting lines.
4415
4417
4416 * Created __release__.py file as a central repository for release
4418 * Created __release__.py file as a central repository for release
4417 info that other files can read from.
4419 info that other files can read from.
4418
4420
4419 * Fixed small bug in logging: when logging was turned on in
4421 * Fixed small bug in logging: when logging was turned on in
4420 mid-session, old lines with special meanings (!@?) were being
4422 mid-session, old lines with special meanings (!@?) were being
4421 logged without the prepended comment, which is necessary since
4423 logged without the prepended comment, which is necessary since
4422 they are not truly valid python syntax. This should make session
4424 they are not truly valid python syntax. This should make session
4423 restores produce less errors.
4425 restores produce less errors.
4424
4426
4425 * The namespace cleanup forced me to make a FlexCompleter class
4427 * The namespace cleanup forced me to make a FlexCompleter class
4426 which is nothing but a ripoff of rlcompleter, but with selectable
4428 which is nothing but a ripoff of rlcompleter, but with selectable
4427 namespace (rlcompleter only works in __main__.__dict__). I'll try
4429 namespace (rlcompleter only works in __main__.__dict__). I'll try
4428 to submit a note to the authors to see if this change can be
4430 to submit a note to the authors to see if this change can be
4429 incorporated in future rlcompleter releases (Dec.6: done)
4431 incorporated in future rlcompleter releases (Dec.6: done)
4430
4432
4431 * More fixes to namespace handling. It was a mess! Now all
4433 * More fixes to namespace handling. It was a mess! Now all
4432 explicit references to __main__.__dict__ are gone (except when
4434 explicit references to __main__.__dict__ are gone (except when
4433 really needed) and everything is handled through the namespace
4435 really needed) and everything is handled through the namespace
4434 dicts in the IPython instance. We seem to be getting somewhere
4436 dicts in the IPython instance. We seem to be getting somewhere
4435 with this, finally...
4437 with this, finally...
4436
4438
4437 * Small documentation updates.
4439 * Small documentation updates.
4438
4440
4439 * Created the Extensions directory under IPython (with an
4441 * Created the Extensions directory under IPython (with an
4440 __init__.py). Put the PhysicalQ stuff there. This directory should
4442 __init__.py). Put the PhysicalQ stuff there. This directory should
4441 be used for all special-purpose extensions.
4443 be used for all special-purpose extensions.
4442
4444
4443 * File renaming:
4445 * File renaming:
4444 ipythonlib --> ipmaker
4446 ipythonlib --> ipmaker
4445 ipplib --> iplib
4447 ipplib --> iplib
4446 This makes a bit more sense in terms of what these files actually do.
4448 This makes a bit more sense in terms of what these files actually do.
4447
4449
4448 * Moved all the classes and functions in ipythonlib to ipplib, so
4450 * Moved all the classes and functions in ipythonlib to ipplib, so
4449 now ipythonlib only has make_IPython(). This will ease up its
4451 now ipythonlib only has make_IPython(). This will ease up its
4450 splitting in smaller functional chunks later.
4452 splitting in smaller functional chunks later.
4451
4453
4452 * Cleaned up (done, I think) output of @whos. Better column
4454 * Cleaned up (done, I think) output of @whos. Better column
4453 formatting, and now shows str(var) for as much as it can, which is
4455 formatting, and now shows str(var) for as much as it can, which is
4454 typically what one gets with a 'print var'.
4456 typically what one gets with a 'print var'.
4455
4457
4456 2001-12-04 Fernando Perez <fperez@colorado.edu>
4458 2001-12-04 Fernando Perez <fperez@colorado.edu>
4457
4459
4458 * Fixed namespace problems. Now builtin/IPyhton/user names get
4460 * Fixed namespace problems. Now builtin/IPyhton/user names get
4459 properly reported in their namespace. Internal namespace handling
4461 properly reported in their namespace. Internal namespace handling
4460 is finally getting decent (not perfect yet, but much better than
4462 is finally getting decent (not perfect yet, but much better than
4461 the ad-hoc mess we had).
4463 the ad-hoc mess we had).
4462
4464
4463 * Removed -exit option. If people just want to run a python
4465 * Removed -exit option. If people just want to run a python
4464 script, that's what the normal interpreter is for. Less
4466 script, that's what the normal interpreter is for. Less
4465 unnecessary options, less chances for bugs.
4467 unnecessary options, less chances for bugs.
4466
4468
4467 * Added a crash handler which generates a complete post-mortem if
4469 * Added a crash handler which generates a complete post-mortem if
4468 IPython crashes. This will help a lot in tracking bugs down the
4470 IPython crashes. This will help a lot in tracking bugs down the
4469 road.
4471 road.
4470
4472
4471 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4473 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4472 which were boud to functions being reassigned would bypass the
4474 which were boud to functions being reassigned would bypass the
4473 logger, breaking the sync of _il with the prompt counter. This
4475 logger, breaking the sync of _il with the prompt counter. This
4474 would then crash IPython later when a new line was logged.
4476 would then crash IPython later when a new line was logged.
4475
4477
4476 2001-12-02 Fernando Perez <fperez@colorado.edu>
4478 2001-12-02 Fernando Perez <fperez@colorado.edu>
4477
4479
4478 * Made IPython a package. This means people don't have to clutter
4480 * Made IPython a package. This means people don't have to clutter
4479 their sys.path with yet another directory. Changed the INSTALL
4481 their sys.path with yet another directory. Changed the INSTALL
4480 file accordingly.
4482 file accordingly.
4481
4483
4482 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4484 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4483 sorts its output (so @who shows it sorted) and @whos formats the
4485 sorts its output (so @who shows it sorted) and @whos formats the
4484 table according to the width of the first column. Nicer, easier to
4486 table according to the width of the first column. Nicer, easier to
4485 read. Todo: write a generic table_format() which takes a list of
4487 read. Todo: write a generic table_format() which takes a list of
4486 lists and prints it nicely formatted, with optional row/column
4488 lists and prints it nicely formatted, with optional row/column
4487 separators and proper padding and justification.
4489 separators and proper padding and justification.
4488
4490
4489 * Released 0.1.20
4491 * Released 0.1.20
4490
4492
4491 * Fixed bug in @log which would reverse the inputcache list (a
4493 * Fixed bug in @log which would reverse the inputcache list (a
4492 copy operation was missing).
4494 copy operation was missing).
4493
4495
4494 * Code cleanup. @config was changed to use page(). Better, since
4496 * Code cleanup. @config was changed to use page(). Better, since
4495 its output is always quite long.
4497 its output is always quite long.
4496
4498
4497 * Itpl is back as a dependency. I was having too many problems
4499 * Itpl is back as a dependency. I was having too many problems
4498 getting the parametric aliases to work reliably, and it's just
4500 getting the parametric aliases to work reliably, and it's just
4499 easier to code weird string operations with it than playing %()s
4501 easier to code weird string operations with it than playing %()s
4500 games. It's only ~6k, so I don't think it's too big a deal.
4502 games. It's only ~6k, so I don't think it's too big a deal.
4501
4503
4502 * Found (and fixed) a very nasty bug with history. !lines weren't
4504 * Found (and fixed) a very nasty bug with history. !lines weren't
4503 getting cached, and the out of sync caches would crash
4505 getting cached, and the out of sync caches would crash
4504 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4506 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4505 division of labor a bit better. Bug fixed, cleaner structure.
4507 division of labor a bit better. Bug fixed, cleaner structure.
4506
4508
4507 2001-12-01 Fernando Perez <fperez@colorado.edu>
4509 2001-12-01 Fernando Perez <fperez@colorado.edu>
4508
4510
4509 * Released 0.1.19
4511 * Released 0.1.19
4510
4512
4511 * Added option -n to @hist to prevent line number printing. Much
4513 * Added option -n to @hist to prevent line number printing. Much
4512 easier to copy/paste code this way.
4514 easier to copy/paste code this way.
4513
4515
4514 * Created global _il to hold the input list. Allows easy
4516 * Created global _il to hold the input list. Allows easy
4515 re-execution of blocks of code by slicing it (inspired by Janko's
4517 re-execution of blocks of code by slicing it (inspired by Janko's
4516 comment on 'macros').
4518 comment on 'macros').
4517
4519
4518 * Small fixes and doc updates.
4520 * Small fixes and doc updates.
4519
4521
4520 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4522 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4521 much too fragile with automagic. Handles properly multi-line
4523 much too fragile with automagic. Handles properly multi-line
4522 statements and takes parameters.
4524 statements and takes parameters.
4523
4525
4524 2001-11-30 Fernando Perez <fperez@colorado.edu>
4526 2001-11-30 Fernando Perez <fperez@colorado.edu>
4525
4527
4526 * Version 0.1.18 released.
4528 * Version 0.1.18 released.
4527
4529
4528 * Fixed nasty namespace bug in initial module imports.
4530 * Fixed nasty namespace bug in initial module imports.
4529
4531
4530 * Added copyright/license notes to all code files (except
4532 * Added copyright/license notes to all code files (except
4531 DPyGetOpt). For the time being, LGPL. That could change.
4533 DPyGetOpt). For the time being, LGPL. That could change.
4532
4534
4533 * Rewrote a much nicer README, updated INSTALL, cleaned up
4535 * Rewrote a much nicer README, updated INSTALL, cleaned up
4534 ipythonrc-* samples.
4536 ipythonrc-* samples.
4535
4537
4536 * Overall code/documentation cleanup. Basically ready for
4538 * Overall code/documentation cleanup. Basically ready for
4537 release. Only remaining thing: licence decision (LGPL?).
4539 release. Only remaining thing: licence decision (LGPL?).
4538
4540
4539 * Converted load_config to a class, ConfigLoader. Now recursion
4541 * Converted load_config to a class, ConfigLoader. Now recursion
4540 control is better organized. Doesn't include the same file twice.
4542 control is better organized. Doesn't include the same file twice.
4541
4543
4542 2001-11-29 Fernando Perez <fperez@colorado.edu>
4544 2001-11-29 Fernando Perez <fperez@colorado.edu>
4543
4545
4544 * Got input history working. Changed output history variables from
4546 * Got input history working. Changed output history variables from
4545 _p to _o so that _i is for input and _o for output. Just cleaner
4547 _p to _o so that _i is for input and _o for output. Just cleaner
4546 convention.
4548 convention.
4547
4549
4548 * Implemented parametric aliases. This pretty much allows the
4550 * Implemented parametric aliases. This pretty much allows the
4549 alias system to offer full-blown shell convenience, I think.
4551 alias system to offer full-blown shell convenience, I think.
4550
4552
4551 * Version 0.1.17 released, 0.1.18 opened.
4553 * Version 0.1.17 released, 0.1.18 opened.
4552
4554
4553 * dot_ipython/ipythonrc (alias): added documentation.
4555 * dot_ipython/ipythonrc (alias): added documentation.
4554 (xcolor): Fixed small bug (xcolors -> xcolor)
4556 (xcolor): Fixed small bug (xcolors -> xcolor)
4555
4557
4556 * Changed the alias system. Now alias is a magic command to define
4558 * Changed the alias system. Now alias is a magic command to define
4557 aliases just like the shell. Rationale: the builtin magics should
4559 aliases just like the shell. Rationale: the builtin magics should
4558 be there for things deeply connected to IPython's
4560 be there for things deeply connected to IPython's
4559 architecture. And this is a much lighter system for what I think
4561 architecture. And this is a much lighter system for what I think
4560 is the really important feature: allowing users to define quickly
4562 is the really important feature: allowing users to define quickly
4561 magics that will do shell things for them, so they can customize
4563 magics that will do shell things for them, so they can customize
4562 IPython easily to match their work habits. If someone is really
4564 IPython easily to match their work habits. If someone is really
4563 desperate to have another name for a builtin alias, they can
4565 desperate to have another name for a builtin alias, they can
4564 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4566 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4565 works.
4567 works.
4566
4568
4567 2001-11-28 Fernando Perez <fperez@colorado.edu>
4569 2001-11-28 Fernando Perez <fperez@colorado.edu>
4568
4570
4569 * Changed @file so that it opens the source file at the proper
4571 * Changed @file so that it opens the source file at the proper
4570 line. Since it uses less, if your EDITOR environment is
4572 line. Since it uses less, if your EDITOR environment is
4571 configured, typing v will immediately open your editor of choice
4573 configured, typing v will immediately open your editor of choice
4572 right at the line where the object is defined. Not as quick as
4574 right at the line where the object is defined. Not as quick as
4573 having a direct @edit command, but for all intents and purposes it
4575 having a direct @edit command, but for all intents and purposes it
4574 works. And I don't have to worry about writing @edit to deal with
4576 works. And I don't have to worry about writing @edit to deal with
4575 all the editors, less does that.
4577 all the editors, less does that.
4576
4578
4577 * Version 0.1.16 released, 0.1.17 opened.
4579 * Version 0.1.16 released, 0.1.17 opened.
4578
4580
4579 * Fixed some nasty bugs in the page/page_dumb combo that could
4581 * Fixed some nasty bugs in the page/page_dumb combo that could
4580 crash IPython.
4582 crash IPython.
4581
4583
4582 2001-11-27 Fernando Perez <fperez@colorado.edu>
4584 2001-11-27 Fernando Perez <fperez@colorado.edu>
4583
4585
4584 * Version 0.1.15 released, 0.1.16 opened.
4586 * Version 0.1.15 released, 0.1.16 opened.
4585
4587
4586 * Finally got ? and ?? to work for undefined things: now it's
4588 * Finally got ? and ?? to work for undefined things: now it's
4587 possible to type {}.get? and get information about the get method
4589 possible to type {}.get? and get information about the get method
4588 of dicts, or os.path? even if only os is defined (so technically
4590 of dicts, or os.path? even if only os is defined (so technically
4589 os.path isn't). Works at any level. For example, after import os,
4591 os.path isn't). Works at any level. For example, after import os,
4590 os?, os.path?, os.path.abspath? all work. This is great, took some
4592 os?, os.path?, os.path.abspath? all work. This is great, took some
4591 work in _ofind.
4593 work in _ofind.
4592
4594
4593 * Fixed more bugs with logging. The sanest way to do it was to add
4595 * Fixed more bugs with logging. The sanest way to do it was to add
4594 to @log a 'mode' parameter. Killed two in one shot (this mode
4596 to @log a 'mode' parameter. Killed two in one shot (this mode
4595 option was a request of Janko's). I think it's finally clean
4597 option was a request of Janko's). I think it's finally clean
4596 (famous last words).
4598 (famous last words).
4597
4599
4598 * Added a page_dumb() pager which does a decent job of paging on
4600 * Added a page_dumb() pager which does a decent job of paging on
4599 screen, if better things (like less) aren't available. One less
4601 screen, if better things (like less) aren't available. One less
4600 unix dependency (someday maybe somebody will port this to
4602 unix dependency (someday maybe somebody will port this to
4601 windows).
4603 windows).
4602
4604
4603 * Fixed problem in magic_log: would lock of logging out if log
4605 * Fixed problem in magic_log: would lock of logging out if log
4604 creation failed (because it would still think it had succeeded).
4606 creation failed (because it would still think it had succeeded).
4605
4607
4606 * Improved the page() function using curses to auto-detect screen
4608 * Improved the page() function using curses to auto-detect screen
4607 size. Now it can make a much better decision on whether to print
4609 size. Now it can make a much better decision on whether to print
4608 or page a string. Option screen_length was modified: a value 0
4610 or page a string. Option screen_length was modified: a value 0
4609 means auto-detect, and that's the default now.
4611 means auto-detect, and that's the default now.
4610
4612
4611 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4613 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4612 go out. I'll test it for a few days, then talk to Janko about
4614 go out. I'll test it for a few days, then talk to Janko about
4613 licences and announce it.
4615 licences and announce it.
4614
4616
4615 * Fixed the length of the auto-generated ---> prompt which appears
4617 * Fixed the length of the auto-generated ---> prompt which appears
4616 for auto-parens and auto-quotes. Getting this right isn't trivial,
4618 for auto-parens and auto-quotes. Getting this right isn't trivial,
4617 with all the color escapes, different prompt types and optional
4619 with all the color escapes, different prompt types and optional
4618 separators. But it seems to be working in all the combinations.
4620 separators. But it seems to be working in all the combinations.
4619
4621
4620 2001-11-26 Fernando Perez <fperez@colorado.edu>
4622 2001-11-26 Fernando Perez <fperez@colorado.edu>
4621
4623
4622 * Wrote a regexp filter to get option types from the option names
4624 * Wrote a regexp filter to get option types from the option names
4623 string. This eliminates the need to manually keep two duplicate
4625 string. This eliminates the need to manually keep two duplicate
4624 lists.
4626 lists.
4625
4627
4626 * Removed the unneeded check_option_names. Now options are handled
4628 * Removed the unneeded check_option_names. Now options are handled
4627 in a much saner manner and it's easy to visually check that things
4629 in a much saner manner and it's easy to visually check that things
4628 are ok.
4630 are ok.
4629
4631
4630 * Updated version numbers on all files I modified to carry a
4632 * Updated version numbers on all files I modified to carry a
4631 notice so Janko and Nathan have clear version markers.
4633 notice so Janko and Nathan have clear version markers.
4632
4634
4633 * Updated docstring for ultraTB with my changes. I should send
4635 * Updated docstring for ultraTB with my changes. I should send
4634 this to Nathan.
4636 this to Nathan.
4635
4637
4636 * Lots of small fixes. Ran everything through pychecker again.
4638 * Lots of small fixes. Ran everything through pychecker again.
4637
4639
4638 * Made loading of deep_reload an cmd line option. If it's not too
4640 * Made loading of deep_reload an cmd line option. If it's not too
4639 kosher, now people can just disable it. With -nodeep_reload it's
4641 kosher, now people can just disable it. With -nodeep_reload it's
4640 still available as dreload(), it just won't overwrite reload().
4642 still available as dreload(), it just won't overwrite reload().
4641
4643
4642 * Moved many options to the no| form (-opt and -noopt
4644 * Moved many options to the no| form (-opt and -noopt
4643 accepted). Cleaner.
4645 accepted). Cleaner.
4644
4646
4645 * Changed magic_log so that if called with no parameters, it uses
4647 * Changed magic_log so that if called with no parameters, it uses
4646 'rotate' mode. That way auto-generated logs aren't automatically
4648 'rotate' mode. That way auto-generated logs aren't automatically
4647 over-written. For normal logs, now a backup is made if it exists
4649 over-written. For normal logs, now a backup is made if it exists
4648 (only 1 level of backups). A new 'backup' mode was added to the
4650 (only 1 level of backups). A new 'backup' mode was added to the
4649 Logger class to support this. This was a request by Janko.
4651 Logger class to support this. This was a request by Janko.
4650
4652
4651 * Added @logoff/@logon to stop/restart an active log.
4653 * Added @logoff/@logon to stop/restart an active log.
4652
4654
4653 * Fixed a lot of bugs in log saving/replay. It was pretty
4655 * Fixed a lot of bugs in log saving/replay. It was pretty
4654 broken. Now special lines (!@,/) appear properly in the command
4656 broken. Now special lines (!@,/) appear properly in the command
4655 history after a log replay.
4657 history after a log replay.
4656
4658
4657 * Tried and failed to implement full session saving via pickle. My
4659 * Tried and failed to implement full session saving via pickle. My
4658 idea was to pickle __main__.__dict__, but modules can't be
4660 idea was to pickle __main__.__dict__, but modules can't be
4659 pickled. This would be a better alternative to replaying logs, but
4661 pickled. This would be a better alternative to replaying logs, but
4660 seems quite tricky to get to work. Changed -session to be called
4662 seems quite tricky to get to work. Changed -session to be called
4661 -logplay, which more accurately reflects what it does. And if we
4663 -logplay, which more accurately reflects what it does. And if we
4662 ever get real session saving working, -session is now available.
4664 ever get real session saving working, -session is now available.
4663
4665
4664 * Implemented color schemes for prompts also. As for tracebacks,
4666 * Implemented color schemes for prompts also. As for tracebacks,
4665 currently only NoColor and Linux are supported. But now the
4667 currently only NoColor and Linux are supported. But now the
4666 infrastructure is in place, based on a generic ColorScheme
4668 infrastructure is in place, based on a generic ColorScheme
4667 class. So writing and activating new schemes both for the prompts
4669 class. So writing and activating new schemes both for the prompts
4668 and the tracebacks should be straightforward.
4670 and the tracebacks should be straightforward.
4669
4671
4670 * Version 0.1.13 released, 0.1.14 opened.
4672 * Version 0.1.13 released, 0.1.14 opened.
4671
4673
4672 * Changed handling of options for output cache. Now counter is
4674 * Changed handling of options for output cache. Now counter is
4673 hardwired starting at 1 and one specifies the maximum number of
4675 hardwired starting at 1 and one specifies the maximum number of
4674 entries *in the outcache* (not the max prompt counter). This is
4676 entries *in the outcache* (not the max prompt counter). This is
4675 much better, since many statements won't increase the cache
4677 much better, since many statements won't increase the cache
4676 count. It also eliminated some confusing options, now there's only
4678 count. It also eliminated some confusing options, now there's only
4677 one: cache_size.
4679 one: cache_size.
4678
4680
4679 * Added 'alias' magic function and magic_alias option in the
4681 * Added 'alias' magic function and magic_alias option in the
4680 ipythonrc file. Now the user can easily define whatever names he
4682 ipythonrc file. Now the user can easily define whatever names he
4681 wants for the magic functions without having to play weird
4683 wants for the magic functions without having to play weird
4682 namespace games. This gives IPython a real shell-like feel.
4684 namespace games. This gives IPython a real shell-like feel.
4683
4685
4684 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4686 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4685 @ or not).
4687 @ or not).
4686
4688
4687 This was one of the last remaining 'visible' bugs (that I know
4689 This was one of the last remaining 'visible' bugs (that I know
4688 of). I think if I can clean up the session loading so it works
4690 of). I think if I can clean up the session loading so it works
4689 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4691 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4690 about licensing).
4692 about licensing).
4691
4693
4692 2001-11-25 Fernando Perez <fperez@colorado.edu>
4694 2001-11-25 Fernando Perez <fperez@colorado.edu>
4693
4695
4694 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4696 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4695 there's a cleaner distinction between what ? and ?? show.
4697 there's a cleaner distinction between what ? and ?? show.
4696
4698
4697 * Added screen_length option. Now the user can define his own
4699 * Added screen_length option. Now the user can define his own
4698 screen size for page() operations.
4700 screen size for page() operations.
4699
4701
4700 * Implemented magic shell-like functions with automatic code
4702 * Implemented magic shell-like functions with automatic code
4701 generation. Now adding another function is just a matter of adding
4703 generation. Now adding another function is just a matter of adding
4702 an entry to a dict, and the function is dynamically generated at
4704 an entry to a dict, and the function is dynamically generated at
4703 run-time. Python has some really cool features!
4705 run-time. Python has some really cool features!
4704
4706
4705 * Renamed many options to cleanup conventions a little. Now all
4707 * Renamed many options to cleanup conventions a little. Now all
4706 are lowercase, and only underscores where needed. Also in the code
4708 are lowercase, and only underscores where needed. Also in the code
4707 option name tables are clearer.
4709 option name tables are clearer.
4708
4710
4709 * Changed prompts a little. Now input is 'In [n]:' instead of
4711 * Changed prompts a little. Now input is 'In [n]:' instead of
4710 'In[n]:='. This allows it the numbers to be aligned with the
4712 'In[n]:='. This allows it the numbers to be aligned with the
4711 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4713 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4712 Python (it was a Mathematica thing). The '...' continuation prompt
4714 Python (it was a Mathematica thing). The '...' continuation prompt
4713 was also changed a little to align better.
4715 was also changed a little to align better.
4714
4716
4715 * Fixed bug when flushing output cache. Not all _p<n> variables
4717 * Fixed bug when flushing output cache. Not all _p<n> variables
4716 exist, so their deletion needs to be wrapped in a try:
4718 exist, so their deletion needs to be wrapped in a try:
4717
4719
4718 * Figured out how to properly use inspect.formatargspec() (it
4720 * Figured out how to properly use inspect.formatargspec() (it
4719 requires the args preceded by *). So I removed all the code from
4721 requires the args preceded by *). So I removed all the code from
4720 _get_pdef in Magic, which was just replicating that.
4722 _get_pdef in Magic, which was just replicating that.
4721
4723
4722 * Added test to prefilter to allow redefining magic function names
4724 * Added test to prefilter to allow redefining magic function names
4723 as variables. This is ok, since the @ form is always available,
4725 as variables. This is ok, since the @ form is always available,
4724 but whe should allow the user to define a variable called 'ls' if
4726 but whe should allow the user to define a variable called 'ls' if
4725 he needs it.
4727 he needs it.
4726
4728
4727 * Moved the ToDo information from README into a separate ToDo.
4729 * Moved the ToDo information from README into a separate ToDo.
4728
4730
4729 * General code cleanup and small bugfixes. I think it's close to a
4731 * General code cleanup and small bugfixes. I think it's close to a
4730 state where it can be released, obviously with a big 'beta'
4732 state where it can be released, obviously with a big 'beta'
4731 warning on it.
4733 warning on it.
4732
4734
4733 * Got the magic function split to work. Now all magics are defined
4735 * Got the magic function split to work. Now all magics are defined
4734 in a separate class. It just organizes things a bit, and now
4736 in a separate class. It just organizes things a bit, and now
4735 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4737 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4736 was too long).
4738 was too long).
4737
4739
4738 * Changed @clear to @reset to avoid potential confusions with
4740 * Changed @clear to @reset to avoid potential confusions with
4739 the shell command clear. Also renamed @cl to @clear, which does
4741 the shell command clear. Also renamed @cl to @clear, which does
4740 exactly what people expect it to from their shell experience.
4742 exactly what people expect it to from their shell experience.
4741
4743
4742 Added a check to the @reset command (since it's so
4744 Added a check to the @reset command (since it's so
4743 destructive, it's probably a good idea to ask for confirmation).
4745 destructive, it's probably a good idea to ask for confirmation).
4744 But now reset only works for full namespace resetting. Since the
4746 But now reset only works for full namespace resetting. Since the
4745 del keyword is already there for deleting a few specific
4747 del keyword is already there for deleting a few specific
4746 variables, I don't see the point of having a redundant magic
4748 variables, I don't see the point of having a redundant magic
4747 function for the same task.
4749 function for the same task.
4748
4750
4749 2001-11-24 Fernando Perez <fperez@colorado.edu>
4751 2001-11-24 Fernando Perez <fperez@colorado.edu>
4750
4752
4751 * Updated the builtin docs (esp. the ? ones).
4753 * Updated the builtin docs (esp. the ? ones).
4752
4754
4753 * Ran all the code through pychecker. Not terribly impressed with
4755 * Ran all the code through pychecker. Not terribly impressed with
4754 it: lots of spurious warnings and didn't really find anything of
4756 it: lots of spurious warnings and didn't really find anything of
4755 substance (just a few modules being imported and not used).
4757 substance (just a few modules being imported and not used).
4756
4758
4757 * Implemented the new ultraTB functionality into IPython. New
4759 * Implemented the new ultraTB functionality into IPython. New
4758 option: xcolors. This chooses color scheme. xmode now only selects
4760 option: xcolors. This chooses color scheme. xmode now only selects
4759 between Plain and Verbose. Better orthogonality.
4761 between Plain and Verbose. Better orthogonality.
4760
4762
4761 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4763 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4762 mode and color scheme for the exception handlers. Now it's
4764 mode and color scheme for the exception handlers. Now it's
4763 possible to have the verbose traceback with no coloring.
4765 possible to have the verbose traceback with no coloring.
4764
4766
4765 2001-11-23 Fernando Perez <fperez@colorado.edu>
4767 2001-11-23 Fernando Perez <fperez@colorado.edu>
4766
4768
4767 * Version 0.1.12 released, 0.1.13 opened.
4769 * Version 0.1.12 released, 0.1.13 opened.
4768
4770
4769 * Removed option to set auto-quote and auto-paren escapes by
4771 * Removed option to set auto-quote and auto-paren escapes by
4770 user. The chances of breaking valid syntax are just too high. If
4772 user. The chances of breaking valid syntax are just too high. If
4771 someone *really* wants, they can always dig into the code.
4773 someone *really* wants, they can always dig into the code.
4772
4774
4773 * Made prompt separators configurable.
4775 * Made prompt separators configurable.
4774
4776
4775 2001-11-22 Fernando Perez <fperez@colorado.edu>
4777 2001-11-22 Fernando Perez <fperez@colorado.edu>
4776
4778
4777 * Small bugfixes in many places.
4779 * Small bugfixes in many places.
4778
4780
4779 * Removed the MyCompleter class from ipplib. It seemed redundant
4781 * Removed the MyCompleter class from ipplib. It seemed redundant
4780 with the C-p,C-n history search functionality. Less code to
4782 with the C-p,C-n history search functionality. Less code to
4781 maintain.
4783 maintain.
4782
4784
4783 * Moved all the original ipython.py code into ipythonlib.py. Right
4785 * Moved all the original ipython.py code into ipythonlib.py. Right
4784 now it's just one big dump into a function called make_IPython, so
4786 now it's just one big dump into a function called make_IPython, so
4785 no real modularity has been gained. But at least it makes the
4787 no real modularity has been gained. But at least it makes the
4786 wrapper script tiny, and since ipythonlib is a module, it gets
4788 wrapper script tiny, and since ipythonlib is a module, it gets
4787 compiled and startup is much faster.
4789 compiled and startup is much faster.
4788
4790
4789 This is a reasobably 'deep' change, so we should test it for a
4791 This is a reasobably 'deep' change, so we should test it for a
4790 while without messing too much more with the code.
4792 while without messing too much more with the code.
4791
4793
4792 2001-11-21 Fernando Perez <fperez@colorado.edu>
4794 2001-11-21 Fernando Perez <fperez@colorado.edu>
4793
4795
4794 * Version 0.1.11 released, 0.1.12 opened for further work.
4796 * Version 0.1.11 released, 0.1.12 opened for further work.
4795
4797
4796 * Removed dependency on Itpl. It was only needed in one place. It
4798 * Removed dependency on Itpl. It was only needed in one place. It
4797 would be nice if this became part of python, though. It makes life
4799 would be nice if this became part of python, though. It makes life
4798 *a lot* easier in some cases.
4800 *a lot* easier in some cases.
4799
4801
4800 * Simplified the prefilter code a bit. Now all handlers are
4802 * Simplified the prefilter code a bit. Now all handlers are
4801 expected to explicitly return a value (at least a blank string).
4803 expected to explicitly return a value (at least a blank string).
4802
4804
4803 * Heavy edits in ipplib. Removed the help system altogether. Now
4805 * Heavy edits in ipplib. Removed the help system altogether. Now
4804 obj?/?? is used for inspecting objects, a magic @doc prints
4806 obj?/?? is used for inspecting objects, a magic @doc prints
4805 docstrings, and full-blown Python help is accessed via the 'help'
4807 docstrings, and full-blown Python help is accessed via the 'help'
4806 keyword. This cleans up a lot of code (less to maintain) and does
4808 keyword. This cleans up a lot of code (less to maintain) and does
4807 the job. Since 'help' is now a standard Python component, might as
4809 the job. Since 'help' is now a standard Python component, might as
4808 well use it and remove duplicate functionality.
4810 well use it and remove duplicate functionality.
4809
4811
4810 Also removed the option to use ipplib as a standalone program. By
4812 Also removed the option to use ipplib as a standalone program. By
4811 now it's too dependent on other parts of IPython to function alone.
4813 now it's too dependent on other parts of IPython to function alone.
4812
4814
4813 * Fixed bug in genutils.pager. It would crash if the pager was
4815 * Fixed bug in genutils.pager. It would crash if the pager was
4814 exited immediately after opening (broken pipe).
4816 exited immediately after opening (broken pipe).
4815
4817
4816 * Trimmed down the VerboseTB reporting a little. The header is
4818 * Trimmed down the VerboseTB reporting a little. The header is
4817 much shorter now and the repeated exception arguments at the end
4819 much shorter now and the repeated exception arguments at the end
4818 have been removed. For interactive use the old header seemed a bit
4820 have been removed. For interactive use the old header seemed a bit
4819 excessive.
4821 excessive.
4820
4822
4821 * Fixed small bug in output of @whos for variables with multi-word
4823 * Fixed small bug in output of @whos for variables with multi-word
4822 types (only first word was displayed).
4824 types (only first word was displayed).
4823
4825
4824 2001-11-17 Fernando Perez <fperez@colorado.edu>
4826 2001-11-17 Fernando Perez <fperez@colorado.edu>
4825
4827
4826 * Version 0.1.10 released, 0.1.11 opened for further work.
4828 * Version 0.1.10 released, 0.1.11 opened for further work.
4827
4829
4828 * Modified dirs and friends. dirs now *returns* the stack (not
4830 * Modified dirs and friends. dirs now *returns* the stack (not
4829 prints), so one can manipulate it as a variable. Convenient to
4831 prints), so one can manipulate it as a variable. Convenient to
4830 travel along many directories.
4832 travel along many directories.
4831
4833
4832 * Fixed bug in magic_pdef: would only work with functions with
4834 * Fixed bug in magic_pdef: would only work with functions with
4833 arguments with default values.
4835 arguments with default values.
4834
4836
4835 2001-11-14 Fernando Perez <fperez@colorado.edu>
4837 2001-11-14 Fernando Perez <fperez@colorado.edu>
4836
4838
4837 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4839 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4838 example with IPython. Various other minor fixes and cleanups.
4840 example with IPython. Various other minor fixes and cleanups.
4839
4841
4840 * Version 0.1.9 released, 0.1.10 opened for further work.
4842 * Version 0.1.9 released, 0.1.10 opened for further work.
4841
4843
4842 * Added sys.path to the list of directories searched in the
4844 * Added sys.path to the list of directories searched in the
4843 execfile= option. It used to be the current directory and the
4845 execfile= option. It used to be the current directory and the
4844 user's IPYTHONDIR only.
4846 user's IPYTHONDIR only.
4845
4847
4846 2001-11-13 Fernando Perez <fperez@colorado.edu>
4848 2001-11-13 Fernando Perez <fperez@colorado.edu>
4847
4849
4848 * Reinstated the raw_input/prefilter separation that Janko had
4850 * Reinstated the raw_input/prefilter separation that Janko had
4849 initially. This gives a more convenient setup for extending the
4851 initially. This gives a more convenient setup for extending the
4850 pre-processor from the outside: raw_input always gets a string,
4852 pre-processor from the outside: raw_input always gets a string,
4851 and prefilter has to process it. We can then redefine prefilter
4853 and prefilter has to process it. We can then redefine prefilter
4852 from the outside and implement extensions for special
4854 from the outside and implement extensions for special
4853 purposes.
4855 purposes.
4854
4856
4855 Today I got one for inputting PhysicalQuantity objects
4857 Today I got one for inputting PhysicalQuantity objects
4856 (from Scientific) without needing any function calls at
4858 (from Scientific) without needing any function calls at
4857 all. Extremely convenient, and it's all done as a user-level
4859 all. Extremely convenient, and it's all done as a user-level
4858 extension (no IPython code was touched). Now instead of:
4860 extension (no IPython code was touched). Now instead of:
4859 a = PhysicalQuantity(4.2,'m/s**2')
4861 a = PhysicalQuantity(4.2,'m/s**2')
4860 one can simply say
4862 one can simply say
4861 a = 4.2 m/s**2
4863 a = 4.2 m/s**2
4862 or even
4864 or even
4863 a = 4.2 m/s^2
4865 a = 4.2 m/s^2
4864
4866
4865 I use this, but it's also a proof of concept: IPython really is
4867 I use this, but it's also a proof of concept: IPython really is
4866 fully user-extensible, even at the level of the parsing of the
4868 fully user-extensible, even at the level of the parsing of the
4867 command line. It's not trivial, but it's perfectly doable.
4869 command line. It's not trivial, but it's perfectly doable.
4868
4870
4869 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4871 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4870 the problem of modules being loaded in the inverse order in which
4872 the problem of modules being loaded in the inverse order in which
4871 they were defined in
4873 they were defined in
4872
4874
4873 * Version 0.1.8 released, 0.1.9 opened for further work.
4875 * Version 0.1.8 released, 0.1.9 opened for further work.
4874
4876
4875 * Added magics pdef, source and file. They respectively show the
4877 * Added magics pdef, source and file. They respectively show the
4876 definition line ('prototype' in C), source code and full python
4878 definition line ('prototype' in C), source code and full python
4877 file for any callable object. The object inspector oinfo uses
4879 file for any callable object. The object inspector oinfo uses
4878 these to show the same information.
4880 these to show the same information.
4879
4881
4880 * Version 0.1.7 released, 0.1.8 opened for further work.
4882 * Version 0.1.7 released, 0.1.8 opened for further work.
4881
4883
4882 * Separated all the magic functions into a class called Magic. The
4884 * Separated all the magic functions into a class called Magic. The
4883 InteractiveShell class was becoming too big for Xemacs to handle
4885 InteractiveShell class was becoming too big for Xemacs to handle
4884 (de-indenting a line would lock it up for 10 seconds while it
4886 (de-indenting a line would lock it up for 10 seconds while it
4885 backtracked on the whole class!)
4887 backtracked on the whole class!)
4886
4888
4887 FIXME: didn't work. It can be done, but right now namespaces are
4889 FIXME: didn't work. It can be done, but right now namespaces are
4888 all messed up. Do it later (reverted it for now, so at least
4890 all messed up. Do it later (reverted it for now, so at least
4889 everything works as before).
4891 everything works as before).
4890
4892
4891 * Got the object introspection system (magic_oinfo) working! I
4893 * Got the object introspection system (magic_oinfo) working! I
4892 think this is pretty much ready for release to Janko, so he can
4894 think this is pretty much ready for release to Janko, so he can
4893 test it for a while and then announce it. Pretty much 100% of what
4895 test it for a while and then announce it. Pretty much 100% of what
4894 I wanted for the 'phase 1' release is ready. Happy, tired.
4896 I wanted for the 'phase 1' release is ready. Happy, tired.
4895
4897
4896 2001-11-12 Fernando Perez <fperez@colorado.edu>
4898 2001-11-12 Fernando Perez <fperez@colorado.edu>
4897
4899
4898 * Version 0.1.6 released, 0.1.7 opened for further work.
4900 * Version 0.1.6 released, 0.1.7 opened for further work.
4899
4901
4900 * Fixed bug in printing: it used to test for truth before
4902 * Fixed bug in printing: it used to test for truth before
4901 printing, so 0 wouldn't print. Now checks for None.
4903 printing, so 0 wouldn't print. Now checks for None.
4902
4904
4903 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4905 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4904 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4906 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4905 reaches by hand into the outputcache. Think of a better way to do
4907 reaches by hand into the outputcache. Think of a better way to do
4906 this later.
4908 this later.
4907
4909
4908 * Various small fixes thanks to Nathan's comments.
4910 * Various small fixes thanks to Nathan's comments.
4909
4911
4910 * Changed magic_pprint to magic_Pprint. This way it doesn't
4912 * Changed magic_pprint to magic_Pprint. This way it doesn't
4911 collide with pprint() and the name is consistent with the command
4913 collide with pprint() and the name is consistent with the command
4912 line option.
4914 line option.
4913
4915
4914 * Changed prompt counter behavior to be fully like
4916 * Changed prompt counter behavior to be fully like
4915 Mathematica's. That is, even input that doesn't return a result
4917 Mathematica's. That is, even input that doesn't return a result
4916 raises the prompt counter. The old behavior was kind of confusing
4918 raises the prompt counter. The old behavior was kind of confusing
4917 (getting the same prompt number several times if the operation
4919 (getting the same prompt number several times if the operation
4918 didn't return a result).
4920 didn't return a result).
4919
4921
4920 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4922 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4921
4923
4922 * Fixed -Classic mode (wasn't working anymore).
4924 * Fixed -Classic mode (wasn't working anymore).
4923
4925
4924 * Added colored prompts using Nathan's new code. Colors are
4926 * Added colored prompts using Nathan's new code. Colors are
4925 currently hardwired, they can be user-configurable. For
4927 currently hardwired, they can be user-configurable. For
4926 developers, they can be chosen in file ipythonlib.py, at the
4928 developers, they can be chosen in file ipythonlib.py, at the
4927 beginning of the CachedOutput class def.
4929 beginning of the CachedOutput class def.
4928
4930
4929 2001-11-11 Fernando Perez <fperez@colorado.edu>
4931 2001-11-11 Fernando Perez <fperez@colorado.edu>
4930
4932
4931 * Version 0.1.5 released, 0.1.6 opened for further work.
4933 * Version 0.1.5 released, 0.1.6 opened for further work.
4932
4934
4933 * Changed magic_env to *return* the environment as a dict (not to
4935 * Changed magic_env to *return* the environment as a dict (not to
4934 print it). This way it prints, but it can also be processed.
4936 print it). This way it prints, but it can also be processed.
4935
4937
4936 * Added Verbose exception reporting to interactive
4938 * Added Verbose exception reporting to interactive
4937 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4939 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4938 traceback. Had to make some changes to the ultraTB file. This is
4940 traceback. Had to make some changes to the ultraTB file. This is
4939 probably the last 'big' thing in my mental todo list. This ties
4941 probably the last 'big' thing in my mental todo list. This ties
4940 in with the next entry:
4942 in with the next entry:
4941
4943
4942 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4944 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4943 has to specify is Plain, Color or Verbose for all exception
4945 has to specify is Plain, Color or Verbose for all exception
4944 handling.
4946 handling.
4945
4947
4946 * Removed ShellServices option. All this can really be done via
4948 * Removed ShellServices option. All this can really be done via
4947 the magic system. It's easier to extend, cleaner and has automatic
4949 the magic system. It's easier to extend, cleaner and has automatic
4948 namespace protection and documentation.
4950 namespace protection and documentation.
4949
4951
4950 2001-11-09 Fernando Perez <fperez@colorado.edu>
4952 2001-11-09 Fernando Perez <fperez@colorado.edu>
4951
4953
4952 * Fixed bug in output cache flushing (missing parameter to
4954 * Fixed bug in output cache flushing (missing parameter to
4953 __init__). Other small bugs fixed (found using pychecker).
4955 __init__). Other small bugs fixed (found using pychecker).
4954
4956
4955 * Version 0.1.4 opened for bugfixing.
4957 * Version 0.1.4 opened for bugfixing.
4956
4958
4957 2001-11-07 Fernando Perez <fperez@colorado.edu>
4959 2001-11-07 Fernando Perez <fperez@colorado.edu>
4958
4960
4959 * Version 0.1.3 released, mainly because of the raw_input bug.
4961 * Version 0.1.3 released, mainly because of the raw_input bug.
4960
4962
4961 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4963 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4962 and when testing for whether things were callable, a call could
4964 and when testing for whether things were callable, a call could
4963 actually be made to certain functions. They would get called again
4965 actually be made to certain functions. They would get called again
4964 once 'really' executed, with a resulting double call. A disaster
4966 once 'really' executed, with a resulting double call. A disaster
4965 in many cases (list.reverse() would never work!).
4967 in many cases (list.reverse() would never work!).
4966
4968
4967 * Removed prefilter() function, moved its code to raw_input (which
4969 * Removed prefilter() function, moved its code to raw_input (which
4968 after all was just a near-empty caller for prefilter). This saves
4970 after all was just a near-empty caller for prefilter). This saves
4969 a function call on every prompt, and simplifies the class a tiny bit.
4971 a function call on every prompt, and simplifies the class a tiny bit.
4970
4972
4971 * Fix _ip to __ip name in magic example file.
4973 * Fix _ip to __ip name in magic example file.
4972
4974
4973 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4975 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4974 work with non-gnu versions of tar.
4976 work with non-gnu versions of tar.
4975
4977
4976 2001-11-06 Fernando Perez <fperez@colorado.edu>
4978 2001-11-06 Fernando Perez <fperez@colorado.edu>
4977
4979
4978 * Version 0.1.2. Just to keep track of the recent changes.
4980 * Version 0.1.2. Just to keep track of the recent changes.
4979
4981
4980 * Fixed nasty bug in output prompt routine. It used to check 'if
4982 * Fixed nasty bug in output prompt routine. It used to check 'if
4981 arg != None...'. Problem is, this fails if arg implements a
4983 arg != None...'. Problem is, this fails if arg implements a
4982 special comparison (__cmp__) which disallows comparing to
4984 special comparison (__cmp__) which disallows comparing to
4983 None. Found it when trying to use the PhysicalQuantity module from
4985 None. Found it when trying to use the PhysicalQuantity module from
4984 ScientificPython.
4986 ScientificPython.
4985
4987
4986 2001-11-05 Fernando Perez <fperez@colorado.edu>
4988 2001-11-05 Fernando Perez <fperez@colorado.edu>
4987
4989
4988 * Also added dirs. Now the pushd/popd/dirs family functions
4990 * Also added dirs. Now the pushd/popd/dirs family functions
4989 basically like the shell, with the added convenience of going home
4991 basically like the shell, with the added convenience of going home
4990 when called with no args.
4992 when called with no args.
4991
4993
4992 * pushd/popd slightly modified to mimic shell behavior more
4994 * pushd/popd slightly modified to mimic shell behavior more
4993 closely.
4995 closely.
4994
4996
4995 * Added env,pushd,popd from ShellServices as magic functions. I
4997 * Added env,pushd,popd from ShellServices as magic functions. I
4996 think the cleanest will be to port all desired functions from
4998 think the cleanest will be to port all desired functions from
4997 ShellServices as magics and remove ShellServices altogether. This
4999 ShellServices as magics and remove ShellServices altogether. This
4998 will provide a single, clean way of adding functionality
5000 will provide a single, clean way of adding functionality
4999 (shell-type or otherwise) to IP.
5001 (shell-type or otherwise) to IP.
5000
5002
5001 2001-11-04 Fernando Perez <fperez@colorado.edu>
5003 2001-11-04 Fernando Perez <fperez@colorado.edu>
5002
5004
5003 * Added .ipython/ directory to sys.path. This way users can keep
5005 * Added .ipython/ directory to sys.path. This way users can keep
5004 customizations there and access them via import.
5006 customizations there and access them via import.
5005
5007
5006 2001-11-03 Fernando Perez <fperez@colorado.edu>
5008 2001-11-03 Fernando Perez <fperez@colorado.edu>
5007
5009
5008 * Opened version 0.1.1 for new changes.
5010 * Opened version 0.1.1 for new changes.
5009
5011
5010 * Changed version number to 0.1.0: first 'public' release, sent to
5012 * Changed version number to 0.1.0: first 'public' release, sent to
5011 Nathan and Janko.
5013 Nathan and Janko.
5012
5014
5013 * Lots of small fixes and tweaks.
5015 * Lots of small fixes and tweaks.
5014
5016
5015 * Minor changes to whos format. Now strings are shown, snipped if
5017 * Minor changes to whos format. Now strings are shown, snipped if
5016 too long.
5018 too long.
5017
5019
5018 * Changed ShellServices to work on __main__ so they show up in @who
5020 * Changed ShellServices to work on __main__ so they show up in @who
5019
5021
5020 * Help also works with ? at the end of a line:
5022 * Help also works with ? at the end of a line:
5021 ?sin and sin?
5023 ?sin and sin?
5022 both produce the same effect. This is nice, as often I use the
5024 both produce the same effect. This is nice, as often I use the
5023 tab-complete to find the name of a method, but I used to then have
5025 tab-complete to find the name of a method, but I used to then have
5024 to go to the beginning of the line to put a ? if I wanted more
5026 to go to the beginning of the line to put a ? if I wanted more
5025 info. Now I can just add the ? and hit return. Convenient.
5027 info. Now I can just add the ? and hit return. Convenient.
5026
5028
5027 2001-11-02 Fernando Perez <fperez@colorado.edu>
5029 2001-11-02 Fernando Perez <fperez@colorado.edu>
5028
5030
5029 * Python version check (>=2.1) added.
5031 * Python version check (>=2.1) added.
5030
5032
5031 * Added LazyPython documentation. At this point the docs are quite
5033 * Added LazyPython documentation. At this point the docs are quite
5032 a mess. A cleanup is in order.
5034 a mess. A cleanup is in order.
5033
5035
5034 * Auto-installer created. For some bizarre reason, the zipfiles
5036 * Auto-installer created. For some bizarre reason, the zipfiles
5035 module isn't working on my system. So I made a tar version
5037 module isn't working on my system. So I made a tar version
5036 (hopefully the command line options in various systems won't kill
5038 (hopefully the command line options in various systems won't kill
5037 me).
5039 me).
5038
5040
5039 * Fixes to Struct in genutils. Now all dictionary-like methods are
5041 * Fixes to Struct in genutils. Now all dictionary-like methods are
5040 protected (reasonably).
5042 protected (reasonably).
5041
5043
5042 * Added pager function to genutils and changed ? to print usage
5044 * Added pager function to genutils and changed ? to print usage
5043 note through it (it was too long).
5045 note through it (it was too long).
5044
5046
5045 * Added the LazyPython functionality. Works great! I changed the
5047 * Added the LazyPython functionality. Works great! I changed the
5046 auto-quote escape to ';', it's on home row and next to '. But
5048 auto-quote escape to ';', it's on home row and next to '. But
5047 both auto-quote and auto-paren (still /) escapes are command-line
5049 both auto-quote and auto-paren (still /) escapes are command-line
5048 parameters.
5050 parameters.
5049
5051
5050
5052
5051 2001-11-01 Fernando Perez <fperez@colorado.edu>
5053 2001-11-01 Fernando Perez <fperez@colorado.edu>
5052
5054
5053 * Version changed to 0.0.7. Fairly large change: configuration now
5055 * Version changed to 0.0.7. Fairly large change: configuration now
5054 is all stored in a directory, by default .ipython. There, all
5056 is all stored in a directory, by default .ipython. There, all
5055 config files have normal looking names (not .names)
5057 config files have normal looking names (not .names)
5056
5058
5057 * Version 0.0.6 Released first to Lucas and Archie as a test
5059 * Version 0.0.6 Released first to Lucas and Archie as a test
5058 run. Since it's the first 'semi-public' release, change version to
5060 run. Since it's the first 'semi-public' release, change version to
5059 > 0.0.6 for any changes now.
5061 > 0.0.6 for any changes now.
5060
5062
5061 * Stuff I had put in the ipplib.py changelog:
5063 * Stuff I had put in the ipplib.py changelog:
5062
5064
5063 Changes to InteractiveShell:
5065 Changes to InteractiveShell:
5064
5066
5065 - Made the usage message a parameter.
5067 - Made the usage message a parameter.
5066
5068
5067 - Require the name of the shell variable to be given. It's a bit
5069 - Require the name of the shell variable to be given. It's a bit
5068 of a hack, but allows the name 'shell' not to be hardwire in the
5070 of a hack, but allows the name 'shell' not to be hardwire in the
5069 magic (@) handler, which is problematic b/c it requires
5071 magic (@) handler, which is problematic b/c it requires
5070 polluting the global namespace with 'shell'. This in turn is
5072 polluting the global namespace with 'shell'. This in turn is
5071 fragile: if a user redefines a variable called shell, things
5073 fragile: if a user redefines a variable called shell, things
5072 break.
5074 break.
5073
5075
5074 - magic @: all functions available through @ need to be defined
5076 - magic @: all functions available through @ need to be defined
5075 as magic_<name>, even though they can be called simply as
5077 as magic_<name>, even though they can be called simply as
5076 @<name>. This allows the special command @magic to gather
5078 @<name>. This allows the special command @magic to gather
5077 information automatically about all existing magic functions,
5079 information automatically about all existing magic functions,
5078 even if they are run-time user extensions, by parsing the shell
5080 even if they are run-time user extensions, by parsing the shell
5079 instance __dict__ looking for special magic_ names.
5081 instance __dict__ looking for special magic_ names.
5080
5082
5081 - mainloop: added *two* local namespace parameters. This allows
5083 - mainloop: added *two* local namespace parameters. This allows
5082 the class to differentiate between parameters which were there
5084 the class to differentiate between parameters which were there
5083 before and after command line initialization was processed. This
5085 before and after command line initialization was processed. This
5084 way, later @who can show things loaded at startup by the
5086 way, later @who can show things loaded at startup by the
5085 user. This trick was necessary to make session saving/reloading
5087 user. This trick was necessary to make session saving/reloading
5086 really work: ideally after saving/exiting/reloading a session,
5088 really work: ideally after saving/exiting/reloading a session,
5087 *everythin* should look the same, including the output of @who. I
5089 *everythin* should look the same, including the output of @who. I
5088 was only able to make this work with this double namespace
5090 was only able to make this work with this double namespace
5089 trick.
5091 trick.
5090
5092
5091 - added a header to the logfile which allows (almost) full
5093 - added a header to the logfile which allows (almost) full
5092 session restoring.
5094 session restoring.
5093
5095
5094 - prepend lines beginning with @ or !, with a and log
5096 - prepend lines beginning with @ or !, with a and log
5095 them. Why? !lines: may be useful to know what you did @lines:
5097 them. Why? !lines: may be useful to know what you did @lines:
5096 they may affect session state. So when restoring a session, at
5098 they may affect session state. So when restoring a session, at
5097 least inform the user of their presence. I couldn't quite get
5099 least inform the user of their presence. I couldn't quite get
5098 them to properly re-execute, but at least the user is warned.
5100 them to properly re-execute, but at least the user is warned.
5099
5101
5100 * Started ChangeLog.
5102 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now