##// END OF EJS Templates
- Fixes to sys.path to better match a plain Python console.
fptest -
Show More
@@ -1,2480 +1,2475 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 1868 2006-11-02 15:29:10Z vivainio $
9 $Id: iplib.py 1874 2006-11-03 08:17:34Z fptest $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pydoc
50 import pydoc
51 import re
51 import re
52 import shutil
52 import shutil
53 import string
53 import string
54 import sys
54 import sys
55 import tempfile
55 import tempfile
56 import traceback
56 import traceback
57 import types
57 import types
58 import pickleshare
58 import pickleshare
59 from sets import Set
59 from sets import Set
60 from pprint import pprint, pformat
60 from pprint import pprint, pformat
61
61
62 # IPython's own modules
62 # IPython's own modules
63 import IPython
63 import IPython
64 from IPython import OInspect,PyColorize,ultraTB
64 from IPython import OInspect,PyColorize,ultraTB
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.FakeModule import FakeModule
66 from IPython.FakeModule import FakeModule
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Logger import Logger
68 from IPython.Logger import Logger
69 from IPython.Magic import Magic
69 from IPython.Magic import Magic
70 from IPython.Prompts import CachedOutput
70 from IPython.Prompts import CachedOutput
71 from IPython.ipstruct import Struct
71 from IPython.ipstruct import Struct
72 from IPython.background_jobs import BackgroundJobManager
72 from IPython.background_jobs import BackgroundJobManager
73 from IPython.usage import cmd_line_usage,interactive_usage
73 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.genutils import *
74 from IPython.genutils import *
75 from IPython.strdispatch import StrDispatch
75 from IPython.strdispatch import StrDispatch
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class Quitter(object):
129 class Quitter(object):
130 """Simple class to handle exit, similar to Python 2.5's.
130 """Simple class to handle exit, similar to Python 2.5's.
131
131
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
133 doesn't do (obviously, since it doesn't know about ipython)."""
133 doesn't do (obviously, since it doesn't know about ipython)."""
134
134
135 def __init__(self,shell,name):
135 def __init__(self,shell,name):
136 self.shell = shell
136 self.shell = shell
137 self.name = name
137 self.name = name
138
138
139 def __repr__(self):
139 def __repr__(self):
140 return 'Type %s() to exit.' % self.name
140 return 'Type %s() to exit.' % self.name
141 __str__ = __repr__
141 __str__ = __repr__
142
142
143 def __call__(self):
143 def __call__(self):
144 self.shell.exit()
144 self.shell.exit()
145
145
146 class InputList(list):
146 class InputList(list):
147 """Class to store user input.
147 """Class to store user input.
148
148
149 It's basically a list, but slices return a string instead of a list, thus
149 It's basically a list, but slices return a string instead of a list, thus
150 allowing things like (assuming 'In' is an instance):
150 allowing things like (assuming 'In' is an instance):
151
151
152 exec In[4:7]
152 exec In[4:7]
153
153
154 or
154 or
155
155
156 exec In[5:9] + In[14] + In[21:25]"""
156 exec In[5:9] + In[14] + In[21:25]"""
157
157
158 def __getslice__(self,i,j):
158 def __getslice__(self,i,j):
159 return ''.join(list.__getslice__(self,i,j))
159 return ''.join(list.__getslice__(self,i,j))
160
160
161 class SyntaxTB(ultraTB.ListTB):
161 class SyntaxTB(ultraTB.ListTB):
162 """Extension which holds some state: the last exception value"""
162 """Extension which holds some state: the last exception value"""
163
163
164 def __init__(self,color_scheme = 'NoColor'):
164 def __init__(self,color_scheme = 'NoColor'):
165 ultraTB.ListTB.__init__(self,color_scheme)
165 ultraTB.ListTB.__init__(self,color_scheme)
166 self.last_syntax_error = None
166 self.last_syntax_error = None
167
167
168 def __call__(self, etype, value, elist):
168 def __call__(self, etype, value, elist):
169 self.last_syntax_error = value
169 self.last_syntax_error = value
170 ultraTB.ListTB.__call__(self,etype,value,elist)
170 ultraTB.ListTB.__call__(self,etype,value,elist)
171
171
172 def clear_err_state(self):
172 def clear_err_state(self):
173 """Return the current error state and clear it"""
173 """Return the current error state and clear it"""
174 e = self.last_syntax_error
174 e = self.last_syntax_error
175 self.last_syntax_error = None
175 self.last_syntax_error = None
176 return e
176 return e
177
177
178 #****************************************************************************
178 #****************************************************************************
179 # Main IPython class
179 # Main IPython class
180
180
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
182 # until a full rewrite is made. I've cleaned all cross-class uses of
182 # until a full rewrite is made. I've cleaned all cross-class uses of
183 # attributes and methods, but too much user code out there relies on the
183 # attributes and methods, but too much user code out there relies on the
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
185 #
185 #
186 # But at least now, all the pieces have been separated and we could, in
186 # But at least now, all the pieces have been separated and we could, in
187 # principle, stop using the mixin. This will ease the transition to the
187 # principle, stop using the mixin. This will ease the transition to the
188 # chainsaw branch.
188 # chainsaw branch.
189
189
190 # For reference, the following is the list of 'self.foo' uses in the Magic
190 # For reference, the following is the list of 'self.foo' uses in the Magic
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
192 # class, to prevent clashes.
192 # class, to prevent clashes.
193
193
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 # 'self.value']
197 # 'self.value']
198
198
199 class InteractiveShell(object,Magic):
199 class InteractiveShell(object,Magic):
200 """An enhanced console for Python."""
200 """An enhanced console for Python."""
201
201
202 # class attribute to indicate whether the class supports threads or not.
202 # class attribute to indicate whether the class supports threads or not.
203 # Subclasses with thread support should override this as needed.
203 # Subclasses with thread support should override this as needed.
204 isthreaded = False
204 isthreaded = False
205
205
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
207 user_ns = None,user_global_ns=None,banner2='',
207 user_ns = None,user_global_ns=None,banner2='',
208 custom_exceptions=((),None),embedded=False):
208 custom_exceptions=((),None),embedded=False):
209
209
210 # log system
210 # log system
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212
212
213 # some minimal strict typechecks. For some core data structures, I
213 # some minimal strict typechecks. For some core data structures, I
214 # want actual basic python types, not just anything that looks like
214 # want actual basic python types, not just anything that looks like
215 # one. This is especially true for namespaces.
215 # one. This is especially true for namespaces.
216 for ns in (user_ns,user_global_ns):
216 for ns in (user_ns,user_global_ns):
217 if ns is not None and type(ns) != types.DictType:
217 if ns is not None and type(ns) != types.DictType:
218 raise TypeError,'namespace must be a dictionary'
218 raise TypeError,'namespace must be a dictionary'
219
219
220 # Job manager (for jobs run as background threads)
220 # Job manager (for jobs run as background threads)
221 self.jobs = BackgroundJobManager()
221 self.jobs = BackgroundJobManager()
222
222
223 # Store the actual shell's name
223 # Store the actual shell's name
224 self.name = name
224 self.name = name
225
225
226 # We need to know whether the instance is meant for embedding, since
226 # We need to know whether the instance is meant for embedding, since
227 # global/local namespaces need to be handled differently in that case
227 # global/local namespaces need to be handled differently in that case
228 self.embedded = embedded
228 self.embedded = embedded
229
229
230 # command compiler
230 # command compiler
231 self.compile = codeop.CommandCompiler()
231 self.compile = codeop.CommandCompiler()
232
232
233 # User input buffer
233 # User input buffer
234 self.buffer = []
234 self.buffer = []
235
235
236 # Default name given in compilation of code
236 # Default name given in compilation of code
237 self.filename = '<ipython console>'
237 self.filename = '<ipython console>'
238
238
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
241 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.exit = Quitter(self,'exit')
242 __builtin__.quit = Quitter(self,'quit')
242 __builtin__.quit = Quitter(self,'quit')
243
243
244 # Make an empty namespace, which extension writers can rely on both
244 # Make an empty namespace, which extension writers can rely on both
245 # existing and NEVER being used by ipython itself. This gives them a
245 # existing and NEVER being used by ipython itself. This gives them a
246 # convenient location for storing additional information and state
246 # convenient location for storing additional information and state
247 # their extensions may require, without fear of collisions with other
247 # their extensions may require, without fear of collisions with other
248 # ipython names that may develop later.
248 # ipython names that may develop later.
249 self.meta = Struct()
249 self.meta = Struct()
250
250
251 # Create the namespace where the user will operate. user_ns is
251 # Create the namespace where the user will operate. user_ns is
252 # normally the only one used, and it is passed to the exec calls as
252 # normally the only one used, and it is passed to the exec calls as
253 # the locals argument. But we do carry a user_global_ns namespace
253 # the locals argument. But we do carry a user_global_ns namespace
254 # given as the exec 'globals' argument, This is useful in embedding
254 # given as the exec 'globals' argument, This is useful in embedding
255 # situations where the ipython shell opens in a context where the
255 # situations where the ipython shell opens in a context where the
256 # distinction between locals and globals is meaningful.
256 # distinction between locals and globals is meaningful.
257
257
258 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # FIXME. For some strange reason, __builtins__ is showing up at user
259 # level as a dict instead of a module. This is a manual fix, but I
259 # level as a dict instead of a module. This is a manual fix, but I
260 # should really track down where the problem is coming from. Alex
260 # should really track down where the problem is coming from. Alex
261 # Schmolck reported this problem first.
261 # Schmolck reported this problem first.
262
262
263 # A useful post by Alex Martelli on this topic:
263 # A useful post by Alex Martelli on this topic:
264 # Re: inconsistent value from __builtins__
264 # Re: inconsistent value from __builtins__
265 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Von: Alex Martelli <aleaxit@yahoo.com>
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 # Gruppen: comp.lang.python
267 # Gruppen: comp.lang.python
268
268
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 # > <type 'dict'>
271 # > <type 'dict'>
272 # > >>> print type(__builtins__)
272 # > >>> print type(__builtins__)
273 # > <type 'module'>
273 # > <type 'module'>
274 # > Is this difference in return value intentional?
274 # > Is this difference in return value intentional?
275
275
276 # Well, it's documented that '__builtins__' can be either a dictionary
276 # Well, it's documented that '__builtins__' can be either a dictionary
277 # or a module, and it's been that way for a long time. Whether it's
277 # or a module, and it's been that way for a long time. Whether it's
278 # intentional (or sensible), I don't know. In any case, the idea is
278 # intentional (or sensible), I don't know. In any case, the idea is
279 # that if you need to access the built-in namespace directly, you
279 # that if you need to access the built-in namespace directly, you
280 # should start with "import __builtin__" (note, no 's') which will
280 # should start with "import __builtin__" (note, no 's') which will
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282
282
283 # These routines return properly built dicts as needed by the rest of
283 # These routines return properly built dicts as needed by the rest of
284 # the code, and can also be used by extension writers to generate
284 # the code, and can also be used by extension writers to generate
285 # properly initialized namespaces.
285 # properly initialized namespaces.
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
288
288
289 # Assign namespaces
289 # Assign namespaces
290 # This is the namespace where all normal user variables live
290 # This is the namespace where all normal user variables live
291 self.user_ns = user_ns
291 self.user_ns = user_ns
292 # Embedded instances require a separate namespace for globals.
292 # Embedded instances require a separate namespace for globals.
293 # Normally this one is unused by non-embedded instances.
293 # Normally this one is unused by non-embedded instances.
294 self.user_global_ns = user_global_ns
294 self.user_global_ns = user_global_ns
295 # A namespace to keep track of internal data structures to prevent
295 # A namespace to keep track of internal data structures to prevent
296 # them from cluttering user-visible stuff. Will be updated later
296 # them from cluttering user-visible stuff. Will be updated later
297 self.internal_ns = {}
297 self.internal_ns = {}
298
298
299 # Namespace of system aliases. Each entry in the alias
299 # Namespace of system aliases. Each entry in the alias
300 # table must be a 2-tuple of the form (N,name), where N is the number
300 # table must be a 2-tuple of the form (N,name), where N is the number
301 # of positional arguments of the alias.
301 # of positional arguments of the alias.
302 self.alias_table = {}
302 self.alias_table = {}
303
303
304 # A table holding all the namespaces IPython deals with, so that
304 # A table holding all the namespaces IPython deals with, so that
305 # introspection facilities can search easily.
305 # introspection facilities can search easily.
306 self.ns_table = {'user':user_ns,
306 self.ns_table = {'user':user_ns,
307 'user_global':user_global_ns,
307 'user_global':user_global_ns,
308 'alias':self.alias_table,
308 'alias':self.alias_table,
309 'internal':self.internal_ns,
309 'internal':self.internal_ns,
310 'builtin':__builtin__.__dict__
310 'builtin':__builtin__.__dict__
311 }
311 }
312
312
313 # The user namespace MUST have a pointer to the shell itself.
313 # The user namespace MUST have a pointer to the shell itself.
314 self.user_ns[name] = self
314 self.user_ns[name] = self
315
315
316 # We need to insert into sys.modules something that looks like a
316 # We need to insert into sys.modules something that looks like a
317 # module but which accesses the IPython namespace, for shelve and
317 # module but which accesses the IPython namespace, for shelve and
318 # pickle to work interactively. Normally they rely on getting
318 # pickle to work interactively. Normally they rely on getting
319 # everything out of __main__, but for embedding purposes each IPython
319 # everything out of __main__, but for embedding purposes each IPython
320 # instance has its own private namespace, so we can't go shoving
320 # instance has its own private namespace, so we can't go shoving
321 # everything into __main__.
321 # everything into __main__.
322
322
323 # note, however, that we should only do this for non-embedded
323 # note, however, that we should only do this for non-embedded
324 # ipythons, which really mimic the __main__.__dict__ with their own
324 # ipythons, which really mimic the __main__.__dict__ with their own
325 # namespace. Embedded instances, on the other hand, should not do
325 # namespace. Embedded instances, on the other hand, should not do
326 # this because they need to manage the user local/global namespaces
326 # this because they need to manage the user local/global namespaces
327 # only, but they live within a 'normal' __main__ (meaning, they
327 # only, but they live within a 'normal' __main__ (meaning, they
328 # shouldn't overtake the execution environment of the script they're
328 # shouldn't overtake the execution environment of the script they're
329 # embedded in).
329 # embedded in).
330
330
331 if not embedded:
331 if not embedded:
332 try:
332 try:
333 main_name = self.user_ns['__name__']
333 main_name = self.user_ns['__name__']
334 except KeyError:
334 except KeyError:
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 else:
336 else:
337 #print "pickle hack in place" # dbg
337 #print "pickle hack in place" # dbg
338 #print 'main_name:',main_name # dbg
338 #print 'main_name:',main_name # dbg
339 sys.modules[main_name] = FakeModule(self.user_ns)
339 sys.modules[main_name] = FakeModule(self.user_ns)
340
340
341 # List of input with multi-line handling.
341 # List of input with multi-line handling.
342 # Fill its zero entry, user counter starts at 1
342 # Fill its zero entry, user counter starts at 1
343 self.input_hist = InputList(['\n'])
343 self.input_hist = InputList(['\n'])
344 # This one will hold the 'raw' input history, without any
344 # This one will hold the 'raw' input history, without any
345 # pre-processing. This will allow users to retrieve the input just as
345 # pre-processing. This will allow users to retrieve the input just as
346 # it was exactly typed in by the user, with %hist -r.
346 # it was exactly typed in by the user, with %hist -r.
347 self.input_hist_raw = InputList(['\n'])
347 self.input_hist_raw = InputList(['\n'])
348
348
349 # list of visited directories
349 # list of visited directories
350 try:
350 try:
351 self.dir_hist = [os.getcwd()]
351 self.dir_hist = [os.getcwd()]
352 except IOError, e:
352 except IOError, e:
353 self.dir_hist = []
353 self.dir_hist = []
354
354
355 # dict of output history
355 # dict of output history
356 self.output_hist = {}
356 self.output_hist = {}
357
357
358 # dict of things NOT to alias (keywords, builtins and some magics)
358 # dict of things NOT to alias (keywords, builtins and some magics)
359 no_alias = {}
359 no_alias = {}
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 for key in keyword.kwlist + no_alias_magics:
361 for key in keyword.kwlist + no_alias_magics:
362 no_alias[key] = 1
362 no_alias[key] = 1
363 no_alias.update(__builtin__.__dict__)
363 no_alias.update(__builtin__.__dict__)
364 self.no_alias = no_alias
364 self.no_alias = no_alias
365
365
366 # make global variables for user access to these
366 # make global variables for user access to these
367 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_ih'] = self.input_hist
368 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_oh'] = self.output_hist
369 self.user_ns['_dh'] = self.dir_hist
369 self.user_ns['_dh'] = self.dir_hist
370
370
371 # user aliases to input and output histories
371 # user aliases to input and output histories
372 self.user_ns['In'] = self.input_hist
372 self.user_ns['In'] = self.input_hist
373 self.user_ns['Out'] = self.output_hist
373 self.user_ns['Out'] = self.output_hist
374
374
375 # Object variable to store code object waiting execution. This is
375 # Object variable to store code object waiting execution. This is
376 # used mainly by the multithreaded shells, but it can come in handy in
376 # used mainly by the multithreaded shells, but it can come in handy in
377 # other situations. No need to use a Queue here, since it's a single
377 # other situations. No need to use a Queue here, since it's a single
378 # item which gets cleared once run.
378 # item which gets cleared once run.
379 self.code_to_run = None
379 self.code_to_run = None
380
380
381 # escapes for automatic behavior on the command line
381 # escapes for automatic behavior on the command line
382 self.ESC_SHELL = '!'
382 self.ESC_SHELL = '!'
383 self.ESC_HELP = '?'
383 self.ESC_HELP = '?'
384 self.ESC_MAGIC = '%'
384 self.ESC_MAGIC = '%'
385 self.ESC_QUOTE = ','
385 self.ESC_QUOTE = ','
386 self.ESC_QUOTE2 = ';'
386 self.ESC_QUOTE2 = ';'
387 self.ESC_PAREN = '/'
387 self.ESC_PAREN = '/'
388
388
389 # And their associated handlers
389 # And their associated handlers
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
393 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_MAGIC : self.handle_magic,
394 self.ESC_HELP : self.handle_help,
394 self.ESC_HELP : self.handle_help,
395 self.ESC_SHELL : self.handle_shell_escape,
395 self.ESC_SHELL : self.handle_shell_escape,
396 }
396 }
397
397
398 # class initializations
398 # class initializations
399 Magic.__init__(self,self)
399 Magic.__init__(self,self)
400
400
401 # Python source parser/formatter for syntax highlighting
401 # Python source parser/formatter for syntax highlighting
402 pyformat = PyColorize.Parser().format
402 pyformat = PyColorize.Parser().format
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404
404
405 # hooks holds pointers used for user-side customizations
405 # hooks holds pointers used for user-side customizations
406 self.hooks = Struct()
406 self.hooks = Struct()
407
407
408 self.strdispatchers = {}
408 self.strdispatchers = {}
409
409
410 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
411 hooks = IPython.hooks
411 hooks = IPython.hooks
412 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 #print "bound hook",hook_name
415 #print "bound hook",hook_name
416
416
417 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
418 self.exit_now = False
418 self.exit_now = False
419
419
420 self.usage_min = """\
420 self.usage_min = """\
421 An enhanced console for Python.
421 An enhanced console for Python.
422 Some of its features are:
422 Some of its features are:
423 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
424 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
425 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
426 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 """
430 """
431 if usage: self.usage = usage
431 if usage: self.usage = usage
432 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
433
433
434 # Storage
434 # Storage
435 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
436 self.pager = 'less'
436 self.pager = 'less'
437 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
438 self.tempfiles = []
438 self.tempfiles = []
439
439
440 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
441 self.has_readline = False
441 self.has_readline = False
442
442
443 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
444 # logstart method.
444 # logstart method.
445 self.loghead_tpl = \
445 self.loghead_tpl = \
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 #log# opts = %s
448 #log# opts = %s
449 #log# args = %s
449 #log# args = %s
450 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
451 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
452 """
452 """
453 # for pushd/popd management
453 # for pushd/popd management
454 try:
454 try:
455 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
456 except HomeDirError,msg:
456 except HomeDirError,msg:
457 fatal(msg)
457 fatal(msg)
458
458
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460
460
461 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
462
462
463 # utility to expand user variables via Itpl
463 # utility to expand user variables via Itpl
464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
465 self.user_ns))
465 self.user_ns))
466 # The first is similar to os.system, but it doesn't return a value,
466 # The first is similar to os.system, but it doesn't return a value,
467 # and it allows interpolation of variables in the user's namespace.
467 # and it allows interpolation of variables in the user's namespace.
468 self.system = lambda cmd: shell(self.var_expand(cmd),
468 self.system = lambda cmd: shell(self.var_expand(cmd),
469 header='IPython system call: ',
469 header='IPython system call: ',
470 verbose=self.rc.system_verbose)
470 verbose=self.rc.system_verbose)
471 # These are for getoutput and getoutputerror:
471 # These are for getoutput and getoutputerror:
472 self.getoutput = lambda cmd: \
472 self.getoutput = lambda cmd: \
473 getoutput(self.var_expand(cmd),
473 getoutput(self.var_expand(cmd),
474 header='IPython system call: ',
474 header='IPython system call: ',
475 verbose=self.rc.system_verbose)
475 verbose=self.rc.system_verbose)
476 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
477 getoutputerror(self.var_expand(cmd),
477 getoutputerror(self.var_expand(cmd),
478 header='IPython system call: ',
478 header='IPython system call: ',
479 verbose=self.rc.system_verbose)
479 verbose=self.rc.system_verbose)
480
480
481 # RegExp for splitting line contents into pre-char//first
481 # RegExp for splitting line contents into pre-char//first
482 # word-method//rest. For clarity, each group in on one line.
482 # word-method//rest. For clarity, each group in on one line.
483
483
484 # WARNING: update the regexp if the above escapes are changed, as they
484 # WARNING: update the regexp if the above escapes are changed, as they
485 # are hardwired in.
485 # are hardwired in.
486
486
487 # Don't get carried away with trying to make the autocalling catch too
487 # Don't get carried away with trying to make the autocalling catch too
488 # much: it's better to be conservative rather than to trigger hidden
488 # much: it's better to be conservative rather than to trigger hidden
489 # evals() somewhere and end up causing side effects.
489 # evals() somewhere and end up causing side effects.
490
490
491 self.line_split = re.compile(r'^([\s*,;/])'
491 self.line_split = re.compile(r'^([\s*,;/])'
492 r'([\?\w\.]+\w*\s*)'
492 r'([\?\w\.]+\w*\s*)'
493 r'(\(?.*$)')
493 r'(\(?.*$)')
494
494
495 # Original re, keep around for a while in case changes break something
495 # Original re, keep around for a while in case changes break something
496 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
496 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
497 # r'(\s*[\?\w\.]+\w*\s*)'
497 # r'(\s*[\?\w\.]+\w*\s*)'
498 # r'(\(?.*$)')
498 # r'(\(?.*$)')
499
499
500 # RegExp to identify potential function names
500 # RegExp to identify potential function names
501 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
501 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
502
502
503 # RegExp to exclude strings with this start from autocalling. In
503 # RegExp to exclude strings with this start from autocalling. In
504 # particular, all binary operators should be excluded, so that if foo
504 # particular, all binary operators should be excluded, so that if foo
505 # is callable, foo OP bar doesn't become foo(OP bar), which is
505 # is callable, foo OP bar doesn't become foo(OP bar), which is
506 # invalid. The characters '!=()' don't need to be checked for, as the
506 # invalid. The characters '!=()' don't need to be checked for, as the
507 # _prefilter routine explicitely does so, to catch direct calls and
507 # _prefilter routine explicitely does so, to catch direct calls and
508 # rebindings of existing names.
508 # rebindings of existing names.
509
509
510 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
510 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
511 # it affects the rest of the group in square brackets.
511 # it affects the rest of the group in square brackets.
512 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
512 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
513 '|^is |^not |^in |^and |^or ')
513 '|^is |^not |^in |^and |^or ')
514
514
515 # try to catch also methods for stuff in lists/tuples/dicts: off
515 # try to catch also methods for stuff in lists/tuples/dicts: off
516 # (experimental). For this to work, the line_split regexp would need
516 # (experimental). For this to work, the line_split regexp would need
517 # to be modified so it wouldn't break things at '['. That line is
517 # to be modified so it wouldn't break things at '['. That line is
518 # nasty enough that I shouldn't change it until I can test it _well_.
518 # nasty enough that I shouldn't change it until I can test it _well_.
519 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
519 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
520
520
521 # keep track of where we started running (mainly for crash post-mortem)
521 # keep track of where we started running (mainly for crash post-mortem)
522 self.starting_dir = os.getcwd()
522 self.starting_dir = os.getcwd()
523
523
524 # Various switches which can be set
524 # Various switches which can be set
525 self.CACHELENGTH = 5000 # this is cheap, it's just text
525 self.CACHELENGTH = 5000 # this is cheap, it's just text
526 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
526 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
527 self.banner2 = banner2
527 self.banner2 = banner2
528
528
529 # TraceBack handlers:
529 # TraceBack handlers:
530
530
531 # Syntax error handler.
531 # Syntax error handler.
532 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
532 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
533
533
534 # The interactive one is initialized with an offset, meaning we always
534 # The interactive one is initialized with an offset, meaning we always
535 # want to remove the topmost item in the traceback, which is our own
535 # want to remove the topmost item in the traceback, which is our own
536 # internal code. Valid modes: ['Plain','Context','Verbose']
536 # internal code. Valid modes: ['Plain','Context','Verbose']
537 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
537 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
538 color_scheme='NoColor',
538 color_scheme='NoColor',
539 tb_offset = 1)
539 tb_offset = 1)
540
540
541 # IPython itself shouldn't crash. This will produce a detailed
541 # IPython itself shouldn't crash. This will produce a detailed
542 # post-mortem if it does. But we only install the crash handler for
542 # post-mortem if it does. But we only install the crash handler for
543 # non-threaded shells, the threaded ones use a normal verbose reporter
543 # non-threaded shells, the threaded ones use a normal verbose reporter
544 # and lose the crash handler. This is because exceptions in the main
544 # and lose the crash handler. This is because exceptions in the main
545 # thread (such as in GUI code) propagate directly to sys.excepthook,
545 # thread (such as in GUI code) propagate directly to sys.excepthook,
546 # and there's no point in printing crash dumps for every user exception.
546 # and there's no point in printing crash dumps for every user exception.
547 if self.isthreaded:
547 if self.isthreaded:
548 ipCrashHandler = ultraTB.FormattedTB()
548 ipCrashHandler = ultraTB.FormattedTB()
549 else:
549 else:
550 from IPython import CrashHandler
550 from IPython import CrashHandler
551 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
551 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
552 self.set_crash_handler(ipCrashHandler)
552 self.set_crash_handler(ipCrashHandler)
553
553
554 # and add any custom exception handlers the user may have specified
554 # and add any custom exception handlers the user may have specified
555 self.set_custom_exc(*custom_exceptions)
555 self.set_custom_exc(*custom_exceptions)
556
556
557 # indentation management
557 # indentation management
558 self.autoindent = False
558 self.autoindent = False
559 self.indent_current_nsp = 0
559 self.indent_current_nsp = 0
560
560
561 # Make some aliases automatically
561 # Make some aliases automatically
562 # Prepare list of shell aliases to auto-define
562 # Prepare list of shell aliases to auto-define
563 if os.name == 'posix':
563 if os.name == 'posix':
564 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
564 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
565 'mv mv -i','rm rm -i','cp cp -i',
565 'mv mv -i','rm rm -i','cp cp -i',
566 'cat cat','less less','clear clear',
566 'cat cat','less less','clear clear',
567 # a better ls
567 # a better ls
568 'ls ls -F',
568 'ls ls -F',
569 # long ls
569 # long ls
570 'll ls -lF')
570 'll ls -lF')
571 # Extra ls aliases with color, which need special treatment on BSD
571 # Extra ls aliases with color, which need special treatment on BSD
572 # variants
572 # variants
573 ls_extra = ( # color ls
573 ls_extra = ( # color ls
574 'lc ls -F -o --color',
574 'lc ls -F -o --color',
575 # ls normal files only
575 # ls normal files only
576 'lf ls -F -o --color %l | grep ^-',
576 'lf ls -F -o --color %l | grep ^-',
577 # ls symbolic links
577 # ls symbolic links
578 'lk ls -F -o --color %l | grep ^l',
578 'lk ls -F -o --color %l | grep ^l',
579 # directories or links to directories,
579 # directories or links to directories,
580 'ldir ls -F -o --color %l | grep /$',
580 'ldir ls -F -o --color %l | grep /$',
581 # things which are executable
581 # things which are executable
582 'lx ls -F -o --color %l | grep ^-..x',
582 'lx ls -F -o --color %l | grep ^-..x',
583 )
583 )
584 # The BSDs don't ship GNU ls, so they don't understand the
584 # The BSDs don't ship GNU ls, so they don't understand the
585 # --color switch out of the box
585 # --color switch out of the box
586 if 'bsd' in sys.platform:
586 if 'bsd' in sys.platform:
587 ls_extra = ( # ls normal files only
587 ls_extra = ( # ls normal files only
588 'lf ls -lF | grep ^-',
588 'lf ls -lF | grep ^-',
589 # ls symbolic links
589 # ls symbolic links
590 'lk ls -lF | grep ^l',
590 'lk ls -lF | grep ^l',
591 # directories or links to directories,
591 # directories or links to directories,
592 'ldir ls -lF | grep /$',
592 'ldir ls -lF | grep /$',
593 # things which are executable
593 # things which are executable
594 'lx ls -lF | grep ^-..x',
594 'lx ls -lF | grep ^-..x',
595 )
595 )
596 auto_alias = auto_alias + ls_extra
596 auto_alias = auto_alias + ls_extra
597 elif os.name in ['nt','dos']:
597 elif os.name in ['nt','dos']:
598 auto_alias = ('dir dir /on', 'ls dir /on',
598 auto_alias = ('dir dir /on', 'ls dir /on',
599 'ddir dir /ad /on', 'ldir dir /ad /on',
599 'ddir dir /ad /on', 'ldir dir /ad /on',
600 'mkdir mkdir','rmdir rmdir','echo echo',
600 'mkdir mkdir','rmdir rmdir','echo echo',
601 'ren ren','cls cls','copy copy')
601 'ren ren','cls cls','copy copy')
602 else:
602 else:
603 auto_alias = ()
603 auto_alias = ()
604 self.auto_alias = [s.split(None,1) for s in auto_alias]
604 self.auto_alias = [s.split(None,1) for s in auto_alias]
605 # Call the actual (public) initializer
605 # Call the actual (public) initializer
606 self.init_auto_alias()
606 self.init_auto_alias()
607
607
608 # Produce a public API instance
608 # Produce a public API instance
609 self.api = IPython.ipapi.IPApi(self)
609 self.api = IPython.ipapi.IPApi(self)
610
610
611 # track which builtins we add, so we can clean up later
611 # track which builtins we add, so we can clean up later
612 self.builtins_added = {}
612 self.builtins_added = {}
613 # This method will add the necessary builtins for operation, but
613 # This method will add the necessary builtins for operation, but
614 # tracking what it did via the builtins_added dict.
614 # tracking what it did via the builtins_added dict.
615 self.add_builtins()
615 self.add_builtins()
616
616
617 # end __init__
617 # end __init__
618
618
619 def pre_config_initialization(self):
619 def pre_config_initialization(self):
620 """Pre-configuration init method
620 """Pre-configuration init method
621
621
622 This is called before the configuration files are processed to
622 This is called before the configuration files are processed to
623 prepare the services the config files might need.
623 prepare the services the config files might need.
624
624
625 self.rc already has reasonable default values at this point.
625 self.rc already has reasonable default values at this point.
626 """
626 """
627 rc = self.rc
627 rc = self.rc
628
628
629 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
629 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
630
630
631 def post_config_initialization(self):
631 def post_config_initialization(self):
632 """Post configuration init method
632 """Post configuration init method
633
633
634 This is called after the configuration files have been processed to
634 This is called after the configuration files have been processed to
635 'finalize' the initialization."""
635 'finalize' the initialization."""
636
636
637 rc = self.rc
637 rc = self.rc
638
638
639 # Object inspector
639 # Object inspector
640 self.inspector = OInspect.Inspector(OInspect.InspectColors,
640 self.inspector = OInspect.Inspector(OInspect.InspectColors,
641 PyColorize.ANSICodeColors,
641 PyColorize.ANSICodeColors,
642 'NoColor',
642 'NoColor',
643 rc.object_info_string_level)
643 rc.object_info_string_level)
644
644
645 # Load readline proper
645 # Load readline proper
646 if rc.readline:
646 if rc.readline:
647 self.init_readline()
647 self.init_readline()
648
648
649 # local shortcut, this is used a LOT
649 # local shortcut, this is used a LOT
650 self.log = self.logger.log
650 self.log = self.logger.log
651
651
652 # Initialize cache, set in/out prompts and printing system
652 # Initialize cache, set in/out prompts and printing system
653 self.outputcache = CachedOutput(self,
653 self.outputcache = CachedOutput(self,
654 rc.cache_size,
654 rc.cache_size,
655 rc.pprint,
655 rc.pprint,
656 input_sep = rc.separate_in,
656 input_sep = rc.separate_in,
657 output_sep = rc.separate_out,
657 output_sep = rc.separate_out,
658 output_sep2 = rc.separate_out2,
658 output_sep2 = rc.separate_out2,
659 ps1 = rc.prompt_in1,
659 ps1 = rc.prompt_in1,
660 ps2 = rc.prompt_in2,
660 ps2 = rc.prompt_in2,
661 ps_out = rc.prompt_out,
661 ps_out = rc.prompt_out,
662 pad_left = rc.prompts_pad_left)
662 pad_left = rc.prompts_pad_left)
663
663
664 # user may have over-ridden the default print hook:
664 # user may have over-ridden the default print hook:
665 try:
665 try:
666 self.outputcache.__class__.display = self.hooks.display
666 self.outputcache.__class__.display = self.hooks.display
667 except AttributeError:
667 except AttributeError:
668 pass
668 pass
669
669
670 # I don't like assigning globally to sys, because it means when
670 # I don't like assigning globally to sys, because it means when
671 # embedding instances, each embedded instance overrides the previous
671 # embedding instances, each embedded instance overrides the previous
672 # choice. But sys.displayhook seems to be called internally by exec,
672 # choice. But sys.displayhook seems to be called internally by exec,
673 # so I don't see a way around it. We first save the original and then
673 # so I don't see a way around it. We first save the original and then
674 # overwrite it.
674 # overwrite it.
675 self.sys_displayhook = sys.displayhook
675 self.sys_displayhook = sys.displayhook
676 sys.displayhook = self.outputcache
676 sys.displayhook = self.outputcache
677
677
678 # Set user colors (don't do it in the constructor above so that it
678 # Set user colors (don't do it in the constructor above so that it
679 # doesn't crash if colors option is invalid)
679 # doesn't crash if colors option is invalid)
680 self.magic_colors(rc.colors)
680 self.magic_colors(rc.colors)
681
681
682 # Set calling of pdb on exceptions
682 # Set calling of pdb on exceptions
683 self.call_pdb = rc.pdb
683 self.call_pdb = rc.pdb
684
684
685 # Load user aliases
685 # Load user aliases
686 for alias in rc.alias:
686 for alias in rc.alias:
687 self.magic_alias(alias)
687 self.magic_alias(alias)
688 self.hooks.late_startup_hook()
688 self.hooks.late_startup_hook()
689
689
690 batchrun = False
690 batchrun = False
691 for batchfile in [path(arg) for arg in self.rc.args
691 for batchfile in [path(arg) for arg in self.rc.args
692 if arg.lower().endswith('.ipy')]:
692 if arg.lower().endswith('.ipy')]:
693 if not batchfile.isfile():
693 if not batchfile.isfile():
694 print "No such batch file:", batchfile
694 print "No such batch file:", batchfile
695 continue
695 continue
696 self.api.runlines(batchfile.text())
696 self.api.runlines(batchfile.text())
697 batchrun = True
697 batchrun = True
698 if batchrun:
698 if batchrun:
699 self.exit_now = True
699 self.exit_now = True
700
700
701 def add_builtins(self):
701 def add_builtins(self):
702 """Store ipython references into the builtin namespace.
702 """Store ipython references into the builtin namespace.
703
703
704 Some parts of ipython operate via builtins injected here, which hold a
704 Some parts of ipython operate via builtins injected here, which hold a
705 reference to IPython itself."""
705 reference to IPython itself."""
706
706
707 # TODO: deprecate all except _ip; 'jobs' should be installed
707 # TODO: deprecate all except _ip; 'jobs' should be installed
708 # by an extension and the rest are under _ip, ipalias is redundant
708 # by an extension and the rest are under _ip, ipalias is redundant
709 builtins_new = dict(__IPYTHON__ = self,
709 builtins_new = dict(__IPYTHON__ = self,
710 ip_set_hook = self.set_hook,
710 ip_set_hook = self.set_hook,
711 jobs = self.jobs,
711 jobs = self.jobs,
712 ipmagic = self.ipmagic,
712 ipmagic = self.ipmagic,
713 ipalias = self.ipalias,
713 ipalias = self.ipalias,
714 ipsystem = self.ipsystem,
714 ipsystem = self.ipsystem,
715 _ip = self.api
715 _ip = self.api
716 )
716 )
717 for biname,bival in builtins_new.items():
717 for biname,bival in builtins_new.items():
718 try:
718 try:
719 # store the orignal value so we can restore it
719 # store the orignal value so we can restore it
720 self.builtins_added[biname] = __builtin__.__dict__[biname]
720 self.builtins_added[biname] = __builtin__.__dict__[biname]
721 except KeyError:
721 except KeyError:
722 # or mark that it wasn't defined, and we'll just delete it at
722 # or mark that it wasn't defined, and we'll just delete it at
723 # cleanup
723 # cleanup
724 self.builtins_added[biname] = Undefined
724 self.builtins_added[biname] = Undefined
725 __builtin__.__dict__[biname] = bival
725 __builtin__.__dict__[biname] = bival
726
726
727 # Keep in the builtins a flag for when IPython is active. We set it
727 # Keep in the builtins a flag for when IPython is active. We set it
728 # with setdefault so that multiple nested IPythons don't clobber one
728 # with setdefault so that multiple nested IPythons don't clobber one
729 # another. Each will increase its value by one upon being activated,
729 # another. Each will increase its value by one upon being activated,
730 # which also gives us a way to determine the nesting level.
730 # which also gives us a way to determine the nesting level.
731 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
731 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
732
732
733 def clean_builtins(self):
733 def clean_builtins(self):
734 """Remove any builtins which might have been added by add_builtins, or
734 """Remove any builtins which might have been added by add_builtins, or
735 restore overwritten ones to their previous values."""
735 restore overwritten ones to their previous values."""
736 for biname,bival in self.builtins_added.items():
736 for biname,bival in self.builtins_added.items():
737 if bival is Undefined:
737 if bival is Undefined:
738 del __builtin__.__dict__[biname]
738 del __builtin__.__dict__[biname]
739 else:
739 else:
740 __builtin__.__dict__[biname] = bival
740 __builtin__.__dict__[biname] = bival
741 self.builtins_added.clear()
741 self.builtins_added.clear()
742
742
743 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
743 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
744 """set_hook(name,hook) -> sets an internal IPython hook.
744 """set_hook(name,hook) -> sets an internal IPython hook.
745
745
746 IPython exposes some of its internal API as user-modifiable hooks. By
746 IPython exposes some of its internal API as user-modifiable hooks. By
747 adding your function to one of these hooks, you can modify IPython's
747 adding your function to one of these hooks, you can modify IPython's
748 behavior to call at runtime your own routines."""
748 behavior to call at runtime your own routines."""
749
749
750 # At some point in the future, this should validate the hook before it
750 # At some point in the future, this should validate the hook before it
751 # accepts it. Probably at least check that the hook takes the number
751 # accepts it. Probably at least check that the hook takes the number
752 # of args it's supposed to.
752 # of args it's supposed to.
753
753
754 f = new.instancemethod(hook,self,self.__class__)
754 f = new.instancemethod(hook,self,self.__class__)
755
755
756 # check if the hook is for strdispatcher first
756 # check if the hook is for strdispatcher first
757 if str_key is not None:
757 if str_key is not None:
758 sdp = self.strdispatchers.get(name, StrDispatch())
758 sdp = self.strdispatchers.get(name, StrDispatch())
759 sdp.add_s(str_key, f, priority )
759 sdp.add_s(str_key, f, priority )
760 self.strdispatchers[name] = sdp
760 self.strdispatchers[name] = sdp
761 return
761 return
762 if re_key is not None:
762 if re_key is not None:
763 sdp = self.strdispatchers.get(name, StrDispatch())
763 sdp = self.strdispatchers.get(name, StrDispatch())
764 sdp.add_re(re.compile(re_key), f, priority )
764 sdp.add_re(re.compile(re_key), f, priority )
765 self.strdispatchers[name] = sdp
765 self.strdispatchers[name] = sdp
766 return
766 return
767
767
768 dp = getattr(self.hooks, name, None)
768 dp = getattr(self.hooks, name, None)
769 if name not in IPython.hooks.__all__:
769 if name not in IPython.hooks.__all__:
770 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
770 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
771 if not dp:
771 if not dp:
772 dp = IPython.hooks.CommandChainDispatcher()
772 dp = IPython.hooks.CommandChainDispatcher()
773
773
774 try:
774 try:
775 dp.add(f,priority)
775 dp.add(f,priority)
776 except AttributeError:
776 except AttributeError:
777 # it was not commandchain, plain old func - replace
777 # it was not commandchain, plain old func - replace
778 dp = f
778 dp = f
779
779
780 setattr(self.hooks,name, dp)
780 setattr(self.hooks,name, dp)
781
781
782
782
783 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
783 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
784
784
785 def set_crash_handler(self,crashHandler):
785 def set_crash_handler(self,crashHandler):
786 """Set the IPython crash handler.
786 """Set the IPython crash handler.
787
787
788 This must be a callable with a signature suitable for use as
788 This must be a callable with a signature suitable for use as
789 sys.excepthook."""
789 sys.excepthook."""
790
790
791 # Install the given crash handler as the Python exception hook
791 # Install the given crash handler as the Python exception hook
792 sys.excepthook = crashHandler
792 sys.excepthook = crashHandler
793
793
794 # The instance will store a pointer to this, so that runtime code
794 # The instance will store a pointer to this, so that runtime code
795 # (such as magics) can access it. This is because during the
795 # (such as magics) can access it. This is because during the
796 # read-eval loop, it gets temporarily overwritten (to deal with GUI
796 # read-eval loop, it gets temporarily overwritten (to deal with GUI
797 # frameworks).
797 # frameworks).
798 self.sys_excepthook = sys.excepthook
798 self.sys_excepthook = sys.excepthook
799
799
800
800
801 def set_custom_exc(self,exc_tuple,handler):
801 def set_custom_exc(self,exc_tuple,handler):
802 """set_custom_exc(exc_tuple,handler)
802 """set_custom_exc(exc_tuple,handler)
803
803
804 Set a custom exception handler, which will be called if any of the
804 Set a custom exception handler, which will be called if any of the
805 exceptions in exc_tuple occur in the mainloop (specifically, in the
805 exceptions in exc_tuple occur in the mainloop (specifically, in the
806 runcode() method.
806 runcode() method.
807
807
808 Inputs:
808 Inputs:
809
809
810 - exc_tuple: a *tuple* of valid exceptions to call the defined
810 - exc_tuple: a *tuple* of valid exceptions to call the defined
811 handler for. It is very important that you use a tuple, and NOT A
811 handler for. It is very important that you use a tuple, and NOT A
812 LIST here, because of the way Python's except statement works. If
812 LIST here, because of the way Python's except statement works. If
813 you only want to trap a single exception, use a singleton tuple:
813 you only want to trap a single exception, use a singleton tuple:
814
814
815 exc_tuple == (MyCustomException,)
815 exc_tuple == (MyCustomException,)
816
816
817 - handler: this must be defined as a function with the following
817 - handler: this must be defined as a function with the following
818 basic interface: def my_handler(self,etype,value,tb).
818 basic interface: def my_handler(self,etype,value,tb).
819
819
820 This will be made into an instance method (via new.instancemethod)
820 This will be made into an instance method (via new.instancemethod)
821 of IPython itself, and it will be called if any of the exceptions
821 of IPython itself, and it will be called if any of the exceptions
822 listed in the exc_tuple are caught. If the handler is None, an
822 listed in the exc_tuple are caught. If the handler is None, an
823 internal basic one is used, which just prints basic info.
823 internal basic one is used, which just prints basic info.
824
824
825 WARNING: by putting in your own exception handler into IPython's main
825 WARNING: by putting in your own exception handler into IPython's main
826 execution loop, you run a very good chance of nasty crashes. This
826 execution loop, you run a very good chance of nasty crashes. This
827 facility should only be used if you really know what you are doing."""
827 facility should only be used if you really know what you are doing."""
828
828
829 assert type(exc_tuple)==type(()) , \
829 assert type(exc_tuple)==type(()) , \
830 "The custom exceptions must be given AS A TUPLE."
830 "The custom exceptions must be given AS A TUPLE."
831
831
832 def dummy_handler(self,etype,value,tb):
832 def dummy_handler(self,etype,value,tb):
833 print '*** Simple custom exception handler ***'
833 print '*** Simple custom exception handler ***'
834 print 'Exception type :',etype
834 print 'Exception type :',etype
835 print 'Exception value:',value
835 print 'Exception value:',value
836 print 'Traceback :',tb
836 print 'Traceback :',tb
837 print 'Source code :','\n'.join(self.buffer)
837 print 'Source code :','\n'.join(self.buffer)
838
838
839 if handler is None: handler = dummy_handler
839 if handler is None: handler = dummy_handler
840
840
841 self.CustomTB = new.instancemethod(handler,self,self.__class__)
841 self.CustomTB = new.instancemethod(handler,self,self.__class__)
842 self.custom_exceptions = exc_tuple
842 self.custom_exceptions = exc_tuple
843
843
844 def set_custom_completer(self,completer,pos=0):
844 def set_custom_completer(self,completer,pos=0):
845 """set_custom_completer(completer,pos=0)
845 """set_custom_completer(completer,pos=0)
846
846
847 Adds a new custom completer function.
847 Adds a new custom completer function.
848
848
849 The position argument (defaults to 0) is the index in the completers
849 The position argument (defaults to 0) is the index in the completers
850 list where you want the completer to be inserted."""
850 list where you want the completer to be inserted."""
851
851
852 newcomp = new.instancemethod(completer,self.Completer,
852 newcomp = new.instancemethod(completer,self.Completer,
853 self.Completer.__class__)
853 self.Completer.__class__)
854 self.Completer.matchers.insert(pos,newcomp)
854 self.Completer.matchers.insert(pos,newcomp)
855
855
856 def _get_call_pdb(self):
856 def _get_call_pdb(self):
857 return self._call_pdb
857 return self._call_pdb
858
858
859 def _set_call_pdb(self,val):
859 def _set_call_pdb(self,val):
860
860
861 if val not in (0,1,False,True):
861 if val not in (0,1,False,True):
862 raise ValueError,'new call_pdb value must be boolean'
862 raise ValueError,'new call_pdb value must be boolean'
863
863
864 # store value in instance
864 # store value in instance
865 self._call_pdb = val
865 self._call_pdb = val
866
866
867 # notify the actual exception handlers
867 # notify the actual exception handlers
868 self.InteractiveTB.call_pdb = val
868 self.InteractiveTB.call_pdb = val
869 if self.isthreaded:
869 if self.isthreaded:
870 try:
870 try:
871 self.sys_excepthook.call_pdb = val
871 self.sys_excepthook.call_pdb = val
872 except:
872 except:
873 warn('Failed to activate pdb for threaded exception handler')
873 warn('Failed to activate pdb for threaded exception handler')
874
874
875 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
875 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
876 'Control auto-activation of pdb at exceptions')
876 'Control auto-activation of pdb at exceptions')
877
877
878
878
879 # These special functions get installed in the builtin namespace, to
879 # These special functions get installed in the builtin namespace, to
880 # provide programmatic (pure python) access to magics, aliases and system
880 # provide programmatic (pure python) access to magics, aliases and system
881 # calls. This is important for logging, user scripting, and more.
881 # calls. This is important for logging, user scripting, and more.
882
882
883 # We are basically exposing, via normal python functions, the three
883 # We are basically exposing, via normal python functions, the three
884 # mechanisms in which ipython offers special call modes (magics for
884 # mechanisms in which ipython offers special call modes (magics for
885 # internal control, aliases for direct system access via pre-selected
885 # internal control, aliases for direct system access via pre-selected
886 # names, and !cmd for calling arbitrary system commands).
886 # names, and !cmd for calling arbitrary system commands).
887
887
888 def ipmagic(self,arg_s):
888 def ipmagic(self,arg_s):
889 """Call a magic function by name.
889 """Call a magic function by name.
890
890
891 Input: a string containing the name of the magic function to call and any
891 Input: a string containing the name of the magic function to call and any
892 additional arguments to be passed to the magic.
892 additional arguments to be passed to the magic.
893
893
894 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
894 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
895 prompt:
895 prompt:
896
896
897 In[1]: %name -opt foo bar
897 In[1]: %name -opt foo bar
898
898
899 To call a magic without arguments, simply use ipmagic('name').
899 To call a magic without arguments, simply use ipmagic('name').
900
900
901 This provides a proper Python function to call IPython's magics in any
901 This provides a proper Python function to call IPython's magics in any
902 valid Python code you can type at the interpreter, including loops and
902 valid Python code you can type at the interpreter, including loops and
903 compound statements. It is added by IPython to the Python builtin
903 compound statements. It is added by IPython to the Python builtin
904 namespace upon initialization."""
904 namespace upon initialization."""
905
905
906 args = arg_s.split(' ',1)
906 args = arg_s.split(' ',1)
907 magic_name = args[0]
907 magic_name = args[0]
908 magic_name = magic_name.lstrip(self.ESC_MAGIC)
908 magic_name = magic_name.lstrip(self.ESC_MAGIC)
909
909
910 try:
910 try:
911 magic_args = args[1]
911 magic_args = args[1]
912 except IndexError:
912 except IndexError:
913 magic_args = ''
913 magic_args = ''
914 fn = getattr(self,'magic_'+magic_name,None)
914 fn = getattr(self,'magic_'+magic_name,None)
915 if fn is None:
915 if fn is None:
916 error("Magic function `%s` not found." % magic_name)
916 error("Magic function `%s` not found." % magic_name)
917 else:
917 else:
918 magic_args = self.var_expand(magic_args)
918 magic_args = self.var_expand(magic_args)
919 return fn(magic_args)
919 return fn(magic_args)
920
920
921 def ipalias(self,arg_s):
921 def ipalias(self,arg_s):
922 """Call an alias by name.
922 """Call an alias by name.
923
923
924 Input: a string containing the name of the alias to call and any
924 Input: a string containing the name of the alias to call and any
925 additional arguments to be passed to the magic.
925 additional arguments to be passed to the magic.
926
926
927 ipalias('name -opt foo bar') is equivalent to typing at the ipython
927 ipalias('name -opt foo bar') is equivalent to typing at the ipython
928 prompt:
928 prompt:
929
929
930 In[1]: name -opt foo bar
930 In[1]: name -opt foo bar
931
931
932 To call an alias without arguments, simply use ipalias('name').
932 To call an alias without arguments, simply use ipalias('name').
933
933
934 This provides a proper Python function to call IPython's aliases in any
934 This provides a proper Python function to call IPython's aliases in any
935 valid Python code you can type at the interpreter, including loops and
935 valid Python code you can type at the interpreter, including loops and
936 compound statements. It is added by IPython to the Python builtin
936 compound statements. It is added by IPython to the Python builtin
937 namespace upon initialization."""
937 namespace upon initialization."""
938
938
939 args = arg_s.split(' ',1)
939 args = arg_s.split(' ',1)
940 alias_name = args[0]
940 alias_name = args[0]
941 try:
941 try:
942 alias_args = args[1]
942 alias_args = args[1]
943 except IndexError:
943 except IndexError:
944 alias_args = ''
944 alias_args = ''
945 if alias_name in self.alias_table:
945 if alias_name in self.alias_table:
946 self.call_alias(alias_name,alias_args)
946 self.call_alias(alias_name,alias_args)
947 else:
947 else:
948 error("Alias `%s` not found." % alias_name)
948 error("Alias `%s` not found." % alias_name)
949
949
950 def ipsystem(self,arg_s):
950 def ipsystem(self,arg_s):
951 """Make a system call, using IPython."""
951 """Make a system call, using IPython."""
952
952
953 self.system(arg_s)
953 self.system(arg_s)
954
954
955 def complete(self,text):
955 def complete(self,text):
956 """Return a sorted list of all possible completions on text.
956 """Return a sorted list of all possible completions on text.
957
957
958 Inputs:
958 Inputs:
959
959
960 - text: a string of text to be completed on.
960 - text: a string of text to be completed on.
961
961
962 This is a wrapper around the completion mechanism, similar to what
962 This is a wrapper around the completion mechanism, similar to what
963 readline does at the command line when the TAB key is hit. By
963 readline does at the command line when the TAB key is hit. By
964 exposing it as a method, it can be used by other non-readline
964 exposing it as a method, it can be used by other non-readline
965 environments (such as GUIs) for text completion.
965 environments (such as GUIs) for text completion.
966
966
967 Simple usage example:
967 Simple usage example:
968
968
969 In [1]: x = 'hello'
969 In [1]: x = 'hello'
970
970
971 In [2]: __IP.complete('x.l')
971 In [2]: __IP.complete('x.l')
972 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
972 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
973
973
974 complete = self.Completer.complete
974 complete = self.Completer.complete
975 state = 0
975 state = 0
976 # use a dict so we get unique keys, since ipyhton's multiple
976 # use a dict so we get unique keys, since ipyhton's multiple
977 # completers can return duplicates.
977 # completers can return duplicates.
978 comps = {}
978 comps = {}
979 while True:
979 while True:
980 newcomp = complete(text,state)
980 newcomp = complete(text,state)
981 if newcomp is None:
981 if newcomp is None:
982 break
982 break
983 comps[newcomp] = 1
983 comps[newcomp] = 1
984 state += 1
984 state += 1
985 outcomps = comps.keys()
985 outcomps = comps.keys()
986 outcomps.sort()
986 outcomps.sort()
987 return outcomps
987 return outcomps
988
988
989 def set_completer_frame(self, frame=None):
989 def set_completer_frame(self, frame=None):
990 if frame:
990 if frame:
991 self.Completer.namespace = frame.f_locals
991 self.Completer.namespace = frame.f_locals
992 self.Completer.global_namespace = frame.f_globals
992 self.Completer.global_namespace = frame.f_globals
993 else:
993 else:
994 self.Completer.namespace = self.user_ns
994 self.Completer.namespace = self.user_ns
995 self.Completer.global_namespace = self.user_global_ns
995 self.Completer.global_namespace = self.user_global_ns
996
996
997 def init_auto_alias(self):
997 def init_auto_alias(self):
998 """Define some aliases automatically.
998 """Define some aliases automatically.
999
999
1000 These are ALL parameter-less aliases"""
1000 These are ALL parameter-less aliases"""
1001
1001
1002 for alias,cmd in self.auto_alias:
1002 for alias,cmd in self.auto_alias:
1003 self.alias_table[alias] = (0,cmd)
1003 self.alias_table[alias] = (0,cmd)
1004
1004
1005 def alias_table_validate(self,verbose=0):
1005 def alias_table_validate(self,verbose=0):
1006 """Update information about the alias table.
1006 """Update information about the alias table.
1007
1007
1008 In particular, make sure no Python keywords/builtins are in it."""
1008 In particular, make sure no Python keywords/builtins are in it."""
1009
1009
1010 no_alias = self.no_alias
1010 no_alias = self.no_alias
1011 for k in self.alias_table.keys():
1011 for k in self.alias_table.keys():
1012 if k in no_alias:
1012 if k in no_alias:
1013 del self.alias_table[k]
1013 del self.alias_table[k]
1014 if verbose:
1014 if verbose:
1015 print ("Deleting alias <%s>, it's a Python "
1015 print ("Deleting alias <%s>, it's a Python "
1016 "keyword or builtin." % k)
1016 "keyword or builtin." % k)
1017
1017
1018 def set_autoindent(self,value=None):
1018 def set_autoindent(self,value=None):
1019 """Set the autoindent flag, checking for readline support.
1019 """Set the autoindent flag, checking for readline support.
1020
1020
1021 If called with no arguments, it acts as a toggle."""
1021 If called with no arguments, it acts as a toggle."""
1022
1022
1023 if not self.has_readline:
1023 if not self.has_readline:
1024 if os.name == 'posix':
1024 if os.name == 'posix':
1025 warn("The auto-indent feature requires the readline library")
1025 warn("The auto-indent feature requires the readline library")
1026 self.autoindent = 0
1026 self.autoindent = 0
1027 return
1027 return
1028 if value is None:
1028 if value is None:
1029 self.autoindent = not self.autoindent
1029 self.autoindent = not self.autoindent
1030 else:
1030 else:
1031 self.autoindent = value
1031 self.autoindent = value
1032
1032
1033 def rc_set_toggle(self,rc_field,value=None):
1033 def rc_set_toggle(self,rc_field,value=None):
1034 """Set or toggle a field in IPython's rc config. structure.
1034 """Set or toggle a field in IPython's rc config. structure.
1035
1035
1036 If called with no arguments, it acts as a toggle.
1036 If called with no arguments, it acts as a toggle.
1037
1037
1038 If called with a non-existent field, the resulting AttributeError
1038 If called with a non-existent field, the resulting AttributeError
1039 exception will propagate out."""
1039 exception will propagate out."""
1040
1040
1041 rc_val = getattr(self.rc,rc_field)
1041 rc_val = getattr(self.rc,rc_field)
1042 if value is None:
1042 if value is None:
1043 value = not rc_val
1043 value = not rc_val
1044 setattr(self.rc,rc_field,value)
1044 setattr(self.rc,rc_field,value)
1045
1045
1046 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1046 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1047 """Install the user configuration directory.
1047 """Install the user configuration directory.
1048
1048
1049 Can be called when running for the first time or to upgrade the user's
1049 Can be called when running for the first time or to upgrade the user's
1050 .ipython/ directory with the mode parameter. Valid modes are 'install'
1050 .ipython/ directory with the mode parameter. Valid modes are 'install'
1051 and 'upgrade'."""
1051 and 'upgrade'."""
1052
1052
1053 def wait():
1053 def wait():
1054 try:
1054 try:
1055 raw_input("Please press <RETURN> to start IPython.")
1055 raw_input("Please press <RETURN> to start IPython.")
1056 except EOFError:
1056 except EOFError:
1057 print >> Term.cout
1057 print >> Term.cout
1058 print '*'*70
1058 print '*'*70
1059
1059
1060 cwd = os.getcwd() # remember where we started
1060 cwd = os.getcwd() # remember where we started
1061 glb = glob.glob
1061 glb = glob.glob
1062 print '*'*70
1062 print '*'*70
1063 if mode == 'install':
1063 if mode == 'install':
1064 print \
1064 print \
1065 """Welcome to IPython. I will try to create a personal configuration directory
1065 """Welcome to IPython. I will try to create a personal configuration directory
1066 where you can customize many aspects of IPython's functionality in:\n"""
1066 where you can customize many aspects of IPython's functionality in:\n"""
1067 else:
1067 else:
1068 print 'I am going to upgrade your configuration in:'
1068 print 'I am going to upgrade your configuration in:'
1069
1069
1070 print ipythondir
1070 print ipythondir
1071
1071
1072 rcdirend = os.path.join('IPython','UserConfig')
1072 rcdirend = os.path.join('IPython','UserConfig')
1073 cfg = lambda d: os.path.join(d,rcdirend)
1073 cfg = lambda d: os.path.join(d,rcdirend)
1074 try:
1074 try:
1075 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1075 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1076 except IOError:
1076 except IOError:
1077 warning = """
1077 warning = """
1078 Installation error. IPython's directory was not found.
1078 Installation error. IPython's directory was not found.
1079
1079
1080 Check the following:
1080 Check the following:
1081
1081
1082 The ipython/IPython directory should be in a directory belonging to your
1082 The ipython/IPython directory should be in a directory belonging to your
1083 PYTHONPATH environment variable (that is, it should be in a directory
1083 PYTHONPATH environment variable (that is, it should be in a directory
1084 belonging to sys.path). You can copy it explicitly there or just link to it.
1084 belonging to sys.path). You can copy it explicitly there or just link to it.
1085
1085
1086 IPython will proceed with builtin defaults.
1086 IPython will proceed with builtin defaults.
1087 """
1087 """
1088 warn(warning)
1088 warn(warning)
1089 wait()
1089 wait()
1090 return
1090 return
1091
1091
1092 if mode == 'install':
1092 if mode == 'install':
1093 try:
1093 try:
1094 shutil.copytree(rcdir,ipythondir)
1094 shutil.copytree(rcdir,ipythondir)
1095 os.chdir(ipythondir)
1095 os.chdir(ipythondir)
1096 rc_files = glb("ipythonrc*")
1096 rc_files = glb("ipythonrc*")
1097 for rc_file in rc_files:
1097 for rc_file in rc_files:
1098 os.rename(rc_file,rc_file+rc_suffix)
1098 os.rename(rc_file,rc_file+rc_suffix)
1099 except:
1099 except:
1100 warning = """
1100 warning = """
1101
1101
1102 There was a problem with the installation:
1102 There was a problem with the installation:
1103 %s
1103 %s
1104 Try to correct it or contact the developers if you think it's a bug.
1104 Try to correct it or contact the developers if you think it's a bug.
1105 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1105 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1106 warn(warning)
1106 warn(warning)
1107 wait()
1107 wait()
1108 return
1108 return
1109
1109
1110 elif mode == 'upgrade':
1110 elif mode == 'upgrade':
1111 try:
1111 try:
1112 os.chdir(ipythondir)
1112 os.chdir(ipythondir)
1113 except:
1113 except:
1114 print """
1114 print """
1115 Can not upgrade: changing to directory %s failed. Details:
1115 Can not upgrade: changing to directory %s failed. Details:
1116 %s
1116 %s
1117 """ % (ipythondir,sys.exc_info()[1])
1117 """ % (ipythondir,sys.exc_info()[1])
1118 wait()
1118 wait()
1119 return
1119 return
1120 else:
1120 else:
1121 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1121 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1122 for new_full_path in sources:
1122 for new_full_path in sources:
1123 new_filename = os.path.basename(new_full_path)
1123 new_filename = os.path.basename(new_full_path)
1124 if new_filename.startswith('ipythonrc'):
1124 if new_filename.startswith('ipythonrc'):
1125 new_filename = new_filename + rc_suffix
1125 new_filename = new_filename + rc_suffix
1126 # The config directory should only contain files, skip any
1126 # The config directory should only contain files, skip any
1127 # directories which may be there (like CVS)
1127 # directories which may be there (like CVS)
1128 if os.path.isdir(new_full_path):
1128 if os.path.isdir(new_full_path):
1129 continue
1129 continue
1130 if os.path.exists(new_filename):
1130 if os.path.exists(new_filename):
1131 old_file = new_filename+'.old'
1131 old_file = new_filename+'.old'
1132 if os.path.exists(old_file):
1132 if os.path.exists(old_file):
1133 os.remove(old_file)
1133 os.remove(old_file)
1134 os.rename(new_filename,old_file)
1134 os.rename(new_filename,old_file)
1135 shutil.copy(new_full_path,new_filename)
1135 shutil.copy(new_full_path,new_filename)
1136 else:
1136 else:
1137 raise ValueError,'unrecognized mode for install:',`mode`
1137 raise ValueError,'unrecognized mode for install:',`mode`
1138
1138
1139 # Fix line-endings to those native to each platform in the config
1139 # Fix line-endings to those native to each platform in the config
1140 # directory.
1140 # directory.
1141 try:
1141 try:
1142 os.chdir(ipythondir)
1142 os.chdir(ipythondir)
1143 except:
1143 except:
1144 print """
1144 print """
1145 Problem: changing to directory %s failed.
1145 Problem: changing to directory %s failed.
1146 Details:
1146 Details:
1147 %s
1147 %s
1148
1148
1149 Some configuration files may have incorrect line endings. This should not
1149 Some configuration files may have incorrect line endings. This should not
1150 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1150 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1151 wait()
1151 wait()
1152 else:
1152 else:
1153 for fname in glb('ipythonrc*'):
1153 for fname in glb('ipythonrc*'):
1154 try:
1154 try:
1155 native_line_ends(fname,backup=0)
1155 native_line_ends(fname,backup=0)
1156 except IOError:
1156 except IOError:
1157 pass
1157 pass
1158
1158
1159 if mode == 'install':
1159 if mode == 'install':
1160 print """
1160 print """
1161 Successful installation!
1161 Successful installation!
1162
1162
1163 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1163 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1164 IPython manual (there are both HTML and PDF versions supplied with the
1164 IPython manual (there are both HTML and PDF versions supplied with the
1165 distribution) to make sure that your system environment is properly configured
1165 distribution) to make sure that your system environment is properly configured
1166 to take advantage of IPython's features.
1166 to take advantage of IPython's features.
1167
1167
1168 Important note: the configuration system has changed! The old system is
1168 Important note: the configuration system has changed! The old system is
1169 still in place, but its setting may be partly overridden by the settings in
1169 still in place, but its setting may be partly overridden by the settings in
1170 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1170 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1171 if some of the new settings bother you.
1171 if some of the new settings bother you.
1172
1172
1173 """
1173 """
1174 else:
1174 else:
1175 print """
1175 print """
1176 Successful upgrade!
1176 Successful upgrade!
1177
1177
1178 All files in your directory:
1178 All files in your directory:
1179 %(ipythondir)s
1179 %(ipythondir)s
1180 which would have been overwritten by the upgrade were backed up with a .old
1180 which would have been overwritten by the upgrade were backed up with a .old
1181 extension. If you had made particular customizations in those files you may
1181 extension. If you had made particular customizations in those files you may
1182 want to merge them back into the new files.""" % locals()
1182 want to merge them back into the new files.""" % locals()
1183 wait()
1183 wait()
1184 os.chdir(cwd)
1184 os.chdir(cwd)
1185 # end user_setup()
1185 # end user_setup()
1186
1186
1187 def atexit_operations(self):
1187 def atexit_operations(self):
1188 """This will be executed at the time of exit.
1188 """This will be executed at the time of exit.
1189
1189
1190 Saving of persistent data should be performed here. """
1190 Saving of persistent data should be performed here. """
1191
1191
1192 #print '*** IPython exit cleanup ***' # dbg
1192 #print '*** IPython exit cleanup ***' # dbg
1193 # input history
1193 # input history
1194 self.savehist()
1194 self.savehist()
1195
1195
1196 # Cleanup all tempfiles left around
1196 # Cleanup all tempfiles left around
1197 for tfile in self.tempfiles:
1197 for tfile in self.tempfiles:
1198 try:
1198 try:
1199 os.unlink(tfile)
1199 os.unlink(tfile)
1200 except OSError:
1200 except OSError:
1201 pass
1201 pass
1202
1202
1203 # save the "persistent data" catch-all dictionary
1203 # save the "persistent data" catch-all dictionary
1204 self.hooks.shutdown_hook()
1204 self.hooks.shutdown_hook()
1205
1205
1206 def savehist(self):
1206 def savehist(self):
1207 """Save input history to a file (via readline library)."""
1207 """Save input history to a file (via readline library)."""
1208 try:
1208 try:
1209 self.readline.write_history_file(self.histfile)
1209 self.readline.write_history_file(self.histfile)
1210 except:
1210 except:
1211 print 'Unable to save IPython command history to file: ' + \
1211 print 'Unable to save IPython command history to file: ' + \
1212 `self.histfile`
1212 `self.histfile`
1213
1213
1214 def history_saving_wrapper(self, func):
1214 def history_saving_wrapper(self, func):
1215 """ Wrap func for readline history saving
1215 """ Wrap func for readline history saving
1216
1216
1217 Convert func into callable that saves & restores
1217 Convert func into callable that saves & restores
1218 history around the call """
1218 history around the call """
1219
1219
1220 if not self.has_readline:
1220 if not self.has_readline:
1221 return func
1221 return func
1222
1222
1223 def wrapper():
1223 def wrapper():
1224 self.savehist()
1224 self.savehist()
1225 try:
1225 try:
1226 func()
1226 func()
1227 finally:
1227 finally:
1228 readline.read_history_file(self.histfile)
1228 readline.read_history_file(self.histfile)
1229 return wrapper
1229 return wrapper
1230
1230
1231
1231
1232 def pre_readline(self):
1232 def pre_readline(self):
1233 """readline hook to be used at the start of each line.
1233 """readline hook to be used at the start of each line.
1234
1234
1235 Currently it handles auto-indent only."""
1235 Currently it handles auto-indent only."""
1236
1236
1237 #debugx('self.indent_current_nsp','pre_readline:')
1237 #debugx('self.indent_current_nsp','pre_readline:')
1238 self.readline.insert_text(self.indent_current_str())
1238 self.readline.insert_text(self.indent_current_str())
1239
1239
1240 def init_readline(self):
1240 def init_readline(self):
1241 """Command history completion/saving/reloading."""
1241 """Command history completion/saving/reloading."""
1242
1242
1243 import IPython.rlineimpl as readline
1243 import IPython.rlineimpl as readline
1244 if not readline.have_readline:
1244 if not readline.have_readline:
1245 self.has_readline = 0
1245 self.has_readline = 0
1246 self.readline = None
1246 self.readline = None
1247 # no point in bugging windows users with this every time:
1247 # no point in bugging windows users with this every time:
1248 warn('Readline services not available on this platform.')
1248 warn('Readline services not available on this platform.')
1249 else:
1249 else:
1250 sys.modules['readline'] = readline
1250 sys.modules['readline'] = readline
1251 import atexit
1251 import atexit
1252 from IPython.completer import IPCompleter
1252 from IPython.completer import IPCompleter
1253 self.Completer = IPCompleter(self,
1253 self.Completer = IPCompleter(self,
1254 self.user_ns,
1254 self.user_ns,
1255 self.user_global_ns,
1255 self.user_global_ns,
1256 self.rc.readline_omit__names,
1256 self.rc.readline_omit__names,
1257 self.alias_table)
1257 self.alias_table)
1258 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1258 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1259 self.strdispatchers['complete_command'] = sdisp
1259 self.strdispatchers['complete_command'] = sdisp
1260 self.Completer.custom_completers = sdisp
1260 self.Completer.custom_completers = sdisp
1261 # Platform-specific configuration
1261 # Platform-specific configuration
1262 if os.name == 'nt':
1262 if os.name == 'nt':
1263 self.readline_startup_hook = readline.set_pre_input_hook
1263 self.readline_startup_hook = readline.set_pre_input_hook
1264 else:
1264 else:
1265 self.readline_startup_hook = readline.set_startup_hook
1265 self.readline_startup_hook = readline.set_startup_hook
1266
1266
1267 # Load user's initrc file (readline config)
1267 # Load user's initrc file (readline config)
1268 inputrc_name = os.environ.get('INPUTRC')
1268 inputrc_name = os.environ.get('INPUTRC')
1269 if inputrc_name is None:
1269 if inputrc_name is None:
1270 home_dir = get_home_dir()
1270 home_dir = get_home_dir()
1271 if home_dir is not None:
1271 if home_dir is not None:
1272 inputrc_name = os.path.join(home_dir,'.inputrc')
1272 inputrc_name = os.path.join(home_dir,'.inputrc')
1273 if os.path.isfile(inputrc_name):
1273 if os.path.isfile(inputrc_name):
1274 try:
1274 try:
1275 readline.read_init_file(inputrc_name)
1275 readline.read_init_file(inputrc_name)
1276 except:
1276 except:
1277 warn('Problems reading readline initialization file <%s>'
1277 warn('Problems reading readline initialization file <%s>'
1278 % inputrc_name)
1278 % inputrc_name)
1279
1279
1280 self.has_readline = 1
1280 self.has_readline = 1
1281 self.readline = readline
1281 self.readline = readline
1282 # save this in sys so embedded copies can restore it properly
1282 # save this in sys so embedded copies can restore it properly
1283 sys.ipcompleter = self.Completer.complete
1283 sys.ipcompleter = self.Completer.complete
1284 readline.set_completer(self.Completer.complete)
1284 readline.set_completer(self.Completer.complete)
1285
1285
1286 # Configure readline according to user's prefs
1286 # Configure readline according to user's prefs
1287 for rlcommand in self.rc.readline_parse_and_bind:
1287 for rlcommand in self.rc.readline_parse_and_bind:
1288 readline.parse_and_bind(rlcommand)
1288 readline.parse_and_bind(rlcommand)
1289
1289
1290 # remove some chars from the delimiters list
1290 # remove some chars from the delimiters list
1291 delims = readline.get_completer_delims()
1291 delims = readline.get_completer_delims()
1292 delims = delims.translate(string._idmap,
1292 delims = delims.translate(string._idmap,
1293 self.rc.readline_remove_delims)
1293 self.rc.readline_remove_delims)
1294 readline.set_completer_delims(delims)
1294 readline.set_completer_delims(delims)
1295 # otherwise we end up with a monster history after a while:
1295 # otherwise we end up with a monster history after a while:
1296 readline.set_history_length(1000)
1296 readline.set_history_length(1000)
1297 try:
1297 try:
1298 #print '*** Reading readline history' # dbg
1298 #print '*** Reading readline history' # dbg
1299 readline.read_history_file(self.histfile)
1299 readline.read_history_file(self.histfile)
1300 except IOError:
1300 except IOError:
1301 pass # It doesn't exist yet.
1301 pass # It doesn't exist yet.
1302
1302
1303 atexit.register(self.atexit_operations)
1303 atexit.register(self.atexit_operations)
1304 del atexit
1304 del atexit
1305
1305
1306 # Configure auto-indent for all platforms
1306 # Configure auto-indent for all platforms
1307 self.set_autoindent(self.rc.autoindent)
1307 self.set_autoindent(self.rc.autoindent)
1308
1308
1309 def ask_yes_no(self,prompt,default=True):
1309 def ask_yes_no(self,prompt,default=True):
1310 if self.rc.quiet:
1310 if self.rc.quiet:
1311 return True
1311 return True
1312 return ask_yes_no(prompt,default)
1312 return ask_yes_no(prompt,default)
1313
1313
1314 def _should_recompile(self,e):
1314 def _should_recompile(self,e):
1315 """Utility routine for edit_syntax_error"""
1315 """Utility routine for edit_syntax_error"""
1316
1316
1317 if e.filename in ('<ipython console>','<input>','<string>',
1317 if e.filename in ('<ipython console>','<input>','<string>',
1318 '<console>','<BackgroundJob compilation>',
1318 '<console>','<BackgroundJob compilation>',
1319 None):
1319 None):
1320
1320
1321 return False
1321 return False
1322 try:
1322 try:
1323 if (self.rc.autoedit_syntax and
1323 if (self.rc.autoedit_syntax and
1324 not self.ask_yes_no('Return to editor to correct syntax error? '
1324 not self.ask_yes_no('Return to editor to correct syntax error? '
1325 '[Y/n] ','y')):
1325 '[Y/n] ','y')):
1326 return False
1326 return False
1327 except EOFError:
1327 except EOFError:
1328 return False
1328 return False
1329
1329
1330 def int0(x):
1330 def int0(x):
1331 try:
1331 try:
1332 return int(x)
1332 return int(x)
1333 except TypeError:
1333 except TypeError:
1334 return 0
1334 return 0
1335 # always pass integer line and offset values to editor hook
1335 # always pass integer line and offset values to editor hook
1336 self.hooks.fix_error_editor(e.filename,
1336 self.hooks.fix_error_editor(e.filename,
1337 int0(e.lineno),int0(e.offset),e.msg)
1337 int0(e.lineno),int0(e.offset),e.msg)
1338 return True
1338 return True
1339
1339
1340 def edit_syntax_error(self):
1340 def edit_syntax_error(self):
1341 """The bottom half of the syntax error handler called in the main loop.
1341 """The bottom half of the syntax error handler called in the main loop.
1342
1342
1343 Loop until syntax error is fixed or user cancels.
1343 Loop until syntax error is fixed or user cancels.
1344 """
1344 """
1345
1345
1346 while self.SyntaxTB.last_syntax_error:
1346 while self.SyntaxTB.last_syntax_error:
1347 # copy and clear last_syntax_error
1347 # copy and clear last_syntax_error
1348 err = self.SyntaxTB.clear_err_state()
1348 err = self.SyntaxTB.clear_err_state()
1349 if not self._should_recompile(err):
1349 if not self._should_recompile(err):
1350 return
1350 return
1351 try:
1351 try:
1352 # may set last_syntax_error again if a SyntaxError is raised
1352 # may set last_syntax_error again if a SyntaxError is raised
1353 self.safe_execfile(err.filename,self.user_ns)
1353 self.safe_execfile(err.filename,self.user_ns)
1354 except:
1354 except:
1355 self.showtraceback()
1355 self.showtraceback()
1356 else:
1356 else:
1357 try:
1357 try:
1358 f = file(err.filename)
1358 f = file(err.filename)
1359 try:
1359 try:
1360 sys.displayhook(f.read())
1360 sys.displayhook(f.read())
1361 finally:
1361 finally:
1362 f.close()
1362 f.close()
1363 except:
1363 except:
1364 self.showtraceback()
1364 self.showtraceback()
1365
1365
1366 def showsyntaxerror(self, filename=None):
1366 def showsyntaxerror(self, filename=None):
1367 """Display the syntax error that just occurred.
1367 """Display the syntax error that just occurred.
1368
1368
1369 This doesn't display a stack trace because there isn't one.
1369 This doesn't display a stack trace because there isn't one.
1370
1370
1371 If a filename is given, it is stuffed in the exception instead
1371 If a filename is given, it is stuffed in the exception instead
1372 of what was there before (because Python's parser always uses
1372 of what was there before (because Python's parser always uses
1373 "<string>" when reading from a string).
1373 "<string>" when reading from a string).
1374 """
1374 """
1375 etype, value, last_traceback = sys.exc_info()
1375 etype, value, last_traceback = sys.exc_info()
1376
1376
1377 # See note about these variables in showtraceback() below
1377 # See note about these variables in showtraceback() below
1378 sys.last_type = etype
1378 sys.last_type = etype
1379 sys.last_value = value
1379 sys.last_value = value
1380 sys.last_traceback = last_traceback
1380 sys.last_traceback = last_traceback
1381
1381
1382 if filename and etype is SyntaxError:
1382 if filename and etype is SyntaxError:
1383 # Work hard to stuff the correct filename in the exception
1383 # Work hard to stuff the correct filename in the exception
1384 try:
1384 try:
1385 msg, (dummy_filename, lineno, offset, line) = value
1385 msg, (dummy_filename, lineno, offset, line) = value
1386 except:
1386 except:
1387 # Not the format we expect; leave it alone
1387 # Not the format we expect; leave it alone
1388 pass
1388 pass
1389 else:
1389 else:
1390 # Stuff in the right filename
1390 # Stuff in the right filename
1391 try:
1391 try:
1392 # Assume SyntaxError is a class exception
1392 # Assume SyntaxError is a class exception
1393 value = SyntaxError(msg, (filename, lineno, offset, line))
1393 value = SyntaxError(msg, (filename, lineno, offset, line))
1394 except:
1394 except:
1395 # If that failed, assume SyntaxError is a string
1395 # If that failed, assume SyntaxError is a string
1396 value = msg, (filename, lineno, offset, line)
1396 value = msg, (filename, lineno, offset, line)
1397 self.SyntaxTB(etype,value,[])
1397 self.SyntaxTB(etype,value,[])
1398
1398
1399 def debugger(self):
1399 def debugger(self):
1400 """Call the pydb/pdb debugger."""
1400 """Call the pydb/pdb debugger."""
1401
1401
1402 if not self.rc.pdb:
1402 if not self.rc.pdb:
1403 return
1403 return
1404 have_pydb = False
1404 have_pydb = False
1405 if sys.version[:3] >= '2.5':
1405 if sys.version[:3] >= '2.5':
1406 try:
1406 try:
1407 from pydb import pm
1407 from pydb import pm
1408 have_pydb = True
1408 have_pydb = True
1409 except ImportError:
1409 except ImportError:
1410 pass
1410 pass
1411 if not have_pydb:
1411 if not have_pydb:
1412 from pdb import pm
1412 from pdb import pm
1413 self.history_saving_wrapper(pm)()
1413 self.history_saving_wrapper(pm)()
1414
1414
1415 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1415 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1416 """Display the exception that just occurred.
1416 """Display the exception that just occurred.
1417
1417
1418 If nothing is known about the exception, this is the method which
1418 If nothing is known about the exception, this is the method which
1419 should be used throughout the code for presenting user tracebacks,
1419 should be used throughout the code for presenting user tracebacks,
1420 rather than directly invoking the InteractiveTB object.
1420 rather than directly invoking the InteractiveTB object.
1421
1421
1422 A specific showsyntaxerror() also exists, but this method can take
1422 A specific showsyntaxerror() also exists, but this method can take
1423 care of calling it if needed, so unless you are explicitly catching a
1423 care of calling it if needed, so unless you are explicitly catching a
1424 SyntaxError exception, don't try to analyze the stack manually and
1424 SyntaxError exception, don't try to analyze the stack manually and
1425 simply call this method."""
1425 simply call this method."""
1426
1426
1427 # Though this won't be called by syntax errors in the input line,
1427 # Though this won't be called by syntax errors in the input line,
1428 # there may be SyntaxError cases whith imported code.
1428 # there may be SyntaxError cases whith imported code.
1429 if exc_tuple is None:
1429 if exc_tuple is None:
1430 etype, value, tb = sys.exc_info()
1430 etype, value, tb = sys.exc_info()
1431 else:
1431 else:
1432 etype, value, tb = exc_tuple
1432 etype, value, tb = exc_tuple
1433 if etype is SyntaxError:
1433 if etype is SyntaxError:
1434 self.showsyntaxerror(filename)
1434 self.showsyntaxerror(filename)
1435 else:
1435 else:
1436 # WARNING: these variables are somewhat deprecated and not
1436 # WARNING: these variables are somewhat deprecated and not
1437 # necessarily safe to use in a threaded environment, but tools
1437 # necessarily safe to use in a threaded environment, but tools
1438 # like pdb depend on their existence, so let's set them. If we
1438 # like pdb depend on their existence, so let's set them. If we
1439 # find problems in the field, we'll need to revisit their use.
1439 # find problems in the field, we'll need to revisit their use.
1440 sys.last_type = etype
1440 sys.last_type = etype
1441 sys.last_value = value
1441 sys.last_value = value
1442 sys.last_traceback = tb
1442 sys.last_traceback = tb
1443
1443
1444 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1444 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1445 if self.InteractiveTB.call_pdb and self.has_readline:
1445 if self.InteractiveTB.call_pdb and self.has_readline:
1446 # pdb mucks up readline, fix it back
1446 # pdb mucks up readline, fix it back
1447 self.readline.set_completer(self.Completer.complete)
1447 self.readline.set_completer(self.Completer.complete)
1448
1448
1449 def mainloop(self,banner=None):
1449 def mainloop(self,banner=None):
1450 """Creates the local namespace and starts the mainloop.
1450 """Creates the local namespace and starts the mainloop.
1451
1451
1452 If an optional banner argument is given, it will override the
1452 If an optional banner argument is given, it will override the
1453 internally created default banner."""
1453 internally created default banner."""
1454
1454
1455 if self.rc.c: # Emulate Python's -c option
1455 if self.rc.c: # Emulate Python's -c option
1456 self.exec_init_cmd()
1456 self.exec_init_cmd()
1457 if banner is None:
1457 if banner is None:
1458 if not self.rc.banner:
1458 if not self.rc.banner:
1459 banner = ''
1459 banner = ''
1460 # banner is string? Use it directly!
1460 # banner is string? Use it directly!
1461 elif isinstance(self.rc.banner,basestring):
1461 elif isinstance(self.rc.banner,basestring):
1462 banner = self.rc.banner
1462 banner = self.rc.banner
1463 else:
1463 else:
1464 banner = self.BANNER+self.banner2
1464 banner = self.BANNER+self.banner2
1465
1465
1466 self.interact(banner)
1466 self.interact(banner)
1467
1467
1468 def exec_init_cmd(self):
1468 def exec_init_cmd(self):
1469 """Execute a command given at the command line.
1469 """Execute a command given at the command line.
1470
1470
1471 This emulates Python's -c option."""
1471 This emulates Python's -c option."""
1472
1472
1473 #sys.argv = ['-c']
1473 #sys.argv = ['-c']
1474 self.push(self.rc.c)
1474 self.push(self.rc.c)
1475
1475
1476 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1476 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1477 """Embeds IPython into a running python program.
1477 """Embeds IPython into a running python program.
1478
1478
1479 Input:
1479 Input:
1480
1480
1481 - header: An optional header message can be specified.
1481 - header: An optional header message can be specified.
1482
1482
1483 - local_ns, global_ns: working namespaces. If given as None, the
1483 - local_ns, global_ns: working namespaces. If given as None, the
1484 IPython-initialized one is updated with __main__.__dict__, so that
1484 IPython-initialized one is updated with __main__.__dict__, so that
1485 program variables become visible but user-specific configuration
1485 program variables become visible but user-specific configuration
1486 remains possible.
1486 remains possible.
1487
1487
1488 - stack_depth: specifies how many levels in the stack to go to
1488 - stack_depth: specifies how many levels in the stack to go to
1489 looking for namespaces (when local_ns and global_ns are None). This
1489 looking for namespaces (when local_ns and global_ns are None). This
1490 allows an intermediate caller to make sure that this function gets
1490 allows an intermediate caller to make sure that this function gets
1491 the namespace from the intended level in the stack. By default (0)
1491 the namespace from the intended level in the stack. By default (0)
1492 it will get its locals and globals from the immediate caller.
1492 it will get its locals and globals from the immediate caller.
1493
1493
1494 Warning: it's possible to use this in a program which is being run by
1494 Warning: it's possible to use this in a program which is being run by
1495 IPython itself (via %run), but some funny things will happen (a few
1495 IPython itself (via %run), but some funny things will happen (a few
1496 globals get overwritten). In the future this will be cleaned up, as
1496 globals get overwritten). In the future this will be cleaned up, as
1497 there is no fundamental reason why it can't work perfectly."""
1497 there is no fundamental reason why it can't work perfectly."""
1498
1498
1499 # Get locals and globals from caller
1499 # Get locals and globals from caller
1500 if local_ns is None or global_ns is None:
1500 if local_ns is None or global_ns is None:
1501 call_frame = sys._getframe(stack_depth).f_back
1501 call_frame = sys._getframe(stack_depth).f_back
1502
1502
1503 if local_ns is None:
1503 if local_ns is None:
1504 local_ns = call_frame.f_locals
1504 local_ns = call_frame.f_locals
1505 if global_ns is None:
1505 if global_ns is None:
1506 global_ns = call_frame.f_globals
1506 global_ns = call_frame.f_globals
1507
1507
1508 # Update namespaces and fire up interpreter
1508 # Update namespaces and fire up interpreter
1509
1509
1510 # The global one is easy, we can just throw it in
1510 # The global one is easy, we can just throw it in
1511 self.user_global_ns = global_ns
1511 self.user_global_ns = global_ns
1512
1512
1513 # but the user/local one is tricky: ipython needs it to store internal
1513 # but the user/local one is tricky: ipython needs it to store internal
1514 # data, but we also need the locals. We'll copy locals in the user
1514 # data, but we also need the locals. We'll copy locals in the user
1515 # one, but will track what got copied so we can delete them at exit.
1515 # one, but will track what got copied so we can delete them at exit.
1516 # This is so that a later embedded call doesn't see locals from a
1516 # This is so that a later embedded call doesn't see locals from a
1517 # previous call (which most likely existed in a separate scope).
1517 # previous call (which most likely existed in a separate scope).
1518 local_varnames = local_ns.keys()
1518 local_varnames = local_ns.keys()
1519 self.user_ns.update(local_ns)
1519 self.user_ns.update(local_ns)
1520
1520
1521 # Patch for global embedding to make sure that things don't overwrite
1521 # Patch for global embedding to make sure that things don't overwrite
1522 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1522 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1523 # FIXME. Test this a bit more carefully (the if.. is new)
1523 # FIXME. Test this a bit more carefully (the if.. is new)
1524 if local_ns is None and global_ns is None:
1524 if local_ns is None and global_ns is None:
1525 self.user_global_ns.update(__main__.__dict__)
1525 self.user_global_ns.update(__main__.__dict__)
1526
1526
1527 # make sure the tab-completer has the correct frame information, so it
1527 # make sure the tab-completer has the correct frame information, so it
1528 # actually completes using the frame's locals/globals
1528 # actually completes using the frame's locals/globals
1529 self.set_completer_frame()
1529 self.set_completer_frame()
1530
1530
1531 # before activating the interactive mode, we need to make sure that
1531 # before activating the interactive mode, we need to make sure that
1532 # all names in the builtin namespace needed by ipython point to
1532 # all names in the builtin namespace needed by ipython point to
1533 # ourselves, and not to other instances.
1533 # ourselves, and not to other instances.
1534 self.add_builtins()
1534 self.add_builtins()
1535
1535
1536 self.interact(header)
1536 self.interact(header)
1537
1537
1538 # now, purge out the user namespace from anything we might have added
1538 # now, purge out the user namespace from anything we might have added
1539 # from the caller's local namespace
1539 # from the caller's local namespace
1540 delvar = self.user_ns.pop
1540 delvar = self.user_ns.pop
1541 for var in local_varnames:
1541 for var in local_varnames:
1542 delvar(var,None)
1542 delvar(var,None)
1543 # and clean builtins we may have overridden
1543 # and clean builtins we may have overridden
1544 self.clean_builtins()
1544 self.clean_builtins()
1545
1545
1546 def interact(self, banner=None):
1546 def interact(self, banner=None):
1547 """Closely emulate the interactive Python console.
1547 """Closely emulate the interactive Python console.
1548
1548
1549 The optional banner argument specify the banner to print
1549 The optional banner argument specify the banner to print
1550 before the first interaction; by default it prints a banner
1550 before the first interaction; by default it prints a banner
1551 similar to the one printed by the real Python interpreter,
1551 similar to the one printed by the real Python interpreter,
1552 followed by the current class name in parentheses (so as not
1552 followed by the current class name in parentheses (so as not
1553 to confuse this with the real interpreter -- since it's so
1553 to confuse this with the real interpreter -- since it's so
1554 close!).
1554 close!).
1555
1555
1556 """
1556 """
1557
1557
1558 if self.exit_now:
1558 if self.exit_now:
1559 # batch run -> do not interact
1559 # batch run -> do not interact
1560 return
1560 return
1561 cprt = 'Type "copyright", "credits" or "license" for more information.'
1561 cprt = 'Type "copyright", "credits" or "license" for more information.'
1562 if banner is None:
1562 if banner is None:
1563 self.write("Python %s on %s\n%s\n(%s)\n" %
1563 self.write("Python %s on %s\n%s\n(%s)\n" %
1564 (sys.version, sys.platform, cprt,
1564 (sys.version, sys.platform, cprt,
1565 self.__class__.__name__))
1565 self.__class__.__name__))
1566 else:
1566 else:
1567 self.write(banner)
1567 self.write(banner)
1568
1568
1569 more = 0
1569 more = 0
1570
1570
1571 # Mark activity in the builtins
1571 # Mark activity in the builtins
1572 __builtin__.__dict__['__IPYTHON__active'] += 1
1572 __builtin__.__dict__['__IPYTHON__active'] += 1
1573
1573
1574 # exit_now is set by a call to %Exit or %Quit
1574 # exit_now is set by a call to %Exit or %Quit
1575 while not self.exit_now:
1575 while not self.exit_now:
1576 if more:
1576 if more:
1577 prompt = self.hooks.generate_prompt(True)
1577 prompt = self.hooks.generate_prompt(True)
1578 if self.autoindent:
1578 if self.autoindent:
1579 self.readline_startup_hook(self.pre_readline)
1579 self.readline_startup_hook(self.pre_readline)
1580 else:
1580 else:
1581 prompt = self.hooks.generate_prompt(False)
1581 prompt = self.hooks.generate_prompt(False)
1582 try:
1582 try:
1583 line = self.raw_input(prompt,more)
1583 line = self.raw_input(prompt,more)
1584 if self.exit_now:
1584 if self.exit_now:
1585 # quick exit on sys.std[in|out] close
1585 # quick exit on sys.std[in|out] close
1586 break
1586 break
1587 if self.autoindent:
1587 if self.autoindent:
1588 self.readline_startup_hook(None)
1588 self.readline_startup_hook(None)
1589 except KeyboardInterrupt:
1589 except KeyboardInterrupt:
1590 self.write('\nKeyboardInterrupt\n')
1590 self.write('\nKeyboardInterrupt\n')
1591 self.resetbuffer()
1591 self.resetbuffer()
1592 # keep cache in sync with the prompt counter:
1592 # keep cache in sync with the prompt counter:
1593 self.outputcache.prompt_count -= 1
1593 self.outputcache.prompt_count -= 1
1594
1594
1595 if self.autoindent:
1595 if self.autoindent:
1596 self.indent_current_nsp = 0
1596 self.indent_current_nsp = 0
1597 more = 0
1597 more = 0
1598 except EOFError:
1598 except EOFError:
1599 if self.autoindent:
1599 if self.autoindent:
1600 self.readline_startup_hook(None)
1600 self.readline_startup_hook(None)
1601 self.write('\n')
1601 self.write('\n')
1602 self.exit()
1602 self.exit()
1603 except bdb.BdbQuit:
1603 except bdb.BdbQuit:
1604 warn('The Python debugger has exited with a BdbQuit exception.\n'
1604 warn('The Python debugger has exited with a BdbQuit exception.\n'
1605 'Because of how pdb handles the stack, it is impossible\n'
1605 'Because of how pdb handles the stack, it is impossible\n'
1606 'for IPython to properly format this particular exception.\n'
1606 'for IPython to properly format this particular exception.\n'
1607 'IPython will resume normal operation.')
1607 'IPython will resume normal operation.')
1608 except:
1608 except:
1609 # exceptions here are VERY RARE, but they can be triggered
1609 # exceptions here are VERY RARE, but they can be triggered
1610 # asynchronously by signal handlers, for example.
1610 # asynchronously by signal handlers, for example.
1611 self.showtraceback()
1611 self.showtraceback()
1612 else:
1612 else:
1613 more = self.push(line)
1613 more = self.push(line)
1614 if (self.SyntaxTB.last_syntax_error and
1614 if (self.SyntaxTB.last_syntax_error and
1615 self.rc.autoedit_syntax):
1615 self.rc.autoedit_syntax):
1616 self.edit_syntax_error()
1616 self.edit_syntax_error()
1617
1617
1618 # We are off again...
1618 # We are off again...
1619 __builtin__.__dict__['__IPYTHON__active'] -= 1
1619 __builtin__.__dict__['__IPYTHON__active'] -= 1
1620
1620
1621 def excepthook(self, etype, value, tb):
1621 def excepthook(self, etype, value, tb):
1622 """One more defense for GUI apps that call sys.excepthook.
1622 """One more defense for GUI apps that call sys.excepthook.
1623
1623
1624 GUI frameworks like wxPython trap exceptions and call
1624 GUI frameworks like wxPython trap exceptions and call
1625 sys.excepthook themselves. I guess this is a feature that
1625 sys.excepthook themselves. I guess this is a feature that
1626 enables them to keep running after exceptions that would
1626 enables them to keep running after exceptions that would
1627 otherwise kill their mainloop. This is a bother for IPython
1627 otherwise kill their mainloop. This is a bother for IPython
1628 which excepts to catch all of the program exceptions with a try:
1628 which excepts to catch all of the program exceptions with a try:
1629 except: statement.
1629 except: statement.
1630
1630
1631 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1631 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1632 any app directly invokes sys.excepthook, it will look to the user like
1632 any app directly invokes sys.excepthook, it will look to the user like
1633 IPython crashed. In order to work around this, we can disable the
1633 IPython crashed. In order to work around this, we can disable the
1634 CrashHandler and replace it with this excepthook instead, which prints a
1634 CrashHandler and replace it with this excepthook instead, which prints a
1635 regular traceback using our InteractiveTB. In this fashion, apps which
1635 regular traceback using our InteractiveTB. In this fashion, apps which
1636 call sys.excepthook will generate a regular-looking exception from
1636 call sys.excepthook will generate a regular-looking exception from
1637 IPython, and the CrashHandler will only be triggered by real IPython
1637 IPython, and the CrashHandler will only be triggered by real IPython
1638 crashes.
1638 crashes.
1639
1639
1640 This hook should be used sparingly, only in places which are not likely
1640 This hook should be used sparingly, only in places which are not likely
1641 to be true IPython errors.
1641 to be true IPython errors.
1642 """
1642 """
1643 self.showtraceback((etype,value,tb),tb_offset=0)
1643 self.showtraceback((etype,value,tb),tb_offset=0)
1644
1644
1645 def expand_aliases(self,fn,rest):
1645 def expand_aliases(self,fn,rest):
1646 """ Expand multiple levels of aliases:
1646 """ Expand multiple levels of aliases:
1647
1647
1648 if:
1648 if:
1649
1649
1650 alias foo bar /tmp
1650 alias foo bar /tmp
1651 alias baz foo
1651 alias baz foo
1652
1652
1653 then:
1653 then:
1654
1654
1655 baz huhhahhei -> bar /tmp huhhahhei
1655 baz huhhahhei -> bar /tmp huhhahhei
1656
1656
1657 """
1657 """
1658 line = fn + " " + rest
1658 line = fn + " " + rest
1659
1659
1660 done = Set()
1660 done = Set()
1661 while 1:
1661 while 1:
1662 pre,fn,rest = self.split_user_input(line)
1662 pre,fn,rest = self.split_user_input(line)
1663 if fn in self.alias_table:
1663 if fn in self.alias_table:
1664 if fn in done:
1664 if fn in done:
1665 warn("Cyclic alias definition, repeated '%s'" % fn)
1665 warn("Cyclic alias definition, repeated '%s'" % fn)
1666 return ""
1666 return ""
1667 done.add(fn)
1667 done.add(fn)
1668
1668
1669 l2 = self.transform_alias(fn,rest)
1669 l2 = self.transform_alias(fn,rest)
1670 # dir -> dir
1670 # dir -> dir
1671 # print "alias",line, "->",l2 #dbg
1671 # print "alias",line, "->",l2 #dbg
1672 if l2 == line:
1672 if l2 == line:
1673 break
1673 break
1674 # ls -> ls -F should not recurse forever
1674 # ls -> ls -F should not recurse forever
1675 if l2.split(None,1)[0] == line.split(None,1)[0]:
1675 if l2.split(None,1)[0] == line.split(None,1)[0]:
1676 line = l2
1676 line = l2
1677 break
1677 break
1678
1678
1679 line=l2
1679 line=l2
1680
1680
1681
1681
1682 # print "al expand to",line #dbg
1682 # print "al expand to",line #dbg
1683 else:
1683 else:
1684 break
1684 break
1685
1685
1686 return line
1686 return line
1687
1687
1688 def transform_alias(self, alias,rest=''):
1688 def transform_alias(self, alias,rest=''):
1689 """ Transform alias to system command string.
1689 """ Transform alias to system command string.
1690 """
1690 """
1691 nargs,cmd = self.alias_table[alias]
1691 nargs,cmd = self.alias_table[alias]
1692 if ' ' in cmd and os.path.isfile(cmd):
1692 if ' ' in cmd and os.path.isfile(cmd):
1693 cmd = '"%s"' % cmd
1693 cmd = '"%s"' % cmd
1694
1694
1695 # Expand the %l special to be the user's input line
1695 # Expand the %l special to be the user's input line
1696 if cmd.find('%l') >= 0:
1696 if cmd.find('%l') >= 0:
1697 cmd = cmd.replace('%l',rest)
1697 cmd = cmd.replace('%l',rest)
1698 rest = ''
1698 rest = ''
1699 if nargs==0:
1699 if nargs==0:
1700 # Simple, argument-less aliases
1700 # Simple, argument-less aliases
1701 cmd = '%s %s' % (cmd,rest)
1701 cmd = '%s %s' % (cmd,rest)
1702 else:
1702 else:
1703 # Handle aliases with positional arguments
1703 # Handle aliases with positional arguments
1704 args = rest.split(None,nargs)
1704 args = rest.split(None,nargs)
1705 if len(args)< nargs:
1705 if len(args)< nargs:
1706 error('Alias <%s> requires %s arguments, %s given.' %
1706 error('Alias <%s> requires %s arguments, %s given.' %
1707 (alias,nargs,len(args)))
1707 (alias,nargs,len(args)))
1708 return None
1708 return None
1709 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1709 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1710 # Now call the macro, evaluating in the user's namespace
1710 # Now call the macro, evaluating in the user's namespace
1711 #print 'new command: <%r>' % cmd # dbg
1711 #print 'new command: <%r>' % cmd # dbg
1712 return cmd
1712 return cmd
1713
1713
1714 def call_alias(self,alias,rest=''):
1714 def call_alias(self,alias,rest=''):
1715 """Call an alias given its name and the rest of the line.
1715 """Call an alias given its name and the rest of the line.
1716
1716
1717 This is only used to provide backwards compatibility for users of
1717 This is only used to provide backwards compatibility for users of
1718 ipalias(), use of which is not recommended for anymore."""
1718 ipalias(), use of which is not recommended for anymore."""
1719
1719
1720 # Now call the macro, evaluating in the user's namespace
1720 # Now call the macro, evaluating in the user's namespace
1721 cmd = self.transform_alias(alias, rest)
1721 cmd = self.transform_alias(alias, rest)
1722 try:
1722 try:
1723 self.system(cmd)
1723 self.system(cmd)
1724 except:
1724 except:
1725 self.showtraceback()
1725 self.showtraceback()
1726
1726
1727 def indent_current_str(self):
1727 def indent_current_str(self):
1728 """return the current level of indentation as a string"""
1728 """return the current level of indentation as a string"""
1729 return self.indent_current_nsp * ' '
1729 return self.indent_current_nsp * ' '
1730
1730
1731 def autoindent_update(self,line):
1731 def autoindent_update(self,line):
1732 """Keep track of the indent level."""
1732 """Keep track of the indent level."""
1733
1733
1734 #debugx('line')
1734 #debugx('line')
1735 #debugx('self.indent_current_nsp')
1735 #debugx('self.indent_current_nsp')
1736 if self.autoindent:
1736 if self.autoindent:
1737 if line:
1737 if line:
1738 inisp = num_ini_spaces(line)
1738 inisp = num_ini_spaces(line)
1739 if inisp < self.indent_current_nsp:
1739 if inisp < self.indent_current_nsp:
1740 self.indent_current_nsp = inisp
1740 self.indent_current_nsp = inisp
1741
1741
1742 if line[-1] == ':':
1742 if line[-1] == ':':
1743 self.indent_current_nsp += 4
1743 self.indent_current_nsp += 4
1744 elif dedent_re.match(line):
1744 elif dedent_re.match(line):
1745 self.indent_current_nsp -= 4
1745 self.indent_current_nsp -= 4
1746 else:
1746 else:
1747 self.indent_current_nsp = 0
1747 self.indent_current_nsp = 0
1748
1748
1749 def runlines(self,lines):
1749 def runlines(self,lines):
1750 """Run a string of one or more lines of source.
1750 """Run a string of one or more lines of source.
1751
1751
1752 This method is capable of running a string containing multiple source
1752 This method is capable of running a string containing multiple source
1753 lines, as if they had been entered at the IPython prompt. Since it
1753 lines, as if they had been entered at the IPython prompt. Since it
1754 exposes IPython's processing machinery, the given strings can contain
1754 exposes IPython's processing machinery, the given strings can contain
1755 magic calls (%magic), special shell access (!cmd), etc."""
1755 magic calls (%magic), special shell access (!cmd), etc."""
1756
1756
1757 # We must start with a clean buffer, in case this is run from an
1757 # We must start with a clean buffer, in case this is run from an
1758 # interactive IPython session (via a magic, for example).
1758 # interactive IPython session (via a magic, for example).
1759 self.resetbuffer()
1759 self.resetbuffer()
1760 lines = lines.split('\n')
1760 lines = lines.split('\n')
1761 more = 0
1761 more = 0
1762 for line in lines:
1762 for line in lines:
1763 # skip blank lines so we don't mess up the prompt counter, but do
1763 # skip blank lines so we don't mess up the prompt counter, but do
1764 # NOT skip even a blank line if we are in a code block (more is
1764 # NOT skip even a blank line if we are in a code block (more is
1765 # true)
1765 # true)
1766 if line or more:
1766 if line or more:
1767 more = self.push(self.prefilter(line,more))
1767 more = self.push(self.prefilter(line,more))
1768 # IPython's runsource returns None if there was an error
1768 # IPython's runsource returns None if there was an error
1769 # compiling the code. This allows us to stop processing right
1769 # compiling the code. This allows us to stop processing right
1770 # away, so the user gets the error message at the right place.
1770 # away, so the user gets the error message at the right place.
1771 if more is None:
1771 if more is None:
1772 break
1772 break
1773 # final newline in case the input didn't have it, so that the code
1773 # final newline in case the input didn't have it, so that the code
1774 # actually does get executed
1774 # actually does get executed
1775 if more:
1775 if more:
1776 self.push('\n')
1776 self.push('\n')
1777
1777
1778 def runsource(self, source, filename='<input>', symbol='single'):
1778 def runsource(self, source, filename='<input>', symbol='single'):
1779 """Compile and run some source in the interpreter.
1779 """Compile and run some source in the interpreter.
1780
1780
1781 Arguments are as for compile_command().
1781 Arguments are as for compile_command().
1782
1782
1783 One several things can happen:
1783 One several things can happen:
1784
1784
1785 1) The input is incorrect; compile_command() raised an
1785 1) The input is incorrect; compile_command() raised an
1786 exception (SyntaxError or OverflowError). A syntax traceback
1786 exception (SyntaxError or OverflowError). A syntax traceback
1787 will be printed by calling the showsyntaxerror() method.
1787 will be printed by calling the showsyntaxerror() method.
1788
1788
1789 2) The input is incomplete, and more input is required;
1789 2) The input is incomplete, and more input is required;
1790 compile_command() returned None. Nothing happens.
1790 compile_command() returned None. Nothing happens.
1791
1791
1792 3) The input is complete; compile_command() returned a code
1792 3) The input is complete; compile_command() returned a code
1793 object. The code is executed by calling self.runcode() (which
1793 object. The code is executed by calling self.runcode() (which
1794 also handles run-time exceptions, except for SystemExit).
1794 also handles run-time exceptions, except for SystemExit).
1795
1795
1796 The return value is:
1796 The return value is:
1797
1797
1798 - True in case 2
1798 - True in case 2
1799
1799
1800 - False in the other cases, unless an exception is raised, where
1800 - False in the other cases, unless an exception is raised, where
1801 None is returned instead. This can be used by external callers to
1801 None is returned instead. This can be used by external callers to
1802 know whether to continue feeding input or not.
1802 know whether to continue feeding input or not.
1803
1803
1804 The return value can be used to decide whether to use sys.ps1 or
1804 The return value can be used to decide whether to use sys.ps1 or
1805 sys.ps2 to prompt the next line."""
1805 sys.ps2 to prompt the next line."""
1806
1806
1807 try:
1807 try:
1808 code = self.compile(source,filename,symbol)
1808 code = self.compile(source,filename,symbol)
1809 except (OverflowError, SyntaxError, ValueError):
1809 except (OverflowError, SyntaxError, ValueError):
1810 # Case 1
1810 # Case 1
1811 self.showsyntaxerror(filename)
1811 self.showsyntaxerror(filename)
1812 return None
1812 return None
1813
1813
1814 if code is None:
1814 if code is None:
1815 # Case 2
1815 # Case 2
1816 return True
1816 return True
1817
1817
1818 # Case 3
1818 # Case 3
1819 # We store the code object so that threaded shells and
1819 # We store the code object so that threaded shells and
1820 # custom exception handlers can access all this info if needed.
1820 # custom exception handlers can access all this info if needed.
1821 # The source corresponding to this can be obtained from the
1821 # The source corresponding to this can be obtained from the
1822 # buffer attribute as '\n'.join(self.buffer).
1822 # buffer attribute as '\n'.join(self.buffer).
1823 self.code_to_run = code
1823 self.code_to_run = code
1824 # now actually execute the code object
1824 # now actually execute the code object
1825 if self.runcode(code) == 0:
1825 if self.runcode(code) == 0:
1826 return False
1826 return False
1827 else:
1827 else:
1828 return None
1828 return None
1829
1829
1830 def runcode(self,code_obj):
1830 def runcode(self,code_obj):
1831 """Execute a code object.
1831 """Execute a code object.
1832
1832
1833 When an exception occurs, self.showtraceback() is called to display a
1833 When an exception occurs, self.showtraceback() is called to display a
1834 traceback.
1834 traceback.
1835
1835
1836 Return value: a flag indicating whether the code to be run completed
1836 Return value: a flag indicating whether the code to be run completed
1837 successfully:
1837 successfully:
1838
1838
1839 - 0: successful execution.
1839 - 0: successful execution.
1840 - 1: an error occurred.
1840 - 1: an error occurred.
1841 """
1841 """
1842
1842
1843 # Set our own excepthook in case the user code tries to call it
1843 # Set our own excepthook in case the user code tries to call it
1844 # directly, so that the IPython crash handler doesn't get triggered
1844 # directly, so that the IPython crash handler doesn't get triggered
1845 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1845 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1846
1846
1847 # we save the original sys.excepthook in the instance, in case config
1847 # we save the original sys.excepthook in the instance, in case config
1848 # code (such as magics) needs access to it.
1848 # code (such as magics) needs access to it.
1849 self.sys_excepthook = old_excepthook
1849 self.sys_excepthook = old_excepthook
1850 outflag = 1 # happens in more places, so it's easier as default
1850 outflag = 1 # happens in more places, so it's easier as default
1851 try:
1851 try:
1852 try:
1852 try:
1853 # Embedded instances require separate global/local namespaces
1853 # Embedded instances require separate global/local namespaces
1854 # so they can see both the surrounding (local) namespace and
1854 # so they can see both the surrounding (local) namespace and
1855 # the module-level globals when called inside another function.
1855 # the module-level globals when called inside another function.
1856 if self.embedded:
1856 if self.embedded:
1857 exec code_obj in self.user_global_ns, self.user_ns
1857 exec code_obj in self.user_global_ns, self.user_ns
1858 # Normal (non-embedded) instances should only have a single
1858 # Normal (non-embedded) instances should only have a single
1859 # namespace for user code execution, otherwise functions won't
1859 # namespace for user code execution, otherwise functions won't
1860 # see interactive top-level globals.
1860 # see interactive top-level globals.
1861 else:
1861 else:
1862 exec code_obj in self.user_ns
1862 exec code_obj in self.user_ns
1863 finally:
1863 finally:
1864 # Reset our crash handler in place
1864 # Reset our crash handler in place
1865 sys.excepthook = old_excepthook
1865 sys.excepthook = old_excepthook
1866 except SystemExit:
1866 except SystemExit:
1867 self.resetbuffer()
1867 self.resetbuffer()
1868 self.showtraceback()
1868 self.showtraceback()
1869 warn("Type %exit or %quit to exit IPython "
1869 warn("Type %exit or %quit to exit IPython "
1870 "(%Exit or %Quit do so unconditionally).",level=1)
1870 "(%Exit or %Quit do so unconditionally).",level=1)
1871 except self.custom_exceptions:
1871 except self.custom_exceptions:
1872 etype,value,tb = sys.exc_info()
1872 etype,value,tb = sys.exc_info()
1873 self.CustomTB(etype,value,tb)
1873 self.CustomTB(etype,value,tb)
1874 except:
1874 except:
1875 self.showtraceback()
1875 self.showtraceback()
1876 else:
1876 else:
1877 outflag = 0
1877 outflag = 0
1878 if softspace(sys.stdout, 0):
1878 if softspace(sys.stdout, 0):
1879 print
1879 print
1880 # Flush out code object which has been run (and source)
1880 # Flush out code object which has been run (and source)
1881 self.code_to_run = None
1881 self.code_to_run = None
1882 return outflag
1882 return outflag
1883
1883
1884 def push(self, line):
1884 def push(self, line):
1885 """Push a line to the interpreter.
1885 """Push a line to the interpreter.
1886
1886
1887 The line should not have a trailing newline; it may have
1887 The line should not have a trailing newline; it may have
1888 internal newlines. The line is appended to a buffer and the
1888 internal newlines. The line is appended to a buffer and the
1889 interpreter's runsource() method is called with the
1889 interpreter's runsource() method is called with the
1890 concatenated contents of the buffer as source. If this
1890 concatenated contents of the buffer as source. If this
1891 indicates that the command was executed or invalid, the buffer
1891 indicates that the command was executed or invalid, the buffer
1892 is reset; otherwise, the command is incomplete, and the buffer
1892 is reset; otherwise, the command is incomplete, and the buffer
1893 is left as it was after the line was appended. The return
1893 is left as it was after the line was appended. The return
1894 value is 1 if more input is required, 0 if the line was dealt
1894 value is 1 if more input is required, 0 if the line was dealt
1895 with in some way (this is the same as runsource()).
1895 with in some way (this is the same as runsource()).
1896 """
1896 """
1897
1897
1898 # autoindent management should be done here, and not in the
1898 # autoindent management should be done here, and not in the
1899 # interactive loop, since that one is only seen by keyboard input. We
1899 # interactive loop, since that one is only seen by keyboard input. We
1900 # need this done correctly even for code run via runlines (which uses
1900 # need this done correctly even for code run via runlines (which uses
1901 # push).
1901 # push).
1902
1902
1903 #print 'push line: <%s>' % line # dbg
1903 #print 'push line: <%s>' % line # dbg
1904 for subline in line.splitlines():
1904 for subline in line.splitlines():
1905 self.autoindent_update(subline)
1905 self.autoindent_update(subline)
1906 self.buffer.append(line)
1906 self.buffer.append(line)
1907 more = self.runsource('\n'.join(self.buffer), self.filename)
1907 more = self.runsource('\n'.join(self.buffer), self.filename)
1908 if not more:
1908 if not more:
1909 self.resetbuffer()
1909 self.resetbuffer()
1910 return more
1910 return more
1911
1911
1912 def resetbuffer(self):
1912 def resetbuffer(self):
1913 """Reset the input buffer."""
1913 """Reset the input buffer."""
1914 self.buffer[:] = []
1914 self.buffer[:] = []
1915
1915
1916 def raw_input(self,prompt='',continue_prompt=False):
1916 def raw_input(self,prompt='',continue_prompt=False):
1917 """Write a prompt and read a line.
1917 """Write a prompt and read a line.
1918
1918
1919 The returned line does not include the trailing newline.
1919 The returned line does not include the trailing newline.
1920 When the user enters the EOF key sequence, EOFError is raised.
1920 When the user enters the EOF key sequence, EOFError is raised.
1921
1921
1922 Optional inputs:
1922 Optional inputs:
1923
1923
1924 - prompt(''): a string to be printed to prompt the user.
1924 - prompt(''): a string to be printed to prompt the user.
1925
1925
1926 - continue_prompt(False): whether this line is the first one or a
1926 - continue_prompt(False): whether this line is the first one or a
1927 continuation in a sequence of inputs.
1927 continuation in a sequence of inputs.
1928 """
1928 """
1929
1929
1930 try:
1930 try:
1931 line = raw_input_original(prompt)
1931 line = raw_input_original(prompt)
1932 except ValueError:
1932 except ValueError:
1933 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1933 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1934 self.exit_now = True
1934 self.exit_now = True
1935 return ""
1935 return ""
1936
1936
1937
1937
1938 # Try to be reasonably smart about not re-indenting pasted input more
1938 # Try to be reasonably smart about not re-indenting pasted input more
1939 # than necessary. We do this by trimming out the auto-indent initial
1939 # than necessary. We do this by trimming out the auto-indent initial
1940 # spaces, if the user's actual input started itself with whitespace.
1940 # spaces, if the user's actual input started itself with whitespace.
1941 #debugx('self.buffer[-1]')
1941 #debugx('self.buffer[-1]')
1942
1942
1943 if self.autoindent:
1943 if self.autoindent:
1944 if num_ini_spaces(line) > self.indent_current_nsp:
1944 if num_ini_spaces(line) > self.indent_current_nsp:
1945 line = line[self.indent_current_nsp:]
1945 line = line[self.indent_current_nsp:]
1946 self.indent_current_nsp = 0
1946 self.indent_current_nsp = 0
1947
1947
1948 # store the unfiltered input before the user has any chance to modify
1948 # store the unfiltered input before the user has any chance to modify
1949 # it.
1949 # it.
1950 if line.strip():
1950 if line.strip():
1951 if continue_prompt:
1951 if continue_prompt:
1952 self.input_hist_raw[-1] += '%s\n' % line
1952 self.input_hist_raw[-1] += '%s\n' % line
1953 if self.has_readline: # and some config option is set?
1953 if self.has_readline: # and some config option is set?
1954 try:
1954 try:
1955 histlen = self.readline.get_current_history_length()
1955 histlen = self.readline.get_current_history_length()
1956 newhist = self.input_hist_raw[-1].rstrip()
1956 newhist = self.input_hist_raw[-1].rstrip()
1957 self.readline.remove_history_item(histlen-1)
1957 self.readline.remove_history_item(histlen-1)
1958 self.readline.replace_history_item(histlen-2,newhist)
1958 self.readline.replace_history_item(histlen-2,newhist)
1959 except AttributeError:
1959 except AttributeError:
1960 pass # re{move,place}_history_item are new in 2.4.
1960 pass # re{move,place}_history_item are new in 2.4.
1961 else:
1961 else:
1962 self.input_hist_raw.append('%s\n' % line)
1962 self.input_hist_raw.append('%s\n' % line)
1963
1963
1964 try:
1964 try:
1965 lineout = self.prefilter(line,continue_prompt)
1965 lineout = self.prefilter(line,continue_prompt)
1966 except:
1966 except:
1967 # blanket except, in case a user-defined prefilter crashes, so it
1967 # blanket except, in case a user-defined prefilter crashes, so it
1968 # can't take all of ipython with it.
1968 # can't take all of ipython with it.
1969 self.showtraceback()
1969 self.showtraceback()
1970 return ''
1970 return ''
1971 else:
1971 else:
1972 return lineout
1972 return lineout
1973
1973
1974 def split_user_input(self,line):
1974 def split_user_input(self,line):
1975 """Split user input into pre-char, function part and rest."""
1975 """Split user input into pre-char, function part and rest."""
1976
1976
1977 lsplit = self.line_split.match(line)
1977 lsplit = self.line_split.match(line)
1978 if lsplit is None: # no regexp match returns None
1978 if lsplit is None: # no regexp match returns None
1979 try:
1979 try:
1980 iFun,theRest = line.split(None,1)
1980 iFun,theRest = line.split(None,1)
1981 except ValueError:
1981 except ValueError:
1982 iFun,theRest = line,''
1982 iFun,theRest = line,''
1983 pre = re.match('^(\s*)(.*)',line).groups()[0]
1983 pre = re.match('^(\s*)(.*)',line).groups()[0]
1984 else:
1984 else:
1985 pre,iFun,theRest = lsplit.groups()
1985 pre,iFun,theRest = lsplit.groups()
1986
1986
1987 #print 'line:<%s>' % line # dbg
1987 #print 'line:<%s>' % line # dbg
1988 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1988 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1989 return pre,iFun.strip(),theRest
1989 return pre,iFun.strip(),theRest
1990
1990
1991 def _prefilter(self, line, continue_prompt):
1991 def _prefilter(self, line, continue_prompt):
1992 """Calls different preprocessors, depending on the form of line."""
1992 """Calls different preprocessors, depending on the form of line."""
1993
1993
1994 # All handlers *must* return a value, even if it's blank ('').
1994 # All handlers *must* return a value, even if it's blank ('').
1995
1995
1996 # Lines are NOT logged here. Handlers should process the line as
1996 # Lines are NOT logged here. Handlers should process the line as
1997 # needed, update the cache AND log it (so that the input cache array
1997 # needed, update the cache AND log it (so that the input cache array
1998 # stays synced).
1998 # stays synced).
1999
1999
2000 # This function is _very_ delicate, and since it's also the one which
2000 # This function is _very_ delicate, and since it's also the one which
2001 # determines IPython's response to user input, it must be as efficient
2001 # determines IPython's response to user input, it must be as efficient
2002 # as possible. For this reason it has _many_ returns in it, trying
2002 # as possible. For this reason it has _many_ returns in it, trying
2003 # always to exit as quickly as it can figure out what it needs to do.
2003 # always to exit as quickly as it can figure out what it needs to do.
2004
2004
2005 # This function is the main responsible for maintaining IPython's
2005 # This function is the main responsible for maintaining IPython's
2006 # behavior respectful of Python's semantics. So be _very_ careful if
2006 # behavior respectful of Python's semantics. So be _very_ careful if
2007 # making changes to anything here.
2007 # making changes to anything here.
2008
2008
2009 #.....................................................................
2009 #.....................................................................
2010 # Code begins
2010 # Code begins
2011
2011
2012 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2012 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2013
2013
2014 # save the line away in case we crash, so the post-mortem handler can
2014 # save the line away in case we crash, so the post-mortem handler can
2015 # record it
2015 # record it
2016 self._last_input_line = line
2016 self._last_input_line = line
2017
2017
2018 #print '***line: <%s>' % line # dbg
2018 #print '***line: <%s>' % line # dbg
2019
2019
2020 # the input history needs to track even empty lines
2020 # the input history needs to track even empty lines
2021 stripped = line.strip()
2021 stripped = line.strip()
2022
2022
2023 if not stripped:
2023 if not stripped:
2024 if not continue_prompt:
2024 if not continue_prompt:
2025 self.outputcache.prompt_count -= 1
2025 self.outputcache.prompt_count -= 1
2026 return self.handle_normal(line,continue_prompt)
2026 return self.handle_normal(line,continue_prompt)
2027 #return self.handle_normal('',continue_prompt)
2027 #return self.handle_normal('',continue_prompt)
2028
2028
2029 # print '***cont',continue_prompt # dbg
2029 # print '***cont',continue_prompt # dbg
2030 # special handlers are only allowed for single line statements
2030 # special handlers are only allowed for single line statements
2031 if continue_prompt and not self.rc.multi_line_specials:
2031 if continue_prompt and not self.rc.multi_line_specials:
2032 return self.handle_normal(line,continue_prompt)
2032 return self.handle_normal(line,continue_prompt)
2033
2033
2034
2034
2035 # For the rest, we need the structure of the input
2035 # For the rest, we need the structure of the input
2036 pre,iFun,theRest = self.split_user_input(line)
2036 pre,iFun,theRest = self.split_user_input(line)
2037
2037
2038 # See whether any pre-existing handler can take care of it
2038 # See whether any pre-existing handler can take care of it
2039
2039
2040 rewritten = self.hooks.input_prefilter(stripped)
2040 rewritten = self.hooks.input_prefilter(stripped)
2041 if rewritten != stripped: # ok, some prefilter did something
2041 if rewritten != stripped: # ok, some prefilter did something
2042 rewritten = pre + rewritten # add indentation
2042 rewritten = pre + rewritten # add indentation
2043 return self.handle_normal(rewritten)
2043 return self.handle_normal(rewritten)
2044
2044
2045 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2045 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2046
2046
2047 # First check for explicit escapes in the last/first character
2047 # First check for explicit escapes in the last/first character
2048 handler = None
2048 handler = None
2049 if line[-1] == self.ESC_HELP:
2049 if line[-1] == self.ESC_HELP:
2050 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2050 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2051 if handler is None:
2051 if handler is None:
2052 # look at the first character of iFun, NOT of line, so we skip
2052 # look at the first character of iFun, NOT of line, so we skip
2053 # leading whitespace in multiline input
2053 # leading whitespace in multiline input
2054 handler = self.esc_handlers.get(iFun[0:1])
2054 handler = self.esc_handlers.get(iFun[0:1])
2055 if handler is not None:
2055 if handler is not None:
2056 return handler(line,continue_prompt,pre,iFun,theRest)
2056 return handler(line,continue_prompt,pre,iFun,theRest)
2057 # Emacs ipython-mode tags certain input lines
2057 # Emacs ipython-mode tags certain input lines
2058 if line.endswith('# PYTHON-MODE'):
2058 if line.endswith('# PYTHON-MODE'):
2059 return self.handle_emacs(line,continue_prompt)
2059 return self.handle_emacs(line,continue_prompt)
2060
2060
2061 # Next, check if we can automatically execute this thing
2061 # Next, check if we can automatically execute this thing
2062
2062
2063 # Allow ! in multi-line statements if multi_line_specials is on:
2063 # Allow ! in multi-line statements if multi_line_specials is on:
2064 if continue_prompt and self.rc.multi_line_specials and \
2064 if continue_prompt and self.rc.multi_line_specials and \
2065 iFun.startswith(self.ESC_SHELL):
2065 iFun.startswith(self.ESC_SHELL):
2066 return self.handle_shell_escape(line,continue_prompt,
2066 return self.handle_shell_escape(line,continue_prompt,
2067 pre=pre,iFun=iFun,
2067 pre=pre,iFun=iFun,
2068 theRest=theRest)
2068 theRest=theRest)
2069
2069
2070 # Let's try to find if the input line is a magic fn
2070 # Let's try to find if the input line is a magic fn
2071 oinfo = None
2071 oinfo = None
2072 if hasattr(self,'magic_'+iFun):
2072 if hasattr(self,'magic_'+iFun):
2073 # WARNING: _ofind uses getattr(), so it can consume generators and
2073 # WARNING: _ofind uses getattr(), so it can consume generators and
2074 # cause other side effects.
2074 # cause other side effects.
2075 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2075 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2076 if oinfo['ismagic']:
2076 if oinfo['ismagic']:
2077 # Be careful not to call magics when a variable assignment is
2077 # Be careful not to call magics when a variable assignment is
2078 # being made (ls='hi', for example)
2078 # being made (ls='hi', for example)
2079 if self.rc.automagic and \
2079 if self.rc.automagic and \
2080 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2080 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2081 (self.rc.multi_line_specials or not continue_prompt):
2081 (self.rc.multi_line_specials or not continue_prompt):
2082 return self.handle_magic(line,continue_prompt,
2082 return self.handle_magic(line,continue_prompt,
2083 pre,iFun,theRest)
2083 pre,iFun,theRest)
2084 else:
2084 else:
2085 return self.handle_normal(line,continue_prompt)
2085 return self.handle_normal(line,continue_prompt)
2086
2086
2087 # If the rest of the line begins with an (in)equality, assginment or
2087 # If the rest of the line begins with an (in)equality, assginment or
2088 # function call, we should not call _ofind but simply execute it.
2088 # function call, we should not call _ofind but simply execute it.
2089 # This avoids spurious geattr() accesses on objects upon assignment.
2089 # This avoids spurious geattr() accesses on objects upon assignment.
2090 #
2090 #
2091 # It also allows users to assign to either alias or magic names true
2091 # It also allows users to assign to either alias or magic names true
2092 # python variables (the magic/alias systems always take second seat to
2092 # python variables (the magic/alias systems always take second seat to
2093 # true python code).
2093 # true python code).
2094 if theRest and theRest[0] in '!=()':
2094 if theRest and theRest[0] in '!=()':
2095 return self.handle_normal(line,continue_prompt)
2095 return self.handle_normal(line,continue_prompt)
2096
2096
2097 if oinfo is None:
2097 if oinfo is None:
2098 # let's try to ensure that _oinfo is ONLY called when autocall is
2098 # let's try to ensure that _oinfo is ONLY called when autocall is
2099 # on. Since it has inevitable potential side effects, at least
2099 # on. Since it has inevitable potential side effects, at least
2100 # having autocall off should be a guarantee to the user that no
2100 # having autocall off should be a guarantee to the user that no
2101 # weird things will happen.
2101 # weird things will happen.
2102
2102
2103 if self.rc.autocall:
2103 if self.rc.autocall:
2104 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2104 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2105 else:
2105 else:
2106 # in this case, all that's left is either an alias or
2106 # in this case, all that's left is either an alias or
2107 # processing the line normally.
2107 # processing the line normally.
2108 if iFun in self.alias_table:
2108 if iFun in self.alias_table:
2109 # if autocall is off, by not running _ofind we won't know
2109 # if autocall is off, by not running _ofind we won't know
2110 # whether the given name may also exist in one of the
2110 # whether the given name may also exist in one of the
2111 # user's namespace. At this point, it's best to do a
2111 # user's namespace. At this point, it's best to do a
2112 # quick check just to be sure that we don't let aliases
2112 # quick check just to be sure that we don't let aliases
2113 # shadow variables.
2113 # shadow variables.
2114 head = iFun.split('.',1)[0]
2114 head = iFun.split('.',1)[0]
2115 if head in self.user_ns or head in self.internal_ns \
2115 if head in self.user_ns or head in self.internal_ns \
2116 or head in __builtin__.__dict__:
2116 or head in __builtin__.__dict__:
2117 return self.handle_normal(line,continue_prompt)
2117 return self.handle_normal(line,continue_prompt)
2118 else:
2118 else:
2119 return self.handle_alias(line,continue_prompt,
2119 return self.handle_alias(line,continue_prompt,
2120 pre,iFun,theRest)
2120 pre,iFun,theRest)
2121
2121
2122 else:
2122 else:
2123 return self.handle_normal(line,continue_prompt)
2123 return self.handle_normal(line,continue_prompt)
2124
2124
2125 if not oinfo['found']:
2125 if not oinfo['found']:
2126 return self.handle_normal(line,continue_prompt)
2126 return self.handle_normal(line,continue_prompt)
2127 else:
2127 else:
2128 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2128 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2129 if oinfo['isalias']:
2129 if oinfo['isalias']:
2130 return self.handle_alias(line,continue_prompt,
2130 return self.handle_alias(line,continue_prompt,
2131 pre,iFun,theRest)
2131 pre,iFun,theRest)
2132
2132
2133 if (self.rc.autocall
2133 if (self.rc.autocall
2134 and
2134 and
2135 (
2135 (
2136 #only consider exclusion re if not "," or ";" autoquoting
2136 #only consider exclusion re if not "," or ";" autoquoting
2137 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2137 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2138 or pre == self.ESC_PAREN) or
2138 or pre == self.ESC_PAREN) or
2139 (not self.re_exclude_auto.match(theRest)))
2139 (not self.re_exclude_auto.match(theRest)))
2140 and
2140 and
2141 self.re_fun_name.match(iFun) and
2141 self.re_fun_name.match(iFun) and
2142 callable(oinfo['obj'])) :
2142 callable(oinfo['obj'])) :
2143 #print 'going auto' # dbg
2143 #print 'going auto' # dbg
2144 return self.handle_auto(line,continue_prompt,
2144 return self.handle_auto(line,continue_prompt,
2145 pre,iFun,theRest,oinfo['obj'])
2145 pre,iFun,theRest,oinfo['obj'])
2146 else:
2146 else:
2147 #print 'was callable?', callable(oinfo['obj']) # dbg
2147 #print 'was callable?', callable(oinfo['obj']) # dbg
2148 return self.handle_normal(line,continue_prompt)
2148 return self.handle_normal(line,continue_prompt)
2149
2149
2150 # If we get here, we have a normal Python line. Log and return.
2150 # If we get here, we have a normal Python line. Log and return.
2151 return self.handle_normal(line,continue_prompt)
2151 return self.handle_normal(line,continue_prompt)
2152
2152
2153 def _prefilter_dumb(self, line, continue_prompt):
2153 def _prefilter_dumb(self, line, continue_prompt):
2154 """simple prefilter function, for debugging"""
2154 """simple prefilter function, for debugging"""
2155 return self.handle_normal(line,continue_prompt)
2155 return self.handle_normal(line,continue_prompt)
2156
2156
2157
2157
2158 def multiline_prefilter(self, line, continue_prompt):
2158 def multiline_prefilter(self, line, continue_prompt):
2159 """ Run _prefilter for each line of input
2159 """ Run _prefilter for each line of input
2160
2160
2161 Covers cases where there are multiple lines in the user entry,
2161 Covers cases where there are multiple lines in the user entry,
2162 which is the case when the user goes back to a multiline history
2162 which is the case when the user goes back to a multiline history
2163 entry and presses enter.
2163 entry and presses enter.
2164
2164
2165 """
2165 """
2166 out = []
2166 out = []
2167 for l in line.rstrip('\n').split('\n'):
2167 for l in line.rstrip('\n').split('\n'):
2168 out.append(self._prefilter(l, continue_prompt))
2168 out.append(self._prefilter(l, continue_prompt))
2169 return '\n'.join(out)
2169 return '\n'.join(out)
2170
2170
2171 # Set the default prefilter() function (this can be user-overridden)
2171 # Set the default prefilter() function (this can be user-overridden)
2172 prefilter = multiline_prefilter
2172 prefilter = multiline_prefilter
2173
2173
2174 def handle_normal(self,line,continue_prompt=None,
2174 def handle_normal(self,line,continue_prompt=None,
2175 pre=None,iFun=None,theRest=None):
2175 pre=None,iFun=None,theRest=None):
2176 """Handle normal input lines. Use as a template for handlers."""
2176 """Handle normal input lines. Use as a template for handlers."""
2177
2177
2178 # With autoindent on, we need some way to exit the input loop, and I
2178 # With autoindent on, we need some way to exit the input loop, and I
2179 # don't want to force the user to have to backspace all the way to
2179 # don't want to force the user to have to backspace all the way to
2180 # clear the line. The rule will be in this case, that either two
2180 # clear the line. The rule will be in this case, that either two
2181 # lines of pure whitespace in a row, or a line of pure whitespace but
2181 # lines of pure whitespace in a row, or a line of pure whitespace but
2182 # of a size different to the indent level, will exit the input loop.
2182 # of a size different to the indent level, will exit the input loop.
2183
2183
2184 if (continue_prompt and self.autoindent and line.isspace() and
2184 if (continue_prompt and self.autoindent and line.isspace() and
2185 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2185 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2186 (self.buffer[-1]).isspace() )):
2186 (self.buffer[-1]).isspace() )):
2187 line = ''
2187 line = ''
2188
2188
2189 self.log(line,line,continue_prompt)
2189 self.log(line,line,continue_prompt)
2190 return line
2190 return line
2191
2191
2192 def handle_alias(self,line,continue_prompt=None,
2192 def handle_alias(self,line,continue_prompt=None,
2193 pre=None,iFun=None,theRest=None):
2193 pre=None,iFun=None,theRest=None):
2194 """Handle alias input lines. """
2194 """Handle alias input lines. """
2195
2195
2196 # pre is needed, because it carries the leading whitespace. Otherwise
2196 # pre is needed, because it carries the leading whitespace. Otherwise
2197 # aliases won't work in indented sections.
2197 # aliases won't work in indented sections.
2198 transformed = self.expand_aliases(iFun, theRest)
2198 transformed = self.expand_aliases(iFun, theRest)
2199 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2199 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2200 self.log(line,line_out,continue_prompt)
2200 self.log(line,line_out,continue_prompt)
2201 #print 'line out:',line_out # dbg
2201 #print 'line out:',line_out # dbg
2202 return line_out
2202 return line_out
2203
2203
2204 def handle_shell_escape(self, line, continue_prompt=None,
2204 def handle_shell_escape(self, line, continue_prompt=None,
2205 pre=None,iFun=None,theRest=None):
2205 pre=None,iFun=None,theRest=None):
2206 """Execute the line in a shell, empty return value"""
2206 """Execute the line in a shell, empty return value"""
2207
2207
2208 #print 'line in :', `line` # dbg
2208 #print 'line in :', `line` # dbg
2209 # Example of a special handler. Others follow a similar pattern.
2209 # Example of a special handler. Others follow a similar pattern.
2210 if line.lstrip().startswith('!!'):
2210 if line.lstrip().startswith('!!'):
2211 # rewrite iFun/theRest to properly hold the call to %sx and
2211 # rewrite iFun/theRest to properly hold the call to %sx and
2212 # the actual command to be executed, so handle_magic can work
2212 # the actual command to be executed, so handle_magic can work
2213 # correctly
2213 # correctly
2214 theRest = '%s %s' % (iFun[2:],theRest)
2214 theRest = '%s %s' % (iFun[2:],theRest)
2215 iFun = 'sx'
2215 iFun = 'sx'
2216 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2216 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2217 line.lstrip()[2:]),
2217 line.lstrip()[2:]),
2218 continue_prompt,pre,iFun,theRest)
2218 continue_prompt,pre,iFun,theRest)
2219 else:
2219 else:
2220 cmd=line.lstrip().lstrip('!')
2220 cmd=line.lstrip().lstrip('!')
2221 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2221 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2222 # update cache/log and return
2222 # update cache/log and return
2223 self.log(line,line_out,continue_prompt)
2223 self.log(line,line_out,continue_prompt)
2224 return line_out
2224 return line_out
2225
2225
2226 def handle_magic(self, line, continue_prompt=None,
2226 def handle_magic(self, line, continue_prompt=None,
2227 pre=None,iFun=None,theRest=None):
2227 pre=None,iFun=None,theRest=None):
2228 """Execute magic functions."""
2228 """Execute magic functions."""
2229
2229
2230
2230
2231 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2231 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2232 self.log(line,cmd,continue_prompt)
2232 self.log(line,cmd,continue_prompt)
2233 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2233 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2234 return cmd
2234 return cmd
2235
2235
2236 def handle_auto(self, line, continue_prompt=None,
2236 def handle_auto(self, line, continue_prompt=None,
2237 pre=None,iFun=None,theRest=None,obj=None):
2237 pre=None,iFun=None,theRest=None,obj=None):
2238 """Hande lines which can be auto-executed, quoting if requested."""
2238 """Hande lines which can be auto-executed, quoting if requested."""
2239
2239
2240 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2240 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2241
2241
2242 # This should only be active for single-line input!
2242 # This should only be active for single-line input!
2243 if continue_prompt:
2243 if continue_prompt:
2244 self.log(line,line,continue_prompt)
2244 self.log(line,line,continue_prompt)
2245 return line
2245 return line
2246
2246
2247 auto_rewrite = True
2247 auto_rewrite = True
2248
2248
2249 if pre == self.ESC_QUOTE:
2249 if pre == self.ESC_QUOTE:
2250 # Auto-quote splitting on whitespace
2250 # Auto-quote splitting on whitespace
2251 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2251 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2252 elif pre == self.ESC_QUOTE2:
2252 elif pre == self.ESC_QUOTE2:
2253 # Auto-quote whole string
2253 # Auto-quote whole string
2254 newcmd = '%s("%s")' % (iFun,theRest)
2254 newcmd = '%s("%s")' % (iFun,theRest)
2255 elif pre == self.ESC_PAREN:
2255 elif pre == self.ESC_PAREN:
2256 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2256 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2257 else:
2257 else:
2258 # Auto-paren.
2258 # Auto-paren.
2259 # We only apply it to argument-less calls if the autocall
2259 # We only apply it to argument-less calls if the autocall
2260 # parameter is set to 2. We only need to check that autocall is <
2260 # parameter is set to 2. We only need to check that autocall is <
2261 # 2, since this function isn't called unless it's at least 1.
2261 # 2, since this function isn't called unless it's at least 1.
2262 if not theRest and (self.rc.autocall < 2):
2262 if not theRest and (self.rc.autocall < 2):
2263 newcmd = '%s %s' % (iFun,theRest)
2263 newcmd = '%s %s' % (iFun,theRest)
2264 auto_rewrite = False
2264 auto_rewrite = False
2265 else:
2265 else:
2266 if theRest.startswith('['):
2266 if theRest.startswith('['):
2267 if hasattr(obj,'__getitem__'):
2267 if hasattr(obj,'__getitem__'):
2268 # Don't autocall in this case: item access for an object
2268 # Don't autocall in this case: item access for an object
2269 # which is BOTH callable and implements __getitem__.
2269 # which is BOTH callable and implements __getitem__.
2270 newcmd = '%s %s' % (iFun,theRest)
2270 newcmd = '%s %s' % (iFun,theRest)
2271 auto_rewrite = False
2271 auto_rewrite = False
2272 else:
2272 else:
2273 # if the object doesn't support [] access, go ahead and
2273 # if the object doesn't support [] access, go ahead and
2274 # autocall
2274 # autocall
2275 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2275 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2276 elif theRest.endswith(';'):
2276 elif theRest.endswith(';'):
2277 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2277 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2278 else:
2278 else:
2279 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2279 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2280
2280
2281 if auto_rewrite:
2281 if auto_rewrite:
2282 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2282 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2283 # log what is now valid Python, not the actual user input (without the
2283 # log what is now valid Python, not the actual user input (without the
2284 # final newline)
2284 # final newline)
2285 self.log(line,newcmd,continue_prompt)
2285 self.log(line,newcmd,continue_prompt)
2286 return newcmd
2286 return newcmd
2287
2287
2288 def handle_help(self, line, continue_prompt=None,
2288 def handle_help(self, line, continue_prompt=None,
2289 pre=None,iFun=None,theRest=None):
2289 pre=None,iFun=None,theRest=None):
2290 """Try to get some help for the object.
2290 """Try to get some help for the object.
2291
2291
2292 obj? or ?obj -> basic information.
2292 obj? or ?obj -> basic information.
2293 obj?? or ??obj -> more details.
2293 obj?? or ??obj -> more details.
2294 """
2294 """
2295
2295
2296 # We need to make sure that we don't process lines which would be
2296 # We need to make sure that we don't process lines which would be
2297 # otherwise valid python, such as "x=1 # what?"
2297 # otherwise valid python, such as "x=1 # what?"
2298 try:
2298 try:
2299 codeop.compile_command(line)
2299 codeop.compile_command(line)
2300 except SyntaxError:
2300 except SyntaxError:
2301 # We should only handle as help stuff which is NOT valid syntax
2301 # We should only handle as help stuff which is NOT valid syntax
2302 if line[0]==self.ESC_HELP:
2302 if line[0]==self.ESC_HELP:
2303 line = line[1:]
2303 line = line[1:]
2304 elif line[-1]==self.ESC_HELP:
2304 elif line[-1]==self.ESC_HELP:
2305 line = line[:-1]
2305 line = line[:-1]
2306 self.log(line,'#?'+line,continue_prompt)
2306 self.log(line,'#?'+line,continue_prompt)
2307 if line:
2307 if line:
2308 self.magic_pinfo(line)
2308 self.magic_pinfo(line)
2309 else:
2309 else:
2310 page(self.usage,screen_lines=self.rc.screen_length)
2310 page(self.usage,screen_lines=self.rc.screen_length)
2311 return '' # Empty string is needed here!
2311 return '' # Empty string is needed here!
2312 except:
2312 except:
2313 # Pass any other exceptions through to the normal handler
2313 # Pass any other exceptions through to the normal handler
2314 return self.handle_normal(line,continue_prompt)
2314 return self.handle_normal(line,continue_prompt)
2315 else:
2315 else:
2316 # If the code compiles ok, we should handle it normally
2316 # If the code compiles ok, we should handle it normally
2317 return self.handle_normal(line,continue_prompt)
2317 return self.handle_normal(line,continue_prompt)
2318
2318
2319 def getapi(self):
2319 def getapi(self):
2320 """ Get an IPApi object for this shell instance
2320 """ Get an IPApi object for this shell instance
2321
2321
2322 Getting an IPApi object is always preferable to accessing the shell
2322 Getting an IPApi object is always preferable to accessing the shell
2323 directly, but this holds true especially for extensions.
2323 directly, but this holds true especially for extensions.
2324
2324
2325 It should always be possible to implement an extension with IPApi
2325 It should always be possible to implement an extension with IPApi
2326 alone. If not, contact maintainer to request an addition.
2326 alone. If not, contact maintainer to request an addition.
2327
2327
2328 """
2328 """
2329 return self.api
2329 return self.api
2330
2330
2331 def handle_emacs(self,line,continue_prompt=None,
2331 def handle_emacs(self,line,continue_prompt=None,
2332 pre=None,iFun=None,theRest=None):
2332 pre=None,iFun=None,theRest=None):
2333 """Handle input lines marked by python-mode."""
2333 """Handle input lines marked by python-mode."""
2334
2334
2335 # Currently, nothing is done. Later more functionality can be added
2335 # Currently, nothing is done. Later more functionality can be added
2336 # here if needed.
2336 # here if needed.
2337
2337
2338 # The input cache shouldn't be updated
2338 # The input cache shouldn't be updated
2339
2339
2340 return line
2340 return line
2341
2341
2342 def mktempfile(self,data=None):
2342 def mktempfile(self,data=None):
2343 """Make a new tempfile and return its filename.
2343 """Make a new tempfile and return its filename.
2344
2344
2345 This makes a call to tempfile.mktemp, but it registers the created
2345 This makes a call to tempfile.mktemp, but it registers the created
2346 filename internally so ipython cleans it up at exit time.
2346 filename internally so ipython cleans it up at exit time.
2347
2347
2348 Optional inputs:
2348 Optional inputs:
2349
2349
2350 - data(None): if data is given, it gets written out to the temp file
2350 - data(None): if data is given, it gets written out to the temp file
2351 immediately, and the file is closed again."""
2351 immediately, and the file is closed again."""
2352
2352
2353 filename = tempfile.mktemp('.py','ipython_edit_')
2353 filename = tempfile.mktemp('.py','ipython_edit_')
2354 self.tempfiles.append(filename)
2354 self.tempfiles.append(filename)
2355
2355
2356 if data:
2356 if data:
2357 tmp_file = open(filename,'w')
2357 tmp_file = open(filename,'w')
2358 tmp_file.write(data)
2358 tmp_file.write(data)
2359 tmp_file.close()
2359 tmp_file.close()
2360 return filename
2360 return filename
2361
2361
2362 def write(self,data):
2362 def write(self,data):
2363 """Write a string to the default output"""
2363 """Write a string to the default output"""
2364 Term.cout.write(data)
2364 Term.cout.write(data)
2365
2365
2366 def write_err(self,data):
2366 def write_err(self,data):
2367 """Write a string to the default error output"""
2367 """Write a string to the default error output"""
2368 Term.cerr.write(data)
2368 Term.cerr.write(data)
2369
2369
2370 def exit(self):
2370 def exit(self):
2371 """Handle interactive exit.
2371 """Handle interactive exit.
2372
2372
2373 This method sets the exit_now attribute."""
2373 This method sets the exit_now attribute."""
2374
2374
2375 if self.rc.confirm_exit:
2375 if self.rc.confirm_exit:
2376 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2376 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2377 self.exit_now = True
2377 self.exit_now = True
2378 else:
2378 else:
2379 self.exit_now = True
2379 self.exit_now = True
2380
2380
2381 def safe_execfile(self,fname,*where,**kw):
2381 def safe_execfile(self,fname,*where,**kw):
2382 fname = os.path.expanduser(fname)
2382 fname = os.path.expanduser(fname)
2383
2383
2384 # find things also in current directory
2385 dname = os.path.dirname(fname)
2386 if not sys.path.count(dname):
2387 sys.path.append(dname)
2388
2389 try:
2384 try:
2390 xfile = open(fname)
2385 xfile = open(fname)
2391 except:
2386 except:
2392 print >> Term.cerr, \
2387 print >> Term.cerr, \
2393 'Could not open file <%s> for safe execution.' % fname
2388 'Could not open file <%s> for safe execution.' % fname
2394 return None
2389 return None
2395
2390
2396 kw.setdefault('islog',0)
2391 kw.setdefault('islog',0)
2397 kw.setdefault('quiet',1)
2392 kw.setdefault('quiet',1)
2398 kw.setdefault('exit_ignore',0)
2393 kw.setdefault('exit_ignore',0)
2399 first = xfile.readline()
2394 first = xfile.readline()
2400 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2395 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2401 xfile.close()
2396 xfile.close()
2402 # line by line execution
2397 # line by line execution
2403 if first.startswith(loghead) or kw['islog']:
2398 if first.startswith(loghead) or kw['islog']:
2404 print 'Loading log file <%s> one line at a time...' % fname
2399 print 'Loading log file <%s> one line at a time...' % fname
2405 if kw['quiet']:
2400 if kw['quiet']:
2406 stdout_save = sys.stdout
2401 stdout_save = sys.stdout
2407 sys.stdout = StringIO.StringIO()
2402 sys.stdout = StringIO.StringIO()
2408 try:
2403 try:
2409 globs,locs = where[0:2]
2404 globs,locs = where[0:2]
2410 except:
2405 except:
2411 try:
2406 try:
2412 globs = locs = where[0]
2407 globs = locs = where[0]
2413 except:
2408 except:
2414 globs = locs = globals()
2409 globs = locs = globals()
2415 badblocks = []
2410 badblocks = []
2416
2411
2417 # we also need to identify indented blocks of code when replaying
2412 # we also need to identify indented blocks of code when replaying
2418 # logs and put them together before passing them to an exec
2413 # logs and put them together before passing them to an exec
2419 # statement. This takes a bit of regexp and look-ahead work in the
2414 # statement. This takes a bit of regexp and look-ahead work in the
2420 # file. It's easiest if we swallow the whole thing in memory
2415 # file. It's easiest if we swallow the whole thing in memory
2421 # first, and manually walk through the lines list moving the
2416 # first, and manually walk through the lines list moving the
2422 # counter ourselves.
2417 # counter ourselves.
2423 indent_re = re.compile('\s+\S')
2418 indent_re = re.compile('\s+\S')
2424 xfile = open(fname)
2419 xfile = open(fname)
2425 filelines = xfile.readlines()
2420 filelines = xfile.readlines()
2426 xfile.close()
2421 xfile.close()
2427 nlines = len(filelines)
2422 nlines = len(filelines)
2428 lnum = 0
2423 lnum = 0
2429 while lnum < nlines:
2424 while lnum < nlines:
2430 line = filelines[lnum]
2425 line = filelines[lnum]
2431 lnum += 1
2426 lnum += 1
2432 # don't re-insert logger status info into cache
2427 # don't re-insert logger status info into cache
2433 if line.startswith('#log#'):
2428 if line.startswith('#log#'):
2434 continue
2429 continue
2435 else:
2430 else:
2436 # build a block of code (maybe a single line) for execution
2431 # build a block of code (maybe a single line) for execution
2437 block = line
2432 block = line
2438 try:
2433 try:
2439 next = filelines[lnum] # lnum has already incremented
2434 next = filelines[lnum] # lnum has already incremented
2440 except:
2435 except:
2441 next = None
2436 next = None
2442 while next and indent_re.match(next):
2437 while next and indent_re.match(next):
2443 block += next
2438 block += next
2444 lnum += 1
2439 lnum += 1
2445 try:
2440 try:
2446 next = filelines[lnum]
2441 next = filelines[lnum]
2447 except:
2442 except:
2448 next = None
2443 next = None
2449 # now execute the block of one or more lines
2444 # now execute the block of one or more lines
2450 try:
2445 try:
2451 exec block in globs,locs
2446 exec block in globs,locs
2452 except SystemExit:
2447 except SystemExit:
2453 pass
2448 pass
2454 except:
2449 except:
2455 badblocks.append(block.rstrip())
2450 badblocks.append(block.rstrip())
2456 if kw['quiet']: # restore stdout
2451 if kw['quiet']: # restore stdout
2457 sys.stdout.close()
2452 sys.stdout.close()
2458 sys.stdout = stdout_save
2453 sys.stdout = stdout_save
2459 print 'Finished replaying log file <%s>' % fname
2454 print 'Finished replaying log file <%s>' % fname
2460 if badblocks:
2455 if badblocks:
2461 print >> sys.stderr, ('\nThe following lines/blocks in file '
2456 print >> sys.stderr, ('\nThe following lines/blocks in file '
2462 '<%s> reported errors:' % fname)
2457 '<%s> reported errors:' % fname)
2463
2458
2464 for badline in badblocks:
2459 for badline in badblocks:
2465 print >> sys.stderr, badline
2460 print >> sys.stderr, badline
2466 else: # regular file execution
2461 else: # regular file execution
2467 try:
2462 try:
2468 execfile(fname,*where)
2463 execfile(fname,*where)
2469 except SyntaxError:
2464 except SyntaxError:
2470 self.showsyntaxerror()
2465 self.showsyntaxerror()
2471 warn('Failure executing file: <%s>' % fname)
2466 warn('Failure executing file: <%s>' % fname)
2472 except SystemExit,status:
2467 except SystemExit,status:
2473 if not kw['exit_ignore']:
2468 if not kw['exit_ignore']:
2474 self.showtraceback()
2469 self.showtraceback()
2475 warn('Failure executing file: <%s>' % fname)
2470 warn('Failure executing file: <%s>' % fname)
2476 except:
2471 except:
2477 self.showtraceback()
2472 self.showtraceback()
2478 warn('Failure executing file: <%s>' % fname)
2473 warn('Failure executing file: <%s>' % fname)
2479
2474
2480 #************************* end of file <iplib.py> *****************************
2475 #************************* end of file <iplib.py> *****************************
@@ -1,5879 +1,5883 b''
1 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * scripts/ipython: remove the very first entry in sys.path which
4 Python auto-inserts for scripts, so that sys.path under IPython is
5 as similar as possible to that under plain Python.
6
3 * IPython/completer.py (IPCompleter.file_matches): Fix
7 * IPython/completer.py (IPCompleter.file_matches): Fix
4 tab-completion so that quotes are not closed unless the completion
8 tab-completion so that quotes are not closed unless the completion
5 is unambiguous. After a request by Stefan. Minor cleanups in
9 is unambiguous. After a request by Stefan. Minor cleanups in
6 ipy_stock_completers.
10 ipy_stock_completers.
7
11
8 2006-11-02 Ville Vainio <vivainio@gmail.com>
12 2006-11-02 Ville Vainio <vivainio@gmail.com>
9
13
10 * ipy_stock_completers.py: Add %run and %cd completers.
14 * ipy_stock_completers.py: Add %run and %cd completers.
11
15
12 * completer.py: Try running custom completer for both
16 * completer.py: Try running custom completer for both
13 "foo" and "%foo" if the command is just "foo". Ignore case
17 "foo" and "%foo" if the command is just "foo". Ignore case
14 when filtering possible completions.
18 when filtering possible completions.
15
19
16 * UserConfig/ipy_user_conf.py: install stock completers as default
20 * UserConfig/ipy_user_conf.py: install stock completers as default
17
21
18 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
22 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
19 simplified readline history save / restore through a wrapper
23 simplified readline history save / restore through a wrapper
20 function
24 function
21
25
22
26
23 2006-10-31 Ville Vainio <vivainio@gmail.com>
27 2006-10-31 Ville Vainio <vivainio@gmail.com>
24
28
25 * strdispatch.py, completer.py, ipy_stock_completers.py:
29 * strdispatch.py, completer.py, ipy_stock_completers.py:
26 Allow str_key ("command") in completer hooks. Implement
30 Allow str_key ("command") in completer hooks. Implement
27 trivial completer for 'import' (stdlib modules only). Rename
31 trivial completer for 'import' (stdlib modules only). Rename
28 ipy_linux_package_managers.py to ipy_stock_completers.py.
32 ipy_linux_package_managers.py to ipy_stock_completers.py.
29 SVN completer.
33 SVN completer.
30
34
31 * Extensions/ledit.py: %magic line editor for easily and
35 * Extensions/ledit.py: %magic line editor for easily and
32 incrementally manipulating lists of strings. The magic command
36 incrementally manipulating lists of strings. The magic command
33 name is %led.
37 name is %led.
34
38
35 2006-10-30 Ville Vainio <vivainio@gmail.com>
39 2006-10-30 Ville Vainio <vivainio@gmail.com>
36
40
37 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
41 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
38 Bernsteins's patches for pydb integration.
42 Bernsteins's patches for pydb integration.
39 http://bashdb.sourceforge.net/pydb/
43 http://bashdb.sourceforge.net/pydb/
40
44
41 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
45 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
42 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
46 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
43 custom completer hook to allow the users to implement their own
47 custom completer hook to allow the users to implement their own
44 completers. See ipy_linux_package_managers.py for example. The
48 completers. See ipy_linux_package_managers.py for example. The
45 hook name is 'complete_command'.
49 hook name is 'complete_command'.
46
50
47 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
51 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
48
52
49 * IPython/UserConfig/ipythonrc-scipy: minor clenaups to remove old
53 * IPython/UserConfig/ipythonrc-scipy: minor clenaups to remove old
50 Numeric leftovers.
54 Numeric leftovers.
51
55
52 * ipython.el (py-execute-region): apply Stefan's patch to fix
56 * ipython.el (py-execute-region): apply Stefan's patch to fix
53 garbled results if the python shell hasn't been previously started.
57 garbled results if the python shell hasn't been previously started.
54
58
55 * IPython/genutils.py (arg_split): moved to genutils, since it's a
59 * IPython/genutils.py (arg_split): moved to genutils, since it's a
56 pretty generic function and useful for other things.
60 pretty generic function and useful for other things.
57
61
58 * IPython/OInspect.py (getsource): Add customizable source
62 * IPython/OInspect.py (getsource): Add customizable source
59 extractor. After a request/patch form W. Stein (SAGE).
63 extractor. After a request/patch form W. Stein (SAGE).
60
64
61 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
65 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
62 window size to a more reasonable value from what pexpect does,
66 window size to a more reasonable value from what pexpect does,
63 since their choice causes wrapping bugs with long input lines.
67 since their choice causes wrapping bugs with long input lines.
64
68
65 2006-10-28 Ville Vainio <vivainio@gmail.com>
69 2006-10-28 Ville Vainio <vivainio@gmail.com>
66
70
67 * Magic.py (%run): Save and restore the readline history from
71 * Magic.py (%run): Save and restore the readline history from
68 file around %run commands to prevent side effects from
72 file around %run commands to prevent side effects from
69 %runned programs that might use readline (e.g. pydb).
73 %runned programs that might use readline (e.g. pydb).
70
74
71 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
75 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
72 invoking the pydb enhanced debugger.
76 invoking the pydb enhanced debugger.
73
77
74 2006-10-23 Walter Doerwald <walter@livinglogic.de>
78 2006-10-23 Walter Doerwald <walter@livinglogic.de>
75
79
76 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
80 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
77 call the base class method and propagate the return value to
81 call the base class method and propagate the return value to
78 ifile. This is now done by path itself.
82 ifile. This is now done by path itself.
79
83
80 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
84 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
81
85
82 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
86 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
83 api: set_crash_handler(), to expose the ability to change the
87 api: set_crash_handler(), to expose the ability to change the
84 internal crash handler.
88 internal crash handler.
85
89
86 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
90 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
87 the various parameters of the crash handler so that apps using
91 the various parameters of the crash handler so that apps using
88 IPython as their engine can customize crash handling. Ipmlemented
92 IPython as their engine can customize crash handling. Ipmlemented
89 at the request of SAGE.
93 at the request of SAGE.
90
94
91 2006-10-14 Ville Vainio <vivainio@gmail.com>
95 2006-10-14 Ville Vainio <vivainio@gmail.com>
92
96
93 * Magic.py, ipython.el: applied first "safe" part of Rocky
97 * Magic.py, ipython.el: applied first "safe" part of Rocky
94 Bernstein's patch set for pydb integration.
98 Bernstein's patch set for pydb integration.
95
99
96 * Magic.py (%unalias, %alias): %store'd aliases can now be
100 * Magic.py (%unalias, %alias): %store'd aliases can now be
97 removed with '%unalias'. %alias w/o args now shows most
101 removed with '%unalias'. %alias w/o args now shows most
98 interesting (stored / manually defined) aliases last
102 interesting (stored / manually defined) aliases last
99 where they catch the eye w/o scrolling.
103 where they catch the eye w/o scrolling.
100
104
101 * Magic.py (%rehashx), ext_rehashdir.py: files with
105 * Magic.py (%rehashx), ext_rehashdir.py: files with
102 'py' extension are always considered executable, even
106 'py' extension are always considered executable, even
103 when not in PATHEXT environment variable.
107 when not in PATHEXT environment variable.
104
108
105 2006-10-12 Ville Vainio <vivainio@gmail.com>
109 2006-10-12 Ville Vainio <vivainio@gmail.com>
106
110
107 * jobctrl.py: Add new "jobctrl" extension for spawning background
111 * jobctrl.py: Add new "jobctrl" extension for spawning background
108 processes with "&find /". 'import jobctrl' to try it out. Requires
112 processes with "&find /". 'import jobctrl' to try it out. Requires
109 'subprocess' module, standard in python 2.4+.
113 'subprocess' module, standard in python 2.4+.
110
114
111 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
115 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
112 so if foo -> bar and bar -> baz, then foo -> baz.
116 so if foo -> bar and bar -> baz, then foo -> baz.
113
117
114 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
118 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
115
119
116 * IPython/Magic.py (Magic.parse_options): add a new posix option
120 * IPython/Magic.py (Magic.parse_options): add a new posix option
117 to allow parsing of input args in magics that doesn't strip quotes
121 to allow parsing of input args in magics that doesn't strip quotes
118 (if posix=False). This also closes %timeit bug reported by
122 (if posix=False). This also closes %timeit bug reported by
119 Stefan.
123 Stefan.
120
124
121 2006-10-03 Ville Vainio <vivainio@gmail.com>
125 2006-10-03 Ville Vainio <vivainio@gmail.com>
122
126
123 * iplib.py (raw_input, interact): Return ValueError catching for
127 * iplib.py (raw_input, interact): Return ValueError catching for
124 raw_input. Fixes infinite loop for sys.stdin.close() or
128 raw_input. Fixes infinite loop for sys.stdin.close() or
125 sys.stdout.close().
129 sys.stdout.close().
126
130
127 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
131 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
128
132
129 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
133 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
130 to help in handling doctests. irunner is now pretty useful for
134 to help in handling doctests. irunner is now pretty useful for
131 running standalone scripts and simulate a full interactive session
135 running standalone scripts and simulate a full interactive session
132 in a format that can be then pasted as a doctest.
136 in a format that can be then pasted as a doctest.
133
137
134 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
138 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
135 on top of the default (useless) ones. This also fixes the nasty
139 on top of the default (useless) ones. This also fixes the nasty
136 way in which 2.5's Quitter() exits (reverted [1785]).
140 way in which 2.5's Quitter() exits (reverted [1785]).
137
141
138 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
142 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
139 2.5.
143 2.5.
140
144
141 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
145 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
142 color scheme is updated as well when color scheme is changed
146 color scheme is updated as well when color scheme is changed
143 interactively.
147 interactively.
144
148
145 2006-09-27 Ville Vainio <vivainio@gmail.com>
149 2006-09-27 Ville Vainio <vivainio@gmail.com>
146
150
147 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
151 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
148 infinite loop and just exit. It's a hack, but will do for a while.
152 infinite loop and just exit. It's a hack, but will do for a while.
149
153
150 2006-08-25 Walter Doerwald <walter@livinglogic.de>
154 2006-08-25 Walter Doerwald <walter@livinglogic.de>
151
155
152 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
156 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
153 the constructor, this makes it possible to get a list of only directories
157 the constructor, this makes it possible to get a list of only directories
154 or only files.
158 or only files.
155
159
156 2006-08-12 Ville Vainio <vivainio@gmail.com>
160 2006-08-12 Ville Vainio <vivainio@gmail.com>
157
161
158 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
162 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
159 they broke unittest
163 they broke unittest
160
164
161 2006-08-11 Ville Vainio <vivainio@gmail.com>
165 2006-08-11 Ville Vainio <vivainio@gmail.com>
162
166
163 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
167 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
164 by resolving issue properly, i.e. by inheriting FakeModule
168 by resolving issue properly, i.e. by inheriting FakeModule
165 from types.ModuleType. Pickling ipython interactive data
169 from types.ModuleType. Pickling ipython interactive data
166 should still work as usual (testing appreciated).
170 should still work as usual (testing appreciated).
167
171
168 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
172 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
169
173
170 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
174 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
171 running under python 2.3 with code from 2.4 to fix a bug with
175 running under python 2.3 with code from 2.4 to fix a bug with
172 help(). Reported by the Debian maintainers, Norbert Tretkowski
176 help(). Reported by the Debian maintainers, Norbert Tretkowski
173 <norbert-AT-tretkowski.de> and Alexandre Fayolle
177 <norbert-AT-tretkowski.de> and Alexandre Fayolle
174 <afayolle-AT-debian.org>.
178 <afayolle-AT-debian.org>.
175
179
176 2006-08-04 Walter Doerwald <walter@livinglogic.de>
180 2006-08-04 Walter Doerwald <walter@livinglogic.de>
177
181
178 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
182 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
179 (which was displaying "quit" twice).
183 (which was displaying "quit" twice).
180
184
181 2006-07-28 Walter Doerwald <walter@livinglogic.de>
185 2006-07-28 Walter Doerwald <walter@livinglogic.de>
182
186
183 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
187 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
184 the mode argument).
188 the mode argument).
185
189
186 2006-07-27 Walter Doerwald <walter@livinglogic.de>
190 2006-07-27 Walter Doerwald <walter@livinglogic.de>
187
191
188 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
192 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
189 not running under IPython.
193 not running under IPython.
190
194
191 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
195 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
192 and make it iterable (iterating over the attribute itself). Add two new
196 and make it iterable (iterating over the attribute itself). Add two new
193 magic strings for __xattrs__(): If the string starts with "-", the attribute
197 magic strings for __xattrs__(): If the string starts with "-", the attribute
194 will not be displayed in ibrowse's detail view (but it can still be
198 will not be displayed in ibrowse's detail view (but it can still be
195 iterated over). This makes it possible to add attributes that are large
199 iterated over). This makes it possible to add attributes that are large
196 lists or generator methods to the detail view. Replace magic attribute names
200 lists or generator methods to the detail view. Replace magic attribute names
197 and _attrname() and _getattr() with "descriptors": For each type of magic
201 and _attrname() and _getattr() with "descriptors": For each type of magic
198 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
202 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
199 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
203 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
200 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
204 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
201 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
205 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
202 are still supported.
206 are still supported.
203
207
204 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
208 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
205 fails in ibrowse.fetch(), the exception object is added as the last item
209 fails in ibrowse.fetch(), the exception object is added as the last item
206 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
210 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
207 a generator throws an exception midway through execution.
211 a generator throws an exception midway through execution.
208
212
209 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
213 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
210 encoding into methods.
214 encoding into methods.
211
215
212 2006-07-26 Ville Vainio <vivainio@gmail.com>
216 2006-07-26 Ville Vainio <vivainio@gmail.com>
213
217
214 * iplib.py: history now stores multiline input as single
218 * iplib.py: history now stores multiline input as single
215 history entries. Patch by Jorgen Cederlof.
219 history entries. Patch by Jorgen Cederlof.
216
220
217 2006-07-18 Walter Doerwald <walter@livinglogic.de>
221 2006-07-18 Walter Doerwald <walter@livinglogic.de>
218
222
219 * IPython/Extensions/ibrowse.py: Make cursor visible over
223 * IPython/Extensions/ibrowse.py: Make cursor visible over
220 non existing attributes.
224 non existing attributes.
221
225
222 2006-07-14 Walter Doerwald <walter@livinglogic.de>
226 2006-07-14 Walter Doerwald <walter@livinglogic.de>
223
227
224 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
228 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
225 error output of the running command doesn't mess up the screen.
229 error output of the running command doesn't mess up the screen.
226
230
227 2006-07-13 Walter Doerwald <walter@livinglogic.de>
231 2006-07-13 Walter Doerwald <walter@livinglogic.de>
228
232
229 * IPython/Extensions/ipipe.py (isort): Make isort usable without
233 * IPython/Extensions/ipipe.py (isort): Make isort usable without
230 argument. This sorts the items themselves.
234 argument. This sorts the items themselves.
231
235
232 2006-07-12 Walter Doerwald <walter@livinglogic.de>
236 2006-07-12 Walter Doerwald <walter@livinglogic.de>
233
237
234 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
238 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
235 Compile expression strings into code objects. This should speed
239 Compile expression strings into code objects. This should speed
236 up ifilter and friends somewhat.
240 up ifilter and friends somewhat.
237
241
238 2006-07-08 Ville Vainio <vivainio@gmail.com>
242 2006-07-08 Ville Vainio <vivainio@gmail.com>
239
243
240 * Magic.py: %cpaste now strips > from the beginning of lines
244 * Magic.py: %cpaste now strips > from the beginning of lines
241 to ease pasting quoted code from emails. Contributed by
245 to ease pasting quoted code from emails. Contributed by
242 Stefan van der Walt.
246 Stefan van der Walt.
243
247
244 2006-06-29 Ville Vainio <vivainio@gmail.com>
248 2006-06-29 Ville Vainio <vivainio@gmail.com>
245
249
246 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
250 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
247 mode, patch contributed by Darren Dale. NEEDS TESTING!
251 mode, patch contributed by Darren Dale. NEEDS TESTING!
248
252
249 2006-06-28 Walter Doerwald <walter@livinglogic.de>
253 2006-06-28 Walter Doerwald <walter@livinglogic.de>
250
254
251 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
255 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
252 a blue background. Fix fetching new display rows when the browser
256 a blue background. Fix fetching new display rows when the browser
253 scrolls more than a screenful (e.g. by using the goto command).
257 scrolls more than a screenful (e.g. by using the goto command).
254
258
255 2006-06-27 Ville Vainio <vivainio@gmail.com>
259 2006-06-27 Ville Vainio <vivainio@gmail.com>
256
260
257 * Magic.py (_inspect, _ofind) Apply David Huard's
261 * Magic.py (_inspect, _ofind) Apply David Huard's
258 patch for displaying the correct docstring for 'property'
262 patch for displaying the correct docstring for 'property'
259 attributes.
263 attributes.
260
264
261 2006-06-23 Walter Doerwald <walter@livinglogic.de>
265 2006-06-23 Walter Doerwald <walter@livinglogic.de>
262
266
263 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
267 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
264 commands into the methods implementing them.
268 commands into the methods implementing them.
265
269
266 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
270 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
267
271
268 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
272 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
269 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
273 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
270 autoindent support was authored by Jin Liu.
274 autoindent support was authored by Jin Liu.
271
275
272 2006-06-22 Walter Doerwald <walter@livinglogic.de>
276 2006-06-22 Walter Doerwald <walter@livinglogic.de>
273
277
274 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
278 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
275 for keymaps with a custom class that simplifies handling.
279 for keymaps with a custom class that simplifies handling.
276
280
277 2006-06-19 Walter Doerwald <walter@livinglogic.de>
281 2006-06-19 Walter Doerwald <walter@livinglogic.de>
278
282
279 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
283 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
280 resizing. This requires Python 2.5 to work.
284 resizing. This requires Python 2.5 to work.
281
285
282 2006-06-16 Walter Doerwald <walter@livinglogic.de>
286 2006-06-16 Walter Doerwald <walter@livinglogic.de>
283
287
284 * IPython/Extensions/ibrowse.py: Add two new commands to
288 * IPython/Extensions/ibrowse.py: Add two new commands to
285 ibrowse: "hideattr" (mapped to "h") hides the attribute under
289 ibrowse: "hideattr" (mapped to "h") hides the attribute under
286 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
290 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
287 attributes again. Remapped the help command to "?". Display
291 attributes again. Remapped the help command to "?". Display
288 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
292 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
289 as keys for the "home" and "end" commands. Add three new commands
293 as keys for the "home" and "end" commands. Add three new commands
290 to the input mode for "find" and friends: "delend" (CTRL-K)
294 to the input mode for "find" and friends: "delend" (CTRL-K)
291 deletes to the end of line. "incsearchup" searches upwards in the
295 deletes to the end of line. "incsearchup" searches upwards in the
292 command history for an input that starts with the text before the cursor.
296 command history for an input that starts with the text before the cursor.
293 "incsearchdown" does the same downwards. Removed a bogus mapping of
297 "incsearchdown" does the same downwards. Removed a bogus mapping of
294 the x key to "delete".
298 the x key to "delete".
295
299
296 2006-06-15 Ville Vainio <vivainio@gmail.com>
300 2006-06-15 Ville Vainio <vivainio@gmail.com>
297
301
298 * iplib.py, hooks.py: Added new generate_prompt hook that can be
302 * iplib.py, hooks.py: Added new generate_prompt hook that can be
299 used to create prompts dynamically, instead of the "old" way of
303 used to create prompts dynamically, instead of the "old" way of
300 assigning "magic" strings to prompt_in1 and prompt_in2. The old
304 assigning "magic" strings to prompt_in1 and prompt_in2. The old
301 way still works (it's invoked by the default hook), of course.
305 way still works (it's invoked by the default hook), of course.
302
306
303 * Prompts.py: added generate_output_prompt hook for altering output
307 * Prompts.py: added generate_output_prompt hook for altering output
304 prompt
308 prompt
305
309
306 * Release.py: Changed version string to 0.7.3.svn.
310 * Release.py: Changed version string to 0.7.3.svn.
307
311
308 2006-06-15 Walter Doerwald <walter@livinglogic.de>
312 2006-06-15 Walter Doerwald <walter@livinglogic.de>
309
313
310 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
314 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
311 the call to fetch() always tries to fetch enough data for at least one
315 the call to fetch() always tries to fetch enough data for at least one
312 full screen. This makes it possible to simply call moveto(0,0,True) in
316 full screen. This makes it possible to simply call moveto(0,0,True) in
313 the constructor. Fix typos and removed the obsolete goto attribute.
317 the constructor. Fix typos and removed the obsolete goto attribute.
314
318
315 2006-06-12 Ville Vainio <vivainio@gmail.com>
319 2006-06-12 Ville Vainio <vivainio@gmail.com>
316
320
317 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
321 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
318 allowing $variable interpolation within multiline statements,
322 allowing $variable interpolation within multiline statements,
319 though so far only with "sh" profile for a testing period.
323 though so far only with "sh" profile for a testing period.
320 The patch also enables splitting long commands with \ but it
324 The patch also enables splitting long commands with \ but it
321 doesn't work properly yet.
325 doesn't work properly yet.
322
326
323 2006-06-12 Walter Doerwald <walter@livinglogic.de>
327 2006-06-12 Walter Doerwald <walter@livinglogic.de>
324
328
325 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
329 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
326 input history and the position of the cursor in the input history for
330 input history and the position of the cursor in the input history for
327 the find, findbackwards and goto command.
331 the find, findbackwards and goto command.
328
332
329 2006-06-10 Walter Doerwald <walter@livinglogic.de>
333 2006-06-10 Walter Doerwald <walter@livinglogic.de>
330
334
331 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
335 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
332 implements the basic functionality of browser commands that require
336 implements the basic functionality of browser commands that require
333 input. Reimplement the goto, find and findbackwards commands as
337 input. Reimplement the goto, find and findbackwards commands as
334 subclasses of _CommandInput. Add an input history and keymaps to those
338 subclasses of _CommandInput. Add an input history and keymaps to those
335 commands. Add "\r" as a keyboard shortcut for the enterdefault and
339 commands. Add "\r" as a keyboard shortcut for the enterdefault and
336 execute commands.
340 execute commands.
337
341
338 2006-06-07 Ville Vainio <vivainio@gmail.com>
342 2006-06-07 Ville Vainio <vivainio@gmail.com>
339
343
340 * iplib.py: ipython mybatch.ipy exits ipython immediately after
344 * iplib.py: ipython mybatch.ipy exits ipython immediately after
341 running the batch files instead of leaving the session open.
345 running the batch files instead of leaving the session open.
342
346
343 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
347 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
344
348
345 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
349 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
346 the original fix was incomplete. Patch submitted by W. Maier.
350 the original fix was incomplete. Patch submitted by W. Maier.
347
351
348 2006-06-07 Ville Vainio <vivainio@gmail.com>
352 2006-06-07 Ville Vainio <vivainio@gmail.com>
349
353
350 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
354 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
351 Confirmation prompts can be supressed by 'quiet' option.
355 Confirmation prompts can be supressed by 'quiet' option.
352 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
356 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
353
357
354 2006-06-06 *** Released version 0.7.2
358 2006-06-06 *** Released version 0.7.2
355
359
356 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
360 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
357
361
358 * IPython/Release.py (version): Made 0.7.2 final for release.
362 * IPython/Release.py (version): Made 0.7.2 final for release.
359 Repo tagged and release cut.
363 Repo tagged and release cut.
360
364
361 2006-06-05 Ville Vainio <vivainio@gmail.com>
365 2006-06-05 Ville Vainio <vivainio@gmail.com>
362
366
363 * Magic.py (magic_rehashx): Honor no_alias list earlier in
367 * Magic.py (magic_rehashx): Honor no_alias list earlier in
364 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
368 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
365
369
366 * upgrade_dir.py: try import 'path' module a bit harder
370 * upgrade_dir.py: try import 'path' module a bit harder
367 (for %upgrade)
371 (for %upgrade)
368
372
369 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
373 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
370
374
371 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
375 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
372 instead of looping 20 times.
376 instead of looping 20 times.
373
377
374 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
378 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
375 correctly at initialization time. Bug reported by Krishna Mohan
379 correctly at initialization time. Bug reported by Krishna Mohan
376 Gundu <gkmohan-AT-gmail.com> on the user list.
380 Gundu <gkmohan-AT-gmail.com> on the user list.
377
381
378 * IPython/Release.py (version): Mark 0.7.2 version to start
382 * IPython/Release.py (version): Mark 0.7.2 version to start
379 testing for release on 06/06.
383 testing for release on 06/06.
380
384
381 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
385 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
382
386
383 * scripts/irunner: thin script interface so users don't have to
387 * scripts/irunner: thin script interface so users don't have to
384 find the module and call it as an executable, since modules rarely
388 find the module and call it as an executable, since modules rarely
385 live in people's PATH.
389 live in people's PATH.
386
390
387 * IPython/irunner.py (InteractiveRunner.__init__): added
391 * IPython/irunner.py (InteractiveRunner.__init__): added
388 delaybeforesend attribute to control delays with newer versions of
392 delaybeforesend attribute to control delays with newer versions of
389 pexpect. Thanks to detailed help from pexpect's author, Noah
393 pexpect. Thanks to detailed help from pexpect's author, Noah
390 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
394 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
391 correctly (it works in NoColor mode).
395 correctly (it works in NoColor mode).
392
396
393 * IPython/iplib.py (handle_normal): fix nasty crash reported on
397 * IPython/iplib.py (handle_normal): fix nasty crash reported on
394 SAGE list, from improper log() calls.
398 SAGE list, from improper log() calls.
395
399
396 2006-05-31 Ville Vainio <vivainio@gmail.com>
400 2006-05-31 Ville Vainio <vivainio@gmail.com>
397
401
398 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
402 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
399 with args in parens to work correctly with dirs that have spaces.
403 with args in parens to work correctly with dirs that have spaces.
400
404
401 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
405 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
402
406
403 * IPython/Logger.py (Logger.logstart): add option to log raw input
407 * IPython/Logger.py (Logger.logstart): add option to log raw input
404 instead of the processed one. A -r flag was added to the
408 instead of the processed one. A -r flag was added to the
405 %logstart magic used for controlling logging.
409 %logstart magic used for controlling logging.
406
410
407 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
411 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
408
412
409 * IPython/iplib.py (InteractiveShell.__init__): add check for the
413 * IPython/iplib.py (InteractiveShell.__init__): add check for the
410 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
414 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
411 recognize the option. After a bug report by Will Maier. This
415 recognize the option. After a bug report by Will Maier. This
412 closes #64 (will do it after confirmation from W. Maier).
416 closes #64 (will do it after confirmation from W. Maier).
413
417
414 * IPython/irunner.py: New module to run scripts as if manually
418 * IPython/irunner.py: New module to run scripts as if manually
415 typed into an interactive environment, based on pexpect. After a
419 typed into an interactive environment, based on pexpect. After a
416 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
420 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
417 ipython-user list. Simple unittests in the tests/ directory.
421 ipython-user list. Simple unittests in the tests/ directory.
418
422
419 * tools/release: add Will Maier, OpenBSD port maintainer, to
423 * tools/release: add Will Maier, OpenBSD port maintainer, to
420 recepients list. We are now officially part of the OpenBSD ports:
424 recepients list. We are now officially part of the OpenBSD ports:
421 http://www.openbsd.org/ports.html ! Many thanks to Will for the
425 http://www.openbsd.org/ports.html ! Many thanks to Will for the
422 work.
426 work.
423
427
424 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
428 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
425
429
426 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
430 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
427 so that it doesn't break tkinter apps.
431 so that it doesn't break tkinter apps.
428
432
429 * IPython/iplib.py (_prefilter): fix bug where aliases would
433 * IPython/iplib.py (_prefilter): fix bug where aliases would
430 shadow variables when autocall was fully off. Reported by SAGE
434 shadow variables when autocall was fully off. Reported by SAGE
431 author William Stein.
435 author William Stein.
432
436
433 * IPython/OInspect.py (Inspector.__init__): add a flag to control
437 * IPython/OInspect.py (Inspector.__init__): add a flag to control
434 at what detail level strings are computed when foo? is requested.
438 at what detail level strings are computed when foo? is requested.
435 This allows users to ask for example that the string form of an
439 This allows users to ask for example that the string form of an
436 object is only computed when foo?? is called, or even never, by
440 object is only computed when foo?? is called, or even never, by
437 setting the object_info_string_level >= 2 in the configuration
441 setting the object_info_string_level >= 2 in the configuration
438 file. This new option has been added and documented. After a
442 file. This new option has been added and documented. After a
439 request by SAGE to be able to control the printing of very large
443 request by SAGE to be able to control the printing of very large
440 objects more easily.
444 objects more easily.
441
445
442 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
446 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
443
447
444 * IPython/ipmaker.py (make_IPython): remove the ipython call path
448 * IPython/ipmaker.py (make_IPython): remove the ipython call path
445 from sys.argv, to be 100% consistent with how Python itself works
449 from sys.argv, to be 100% consistent with how Python itself works
446 (as seen for example with python -i file.py). After a bug report
450 (as seen for example with python -i file.py). After a bug report
447 by Jeffrey Collins.
451 by Jeffrey Collins.
448
452
449 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
453 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
450 nasty bug which was preventing custom namespaces with -pylab,
454 nasty bug which was preventing custom namespaces with -pylab,
451 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
455 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
452 compatibility (long gone from mpl).
456 compatibility (long gone from mpl).
453
457
454 * IPython/ipapi.py (make_session): name change: create->make. We
458 * IPython/ipapi.py (make_session): name change: create->make. We
455 use make in other places (ipmaker,...), it's shorter and easier to
459 use make in other places (ipmaker,...), it's shorter and easier to
456 type and say, etc. I'm trying to clean things before 0.7.2 so
460 type and say, etc. I'm trying to clean things before 0.7.2 so
457 that I can keep things stable wrt to ipapi in the chainsaw branch.
461 that I can keep things stable wrt to ipapi in the chainsaw branch.
458
462
459 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
463 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
460 python-mode recognizes our debugger mode. Add support for
464 python-mode recognizes our debugger mode. Add support for
461 autoindent inside (X)emacs. After a patch sent in by Jin Liu
465 autoindent inside (X)emacs. After a patch sent in by Jin Liu
462 <m.liu.jin-AT-gmail.com> originally written by
466 <m.liu.jin-AT-gmail.com> originally written by
463 doxgen-AT-newsmth.net (with minor modifications for xemacs
467 doxgen-AT-newsmth.net (with minor modifications for xemacs
464 compatibility)
468 compatibility)
465
469
466 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
470 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
467 tracebacks when walking the stack so that the stack tracking system
471 tracebacks when walking the stack so that the stack tracking system
468 in emacs' python-mode can identify the frames correctly.
472 in emacs' python-mode can identify the frames correctly.
469
473
470 * IPython/ipmaker.py (make_IPython): make the internal (and
474 * IPython/ipmaker.py (make_IPython): make the internal (and
471 default config) autoedit_syntax value false by default. Too many
475 default config) autoedit_syntax value false by default. Too many
472 users have complained to me (both on and off-list) about problems
476 users have complained to me (both on and off-list) about problems
473 with this option being on by default, so I'm making it default to
477 with this option being on by default, so I'm making it default to
474 off. It can still be enabled by anyone via the usual mechanisms.
478 off. It can still be enabled by anyone via the usual mechanisms.
475
479
476 * IPython/completer.py (Completer.attr_matches): add support for
480 * IPython/completer.py (Completer.attr_matches): add support for
477 PyCrust-style _getAttributeNames magic method. Patch contributed
481 PyCrust-style _getAttributeNames magic method. Patch contributed
478 by <mscott-AT-goldenspud.com>. Closes #50.
482 by <mscott-AT-goldenspud.com>. Closes #50.
479
483
480 * IPython/iplib.py (InteractiveShell.__init__): remove the
484 * IPython/iplib.py (InteractiveShell.__init__): remove the
481 deletion of exit/quit from __builtin__, which can break
485 deletion of exit/quit from __builtin__, which can break
482 third-party tools like the Zope debugging console. The
486 third-party tools like the Zope debugging console. The
483 %exit/%quit magics remain. In general, it's probably a good idea
487 %exit/%quit magics remain. In general, it's probably a good idea
484 not to delete anything from __builtin__, since we never know what
488 not to delete anything from __builtin__, since we never know what
485 that will break. In any case, python now (for 2.5) will support
489 that will break. In any case, python now (for 2.5) will support
486 'real' exit/quit, so this issue is moot. Closes #55.
490 'real' exit/quit, so this issue is moot. Closes #55.
487
491
488 * IPython/genutils.py (with_obj): rename the 'with' function to
492 * IPython/genutils.py (with_obj): rename the 'with' function to
489 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
493 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
490 becomes a language keyword. Closes #53.
494 becomes a language keyword. Closes #53.
491
495
492 * IPython/FakeModule.py (FakeModule.__init__): add a proper
496 * IPython/FakeModule.py (FakeModule.__init__): add a proper
493 __file__ attribute to this so it fools more things into thinking
497 __file__ attribute to this so it fools more things into thinking
494 it is a real module. Closes #59.
498 it is a real module. Closes #59.
495
499
496 * IPython/Magic.py (magic_edit): add -n option to open the editor
500 * IPython/Magic.py (magic_edit): add -n option to open the editor
497 at a specific line number. After a patch by Stefan van der Walt.
501 at a specific line number. After a patch by Stefan van der Walt.
498
502
499 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
503 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
500
504
501 * IPython/iplib.py (edit_syntax_error): fix crash when for some
505 * IPython/iplib.py (edit_syntax_error): fix crash when for some
502 reason the file could not be opened. After automatic crash
506 reason the file could not be opened. After automatic crash
503 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
507 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
504 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
508 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
505 (_should_recompile): Don't fire editor if using %bg, since there
509 (_should_recompile): Don't fire editor if using %bg, since there
506 is no file in the first place. From the same report as above.
510 is no file in the first place. From the same report as above.
507 (raw_input): protect against faulty third-party prefilters. After
511 (raw_input): protect against faulty third-party prefilters. After
508 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
512 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
509 while running under SAGE.
513 while running under SAGE.
510
514
511 2006-05-23 Ville Vainio <vivainio@gmail.com>
515 2006-05-23 Ville Vainio <vivainio@gmail.com>
512
516
513 * ipapi.py: Stripped down ip.to_user_ns() to work only as
517 * ipapi.py: Stripped down ip.to_user_ns() to work only as
514 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
518 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
515 now returns None (again), unless dummy is specifically allowed by
519 now returns None (again), unless dummy is specifically allowed by
516 ipapi.get(allow_dummy=True).
520 ipapi.get(allow_dummy=True).
517
521
518 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
522 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
519
523
520 * IPython: remove all 2.2-compatibility objects and hacks from
524 * IPython: remove all 2.2-compatibility objects and hacks from
521 everywhere, since we only support 2.3 at this point. Docs
525 everywhere, since we only support 2.3 at this point. Docs
522 updated.
526 updated.
523
527
524 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
528 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
525 Anything requiring extra validation can be turned into a Python
529 Anything requiring extra validation can be turned into a Python
526 property in the future. I used a property for the db one b/c
530 property in the future. I used a property for the db one b/c
527 there was a nasty circularity problem with the initialization
531 there was a nasty circularity problem with the initialization
528 order, which right now I don't have time to clean up.
532 order, which right now I don't have time to clean up.
529
533
530 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
534 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
531 another locking bug reported by Jorgen. I'm not 100% sure though,
535 another locking bug reported by Jorgen. I'm not 100% sure though,
532 so more testing is needed...
536 so more testing is needed...
533
537
534 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
538 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
535
539
536 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
540 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
537 local variables from any routine in user code (typically executed
541 local variables from any routine in user code (typically executed
538 with %run) directly into the interactive namespace. Very useful
542 with %run) directly into the interactive namespace. Very useful
539 when doing complex debugging.
543 when doing complex debugging.
540 (IPythonNotRunning): Changed the default None object to a dummy
544 (IPythonNotRunning): Changed the default None object to a dummy
541 whose attributes can be queried as well as called without
545 whose attributes can be queried as well as called without
542 exploding, to ease writing code which works transparently both in
546 exploding, to ease writing code which works transparently both in
543 and out of ipython and uses some of this API.
547 and out of ipython and uses some of this API.
544
548
545 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
549 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
546
550
547 * IPython/hooks.py (result_display): Fix the fact that our display
551 * IPython/hooks.py (result_display): Fix the fact that our display
548 hook was using str() instead of repr(), as the default python
552 hook was using str() instead of repr(), as the default python
549 console does. This had gone unnoticed b/c it only happened if
553 console does. This had gone unnoticed b/c it only happened if
550 %Pprint was off, but the inconsistency was there.
554 %Pprint was off, but the inconsistency was there.
551
555
552 2006-05-15 Ville Vainio <vivainio@gmail.com>
556 2006-05-15 Ville Vainio <vivainio@gmail.com>
553
557
554 * Oinspect.py: Only show docstring for nonexisting/binary files
558 * Oinspect.py: Only show docstring for nonexisting/binary files
555 when doing object??, closing ticket #62
559 when doing object??, closing ticket #62
556
560
557 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
561 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
558
562
559 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
563 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
560 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
564 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
561 was being released in a routine which hadn't checked if it had
565 was being released in a routine which hadn't checked if it had
562 been the one to acquire it.
566 been the one to acquire it.
563
567
564 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
568 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
565
569
566 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
570 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
567
571
568 2006-04-11 Ville Vainio <vivainio@gmail.com>
572 2006-04-11 Ville Vainio <vivainio@gmail.com>
569
573
570 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
574 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
571 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
575 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
572 prefilters, allowing stuff like magics and aliases in the file.
576 prefilters, allowing stuff like magics and aliases in the file.
573
577
574 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
578 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
575 added. Supported now are "%clear in" and "%clear out" (clear input and
579 added. Supported now are "%clear in" and "%clear out" (clear input and
576 output history, respectively). Also fixed CachedOutput.flush to
580 output history, respectively). Also fixed CachedOutput.flush to
577 properly flush the output cache.
581 properly flush the output cache.
578
582
579 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
583 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
580 half-success (and fail explicitly).
584 half-success (and fail explicitly).
581
585
582 2006-03-28 Ville Vainio <vivainio@gmail.com>
586 2006-03-28 Ville Vainio <vivainio@gmail.com>
583
587
584 * iplib.py: Fix quoting of aliases so that only argless ones
588 * iplib.py: Fix quoting of aliases so that only argless ones
585 are quoted
589 are quoted
586
590
587 2006-03-28 Ville Vainio <vivainio@gmail.com>
591 2006-03-28 Ville Vainio <vivainio@gmail.com>
588
592
589 * iplib.py: Quote aliases with spaces in the name.
593 * iplib.py: Quote aliases with spaces in the name.
590 "c:\program files\blah\bin" is now legal alias target.
594 "c:\program files\blah\bin" is now legal alias target.
591
595
592 * ext_rehashdir.py: Space no longer allowed as arg
596 * ext_rehashdir.py: Space no longer allowed as arg
593 separator, since space is legal in path names.
597 separator, since space is legal in path names.
594
598
595 2006-03-16 Ville Vainio <vivainio@gmail.com>
599 2006-03-16 Ville Vainio <vivainio@gmail.com>
596
600
597 * upgrade_dir.py: Take path.py from Extensions, correcting
601 * upgrade_dir.py: Take path.py from Extensions, correcting
598 %upgrade magic
602 %upgrade magic
599
603
600 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
604 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
601
605
602 * hooks.py: Only enclose editor binary in quotes if legal and
606 * hooks.py: Only enclose editor binary in quotes if legal and
603 necessary (space in the name, and is an existing file). Fixes a bug
607 necessary (space in the name, and is an existing file). Fixes a bug
604 reported by Zachary Pincus.
608 reported by Zachary Pincus.
605
609
606 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
610 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
607
611
608 * Manual: thanks to a tip on proper color handling for Emacs, by
612 * Manual: thanks to a tip on proper color handling for Emacs, by
609 Eric J Haywiser <ejh1-AT-MIT.EDU>.
613 Eric J Haywiser <ejh1-AT-MIT.EDU>.
610
614
611 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
615 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
612 by applying the provided patch. Thanks to Liu Jin
616 by applying the provided patch. Thanks to Liu Jin
613 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
617 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
614 XEmacs/Linux, I'm trusting the submitter that it actually helps
618 XEmacs/Linux, I'm trusting the submitter that it actually helps
615 under win32/GNU Emacs. Will revisit if any problems are reported.
619 under win32/GNU Emacs. Will revisit if any problems are reported.
616
620
617 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
621 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
618
622
619 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
623 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
620 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
624 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
621
625
622 2006-03-12 Ville Vainio <vivainio@gmail.com>
626 2006-03-12 Ville Vainio <vivainio@gmail.com>
623
627
624 * Magic.py (magic_timeit): Added %timeit magic, contributed by
628 * Magic.py (magic_timeit): Added %timeit magic, contributed by
625 Torsten Marek.
629 Torsten Marek.
626
630
627 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
631 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
628
632
629 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
633 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
630 line ranges works again.
634 line ranges works again.
631
635
632 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
636 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
633
637
634 * IPython/iplib.py (showtraceback): add back sys.last_traceback
638 * IPython/iplib.py (showtraceback): add back sys.last_traceback
635 and friends, after a discussion with Zach Pincus on ipython-user.
639 and friends, after a discussion with Zach Pincus on ipython-user.
636 I'm not 100% sure, but after thinking about it quite a bit, it may
640 I'm not 100% sure, but after thinking about it quite a bit, it may
637 be OK. Testing with the multithreaded shells didn't reveal any
641 be OK. Testing with the multithreaded shells didn't reveal any
638 problems, but let's keep an eye out.
642 problems, but let's keep an eye out.
639
643
640 In the process, I fixed a few things which were calling
644 In the process, I fixed a few things which were calling
641 self.InteractiveTB() directly (like safe_execfile), which is a
645 self.InteractiveTB() directly (like safe_execfile), which is a
642 mistake: ALL exception reporting should be done by calling
646 mistake: ALL exception reporting should be done by calling
643 self.showtraceback(), which handles state and tab-completion and
647 self.showtraceback(), which handles state and tab-completion and
644 more.
648 more.
645
649
646 2006-03-01 Ville Vainio <vivainio@gmail.com>
650 2006-03-01 Ville Vainio <vivainio@gmail.com>
647
651
648 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
652 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
649 To use, do "from ipipe import *".
653 To use, do "from ipipe import *".
650
654
651 2006-02-24 Ville Vainio <vivainio@gmail.com>
655 2006-02-24 Ville Vainio <vivainio@gmail.com>
652
656
653 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
657 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
654 "cleanly" and safely than the older upgrade mechanism.
658 "cleanly" and safely than the older upgrade mechanism.
655
659
656 2006-02-21 Ville Vainio <vivainio@gmail.com>
660 2006-02-21 Ville Vainio <vivainio@gmail.com>
657
661
658 * Magic.py: %save works again.
662 * Magic.py: %save works again.
659
663
660 2006-02-15 Ville Vainio <vivainio@gmail.com>
664 2006-02-15 Ville Vainio <vivainio@gmail.com>
661
665
662 * Magic.py: %Pprint works again
666 * Magic.py: %Pprint works again
663
667
664 * Extensions/ipy_sane_defaults.py: Provide everything provided
668 * Extensions/ipy_sane_defaults.py: Provide everything provided
665 in default ipythonrc, to make it possible to have a completely empty
669 in default ipythonrc, to make it possible to have a completely empty
666 ipythonrc (and thus completely rc-file free configuration)
670 ipythonrc (and thus completely rc-file free configuration)
667
671
668 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
672 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
669
673
670 * IPython/hooks.py (editor): quote the call to the editor command,
674 * IPython/hooks.py (editor): quote the call to the editor command,
671 to allow commands with spaces in them. Problem noted by watching
675 to allow commands with spaces in them. Problem noted by watching
672 Ian Oswald's video about textpad under win32 at
676 Ian Oswald's video about textpad under win32 at
673 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
677 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
674
678
675 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
679 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
676 describing magics (we haven't used @ for a loong time).
680 describing magics (we haven't used @ for a loong time).
677
681
678 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
682 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
679 contributed by marienz to close
683 contributed by marienz to close
680 http://www.scipy.net/roundup/ipython/issue53.
684 http://www.scipy.net/roundup/ipython/issue53.
681
685
682 2006-02-10 Ville Vainio <vivainio@gmail.com>
686 2006-02-10 Ville Vainio <vivainio@gmail.com>
683
687
684 * genutils.py: getoutput now works in win32 too
688 * genutils.py: getoutput now works in win32 too
685
689
686 * completer.py: alias and magic completion only invoked
690 * completer.py: alias and magic completion only invoked
687 at the first "item" in the line, to avoid "cd %store"
691 at the first "item" in the line, to avoid "cd %store"
688 nonsense.
692 nonsense.
689
693
690 2006-02-09 Ville Vainio <vivainio@gmail.com>
694 2006-02-09 Ville Vainio <vivainio@gmail.com>
691
695
692 * test/*: Added a unit testing framework (finally).
696 * test/*: Added a unit testing framework (finally).
693 '%run runtests.py' to run test_*.
697 '%run runtests.py' to run test_*.
694
698
695 * ipapi.py: Exposed runlines and set_custom_exc
699 * ipapi.py: Exposed runlines and set_custom_exc
696
700
697 2006-02-07 Ville Vainio <vivainio@gmail.com>
701 2006-02-07 Ville Vainio <vivainio@gmail.com>
698
702
699 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
703 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
700 instead use "f(1 2)" as before.
704 instead use "f(1 2)" as before.
701
705
702 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
706 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
703
707
704 * IPython/demo.py (IPythonDemo): Add new classes to the demo
708 * IPython/demo.py (IPythonDemo): Add new classes to the demo
705 facilities, for demos processed by the IPython input filter
709 facilities, for demos processed by the IPython input filter
706 (IPythonDemo), and for running a script one-line-at-a-time as a
710 (IPythonDemo), and for running a script one-line-at-a-time as a
707 demo, both for pure Python (LineDemo) and for IPython-processed
711 demo, both for pure Python (LineDemo) and for IPython-processed
708 input (IPythonLineDemo). After a request by Dave Kohel, from the
712 input (IPythonLineDemo). After a request by Dave Kohel, from the
709 SAGE team.
713 SAGE team.
710 (Demo.edit): added an edit() method to the demo objects, to edit
714 (Demo.edit): added an edit() method to the demo objects, to edit
711 the in-memory copy of the last executed block.
715 the in-memory copy of the last executed block.
712
716
713 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
717 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
714 processing to %edit, %macro and %save. These commands can now be
718 processing to %edit, %macro and %save. These commands can now be
715 invoked on the unprocessed input as it was typed by the user
719 invoked on the unprocessed input as it was typed by the user
716 (without any prefilters applied). After requests by the SAGE team
720 (without any prefilters applied). After requests by the SAGE team
717 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
721 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
718
722
719 2006-02-01 Ville Vainio <vivainio@gmail.com>
723 2006-02-01 Ville Vainio <vivainio@gmail.com>
720
724
721 * setup.py, eggsetup.py: easy_install ipython==dev works
725 * setup.py, eggsetup.py: easy_install ipython==dev works
722 correctly now (on Linux)
726 correctly now (on Linux)
723
727
724 * ipy_user_conf,ipmaker: user config changes, removed spurious
728 * ipy_user_conf,ipmaker: user config changes, removed spurious
725 warnings
729 warnings
726
730
727 * iplib: if rc.banner is string, use it as is.
731 * iplib: if rc.banner is string, use it as is.
728
732
729 * Magic: %pycat accepts a string argument and pages it's contents.
733 * Magic: %pycat accepts a string argument and pages it's contents.
730
734
731
735
732 2006-01-30 Ville Vainio <vivainio@gmail.com>
736 2006-01-30 Ville Vainio <vivainio@gmail.com>
733
737
734 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
738 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
735 Now %store and bookmarks work through PickleShare, meaning that
739 Now %store and bookmarks work through PickleShare, meaning that
736 concurrent access is possible and all ipython sessions see the
740 concurrent access is possible and all ipython sessions see the
737 same database situation all the time, instead of snapshot of
741 same database situation all the time, instead of snapshot of
738 the situation when the session was started. Hence, %bookmark
742 the situation when the session was started. Hence, %bookmark
739 results are immediately accessible from othes sessions. The database
743 results are immediately accessible from othes sessions. The database
740 is also available for use by user extensions. See:
744 is also available for use by user extensions. See:
741 http://www.python.org/pypi/pickleshare
745 http://www.python.org/pypi/pickleshare
742
746
743 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
747 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
744
748
745 * aliases can now be %store'd
749 * aliases can now be %store'd
746
750
747 * path.py moved to Extensions so that pickleshare does not need
751 * path.py moved to Extensions so that pickleshare does not need
748 IPython-specific import. Extensions added to pythonpath right
752 IPython-specific import. Extensions added to pythonpath right
749 at __init__.
753 at __init__.
750
754
751 * iplib.py: ipalias deprecated/redundant; aliases are converted and
755 * iplib.py: ipalias deprecated/redundant; aliases are converted and
752 called with _ip.system and the pre-transformed command string.
756 called with _ip.system and the pre-transformed command string.
753
757
754 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
758 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
755
759
756 * IPython/iplib.py (interact): Fix that we were not catching
760 * IPython/iplib.py (interact): Fix that we were not catching
757 KeyboardInterrupt exceptions properly. I'm not quite sure why the
761 KeyboardInterrupt exceptions properly. I'm not quite sure why the
758 logic here had to change, but it's fixed now.
762 logic here had to change, but it's fixed now.
759
763
760 2006-01-29 Ville Vainio <vivainio@gmail.com>
764 2006-01-29 Ville Vainio <vivainio@gmail.com>
761
765
762 * iplib.py: Try to import pyreadline on Windows.
766 * iplib.py: Try to import pyreadline on Windows.
763
767
764 2006-01-27 Ville Vainio <vivainio@gmail.com>
768 2006-01-27 Ville Vainio <vivainio@gmail.com>
765
769
766 * iplib.py: Expose ipapi as _ip in builtin namespace.
770 * iplib.py: Expose ipapi as _ip in builtin namespace.
767 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
771 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
768 and ip_set_hook (-> _ip.set_hook) redundant. % and !
772 and ip_set_hook (-> _ip.set_hook) redundant. % and !
769 syntax now produce _ip.* variant of the commands.
773 syntax now produce _ip.* variant of the commands.
770
774
771 * "_ip.options().autoedit_syntax = 2" automatically throws
775 * "_ip.options().autoedit_syntax = 2" automatically throws
772 user to editor for syntax error correction without prompting.
776 user to editor for syntax error correction without prompting.
773
777
774 2006-01-27 Ville Vainio <vivainio@gmail.com>
778 2006-01-27 Ville Vainio <vivainio@gmail.com>
775
779
776 * ipmaker.py: Give "realistic" sys.argv for scripts (without
780 * ipmaker.py: Give "realistic" sys.argv for scripts (without
777 'ipython' at argv[0]) executed through command line.
781 'ipython' at argv[0]) executed through command line.
778 NOTE: this DEPRECATES calling ipython with multiple scripts
782 NOTE: this DEPRECATES calling ipython with multiple scripts
779 ("ipython a.py b.py c.py")
783 ("ipython a.py b.py c.py")
780
784
781 * iplib.py, hooks.py: Added configurable input prefilter,
785 * iplib.py, hooks.py: Added configurable input prefilter,
782 named 'input_prefilter'. See ext_rescapture.py for example
786 named 'input_prefilter'. See ext_rescapture.py for example
783 usage.
787 usage.
784
788
785 * ext_rescapture.py, Magic.py: Better system command output capture
789 * ext_rescapture.py, Magic.py: Better system command output capture
786 through 'var = !ls' (deprecates user-visible %sc). Same notation
790 through 'var = !ls' (deprecates user-visible %sc). Same notation
787 applies for magics, 'var = %alias' assigns alias list to var.
791 applies for magics, 'var = %alias' assigns alias list to var.
788
792
789 * ipapi.py: added meta() for accessing extension-usable data store.
793 * ipapi.py: added meta() for accessing extension-usable data store.
790
794
791 * iplib.py: added InteractiveShell.getapi(). New magics should be
795 * iplib.py: added InteractiveShell.getapi(). New magics should be
792 written doing self.getapi() instead of using the shell directly.
796 written doing self.getapi() instead of using the shell directly.
793
797
794 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
798 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
795 %store foo >> ~/myfoo.txt to store variables to files (in clean
799 %store foo >> ~/myfoo.txt to store variables to files (in clean
796 textual form, not a restorable pickle).
800 textual form, not a restorable pickle).
797
801
798 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
802 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
799
803
800 * usage.py, Magic.py: added %quickref
804 * usage.py, Magic.py: added %quickref
801
805
802 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
806 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
803
807
804 * GetoptErrors when invoking magics etc. with wrong args
808 * GetoptErrors when invoking magics etc. with wrong args
805 are now more helpful:
809 are now more helpful:
806 GetoptError: option -l not recognized (allowed: "qb" )
810 GetoptError: option -l not recognized (allowed: "qb" )
807
811
808 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
812 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
809
813
810 * IPython/demo.py (Demo.show): Flush stdout after each block, so
814 * IPython/demo.py (Demo.show): Flush stdout after each block, so
811 computationally intensive blocks don't appear to stall the demo.
815 computationally intensive blocks don't appear to stall the demo.
812
816
813 2006-01-24 Ville Vainio <vivainio@gmail.com>
817 2006-01-24 Ville Vainio <vivainio@gmail.com>
814
818
815 * iplib.py, hooks.py: 'result_display' hook can return a non-None
819 * iplib.py, hooks.py: 'result_display' hook can return a non-None
816 value to manipulate resulting history entry.
820 value to manipulate resulting history entry.
817
821
818 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
822 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
819 to instance methods of IPApi class, to make extending an embedded
823 to instance methods of IPApi class, to make extending an embedded
820 IPython feasible. See ext_rehashdir.py for example usage.
824 IPython feasible. See ext_rehashdir.py for example usage.
821
825
822 * Merged 1071-1076 from branches/0.7.1
826 * Merged 1071-1076 from branches/0.7.1
823
827
824
828
825 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
829 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
826
830
827 * tools/release (daystamp): Fix build tools to use the new
831 * tools/release (daystamp): Fix build tools to use the new
828 eggsetup.py script to build lightweight eggs.
832 eggsetup.py script to build lightweight eggs.
829
833
830 * Applied changesets 1062 and 1064 before 0.7.1 release.
834 * Applied changesets 1062 and 1064 before 0.7.1 release.
831
835
832 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
836 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
833 see the raw input history (without conversions like %ls ->
837 see the raw input history (without conversions like %ls ->
834 ipmagic("ls")). After a request from W. Stein, SAGE
838 ipmagic("ls")). After a request from W. Stein, SAGE
835 (http://modular.ucsd.edu/sage) developer. This information is
839 (http://modular.ucsd.edu/sage) developer. This information is
836 stored in the input_hist_raw attribute of the IPython instance, so
840 stored in the input_hist_raw attribute of the IPython instance, so
837 developers can access it if needed (it's an InputList instance).
841 developers can access it if needed (it's an InputList instance).
838
842
839 * Versionstring = 0.7.2.svn
843 * Versionstring = 0.7.2.svn
840
844
841 * eggsetup.py: A separate script for constructing eggs, creates
845 * eggsetup.py: A separate script for constructing eggs, creates
842 proper launch scripts even on Windows (an .exe file in
846 proper launch scripts even on Windows (an .exe file in
843 \python24\scripts).
847 \python24\scripts).
844
848
845 * ipapi.py: launch_new_instance, launch entry point needed for the
849 * ipapi.py: launch_new_instance, launch entry point needed for the
846 egg.
850 egg.
847
851
848 2006-01-23 Ville Vainio <vivainio@gmail.com>
852 2006-01-23 Ville Vainio <vivainio@gmail.com>
849
853
850 * Added %cpaste magic for pasting python code
854 * Added %cpaste magic for pasting python code
851
855
852 2006-01-22 Ville Vainio <vivainio@gmail.com>
856 2006-01-22 Ville Vainio <vivainio@gmail.com>
853
857
854 * Merge from branches/0.7.1 into trunk, revs 1052-1057
858 * Merge from branches/0.7.1 into trunk, revs 1052-1057
855
859
856 * Versionstring = 0.7.2.svn
860 * Versionstring = 0.7.2.svn
857
861
858 * eggsetup.py: A separate script for constructing eggs, creates
862 * eggsetup.py: A separate script for constructing eggs, creates
859 proper launch scripts even on Windows (an .exe file in
863 proper launch scripts even on Windows (an .exe file in
860 \python24\scripts).
864 \python24\scripts).
861
865
862 * ipapi.py: launch_new_instance, launch entry point needed for the
866 * ipapi.py: launch_new_instance, launch entry point needed for the
863 egg.
867 egg.
864
868
865 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
869 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
866
870
867 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
871 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
868 %pfile foo would print the file for foo even if it was a binary.
872 %pfile foo would print the file for foo even if it was a binary.
869 Now, extensions '.so' and '.dll' are skipped.
873 Now, extensions '.so' and '.dll' are skipped.
870
874
871 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
875 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
872 bug, where macros would fail in all threaded modes. I'm not 100%
876 bug, where macros would fail in all threaded modes. I'm not 100%
873 sure, so I'm going to put out an rc instead of making a release
877 sure, so I'm going to put out an rc instead of making a release
874 today, and wait for feedback for at least a few days.
878 today, and wait for feedback for at least a few days.
875
879
876 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
880 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
877 it...) the handling of pasting external code with autoindent on.
881 it...) the handling of pasting external code with autoindent on.
878 To get out of a multiline input, the rule will appear for most
882 To get out of a multiline input, the rule will appear for most
879 users unchanged: two blank lines or change the indent level
883 users unchanged: two blank lines or change the indent level
880 proposed by IPython. But there is a twist now: you can
884 proposed by IPython. But there is a twist now: you can
881 add/subtract only *one or two spaces*. If you add/subtract three
885 add/subtract only *one or two spaces*. If you add/subtract three
882 or more (unless you completely delete the line), IPython will
886 or more (unless you completely delete the line), IPython will
883 accept that line, and you'll need to enter a second one of pure
887 accept that line, and you'll need to enter a second one of pure
884 whitespace. I know it sounds complicated, but I can't find a
888 whitespace. I know it sounds complicated, but I can't find a
885 different solution that covers all the cases, with the right
889 different solution that covers all the cases, with the right
886 heuristics. Hopefully in actual use, nobody will really notice
890 heuristics. Hopefully in actual use, nobody will really notice
887 all these strange rules and things will 'just work'.
891 all these strange rules and things will 'just work'.
888
892
889 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
893 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
890
894
891 * IPython/iplib.py (interact): catch exceptions which can be
895 * IPython/iplib.py (interact): catch exceptions which can be
892 triggered asynchronously by signal handlers. Thanks to an
896 triggered asynchronously by signal handlers. Thanks to an
893 automatic crash report, submitted by Colin Kingsley
897 automatic crash report, submitted by Colin Kingsley
894 <tercel-AT-gentoo.org>.
898 <tercel-AT-gentoo.org>.
895
899
896 2006-01-20 Ville Vainio <vivainio@gmail.com>
900 2006-01-20 Ville Vainio <vivainio@gmail.com>
897
901
898 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
902 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
899 (%rehashdir, very useful, try it out) of how to extend ipython
903 (%rehashdir, very useful, try it out) of how to extend ipython
900 with new magics. Also added Extensions dir to pythonpath to make
904 with new magics. Also added Extensions dir to pythonpath to make
901 importing extensions easy.
905 importing extensions easy.
902
906
903 * %store now complains when trying to store interactively declared
907 * %store now complains when trying to store interactively declared
904 classes / instances of those classes.
908 classes / instances of those classes.
905
909
906 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
910 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
907 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
911 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
908 if they exist, and ipy_user_conf.py with some defaults is created for
912 if they exist, and ipy_user_conf.py with some defaults is created for
909 the user.
913 the user.
910
914
911 * Startup rehashing done by the config file, not InterpreterExec.
915 * Startup rehashing done by the config file, not InterpreterExec.
912 This means system commands are available even without selecting the
916 This means system commands are available even without selecting the
913 pysh profile. It's the sensible default after all.
917 pysh profile. It's the sensible default after all.
914
918
915 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
919 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
916
920
917 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
921 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
918 multiline code with autoindent on working. But I am really not
922 multiline code with autoindent on working. But I am really not
919 sure, so this needs more testing. Will commit a debug-enabled
923 sure, so this needs more testing. Will commit a debug-enabled
920 version for now, while I test it some more, so that Ville and
924 version for now, while I test it some more, so that Ville and
921 others may also catch any problems. Also made
925 others may also catch any problems. Also made
922 self.indent_current_str() a method, to ensure that there's no
926 self.indent_current_str() a method, to ensure that there's no
923 chance of the indent space count and the corresponding string
927 chance of the indent space count and the corresponding string
924 falling out of sync. All code needing the string should just call
928 falling out of sync. All code needing the string should just call
925 the method.
929 the method.
926
930
927 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
931 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
928
932
929 * IPython/Magic.py (magic_edit): fix check for when users don't
933 * IPython/Magic.py (magic_edit): fix check for when users don't
930 save their output files, the try/except was in the wrong section.
934 save their output files, the try/except was in the wrong section.
931
935
932 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
936 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
933
937
934 * IPython/Magic.py (magic_run): fix __file__ global missing from
938 * IPython/Magic.py (magic_run): fix __file__ global missing from
935 script's namespace when executed via %run. After a report by
939 script's namespace when executed via %run. After a report by
936 Vivian.
940 Vivian.
937
941
938 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
942 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
939 when using python 2.4. The parent constructor changed in 2.4, and
943 when using python 2.4. The parent constructor changed in 2.4, and
940 we need to track it directly (we can't call it, as it messes up
944 we need to track it directly (we can't call it, as it messes up
941 readline and tab-completion inside our pdb would stop working).
945 readline and tab-completion inside our pdb would stop working).
942 After a bug report by R. Bernstein <rocky-AT-panix.com>.
946 After a bug report by R. Bernstein <rocky-AT-panix.com>.
943
947
944 2006-01-16 Ville Vainio <vivainio@gmail.com>
948 2006-01-16 Ville Vainio <vivainio@gmail.com>
945
949
946 * Ipython/magic.py: Reverted back to old %edit functionality
950 * Ipython/magic.py: Reverted back to old %edit functionality
947 that returns file contents on exit.
951 that returns file contents on exit.
948
952
949 * IPython/path.py: Added Jason Orendorff's "path" module to
953 * IPython/path.py: Added Jason Orendorff's "path" module to
950 IPython tree, http://www.jorendorff.com/articles/python/path/.
954 IPython tree, http://www.jorendorff.com/articles/python/path/.
951 You can get path objects conveniently through %sc, and !!, e.g.:
955 You can get path objects conveniently through %sc, and !!, e.g.:
952 sc files=ls
956 sc files=ls
953 for p in files.paths: # or files.p
957 for p in files.paths: # or files.p
954 print p,p.mtime
958 print p,p.mtime
955
959
956 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
960 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
957 now work again without considering the exclusion regexp -
961 now work again without considering the exclusion regexp -
958 hence, things like ',foo my/path' turn to 'foo("my/path")'
962 hence, things like ',foo my/path' turn to 'foo("my/path")'
959 instead of syntax error.
963 instead of syntax error.
960
964
961
965
962 2006-01-14 Ville Vainio <vivainio@gmail.com>
966 2006-01-14 Ville Vainio <vivainio@gmail.com>
963
967
964 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
968 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
965 ipapi decorators for python 2.4 users, options() provides access to rc
969 ipapi decorators for python 2.4 users, options() provides access to rc
966 data.
970 data.
967
971
968 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
972 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
969 as path separators (even on Linux ;-). Space character after
973 as path separators (even on Linux ;-). Space character after
970 backslash (as yielded by tab completer) is still space;
974 backslash (as yielded by tab completer) is still space;
971 "%cd long\ name" works as expected.
975 "%cd long\ name" works as expected.
972
976
973 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
977 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
974 as "chain of command", with priority. API stays the same,
978 as "chain of command", with priority. API stays the same,
975 TryNext exception raised by a hook function signals that
979 TryNext exception raised by a hook function signals that
976 current hook failed and next hook should try handling it, as
980 current hook failed and next hook should try handling it, as
977 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
981 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
978 requested configurable display hook, which is now implemented.
982 requested configurable display hook, which is now implemented.
979
983
980 2006-01-13 Ville Vainio <vivainio@gmail.com>
984 2006-01-13 Ville Vainio <vivainio@gmail.com>
981
985
982 * IPython/platutils*.py: platform specific utility functions,
986 * IPython/platutils*.py: platform specific utility functions,
983 so far only set_term_title is implemented (change terminal
987 so far only set_term_title is implemented (change terminal
984 label in windowing systems). %cd now changes the title to
988 label in windowing systems). %cd now changes the title to
985 current dir.
989 current dir.
986
990
987 * IPython/Release.py: Added myself to "authors" list,
991 * IPython/Release.py: Added myself to "authors" list,
988 had to create new files.
992 had to create new files.
989
993
990 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
994 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
991 shell escape; not a known bug but had potential to be one in the
995 shell escape; not a known bug but had potential to be one in the
992 future.
996 future.
993
997
994 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
998 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
995 extension API for IPython! See the module for usage example. Fix
999 extension API for IPython! See the module for usage example. Fix
996 OInspect for docstring-less magic functions.
1000 OInspect for docstring-less magic functions.
997
1001
998
1002
999 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1003 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1000
1004
1001 * IPython/iplib.py (raw_input): temporarily deactivate all
1005 * IPython/iplib.py (raw_input): temporarily deactivate all
1002 attempts at allowing pasting of code with autoindent on. It
1006 attempts at allowing pasting of code with autoindent on. It
1003 introduced bugs (reported by Prabhu) and I can't seem to find a
1007 introduced bugs (reported by Prabhu) and I can't seem to find a
1004 robust combination which works in all cases. Will have to revisit
1008 robust combination which works in all cases. Will have to revisit
1005 later.
1009 later.
1006
1010
1007 * IPython/genutils.py: remove isspace() function. We've dropped
1011 * IPython/genutils.py: remove isspace() function. We've dropped
1008 2.2 compatibility, so it's OK to use the string method.
1012 2.2 compatibility, so it's OK to use the string method.
1009
1013
1010 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1014 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1011
1015
1012 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1016 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1013 matching what NOT to autocall on, to include all python binary
1017 matching what NOT to autocall on, to include all python binary
1014 operators (including things like 'and', 'or', 'is' and 'in').
1018 operators (including things like 'and', 'or', 'is' and 'in').
1015 Prompted by a bug report on 'foo & bar', but I realized we had
1019 Prompted by a bug report on 'foo & bar', but I realized we had
1016 many more potential bug cases with other operators. The regexp is
1020 many more potential bug cases with other operators. The regexp is
1017 self.re_exclude_auto, it's fairly commented.
1021 self.re_exclude_auto, it's fairly commented.
1018
1022
1019 2006-01-12 Ville Vainio <vivainio@gmail.com>
1023 2006-01-12 Ville Vainio <vivainio@gmail.com>
1020
1024
1021 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1025 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1022 Prettified and hardened string/backslash quoting with ipsystem(),
1026 Prettified and hardened string/backslash quoting with ipsystem(),
1023 ipalias() and ipmagic(). Now even \ characters are passed to
1027 ipalias() and ipmagic(). Now even \ characters are passed to
1024 %magics, !shell escapes and aliases exactly as they are in the
1028 %magics, !shell escapes and aliases exactly as they are in the
1025 ipython command line. Should improve backslash experience,
1029 ipython command line. Should improve backslash experience,
1026 particularly in Windows (path delimiter for some commands that
1030 particularly in Windows (path delimiter for some commands that
1027 won't understand '/'), but Unix benefits as well (regexps). %cd
1031 won't understand '/'), but Unix benefits as well (regexps). %cd
1028 magic still doesn't support backslash path delimiters, though. Also
1032 magic still doesn't support backslash path delimiters, though. Also
1029 deleted all pretense of supporting multiline command strings in
1033 deleted all pretense of supporting multiline command strings in
1030 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1034 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1031
1035
1032 * doc/build_doc_instructions.txt added. Documentation on how to
1036 * doc/build_doc_instructions.txt added. Documentation on how to
1033 use doc/update_manual.py, added yesterday. Both files contributed
1037 use doc/update_manual.py, added yesterday. Both files contributed
1034 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1038 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1035 doc/*.sh for deprecation at a later date.
1039 doc/*.sh for deprecation at a later date.
1036
1040
1037 * /ipython.py Added ipython.py to root directory for
1041 * /ipython.py Added ipython.py to root directory for
1038 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1042 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1039 ipython.py) and development convenience (no need to keep doing
1043 ipython.py) and development convenience (no need to keep doing
1040 "setup.py install" between changes).
1044 "setup.py install" between changes).
1041
1045
1042 * Made ! and !! shell escapes work (again) in multiline expressions:
1046 * Made ! and !! shell escapes work (again) in multiline expressions:
1043 if 1:
1047 if 1:
1044 !ls
1048 !ls
1045 !!ls
1049 !!ls
1046
1050
1047 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1051 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1048
1052
1049 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1053 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1050 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1054 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1051 module in case-insensitive installation. Was causing crashes
1055 module in case-insensitive installation. Was causing crashes
1052 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1056 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1053
1057
1054 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1058 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1055 <marienz-AT-gentoo.org>, closes
1059 <marienz-AT-gentoo.org>, closes
1056 http://www.scipy.net/roundup/ipython/issue51.
1060 http://www.scipy.net/roundup/ipython/issue51.
1057
1061
1058 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1062 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1059
1063
1060 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1064 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1061 problem of excessive CPU usage under *nix and keyboard lag under
1065 problem of excessive CPU usage under *nix and keyboard lag under
1062 win32.
1066 win32.
1063
1067
1064 2006-01-10 *** Released version 0.7.0
1068 2006-01-10 *** Released version 0.7.0
1065
1069
1066 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1070 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1067
1071
1068 * IPython/Release.py (revision): tag version number to 0.7.0,
1072 * IPython/Release.py (revision): tag version number to 0.7.0,
1069 ready for release.
1073 ready for release.
1070
1074
1071 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1075 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1072 it informs the user of the name of the temp. file used. This can
1076 it informs the user of the name of the temp. file used. This can
1073 help if you decide later to reuse that same file, so you know
1077 help if you decide later to reuse that same file, so you know
1074 where to copy the info from.
1078 where to copy the info from.
1075
1079
1076 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1080 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1077
1081
1078 * setup_bdist_egg.py: little script to build an egg. Added
1082 * setup_bdist_egg.py: little script to build an egg. Added
1079 support in the release tools as well.
1083 support in the release tools as well.
1080
1084
1081 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1085 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1082
1086
1083 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1087 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1084 version selection (new -wxversion command line and ipythonrc
1088 version selection (new -wxversion command line and ipythonrc
1085 parameter). Patch contributed by Arnd Baecker
1089 parameter). Patch contributed by Arnd Baecker
1086 <arnd.baecker-AT-web.de>.
1090 <arnd.baecker-AT-web.de>.
1087
1091
1088 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1092 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1089 embedded instances, for variables defined at the interactive
1093 embedded instances, for variables defined at the interactive
1090 prompt of the embedded ipython. Reported by Arnd.
1094 prompt of the embedded ipython. Reported by Arnd.
1091
1095
1092 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1096 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1093 it can be used as a (stateful) toggle, or with a direct parameter.
1097 it can be used as a (stateful) toggle, or with a direct parameter.
1094
1098
1095 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1099 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1096 could be triggered in certain cases and cause the traceback
1100 could be triggered in certain cases and cause the traceback
1097 printer not to work.
1101 printer not to work.
1098
1102
1099 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1103 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1100
1104
1101 * IPython/iplib.py (_should_recompile): Small fix, closes
1105 * IPython/iplib.py (_should_recompile): Small fix, closes
1102 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1106 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1103
1107
1104 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1108 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1105
1109
1106 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1110 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1107 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1111 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1108 Moad for help with tracking it down.
1112 Moad for help with tracking it down.
1109
1113
1110 * IPython/iplib.py (handle_auto): fix autocall handling for
1114 * IPython/iplib.py (handle_auto): fix autocall handling for
1111 objects which support BOTH __getitem__ and __call__ (so that f [x]
1115 objects which support BOTH __getitem__ and __call__ (so that f [x]
1112 is left alone, instead of becoming f([x]) automatically).
1116 is left alone, instead of becoming f([x]) automatically).
1113
1117
1114 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1118 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1115 Ville's patch.
1119 Ville's patch.
1116
1120
1117 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1121 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1118
1122
1119 * IPython/iplib.py (handle_auto): changed autocall semantics to
1123 * IPython/iplib.py (handle_auto): changed autocall semantics to
1120 include 'smart' mode, where the autocall transformation is NOT
1124 include 'smart' mode, where the autocall transformation is NOT
1121 applied if there are no arguments on the line. This allows you to
1125 applied if there are no arguments on the line. This allows you to
1122 just type 'foo' if foo is a callable to see its internal form,
1126 just type 'foo' if foo is a callable to see its internal form,
1123 instead of having it called with no arguments (typically a
1127 instead of having it called with no arguments (typically a
1124 mistake). The old 'full' autocall still exists: for that, you
1128 mistake). The old 'full' autocall still exists: for that, you
1125 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1129 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1126
1130
1127 * IPython/completer.py (Completer.attr_matches): add
1131 * IPython/completer.py (Completer.attr_matches): add
1128 tab-completion support for Enthoughts' traits. After a report by
1132 tab-completion support for Enthoughts' traits. After a report by
1129 Arnd and a patch by Prabhu.
1133 Arnd and a patch by Prabhu.
1130
1134
1131 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1135 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1132
1136
1133 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1137 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1134 Schmolck's patch to fix inspect.getinnerframes().
1138 Schmolck's patch to fix inspect.getinnerframes().
1135
1139
1136 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1140 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1137 for embedded instances, regarding handling of namespaces and items
1141 for embedded instances, regarding handling of namespaces and items
1138 added to the __builtin__ one. Multiple embedded instances and
1142 added to the __builtin__ one. Multiple embedded instances and
1139 recursive embeddings should work better now (though I'm not sure
1143 recursive embeddings should work better now (though I'm not sure
1140 I've got all the corner cases fixed, that code is a bit of a brain
1144 I've got all the corner cases fixed, that code is a bit of a brain
1141 twister).
1145 twister).
1142
1146
1143 * IPython/Magic.py (magic_edit): added support to edit in-memory
1147 * IPython/Magic.py (magic_edit): added support to edit in-memory
1144 macros (automatically creates the necessary temp files). %edit
1148 macros (automatically creates the necessary temp files). %edit
1145 also doesn't return the file contents anymore, it's just noise.
1149 also doesn't return the file contents anymore, it's just noise.
1146
1150
1147 * IPython/completer.py (Completer.attr_matches): revert change to
1151 * IPython/completer.py (Completer.attr_matches): revert change to
1148 complete only on attributes listed in __all__. I realized it
1152 complete only on attributes listed in __all__. I realized it
1149 cripples the tab-completion system as a tool for exploring the
1153 cripples the tab-completion system as a tool for exploring the
1150 internals of unknown libraries (it renders any non-__all__
1154 internals of unknown libraries (it renders any non-__all__
1151 attribute off-limits). I got bit by this when trying to see
1155 attribute off-limits). I got bit by this when trying to see
1152 something inside the dis module.
1156 something inside the dis module.
1153
1157
1154 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1158 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1155
1159
1156 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1160 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1157 namespace for users and extension writers to hold data in. This
1161 namespace for users and extension writers to hold data in. This
1158 follows the discussion in
1162 follows the discussion in
1159 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1163 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1160
1164
1161 * IPython/completer.py (IPCompleter.complete): small patch to help
1165 * IPython/completer.py (IPCompleter.complete): small patch to help
1162 tab-completion under Emacs, after a suggestion by John Barnard
1166 tab-completion under Emacs, after a suggestion by John Barnard
1163 <barnarj-AT-ccf.org>.
1167 <barnarj-AT-ccf.org>.
1164
1168
1165 * IPython/Magic.py (Magic.extract_input_slices): added support for
1169 * IPython/Magic.py (Magic.extract_input_slices): added support for
1166 the slice notation in magics to use N-M to represent numbers N...M
1170 the slice notation in magics to use N-M to represent numbers N...M
1167 (closed endpoints). This is used by %macro and %save.
1171 (closed endpoints). This is used by %macro and %save.
1168
1172
1169 * IPython/completer.py (Completer.attr_matches): for modules which
1173 * IPython/completer.py (Completer.attr_matches): for modules which
1170 define __all__, complete only on those. After a patch by Jeffrey
1174 define __all__, complete only on those. After a patch by Jeffrey
1171 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1175 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1172 speed up this routine.
1176 speed up this routine.
1173
1177
1174 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1178 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1175 don't know if this is the end of it, but the behavior now is
1179 don't know if this is the end of it, but the behavior now is
1176 certainly much more correct. Note that coupled with macros,
1180 certainly much more correct. Note that coupled with macros,
1177 slightly surprising (at first) behavior may occur: a macro will in
1181 slightly surprising (at first) behavior may occur: a macro will in
1178 general expand to multiple lines of input, so upon exiting, the
1182 general expand to multiple lines of input, so upon exiting, the
1179 in/out counters will both be bumped by the corresponding amount
1183 in/out counters will both be bumped by the corresponding amount
1180 (as if the macro's contents had been typed interactively). Typing
1184 (as if the macro's contents had been typed interactively). Typing
1181 %hist will reveal the intermediate (silently processed) lines.
1185 %hist will reveal the intermediate (silently processed) lines.
1182
1186
1183 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1187 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1184 pickle to fail (%run was overwriting __main__ and not restoring
1188 pickle to fail (%run was overwriting __main__ and not restoring
1185 it, but pickle relies on __main__ to operate).
1189 it, but pickle relies on __main__ to operate).
1186
1190
1187 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1191 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1188 using properties, but forgot to make the main InteractiveShell
1192 using properties, but forgot to make the main InteractiveShell
1189 class a new-style class. Properties fail silently, and
1193 class a new-style class. Properties fail silently, and
1190 mysteriously, with old-style class (getters work, but
1194 mysteriously, with old-style class (getters work, but
1191 setters don't do anything).
1195 setters don't do anything).
1192
1196
1193 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1197 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1194
1198
1195 * IPython/Magic.py (magic_history): fix history reporting bug (I
1199 * IPython/Magic.py (magic_history): fix history reporting bug (I
1196 know some nasties are still there, I just can't seem to find a
1200 know some nasties are still there, I just can't seem to find a
1197 reproducible test case to track them down; the input history is
1201 reproducible test case to track them down; the input history is
1198 falling out of sync...)
1202 falling out of sync...)
1199
1203
1200 * IPython/iplib.py (handle_shell_escape): fix bug where both
1204 * IPython/iplib.py (handle_shell_escape): fix bug where both
1201 aliases and system accesses where broken for indented code (such
1205 aliases and system accesses where broken for indented code (such
1202 as loops).
1206 as loops).
1203
1207
1204 * IPython/genutils.py (shell): fix small but critical bug for
1208 * IPython/genutils.py (shell): fix small but critical bug for
1205 win32 system access.
1209 win32 system access.
1206
1210
1207 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1211 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1208
1212
1209 * IPython/iplib.py (showtraceback): remove use of the
1213 * IPython/iplib.py (showtraceback): remove use of the
1210 sys.last_{type/value/traceback} structures, which are non
1214 sys.last_{type/value/traceback} structures, which are non
1211 thread-safe.
1215 thread-safe.
1212 (_prefilter): change control flow to ensure that we NEVER
1216 (_prefilter): change control flow to ensure that we NEVER
1213 introspect objects when autocall is off. This will guarantee that
1217 introspect objects when autocall is off. This will guarantee that
1214 having an input line of the form 'x.y', where access to attribute
1218 having an input line of the form 'x.y', where access to attribute
1215 'y' has side effects, doesn't trigger the side effect TWICE. It
1219 'y' has side effects, doesn't trigger the side effect TWICE. It
1216 is important to note that, with autocall on, these side effects
1220 is important to note that, with autocall on, these side effects
1217 can still happen.
1221 can still happen.
1218 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1222 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1219 trio. IPython offers these three kinds of special calls which are
1223 trio. IPython offers these three kinds of special calls which are
1220 not python code, and it's a good thing to have their call method
1224 not python code, and it's a good thing to have their call method
1221 be accessible as pure python functions (not just special syntax at
1225 be accessible as pure python functions (not just special syntax at
1222 the command line). It gives us a better internal implementation
1226 the command line). It gives us a better internal implementation
1223 structure, as well as exposing these for user scripting more
1227 structure, as well as exposing these for user scripting more
1224 cleanly.
1228 cleanly.
1225
1229
1226 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1230 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1227 file. Now that they'll be more likely to be used with the
1231 file. Now that they'll be more likely to be used with the
1228 persistance system (%store), I want to make sure their module path
1232 persistance system (%store), I want to make sure their module path
1229 doesn't change in the future, so that we don't break things for
1233 doesn't change in the future, so that we don't break things for
1230 users' persisted data.
1234 users' persisted data.
1231
1235
1232 * IPython/iplib.py (autoindent_update): move indentation
1236 * IPython/iplib.py (autoindent_update): move indentation
1233 management into the _text_ processing loop, not the keyboard
1237 management into the _text_ processing loop, not the keyboard
1234 interactive one. This is necessary to correctly process non-typed
1238 interactive one. This is necessary to correctly process non-typed
1235 multiline input (such as macros).
1239 multiline input (such as macros).
1236
1240
1237 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1241 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1238 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1242 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1239 which was producing problems in the resulting manual.
1243 which was producing problems in the resulting manual.
1240 (magic_whos): improve reporting of instances (show their class,
1244 (magic_whos): improve reporting of instances (show their class,
1241 instead of simply printing 'instance' which isn't terribly
1245 instead of simply printing 'instance' which isn't terribly
1242 informative).
1246 informative).
1243
1247
1244 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1248 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1245 (minor mods) to support network shares under win32.
1249 (minor mods) to support network shares under win32.
1246
1250
1247 * IPython/winconsole.py (get_console_size): add new winconsole
1251 * IPython/winconsole.py (get_console_size): add new winconsole
1248 module and fixes to page_dumb() to improve its behavior under
1252 module and fixes to page_dumb() to improve its behavior under
1249 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1253 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1250
1254
1251 * IPython/Magic.py (Macro): simplified Macro class to just
1255 * IPython/Magic.py (Macro): simplified Macro class to just
1252 subclass list. We've had only 2.2 compatibility for a very long
1256 subclass list. We've had only 2.2 compatibility for a very long
1253 time, yet I was still avoiding subclassing the builtin types. No
1257 time, yet I was still avoiding subclassing the builtin types. No
1254 more (I'm also starting to use properties, though I won't shift to
1258 more (I'm also starting to use properties, though I won't shift to
1255 2.3-specific features quite yet).
1259 2.3-specific features quite yet).
1256 (magic_store): added Ville's patch for lightweight variable
1260 (magic_store): added Ville's patch for lightweight variable
1257 persistence, after a request on the user list by Matt Wilkie
1261 persistence, after a request on the user list by Matt Wilkie
1258 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1262 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1259 details.
1263 details.
1260
1264
1261 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1265 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1262 changed the default logfile name from 'ipython.log' to
1266 changed the default logfile name from 'ipython.log' to
1263 'ipython_log.py'. These logs are real python files, and now that
1267 'ipython_log.py'. These logs are real python files, and now that
1264 we have much better multiline support, people are more likely to
1268 we have much better multiline support, people are more likely to
1265 want to use them as such. Might as well name them correctly.
1269 want to use them as such. Might as well name them correctly.
1266
1270
1267 * IPython/Magic.py: substantial cleanup. While we can't stop
1271 * IPython/Magic.py: substantial cleanup. While we can't stop
1268 using magics as mixins, due to the existing customizations 'out
1272 using magics as mixins, due to the existing customizations 'out
1269 there' which rely on the mixin naming conventions, at least I
1273 there' which rely on the mixin naming conventions, at least I
1270 cleaned out all cross-class name usage. So once we are OK with
1274 cleaned out all cross-class name usage. So once we are OK with
1271 breaking compatibility, the two systems can be separated.
1275 breaking compatibility, the two systems can be separated.
1272
1276
1273 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1277 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1274 anymore, and the class is a fair bit less hideous as well. New
1278 anymore, and the class is a fair bit less hideous as well. New
1275 features were also introduced: timestamping of input, and logging
1279 features were also introduced: timestamping of input, and logging
1276 of output results. These are user-visible with the -t and -o
1280 of output results. These are user-visible with the -t and -o
1277 options to %logstart. Closes
1281 options to %logstart. Closes
1278 http://www.scipy.net/roundup/ipython/issue11 and a request by
1282 http://www.scipy.net/roundup/ipython/issue11 and a request by
1279 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1283 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1280
1284
1281 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1285 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1282
1286
1283 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1287 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1284 better handle backslashes in paths. See the thread 'More Windows
1288 better handle backslashes in paths. See the thread 'More Windows
1285 questions part 2 - \/ characters revisited' on the iypthon user
1289 questions part 2 - \/ characters revisited' on the iypthon user
1286 list:
1290 list:
1287 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1291 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1288
1292
1289 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1293 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1290
1294
1291 (InteractiveShell.__init__): change threaded shells to not use the
1295 (InteractiveShell.__init__): change threaded shells to not use the
1292 ipython crash handler. This was causing more problems than not,
1296 ipython crash handler. This was causing more problems than not,
1293 as exceptions in the main thread (GUI code, typically) would
1297 as exceptions in the main thread (GUI code, typically) would
1294 always show up as a 'crash', when they really weren't.
1298 always show up as a 'crash', when they really weren't.
1295
1299
1296 The colors and exception mode commands (%colors/%xmode) have been
1300 The colors and exception mode commands (%colors/%xmode) have been
1297 synchronized to also take this into account, so users can get
1301 synchronized to also take this into account, so users can get
1298 verbose exceptions for their threaded code as well. I also added
1302 verbose exceptions for their threaded code as well. I also added
1299 support for activating pdb inside this exception handler as well,
1303 support for activating pdb inside this exception handler as well,
1300 so now GUI authors can use IPython's enhanced pdb at runtime.
1304 so now GUI authors can use IPython's enhanced pdb at runtime.
1301
1305
1302 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1306 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1303 true by default, and add it to the shipped ipythonrc file. Since
1307 true by default, and add it to the shipped ipythonrc file. Since
1304 this asks the user before proceeding, I think it's OK to make it
1308 this asks the user before proceeding, I think it's OK to make it
1305 true by default.
1309 true by default.
1306
1310
1307 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1311 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1308 of the previous special-casing of input in the eval loop. I think
1312 of the previous special-casing of input in the eval loop. I think
1309 this is cleaner, as they really are commands and shouldn't have
1313 this is cleaner, as they really are commands and shouldn't have
1310 a special role in the middle of the core code.
1314 a special role in the middle of the core code.
1311
1315
1312 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1316 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1313
1317
1314 * IPython/iplib.py (edit_syntax_error): added support for
1318 * IPython/iplib.py (edit_syntax_error): added support for
1315 automatically reopening the editor if the file had a syntax error
1319 automatically reopening the editor if the file had a syntax error
1316 in it. Thanks to scottt who provided the patch at:
1320 in it. Thanks to scottt who provided the patch at:
1317 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1321 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1318 version committed).
1322 version committed).
1319
1323
1320 * IPython/iplib.py (handle_normal): add suport for multi-line
1324 * IPython/iplib.py (handle_normal): add suport for multi-line
1321 input with emtpy lines. This fixes
1325 input with emtpy lines. This fixes
1322 http://www.scipy.net/roundup/ipython/issue43 and a similar
1326 http://www.scipy.net/roundup/ipython/issue43 and a similar
1323 discussion on the user list.
1327 discussion on the user list.
1324
1328
1325 WARNING: a behavior change is necessarily introduced to support
1329 WARNING: a behavior change is necessarily introduced to support
1326 blank lines: now a single blank line with whitespace does NOT
1330 blank lines: now a single blank line with whitespace does NOT
1327 break the input loop, which means that when autoindent is on, by
1331 break the input loop, which means that when autoindent is on, by
1328 default hitting return on the next (indented) line does NOT exit.
1332 default hitting return on the next (indented) line does NOT exit.
1329
1333
1330 Instead, to exit a multiline input you can either have:
1334 Instead, to exit a multiline input you can either have:
1331
1335
1332 - TWO whitespace lines (just hit return again), or
1336 - TWO whitespace lines (just hit return again), or
1333 - a single whitespace line of a different length than provided
1337 - a single whitespace line of a different length than provided
1334 by the autoindent (add or remove a space).
1338 by the autoindent (add or remove a space).
1335
1339
1336 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1340 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1337 module to better organize all readline-related functionality.
1341 module to better organize all readline-related functionality.
1338 I've deleted FlexCompleter and put all completion clases here.
1342 I've deleted FlexCompleter and put all completion clases here.
1339
1343
1340 * IPython/iplib.py (raw_input): improve indentation management.
1344 * IPython/iplib.py (raw_input): improve indentation management.
1341 It is now possible to paste indented code with autoindent on, and
1345 It is now possible to paste indented code with autoindent on, and
1342 the code is interpreted correctly (though it still looks bad on
1346 the code is interpreted correctly (though it still looks bad on
1343 screen, due to the line-oriented nature of ipython).
1347 screen, due to the line-oriented nature of ipython).
1344 (MagicCompleter.complete): change behavior so that a TAB key on an
1348 (MagicCompleter.complete): change behavior so that a TAB key on an
1345 otherwise empty line actually inserts a tab, instead of completing
1349 otherwise empty line actually inserts a tab, instead of completing
1346 on the entire global namespace. This makes it easier to use the
1350 on the entire global namespace. This makes it easier to use the
1347 TAB key for indentation. After a request by Hans Meine
1351 TAB key for indentation. After a request by Hans Meine
1348 <hans_meine-AT-gmx.net>
1352 <hans_meine-AT-gmx.net>
1349 (_prefilter): add support so that typing plain 'exit' or 'quit'
1353 (_prefilter): add support so that typing plain 'exit' or 'quit'
1350 does a sensible thing. Originally I tried to deviate as little as
1354 does a sensible thing. Originally I tried to deviate as little as
1351 possible from the default python behavior, but even that one may
1355 possible from the default python behavior, but even that one may
1352 change in this direction (thread on python-dev to that effect).
1356 change in this direction (thread on python-dev to that effect).
1353 Regardless, ipython should do the right thing even if CPython's
1357 Regardless, ipython should do the right thing even if CPython's
1354 '>>>' prompt doesn't.
1358 '>>>' prompt doesn't.
1355 (InteractiveShell): removed subclassing code.InteractiveConsole
1359 (InteractiveShell): removed subclassing code.InteractiveConsole
1356 class. By now we'd overridden just about all of its methods: I've
1360 class. By now we'd overridden just about all of its methods: I've
1357 copied the remaining two over, and now ipython is a standalone
1361 copied the remaining two over, and now ipython is a standalone
1358 class. This will provide a clearer picture for the chainsaw
1362 class. This will provide a clearer picture for the chainsaw
1359 branch refactoring.
1363 branch refactoring.
1360
1364
1361 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1365 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1362
1366
1363 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1367 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1364 failures for objects which break when dir() is called on them.
1368 failures for objects which break when dir() is called on them.
1365
1369
1366 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1370 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1367 distinct local and global namespaces in the completer API. This
1371 distinct local and global namespaces in the completer API. This
1368 change allows us to properly handle completion with distinct
1372 change allows us to properly handle completion with distinct
1369 scopes, including in embedded instances (this had never really
1373 scopes, including in embedded instances (this had never really
1370 worked correctly).
1374 worked correctly).
1371
1375
1372 Note: this introduces a change in the constructor for
1376 Note: this introduces a change in the constructor for
1373 MagicCompleter, as a new global_namespace parameter is now the
1377 MagicCompleter, as a new global_namespace parameter is now the
1374 second argument (the others were bumped one position).
1378 second argument (the others were bumped one position).
1375
1379
1376 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1380 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1377
1381
1378 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1382 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1379 embedded instances (which can be done now thanks to Vivian's
1383 embedded instances (which can be done now thanks to Vivian's
1380 frame-handling fixes for pdb).
1384 frame-handling fixes for pdb).
1381 (InteractiveShell.__init__): Fix namespace handling problem in
1385 (InteractiveShell.__init__): Fix namespace handling problem in
1382 embedded instances. We were overwriting __main__ unconditionally,
1386 embedded instances. We were overwriting __main__ unconditionally,
1383 and this should only be done for 'full' (non-embedded) IPython;
1387 and this should only be done for 'full' (non-embedded) IPython;
1384 embedded instances must respect the caller's __main__. Thanks to
1388 embedded instances must respect the caller's __main__. Thanks to
1385 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1389 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1386
1390
1387 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1391 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1388
1392
1389 * setup.py: added download_url to setup(). This registers the
1393 * setup.py: added download_url to setup(). This registers the
1390 download address at PyPI, which is not only useful to humans
1394 download address at PyPI, which is not only useful to humans
1391 browsing the site, but is also picked up by setuptools (the Eggs
1395 browsing the site, but is also picked up by setuptools (the Eggs
1392 machinery). Thanks to Ville and R. Kern for the info/discussion
1396 machinery). Thanks to Ville and R. Kern for the info/discussion
1393 on this.
1397 on this.
1394
1398
1395 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1399 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1396
1400
1397 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1401 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1398 This brings a lot of nice functionality to the pdb mode, which now
1402 This brings a lot of nice functionality to the pdb mode, which now
1399 has tab-completion, syntax highlighting, and better stack handling
1403 has tab-completion, syntax highlighting, and better stack handling
1400 than before. Many thanks to Vivian De Smedt
1404 than before. Many thanks to Vivian De Smedt
1401 <vivian-AT-vdesmedt.com> for the original patches.
1405 <vivian-AT-vdesmedt.com> for the original patches.
1402
1406
1403 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1407 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1404
1408
1405 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1409 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1406 sequence to consistently accept the banner argument. The
1410 sequence to consistently accept the banner argument. The
1407 inconsistency was tripping SAGE, thanks to Gary Zablackis
1411 inconsistency was tripping SAGE, thanks to Gary Zablackis
1408 <gzabl-AT-yahoo.com> for the report.
1412 <gzabl-AT-yahoo.com> for the report.
1409
1413
1410 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1414 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1411
1415
1412 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1416 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1413 Fix bug where a naked 'alias' call in the ipythonrc file would
1417 Fix bug where a naked 'alias' call in the ipythonrc file would
1414 cause a crash. Bug reported by Jorgen Stenarson.
1418 cause a crash. Bug reported by Jorgen Stenarson.
1415
1419
1416 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1420 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1417
1421
1418 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1422 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1419 startup time.
1423 startup time.
1420
1424
1421 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1425 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1422 instances had introduced a bug with globals in normal code. Now
1426 instances had introduced a bug with globals in normal code. Now
1423 it's working in all cases.
1427 it's working in all cases.
1424
1428
1425 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1429 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1426 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1430 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1427 has been introduced to set the default case sensitivity of the
1431 has been introduced to set the default case sensitivity of the
1428 searches. Users can still select either mode at runtime on a
1432 searches. Users can still select either mode at runtime on a
1429 per-search basis.
1433 per-search basis.
1430
1434
1431 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1435 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1432
1436
1433 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1437 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1434 attributes in wildcard searches for subclasses. Modified version
1438 attributes in wildcard searches for subclasses. Modified version
1435 of a patch by Jorgen.
1439 of a patch by Jorgen.
1436
1440
1437 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1441 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1438
1442
1439 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1443 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1440 embedded instances. I added a user_global_ns attribute to the
1444 embedded instances. I added a user_global_ns attribute to the
1441 InteractiveShell class to handle this.
1445 InteractiveShell class to handle this.
1442
1446
1443 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1447 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1444
1448
1445 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1449 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1446 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1450 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1447 (reported under win32, but may happen also in other platforms).
1451 (reported under win32, but may happen also in other platforms).
1448 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1452 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1449
1453
1450 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1454 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1451
1455
1452 * IPython/Magic.py (magic_psearch): new support for wildcard
1456 * IPython/Magic.py (magic_psearch): new support for wildcard
1453 patterns. Now, typing ?a*b will list all names which begin with a
1457 patterns. Now, typing ?a*b will list all names which begin with a
1454 and end in b, for example. The %psearch magic has full
1458 and end in b, for example. The %psearch magic has full
1455 docstrings. Many thanks to JΓΆrgen Stenarson
1459 docstrings. Many thanks to JΓΆrgen Stenarson
1456 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1460 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1457 implementing this functionality.
1461 implementing this functionality.
1458
1462
1459 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1463 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1460
1464
1461 * Manual: fixed long-standing annoyance of double-dashes (as in
1465 * Manual: fixed long-standing annoyance of double-dashes (as in
1462 --prefix=~, for example) being stripped in the HTML version. This
1466 --prefix=~, for example) being stripped in the HTML version. This
1463 is a latex2html bug, but a workaround was provided. Many thanks
1467 is a latex2html bug, but a workaround was provided. Many thanks
1464 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1468 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1465 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1469 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1466 rolling. This seemingly small issue had tripped a number of users
1470 rolling. This seemingly small issue had tripped a number of users
1467 when first installing, so I'm glad to see it gone.
1471 when first installing, so I'm glad to see it gone.
1468
1472
1469 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1473 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1470
1474
1471 * IPython/Extensions/numeric_formats.py: fix missing import,
1475 * IPython/Extensions/numeric_formats.py: fix missing import,
1472 reported by Stephen Walton.
1476 reported by Stephen Walton.
1473
1477
1474 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1478 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1475
1479
1476 * IPython/demo.py: finish demo module, fully documented now.
1480 * IPython/demo.py: finish demo module, fully documented now.
1477
1481
1478 * IPython/genutils.py (file_read): simple little utility to read a
1482 * IPython/genutils.py (file_read): simple little utility to read a
1479 file and ensure it's closed afterwards.
1483 file and ensure it's closed afterwards.
1480
1484
1481 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1485 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1482
1486
1483 * IPython/demo.py (Demo.__init__): added support for individually
1487 * IPython/demo.py (Demo.__init__): added support for individually
1484 tagging blocks for automatic execution.
1488 tagging blocks for automatic execution.
1485
1489
1486 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1490 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1487 syntax-highlighted python sources, requested by John.
1491 syntax-highlighted python sources, requested by John.
1488
1492
1489 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1493 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1490
1494
1491 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1495 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1492 finishing.
1496 finishing.
1493
1497
1494 * IPython/genutils.py (shlex_split): moved from Magic to here,
1498 * IPython/genutils.py (shlex_split): moved from Magic to here,
1495 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1499 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1496
1500
1497 * IPython/demo.py (Demo.__init__): added support for silent
1501 * IPython/demo.py (Demo.__init__): added support for silent
1498 blocks, improved marks as regexps, docstrings written.
1502 blocks, improved marks as regexps, docstrings written.
1499 (Demo.__init__): better docstring, added support for sys.argv.
1503 (Demo.__init__): better docstring, added support for sys.argv.
1500
1504
1501 * IPython/genutils.py (marquee): little utility used by the demo
1505 * IPython/genutils.py (marquee): little utility used by the demo
1502 code, handy in general.
1506 code, handy in general.
1503
1507
1504 * IPython/demo.py (Demo.__init__): new class for interactive
1508 * IPython/demo.py (Demo.__init__): new class for interactive
1505 demos. Not documented yet, I just wrote it in a hurry for
1509 demos. Not documented yet, I just wrote it in a hurry for
1506 scipy'05. Will docstring later.
1510 scipy'05. Will docstring later.
1507
1511
1508 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1512 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1509
1513
1510 * IPython/Shell.py (sigint_handler): Drastic simplification which
1514 * IPython/Shell.py (sigint_handler): Drastic simplification which
1511 also seems to make Ctrl-C work correctly across threads! This is
1515 also seems to make Ctrl-C work correctly across threads! This is
1512 so simple, that I can't beleive I'd missed it before. Needs more
1516 so simple, that I can't beleive I'd missed it before. Needs more
1513 testing, though.
1517 testing, though.
1514 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1518 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1515 like this before...
1519 like this before...
1516
1520
1517 * IPython/genutils.py (get_home_dir): add protection against
1521 * IPython/genutils.py (get_home_dir): add protection against
1518 non-dirs in win32 registry.
1522 non-dirs in win32 registry.
1519
1523
1520 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1524 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1521 bug where dict was mutated while iterating (pysh crash).
1525 bug where dict was mutated while iterating (pysh crash).
1522
1526
1523 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1527 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1524
1528
1525 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1529 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1526 spurious newlines added by this routine. After a report by
1530 spurious newlines added by this routine. After a report by
1527 F. Mantegazza.
1531 F. Mantegazza.
1528
1532
1529 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1533 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1530
1534
1531 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1535 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1532 calls. These were a leftover from the GTK 1.x days, and can cause
1536 calls. These were a leftover from the GTK 1.x days, and can cause
1533 problems in certain cases (after a report by John Hunter).
1537 problems in certain cases (after a report by John Hunter).
1534
1538
1535 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1539 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1536 os.getcwd() fails at init time. Thanks to patch from David Remahl
1540 os.getcwd() fails at init time. Thanks to patch from David Remahl
1537 <chmod007-AT-mac.com>.
1541 <chmod007-AT-mac.com>.
1538 (InteractiveShell.__init__): prevent certain special magics from
1542 (InteractiveShell.__init__): prevent certain special magics from
1539 being shadowed by aliases. Closes
1543 being shadowed by aliases. Closes
1540 http://www.scipy.net/roundup/ipython/issue41.
1544 http://www.scipy.net/roundup/ipython/issue41.
1541
1545
1542 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1546 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1543
1547
1544 * IPython/iplib.py (InteractiveShell.complete): Added new
1548 * IPython/iplib.py (InteractiveShell.complete): Added new
1545 top-level completion method to expose the completion mechanism
1549 top-level completion method to expose the completion mechanism
1546 beyond readline-based environments.
1550 beyond readline-based environments.
1547
1551
1548 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1552 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1549
1553
1550 * tools/ipsvnc (svnversion): fix svnversion capture.
1554 * tools/ipsvnc (svnversion): fix svnversion capture.
1551
1555
1552 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1556 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1553 attribute to self, which was missing. Before, it was set by a
1557 attribute to self, which was missing. Before, it was set by a
1554 routine which in certain cases wasn't being called, so the
1558 routine which in certain cases wasn't being called, so the
1555 instance could end up missing the attribute. This caused a crash.
1559 instance could end up missing the attribute. This caused a crash.
1556 Closes http://www.scipy.net/roundup/ipython/issue40.
1560 Closes http://www.scipy.net/roundup/ipython/issue40.
1557
1561
1558 2005-08-16 Fernando Perez <fperez@colorado.edu>
1562 2005-08-16 Fernando Perez <fperez@colorado.edu>
1559
1563
1560 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1564 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1561 contains non-string attribute. Closes
1565 contains non-string attribute. Closes
1562 http://www.scipy.net/roundup/ipython/issue38.
1566 http://www.scipy.net/roundup/ipython/issue38.
1563
1567
1564 2005-08-14 Fernando Perez <fperez@colorado.edu>
1568 2005-08-14 Fernando Perez <fperez@colorado.edu>
1565
1569
1566 * tools/ipsvnc: Minor improvements, to add changeset info.
1570 * tools/ipsvnc: Minor improvements, to add changeset info.
1567
1571
1568 2005-08-12 Fernando Perez <fperez@colorado.edu>
1572 2005-08-12 Fernando Perez <fperez@colorado.edu>
1569
1573
1570 * IPython/iplib.py (runsource): remove self.code_to_run_src
1574 * IPython/iplib.py (runsource): remove self.code_to_run_src
1571 attribute. I realized this is nothing more than
1575 attribute. I realized this is nothing more than
1572 '\n'.join(self.buffer), and having the same data in two different
1576 '\n'.join(self.buffer), and having the same data in two different
1573 places is just asking for synchronization bugs. This may impact
1577 places is just asking for synchronization bugs. This may impact
1574 people who have custom exception handlers, so I need to warn
1578 people who have custom exception handlers, so I need to warn
1575 ipython-dev about it (F. Mantegazza may use them).
1579 ipython-dev about it (F. Mantegazza may use them).
1576
1580
1577 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1581 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1578
1582
1579 * IPython/genutils.py: fix 2.2 compatibility (generators)
1583 * IPython/genutils.py: fix 2.2 compatibility (generators)
1580
1584
1581 2005-07-18 Fernando Perez <fperez@colorado.edu>
1585 2005-07-18 Fernando Perez <fperez@colorado.edu>
1582
1586
1583 * IPython/genutils.py (get_home_dir): fix to help users with
1587 * IPython/genutils.py (get_home_dir): fix to help users with
1584 invalid $HOME under win32.
1588 invalid $HOME under win32.
1585
1589
1586 2005-07-17 Fernando Perez <fperez@colorado.edu>
1590 2005-07-17 Fernando Perez <fperez@colorado.edu>
1587
1591
1588 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1592 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1589 some old hacks and clean up a bit other routines; code should be
1593 some old hacks and clean up a bit other routines; code should be
1590 simpler and a bit faster.
1594 simpler and a bit faster.
1591
1595
1592 * IPython/iplib.py (interact): removed some last-resort attempts
1596 * IPython/iplib.py (interact): removed some last-resort attempts
1593 to survive broken stdout/stderr. That code was only making it
1597 to survive broken stdout/stderr. That code was only making it
1594 harder to abstract out the i/o (necessary for gui integration),
1598 harder to abstract out the i/o (necessary for gui integration),
1595 and the crashes it could prevent were extremely rare in practice
1599 and the crashes it could prevent were extremely rare in practice
1596 (besides being fully user-induced in a pretty violent manner).
1600 (besides being fully user-induced in a pretty violent manner).
1597
1601
1598 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1602 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1599 Nothing major yet, but the code is simpler to read; this should
1603 Nothing major yet, but the code is simpler to read; this should
1600 make it easier to do more serious modifications in the future.
1604 make it easier to do more serious modifications in the future.
1601
1605
1602 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1606 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1603 which broke in .15 (thanks to a report by Ville).
1607 which broke in .15 (thanks to a report by Ville).
1604
1608
1605 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1609 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1606 be quite correct, I know next to nothing about unicode). This
1610 be quite correct, I know next to nothing about unicode). This
1607 will allow unicode strings to be used in prompts, amongst other
1611 will allow unicode strings to be used in prompts, amongst other
1608 cases. It also will prevent ipython from crashing when unicode
1612 cases. It also will prevent ipython from crashing when unicode
1609 shows up unexpectedly in many places. If ascii encoding fails, we
1613 shows up unexpectedly in many places. If ascii encoding fails, we
1610 assume utf_8. Currently the encoding is not a user-visible
1614 assume utf_8. Currently the encoding is not a user-visible
1611 setting, though it could be made so if there is demand for it.
1615 setting, though it could be made so if there is demand for it.
1612
1616
1613 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1617 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1614
1618
1615 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1619 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1616
1620
1617 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1621 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1618
1622
1619 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1623 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1620 code can work transparently for 2.2/2.3.
1624 code can work transparently for 2.2/2.3.
1621
1625
1622 2005-07-16 Fernando Perez <fperez@colorado.edu>
1626 2005-07-16 Fernando Perez <fperez@colorado.edu>
1623
1627
1624 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1628 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1625 out of the color scheme table used for coloring exception
1629 out of the color scheme table used for coloring exception
1626 tracebacks. This allows user code to add new schemes at runtime.
1630 tracebacks. This allows user code to add new schemes at runtime.
1627 This is a minimally modified version of the patch at
1631 This is a minimally modified version of the patch at
1628 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1632 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1629 for the contribution.
1633 for the contribution.
1630
1634
1631 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1635 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1632 slightly modified version of the patch in
1636 slightly modified version of the patch in
1633 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1637 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1634 to remove the previous try/except solution (which was costlier).
1638 to remove the previous try/except solution (which was costlier).
1635 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1639 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1636
1640
1637 2005-06-08 Fernando Perez <fperez@colorado.edu>
1641 2005-06-08 Fernando Perez <fperez@colorado.edu>
1638
1642
1639 * IPython/iplib.py (write/write_err): Add methods to abstract all
1643 * IPython/iplib.py (write/write_err): Add methods to abstract all
1640 I/O a bit more.
1644 I/O a bit more.
1641
1645
1642 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1646 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1643 warning, reported by Aric Hagberg, fix by JD Hunter.
1647 warning, reported by Aric Hagberg, fix by JD Hunter.
1644
1648
1645 2005-06-02 *** Released version 0.6.15
1649 2005-06-02 *** Released version 0.6.15
1646
1650
1647 2005-06-01 Fernando Perez <fperez@colorado.edu>
1651 2005-06-01 Fernando Perez <fperez@colorado.edu>
1648
1652
1649 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1653 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1650 tab-completion of filenames within open-quoted strings. Note that
1654 tab-completion of filenames within open-quoted strings. Note that
1651 this requires that in ~/.ipython/ipythonrc, users change the
1655 this requires that in ~/.ipython/ipythonrc, users change the
1652 readline delimiters configuration to read:
1656 readline delimiters configuration to read:
1653
1657
1654 readline_remove_delims -/~
1658 readline_remove_delims -/~
1655
1659
1656
1660
1657 2005-05-31 *** Released version 0.6.14
1661 2005-05-31 *** Released version 0.6.14
1658
1662
1659 2005-05-29 Fernando Perez <fperez@colorado.edu>
1663 2005-05-29 Fernando Perez <fperez@colorado.edu>
1660
1664
1661 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1665 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1662 with files not on the filesystem. Reported by Eliyahu Sandler
1666 with files not on the filesystem. Reported by Eliyahu Sandler
1663 <eli@gondolin.net>
1667 <eli@gondolin.net>
1664
1668
1665 2005-05-22 Fernando Perez <fperez@colorado.edu>
1669 2005-05-22 Fernando Perez <fperez@colorado.edu>
1666
1670
1667 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1671 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1668 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1672 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1669
1673
1670 2005-05-19 Fernando Perez <fperez@colorado.edu>
1674 2005-05-19 Fernando Perez <fperez@colorado.edu>
1671
1675
1672 * IPython/iplib.py (safe_execfile): close a file which could be
1676 * IPython/iplib.py (safe_execfile): close a file which could be
1673 left open (causing problems in win32, which locks open files).
1677 left open (causing problems in win32, which locks open files).
1674 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1678 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1675
1679
1676 2005-05-18 Fernando Perez <fperez@colorado.edu>
1680 2005-05-18 Fernando Perez <fperez@colorado.edu>
1677
1681
1678 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1682 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1679 keyword arguments correctly to safe_execfile().
1683 keyword arguments correctly to safe_execfile().
1680
1684
1681 2005-05-13 Fernando Perez <fperez@colorado.edu>
1685 2005-05-13 Fernando Perez <fperez@colorado.edu>
1682
1686
1683 * ipython.1: Added info about Qt to manpage, and threads warning
1687 * ipython.1: Added info about Qt to manpage, and threads warning
1684 to usage page (invoked with --help).
1688 to usage page (invoked with --help).
1685
1689
1686 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1690 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1687 new matcher (it goes at the end of the priority list) to do
1691 new matcher (it goes at the end of the priority list) to do
1688 tab-completion on named function arguments. Submitted by George
1692 tab-completion on named function arguments. Submitted by George
1689 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1693 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1690 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1694 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1691 for more details.
1695 for more details.
1692
1696
1693 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1697 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1694 SystemExit exceptions in the script being run. Thanks to a report
1698 SystemExit exceptions in the script being run. Thanks to a report
1695 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1699 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1696 producing very annoying behavior when running unit tests.
1700 producing very annoying behavior when running unit tests.
1697
1701
1698 2005-05-12 Fernando Perez <fperez@colorado.edu>
1702 2005-05-12 Fernando Perez <fperez@colorado.edu>
1699
1703
1700 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1704 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1701 which I'd broken (again) due to a changed regexp. In the process,
1705 which I'd broken (again) due to a changed regexp. In the process,
1702 added ';' as an escape to auto-quote the whole line without
1706 added ';' as an escape to auto-quote the whole line without
1703 splitting its arguments. Thanks to a report by Jerry McRae
1707 splitting its arguments. Thanks to a report by Jerry McRae
1704 <qrs0xyc02-AT-sneakemail.com>.
1708 <qrs0xyc02-AT-sneakemail.com>.
1705
1709
1706 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1710 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1707 possible crashes caused by a TokenError. Reported by Ed Schofield
1711 possible crashes caused by a TokenError. Reported by Ed Schofield
1708 <schofield-AT-ftw.at>.
1712 <schofield-AT-ftw.at>.
1709
1713
1710 2005-05-06 Fernando Perez <fperez@colorado.edu>
1714 2005-05-06 Fernando Perez <fperez@colorado.edu>
1711
1715
1712 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1716 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1713
1717
1714 2005-04-29 Fernando Perez <fperez@colorado.edu>
1718 2005-04-29 Fernando Perez <fperez@colorado.edu>
1715
1719
1716 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1720 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1717 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1721 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1718 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1722 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1719 which provides support for Qt interactive usage (similar to the
1723 which provides support for Qt interactive usage (similar to the
1720 existing one for WX and GTK). This had been often requested.
1724 existing one for WX and GTK). This had been often requested.
1721
1725
1722 2005-04-14 *** Released version 0.6.13
1726 2005-04-14 *** Released version 0.6.13
1723
1727
1724 2005-04-08 Fernando Perez <fperez@colorado.edu>
1728 2005-04-08 Fernando Perez <fperez@colorado.edu>
1725
1729
1726 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1730 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1727 from _ofind, which gets called on almost every input line. Now,
1731 from _ofind, which gets called on almost every input line. Now,
1728 we only try to get docstrings if they are actually going to be
1732 we only try to get docstrings if they are actually going to be
1729 used (the overhead of fetching unnecessary docstrings can be
1733 used (the overhead of fetching unnecessary docstrings can be
1730 noticeable for certain objects, such as Pyro proxies).
1734 noticeable for certain objects, such as Pyro proxies).
1731
1735
1732 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1736 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1733 for completers. For some reason I had been passing them the state
1737 for completers. For some reason I had been passing them the state
1734 variable, which completers never actually need, and was in
1738 variable, which completers never actually need, and was in
1735 conflict with the rlcompleter API. Custom completers ONLY need to
1739 conflict with the rlcompleter API. Custom completers ONLY need to
1736 take the text parameter.
1740 take the text parameter.
1737
1741
1738 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1742 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1739 work correctly in pysh. I've also moved all the logic which used
1743 work correctly in pysh. I've also moved all the logic which used
1740 to be in pysh.py here, which will prevent problems with future
1744 to be in pysh.py here, which will prevent problems with future
1741 upgrades. However, this time I must warn users to update their
1745 upgrades. However, this time I must warn users to update their
1742 pysh profile to include the line
1746 pysh profile to include the line
1743
1747
1744 import_all IPython.Extensions.InterpreterExec
1748 import_all IPython.Extensions.InterpreterExec
1745
1749
1746 because otherwise things won't work for them. They MUST also
1750 because otherwise things won't work for them. They MUST also
1747 delete pysh.py and the line
1751 delete pysh.py and the line
1748
1752
1749 execfile pysh.py
1753 execfile pysh.py
1750
1754
1751 from their ipythonrc-pysh.
1755 from their ipythonrc-pysh.
1752
1756
1753 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1757 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1754 robust in the face of objects whose dir() returns non-strings
1758 robust in the face of objects whose dir() returns non-strings
1755 (which it shouldn't, but some broken libs like ITK do). Thanks to
1759 (which it shouldn't, but some broken libs like ITK do). Thanks to
1756 a patch by John Hunter (implemented differently, though). Also
1760 a patch by John Hunter (implemented differently, though). Also
1757 minor improvements by using .extend instead of + on lists.
1761 minor improvements by using .extend instead of + on lists.
1758
1762
1759 * pysh.py:
1763 * pysh.py:
1760
1764
1761 2005-04-06 Fernando Perez <fperez@colorado.edu>
1765 2005-04-06 Fernando Perez <fperez@colorado.edu>
1762
1766
1763 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1767 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1764 by default, so that all users benefit from it. Those who don't
1768 by default, so that all users benefit from it. Those who don't
1765 want it can still turn it off.
1769 want it can still turn it off.
1766
1770
1767 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1771 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1768 config file, I'd forgotten about this, so users were getting it
1772 config file, I'd forgotten about this, so users were getting it
1769 off by default.
1773 off by default.
1770
1774
1771 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1775 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1772 consistency. Now magics can be called in multiline statements,
1776 consistency. Now magics can be called in multiline statements,
1773 and python variables can be expanded in magic calls via $var.
1777 and python variables can be expanded in magic calls via $var.
1774 This makes the magic system behave just like aliases or !system
1778 This makes the magic system behave just like aliases or !system
1775 calls.
1779 calls.
1776
1780
1777 2005-03-28 Fernando Perez <fperez@colorado.edu>
1781 2005-03-28 Fernando Perez <fperez@colorado.edu>
1778
1782
1779 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1783 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1780 expensive string additions for building command. Add support for
1784 expensive string additions for building command. Add support for
1781 trailing ';' when autocall is used.
1785 trailing ';' when autocall is used.
1782
1786
1783 2005-03-26 Fernando Perez <fperez@colorado.edu>
1787 2005-03-26 Fernando Perez <fperez@colorado.edu>
1784
1788
1785 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1789 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1786 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1790 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1787 ipython.el robust against prompts with any number of spaces
1791 ipython.el robust against prompts with any number of spaces
1788 (including 0) after the ':' character.
1792 (including 0) after the ':' character.
1789
1793
1790 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1794 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1791 continuation prompt, which misled users to think the line was
1795 continuation prompt, which misled users to think the line was
1792 already indented. Closes debian Bug#300847, reported to me by
1796 already indented. Closes debian Bug#300847, reported to me by
1793 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1797 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1794
1798
1795 2005-03-23 Fernando Perez <fperez@colorado.edu>
1799 2005-03-23 Fernando Perez <fperez@colorado.edu>
1796
1800
1797 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1801 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1798 properly aligned if they have embedded newlines.
1802 properly aligned if they have embedded newlines.
1799
1803
1800 * IPython/iplib.py (runlines): Add a public method to expose
1804 * IPython/iplib.py (runlines): Add a public method to expose
1801 IPython's code execution machinery, so that users can run strings
1805 IPython's code execution machinery, so that users can run strings
1802 as if they had been typed at the prompt interactively.
1806 as if they had been typed at the prompt interactively.
1803 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1807 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1804 methods which can call the system shell, but with python variable
1808 methods which can call the system shell, but with python variable
1805 expansion. The three such methods are: __IPYTHON__.system,
1809 expansion. The three such methods are: __IPYTHON__.system,
1806 .getoutput and .getoutputerror. These need to be documented in a
1810 .getoutput and .getoutputerror. These need to be documented in a
1807 'public API' section (to be written) of the manual.
1811 'public API' section (to be written) of the manual.
1808
1812
1809 2005-03-20 Fernando Perez <fperez@colorado.edu>
1813 2005-03-20 Fernando Perez <fperez@colorado.edu>
1810
1814
1811 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1815 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1812 for custom exception handling. This is quite powerful, and it
1816 for custom exception handling. This is quite powerful, and it
1813 allows for user-installable exception handlers which can trap
1817 allows for user-installable exception handlers which can trap
1814 custom exceptions at runtime and treat them separately from
1818 custom exceptions at runtime and treat them separately from
1815 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1819 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1816 Mantegazza <mantegazza-AT-ill.fr>.
1820 Mantegazza <mantegazza-AT-ill.fr>.
1817 (InteractiveShell.set_custom_completer): public API function to
1821 (InteractiveShell.set_custom_completer): public API function to
1818 add new completers at runtime.
1822 add new completers at runtime.
1819
1823
1820 2005-03-19 Fernando Perez <fperez@colorado.edu>
1824 2005-03-19 Fernando Perez <fperez@colorado.edu>
1821
1825
1822 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1826 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1823 allow objects which provide their docstrings via non-standard
1827 allow objects which provide their docstrings via non-standard
1824 mechanisms (like Pyro proxies) to still be inspected by ipython's
1828 mechanisms (like Pyro proxies) to still be inspected by ipython's
1825 ? system.
1829 ? system.
1826
1830
1827 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1831 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1828 automatic capture system. I tried quite hard to make it work
1832 automatic capture system. I tried quite hard to make it work
1829 reliably, and simply failed. I tried many combinations with the
1833 reliably, and simply failed. I tried many combinations with the
1830 subprocess module, but eventually nothing worked in all needed
1834 subprocess module, but eventually nothing worked in all needed
1831 cases (not blocking stdin for the child, duplicating stdout
1835 cases (not blocking stdin for the child, duplicating stdout
1832 without blocking, etc). The new %sc/%sx still do capture to these
1836 without blocking, etc). The new %sc/%sx still do capture to these
1833 magical list/string objects which make shell use much more
1837 magical list/string objects which make shell use much more
1834 conveninent, so not all is lost.
1838 conveninent, so not all is lost.
1835
1839
1836 XXX - FIX MANUAL for the change above!
1840 XXX - FIX MANUAL for the change above!
1837
1841
1838 (runsource): I copied code.py's runsource() into ipython to modify
1842 (runsource): I copied code.py's runsource() into ipython to modify
1839 it a bit. Now the code object and source to be executed are
1843 it a bit. Now the code object and source to be executed are
1840 stored in ipython. This makes this info accessible to third-party
1844 stored in ipython. This makes this info accessible to third-party
1841 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1845 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1842 Mantegazza <mantegazza-AT-ill.fr>.
1846 Mantegazza <mantegazza-AT-ill.fr>.
1843
1847
1844 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1848 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1845 history-search via readline (like C-p/C-n). I'd wanted this for a
1849 history-search via readline (like C-p/C-n). I'd wanted this for a
1846 long time, but only recently found out how to do it. For users
1850 long time, but only recently found out how to do it. For users
1847 who already have their ipythonrc files made and want this, just
1851 who already have their ipythonrc files made and want this, just
1848 add:
1852 add:
1849
1853
1850 readline_parse_and_bind "\e[A": history-search-backward
1854 readline_parse_and_bind "\e[A": history-search-backward
1851 readline_parse_and_bind "\e[B": history-search-forward
1855 readline_parse_and_bind "\e[B": history-search-forward
1852
1856
1853 2005-03-18 Fernando Perez <fperez@colorado.edu>
1857 2005-03-18 Fernando Perez <fperez@colorado.edu>
1854
1858
1855 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1859 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1856 LSString and SList classes which allow transparent conversions
1860 LSString and SList classes which allow transparent conversions
1857 between list mode and whitespace-separated string.
1861 between list mode and whitespace-separated string.
1858 (magic_r): Fix recursion problem in %r.
1862 (magic_r): Fix recursion problem in %r.
1859
1863
1860 * IPython/genutils.py (LSString): New class to be used for
1864 * IPython/genutils.py (LSString): New class to be used for
1861 automatic storage of the results of all alias/system calls in _o
1865 automatic storage of the results of all alias/system calls in _o
1862 and _e (stdout/err). These provide a .l/.list attribute which
1866 and _e (stdout/err). These provide a .l/.list attribute which
1863 does automatic splitting on newlines. This means that for most
1867 does automatic splitting on newlines. This means that for most
1864 uses, you'll never need to do capturing of output with %sc/%sx
1868 uses, you'll never need to do capturing of output with %sc/%sx
1865 anymore, since ipython keeps this always done for you. Note that
1869 anymore, since ipython keeps this always done for you. Note that
1866 only the LAST results are stored, the _o/e variables are
1870 only the LAST results are stored, the _o/e variables are
1867 overwritten on each call. If you need to save their contents
1871 overwritten on each call. If you need to save their contents
1868 further, simply bind them to any other name.
1872 further, simply bind them to any other name.
1869
1873
1870 2005-03-17 Fernando Perez <fperez@colorado.edu>
1874 2005-03-17 Fernando Perez <fperez@colorado.edu>
1871
1875
1872 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1876 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1873 prompt namespace handling.
1877 prompt namespace handling.
1874
1878
1875 2005-03-16 Fernando Perez <fperez@colorado.edu>
1879 2005-03-16 Fernando Perez <fperez@colorado.edu>
1876
1880
1877 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1881 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1878 classic prompts to be '>>> ' (final space was missing, and it
1882 classic prompts to be '>>> ' (final space was missing, and it
1879 trips the emacs python mode).
1883 trips the emacs python mode).
1880 (BasePrompt.__str__): Added safe support for dynamic prompt
1884 (BasePrompt.__str__): Added safe support for dynamic prompt
1881 strings. Now you can set your prompt string to be '$x', and the
1885 strings. Now you can set your prompt string to be '$x', and the
1882 value of x will be printed from your interactive namespace. The
1886 value of x will be printed from your interactive namespace. The
1883 interpolation syntax includes the full Itpl support, so
1887 interpolation syntax includes the full Itpl support, so
1884 ${foo()+x+bar()} is a valid prompt string now, and the function
1888 ${foo()+x+bar()} is a valid prompt string now, and the function
1885 calls will be made at runtime.
1889 calls will be made at runtime.
1886
1890
1887 2005-03-15 Fernando Perez <fperez@colorado.edu>
1891 2005-03-15 Fernando Perez <fperez@colorado.edu>
1888
1892
1889 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1893 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1890 avoid name clashes in pylab. %hist still works, it just forwards
1894 avoid name clashes in pylab. %hist still works, it just forwards
1891 the call to %history.
1895 the call to %history.
1892
1896
1893 2005-03-02 *** Released version 0.6.12
1897 2005-03-02 *** Released version 0.6.12
1894
1898
1895 2005-03-02 Fernando Perez <fperez@colorado.edu>
1899 2005-03-02 Fernando Perez <fperez@colorado.edu>
1896
1900
1897 * IPython/iplib.py (handle_magic): log magic calls properly as
1901 * IPython/iplib.py (handle_magic): log magic calls properly as
1898 ipmagic() function calls.
1902 ipmagic() function calls.
1899
1903
1900 * IPython/Magic.py (magic_time): Improved %time to support
1904 * IPython/Magic.py (magic_time): Improved %time to support
1901 statements and provide wall-clock as well as CPU time.
1905 statements and provide wall-clock as well as CPU time.
1902
1906
1903 2005-02-27 Fernando Perez <fperez@colorado.edu>
1907 2005-02-27 Fernando Perez <fperez@colorado.edu>
1904
1908
1905 * IPython/hooks.py: New hooks module, to expose user-modifiable
1909 * IPython/hooks.py: New hooks module, to expose user-modifiable
1906 IPython functionality in a clean manner. For now only the editor
1910 IPython functionality in a clean manner. For now only the editor
1907 hook is actually written, and other thigns which I intend to turn
1911 hook is actually written, and other thigns which I intend to turn
1908 into proper hooks aren't yet there. The display and prefilter
1912 into proper hooks aren't yet there. The display and prefilter
1909 stuff, for example, should be hooks. But at least now the
1913 stuff, for example, should be hooks. But at least now the
1910 framework is in place, and the rest can be moved here with more
1914 framework is in place, and the rest can be moved here with more
1911 time later. IPython had had a .hooks variable for a long time for
1915 time later. IPython had had a .hooks variable for a long time for
1912 this purpose, but I'd never actually used it for anything.
1916 this purpose, but I'd never actually used it for anything.
1913
1917
1914 2005-02-26 Fernando Perez <fperez@colorado.edu>
1918 2005-02-26 Fernando Perez <fperez@colorado.edu>
1915
1919
1916 * IPython/ipmaker.py (make_IPython): make the default ipython
1920 * IPython/ipmaker.py (make_IPython): make the default ipython
1917 directory be called _ipython under win32, to follow more the
1921 directory be called _ipython under win32, to follow more the
1918 naming peculiarities of that platform (where buggy software like
1922 naming peculiarities of that platform (where buggy software like
1919 Visual Sourcesafe breaks with .named directories). Reported by
1923 Visual Sourcesafe breaks with .named directories). Reported by
1920 Ville Vainio.
1924 Ville Vainio.
1921
1925
1922 2005-02-23 Fernando Perez <fperez@colorado.edu>
1926 2005-02-23 Fernando Perez <fperez@colorado.edu>
1923
1927
1924 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1928 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1925 auto_aliases for win32 which were causing problems. Users can
1929 auto_aliases for win32 which were causing problems. Users can
1926 define the ones they personally like.
1930 define the ones they personally like.
1927
1931
1928 2005-02-21 Fernando Perez <fperez@colorado.edu>
1932 2005-02-21 Fernando Perez <fperez@colorado.edu>
1929
1933
1930 * IPython/Magic.py (magic_time): new magic to time execution of
1934 * IPython/Magic.py (magic_time): new magic to time execution of
1931 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1935 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1932
1936
1933 2005-02-19 Fernando Perez <fperez@colorado.edu>
1937 2005-02-19 Fernando Perez <fperez@colorado.edu>
1934
1938
1935 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1939 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1936 into keys (for prompts, for example).
1940 into keys (for prompts, for example).
1937
1941
1938 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1942 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1939 prompts in case users want them. This introduces a small behavior
1943 prompts in case users want them. This introduces a small behavior
1940 change: ipython does not automatically add a space to all prompts
1944 change: ipython does not automatically add a space to all prompts
1941 anymore. To get the old prompts with a space, users should add it
1945 anymore. To get the old prompts with a space, users should add it
1942 manually to their ipythonrc file, so for example prompt_in1 should
1946 manually to their ipythonrc file, so for example prompt_in1 should
1943 now read 'In [\#]: ' instead of 'In [\#]:'.
1947 now read 'In [\#]: ' instead of 'In [\#]:'.
1944 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1948 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1945 file) to control left-padding of secondary prompts.
1949 file) to control left-padding of secondary prompts.
1946
1950
1947 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1951 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1948 the profiler can't be imported. Fix for Debian, which removed
1952 the profiler can't be imported. Fix for Debian, which removed
1949 profile.py because of License issues. I applied a slightly
1953 profile.py because of License issues. I applied a slightly
1950 modified version of the original Debian patch at
1954 modified version of the original Debian patch at
1951 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1955 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1952
1956
1953 2005-02-17 Fernando Perez <fperez@colorado.edu>
1957 2005-02-17 Fernando Perez <fperez@colorado.edu>
1954
1958
1955 * IPython/genutils.py (native_line_ends): Fix bug which would
1959 * IPython/genutils.py (native_line_ends): Fix bug which would
1956 cause improper line-ends under win32 b/c I was not opening files
1960 cause improper line-ends under win32 b/c I was not opening files
1957 in binary mode. Bug report and fix thanks to Ville.
1961 in binary mode. Bug report and fix thanks to Ville.
1958
1962
1959 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1963 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1960 trying to catch spurious foo[1] autocalls. My fix actually broke
1964 trying to catch spurious foo[1] autocalls. My fix actually broke
1961 ',/' autoquote/call with explicit escape (bad regexp).
1965 ',/' autoquote/call with explicit escape (bad regexp).
1962
1966
1963 2005-02-15 *** Released version 0.6.11
1967 2005-02-15 *** Released version 0.6.11
1964
1968
1965 2005-02-14 Fernando Perez <fperez@colorado.edu>
1969 2005-02-14 Fernando Perez <fperez@colorado.edu>
1966
1970
1967 * IPython/background_jobs.py: New background job management
1971 * IPython/background_jobs.py: New background job management
1968 subsystem. This is implemented via a new set of classes, and
1972 subsystem. This is implemented via a new set of classes, and
1969 IPython now provides a builtin 'jobs' object for background job
1973 IPython now provides a builtin 'jobs' object for background job
1970 execution. A convenience %bg magic serves as a lightweight
1974 execution. A convenience %bg magic serves as a lightweight
1971 frontend for starting the more common type of calls. This was
1975 frontend for starting the more common type of calls. This was
1972 inspired by discussions with B. Granger and the BackgroundCommand
1976 inspired by discussions with B. Granger and the BackgroundCommand
1973 class described in the book Python Scripting for Computational
1977 class described in the book Python Scripting for Computational
1974 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1978 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1975 (although ultimately no code from this text was used, as IPython's
1979 (although ultimately no code from this text was used, as IPython's
1976 system is a separate implementation).
1980 system is a separate implementation).
1977
1981
1978 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1982 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1979 to control the completion of single/double underscore names
1983 to control the completion of single/double underscore names
1980 separately. As documented in the example ipytonrc file, the
1984 separately. As documented in the example ipytonrc file, the
1981 readline_omit__names variable can now be set to 2, to omit even
1985 readline_omit__names variable can now be set to 2, to omit even
1982 single underscore names. Thanks to a patch by Brian Wong
1986 single underscore names. Thanks to a patch by Brian Wong
1983 <BrianWong-AT-AirgoNetworks.Com>.
1987 <BrianWong-AT-AirgoNetworks.Com>.
1984 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1988 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1985 be autocalled as foo([1]) if foo were callable. A problem for
1989 be autocalled as foo([1]) if foo were callable. A problem for
1986 things which are both callable and implement __getitem__.
1990 things which are both callable and implement __getitem__.
1987 (init_readline): Fix autoindentation for win32. Thanks to a patch
1991 (init_readline): Fix autoindentation for win32. Thanks to a patch
1988 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1992 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1989
1993
1990 2005-02-12 Fernando Perez <fperez@colorado.edu>
1994 2005-02-12 Fernando Perez <fperez@colorado.edu>
1991
1995
1992 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1996 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1993 which I had written long ago to sort out user error messages which
1997 which I had written long ago to sort out user error messages which
1994 may occur during startup. This seemed like a good idea initially,
1998 may occur during startup. This seemed like a good idea initially,
1995 but it has proven a disaster in retrospect. I don't want to
1999 but it has proven a disaster in retrospect. I don't want to
1996 change much code for now, so my fix is to set the internal 'debug'
2000 change much code for now, so my fix is to set the internal 'debug'
1997 flag to true everywhere, whose only job was precisely to control
2001 flag to true everywhere, whose only job was precisely to control
1998 this subsystem. This closes issue 28 (as well as avoiding all
2002 this subsystem. This closes issue 28 (as well as avoiding all
1999 sorts of strange hangups which occur from time to time).
2003 sorts of strange hangups which occur from time to time).
2000
2004
2001 2005-02-07 Fernando Perez <fperez@colorado.edu>
2005 2005-02-07 Fernando Perez <fperez@colorado.edu>
2002
2006
2003 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2007 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2004 previous call produced a syntax error.
2008 previous call produced a syntax error.
2005
2009
2006 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2010 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2007 classes without constructor.
2011 classes without constructor.
2008
2012
2009 2005-02-06 Fernando Perez <fperez@colorado.edu>
2013 2005-02-06 Fernando Perez <fperez@colorado.edu>
2010
2014
2011 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2015 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2012 completions with the results of each matcher, so we return results
2016 completions with the results of each matcher, so we return results
2013 to the user from all namespaces. This breaks with ipython
2017 to the user from all namespaces. This breaks with ipython
2014 tradition, but I think it's a nicer behavior. Now you get all
2018 tradition, but I think it's a nicer behavior. Now you get all
2015 possible completions listed, from all possible namespaces (python,
2019 possible completions listed, from all possible namespaces (python,
2016 filesystem, magics...) After a request by John Hunter
2020 filesystem, magics...) After a request by John Hunter
2017 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2021 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2018
2022
2019 2005-02-05 Fernando Perez <fperez@colorado.edu>
2023 2005-02-05 Fernando Perez <fperez@colorado.edu>
2020
2024
2021 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2025 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2022 the call had quote characters in it (the quotes were stripped).
2026 the call had quote characters in it (the quotes were stripped).
2023
2027
2024 2005-01-31 Fernando Perez <fperez@colorado.edu>
2028 2005-01-31 Fernando Perez <fperez@colorado.edu>
2025
2029
2026 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2030 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2027 Itpl.itpl() to make the code more robust against psyco
2031 Itpl.itpl() to make the code more robust against psyco
2028 optimizations.
2032 optimizations.
2029
2033
2030 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2034 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2031 of causing an exception. Quicker, cleaner.
2035 of causing an exception. Quicker, cleaner.
2032
2036
2033 2005-01-28 Fernando Perez <fperez@colorado.edu>
2037 2005-01-28 Fernando Perez <fperez@colorado.edu>
2034
2038
2035 * scripts/ipython_win_post_install.py (install): hardcode
2039 * scripts/ipython_win_post_install.py (install): hardcode
2036 sys.prefix+'python.exe' as the executable path. It turns out that
2040 sys.prefix+'python.exe' as the executable path. It turns out that
2037 during the post-installation run, sys.executable resolves to the
2041 during the post-installation run, sys.executable resolves to the
2038 name of the binary installer! I should report this as a distutils
2042 name of the binary installer! I should report this as a distutils
2039 bug, I think. I updated the .10 release with this tiny fix, to
2043 bug, I think. I updated the .10 release with this tiny fix, to
2040 avoid annoying the lists further.
2044 avoid annoying the lists further.
2041
2045
2042 2005-01-27 *** Released version 0.6.10
2046 2005-01-27 *** Released version 0.6.10
2043
2047
2044 2005-01-27 Fernando Perez <fperez@colorado.edu>
2048 2005-01-27 Fernando Perez <fperez@colorado.edu>
2045
2049
2046 * IPython/numutils.py (norm): Added 'inf' as optional name for
2050 * IPython/numutils.py (norm): Added 'inf' as optional name for
2047 L-infinity norm, included references to mathworld.com for vector
2051 L-infinity norm, included references to mathworld.com for vector
2048 norm definitions.
2052 norm definitions.
2049 (amin/amax): added amin/amax for array min/max. Similar to what
2053 (amin/amax): added amin/amax for array min/max. Similar to what
2050 pylab ships with after the recent reorganization of names.
2054 pylab ships with after the recent reorganization of names.
2051 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2055 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2052
2056
2053 * ipython.el: committed Alex's recent fixes and improvements.
2057 * ipython.el: committed Alex's recent fixes and improvements.
2054 Tested with python-mode from CVS, and it looks excellent. Since
2058 Tested with python-mode from CVS, and it looks excellent. Since
2055 python-mode hasn't released anything in a while, I'm temporarily
2059 python-mode hasn't released anything in a while, I'm temporarily
2056 putting a copy of today's CVS (v 4.70) of python-mode in:
2060 putting a copy of today's CVS (v 4.70) of python-mode in:
2057 http://ipython.scipy.org/tmp/python-mode.el
2061 http://ipython.scipy.org/tmp/python-mode.el
2058
2062
2059 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2063 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2060 sys.executable for the executable name, instead of assuming it's
2064 sys.executable for the executable name, instead of assuming it's
2061 called 'python.exe' (the post-installer would have produced broken
2065 called 'python.exe' (the post-installer would have produced broken
2062 setups on systems with a differently named python binary).
2066 setups on systems with a differently named python binary).
2063
2067
2064 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2068 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2065 references to os.linesep, to make the code more
2069 references to os.linesep, to make the code more
2066 platform-independent. This is also part of the win32 coloring
2070 platform-independent. This is also part of the win32 coloring
2067 fixes.
2071 fixes.
2068
2072
2069 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2073 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2070 lines, which actually cause coloring bugs because the length of
2074 lines, which actually cause coloring bugs because the length of
2071 the line is very difficult to correctly compute with embedded
2075 the line is very difficult to correctly compute with embedded
2072 escapes. This was the source of all the coloring problems under
2076 escapes. This was the source of all the coloring problems under
2073 Win32. I think that _finally_, Win32 users have a properly
2077 Win32. I think that _finally_, Win32 users have a properly
2074 working ipython in all respects. This would never have happened
2078 working ipython in all respects. This would never have happened
2075 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2079 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2076
2080
2077 2005-01-26 *** Released version 0.6.9
2081 2005-01-26 *** Released version 0.6.9
2078
2082
2079 2005-01-25 Fernando Perez <fperez@colorado.edu>
2083 2005-01-25 Fernando Perez <fperez@colorado.edu>
2080
2084
2081 * setup.py: finally, we have a true Windows installer, thanks to
2085 * setup.py: finally, we have a true Windows installer, thanks to
2082 the excellent work of Viktor Ransmayr
2086 the excellent work of Viktor Ransmayr
2083 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2087 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2084 Windows users. The setup routine is quite a bit cleaner thanks to
2088 Windows users. The setup routine is quite a bit cleaner thanks to
2085 this, and the post-install script uses the proper functions to
2089 this, and the post-install script uses the proper functions to
2086 allow a clean de-installation using the standard Windows Control
2090 allow a clean de-installation using the standard Windows Control
2087 Panel.
2091 Panel.
2088
2092
2089 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2093 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2090 environment variable under all OSes (including win32) if
2094 environment variable under all OSes (including win32) if
2091 available. This will give consistency to win32 users who have set
2095 available. This will give consistency to win32 users who have set
2092 this variable for any reason. If os.environ['HOME'] fails, the
2096 this variable for any reason. If os.environ['HOME'] fails, the
2093 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2097 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2094
2098
2095 2005-01-24 Fernando Perez <fperez@colorado.edu>
2099 2005-01-24 Fernando Perez <fperez@colorado.edu>
2096
2100
2097 * IPython/numutils.py (empty_like): add empty_like(), similar to
2101 * IPython/numutils.py (empty_like): add empty_like(), similar to
2098 zeros_like() but taking advantage of the new empty() Numeric routine.
2102 zeros_like() but taking advantage of the new empty() Numeric routine.
2099
2103
2100 2005-01-23 *** Released version 0.6.8
2104 2005-01-23 *** Released version 0.6.8
2101
2105
2102 2005-01-22 Fernando Perez <fperez@colorado.edu>
2106 2005-01-22 Fernando Perez <fperez@colorado.edu>
2103
2107
2104 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2108 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2105 automatic show() calls. After discussing things with JDH, it
2109 automatic show() calls. After discussing things with JDH, it
2106 turns out there are too many corner cases where this can go wrong.
2110 turns out there are too many corner cases where this can go wrong.
2107 It's best not to try to be 'too smart', and simply have ipython
2111 It's best not to try to be 'too smart', and simply have ipython
2108 reproduce as much as possible the default behavior of a normal
2112 reproduce as much as possible the default behavior of a normal
2109 python shell.
2113 python shell.
2110
2114
2111 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2115 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2112 line-splitting regexp and _prefilter() to avoid calling getattr()
2116 line-splitting regexp and _prefilter() to avoid calling getattr()
2113 on assignments. This closes
2117 on assignments. This closes
2114 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2118 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2115 readline uses getattr(), so a simple <TAB> keypress is still
2119 readline uses getattr(), so a simple <TAB> keypress is still
2116 enough to trigger getattr() calls on an object.
2120 enough to trigger getattr() calls on an object.
2117
2121
2118 2005-01-21 Fernando Perez <fperez@colorado.edu>
2122 2005-01-21 Fernando Perez <fperez@colorado.edu>
2119
2123
2120 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2124 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2121 docstring under pylab so it doesn't mask the original.
2125 docstring under pylab so it doesn't mask the original.
2122
2126
2123 2005-01-21 *** Released version 0.6.7
2127 2005-01-21 *** Released version 0.6.7
2124
2128
2125 2005-01-21 Fernando Perez <fperez@colorado.edu>
2129 2005-01-21 Fernando Perez <fperez@colorado.edu>
2126
2130
2127 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2131 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2128 signal handling for win32 users in multithreaded mode.
2132 signal handling for win32 users in multithreaded mode.
2129
2133
2130 2005-01-17 Fernando Perez <fperez@colorado.edu>
2134 2005-01-17 Fernando Perez <fperez@colorado.edu>
2131
2135
2132 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2136 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2133 instances with no __init__. After a crash report by Norbert Nemec
2137 instances with no __init__. After a crash report by Norbert Nemec
2134 <Norbert-AT-nemec-online.de>.
2138 <Norbert-AT-nemec-online.de>.
2135
2139
2136 2005-01-14 Fernando Perez <fperez@colorado.edu>
2140 2005-01-14 Fernando Perez <fperez@colorado.edu>
2137
2141
2138 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2142 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2139 names for verbose exceptions, when multiple dotted names and the
2143 names for verbose exceptions, when multiple dotted names and the
2140 'parent' object were present on the same line.
2144 'parent' object were present on the same line.
2141
2145
2142 2005-01-11 Fernando Perez <fperez@colorado.edu>
2146 2005-01-11 Fernando Perez <fperez@colorado.edu>
2143
2147
2144 * IPython/genutils.py (flag_calls): new utility to trap and flag
2148 * IPython/genutils.py (flag_calls): new utility to trap and flag
2145 calls in functions. I need it to clean up matplotlib support.
2149 calls in functions. I need it to clean up matplotlib support.
2146 Also removed some deprecated code in genutils.
2150 Also removed some deprecated code in genutils.
2147
2151
2148 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2152 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2149 that matplotlib scripts called with %run, which don't call show()
2153 that matplotlib scripts called with %run, which don't call show()
2150 themselves, still have their plotting windows open.
2154 themselves, still have their plotting windows open.
2151
2155
2152 2005-01-05 Fernando Perez <fperez@colorado.edu>
2156 2005-01-05 Fernando Perez <fperez@colorado.edu>
2153
2157
2154 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2158 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2155 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2159 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2156
2160
2157 2004-12-19 Fernando Perez <fperez@colorado.edu>
2161 2004-12-19 Fernando Perez <fperez@colorado.edu>
2158
2162
2159 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2163 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2160 parent_runcode, which was an eyesore. The same result can be
2164 parent_runcode, which was an eyesore. The same result can be
2161 obtained with Python's regular superclass mechanisms.
2165 obtained with Python's regular superclass mechanisms.
2162
2166
2163 2004-12-17 Fernando Perez <fperez@colorado.edu>
2167 2004-12-17 Fernando Perez <fperez@colorado.edu>
2164
2168
2165 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2169 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2166 reported by Prabhu.
2170 reported by Prabhu.
2167 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2171 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2168 sys.stderr) instead of explicitly calling sys.stderr. This helps
2172 sys.stderr) instead of explicitly calling sys.stderr. This helps
2169 maintain our I/O abstractions clean, for future GUI embeddings.
2173 maintain our I/O abstractions clean, for future GUI embeddings.
2170
2174
2171 * IPython/genutils.py (info): added new utility for sys.stderr
2175 * IPython/genutils.py (info): added new utility for sys.stderr
2172 unified info message handling (thin wrapper around warn()).
2176 unified info message handling (thin wrapper around warn()).
2173
2177
2174 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2178 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2175 composite (dotted) names on verbose exceptions.
2179 composite (dotted) names on verbose exceptions.
2176 (VerboseTB.nullrepr): harden against another kind of errors which
2180 (VerboseTB.nullrepr): harden against another kind of errors which
2177 Python's inspect module can trigger, and which were crashing
2181 Python's inspect module can trigger, and which were crashing
2178 IPython. Thanks to a report by Marco Lombardi
2182 IPython. Thanks to a report by Marco Lombardi
2179 <mlombard-AT-ma010192.hq.eso.org>.
2183 <mlombard-AT-ma010192.hq.eso.org>.
2180
2184
2181 2004-12-13 *** Released version 0.6.6
2185 2004-12-13 *** Released version 0.6.6
2182
2186
2183 2004-12-12 Fernando Perez <fperez@colorado.edu>
2187 2004-12-12 Fernando Perez <fperez@colorado.edu>
2184
2188
2185 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2189 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2186 generated by pygtk upon initialization if it was built without
2190 generated by pygtk upon initialization if it was built without
2187 threads (for matplotlib users). After a crash reported by
2191 threads (for matplotlib users). After a crash reported by
2188 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2192 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2189
2193
2190 * IPython/ipmaker.py (make_IPython): fix small bug in the
2194 * IPython/ipmaker.py (make_IPython): fix small bug in the
2191 import_some parameter for multiple imports.
2195 import_some parameter for multiple imports.
2192
2196
2193 * IPython/iplib.py (ipmagic): simplified the interface of
2197 * IPython/iplib.py (ipmagic): simplified the interface of
2194 ipmagic() to take a single string argument, just as it would be
2198 ipmagic() to take a single string argument, just as it would be
2195 typed at the IPython cmd line.
2199 typed at the IPython cmd line.
2196 (ipalias): Added new ipalias() with an interface identical to
2200 (ipalias): Added new ipalias() with an interface identical to
2197 ipmagic(). This completes exposing a pure python interface to the
2201 ipmagic(). This completes exposing a pure python interface to the
2198 alias and magic system, which can be used in loops or more complex
2202 alias and magic system, which can be used in loops or more complex
2199 code where IPython's automatic line mangling is not active.
2203 code where IPython's automatic line mangling is not active.
2200
2204
2201 * IPython/genutils.py (timing): changed interface of timing to
2205 * IPython/genutils.py (timing): changed interface of timing to
2202 simply run code once, which is the most common case. timings()
2206 simply run code once, which is the most common case. timings()
2203 remains unchanged, for the cases where you want multiple runs.
2207 remains unchanged, for the cases where you want multiple runs.
2204
2208
2205 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2209 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2206 bug where Python2.2 crashes with exec'ing code which does not end
2210 bug where Python2.2 crashes with exec'ing code which does not end
2207 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2211 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2208 before.
2212 before.
2209
2213
2210 2004-12-10 Fernando Perez <fperez@colorado.edu>
2214 2004-12-10 Fernando Perez <fperez@colorado.edu>
2211
2215
2212 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2216 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2213 -t to -T, to accomodate the new -t flag in %run (the %run and
2217 -t to -T, to accomodate the new -t flag in %run (the %run and
2214 %prun options are kind of intermixed, and it's not easy to change
2218 %prun options are kind of intermixed, and it's not easy to change
2215 this with the limitations of python's getopt).
2219 this with the limitations of python's getopt).
2216
2220
2217 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2221 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2218 the execution of scripts. It's not as fine-tuned as timeit.py,
2222 the execution of scripts. It's not as fine-tuned as timeit.py,
2219 but it works from inside ipython (and under 2.2, which lacks
2223 but it works from inside ipython (and under 2.2, which lacks
2220 timeit.py). Optionally a number of runs > 1 can be given for
2224 timeit.py). Optionally a number of runs > 1 can be given for
2221 timing very short-running code.
2225 timing very short-running code.
2222
2226
2223 * IPython/genutils.py (uniq_stable): new routine which returns a
2227 * IPython/genutils.py (uniq_stable): new routine which returns a
2224 list of unique elements in any iterable, but in stable order of
2228 list of unique elements in any iterable, but in stable order of
2225 appearance. I needed this for the ultraTB fixes, and it's a handy
2229 appearance. I needed this for the ultraTB fixes, and it's a handy
2226 utility.
2230 utility.
2227
2231
2228 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2232 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2229 dotted names in Verbose exceptions. This had been broken since
2233 dotted names in Verbose exceptions. This had been broken since
2230 the very start, now x.y will properly be printed in a Verbose
2234 the very start, now x.y will properly be printed in a Verbose
2231 traceback, instead of x being shown and y appearing always as an
2235 traceback, instead of x being shown and y appearing always as an
2232 'undefined global'. Getting this to work was a bit tricky,
2236 'undefined global'. Getting this to work was a bit tricky,
2233 because by default python tokenizers are stateless. Saved by
2237 because by default python tokenizers are stateless. Saved by
2234 python's ability to easily add a bit of state to an arbitrary
2238 python's ability to easily add a bit of state to an arbitrary
2235 function (without needing to build a full-blown callable object).
2239 function (without needing to build a full-blown callable object).
2236
2240
2237 Also big cleanup of this code, which had horrendous runtime
2241 Also big cleanup of this code, which had horrendous runtime
2238 lookups of zillions of attributes for colorization. Moved all
2242 lookups of zillions of attributes for colorization. Moved all
2239 this code into a few templates, which make it cleaner and quicker.
2243 this code into a few templates, which make it cleaner and quicker.
2240
2244
2241 Printout quality was also improved for Verbose exceptions: one
2245 Printout quality was also improved for Verbose exceptions: one
2242 variable per line, and memory addresses are printed (this can be
2246 variable per line, and memory addresses are printed (this can be
2243 quite handy in nasty debugging situations, which is what Verbose
2247 quite handy in nasty debugging situations, which is what Verbose
2244 is for).
2248 is for).
2245
2249
2246 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2250 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2247 the command line as scripts to be loaded by embedded instances.
2251 the command line as scripts to be loaded by embedded instances.
2248 Doing so has the potential for an infinite recursion if there are
2252 Doing so has the potential for an infinite recursion if there are
2249 exceptions thrown in the process. This fixes a strange crash
2253 exceptions thrown in the process. This fixes a strange crash
2250 reported by Philippe MULLER <muller-AT-irit.fr>.
2254 reported by Philippe MULLER <muller-AT-irit.fr>.
2251
2255
2252 2004-12-09 Fernando Perez <fperez@colorado.edu>
2256 2004-12-09 Fernando Perez <fperez@colorado.edu>
2253
2257
2254 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2258 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2255 to reflect new names in matplotlib, which now expose the
2259 to reflect new names in matplotlib, which now expose the
2256 matlab-compatible interface via a pylab module instead of the
2260 matlab-compatible interface via a pylab module instead of the
2257 'matlab' name. The new code is backwards compatible, so users of
2261 'matlab' name. The new code is backwards compatible, so users of
2258 all matplotlib versions are OK. Patch by J. Hunter.
2262 all matplotlib versions are OK. Patch by J. Hunter.
2259
2263
2260 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2264 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2261 of __init__ docstrings for instances (class docstrings are already
2265 of __init__ docstrings for instances (class docstrings are already
2262 automatically printed). Instances with customized docstrings
2266 automatically printed). Instances with customized docstrings
2263 (indep. of the class) are also recognized and all 3 separate
2267 (indep. of the class) are also recognized and all 3 separate
2264 docstrings are printed (instance, class, constructor). After some
2268 docstrings are printed (instance, class, constructor). After some
2265 comments/suggestions by J. Hunter.
2269 comments/suggestions by J. Hunter.
2266
2270
2267 2004-12-05 Fernando Perez <fperez@colorado.edu>
2271 2004-12-05 Fernando Perez <fperez@colorado.edu>
2268
2272
2269 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2273 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2270 warnings when tab-completion fails and triggers an exception.
2274 warnings when tab-completion fails and triggers an exception.
2271
2275
2272 2004-12-03 Fernando Perez <fperez@colorado.edu>
2276 2004-12-03 Fernando Perez <fperez@colorado.edu>
2273
2277
2274 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2278 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2275 be triggered when using 'run -p'. An incorrect option flag was
2279 be triggered when using 'run -p'. An incorrect option flag was
2276 being set ('d' instead of 'D').
2280 being set ('d' instead of 'D').
2277 (manpage): fix missing escaped \- sign.
2281 (manpage): fix missing escaped \- sign.
2278
2282
2279 2004-11-30 *** Released version 0.6.5
2283 2004-11-30 *** Released version 0.6.5
2280
2284
2281 2004-11-30 Fernando Perez <fperez@colorado.edu>
2285 2004-11-30 Fernando Perez <fperez@colorado.edu>
2282
2286
2283 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2287 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2284 setting with -d option.
2288 setting with -d option.
2285
2289
2286 * setup.py (docfiles): Fix problem where the doc glob I was using
2290 * setup.py (docfiles): Fix problem where the doc glob I was using
2287 was COMPLETELY BROKEN. It was giving the right files by pure
2291 was COMPLETELY BROKEN. It was giving the right files by pure
2288 accident, but failed once I tried to include ipython.el. Note:
2292 accident, but failed once I tried to include ipython.el. Note:
2289 glob() does NOT allow you to do exclusion on multiple endings!
2293 glob() does NOT allow you to do exclusion on multiple endings!
2290
2294
2291 2004-11-29 Fernando Perez <fperez@colorado.edu>
2295 2004-11-29 Fernando Perez <fperez@colorado.edu>
2292
2296
2293 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2297 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2294 the manpage as the source. Better formatting & consistency.
2298 the manpage as the source. Better formatting & consistency.
2295
2299
2296 * IPython/Magic.py (magic_run): Added new -d option, to run
2300 * IPython/Magic.py (magic_run): Added new -d option, to run
2297 scripts under the control of the python pdb debugger. Note that
2301 scripts under the control of the python pdb debugger. Note that
2298 this required changing the %prun option -d to -D, to avoid a clash
2302 this required changing the %prun option -d to -D, to avoid a clash
2299 (since %run must pass options to %prun, and getopt is too dumb to
2303 (since %run must pass options to %prun, and getopt is too dumb to
2300 handle options with string values with embedded spaces). Thanks
2304 handle options with string values with embedded spaces). Thanks
2301 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2305 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2302 (magic_who_ls): added type matching to %who and %whos, so that one
2306 (magic_who_ls): added type matching to %who and %whos, so that one
2303 can filter their output to only include variables of certain
2307 can filter their output to only include variables of certain
2304 types. Another suggestion by Matthew.
2308 types. Another suggestion by Matthew.
2305 (magic_whos): Added memory summaries in kb and Mb for arrays.
2309 (magic_whos): Added memory summaries in kb and Mb for arrays.
2306 (magic_who): Improve formatting (break lines every 9 vars).
2310 (magic_who): Improve formatting (break lines every 9 vars).
2307
2311
2308 2004-11-28 Fernando Perez <fperez@colorado.edu>
2312 2004-11-28 Fernando Perez <fperez@colorado.edu>
2309
2313
2310 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2314 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2311 cache when empty lines were present.
2315 cache when empty lines were present.
2312
2316
2313 2004-11-24 Fernando Perez <fperez@colorado.edu>
2317 2004-11-24 Fernando Perez <fperez@colorado.edu>
2314
2318
2315 * IPython/usage.py (__doc__): document the re-activated threading
2319 * IPython/usage.py (__doc__): document the re-activated threading
2316 options for WX and GTK.
2320 options for WX and GTK.
2317
2321
2318 2004-11-23 Fernando Perez <fperez@colorado.edu>
2322 2004-11-23 Fernando Perez <fperez@colorado.edu>
2319
2323
2320 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2324 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2321 the -wthread and -gthread options, along with a new -tk one to try
2325 the -wthread and -gthread options, along with a new -tk one to try
2322 and coordinate Tk threading with wx/gtk. The tk support is very
2326 and coordinate Tk threading with wx/gtk. The tk support is very
2323 platform dependent, since it seems to require Tcl and Tk to be
2327 platform dependent, since it seems to require Tcl and Tk to be
2324 built with threads (Fedora1/2 appears NOT to have it, but in
2328 built with threads (Fedora1/2 appears NOT to have it, but in
2325 Prabhu's Debian boxes it works OK). But even with some Tk
2329 Prabhu's Debian boxes it works OK). But even with some Tk
2326 limitations, this is a great improvement.
2330 limitations, this is a great improvement.
2327
2331
2328 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2332 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2329 info in user prompts. Patch by Prabhu.
2333 info in user prompts. Patch by Prabhu.
2330
2334
2331 2004-11-18 Fernando Perez <fperez@colorado.edu>
2335 2004-11-18 Fernando Perez <fperez@colorado.edu>
2332
2336
2333 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2337 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2334 EOFErrors and bail, to avoid infinite loops if a non-terminating
2338 EOFErrors and bail, to avoid infinite loops if a non-terminating
2335 file is fed into ipython. Patch submitted in issue 19 by user,
2339 file is fed into ipython. Patch submitted in issue 19 by user,
2336 many thanks.
2340 many thanks.
2337
2341
2338 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2342 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2339 autoquote/parens in continuation prompts, which can cause lots of
2343 autoquote/parens in continuation prompts, which can cause lots of
2340 problems. Closes roundup issue 20.
2344 problems. Closes roundup issue 20.
2341
2345
2342 2004-11-17 Fernando Perez <fperez@colorado.edu>
2346 2004-11-17 Fernando Perez <fperez@colorado.edu>
2343
2347
2344 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2348 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2345 reported as debian bug #280505. I'm not sure my local changelog
2349 reported as debian bug #280505. I'm not sure my local changelog
2346 entry has the proper debian format (Jack?).
2350 entry has the proper debian format (Jack?).
2347
2351
2348 2004-11-08 *** Released version 0.6.4
2352 2004-11-08 *** Released version 0.6.4
2349
2353
2350 2004-11-08 Fernando Perez <fperez@colorado.edu>
2354 2004-11-08 Fernando Perez <fperez@colorado.edu>
2351
2355
2352 * IPython/iplib.py (init_readline): Fix exit message for Windows
2356 * IPython/iplib.py (init_readline): Fix exit message for Windows
2353 when readline is active. Thanks to a report by Eric Jones
2357 when readline is active. Thanks to a report by Eric Jones
2354 <eric-AT-enthought.com>.
2358 <eric-AT-enthought.com>.
2355
2359
2356 2004-11-07 Fernando Perez <fperez@colorado.edu>
2360 2004-11-07 Fernando Perez <fperez@colorado.edu>
2357
2361
2358 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2362 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2359 sometimes seen by win2k/cygwin users.
2363 sometimes seen by win2k/cygwin users.
2360
2364
2361 2004-11-06 Fernando Perez <fperez@colorado.edu>
2365 2004-11-06 Fernando Perez <fperez@colorado.edu>
2362
2366
2363 * IPython/iplib.py (interact): Change the handling of %Exit from
2367 * IPython/iplib.py (interact): Change the handling of %Exit from
2364 trying to propagate a SystemExit to an internal ipython flag.
2368 trying to propagate a SystemExit to an internal ipython flag.
2365 This is less elegant than using Python's exception mechanism, but
2369 This is less elegant than using Python's exception mechanism, but
2366 I can't get that to work reliably with threads, so under -pylab
2370 I can't get that to work reliably with threads, so under -pylab
2367 %Exit was hanging IPython. Cross-thread exception handling is
2371 %Exit was hanging IPython. Cross-thread exception handling is
2368 really a bitch. Thaks to a bug report by Stephen Walton
2372 really a bitch. Thaks to a bug report by Stephen Walton
2369 <stephen.walton-AT-csun.edu>.
2373 <stephen.walton-AT-csun.edu>.
2370
2374
2371 2004-11-04 Fernando Perez <fperez@colorado.edu>
2375 2004-11-04 Fernando Perez <fperez@colorado.edu>
2372
2376
2373 * IPython/iplib.py (raw_input_original): store a pointer to the
2377 * IPython/iplib.py (raw_input_original): store a pointer to the
2374 true raw_input to harden against code which can modify it
2378 true raw_input to harden against code which can modify it
2375 (wx.py.PyShell does this and would otherwise crash ipython).
2379 (wx.py.PyShell does this and would otherwise crash ipython).
2376 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2380 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2377
2381
2378 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2382 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2379 Ctrl-C problem, which does not mess up the input line.
2383 Ctrl-C problem, which does not mess up the input line.
2380
2384
2381 2004-11-03 Fernando Perez <fperez@colorado.edu>
2385 2004-11-03 Fernando Perez <fperez@colorado.edu>
2382
2386
2383 * IPython/Release.py: Changed licensing to BSD, in all files.
2387 * IPython/Release.py: Changed licensing to BSD, in all files.
2384 (name): lowercase name for tarball/RPM release.
2388 (name): lowercase name for tarball/RPM release.
2385
2389
2386 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2390 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2387 use throughout ipython.
2391 use throughout ipython.
2388
2392
2389 * IPython/Magic.py (Magic._ofind): Switch to using the new
2393 * IPython/Magic.py (Magic._ofind): Switch to using the new
2390 OInspect.getdoc() function.
2394 OInspect.getdoc() function.
2391
2395
2392 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2396 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2393 of the line currently being canceled via Ctrl-C. It's extremely
2397 of the line currently being canceled via Ctrl-C. It's extremely
2394 ugly, but I don't know how to do it better (the problem is one of
2398 ugly, but I don't know how to do it better (the problem is one of
2395 handling cross-thread exceptions).
2399 handling cross-thread exceptions).
2396
2400
2397 2004-10-28 Fernando Perez <fperez@colorado.edu>
2401 2004-10-28 Fernando Perez <fperez@colorado.edu>
2398
2402
2399 * IPython/Shell.py (signal_handler): add signal handlers to trap
2403 * IPython/Shell.py (signal_handler): add signal handlers to trap
2400 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2404 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2401 report by Francesc Alted.
2405 report by Francesc Alted.
2402
2406
2403 2004-10-21 Fernando Perez <fperez@colorado.edu>
2407 2004-10-21 Fernando Perez <fperez@colorado.edu>
2404
2408
2405 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2409 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2406 to % for pysh syntax extensions.
2410 to % for pysh syntax extensions.
2407
2411
2408 2004-10-09 Fernando Perez <fperez@colorado.edu>
2412 2004-10-09 Fernando Perez <fperez@colorado.edu>
2409
2413
2410 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2414 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2411 arrays to print a more useful summary, without calling str(arr).
2415 arrays to print a more useful summary, without calling str(arr).
2412 This avoids the problem of extremely lengthy computations which
2416 This avoids the problem of extremely lengthy computations which
2413 occur if arr is large, and appear to the user as a system lockup
2417 occur if arr is large, and appear to the user as a system lockup
2414 with 100% cpu activity. After a suggestion by Kristian Sandberg
2418 with 100% cpu activity. After a suggestion by Kristian Sandberg
2415 <Kristian.Sandberg@colorado.edu>.
2419 <Kristian.Sandberg@colorado.edu>.
2416 (Magic.__init__): fix bug in global magic escapes not being
2420 (Magic.__init__): fix bug in global magic escapes not being
2417 correctly set.
2421 correctly set.
2418
2422
2419 2004-10-08 Fernando Perez <fperez@colorado.edu>
2423 2004-10-08 Fernando Perez <fperez@colorado.edu>
2420
2424
2421 * IPython/Magic.py (__license__): change to absolute imports of
2425 * IPython/Magic.py (__license__): change to absolute imports of
2422 ipython's own internal packages, to start adapting to the absolute
2426 ipython's own internal packages, to start adapting to the absolute
2423 import requirement of PEP-328.
2427 import requirement of PEP-328.
2424
2428
2425 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2429 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2426 files, and standardize author/license marks through the Release
2430 files, and standardize author/license marks through the Release
2427 module instead of having per/file stuff (except for files with
2431 module instead of having per/file stuff (except for files with
2428 particular licenses, like the MIT/PSF-licensed codes).
2432 particular licenses, like the MIT/PSF-licensed codes).
2429
2433
2430 * IPython/Debugger.py: remove dead code for python 2.1
2434 * IPython/Debugger.py: remove dead code for python 2.1
2431
2435
2432 2004-10-04 Fernando Perez <fperez@colorado.edu>
2436 2004-10-04 Fernando Perez <fperez@colorado.edu>
2433
2437
2434 * IPython/iplib.py (ipmagic): New function for accessing magics
2438 * IPython/iplib.py (ipmagic): New function for accessing magics
2435 via a normal python function call.
2439 via a normal python function call.
2436
2440
2437 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2441 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2438 from '@' to '%', to accomodate the new @decorator syntax of python
2442 from '@' to '%', to accomodate the new @decorator syntax of python
2439 2.4.
2443 2.4.
2440
2444
2441 2004-09-29 Fernando Perez <fperez@colorado.edu>
2445 2004-09-29 Fernando Perez <fperez@colorado.edu>
2442
2446
2443 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2447 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2444 matplotlib.use to prevent running scripts which try to switch
2448 matplotlib.use to prevent running scripts which try to switch
2445 interactive backends from within ipython. This will just crash
2449 interactive backends from within ipython. This will just crash
2446 the python interpreter, so we can't allow it (but a detailed error
2450 the python interpreter, so we can't allow it (but a detailed error
2447 is given to the user).
2451 is given to the user).
2448
2452
2449 2004-09-28 Fernando Perez <fperez@colorado.edu>
2453 2004-09-28 Fernando Perez <fperez@colorado.edu>
2450
2454
2451 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2455 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2452 matplotlib-related fixes so that using @run with non-matplotlib
2456 matplotlib-related fixes so that using @run with non-matplotlib
2453 scripts doesn't pop up spurious plot windows. This requires
2457 scripts doesn't pop up spurious plot windows. This requires
2454 matplotlib >= 0.63, where I had to make some changes as well.
2458 matplotlib >= 0.63, where I had to make some changes as well.
2455
2459
2456 * IPython/ipmaker.py (make_IPython): update version requirement to
2460 * IPython/ipmaker.py (make_IPython): update version requirement to
2457 python 2.2.
2461 python 2.2.
2458
2462
2459 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2463 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2460 banner arg for embedded customization.
2464 banner arg for embedded customization.
2461
2465
2462 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2466 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2463 explicit uses of __IP as the IPython's instance name. Now things
2467 explicit uses of __IP as the IPython's instance name. Now things
2464 are properly handled via the shell.name value. The actual code
2468 are properly handled via the shell.name value. The actual code
2465 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2469 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2466 is much better than before. I'll clean things completely when the
2470 is much better than before. I'll clean things completely when the
2467 magic stuff gets a real overhaul.
2471 magic stuff gets a real overhaul.
2468
2472
2469 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2473 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2470 minor changes to debian dir.
2474 minor changes to debian dir.
2471
2475
2472 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2476 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2473 pointer to the shell itself in the interactive namespace even when
2477 pointer to the shell itself in the interactive namespace even when
2474 a user-supplied dict is provided. This is needed for embedding
2478 a user-supplied dict is provided. This is needed for embedding
2475 purposes (found by tests with Michel Sanner).
2479 purposes (found by tests with Michel Sanner).
2476
2480
2477 2004-09-27 Fernando Perez <fperez@colorado.edu>
2481 2004-09-27 Fernando Perez <fperez@colorado.edu>
2478
2482
2479 * IPython/UserConfig/ipythonrc: remove []{} from
2483 * IPython/UserConfig/ipythonrc: remove []{} from
2480 readline_remove_delims, so that things like [modname.<TAB> do
2484 readline_remove_delims, so that things like [modname.<TAB> do
2481 proper completion. This disables [].TAB, but that's a less common
2485 proper completion. This disables [].TAB, but that's a less common
2482 case than module names in list comprehensions, for example.
2486 case than module names in list comprehensions, for example.
2483 Thanks to a report by Andrea Riciputi.
2487 Thanks to a report by Andrea Riciputi.
2484
2488
2485 2004-09-09 Fernando Perez <fperez@colorado.edu>
2489 2004-09-09 Fernando Perez <fperez@colorado.edu>
2486
2490
2487 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2491 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2488 blocking problems in win32 and osx. Fix by John.
2492 blocking problems in win32 and osx. Fix by John.
2489
2493
2490 2004-09-08 Fernando Perez <fperez@colorado.edu>
2494 2004-09-08 Fernando Perez <fperez@colorado.edu>
2491
2495
2492 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2496 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2493 for Win32 and OSX. Fix by John Hunter.
2497 for Win32 and OSX. Fix by John Hunter.
2494
2498
2495 2004-08-30 *** Released version 0.6.3
2499 2004-08-30 *** Released version 0.6.3
2496
2500
2497 2004-08-30 Fernando Perez <fperez@colorado.edu>
2501 2004-08-30 Fernando Perez <fperez@colorado.edu>
2498
2502
2499 * setup.py (isfile): Add manpages to list of dependent files to be
2503 * setup.py (isfile): Add manpages to list of dependent files to be
2500 updated.
2504 updated.
2501
2505
2502 2004-08-27 Fernando Perez <fperez@colorado.edu>
2506 2004-08-27 Fernando Perez <fperez@colorado.edu>
2503
2507
2504 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2508 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2505 for now. They don't really work with standalone WX/GTK code
2509 for now. They don't really work with standalone WX/GTK code
2506 (though matplotlib IS working fine with both of those backends).
2510 (though matplotlib IS working fine with both of those backends).
2507 This will neeed much more testing. I disabled most things with
2511 This will neeed much more testing. I disabled most things with
2508 comments, so turning it back on later should be pretty easy.
2512 comments, so turning it back on later should be pretty easy.
2509
2513
2510 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2514 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2511 autocalling of expressions like r'foo', by modifying the line
2515 autocalling of expressions like r'foo', by modifying the line
2512 split regexp. Closes
2516 split regexp. Closes
2513 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2517 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2514 Riley <ipythonbugs-AT-sabi.net>.
2518 Riley <ipythonbugs-AT-sabi.net>.
2515 (InteractiveShell.mainloop): honor --nobanner with banner
2519 (InteractiveShell.mainloop): honor --nobanner with banner
2516 extensions.
2520 extensions.
2517
2521
2518 * IPython/Shell.py: Significant refactoring of all classes, so
2522 * IPython/Shell.py: Significant refactoring of all classes, so
2519 that we can really support ALL matplotlib backends and threading
2523 that we can really support ALL matplotlib backends and threading
2520 models (John spotted a bug with Tk which required this). Now we
2524 models (John spotted a bug with Tk which required this). Now we
2521 should support single-threaded, WX-threads and GTK-threads, both
2525 should support single-threaded, WX-threads and GTK-threads, both
2522 for generic code and for matplotlib.
2526 for generic code and for matplotlib.
2523
2527
2524 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2528 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2525 -pylab, to simplify things for users. Will also remove the pylab
2529 -pylab, to simplify things for users. Will also remove the pylab
2526 profile, since now all of matplotlib configuration is directly
2530 profile, since now all of matplotlib configuration is directly
2527 handled here. This also reduces startup time.
2531 handled here. This also reduces startup time.
2528
2532
2529 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2533 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2530 shell wasn't being correctly called. Also in IPShellWX.
2534 shell wasn't being correctly called. Also in IPShellWX.
2531
2535
2532 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2536 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2533 fine-tune banner.
2537 fine-tune banner.
2534
2538
2535 * IPython/numutils.py (spike): Deprecate these spike functions,
2539 * IPython/numutils.py (spike): Deprecate these spike functions,
2536 delete (long deprecated) gnuplot_exec handler.
2540 delete (long deprecated) gnuplot_exec handler.
2537
2541
2538 2004-08-26 Fernando Perez <fperez@colorado.edu>
2542 2004-08-26 Fernando Perez <fperez@colorado.edu>
2539
2543
2540 * ipython.1: Update for threading options, plus some others which
2544 * ipython.1: Update for threading options, plus some others which
2541 were missing.
2545 were missing.
2542
2546
2543 * IPython/ipmaker.py (__call__): Added -wthread option for
2547 * IPython/ipmaker.py (__call__): Added -wthread option for
2544 wxpython thread handling. Make sure threading options are only
2548 wxpython thread handling. Make sure threading options are only
2545 valid at the command line.
2549 valid at the command line.
2546
2550
2547 * scripts/ipython: moved shell selection into a factory function
2551 * scripts/ipython: moved shell selection into a factory function
2548 in Shell.py, to keep the starter script to a minimum.
2552 in Shell.py, to keep the starter script to a minimum.
2549
2553
2550 2004-08-25 Fernando Perez <fperez@colorado.edu>
2554 2004-08-25 Fernando Perez <fperez@colorado.edu>
2551
2555
2552 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2556 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2553 John. Along with some recent changes he made to matplotlib, the
2557 John. Along with some recent changes he made to matplotlib, the
2554 next versions of both systems should work very well together.
2558 next versions of both systems should work very well together.
2555
2559
2556 2004-08-24 Fernando Perez <fperez@colorado.edu>
2560 2004-08-24 Fernando Perez <fperez@colorado.edu>
2557
2561
2558 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2562 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2559 tried to switch the profiling to using hotshot, but I'm getting
2563 tried to switch the profiling to using hotshot, but I'm getting
2560 strange errors from prof.runctx() there. I may be misreading the
2564 strange errors from prof.runctx() there. I may be misreading the
2561 docs, but it looks weird. For now the profiling code will
2565 docs, but it looks weird. For now the profiling code will
2562 continue to use the standard profiler.
2566 continue to use the standard profiler.
2563
2567
2564 2004-08-23 Fernando Perez <fperez@colorado.edu>
2568 2004-08-23 Fernando Perez <fperez@colorado.edu>
2565
2569
2566 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2570 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2567 threaded shell, by John Hunter. It's not quite ready yet, but
2571 threaded shell, by John Hunter. It's not quite ready yet, but
2568 close.
2572 close.
2569
2573
2570 2004-08-22 Fernando Perez <fperez@colorado.edu>
2574 2004-08-22 Fernando Perez <fperez@colorado.edu>
2571
2575
2572 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2576 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2573 in Magic and ultraTB.
2577 in Magic and ultraTB.
2574
2578
2575 * ipython.1: document threading options in manpage.
2579 * ipython.1: document threading options in manpage.
2576
2580
2577 * scripts/ipython: Changed name of -thread option to -gthread,
2581 * scripts/ipython: Changed name of -thread option to -gthread,
2578 since this is GTK specific. I want to leave the door open for a
2582 since this is GTK specific. I want to leave the door open for a
2579 -wthread option for WX, which will most likely be necessary. This
2583 -wthread option for WX, which will most likely be necessary. This
2580 change affects usage and ipmaker as well.
2584 change affects usage and ipmaker as well.
2581
2585
2582 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2586 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2583 handle the matplotlib shell issues. Code by John Hunter
2587 handle the matplotlib shell issues. Code by John Hunter
2584 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2588 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2585 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2589 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2586 broken (and disabled for end users) for now, but it puts the
2590 broken (and disabled for end users) for now, but it puts the
2587 infrastructure in place.
2591 infrastructure in place.
2588
2592
2589 2004-08-21 Fernando Perez <fperez@colorado.edu>
2593 2004-08-21 Fernando Perez <fperez@colorado.edu>
2590
2594
2591 * ipythonrc-pylab: Add matplotlib support.
2595 * ipythonrc-pylab: Add matplotlib support.
2592
2596
2593 * matplotlib_config.py: new files for matplotlib support, part of
2597 * matplotlib_config.py: new files for matplotlib support, part of
2594 the pylab profile.
2598 the pylab profile.
2595
2599
2596 * IPython/usage.py (__doc__): documented the threading options.
2600 * IPython/usage.py (__doc__): documented the threading options.
2597
2601
2598 2004-08-20 Fernando Perez <fperez@colorado.edu>
2602 2004-08-20 Fernando Perez <fperez@colorado.edu>
2599
2603
2600 * ipython: Modified the main calling routine to handle the -thread
2604 * ipython: Modified the main calling routine to handle the -thread
2601 and -mpthread options. This needs to be done as a top-level hack,
2605 and -mpthread options. This needs to be done as a top-level hack,
2602 because it determines which class to instantiate for IPython
2606 because it determines which class to instantiate for IPython
2603 itself.
2607 itself.
2604
2608
2605 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2609 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2606 classes to support multithreaded GTK operation without blocking,
2610 classes to support multithreaded GTK operation without blocking,
2607 and matplotlib with all backends. This is a lot of still very
2611 and matplotlib with all backends. This is a lot of still very
2608 experimental code, and threads are tricky. So it may still have a
2612 experimental code, and threads are tricky. So it may still have a
2609 few rough edges... This code owes a lot to
2613 few rough edges... This code owes a lot to
2610 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2614 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2611 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2615 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2612 to John Hunter for all the matplotlib work.
2616 to John Hunter for all the matplotlib work.
2613
2617
2614 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2618 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2615 options for gtk thread and matplotlib support.
2619 options for gtk thread and matplotlib support.
2616
2620
2617 2004-08-16 Fernando Perez <fperez@colorado.edu>
2621 2004-08-16 Fernando Perez <fperez@colorado.edu>
2618
2622
2619 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2623 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2620 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2624 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2621 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2625 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2622
2626
2623 2004-08-11 Fernando Perez <fperez@colorado.edu>
2627 2004-08-11 Fernando Perez <fperez@colorado.edu>
2624
2628
2625 * setup.py (isfile): Fix build so documentation gets updated for
2629 * setup.py (isfile): Fix build so documentation gets updated for
2626 rpms (it was only done for .tgz builds).
2630 rpms (it was only done for .tgz builds).
2627
2631
2628 2004-08-10 Fernando Perez <fperez@colorado.edu>
2632 2004-08-10 Fernando Perez <fperez@colorado.edu>
2629
2633
2630 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2634 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2631
2635
2632 * iplib.py : Silence syntax error exceptions in tab-completion.
2636 * iplib.py : Silence syntax error exceptions in tab-completion.
2633
2637
2634 2004-08-05 Fernando Perez <fperez@colorado.edu>
2638 2004-08-05 Fernando Perez <fperez@colorado.edu>
2635
2639
2636 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2640 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2637 'color off' mark for continuation prompts. This was causing long
2641 'color off' mark for continuation prompts. This was causing long
2638 continuation lines to mis-wrap.
2642 continuation lines to mis-wrap.
2639
2643
2640 2004-08-01 Fernando Perez <fperez@colorado.edu>
2644 2004-08-01 Fernando Perez <fperez@colorado.edu>
2641
2645
2642 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2646 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2643 for building ipython to be a parameter. All this is necessary
2647 for building ipython to be a parameter. All this is necessary
2644 right now to have a multithreaded version, but this insane
2648 right now to have a multithreaded version, but this insane
2645 non-design will be cleaned up soon. For now, it's a hack that
2649 non-design will be cleaned up soon. For now, it's a hack that
2646 works.
2650 works.
2647
2651
2648 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2652 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2649 args in various places. No bugs so far, but it's a dangerous
2653 args in various places. No bugs so far, but it's a dangerous
2650 practice.
2654 practice.
2651
2655
2652 2004-07-31 Fernando Perez <fperez@colorado.edu>
2656 2004-07-31 Fernando Perez <fperez@colorado.edu>
2653
2657
2654 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2658 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2655 fix completion of files with dots in their names under most
2659 fix completion of files with dots in their names under most
2656 profiles (pysh was OK because the completion order is different).
2660 profiles (pysh was OK because the completion order is different).
2657
2661
2658 2004-07-27 Fernando Perez <fperez@colorado.edu>
2662 2004-07-27 Fernando Perez <fperez@colorado.edu>
2659
2663
2660 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2664 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2661 keywords manually, b/c the one in keyword.py was removed in python
2665 keywords manually, b/c the one in keyword.py was removed in python
2662 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2666 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2663 This is NOT a bug under python 2.3 and earlier.
2667 This is NOT a bug under python 2.3 and earlier.
2664
2668
2665 2004-07-26 Fernando Perez <fperez@colorado.edu>
2669 2004-07-26 Fernando Perez <fperez@colorado.edu>
2666
2670
2667 * IPython/ultraTB.py (VerboseTB.text): Add another
2671 * IPython/ultraTB.py (VerboseTB.text): Add another
2668 linecache.checkcache() call to try to prevent inspect.py from
2672 linecache.checkcache() call to try to prevent inspect.py from
2669 crashing under python 2.3. I think this fixes
2673 crashing under python 2.3. I think this fixes
2670 http://www.scipy.net/roundup/ipython/issue17.
2674 http://www.scipy.net/roundup/ipython/issue17.
2671
2675
2672 2004-07-26 *** Released version 0.6.2
2676 2004-07-26 *** Released version 0.6.2
2673
2677
2674 2004-07-26 Fernando Perez <fperez@colorado.edu>
2678 2004-07-26 Fernando Perez <fperez@colorado.edu>
2675
2679
2676 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2680 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2677 fail for any number.
2681 fail for any number.
2678 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2682 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2679 empty bookmarks.
2683 empty bookmarks.
2680
2684
2681 2004-07-26 *** Released version 0.6.1
2685 2004-07-26 *** Released version 0.6.1
2682
2686
2683 2004-07-26 Fernando Perez <fperez@colorado.edu>
2687 2004-07-26 Fernando Perez <fperez@colorado.edu>
2684
2688
2685 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2689 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2686
2690
2687 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2691 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2688 escaping '()[]{}' in filenames.
2692 escaping '()[]{}' in filenames.
2689
2693
2690 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2694 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2691 Python 2.2 users who lack a proper shlex.split.
2695 Python 2.2 users who lack a proper shlex.split.
2692
2696
2693 2004-07-19 Fernando Perez <fperez@colorado.edu>
2697 2004-07-19 Fernando Perez <fperez@colorado.edu>
2694
2698
2695 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2699 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2696 for reading readline's init file. I follow the normal chain:
2700 for reading readline's init file. I follow the normal chain:
2697 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2701 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2698 report by Mike Heeter. This closes
2702 report by Mike Heeter. This closes
2699 http://www.scipy.net/roundup/ipython/issue16.
2703 http://www.scipy.net/roundup/ipython/issue16.
2700
2704
2701 2004-07-18 Fernando Perez <fperez@colorado.edu>
2705 2004-07-18 Fernando Perez <fperez@colorado.edu>
2702
2706
2703 * IPython/iplib.py (__init__): Add better handling of '\' under
2707 * IPython/iplib.py (__init__): Add better handling of '\' under
2704 Win32 for filenames. After a patch by Ville.
2708 Win32 for filenames. After a patch by Ville.
2705
2709
2706 2004-07-17 Fernando Perez <fperez@colorado.edu>
2710 2004-07-17 Fernando Perez <fperez@colorado.edu>
2707
2711
2708 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2712 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2709 autocalling would be triggered for 'foo is bar' if foo is
2713 autocalling would be triggered for 'foo is bar' if foo is
2710 callable. I also cleaned up the autocall detection code to use a
2714 callable. I also cleaned up the autocall detection code to use a
2711 regexp, which is faster. Bug reported by Alexander Schmolck.
2715 regexp, which is faster. Bug reported by Alexander Schmolck.
2712
2716
2713 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2717 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2714 '?' in them would confuse the help system. Reported by Alex
2718 '?' in them would confuse the help system. Reported by Alex
2715 Schmolck.
2719 Schmolck.
2716
2720
2717 2004-07-16 Fernando Perez <fperez@colorado.edu>
2721 2004-07-16 Fernando Perez <fperez@colorado.edu>
2718
2722
2719 * IPython/GnuplotInteractive.py (__all__): added plot2.
2723 * IPython/GnuplotInteractive.py (__all__): added plot2.
2720
2724
2721 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2725 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2722 plotting dictionaries, lists or tuples of 1d arrays.
2726 plotting dictionaries, lists or tuples of 1d arrays.
2723
2727
2724 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2728 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2725 optimizations.
2729 optimizations.
2726
2730
2727 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2731 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2728 the information which was there from Janko's original IPP code:
2732 the information which was there from Janko's original IPP code:
2729
2733
2730 03.05.99 20:53 porto.ifm.uni-kiel.de
2734 03.05.99 20:53 porto.ifm.uni-kiel.de
2731 --Started changelog.
2735 --Started changelog.
2732 --make clear do what it say it does
2736 --make clear do what it say it does
2733 --added pretty output of lines from inputcache
2737 --added pretty output of lines from inputcache
2734 --Made Logger a mixin class, simplifies handling of switches
2738 --Made Logger a mixin class, simplifies handling of switches
2735 --Added own completer class. .string<TAB> expands to last history
2739 --Added own completer class. .string<TAB> expands to last history
2736 line which starts with string. The new expansion is also present
2740 line which starts with string. The new expansion is also present
2737 with Ctrl-r from the readline library. But this shows, who this
2741 with Ctrl-r from the readline library. But this shows, who this
2738 can be done for other cases.
2742 can be done for other cases.
2739 --Added convention that all shell functions should accept a
2743 --Added convention that all shell functions should accept a
2740 parameter_string This opens the door for different behaviour for
2744 parameter_string This opens the door for different behaviour for
2741 each function. @cd is a good example of this.
2745 each function. @cd is a good example of this.
2742
2746
2743 04.05.99 12:12 porto.ifm.uni-kiel.de
2747 04.05.99 12:12 porto.ifm.uni-kiel.de
2744 --added logfile rotation
2748 --added logfile rotation
2745 --added new mainloop method which freezes first the namespace
2749 --added new mainloop method which freezes first the namespace
2746
2750
2747 07.05.99 21:24 porto.ifm.uni-kiel.de
2751 07.05.99 21:24 porto.ifm.uni-kiel.de
2748 --added the docreader classes. Now there is a help system.
2752 --added the docreader classes. Now there is a help system.
2749 -This is only a first try. Currently it's not easy to put new
2753 -This is only a first try. Currently it's not easy to put new
2750 stuff in the indices. But this is the way to go. Info would be
2754 stuff in the indices. But this is the way to go. Info would be
2751 better, but HTML is every where and not everybody has an info
2755 better, but HTML is every where and not everybody has an info
2752 system installed and it's not so easy to change html-docs to info.
2756 system installed and it's not so easy to change html-docs to info.
2753 --added global logfile option
2757 --added global logfile option
2754 --there is now a hook for object inspection method pinfo needs to
2758 --there is now a hook for object inspection method pinfo needs to
2755 be provided for this. Can be reached by two '??'.
2759 be provided for this. Can be reached by two '??'.
2756
2760
2757 08.05.99 20:51 porto.ifm.uni-kiel.de
2761 08.05.99 20:51 porto.ifm.uni-kiel.de
2758 --added a README
2762 --added a README
2759 --bug in rc file. Something has changed so functions in the rc
2763 --bug in rc file. Something has changed so functions in the rc
2760 file need to reference the shell and not self. Not clear if it's a
2764 file need to reference the shell and not self. Not clear if it's a
2761 bug or feature.
2765 bug or feature.
2762 --changed rc file for new behavior
2766 --changed rc file for new behavior
2763
2767
2764 2004-07-15 Fernando Perez <fperez@colorado.edu>
2768 2004-07-15 Fernando Perez <fperez@colorado.edu>
2765
2769
2766 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2770 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2767 cache was falling out of sync in bizarre manners when multi-line
2771 cache was falling out of sync in bizarre manners when multi-line
2768 input was present. Minor optimizations and cleanup.
2772 input was present. Minor optimizations and cleanup.
2769
2773
2770 (Logger): Remove old Changelog info for cleanup. This is the
2774 (Logger): Remove old Changelog info for cleanup. This is the
2771 information which was there from Janko's original code:
2775 information which was there from Janko's original code:
2772
2776
2773 Changes to Logger: - made the default log filename a parameter
2777 Changes to Logger: - made the default log filename a parameter
2774
2778
2775 - put a check for lines beginning with !@? in log(). Needed
2779 - put a check for lines beginning with !@? in log(). Needed
2776 (even if the handlers properly log their lines) for mid-session
2780 (even if the handlers properly log their lines) for mid-session
2777 logging activation to work properly. Without this, lines logged
2781 logging activation to work properly. Without this, lines logged
2778 in mid session, which get read from the cache, would end up
2782 in mid session, which get read from the cache, would end up
2779 'bare' (with !@? in the open) in the log. Now they are caught
2783 'bare' (with !@? in the open) in the log. Now they are caught
2780 and prepended with a #.
2784 and prepended with a #.
2781
2785
2782 * IPython/iplib.py (InteractiveShell.init_readline): added check
2786 * IPython/iplib.py (InteractiveShell.init_readline): added check
2783 in case MagicCompleter fails to be defined, so we don't crash.
2787 in case MagicCompleter fails to be defined, so we don't crash.
2784
2788
2785 2004-07-13 Fernando Perez <fperez@colorado.edu>
2789 2004-07-13 Fernando Perez <fperez@colorado.edu>
2786
2790
2787 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2791 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2788 of EPS if the requested filename ends in '.eps'.
2792 of EPS if the requested filename ends in '.eps'.
2789
2793
2790 2004-07-04 Fernando Perez <fperez@colorado.edu>
2794 2004-07-04 Fernando Perez <fperez@colorado.edu>
2791
2795
2792 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2796 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2793 escaping of quotes when calling the shell.
2797 escaping of quotes when calling the shell.
2794
2798
2795 2004-07-02 Fernando Perez <fperez@colorado.edu>
2799 2004-07-02 Fernando Perez <fperez@colorado.edu>
2796
2800
2797 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2801 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2798 gettext not working because we were clobbering '_'. Fixes
2802 gettext not working because we were clobbering '_'. Fixes
2799 http://www.scipy.net/roundup/ipython/issue6.
2803 http://www.scipy.net/roundup/ipython/issue6.
2800
2804
2801 2004-07-01 Fernando Perez <fperez@colorado.edu>
2805 2004-07-01 Fernando Perez <fperez@colorado.edu>
2802
2806
2803 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2807 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2804 into @cd. Patch by Ville.
2808 into @cd. Patch by Ville.
2805
2809
2806 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2810 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2807 new function to store things after ipmaker runs. Patch by Ville.
2811 new function to store things after ipmaker runs. Patch by Ville.
2808 Eventually this will go away once ipmaker is removed and the class
2812 Eventually this will go away once ipmaker is removed and the class
2809 gets cleaned up, but for now it's ok. Key functionality here is
2813 gets cleaned up, but for now it's ok. Key functionality here is
2810 the addition of the persistent storage mechanism, a dict for
2814 the addition of the persistent storage mechanism, a dict for
2811 keeping data across sessions (for now just bookmarks, but more can
2815 keeping data across sessions (for now just bookmarks, but more can
2812 be implemented later).
2816 be implemented later).
2813
2817
2814 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2818 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2815 persistent across sections. Patch by Ville, I modified it
2819 persistent across sections. Patch by Ville, I modified it
2816 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2820 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2817 added a '-l' option to list all bookmarks.
2821 added a '-l' option to list all bookmarks.
2818
2822
2819 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2823 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2820 center for cleanup. Registered with atexit.register(). I moved
2824 center for cleanup. Registered with atexit.register(). I moved
2821 here the old exit_cleanup(). After a patch by Ville.
2825 here the old exit_cleanup(). After a patch by Ville.
2822
2826
2823 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2827 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2824 characters in the hacked shlex_split for python 2.2.
2828 characters in the hacked shlex_split for python 2.2.
2825
2829
2826 * IPython/iplib.py (file_matches): more fixes to filenames with
2830 * IPython/iplib.py (file_matches): more fixes to filenames with
2827 whitespace in them. It's not perfect, but limitations in python's
2831 whitespace in them. It's not perfect, but limitations in python's
2828 readline make it impossible to go further.
2832 readline make it impossible to go further.
2829
2833
2830 2004-06-29 Fernando Perez <fperez@colorado.edu>
2834 2004-06-29 Fernando Perez <fperez@colorado.edu>
2831
2835
2832 * IPython/iplib.py (file_matches): escape whitespace correctly in
2836 * IPython/iplib.py (file_matches): escape whitespace correctly in
2833 filename completions. Bug reported by Ville.
2837 filename completions. Bug reported by Ville.
2834
2838
2835 2004-06-28 Fernando Perez <fperez@colorado.edu>
2839 2004-06-28 Fernando Perez <fperez@colorado.edu>
2836
2840
2837 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2841 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2838 the history file will be called 'history-PROFNAME' (or just
2842 the history file will be called 'history-PROFNAME' (or just
2839 'history' if no profile is loaded). I was getting annoyed at
2843 'history' if no profile is loaded). I was getting annoyed at
2840 getting my Numerical work history clobbered by pysh sessions.
2844 getting my Numerical work history clobbered by pysh sessions.
2841
2845
2842 * IPython/iplib.py (InteractiveShell.__init__): Internal
2846 * IPython/iplib.py (InteractiveShell.__init__): Internal
2843 getoutputerror() function so that we can honor the system_verbose
2847 getoutputerror() function so that we can honor the system_verbose
2844 flag for _all_ system calls. I also added escaping of #
2848 flag for _all_ system calls. I also added escaping of #
2845 characters here to avoid confusing Itpl.
2849 characters here to avoid confusing Itpl.
2846
2850
2847 * IPython/Magic.py (shlex_split): removed call to shell in
2851 * IPython/Magic.py (shlex_split): removed call to shell in
2848 parse_options and replaced it with shlex.split(). The annoying
2852 parse_options and replaced it with shlex.split(). The annoying
2849 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2853 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2850 to backport it from 2.3, with several frail hacks (the shlex
2854 to backport it from 2.3, with several frail hacks (the shlex
2851 module is rather limited in 2.2). Thanks to a suggestion by Ville
2855 module is rather limited in 2.2). Thanks to a suggestion by Ville
2852 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2856 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2853 problem.
2857 problem.
2854
2858
2855 (Magic.magic_system_verbose): new toggle to print the actual
2859 (Magic.magic_system_verbose): new toggle to print the actual
2856 system calls made by ipython. Mainly for debugging purposes.
2860 system calls made by ipython. Mainly for debugging purposes.
2857
2861
2858 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2862 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2859 doesn't support persistence. Reported (and fix suggested) by
2863 doesn't support persistence. Reported (and fix suggested) by
2860 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2864 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2861
2865
2862 2004-06-26 Fernando Perez <fperez@colorado.edu>
2866 2004-06-26 Fernando Perez <fperez@colorado.edu>
2863
2867
2864 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2868 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2865 continue prompts.
2869 continue prompts.
2866
2870
2867 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2871 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2868 function (basically a big docstring) and a few more things here to
2872 function (basically a big docstring) and a few more things here to
2869 speedup startup. pysh.py is now very lightweight. We want because
2873 speedup startup. pysh.py is now very lightweight. We want because
2870 it gets execfile'd, while InterpreterExec gets imported, so
2874 it gets execfile'd, while InterpreterExec gets imported, so
2871 byte-compilation saves time.
2875 byte-compilation saves time.
2872
2876
2873 2004-06-25 Fernando Perez <fperez@colorado.edu>
2877 2004-06-25 Fernando Perez <fperez@colorado.edu>
2874
2878
2875 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2879 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2876 -NUM', which was recently broken.
2880 -NUM', which was recently broken.
2877
2881
2878 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2882 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2879 in multi-line input (but not !!, which doesn't make sense there).
2883 in multi-line input (but not !!, which doesn't make sense there).
2880
2884
2881 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2885 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2882 It's just too useful, and people can turn it off in the less
2886 It's just too useful, and people can turn it off in the less
2883 common cases where it's a problem.
2887 common cases where it's a problem.
2884
2888
2885 2004-06-24 Fernando Perez <fperez@colorado.edu>
2889 2004-06-24 Fernando Perez <fperez@colorado.edu>
2886
2890
2887 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2891 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2888 special syntaxes (like alias calling) is now allied in multi-line
2892 special syntaxes (like alias calling) is now allied in multi-line
2889 input. This is still _very_ experimental, but it's necessary for
2893 input. This is still _very_ experimental, but it's necessary for
2890 efficient shell usage combining python looping syntax with system
2894 efficient shell usage combining python looping syntax with system
2891 calls. For now it's restricted to aliases, I don't think it
2895 calls. For now it's restricted to aliases, I don't think it
2892 really even makes sense to have this for magics.
2896 really even makes sense to have this for magics.
2893
2897
2894 2004-06-23 Fernando Perez <fperez@colorado.edu>
2898 2004-06-23 Fernando Perez <fperez@colorado.edu>
2895
2899
2896 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2900 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2897 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2901 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2898
2902
2899 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2903 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2900 extensions under Windows (after code sent by Gary Bishop). The
2904 extensions under Windows (after code sent by Gary Bishop). The
2901 extensions considered 'executable' are stored in IPython's rc
2905 extensions considered 'executable' are stored in IPython's rc
2902 structure as win_exec_ext.
2906 structure as win_exec_ext.
2903
2907
2904 * IPython/genutils.py (shell): new function, like system() but
2908 * IPython/genutils.py (shell): new function, like system() but
2905 without return value. Very useful for interactive shell work.
2909 without return value. Very useful for interactive shell work.
2906
2910
2907 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2911 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2908 delete aliases.
2912 delete aliases.
2909
2913
2910 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2914 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2911 sure that the alias table doesn't contain python keywords.
2915 sure that the alias table doesn't contain python keywords.
2912
2916
2913 2004-06-21 Fernando Perez <fperez@colorado.edu>
2917 2004-06-21 Fernando Perez <fperez@colorado.edu>
2914
2918
2915 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2919 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2916 non-existent items are found in $PATH. Reported by Thorsten.
2920 non-existent items are found in $PATH. Reported by Thorsten.
2917
2921
2918 2004-06-20 Fernando Perez <fperez@colorado.edu>
2922 2004-06-20 Fernando Perez <fperez@colorado.edu>
2919
2923
2920 * IPython/iplib.py (complete): modified the completer so that the
2924 * IPython/iplib.py (complete): modified the completer so that the
2921 order of priorities can be easily changed at runtime.
2925 order of priorities can be easily changed at runtime.
2922
2926
2923 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2927 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2924 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2928 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2925
2929
2926 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2930 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2927 expand Python variables prepended with $ in all system calls. The
2931 expand Python variables prepended with $ in all system calls. The
2928 same was done to InteractiveShell.handle_shell_escape. Now all
2932 same was done to InteractiveShell.handle_shell_escape. Now all
2929 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2933 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2930 expansion of python variables and expressions according to the
2934 expansion of python variables and expressions according to the
2931 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2935 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2932
2936
2933 Though PEP-215 has been rejected, a similar (but simpler) one
2937 Though PEP-215 has been rejected, a similar (but simpler) one
2934 seems like it will go into Python 2.4, PEP-292 -
2938 seems like it will go into Python 2.4, PEP-292 -
2935 http://www.python.org/peps/pep-0292.html.
2939 http://www.python.org/peps/pep-0292.html.
2936
2940
2937 I'll keep the full syntax of PEP-215, since IPython has since the
2941 I'll keep the full syntax of PEP-215, since IPython has since the
2938 start used Ka-Ping Yee's reference implementation discussed there
2942 start used Ka-Ping Yee's reference implementation discussed there
2939 (Itpl), and I actually like the powerful semantics it offers.
2943 (Itpl), and I actually like the powerful semantics it offers.
2940
2944
2941 In order to access normal shell variables, the $ has to be escaped
2945 In order to access normal shell variables, the $ has to be escaped
2942 via an extra $. For example:
2946 via an extra $. For example:
2943
2947
2944 In [7]: PATH='a python variable'
2948 In [7]: PATH='a python variable'
2945
2949
2946 In [8]: !echo $PATH
2950 In [8]: !echo $PATH
2947 a python variable
2951 a python variable
2948
2952
2949 In [9]: !echo $$PATH
2953 In [9]: !echo $$PATH
2950 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2954 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2951
2955
2952 (Magic.parse_options): escape $ so the shell doesn't evaluate
2956 (Magic.parse_options): escape $ so the shell doesn't evaluate
2953 things prematurely.
2957 things prematurely.
2954
2958
2955 * IPython/iplib.py (InteractiveShell.call_alias): added the
2959 * IPython/iplib.py (InteractiveShell.call_alias): added the
2956 ability for aliases to expand python variables via $.
2960 ability for aliases to expand python variables via $.
2957
2961
2958 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2962 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2959 system, now there's a @rehash/@rehashx pair of magics. These work
2963 system, now there's a @rehash/@rehashx pair of magics. These work
2960 like the csh rehash command, and can be invoked at any time. They
2964 like the csh rehash command, and can be invoked at any time. They
2961 build a table of aliases to everything in the user's $PATH
2965 build a table of aliases to everything in the user's $PATH
2962 (@rehash uses everything, @rehashx is slower but only adds
2966 (@rehash uses everything, @rehashx is slower but only adds
2963 executable files). With this, the pysh.py-based shell profile can
2967 executable files). With this, the pysh.py-based shell profile can
2964 now simply call rehash upon startup, and full access to all
2968 now simply call rehash upon startup, and full access to all
2965 programs in the user's path is obtained.
2969 programs in the user's path is obtained.
2966
2970
2967 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2971 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2968 functionality is now fully in place. I removed the old dynamic
2972 functionality is now fully in place. I removed the old dynamic
2969 code generation based approach, in favor of a much lighter one
2973 code generation based approach, in favor of a much lighter one
2970 based on a simple dict. The advantage is that this allows me to
2974 based on a simple dict. The advantage is that this allows me to
2971 now have thousands of aliases with negligible cost (unthinkable
2975 now have thousands of aliases with negligible cost (unthinkable
2972 with the old system).
2976 with the old system).
2973
2977
2974 2004-06-19 Fernando Perez <fperez@colorado.edu>
2978 2004-06-19 Fernando Perez <fperez@colorado.edu>
2975
2979
2976 * IPython/iplib.py (__init__): extended MagicCompleter class to
2980 * IPython/iplib.py (__init__): extended MagicCompleter class to
2977 also complete (last in priority) on user aliases.
2981 also complete (last in priority) on user aliases.
2978
2982
2979 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2983 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2980 call to eval.
2984 call to eval.
2981 (ItplNS.__init__): Added a new class which functions like Itpl,
2985 (ItplNS.__init__): Added a new class which functions like Itpl,
2982 but allows configuring the namespace for the evaluation to occur
2986 but allows configuring the namespace for the evaluation to occur
2983 in.
2987 in.
2984
2988
2985 2004-06-18 Fernando Perez <fperez@colorado.edu>
2989 2004-06-18 Fernando Perez <fperez@colorado.edu>
2986
2990
2987 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2991 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2988 better message when 'exit' or 'quit' are typed (a common newbie
2992 better message when 'exit' or 'quit' are typed (a common newbie
2989 confusion).
2993 confusion).
2990
2994
2991 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2995 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2992 check for Windows users.
2996 check for Windows users.
2993
2997
2994 * IPython/iplib.py (InteractiveShell.user_setup): removed
2998 * IPython/iplib.py (InteractiveShell.user_setup): removed
2995 disabling of colors for Windows. I'll test at runtime and issue a
2999 disabling of colors for Windows. I'll test at runtime and issue a
2996 warning if Gary's readline isn't found, as to nudge users to
3000 warning if Gary's readline isn't found, as to nudge users to
2997 download it.
3001 download it.
2998
3002
2999 2004-06-16 Fernando Perez <fperez@colorado.edu>
3003 2004-06-16 Fernando Perez <fperez@colorado.edu>
3000
3004
3001 * IPython/genutils.py (Stream.__init__): changed to print errors
3005 * IPython/genutils.py (Stream.__init__): changed to print errors
3002 to sys.stderr. I had a circular dependency here. Now it's
3006 to sys.stderr. I had a circular dependency here. Now it's
3003 possible to run ipython as IDLE's shell (consider this pre-alpha,
3007 possible to run ipython as IDLE's shell (consider this pre-alpha,
3004 since true stdout things end up in the starting terminal instead
3008 since true stdout things end up in the starting terminal instead
3005 of IDLE's out).
3009 of IDLE's out).
3006
3010
3007 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3011 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3008 users who haven't # updated their prompt_in2 definitions. Remove
3012 users who haven't # updated their prompt_in2 definitions. Remove
3009 eventually.
3013 eventually.
3010 (multiple_replace): added credit to original ASPN recipe.
3014 (multiple_replace): added credit to original ASPN recipe.
3011
3015
3012 2004-06-15 Fernando Perez <fperez@colorado.edu>
3016 2004-06-15 Fernando Perez <fperez@colorado.edu>
3013
3017
3014 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3018 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3015 list of auto-defined aliases.
3019 list of auto-defined aliases.
3016
3020
3017 2004-06-13 Fernando Perez <fperez@colorado.edu>
3021 2004-06-13 Fernando Perez <fperez@colorado.edu>
3018
3022
3019 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3023 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3020 install was really requested (so setup.py can be used for other
3024 install was really requested (so setup.py can be used for other
3021 things under Windows).
3025 things under Windows).
3022
3026
3023 2004-06-10 Fernando Perez <fperez@colorado.edu>
3027 2004-06-10 Fernando Perez <fperez@colorado.edu>
3024
3028
3025 * IPython/Logger.py (Logger.create_log): Manually remove any old
3029 * IPython/Logger.py (Logger.create_log): Manually remove any old
3026 backup, since os.remove may fail under Windows. Fixes bug
3030 backup, since os.remove may fail under Windows. Fixes bug
3027 reported by Thorsten.
3031 reported by Thorsten.
3028
3032
3029 2004-06-09 Fernando Perez <fperez@colorado.edu>
3033 2004-06-09 Fernando Perez <fperez@colorado.edu>
3030
3034
3031 * examples/example-embed.py: fixed all references to %n (replaced
3035 * examples/example-embed.py: fixed all references to %n (replaced
3032 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3036 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3033 for all examples and the manual as well.
3037 for all examples and the manual as well.
3034
3038
3035 2004-06-08 Fernando Perez <fperez@colorado.edu>
3039 2004-06-08 Fernando Perez <fperez@colorado.edu>
3036
3040
3037 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3041 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3038 alignment and color management. All 3 prompt subsystems now
3042 alignment and color management. All 3 prompt subsystems now
3039 inherit from BasePrompt.
3043 inherit from BasePrompt.
3040
3044
3041 * tools/release: updates for windows installer build and tag rpms
3045 * tools/release: updates for windows installer build and tag rpms
3042 with python version (since paths are fixed).
3046 with python version (since paths are fixed).
3043
3047
3044 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3048 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3045 which will become eventually obsolete. Also fixed the default
3049 which will become eventually obsolete. Also fixed the default
3046 prompt_in2 to use \D, so at least new users start with the correct
3050 prompt_in2 to use \D, so at least new users start with the correct
3047 defaults.
3051 defaults.
3048 WARNING: Users with existing ipythonrc files will need to apply
3052 WARNING: Users with existing ipythonrc files will need to apply
3049 this fix manually!
3053 this fix manually!
3050
3054
3051 * setup.py: make windows installer (.exe). This is finally the
3055 * setup.py: make windows installer (.exe). This is finally the
3052 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3056 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3053 which I hadn't included because it required Python 2.3 (or recent
3057 which I hadn't included because it required Python 2.3 (or recent
3054 distutils).
3058 distutils).
3055
3059
3056 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3060 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3057 usage of new '\D' escape.
3061 usage of new '\D' escape.
3058
3062
3059 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3063 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3060 lacks os.getuid())
3064 lacks os.getuid())
3061 (CachedOutput.set_colors): Added the ability to turn coloring
3065 (CachedOutput.set_colors): Added the ability to turn coloring
3062 on/off with @colors even for manually defined prompt colors. It
3066 on/off with @colors even for manually defined prompt colors. It
3063 uses a nasty global, but it works safely and via the generic color
3067 uses a nasty global, but it works safely and via the generic color
3064 handling mechanism.
3068 handling mechanism.
3065 (Prompt2.__init__): Introduced new escape '\D' for continuation
3069 (Prompt2.__init__): Introduced new escape '\D' for continuation
3066 prompts. It represents the counter ('\#') as dots.
3070 prompts. It represents the counter ('\#') as dots.
3067 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3071 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3068 need to update their ipythonrc files and replace '%n' with '\D' in
3072 need to update their ipythonrc files and replace '%n' with '\D' in
3069 their prompt_in2 settings everywhere. Sorry, but there's
3073 their prompt_in2 settings everywhere. Sorry, but there's
3070 otherwise no clean way to get all prompts to properly align. The
3074 otherwise no clean way to get all prompts to properly align. The
3071 ipythonrc shipped with IPython has been updated.
3075 ipythonrc shipped with IPython has been updated.
3072
3076
3073 2004-06-07 Fernando Perez <fperez@colorado.edu>
3077 2004-06-07 Fernando Perez <fperez@colorado.edu>
3074
3078
3075 * setup.py (isfile): Pass local_icons option to latex2html, so the
3079 * setup.py (isfile): Pass local_icons option to latex2html, so the
3076 resulting HTML file is self-contained. Thanks to
3080 resulting HTML file is self-contained. Thanks to
3077 dryice-AT-liu.com.cn for the tip.
3081 dryice-AT-liu.com.cn for the tip.
3078
3082
3079 * pysh.py: I created a new profile 'shell', which implements a
3083 * pysh.py: I created a new profile 'shell', which implements a
3080 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3084 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3081 system shell, nor will it become one anytime soon. It's mainly
3085 system shell, nor will it become one anytime soon. It's mainly
3082 meant to illustrate the use of the new flexible bash-like prompts.
3086 meant to illustrate the use of the new flexible bash-like prompts.
3083 I guess it could be used by hardy souls for true shell management,
3087 I guess it could be used by hardy souls for true shell management,
3084 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3088 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3085 profile. This uses the InterpreterExec extension provided by
3089 profile. This uses the InterpreterExec extension provided by
3086 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3090 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3087
3091
3088 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3092 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3089 auto-align itself with the length of the previous input prompt
3093 auto-align itself with the length of the previous input prompt
3090 (taking into account the invisible color escapes).
3094 (taking into account the invisible color escapes).
3091 (CachedOutput.__init__): Large restructuring of this class. Now
3095 (CachedOutput.__init__): Large restructuring of this class. Now
3092 all three prompts (primary1, primary2, output) are proper objects,
3096 all three prompts (primary1, primary2, output) are proper objects,
3093 managed by the 'parent' CachedOutput class. The code is still a
3097 managed by the 'parent' CachedOutput class. The code is still a
3094 bit hackish (all prompts share state via a pointer to the cache),
3098 bit hackish (all prompts share state via a pointer to the cache),
3095 but it's overall far cleaner than before.
3099 but it's overall far cleaner than before.
3096
3100
3097 * IPython/genutils.py (getoutputerror): modified to add verbose,
3101 * IPython/genutils.py (getoutputerror): modified to add verbose,
3098 debug and header options. This makes the interface of all getout*
3102 debug and header options. This makes the interface of all getout*
3099 functions uniform.
3103 functions uniform.
3100 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3104 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3101
3105
3102 * IPython/Magic.py (Magic.default_option): added a function to
3106 * IPython/Magic.py (Magic.default_option): added a function to
3103 allow registering default options for any magic command. This
3107 allow registering default options for any magic command. This
3104 makes it easy to have profiles which customize the magics globally
3108 makes it easy to have profiles which customize the magics globally
3105 for a certain use. The values set through this function are
3109 for a certain use. The values set through this function are
3106 picked up by the parse_options() method, which all magics should
3110 picked up by the parse_options() method, which all magics should
3107 use to parse their options.
3111 use to parse their options.
3108
3112
3109 * IPython/genutils.py (warn): modified the warnings framework to
3113 * IPython/genutils.py (warn): modified the warnings framework to
3110 use the Term I/O class. I'm trying to slowly unify all of
3114 use the Term I/O class. I'm trying to slowly unify all of
3111 IPython's I/O operations to pass through Term.
3115 IPython's I/O operations to pass through Term.
3112
3116
3113 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3117 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3114 the secondary prompt to correctly match the length of the primary
3118 the secondary prompt to correctly match the length of the primary
3115 one for any prompt. Now multi-line code will properly line up
3119 one for any prompt. Now multi-line code will properly line up
3116 even for path dependent prompts, such as the new ones available
3120 even for path dependent prompts, such as the new ones available
3117 via the prompt_specials.
3121 via the prompt_specials.
3118
3122
3119 2004-06-06 Fernando Perez <fperez@colorado.edu>
3123 2004-06-06 Fernando Perez <fperez@colorado.edu>
3120
3124
3121 * IPython/Prompts.py (prompt_specials): Added the ability to have
3125 * IPython/Prompts.py (prompt_specials): Added the ability to have
3122 bash-like special sequences in the prompts, which get
3126 bash-like special sequences in the prompts, which get
3123 automatically expanded. Things like hostname, current working
3127 automatically expanded. Things like hostname, current working
3124 directory and username are implemented already, but it's easy to
3128 directory and username are implemented already, but it's easy to
3125 add more in the future. Thanks to a patch by W.J. van der Laan
3129 add more in the future. Thanks to a patch by W.J. van der Laan
3126 <gnufnork-AT-hetdigitalegat.nl>
3130 <gnufnork-AT-hetdigitalegat.nl>
3127 (prompt_specials): Added color support for prompt strings, so
3131 (prompt_specials): Added color support for prompt strings, so
3128 users can define arbitrary color setups for their prompts.
3132 users can define arbitrary color setups for their prompts.
3129
3133
3130 2004-06-05 Fernando Perez <fperez@colorado.edu>
3134 2004-06-05 Fernando Perez <fperez@colorado.edu>
3131
3135
3132 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3136 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3133 code to load Gary Bishop's readline and configure it
3137 code to load Gary Bishop's readline and configure it
3134 automatically. Thanks to Gary for help on this.
3138 automatically. Thanks to Gary for help on this.
3135
3139
3136 2004-06-01 Fernando Perez <fperez@colorado.edu>
3140 2004-06-01 Fernando Perez <fperez@colorado.edu>
3137
3141
3138 * IPython/Logger.py (Logger.create_log): fix bug for logging
3142 * IPython/Logger.py (Logger.create_log): fix bug for logging
3139 with no filename (previous fix was incomplete).
3143 with no filename (previous fix was incomplete).
3140
3144
3141 2004-05-25 Fernando Perez <fperez@colorado.edu>
3145 2004-05-25 Fernando Perez <fperez@colorado.edu>
3142
3146
3143 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3147 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3144 parens would get passed to the shell.
3148 parens would get passed to the shell.
3145
3149
3146 2004-05-20 Fernando Perez <fperez@colorado.edu>
3150 2004-05-20 Fernando Perez <fperez@colorado.edu>
3147
3151
3148 * IPython/Magic.py (Magic.magic_prun): changed default profile
3152 * IPython/Magic.py (Magic.magic_prun): changed default profile
3149 sort order to 'time' (the more common profiling need).
3153 sort order to 'time' (the more common profiling need).
3150
3154
3151 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3155 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3152 so that source code shown is guaranteed in sync with the file on
3156 so that source code shown is guaranteed in sync with the file on
3153 disk (also changed in psource). Similar fix to the one for
3157 disk (also changed in psource). Similar fix to the one for
3154 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3158 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3155 <yann.ledu-AT-noos.fr>.
3159 <yann.ledu-AT-noos.fr>.
3156
3160
3157 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3161 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3158 with a single option would not be correctly parsed. Closes
3162 with a single option would not be correctly parsed. Closes
3159 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3163 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3160 introduced in 0.6.0 (on 2004-05-06).
3164 introduced in 0.6.0 (on 2004-05-06).
3161
3165
3162 2004-05-13 *** Released version 0.6.0
3166 2004-05-13 *** Released version 0.6.0
3163
3167
3164 2004-05-13 Fernando Perez <fperez@colorado.edu>
3168 2004-05-13 Fernando Perez <fperez@colorado.edu>
3165
3169
3166 * debian/: Added debian/ directory to CVS, so that debian support
3170 * debian/: Added debian/ directory to CVS, so that debian support
3167 is publicly accessible. The debian package is maintained by Jack
3171 is publicly accessible. The debian package is maintained by Jack
3168 Moffit <jack-AT-xiph.org>.
3172 Moffit <jack-AT-xiph.org>.
3169
3173
3170 * Documentation: included the notes about an ipython-based system
3174 * Documentation: included the notes about an ipython-based system
3171 shell (the hypothetical 'pysh') into the new_design.pdf document,
3175 shell (the hypothetical 'pysh') into the new_design.pdf document,
3172 so that these ideas get distributed to users along with the
3176 so that these ideas get distributed to users along with the
3173 official documentation.
3177 official documentation.
3174
3178
3175 2004-05-10 Fernando Perez <fperez@colorado.edu>
3179 2004-05-10 Fernando Perez <fperez@colorado.edu>
3176
3180
3177 * IPython/Logger.py (Logger.create_log): fix recently introduced
3181 * IPython/Logger.py (Logger.create_log): fix recently introduced
3178 bug (misindented line) where logstart would fail when not given an
3182 bug (misindented line) where logstart would fail when not given an
3179 explicit filename.
3183 explicit filename.
3180
3184
3181 2004-05-09 Fernando Perez <fperez@colorado.edu>
3185 2004-05-09 Fernando Perez <fperez@colorado.edu>
3182
3186
3183 * IPython/Magic.py (Magic.parse_options): skip system call when
3187 * IPython/Magic.py (Magic.parse_options): skip system call when
3184 there are no options to look for. Faster, cleaner for the common
3188 there are no options to look for. Faster, cleaner for the common
3185 case.
3189 case.
3186
3190
3187 * Documentation: many updates to the manual: describing Windows
3191 * Documentation: many updates to the manual: describing Windows
3188 support better, Gnuplot updates, credits, misc small stuff. Also
3192 support better, Gnuplot updates, credits, misc small stuff. Also
3189 updated the new_design doc a bit.
3193 updated the new_design doc a bit.
3190
3194
3191 2004-05-06 *** Released version 0.6.0.rc1
3195 2004-05-06 *** Released version 0.6.0.rc1
3192
3196
3193 2004-05-06 Fernando Perez <fperez@colorado.edu>
3197 2004-05-06 Fernando Perez <fperez@colorado.edu>
3194
3198
3195 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3199 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3196 operations to use the vastly more efficient list/''.join() method.
3200 operations to use the vastly more efficient list/''.join() method.
3197 (FormattedTB.text): Fix
3201 (FormattedTB.text): Fix
3198 http://www.scipy.net/roundup/ipython/issue12 - exception source
3202 http://www.scipy.net/roundup/ipython/issue12 - exception source
3199 extract not updated after reload. Thanks to Mike Salib
3203 extract not updated after reload. Thanks to Mike Salib
3200 <msalib-AT-mit.edu> for pinning the source of the problem.
3204 <msalib-AT-mit.edu> for pinning the source of the problem.
3201 Fortunately, the solution works inside ipython and doesn't require
3205 Fortunately, the solution works inside ipython and doesn't require
3202 any changes to python proper.
3206 any changes to python proper.
3203
3207
3204 * IPython/Magic.py (Magic.parse_options): Improved to process the
3208 * IPython/Magic.py (Magic.parse_options): Improved to process the
3205 argument list as a true shell would (by actually using the
3209 argument list as a true shell would (by actually using the
3206 underlying system shell). This way, all @magics automatically get
3210 underlying system shell). This way, all @magics automatically get
3207 shell expansion for variables. Thanks to a comment by Alex
3211 shell expansion for variables. Thanks to a comment by Alex
3208 Schmolck.
3212 Schmolck.
3209
3213
3210 2004-04-04 Fernando Perez <fperez@colorado.edu>
3214 2004-04-04 Fernando Perez <fperez@colorado.edu>
3211
3215
3212 * IPython/iplib.py (InteractiveShell.interact): Added a special
3216 * IPython/iplib.py (InteractiveShell.interact): Added a special
3213 trap for a debugger quit exception, which is basically impossible
3217 trap for a debugger quit exception, which is basically impossible
3214 to handle by normal mechanisms, given what pdb does to the stack.
3218 to handle by normal mechanisms, given what pdb does to the stack.
3215 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3219 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3216
3220
3217 2004-04-03 Fernando Perez <fperez@colorado.edu>
3221 2004-04-03 Fernando Perez <fperez@colorado.edu>
3218
3222
3219 * IPython/genutils.py (Term): Standardized the names of the Term
3223 * IPython/genutils.py (Term): Standardized the names of the Term
3220 class streams to cin/cout/cerr, following C++ naming conventions
3224 class streams to cin/cout/cerr, following C++ naming conventions
3221 (I can't use in/out/err because 'in' is not a valid attribute
3225 (I can't use in/out/err because 'in' is not a valid attribute
3222 name).
3226 name).
3223
3227
3224 * IPython/iplib.py (InteractiveShell.interact): don't increment
3228 * IPython/iplib.py (InteractiveShell.interact): don't increment
3225 the prompt if there's no user input. By Daniel 'Dang' Griffith
3229 the prompt if there's no user input. By Daniel 'Dang' Griffith
3226 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3230 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3227 Francois Pinard.
3231 Francois Pinard.
3228
3232
3229 2004-04-02 Fernando Perez <fperez@colorado.edu>
3233 2004-04-02 Fernando Perez <fperez@colorado.edu>
3230
3234
3231 * IPython/genutils.py (Stream.__init__): Modified to survive at
3235 * IPython/genutils.py (Stream.__init__): Modified to survive at
3232 least importing in contexts where stdin/out/err aren't true file
3236 least importing in contexts where stdin/out/err aren't true file
3233 objects, such as PyCrust (they lack fileno() and mode). However,
3237 objects, such as PyCrust (they lack fileno() and mode). However,
3234 the recovery facilities which rely on these things existing will
3238 the recovery facilities which rely on these things existing will
3235 not work.
3239 not work.
3236
3240
3237 2004-04-01 Fernando Perez <fperez@colorado.edu>
3241 2004-04-01 Fernando Perez <fperez@colorado.edu>
3238
3242
3239 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3243 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3240 use the new getoutputerror() function, so it properly
3244 use the new getoutputerror() function, so it properly
3241 distinguishes stdout/err.
3245 distinguishes stdout/err.
3242
3246
3243 * IPython/genutils.py (getoutputerror): added a function to
3247 * IPython/genutils.py (getoutputerror): added a function to
3244 capture separately the standard output and error of a command.
3248 capture separately the standard output and error of a command.
3245 After a comment from dang on the mailing lists. This code is
3249 After a comment from dang on the mailing lists. This code is
3246 basically a modified version of commands.getstatusoutput(), from
3250 basically a modified version of commands.getstatusoutput(), from
3247 the standard library.
3251 the standard library.
3248
3252
3249 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3253 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3250 '!!' as a special syntax (shorthand) to access @sx.
3254 '!!' as a special syntax (shorthand) to access @sx.
3251
3255
3252 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3256 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3253 command and return its output as a list split on '\n'.
3257 command and return its output as a list split on '\n'.
3254
3258
3255 2004-03-31 Fernando Perez <fperez@colorado.edu>
3259 2004-03-31 Fernando Perez <fperez@colorado.edu>
3256
3260
3257 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3261 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3258 method to dictionaries used as FakeModule instances if they lack
3262 method to dictionaries used as FakeModule instances if they lack
3259 it. At least pydoc in python2.3 breaks for runtime-defined
3263 it. At least pydoc in python2.3 breaks for runtime-defined
3260 functions without this hack. At some point I need to _really_
3264 functions without this hack. At some point I need to _really_
3261 understand what FakeModule is doing, because it's a gross hack.
3265 understand what FakeModule is doing, because it's a gross hack.
3262 But it solves Arnd's problem for now...
3266 But it solves Arnd's problem for now...
3263
3267
3264 2004-02-27 Fernando Perez <fperez@colorado.edu>
3268 2004-02-27 Fernando Perez <fperez@colorado.edu>
3265
3269
3266 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3270 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3267 mode would behave erratically. Also increased the number of
3271 mode would behave erratically. Also increased the number of
3268 possible logs in rotate mod to 999. Thanks to Rod Holland
3272 possible logs in rotate mod to 999. Thanks to Rod Holland
3269 <rhh@StructureLABS.com> for the report and fixes.
3273 <rhh@StructureLABS.com> for the report and fixes.
3270
3274
3271 2004-02-26 Fernando Perez <fperez@colorado.edu>
3275 2004-02-26 Fernando Perez <fperez@colorado.edu>
3272
3276
3273 * IPython/genutils.py (page): Check that the curses module really
3277 * IPython/genutils.py (page): Check that the curses module really
3274 has the initscr attribute before trying to use it. For some
3278 has the initscr attribute before trying to use it. For some
3275 reason, the Solaris curses module is missing this. I think this
3279 reason, the Solaris curses module is missing this. I think this
3276 should be considered a Solaris python bug, but I'm not sure.
3280 should be considered a Solaris python bug, but I'm not sure.
3277
3281
3278 2004-01-17 Fernando Perez <fperez@colorado.edu>
3282 2004-01-17 Fernando Perez <fperez@colorado.edu>
3279
3283
3280 * IPython/genutils.py (Stream.__init__): Changes to try to make
3284 * IPython/genutils.py (Stream.__init__): Changes to try to make
3281 ipython robust against stdin/out/err being closed by the user.
3285 ipython robust against stdin/out/err being closed by the user.
3282 This is 'user error' (and blocks a normal python session, at least
3286 This is 'user error' (and blocks a normal python session, at least
3283 the stdout case). However, Ipython should be able to survive such
3287 the stdout case). However, Ipython should be able to survive such
3284 instances of abuse as gracefully as possible. To simplify the
3288 instances of abuse as gracefully as possible. To simplify the
3285 coding and maintain compatibility with Gary Bishop's Term
3289 coding and maintain compatibility with Gary Bishop's Term
3286 contributions, I've made use of classmethods for this. I think
3290 contributions, I've made use of classmethods for this. I think
3287 this introduces a dependency on python 2.2.
3291 this introduces a dependency on python 2.2.
3288
3292
3289 2004-01-13 Fernando Perez <fperez@colorado.edu>
3293 2004-01-13 Fernando Perez <fperez@colorado.edu>
3290
3294
3291 * IPython/numutils.py (exp_safe): simplified the code a bit and
3295 * IPython/numutils.py (exp_safe): simplified the code a bit and
3292 removed the need for importing the kinds module altogether.
3296 removed the need for importing the kinds module altogether.
3293
3297
3294 2004-01-06 Fernando Perez <fperez@colorado.edu>
3298 2004-01-06 Fernando Perez <fperez@colorado.edu>
3295
3299
3296 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3300 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3297 a magic function instead, after some community feedback. No
3301 a magic function instead, after some community feedback. No
3298 special syntax will exist for it, but its name is deliberately
3302 special syntax will exist for it, but its name is deliberately
3299 very short.
3303 very short.
3300
3304
3301 2003-12-20 Fernando Perez <fperez@colorado.edu>
3305 2003-12-20 Fernando Perez <fperez@colorado.edu>
3302
3306
3303 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3307 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3304 new functionality, to automagically assign the result of a shell
3308 new functionality, to automagically assign the result of a shell
3305 command to a variable. I'll solicit some community feedback on
3309 command to a variable. I'll solicit some community feedback on
3306 this before making it permanent.
3310 this before making it permanent.
3307
3311
3308 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3312 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3309 requested about callables for which inspect couldn't obtain a
3313 requested about callables for which inspect couldn't obtain a
3310 proper argspec. Thanks to a crash report sent by Etienne
3314 proper argspec. Thanks to a crash report sent by Etienne
3311 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3315 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3312
3316
3313 2003-12-09 Fernando Perez <fperez@colorado.edu>
3317 2003-12-09 Fernando Perez <fperez@colorado.edu>
3314
3318
3315 * IPython/genutils.py (page): patch for the pager to work across
3319 * IPython/genutils.py (page): patch for the pager to work across
3316 various versions of Windows. By Gary Bishop.
3320 various versions of Windows. By Gary Bishop.
3317
3321
3318 2003-12-04 Fernando Perez <fperez@colorado.edu>
3322 2003-12-04 Fernando Perez <fperez@colorado.edu>
3319
3323
3320 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3324 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3321 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3325 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3322 While I tested this and it looks ok, there may still be corner
3326 While I tested this and it looks ok, there may still be corner
3323 cases I've missed.
3327 cases I've missed.
3324
3328
3325 2003-12-01 Fernando Perez <fperez@colorado.edu>
3329 2003-12-01 Fernando Perez <fperez@colorado.edu>
3326
3330
3327 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3331 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3328 where a line like 'p,q=1,2' would fail because the automagic
3332 where a line like 'p,q=1,2' would fail because the automagic
3329 system would be triggered for @p.
3333 system would be triggered for @p.
3330
3334
3331 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3335 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3332 cleanups, code unmodified.
3336 cleanups, code unmodified.
3333
3337
3334 * IPython/genutils.py (Term): added a class for IPython to handle
3338 * IPython/genutils.py (Term): added a class for IPython to handle
3335 output. In most cases it will just be a proxy for stdout/err, but
3339 output. In most cases it will just be a proxy for stdout/err, but
3336 having this allows modifications to be made for some platforms,
3340 having this allows modifications to be made for some platforms,
3337 such as handling color escapes under Windows. All of this code
3341 such as handling color escapes under Windows. All of this code
3338 was contributed by Gary Bishop, with minor modifications by me.
3342 was contributed by Gary Bishop, with minor modifications by me.
3339 The actual changes affect many files.
3343 The actual changes affect many files.
3340
3344
3341 2003-11-30 Fernando Perez <fperez@colorado.edu>
3345 2003-11-30 Fernando Perez <fperez@colorado.edu>
3342
3346
3343 * IPython/iplib.py (file_matches): new completion code, courtesy
3347 * IPython/iplib.py (file_matches): new completion code, courtesy
3344 of Jeff Collins. This enables filename completion again under
3348 of Jeff Collins. This enables filename completion again under
3345 python 2.3, which disabled it at the C level.
3349 python 2.3, which disabled it at the C level.
3346
3350
3347 2003-11-11 Fernando Perez <fperez@colorado.edu>
3351 2003-11-11 Fernando Perez <fperez@colorado.edu>
3348
3352
3349 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3353 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3350 for Numeric.array(map(...)), but often convenient.
3354 for Numeric.array(map(...)), but often convenient.
3351
3355
3352 2003-11-05 Fernando Perez <fperez@colorado.edu>
3356 2003-11-05 Fernando Perez <fperez@colorado.edu>
3353
3357
3354 * IPython/numutils.py (frange): Changed a call from int() to
3358 * IPython/numutils.py (frange): Changed a call from int() to
3355 int(round()) to prevent a problem reported with arange() in the
3359 int(round()) to prevent a problem reported with arange() in the
3356 numpy list.
3360 numpy list.
3357
3361
3358 2003-10-06 Fernando Perez <fperez@colorado.edu>
3362 2003-10-06 Fernando Perez <fperez@colorado.edu>
3359
3363
3360 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3364 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3361 prevent crashes if sys lacks an argv attribute (it happens with
3365 prevent crashes if sys lacks an argv attribute (it happens with
3362 embedded interpreters which build a bare-bones sys module).
3366 embedded interpreters which build a bare-bones sys module).
3363 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3367 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3364
3368
3365 2003-09-24 Fernando Perez <fperez@colorado.edu>
3369 2003-09-24 Fernando Perez <fperez@colorado.edu>
3366
3370
3367 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3371 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3368 to protect against poorly written user objects where __getattr__
3372 to protect against poorly written user objects where __getattr__
3369 raises exceptions other than AttributeError. Thanks to a bug
3373 raises exceptions other than AttributeError. Thanks to a bug
3370 report by Oliver Sander <osander-AT-gmx.de>.
3374 report by Oliver Sander <osander-AT-gmx.de>.
3371
3375
3372 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3376 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3373 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3377 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3374
3378
3375 2003-09-09 Fernando Perez <fperez@colorado.edu>
3379 2003-09-09 Fernando Perez <fperez@colorado.edu>
3376
3380
3377 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3381 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3378 unpacking a list whith a callable as first element would
3382 unpacking a list whith a callable as first element would
3379 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3383 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3380 Collins.
3384 Collins.
3381
3385
3382 2003-08-25 *** Released version 0.5.0
3386 2003-08-25 *** Released version 0.5.0
3383
3387
3384 2003-08-22 Fernando Perez <fperez@colorado.edu>
3388 2003-08-22 Fernando Perez <fperez@colorado.edu>
3385
3389
3386 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3390 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3387 improperly defined user exceptions. Thanks to feedback from Mark
3391 improperly defined user exceptions. Thanks to feedback from Mark
3388 Russell <mrussell-AT-verio.net>.
3392 Russell <mrussell-AT-verio.net>.
3389
3393
3390 2003-08-20 Fernando Perez <fperez@colorado.edu>
3394 2003-08-20 Fernando Perez <fperez@colorado.edu>
3391
3395
3392 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3396 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3393 printing so that it would print multi-line string forms starting
3397 printing so that it would print multi-line string forms starting
3394 with a new line. This way the formatting is better respected for
3398 with a new line. This way the formatting is better respected for
3395 objects which work hard to make nice string forms.
3399 objects which work hard to make nice string forms.
3396
3400
3397 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3401 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3398 autocall would overtake data access for objects with both
3402 autocall would overtake data access for objects with both
3399 __getitem__ and __call__.
3403 __getitem__ and __call__.
3400
3404
3401 2003-08-19 *** Released version 0.5.0-rc1
3405 2003-08-19 *** Released version 0.5.0-rc1
3402
3406
3403 2003-08-19 Fernando Perez <fperez@colorado.edu>
3407 2003-08-19 Fernando Perez <fperez@colorado.edu>
3404
3408
3405 * IPython/deep_reload.py (load_tail): single tiny change here
3409 * IPython/deep_reload.py (load_tail): single tiny change here
3406 seems to fix the long-standing bug of dreload() failing to work
3410 seems to fix the long-standing bug of dreload() failing to work
3407 for dotted names. But this module is pretty tricky, so I may have
3411 for dotted names. But this module is pretty tricky, so I may have
3408 missed some subtlety. Needs more testing!.
3412 missed some subtlety. Needs more testing!.
3409
3413
3410 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3414 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3411 exceptions which have badly implemented __str__ methods.
3415 exceptions which have badly implemented __str__ methods.
3412 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3416 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3413 which I've been getting reports about from Python 2.3 users. I
3417 which I've been getting reports about from Python 2.3 users. I
3414 wish I had a simple test case to reproduce the problem, so I could
3418 wish I had a simple test case to reproduce the problem, so I could
3415 either write a cleaner workaround or file a bug report if
3419 either write a cleaner workaround or file a bug report if
3416 necessary.
3420 necessary.
3417
3421
3418 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3422 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3419 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3423 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3420 a bug report by Tjabo Kloppenburg.
3424 a bug report by Tjabo Kloppenburg.
3421
3425
3422 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3426 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3423 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3427 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3424 seems rather unstable. Thanks to a bug report by Tjabo
3428 seems rather unstable. Thanks to a bug report by Tjabo
3425 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3429 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3426
3430
3427 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3431 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3428 this out soon because of the critical fixes in the inner loop for
3432 this out soon because of the critical fixes in the inner loop for
3429 generators.
3433 generators.
3430
3434
3431 * IPython/Magic.py (Magic.getargspec): removed. This (and
3435 * IPython/Magic.py (Magic.getargspec): removed. This (and
3432 _get_def) have been obsoleted by OInspect for a long time, I
3436 _get_def) have been obsoleted by OInspect for a long time, I
3433 hadn't noticed that they were dead code.
3437 hadn't noticed that they were dead code.
3434 (Magic._ofind): restored _ofind functionality for a few literals
3438 (Magic._ofind): restored _ofind functionality for a few literals
3435 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3439 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3436 for things like "hello".capitalize?, since that would require a
3440 for things like "hello".capitalize?, since that would require a
3437 potentially dangerous eval() again.
3441 potentially dangerous eval() again.
3438
3442
3439 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3443 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3440 logic a bit more to clean up the escapes handling and minimize the
3444 logic a bit more to clean up the escapes handling and minimize the
3441 use of _ofind to only necessary cases. The interactive 'feel' of
3445 use of _ofind to only necessary cases. The interactive 'feel' of
3442 IPython should have improved quite a bit with the changes in
3446 IPython should have improved quite a bit with the changes in
3443 _prefilter and _ofind (besides being far safer than before).
3447 _prefilter and _ofind (besides being far safer than before).
3444
3448
3445 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3449 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3446 obscure, never reported). Edit would fail to find the object to
3450 obscure, never reported). Edit would fail to find the object to
3447 edit under some circumstances.
3451 edit under some circumstances.
3448 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3452 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3449 which were causing double-calling of generators. Those eval calls
3453 which were causing double-calling of generators. Those eval calls
3450 were _very_ dangerous, since code with side effects could be
3454 were _very_ dangerous, since code with side effects could be
3451 triggered. As they say, 'eval is evil'... These were the
3455 triggered. As they say, 'eval is evil'... These were the
3452 nastiest evals in IPython. Besides, _ofind is now far simpler,
3456 nastiest evals in IPython. Besides, _ofind is now far simpler,
3453 and it should also be quite a bit faster. Its use of inspect is
3457 and it should also be quite a bit faster. Its use of inspect is
3454 also safer, so perhaps some of the inspect-related crashes I've
3458 also safer, so perhaps some of the inspect-related crashes I've
3455 seen lately with Python 2.3 might be taken care of. That will
3459 seen lately with Python 2.3 might be taken care of. That will
3456 need more testing.
3460 need more testing.
3457
3461
3458 2003-08-17 Fernando Perez <fperez@colorado.edu>
3462 2003-08-17 Fernando Perez <fperez@colorado.edu>
3459
3463
3460 * IPython/iplib.py (InteractiveShell._prefilter): significant
3464 * IPython/iplib.py (InteractiveShell._prefilter): significant
3461 simplifications to the logic for handling user escapes. Faster
3465 simplifications to the logic for handling user escapes. Faster
3462 and simpler code.
3466 and simpler code.
3463
3467
3464 2003-08-14 Fernando Perez <fperez@colorado.edu>
3468 2003-08-14 Fernando Perez <fperez@colorado.edu>
3465
3469
3466 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3470 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3467 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3471 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3468 but it should be quite a bit faster. And the recursive version
3472 but it should be quite a bit faster. And the recursive version
3469 generated O(log N) intermediate storage for all rank>1 arrays,
3473 generated O(log N) intermediate storage for all rank>1 arrays,
3470 even if they were contiguous.
3474 even if they were contiguous.
3471 (l1norm): Added this function.
3475 (l1norm): Added this function.
3472 (norm): Added this function for arbitrary norms (including
3476 (norm): Added this function for arbitrary norms (including
3473 l-infinity). l1 and l2 are still special cases for convenience
3477 l-infinity). l1 and l2 are still special cases for convenience
3474 and speed.
3478 and speed.
3475
3479
3476 2003-08-03 Fernando Perez <fperez@colorado.edu>
3480 2003-08-03 Fernando Perez <fperez@colorado.edu>
3477
3481
3478 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3482 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3479 exceptions, which now raise PendingDeprecationWarnings in Python
3483 exceptions, which now raise PendingDeprecationWarnings in Python
3480 2.3. There were some in Magic and some in Gnuplot2.
3484 2.3. There were some in Magic and some in Gnuplot2.
3481
3485
3482 2003-06-30 Fernando Perez <fperez@colorado.edu>
3486 2003-06-30 Fernando Perez <fperez@colorado.edu>
3483
3487
3484 * IPython/genutils.py (page): modified to call curses only for
3488 * IPython/genutils.py (page): modified to call curses only for
3485 terminals where TERM=='xterm'. After problems under many other
3489 terminals where TERM=='xterm'. After problems under many other
3486 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3490 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3487
3491
3488 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3492 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3489 would be triggered when readline was absent. This was just an old
3493 would be triggered when readline was absent. This was just an old
3490 debugging statement I'd forgotten to take out.
3494 debugging statement I'd forgotten to take out.
3491
3495
3492 2003-06-20 Fernando Perez <fperez@colorado.edu>
3496 2003-06-20 Fernando Perez <fperez@colorado.edu>
3493
3497
3494 * IPython/genutils.py (clock): modified to return only user time
3498 * IPython/genutils.py (clock): modified to return only user time
3495 (not counting system time), after a discussion on scipy. While
3499 (not counting system time), after a discussion on scipy. While
3496 system time may be a useful quantity occasionally, it may much
3500 system time may be a useful quantity occasionally, it may much
3497 more easily be skewed by occasional swapping or other similar
3501 more easily be skewed by occasional swapping or other similar
3498 activity.
3502 activity.
3499
3503
3500 2003-06-05 Fernando Perez <fperez@colorado.edu>
3504 2003-06-05 Fernando Perez <fperez@colorado.edu>
3501
3505
3502 * IPython/numutils.py (identity): new function, for building
3506 * IPython/numutils.py (identity): new function, for building
3503 arbitrary rank Kronecker deltas (mostly backwards compatible with
3507 arbitrary rank Kronecker deltas (mostly backwards compatible with
3504 Numeric.identity)
3508 Numeric.identity)
3505
3509
3506 2003-06-03 Fernando Perez <fperez@colorado.edu>
3510 2003-06-03 Fernando Perez <fperez@colorado.edu>
3507
3511
3508 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3512 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3509 arguments passed to magics with spaces, to allow trailing '\' to
3513 arguments passed to magics with spaces, to allow trailing '\' to
3510 work normally (mainly for Windows users).
3514 work normally (mainly for Windows users).
3511
3515
3512 2003-05-29 Fernando Perez <fperez@colorado.edu>
3516 2003-05-29 Fernando Perez <fperez@colorado.edu>
3513
3517
3514 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3518 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3515 instead of pydoc.help. This fixes a bizarre behavior where
3519 instead of pydoc.help. This fixes a bizarre behavior where
3516 printing '%s' % locals() would trigger the help system. Now
3520 printing '%s' % locals() would trigger the help system. Now
3517 ipython behaves like normal python does.
3521 ipython behaves like normal python does.
3518
3522
3519 Note that if one does 'from pydoc import help', the bizarre
3523 Note that if one does 'from pydoc import help', the bizarre
3520 behavior returns, but this will also happen in normal python, so
3524 behavior returns, but this will also happen in normal python, so
3521 it's not an ipython bug anymore (it has to do with how pydoc.help
3525 it's not an ipython bug anymore (it has to do with how pydoc.help
3522 is implemented).
3526 is implemented).
3523
3527
3524 2003-05-22 Fernando Perez <fperez@colorado.edu>
3528 2003-05-22 Fernando Perez <fperez@colorado.edu>
3525
3529
3526 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3530 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3527 return [] instead of None when nothing matches, also match to end
3531 return [] instead of None when nothing matches, also match to end
3528 of line. Patch by Gary Bishop.
3532 of line. Patch by Gary Bishop.
3529
3533
3530 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3534 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3531 protection as before, for files passed on the command line. This
3535 protection as before, for files passed on the command line. This
3532 prevents the CrashHandler from kicking in if user files call into
3536 prevents the CrashHandler from kicking in if user files call into
3533 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3537 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3534 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3538 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3535
3539
3536 2003-05-20 *** Released version 0.4.0
3540 2003-05-20 *** Released version 0.4.0
3537
3541
3538 2003-05-20 Fernando Perez <fperez@colorado.edu>
3542 2003-05-20 Fernando Perez <fperez@colorado.edu>
3539
3543
3540 * setup.py: added support for manpages. It's a bit hackish b/c of
3544 * setup.py: added support for manpages. It's a bit hackish b/c of
3541 a bug in the way the bdist_rpm distutils target handles gzipped
3545 a bug in the way the bdist_rpm distutils target handles gzipped
3542 manpages, but it works. After a patch by Jack.
3546 manpages, but it works. After a patch by Jack.
3543
3547
3544 2003-05-19 Fernando Perez <fperez@colorado.edu>
3548 2003-05-19 Fernando Perez <fperez@colorado.edu>
3545
3549
3546 * IPython/numutils.py: added a mockup of the kinds module, since
3550 * IPython/numutils.py: added a mockup of the kinds module, since
3547 it was recently removed from Numeric. This way, numutils will
3551 it was recently removed from Numeric. This way, numutils will
3548 work for all users even if they are missing kinds.
3552 work for all users even if they are missing kinds.
3549
3553
3550 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3554 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3551 failure, which can occur with SWIG-wrapped extensions. After a
3555 failure, which can occur with SWIG-wrapped extensions. After a
3552 crash report from Prabhu.
3556 crash report from Prabhu.
3553
3557
3554 2003-05-16 Fernando Perez <fperez@colorado.edu>
3558 2003-05-16 Fernando Perez <fperez@colorado.edu>
3555
3559
3556 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3560 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3557 protect ipython from user code which may call directly
3561 protect ipython from user code which may call directly
3558 sys.excepthook (this looks like an ipython crash to the user, even
3562 sys.excepthook (this looks like an ipython crash to the user, even
3559 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3563 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3560 This is especially important to help users of WxWindows, but may
3564 This is especially important to help users of WxWindows, but may
3561 also be useful in other cases.
3565 also be useful in other cases.
3562
3566
3563 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3567 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3564 an optional tb_offset to be specified, and to preserve exception
3568 an optional tb_offset to be specified, and to preserve exception
3565 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3569 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3566
3570
3567 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3571 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3568
3572
3569 2003-05-15 Fernando Perez <fperez@colorado.edu>
3573 2003-05-15 Fernando Perez <fperez@colorado.edu>
3570
3574
3571 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3575 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3572 installing for a new user under Windows.
3576 installing for a new user under Windows.
3573
3577
3574 2003-05-12 Fernando Perez <fperez@colorado.edu>
3578 2003-05-12 Fernando Perez <fperez@colorado.edu>
3575
3579
3576 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3580 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3577 handler for Emacs comint-based lines. Currently it doesn't do
3581 handler for Emacs comint-based lines. Currently it doesn't do
3578 much (but importantly, it doesn't update the history cache). In
3582 much (but importantly, it doesn't update the history cache). In
3579 the future it may be expanded if Alex needs more functionality
3583 the future it may be expanded if Alex needs more functionality
3580 there.
3584 there.
3581
3585
3582 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3586 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3583 info to crash reports.
3587 info to crash reports.
3584
3588
3585 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3589 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3586 just like Python's -c. Also fixed crash with invalid -color
3590 just like Python's -c. Also fixed crash with invalid -color
3587 option value at startup. Thanks to Will French
3591 option value at startup. Thanks to Will French
3588 <wfrench-AT-bestweb.net> for the bug report.
3592 <wfrench-AT-bestweb.net> for the bug report.
3589
3593
3590 2003-05-09 Fernando Perez <fperez@colorado.edu>
3594 2003-05-09 Fernando Perez <fperez@colorado.edu>
3591
3595
3592 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3596 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3593 to EvalDict (it's a mapping, after all) and simplified its code
3597 to EvalDict (it's a mapping, after all) and simplified its code
3594 quite a bit, after a nice discussion on c.l.py where Gustavo
3598 quite a bit, after a nice discussion on c.l.py where Gustavo
3595 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3599 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3596
3600
3597 2003-04-30 Fernando Perez <fperez@colorado.edu>
3601 2003-04-30 Fernando Perez <fperez@colorado.edu>
3598
3602
3599 * IPython/genutils.py (timings_out): modified it to reduce its
3603 * IPython/genutils.py (timings_out): modified it to reduce its
3600 overhead in the common reps==1 case.
3604 overhead in the common reps==1 case.
3601
3605
3602 2003-04-29 Fernando Perez <fperez@colorado.edu>
3606 2003-04-29 Fernando Perez <fperez@colorado.edu>
3603
3607
3604 * IPython/genutils.py (timings_out): Modified to use the resource
3608 * IPython/genutils.py (timings_out): Modified to use the resource
3605 module, which avoids the wraparound problems of time.clock().
3609 module, which avoids the wraparound problems of time.clock().
3606
3610
3607 2003-04-17 *** Released version 0.2.15pre4
3611 2003-04-17 *** Released version 0.2.15pre4
3608
3612
3609 2003-04-17 Fernando Perez <fperez@colorado.edu>
3613 2003-04-17 Fernando Perez <fperez@colorado.edu>
3610
3614
3611 * setup.py (scriptfiles): Split windows-specific stuff over to a
3615 * setup.py (scriptfiles): Split windows-specific stuff over to a
3612 separate file, in an attempt to have a Windows GUI installer.
3616 separate file, in an attempt to have a Windows GUI installer.
3613 That didn't work, but part of the groundwork is done.
3617 That didn't work, but part of the groundwork is done.
3614
3618
3615 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3619 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3616 indent/unindent with 4 spaces. Particularly useful in combination
3620 indent/unindent with 4 spaces. Particularly useful in combination
3617 with the new auto-indent option.
3621 with the new auto-indent option.
3618
3622
3619 2003-04-16 Fernando Perez <fperez@colorado.edu>
3623 2003-04-16 Fernando Perez <fperez@colorado.edu>
3620
3624
3621 * IPython/Magic.py: various replacements of self.rc for
3625 * IPython/Magic.py: various replacements of self.rc for
3622 self.shell.rc. A lot more remains to be done to fully disentangle
3626 self.shell.rc. A lot more remains to be done to fully disentangle
3623 this class from the main Shell class.
3627 this class from the main Shell class.
3624
3628
3625 * IPython/GnuplotRuntime.py: added checks for mouse support so
3629 * IPython/GnuplotRuntime.py: added checks for mouse support so
3626 that we don't try to enable it if the current gnuplot doesn't
3630 that we don't try to enable it if the current gnuplot doesn't
3627 really support it. Also added checks so that we don't try to
3631 really support it. Also added checks so that we don't try to
3628 enable persist under Windows (where Gnuplot doesn't recognize the
3632 enable persist under Windows (where Gnuplot doesn't recognize the
3629 option).
3633 option).
3630
3634
3631 * IPython/iplib.py (InteractiveShell.interact): Added optional
3635 * IPython/iplib.py (InteractiveShell.interact): Added optional
3632 auto-indenting code, after a patch by King C. Shu
3636 auto-indenting code, after a patch by King C. Shu
3633 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3637 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3634 get along well with pasting indented code. If I ever figure out
3638 get along well with pasting indented code. If I ever figure out
3635 how to make that part go well, it will become on by default.
3639 how to make that part go well, it will become on by default.
3636
3640
3637 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3641 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3638 crash ipython if there was an unmatched '%' in the user's prompt
3642 crash ipython if there was an unmatched '%' in the user's prompt
3639 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3643 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3640
3644
3641 * IPython/iplib.py (InteractiveShell.interact): removed the
3645 * IPython/iplib.py (InteractiveShell.interact): removed the
3642 ability to ask the user whether he wants to crash or not at the
3646 ability to ask the user whether he wants to crash or not at the
3643 'last line' exception handler. Calling functions at that point
3647 'last line' exception handler. Calling functions at that point
3644 changes the stack, and the error reports would have incorrect
3648 changes the stack, and the error reports would have incorrect
3645 tracebacks.
3649 tracebacks.
3646
3650
3647 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3651 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3648 pass through a peger a pretty-printed form of any object. After a
3652 pass through a peger a pretty-printed form of any object. After a
3649 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3653 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3650
3654
3651 2003-04-14 Fernando Perez <fperez@colorado.edu>
3655 2003-04-14 Fernando Perez <fperez@colorado.edu>
3652
3656
3653 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3657 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3654 all files in ~ would be modified at first install (instead of
3658 all files in ~ would be modified at first install (instead of
3655 ~/.ipython). This could be potentially disastrous, as the
3659 ~/.ipython). This could be potentially disastrous, as the
3656 modification (make line-endings native) could damage binary files.
3660 modification (make line-endings native) could damage binary files.
3657
3661
3658 2003-04-10 Fernando Perez <fperez@colorado.edu>
3662 2003-04-10 Fernando Perez <fperez@colorado.edu>
3659
3663
3660 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3664 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3661 handle only lines which are invalid python. This now means that
3665 handle only lines which are invalid python. This now means that
3662 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3666 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3663 for the bug report.
3667 for the bug report.
3664
3668
3665 2003-04-01 Fernando Perez <fperez@colorado.edu>
3669 2003-04-01 Fernando Perez <fperez@colorado.edu>
3666
3670
3667 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3671 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3668 where failing to set sys.last_traceback would crash pdb.pm().
3672 where failing to set sys.last_traceback would crash pdb.pm().
3669 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3673 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3670 report.
3674 report.
3671
3675
3672 2003-03-25 Fernando Perez <fperez@colorado.edu>
3676 2003-03-25 Fernando Perez <fperez@colorado.edu>
3673
3677
3674 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3678 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3675 before printing it (it had a lot of spurious blank lines at the
3679 before printing it (it had a lot of spurious blank lines at the
3676 end).
3680 end).
3677
3681
3678 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3682 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3679 output would be sent 21 times! Obviously people don't use this
3683 output would be sent 21 times! Obviously people don't use this
3680 too often, or I would have heard about it.
3684 too often, or I would have heard about it.
3681
3685
3682 2003-03-24 Fernando Perez <fperez@colorado.edu>
3686 2003-03-24 Fernando Perez <fperez@colorado.edu>
3683
3687
3684 * setup.py (scriptfiles): renamed the data_files parameter from
3688 * setup.py (scriptfiles): renamed the data_files parameter from
3685 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3689 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3686 for the patch.
3690 for the patch.
3687
3691
3688 2003-03-20 Fernando Perez <fperez@colorado.edu>
3692 2003-03-20 Fernando Perez <fperez@colorado.edu>
3689
3693
3690 * IPython/genutils.py (error): added error() and fatal()
3694 * IPython/genutils.py (error): added error() and fatal()
3691 functions.
3695 functions.
3692
3696
3693 2003-03-18 *** Released version 0.2.15pre3
3697 2003-03-18 *** Released version 0.2.15pre3
3694
3698
3695 2003-03-18 Fernando Perez <fperez@colorado.edu>
3699 2003-03-18 Fernando Perez <fperez@colorado.edu>
3696
3700
3697 * setupext/install_data_ext.py
3701 * setupext/install_data_ext.py
3698 (install_data_ext.initialize_options): Class contributed by Jack
3702 (install_data_ext.initialize_options): Class contributed by Jack
3699 Moffit for fixing the old distutils hack. He is sending this to
3703 Moffit for fixing the old distutils hack. He is sending this to
3700 the distutils folks so in the future we may not need it as a
3704 the distutils folks so in the future we may not need it as a
3701 private fix.
3705 private fix.
3702
3706
3703 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3707 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3704 changes for Debian packaging. See his patch for full details.
3708 changes for Debian packaging. See his patch for full details.
3705 The old distutils hack of making the ipythonrc* files carry a
3709 The old distutils hack of making the ipythonrc* files carry a
3706 bogus .py extension is gone, at last. Examples were moved to a
3710 bogus .py extension is gone, at last. Examples were moved to a
3707 separate subdir under doc/, and the separate executable scripts
3711 separate subdir under doc/, and the separate executable scripts
3708 now live in their own directory. Overall a great cleanup. The
3712 now live in their own directory. Overall a great cleanup. The
3709 manual was updated to use the new files, and setup.py has been
3713 manual was updated to use the new files, and setup.py has been
3710 fixed for this setup.
3714 fixed for this setup.
3711
3715
3712 * IPython/PyColorize.py (Parser.usage): made non-executable and
3716 * IPython/PyColorize.py (Parser.usage): made non-executable and
3713 created a pycolor wrapper around it to be included as a script.
3717 created a pycolor wrapper around it to be included as a script.
3714
3718
3715 2003-03-12 *** Released version 0.2.15pre2
3719 2003-03-12 *** Released version 0.2.15pre2
3716
3720
3717 2003-03-12 Fernando Perez <fperez@colorado.edu>
3721 2003-03-12 Fernando Perez <fperez@colorado.edu>
3718
3722
3719 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3723 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3720 long-standing problem with garbage characters in some terminals.
3724 long-standing problem with garbage characters in some terminals.
3721 The issue was really that the \001 and \002 escapes must _only_ be
3725 The issue was really that the \001 and \002 escapes must _only_ be
3722 passed to input prompts (which call readline), but _never_ to
3726 passed to input prompts (which call readline), but _never_ to
3723 normal text to be printed on screen. I changed ColorANSI to have
3727 normal text to be printed on screen. I changed ColorANSI to have
3724 two classes: TermColors and InputTermColors, each with the
3728 two classes: TermColors and InputTermColors, each with the
3725 appropriate escapes for input prompts or normal text. The code in
3729 appropriate escapes for input prompts or normal text. The code in
3726 Prompts.py got slightly more complicated, but this very old and
3730 Prompts.py got slightly more complicated, but this very old and
3727 annoying bug is finally fixed.
3731 annoying bug is finally fixed.
3728
3732
3729 All the credit for nailing down the real origin of this problem
3733 All the credit for nailing down the real origin of this problem
3730 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3734 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3731 *Many* thanks to him for spending quite a bit of effort on this.
3735 *Many* thanks to him for spending quite a bit of effort on this.
3732
3736
3733 2003-03-05 *** Released version 0.2.15pre1
3737 2003-03-05 *** Released version 0.2.15pre1
3734
3738
3735 2003-03-03 Fernando Perez <fperez@colorado.edu>
3739 2003-03-03 Fernando Perez <fperez@colorado.edu>
3736
3740
3737 * IPython/FakeModule.py: Moved the former _FakeModule to a
3741 * IPython/FakeModule.py: Moved the former _FakeModule to a
3738 separate file, because it's also needed by Magic (to fix a similar
3742 separate file, because it's also needed by Magic (to fix a similar
3739 pickle-related issue in @run).
3743 pickle-related issue in @run).
3740
3744
3741 2003-03-02 Fernando Perez <fperez@colorado.edu>
3745 2003-03-02 Fernando Perez <fperez@colorado.edu>
3742
3746
3743 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3747 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3744 the autocall option at runtime.
3748 the autocall option at runtime.
3745 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3749 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3746 across Magic.py to start separating Magic from InteractiveShell.
3750 across Magic.py to start separating Magic from InteractiveShell.
3747 (Magic._ofind): Fixed to return proper namespace for dotted
3751 (Magic._ofind): Fixed to return proper namespace for dotted
3748 names. Before, a dotted name would always return 'not currently
3752 names. Before, a dotted name would always return 'not currently
3749 defined', because it would find the 'parent'. s.x would be found,
3753 defined', because it would find the 'parent'. s.x would be found,
3750 but since 'x' isn't defined by itself, it would get confused.
3754 but since 'x' isn't defined by itself, it would get confused.
3751 (Magic.magic_run): Fixed pickling problems reported by Ralf
3755 (Magic.magic_run): Fixed pickling problems reported by Ralf
3752 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3756 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3753 that I'd used when Mike Heeter reported similar issues at the
3757 that I'd used when Mike Heeter reported similar issues at the
3754 top-level, but now for @run. It boils down to injecting the
3758 top-level, but now for @run. It boils down to injecting the
3755 namespace where code is being executed with something that looks
3759 namespace where code is being executed with something that looks
3756 enough like a module to fool pickle.dump(). Since a pickle stores
3760 enough like a module to fool pickle.dump(). Since a pickle stores
3757 a named reference to the importing module, we need this for
3761 a named reference to the importing module, we need this for
3758 pickles to save something sensible.
3762 pickles to save something sensible.
3759
3763
3760 * IPython/ipmaker.py (make_IPython): added an autocall option.
3764 * IPython/ipmaker.py (make_IPython): added an autocall option.
3761
3765
3762 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3766 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3763 the auto-eval code. Now autocalling is an option, and the code is
3767 the auto-eval code. Now autocalling is an option, and the code is
3764 also vastly safer. There is no more eval() involved at all.
3768 also vastly safer. There is no more eval() involved at all.
3765
3769
3766 2003-03-01 Fernando Perez <fperez@colorado.edu>
3770 2003-03-01 Fernando Perez <fperez@colorado.edu>
3767
3771
3768 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3772 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3769 dict with named keys instead of a tuple.
3773 dict with named keys instead of a tuple.
3770
3774
3771 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3775 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3772
3776
3773 * setup.py (make_shortcut): Fixed message about directories
3777 * setup.py (make_shortcut): Fixed message about directories
3774 created during Windows installation (the directories were ok, just
3778 created during Windows installation (the directories were ok, just
3775 the printed message was misleading). Thanks to Chris Liechti
3779 the printed message was misleading). Thanks to Chris Liechti
3776 <cliechti-AT-gmx.net> for the heads up.
3780 <cliechti-AT-gmx.net> for the heads up.
3777
3781
3778 2003-02-21 Fernando Perez <fperez@colorado.edu>
3782 2003-02-21 Fernando Perez <fperez@colorado.edu>
3779
3783
3780 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3784 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3781 of ValueError exception when checking for auto-execution. This
3785 of ValueError exception when checking for auto-execution. This
3782 one is raised by things like Numeric arrays arr.flat when the
3786 one is raised by things like Numeric arrays arr.flat when the
3783 array is non-contiguous.
3787 array is non-contiguous.
3784
3788
3785 2003-01-31 Fernando Perez <fperez@colorado.edu>
3789 2003-01-31 Fernando Perez <fperez@colorado.edu>
3786
3790
3787 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3791 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3788 not return any value at all (even though the command would get
3792 not return any value at all (even though the command would get
3789 executed).
3793 executed).
3790 (xsys): Flush stdout right after printing the command to ensure
3794 (xsys): Flush stdout right after printing the command to ensure
3791 proper ordering of commands and command output in the total
3795 proper ordering of commands and command output in the total
3792 output.
3796 output.
3793 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3797 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3794 system/getoutput as defaults. The old ones are kept for
3798 system/getoutput as defaults. The old ones are kept for
3795 compatibility reasons, so no code which uses this library needs
3799 compatibility reasons, so no code which uses this library needs
3796 changing.
3800 changing.
3797
3801
3798 2003-01-27 *** Released version 0.2.14
3802 2003-01-27 *** Released version 0.2.14
3799
3803
3800 2003-01-25 Fernando Perez <fperez@colorado.edu>
3804 2003-01-25 Fernando Perez <fperez@colorado.edu>
3801
3805
3802 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3806 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3803 functions defined in previous edit sessions could not be re-edited
3807 functions defined in previous edit sessions could not be re-edited
3804 (because the temp files were immediately removed). Now temp files
3808 (because the temp files were immediately removed). Now temp files
3805 are removed only at IPython's exit.
3809 are removed only at IPython's exit.
3806 (Magic.magic_run): Improved @run to perform shell-like expansions
3810 (Magic.magic_run): Improved @run to perform shell-like expansions
3807 on its arguments (~users and $VARS). With this, @run becomes more
3811 on its arguments (~users and $VARS). With this, @run becomes more
3808 like a normal command-line.
3812 like a normal command-line.
3809
3813
3810 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3814 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3811 bugs related to embedding and cleaned up that code. A fairly
3815 bugs related to embedding and cleaned up that code. A fairly
3812 important one was the impossibility to access the global namespace
3816 important one was the impossibility to access the global namespace
3813 through the embedded IPython (only local variables were visible).
3817 through the embedded IPython (only local variables were visible).
3814
3818
3815 2003-01-14 Fernando Perez <fperez@colorado.edu>
3819 2003-01-14 Fernando Perez <fperez@colorado.edu>
3816
3820
3817 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3821 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3818 auto-calling to be a bit more conservative. Now it doesn't get
3822 auto-calling to be a bit more conservative. Now it doesn't get
3819 triggered if any of '!=()<>' are in the rest of the input line, to
3823 triggered if any of '!=()<>' are in the rest of the input line, to
3820 allow comparing callables. Thanks to Alex for the heads up.
3824 allow comparing callables. Thanks to Alex for the heads up.
3821
3825
3822 2003-01-07 Fernando Perez <fperez@colorado.edu>
3826 2003-01-07 Fernando Perez <fperez@colorado.edu>
3823
3827
3824 * IPython/genutils.py (page): fixed estimation of the number of
3828 * IPython/genutils.py (page): fixed estimation of the number of
3825 lines in a string to be paged to simply count newlines. This
3829 lines in a string to be paged to simply count newlines. This
3826 prevents over-guessing due to embedded escape sequences. A better
3830 prevents over-guessing due to embedded escape sequences. A better
3827 long-term solution would involve stripping out the control chars
3831 long-term solution would involve stripping out the control chars
3828 for the count, but it's potentially so expensive I just don't
3832 for the count, but it's potentially so expensive I just don't
3829 think it's worth doing.
3833 think it's worth doing.
3830
3834
3831 2002-12-19 *** Released version 0.2.14pre50
3835 2002-12-19 *** Released version 0.2.14pre50
3832
3836
3833 2002-12-19 Fernando Perez <fperez@colorado.edu>
3837 2002-12-19 Fernando Perez <fperez@colorado.edu>
3834
3838
3835 * tools/release (version): Changed release scripts to inform
3839 * tools/release (version): Changed release scripts to inform
3836 Andrea and build a NEWS file with a list of recent changes.
3840 Andrea and build a NEWS file with a list of recent changes.
3837
3841
3838 * IPython/ColorANSI.py (__all__): changed terminal detection
3842 * IPython/ColorANSI.py (__all__): changed terminal detection
3839 code. Seems to work better for xterms without breaking
3843 code. Seems to work better for xterms without breaking
3840 konsole. Will need more testing to determine if WinXP and Mac OSX
3844 konsole. Will need more testing to determine if WinXP and Mac OSX
3841 also work ok.
3845 also work ok.
3842
3846
3843 2002-12-18 *** Released version 0.2.14pre49
3847 2002-12-18 *** Released version 0.2.14pre49
3844
3848
3845 2002-12-18 Fernando Perez <fperez@colorado.edu>
3849 2002-12-18 Fernando Perez <fperez@colorado.edu>
3846
3850
3847 * Docs: added new info about Mac OSX, from Andrea.
3851 * Docs: added new info about Mac OSX, from Andrea.
3848
3852
3849 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3853 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3850 allow direct plotting of python strings whose format is the same
3854 allow direct plotting of python strings whose format is the same
3851 of gnuplot data files.
3855 of gnuplot data files.
3852
3856
3853 2002-12-16 Fernando Perez <fperez@colorado.edu>
3857 2002-12-16 Fernando Perez <fperez@colorado.edu>
3854
3858
3855 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3859 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3856 value of exit question to be acknowledged.
3860 value of exit question to be acknowledged.
3857
3861
3858 2002-12-03 Fernando Perez <fperez@colorado.edu>
3862 2002-12-03 Fernando Perez <fperez@colorado.edu>
3859
3863
3860 * IPython/ipmaker.py: removed generators, which had been added
3864 * IPython/ipmaker.py: removed generators, which had been added
3861 by mistake in an earlier debugging run. This was causing trouble
3865 by mistake in an earlier debugging run. This was causing trouble
3862 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3866 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3863 for pointing this out.
3867 for pointing this out.
3864
3868
3865 2002-11-17 Fernando Perez <fperez@colorado.edu>
3869 2002-11-17 Fernando Perez <fperez@colorado.edu>
3866
3870
3867 * Manual: updated the Gnuplot section.
3871 * Manual: updated the Gnuplot section.
3868
3872
3869 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3873 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3870 a much better split of what goes in Runtime and what goes in
3874 a much better split of what goes in Runtime and what goes in
3871 Interactive.
3875 Interactive.
3872
3876
3873 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3877 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3874 being imported from iplib.
3878 being imported from iplib.
3875
3879
3876 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3880 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3877 for command-passing. Now the global Gnuplot instance is called
3881 for command-passing. Now the global Gnuplot instance is called
3878 'gp' instead of 'g', which was really a far too fragile and
3882 'gp' instead of 'g', which was really a far too fragile and
3879 common name.
3883 common name.
3880
3884
3881 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3885 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3882 bounding boxes generated by Gnuplot for square plots.
3886 bounding boxes generated by Gnuplot for square plots.
3883
3887
3884 * IPython/genutils.py (popkey): new function added. I should
3888 * IPython/genutils.py (popkey): new function added. I should
3885 suggest this on c.l.py as a dict method, it seems useful.
3889 suggest this on c.l.py as a dict method, it seems useful.
3886
3890
3887 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3891 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3888 to transparently handle PostScript generation. MUCH better than
3892 to transparently handle PostScript generation. MUCH better than
3889 the previous plot_eps/replot_eps (which I removed now). The code
3893 the previous plot_eps/replot_eps (which I removed now). The code
3890 is also fairly clean and well documented now (including
3894 is also fairly clean and well documented now (including
3891 docstrings).
3895 docstrings).
3892
3896
3893 2002-11-13 Fernando Perez <fperez@colorado.edu>
3897 2002-11-13 Fernando Perez <fperez@colorado.edu>
3894
3898
3895 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3899 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3896 (inconsistent with options).
3900 (inconsistent with options).
3897
3901
3898 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3902 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3899 manually disabled, I don't know why. Fixed it.
3903 manually disabled, I don't know why. Fixed it.
3900 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3904 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3901 eps output.
3905 eps output.
3902
3906
3903 2002-11-12 Fernando Perez <fperez@colorado.edu>
3907 2002-11-12 Fernando Perez <fperez@colorado.edu>
3904
3908
3905 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3909 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3906 don't propagate up to caller. Fixes crash reported by François
3910 don't propagate up to caller. Fixes crash reported by François
3907 Pinard.
3911 Pinard.
3908
3912
3909 2002-11-09 Fernando Perez <fperez@colorado.edu>
3913 2002-11-09 Fernando Perez <fperez@colorado.edu>
3910
3914
3911 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3915 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3912 history file for new users.
3916 history file for new users.
3913 (make_IPython): fixed bug where initial install would leave the
3917 (make_IPython): fixed bug where initial install would leave the
3914 user running in the .ipython dir.
3918 user running in the .ipython dir.
3915 (make_IPython): fixed bug where config dir .ipython would be
3919 (make_IPython): fixed bug where config dir .ipython would be
3916 created regardless of the given -ipythondir option. Thanks to Cory
3920 created regardless of the given -ipythondir option. Thanks to Cory
3917 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3921 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3918
3922
3919 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3923 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3920 type confirmations. Will need to use it in all of IPython's code
3924 type confirmations. Will need to use it in all of IPython's code
3921 consistently.
3925 consistently.
3922
3926
3923 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3927 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3924 context to print 31 lines instead of the default 5. This will make
3928 context to print 31 lines instead of the default 5. This will make
3925 the crash reports extremely detailed in case the problem is in
3929 the crash reports extremely detailed in case the problem is in
3926 libraries I don't have access to.
3930 libraries I don't have access to.
3927
3931
3928 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3932 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3929 line of defense' code to still crash, but giving users fair
3933 line of defense' code to still crash, but giving users fair
3930 warning. I don't want internal errors to go unreported: if there's
3934 warning. I don't want internal errors to go unreported: if there's
3931 an internal problem, IPython should crash and generate a full
3935 an internal problem, IPython should crash and generate a full
3932 report.
3936 report.
3933
3937
3934 2002-11-08 Fernando Perez <fperez@colorado.edu>
3938 2002-11-08 Fernando Perez <fperez@colorado.edu>
3935
3939
3936 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3940 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3937 otherwise uncaught exceptions which can appear if people set
3941 otherwise uncaught exceptions which can appear if people set
3938 sys.stdout to something badly broken. Thanks to a crash report
3942 sys.stdout to something badly broken. Thanks to a crash report
3939 from henni-AT-mail.brainbot.com.
3943 from henni-AT-mail.brainbot.com.
3940
3944
3941 2002-11-04 Fernando Perez <fperez@colorado.edu>
3945 2002-11-04 Fernando Perez <fperez@colorado.edu>
3942
3946
3943 * IPython/iplib.py (InteractiveShell.interact): added
3947 * IPython/iplib.py (InteractiveShell.interact): added
3944 __IPYTHON__active to the builtins. It's a flag which goes on when
3948 __IPYTHON__active to the builtins. It's a flag which goes on when
3945 the interaction starts and goes off again when it stops. This
3949 the interaction starts and goes off again when it stops. This
3946 allows embedding code to detect being inside IPython. Before this
3950 allows embedding code to detect being inside IPython. Before this
3947 was done via __IPYTHON__, but that only shows that an IPython
3951 was done via __IPYTHON__, but that only shows that an IPython
3948 instance has been created.
3952 instance has been created.
3949
3953
3950 * IPython/Magic.py (Magic.magic_env): I realized that in a
3954 * IPython/Magic.py (Magic.magic_env): I realized that in a
3951 UserDict, instance.data holds the data as a normal dict. So I
3955 UserDict, instance.data holds the data as a normal dict. So I
3952 modified @env to return os.environ.data instead of rebuilding a
3956 modified @env to return os.environ.data instead of rebuilding a
3953 dict by hand.
3957 dict by hand.
3954
3958
3955 2002-11-02 Fernando Perez <fperez@colorado.edu>
3959 2002-11-02 Fernando Perez <fperez@colorado.edu>
3956
3960
3957 * IPython/genutils.py (warn): changed so that level 1 prints no
3961 * IPython/genutils.py (warn): changed so that level 1 prints no
3958 header. Level 2 is now the default (with 'WARNING' header, as
3962 header. Level 2 is now the default (with 'WARNING' header, as
3959 before). I think I tracked all places where changes were needed in
3963 before). I think I tracked all places where changes were needed in
3960 IPython, but outside code using the old level numbering may have
3964 IPython, but outside code using the old level numbering may have
3961 broken.
3965 broken.
3962
3966
3963 * IPython/iplib.py (InteractiveShell.runcode): added this to
3967 * IPython/iplib.py (InteractiveShell.runcode): added this to
3964 handle the tracebacks in SystemExit traps correctly. The previous
3968 handle the tracebacks in SystemExit traps correctly. The previous
3965 code (through interact) was printing more of the stack than
3969 code (through interact) was printing more of the stack than
3966 necessary, showing IPython internal code to the user.
3970 necessary, showing IPython internal code to the user.
3967
3971
3968 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3972 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3969 default. Now that the default at the confirmation prompt is yes,
3973 default. Now that the default at the confirmation prompt is yes,
3970 it's not so intrusive. François' argument that ipython sessions
3974 it's not so intrusive. François' argument that ipython sessions
3971 tend to be complex enough not to lose them from an accidental C-d,
3975 tend to be complex enough not to lose them from an accidental C-d,
3972 is a valid one.
3976 is a valid one.
3973
3977
3974 * IPython/iplib.py (InteractiveShell.interact): added a
3978 * IPython/iplib.py (InteractiveShell.interact): added a
3975 showtraceback() call to the SystemExit trap, and modified the exit
3979 showtraceback() call to the SystemExit trap, and modified the exit
3976 confirmation to have yes as the default.
3980 confirmation to have yes as the default.
3977
3981
3978 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3982 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3979 this file. It's been gone from the code for a long time, this was
3983 this file. It's been gone from the code for a long time, this was
3980 simply leftover junk.
3984 simply leftover junk.
3981
3985
3982 2002-11-01 Fernando Perez <fperez@colorado.edu>
3986 2002-11-01 Fernando Perez <fperez@colorado.edu>
3983
3987
3984 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3988 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3985 added. If set, IPython now traps EOF and asks for
3989 added. If set, IPython now traps EOF and asks for
3986 confirmation. After a request by François Pinard.
3990 confirmation. After a request by François Pinard.
3987
3991
3988 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3992 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3989 of @abort, and with a new (better) mechanism for handling the
3993 of @abort, and with a new (better) mechanism for handling the
3990 exceptions.
3994 exceptions.
3991
3995
3992 2002-10-27 Fernando Perez <fperez@colorado.edu>
3996 2002-10-27 Fernando Perez <fperez@colorado.edu>
3993
3997
3994 * IPython/usage.py (__doc__): updated the --help information and
3998 * IPython/usage.py (__doc__): updated the --help information and
3995 the ipythonrc file to indicate that -log generates
3999 the ipythonrc file to indicate that -log generates
3996 ./ipython.log. Also fixed the corresponding info in @logstart.
4000 ./ipython.log. Also fixed the corresponding info in @logstart.
3997 This and several other fixes in the manuals thanks to reports by
4001 This and several other fixes in the manuals thanks to reports by
3998 François Pinard <pinard-AT-iro.umontreal.ca>.
4002 François Pinard <pinard-AT-iro.umontreal.ca>.
3999
4003
4000 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4004 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4001 refer to @logstart (instead of @log, which doesn't exist).
4005 refer to @logstart (instead of @log, which doesn't exist).
4002
4006
4003 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4007 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4004 AttributeError crash. Thanks to Christopher Armstrong
4008 AttributeError crash. Thanks to Christopher Armstrong
4005 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4009 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4006 introduced recently (in 0.2.14pre37) with the fix to the eval
4010 introduced recently (in 0.2.14pre37) with the fix to the eval
4007 problem mentioned below.
4011 problem mentioned below.
4008
4012
4009 2002-10-17 Fernando Perez <fperez@colorado.edu>
4013 2002-10-17 Fernando Perez <fperez@colorado.edu>
4010
4014
4011 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4015 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4012 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4016 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4013
4017
4014 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4018 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4015 this function to fix a problem reported by Alex Schmolck. He saw
4019 this function to fix a problem reported by Alex Schmolck. He saw
4016 it with list comprehensions and generators, which were getting
4020 it with list comprehensions and generators, which were getting
4017 called twice. The real problem was an 'eval' call in testing for
4021 called twice. The real problem was an 'eval' call in testing for
4018 automagic which was evaluating the input line silently.
4022 automagic which was evaluating the input line silently.
4019
4023
4020 This is a potentially very nasty bug, if the input has side
4024 This is a potentially very nasty bug, if the input has side
4021 effects which must not be repeated. The code is much cleaner now,
4025 effects which must not be repeated. The code is much cleaner now,
4022 without any blanket 'except' left and with a regexp test for
4026 without any blanket 'except' left and with a regexp test for
4023 actual function names.
4027 actual function names.
4024
4028
4025 But an eval remains, which I'm not fully comfortable with. I just
4029 But an eval remains, which I'm not fully comfortable with. I just
4026 don't know how to find out if an expression could be a callable in
4030 don't know how to find out if an expression could be a callable in
4027 the user's namespace without doing an eval on the string. However
4031 the user's namespace without doing an eval on the string. However
4028 that string is now much more strictly checked so that no code
4032 that string is now much more strictly checked so that no code
4029 slips by, so the eval should only happen for things that can
4033 slips by, so the eval should only happen for things that can
4030 really be only function/method names.
4034 really be only function/method names.
4031
4035
4032 2002-10-15 Fernando Perez <fperez@colorado.edu>
4036 2002-10-15 Fernando Perez <fperez@colorado.edu>
4033
4037
4034 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4038 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4035 OSX information to main manual, removed README_Mac_OSX file from
4039 OSX information to main manual, removed README_Mac_OSX file from
4036 distribution. Also updated credits for recent additions.
4040 distribution. Also updated credits for recent additions.
4037
4041
4038 2002-10-10 Fernando Perez <fperez@colorado.edu>
4042 2002-10-10 Fernando Perez <fperez@colorado.edu>
4039
4043
4040 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4044 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4041 terminal-related issues. Many thanks to Andrea Riciputi
4045 terminal-related issues. Many thanks to Andrea Riciputi
4042 <andrea.riciputi-AT-libero.it> for writing it.
4046 <andrea.riciputi-AT-libero.it> for writing it.
4043
4047
4044 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4048 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4045 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4049 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4046
4050
4047 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4051 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4048 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4052 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4049 <syver-en-AT-online.no> who both submitted patches for this problem.
4053 <syver-en-AT-online.no> who both submitted patches for this problem.
4050
4054
4051 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4055 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4052 global embedding to make sure that things don't overwrite user
4056 global embedding to make sure that things don't overwrite user
4053 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4057 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4054
4058
4055 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4059 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4056 compatibility. Thanks to Hayden Callow
4060 compatibility. Thanks to Hayden Callow
4057 <h.callow-AT-elec.canterbury.ac.nz>
4061 <h.callow-AT-elec.canterbury.ac.nz>
4058
4062
4059 2002-10-04 Fernando Perez <fperez@colorado.edu>
4063 2002-10-04 Fernando Perez <fperez@colorado.edu>
4060
4064
4061 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4065 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4062 Gnuplot.File objects.
4066 Gnuplot.File objects.
4063
4067
4064 2002-07-23 Fernando Perez <fperez@colorado.edu>
4068 2002-07-23 Fernando Perez <fperez@colorado.edu>
4065
4069
4066 * IPython/genutils.py (timing): Added timings() and timing() for
4070 * IPython/genutils.py (timing): Added timings() and timing() for
4067 quick access to the most commonly needed data, the execution
4071 quick access to the most commonly needed data, the execution
4068 times. Old timing() renamed to timings_out().
4072 times. Old timing() renamed to timings_out().
4069
4073
4070 2002-07-18 Fernando Perez <fperez@colorado.edu>
4074 2002-07-18 Fernando Perez <fperez@colorado.edu>
4071
4075
4072 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4076 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4073 bug with nested instances disrupting the parent's tab completion.
4077 bug with nested instances disrupting the parent's tab completion.
4074
4078
4075 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4079 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4076 all_completions code to begin the emacs integration.
4080 all_completions code to begin the emacs integration.
4077
4081
4078 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4082 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4079 argument to allow titling individual arrays when plotting.
4083 argument to allow titling individual arrays when plotting.
4080
4084
4081 2002-07-15 Fernando Perez <fperez@colorado.edu>
4085 2002-07-15 Fernando Perez <fperez@colorado.edu>
4082
4086
4083 * setup.py (make_shortcut): changed to retrieve the value of
4087 * setup.py (make_shortcut): changed to retrieve the value of
4084 'Program Files' directory from the registry (this value changes in
4088 'Program Files' directory from the registry (this value changes in
4085 non-english versions of Windows). Thanks to Thomas Fanslau
4089 non-english versions of Windows). Thanks to Thomas Fanslau
4086 <tfanslau-AT-gmx.de> for the report.
4090 <tfanslau-AT-gmx.de> for the report.
4087
4091
4088 2002-07-10 Fernando Perez <fperez@colorado.edu>
4092 2002-07-10 Fernando Perez <fperez@colorado.edu>
4089
4093
4090 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4094 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4091 a bug in pdb, which crashes if a line with only whitespace is
4095 a bug in pdb, which crashes if a line with only whitespace is
4092 entered. Bug report submitted to sourceforge.
4096 entered. Bug report submitted to sourceforge.
4093
4097
4094 2002-07-09 Fernando Perez <fperez@colorado.edu>
4098 2002-07-09 Fernando Perez <fperez@colorado.edu>
4095
4099
4096 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4100 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4097 reporting exceptions (it's a bug in inspect.py, I just set a
4101 reporting exceptions (it's a bug in inspect.py, I just set a
4098 workaround).
4102 workaround).
4099
4103
4100 2002-07-08 Fernando Perez <fperez@colorado.edu>
4104 2002-07-08 Fernando Perez <fperez@colorado.edu>
4101
4105
4102 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4106 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4103 __IPYTHON__ in __builtins__ to show up in user_ns.
4107 __IPYTHON__ in __builtins__ to show up in user_ns.
4104
4108
4105 2002-07-03 Fernando Perez <fperez@colorado.edu>
4109 2002-07-03 Fernando Perez <fperez@colorado.edu>
4106
4110
4107 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4111 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4108 name from @gp_set_instance to @gp_set_default.
4112 name from @gp_set_instance to @gp_set_default.
4109
4113
4110 * IPython/ipmaker.py (make_IPython): default editor value set to
4114 * IPython/ipmaker.py (make_IPython): default editor value set to
4111 '0' (a string), to match the rc file. Otherwise will crash when
4115 '0' (a string), to match the rc file. Otherwise will crash when
4112 .strip() is called on it.
4116 .strip() is called on it.
4113
4117
4114
4118
4115 2002-06-28 Fernando Perez <fperez@colorado.edu>
4119 2002-06-28 Fernando Perez <fperez@colorado.edu>
4116
4120
4117 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4121 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4118 of files in current directory when a file is executed via
4122 of files in current directory when a file is executed via
4119 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4123 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4120
4124
4121 * setup.py (manfiles): fix for rpm builds, submitted by RA
4125 * setup.py (manfiles): fix for rpm builds, submitted by RA
4122 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4126 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4123
4127
4124 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4128 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4125 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4129 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4126 string!). A. Schmolck caught this one.
4130 string!). A. Schmolck caught this one.
4127
4131
4128 2002-06-27 Fernando Perez <fperez@colorado.edu>
4132 2002-06-27 Fernando Perez <fperez@colorado.edu>
4129
4133
4130 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4134 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4131 defined files at the cmd line. __name__ wasn't being set to
4135 defined files at the cmd line. __name__ wasn't being set to
4132 __main__.
4136 __main__.
4133
4137
4134 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4138 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4135 regular lists and tuples besides Numeric arrays.
4139 regular lists and tuples besides Numeric arrays.
4136
4140
4137 * IPython/Prompts.py (CachedOutput.__call__): Added output
4141 * IPython/Prompts.py (CachedOutput.__call__): Added output
4138 supression for input ending with ';'. Similar to Mathematica and
4142 supression for input ending with ';'. Similar to Mathematica and
4139 Matlab. The _* vars and Out[] list are still updated, just like
4143 Matlab. The _* vars and Out[] list are still updated, just like
4140 Mathematica behaves.
4144 Mathematica behaves.
4141
4145
4142 2002-06-25 Fernando Perez <fperez@colorado.edu>
4146 2002-06-25 Fernando Perez <fperez@colorado.edu>
4143
4147
4144 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4148 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4145 .ini extensions for profiels under Windows.
4149 .ini extensions for profiels under Windows.
4146
4150
4147 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4151 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4148 string form. Fix contributed by Alexander Schmolck
4152 string form. Fix contributed by Alexander Schmolck
4149 <a.schmolck-AT-gmx.net>
4153 <a.schmolck-AT-gmx.net>
4150
4154
4151 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4155 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4152 pre-configured Gnuplot instance.
4156 pre-configured Gnuplot instance.
4153
4157
4154 2002-06-21 Fernando Perez <fperez@colorado.edu>
4158 2002-06-21 Fernando Perez <fperez@colorado.edu>
4155
4159
4156 * IPython/numutils.py (exp_safe): new function, works around the
4160 * IPython/numutils.py (exp_safe): new function, works around the
4157 underflow problems in Numeric.
4161 underflow problems in Numeric.
4158 (log2): New fn. Safe log in base 2: returns exact integer answer
4162 (log2): New fn. Safe log in base 2: returns exact integer answer
4159 for exact integer powers of 2.
4163 for exact integer powers of 2.
4160
4164
4161 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4165 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4162 properly.
4166 properly.
4163
4167
4164 2002-06-20 Fernando Perez <fperez@colorado.edu>
4168 2002-06-20 Fernando Perez <fperez@colorado.edu>
4165
4169
4166 * IPython/genutils.py (timing): new function like
4170 * IPython/genutils.py (timing): new function like
4167 Mathematica's. Similar to time_test, but returns more info.
4171 Mathematica's. Similar to time_test, but returns more info.
4168
4172
4169 2002-06-18 Fernando Perez <fperez@colorado.edu>
4173 2002-06-18 Fernando Perez <fperez@colorado.edu>
4170
4174
4171 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4175 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4172 according to Mike Heeter's suggestions.
4176 according to Mike Heeter's suggestions.
4173
4177
4174 2002-06-16 Fernando Perez <fperez@colorado.edu>
4178 2002-06-16 Fernando Perez <fperez@colorado.edu>
4175
4179
4176 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4180 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4177 system. GnuplotMagic is gone as a user-directory option. New files
4181 system. GnuplotMagic is gone as a user-directory option. New files
4178 make it easier to use all the gnuplot stuff both from external
4182 make it easier to use all the gnuplot stuff both from external
4179 programs as well as from IPython. Had to rewrite part of
4183 programs as well as from IPython. Had to rewrite part of
4180 hardcopy() b/c of a strange bug: often the ps files simply don't
4184 hardcopy() b/c of a strange bug: often the ps files simply don't
4181 get created, and require a repeat of the command (often several
4185 get created, and require a repeat of the command (often several
4182 times).
4186 times).
4183
4187
4184 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4188 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4185 resolve output channel at call time, so that if sys.stderr has
4189 resolve output channel at call time, so that if sys.stderr has
4186 been redirected by user this gets honored.
4190 been redirected by user this gets honored.
4187
4191
4188 2002-06-13 Fernando Perez <fperez@colorado.edu>
4192 2002-06-13 Fernando Perez <fperez@colorado.edu>
4189
4193
4190 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4194 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4191 IPShell. Kept a copy with the old names to avoid breaking people's
4195 IPShell. Kept a copy with the old names to avoid breaking people's
4192 embedded code.
4196 embedded code.
4193
4197
4194 * IPython/ipython: simplified it to the bare minimum after
4198 * IPython/ipython: simplified it to the bare minimum after
4195 Holger's suggestions. Added info about how to use it in
4199 Holger's suggestions. Added info about how to use it in
4196 PYTHONSTARTUP.
4200 PYTHONSTARTUP.
4197
4201
4198 * IPython/Shell.py (IPythonShell): changed the options passing
4202 * IPython/Shell.py (IPythonShell): changed the options passing
4199 from a string with funky %s replacements to a straight list. Maybe
4203 from a string with funky %s replacements to a straight list. Maybe
4200 a bit more typing, but it follows sys.argv conventions, so there's
4204 a bit more typing, but it follows sys.argv conventions, so there's
4201 less special-casing to remember.
4205 less special-casing to remember.
4202
4206
4203 2002-06-12 Fernando Perez <fperez@colorado.edu>
4207 2002-06-12 Fernando Perez <fperez@colorado.edu>
4204
4208
4205 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4209 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4206 command. Thanks to a suggestion by Mike Heeter.
4210 command. Thanks to a suggestion by Mike Heeter.
4207 (Magic.magic_pfile): added behavior to look at filenames if given
4211 (Magic.magic_pfile): added behavior to look at filenames if given
4208 arg is not a defined object.
4212 arg is not a defined object.
4209 (Magic.magic_save): New @save function to save code snippets. Also
4213 (Magic.magic_save): New @save function to save code snippets. Also
4210 a Mike Heeter idea.
4214 a Mike Heeter idea.
4211
4215
4212 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4216 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4213 plot() and replot(). Much more convenient now, especially for
4217 plot() and replot(). Much more convenient now, especially for
4214 interactive use.
4218 interactive use.
4215
4219
4216 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4220 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4217 filenames.
4221 filenames.
4218
4222
4219 2002-06-02 Fernando Perez <fperez@colorado.edu>
4223 2002-06-02 Fernando Perez <fperez@colorado.edu>
4220
4224
4221 * IPython/Struct.py (Struct.__init__): modified to admit
4225 * IPython/Struct.py (Struct.__init__): modified to admit
4222 initialization via another struct.
4226 initialization via another struct.
4223
4227
4224 * IPython/genutils.py (SystemExec.__init__): New stateful
4228 * IPython/genutils.py (SystemExec.__init__): New stateful
4225 interface to xsys and bq. Useful for writing system scripts.
4229 interface to xsys and bq. Useful for writing system scripts.
4226
4230
4227 2002-05-30 Fernando Perez <fperez@colorado.edu>
4231 2002-05-30 Fernando Perez <fperez@colorado.edu>
4228
4232
4229 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4233 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4230 documents. This will make the user download smaller (it's getting
4234 documents. This will make the user download smaller (it's getting
4231 too big).
4235 too big).
4232
4236
4233 2002-05-29 Fernando Perez <fperez@colorado.edu>
4237 2002-05-29 Fernando Perez <fperez@colorado.edu>
4234
4238
4235 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4239 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4236 fix problems with shelve and pickle. Seems to work, but I don't
4240 fix problems with shelve and pickle. Seems to work, but I don't
4237 know if corner cases break it. Thanks to Mike Heeter
4241 know if corner cases break it. Thanks to Mike Heeter
4238 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4242 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4239
4243
4240 2002-05-24 Fernando Perez <fperez@colorado.edu>
4244 2002-05-24 Fernando Perez <fperez@colorado.edu>
4241
4245
4242 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4246 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4243 macros having broken.
4247 macros having broken.
4244
4248
4245 2002-05-21 Fernando Perez <fperez@colorado.edu>
4249 2002-05-21 Fernando Perez <fperez@colorado.edu>
4246
4250
4247 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4251 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4248 introduced logging bug: all history before logging started was
4252 introduced logging bug: all history before logging started was
4249 being written one character per line! This came from the redesign
4253 being written one character per line! This came from the redesign
4250 of the input history as a special list which slices to strings,
4254 of the input history as a special list which slices to strings,
4251 not to lists.
4255 not to lists.
4252
4256
4253 2002-05-20 Fernando Perez <fperez@colorado.edu>
4257 2002-05-20 Fernando Perez <fperez@colorado.edu>
4254
4258
4255 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4259 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4256 be an attribute of all classes in this module. The design of these
4260 be an attribute of all classes in this module. The design of these
4257 classes needs some serious overhauling.
4261 classes needs some serious overhauling.
4258
4262
4259 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4263 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4260 which was ignoring '_' in option names.
4264 which was ignoring '_' in option names.
4261
4265
4262 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4266 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4263 'Verbose_novars' to 'Context' and made it the new default. It's a
4267 'Verbose_novars' to 'Context' and made it the new default. It's a
4264 bit more readable and also safer than verbose.
4268 bit more readable and also safer than verbose.
4265
4269
4266 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4270 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4267 triple-quoted strings.
4271 triple-quoted strings.
4268
4272
4269 * IPython/OInspect.py (__all__): new module exposing the object
4273 * IPython/OInspect.py (__all__): new module exposing the object
4270 introspection facilities. Now the corresponding magics are dummy
4274 introspection facilities. Now the corresponding magics are dummy
4271 wrappers around this. Having this module will make it much easier
4275 wrappers around this. Having this module will make it much easier
4272 to put these functions into our modified pdb.
4276 to put these functions into our modified pdb.
4273 This new object inspector system uses the new colorizing module,
4277 This new object inspector system uses the new colorizing module,
4274 so source code and other things are nicely syntax highlighted.
4278 so source code and other things are nicely syntax highlighted.
4275
4279
4276 2002-05-18 Fernando Perez <fperez@colorado.edu>
4280 2002-05-18 Fernando Perez <fperez@colorado.edu>
4277
4281
4278 * IPython/ColorANSI.py: Split the coloring tools into a separate
4282 * IPython/ColorANSI.py: Split the coloring tools into a separate
4279 module so I can use them in other code easier (they were part of
4283 module so I can use them in other code easier (they were part of
4280 ultraTB).
4284 ultraTB).
4281
4285
4282 2002-05-17 Fernando Perez <fperez@colorado.edu>
4286 2002-05-17 Fernando Perez <fperez@colorado.edu>
4283
4287
4284 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4288 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4285 fixed it to set the global 'g' also to the called instance, as
4289 fixed it to set the global 'g' also to the called instance, as
4286 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4290 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4287 user's 'g' variables).
4291 user's 'g' variables).
4288
4292
4289 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4293 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4290 global variables (aliases to _ih,_oh) so that users which expect
4294 global variables (aliases to _ih,_oh) so that users which expect
4291 In[5] or Out[7] to work aren't unpleasantly surprised.
4295 In[5] or Out[7] to work aren't unpleasantly surprised.
4292 (InputList.__getslice__): new class to allow executing slices of
4296 (InputList.__getslice__): new class to allow executing slices of
4293 input history directly. Very simple class, complements the use of
4297 input history directly. Very simple class, complements the use of
4294 macros.
4298 macros.
4295
4299
4296 2002-05-16 Fernando Perez <fperez@colorado.edu>
4300 2002-05-16 Fernando Perez <fperez@colorado.edu>
4297
4301
4298 * setup.py (docdirbase): make doc directory be just doc/IPython
4302 * setup.py (docdirbase): make doc directory be just doc/IPython
4299 without version numbers, it will reduce clutter for users.
4303 without version numbers, it will reduce clutter for users.
4300
4304
4301 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4305 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4302 execfile call to prevent possible memory leak. See for details:
4306 execfile call to prevent possible memory leak. See for details:
4303 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4307 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4304
4308
4305 2002-05-15 Fernando Perez <fperez@colorado.edu>
4309 2002-05-15 Fernando Perez <fperez@colorado.edu>
4306
4310
4307 * IPython/Magic.py (Magic.magic_psource): made the object
4311 * IPython/Magic.py (Magic.magic_psource): made the object
4308 introspection names be more standard: pdoc, pdef, pfile and
4312 introspection names be more standard: pdoc, pdef, pfile and
4309 psource. They all print/page their output, and it makes
4313 psource. They all print/page their output, and it makes
4310 remembering them easier. Kept old names for compatibility as
4314 remembering them easier. Kept old names for compatibility as
4311 aliases.
4315 aliases.
4312
4316
4313 2002-05-14 Fernando Perez <fperez@colorado.edu>
4317 2002-05-14 Fernando Perez <fperez@colorado.edu>
4314
4318
4315 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4319 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4316 what the mouse problem was. The trick is to use gnuplot with temp
4320 what the mouse problem was. The trick is to use gnuplot with temp
4317 files and NOT with pipes (for data communication), because having
4321 files and NOT with pipes (for data communication), because having
4318 both pipes and the mouse on is bad news.
4322 both pipes and the mouse on is bad news.
4319
4323
4320 2002-05-13 Fernando Perez <fperez@colorado.edu>
4324 2002-05-13 Fernando Perez <fperez@colorado.edu>
4321
4325
4322 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4326 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4323 bug. Information would be reported about builtins even when
4327 bug. Information would be reported about builtins even when
4324 user-defined functions overrode them.
4328 user-defined functions overrode them.
4325
4329
4326 2002-05-11 Fernando Perez <fperez@colorado.edu>
4330 2002-05-11 Fernando Perez <fperez@colorado.edu>
4327
4331
4328 * IPython/__init__.py (__all__): removed FlexCompleter from
4332 * IPython/__init__.py (__all__): removed FlexCompleter from
4329 __all__ so that things don't fail in platforms without readline.
4333 __all__ so that things don't fail in platforms without readline.
4330
4334
4331 2002-05-10 Fernando Perez <fperez@colorado.edu>
4335 2002-05-10 Fernando Perez <fperez@colorado.edu>
4332
4336
4333 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4337 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4334 it requires Numeric, effectively making Numeric a dependency for
4338 it requires Numeric, effectively making Numeric a dependency for
4335 IPython.
4339 IPython.
4336
4340
4337 * Released 0.2.13
4341 * Released 0.2.13
4338
4342
4339 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4343 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4340 profiler interface. Now all the major options from the profiler
4344 profiler interface. Now all the major options from the profiler
4341 module are directly supported in IPython, both for single
4345 module are directly supported in IPython, both for single
4342 expressions (@prun) and for full programs (@run -p).
4346 expressions (@prun) and for full programs (@run -p).
4343
4347
4344 2002-05-09 Fernando Perez <fperez@colorado.edu>
4348 2002-05-09 Fernando Perez <fperez@colorado.edu>
4345
4349
4346 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4350 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4347 magic properly formatted for screen.
4351 magic properly formatted for screen.
4348
4352
4349 * setup.py (make_shortcut): Changed things to put pdf version in
4353 * setup.py (make_shortcut): Changed things to put pdf version in
4350 doc/ instead of doc/manual (had to change lyxport a bit).
4354 doc/ instead of doc/manual (had to change lyxport a bit).
4351
4355
4352 * IPython/Magic.py (Profile.string_stats): made profile runs go
4356 * IPython/Magic.py (Profile.string_stats): made profile runs go
4353 through pager (they are long and a pager allows searching, saving,
4357 through pager (they are long and a pager allows searching, saving,
4354 etc.)
4358 etc.)
4355
4359
4356 2002-05-08 Fernando Perez <fperez@colorado.edu>
4360 2002-05-08 Fernando Perez <fperez@colorado.edu>
4357
4361
4358 * Released 0.2.12
4362 * Released 0.2.12
4359
4363
4360 2002-05-06 Fernando Perez <fperez@colorado.edu>
4364 2002-05-06 Fernando Perez <fperez@colorado.edu>
4361
4365
4362 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4366 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4363 introduced); 'hist n1 n2' was broken.
4367 introduced); 'hist n1 n2' was broken.
4364 (Magic.magic_pdb): added optional on/off arguments to @pdb
4368 (Magic.magic_pdb): added optional on/off arguments to @pdb
4365 (Magic.magic_run): added option -i to @run, which executes code in
4369 (Magic.magic_run): added option -i to @run, which executes code in
4366 the IPython namespace instead of a clean one. Also added @irun as
4370 the IPython namespace instead of a clean one. Also added @irun as
4367 an alias to @run -i.
4371 an alias to @run -i.
4368
4372
4369 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4373 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4370 fixed (it didn't really do anything, the namespaces were wrong).
4374 fixed (it didn't really do anything, the namespaces were wrong).
4371
4375
4372 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4376 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4373
4377
4374 * IPython/__init__.py (__all__): Fixed package namespace, now
4378 * IPython/__init__.py (__all__): Fixed package namespace, now
4375 'import IPython' does give access to IPython.<all> as
4379 'import IPython' does give access to IPython.<all> as
4376 expected. Also renamed __release__ to Release.
4380 expected. Also renamed __release__ to Release.
4377
4381
4378 * IPython/Debugger.py (__license__): created new Pdb class which
4382 * IPython/Debugger.py (__license__): created new Pdb class which
4379 functions like a drop-in for the normal pdb.Pdb but does NOT
4383 functions like a drop-in for the normal pdb.Pdb but does NOT
4380 import readline by default. This way it doesn't muck up IPython's
4384 import readline by default. This way it doesn't muck up IPython's
4381 readline handling, and now tab-completion finally works in the
4385 readline handling, and now tab-completion finally works in the
4382 debugger -- sort of. It completes things globally visible, but the
4386 debugger -- sort of. It completes things globally visible, but the
4383 completer doesn't track the stack as pdb walks it. That's a bit
4387 completer doesn't track the stack as pdb walks it. That's a bit
4384 tricky, and I'll have to implement it later.
4388 tricky, and I'll have to implement it later.
4385
4389
4386 2002-05-05 Fernando Perez <fperez@colorado.edu>
4390 2002-05-05 Fernando Perez <fperez@colorado.edu>
4387
4391
4388 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4392 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4389 magic docstrings when printed via ? (explicit \'s were being
4393 magic docstrings when printed via ? (explicit \'s were being
4390 printed).
4394 printed).
4391
4395
4392 * IPython/ipmaker.py (make_IPython): fixed namespace
4396 * IPython/ipmaker.py (make_IPython): fixed namespace
4393 identification bug. Now variables loaded via logs or command-line
4397 identification bug. Now variables loaded via logs or command-line
4394 files are recognized in the interactive namespace by @who.
4398 files are recognized in the interactive namespace by @who.
4395
4399
4396 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4400 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4397 log replay system stemming from the string form of Structs.
4401 log replay system stemming from the string form of Structs.
4398
4402
4399 * IPython/Magic.py (Macro.__init__): improved macros to properly
4403 * IPython/Magic.py (Macro.__init__): improved macros to properly
4400 handle magic commands in them.
4404 handle magic commands in them.
4401 (Magic.magic_logstart): usernames are now expanded so 'logstart
4405 (Magic.magic_logstart): usernames are now expanded so 'logstart
4402 ~/mylog' now works.
4406 ~/mylog' now works.
4403
4407
4404 * IPython/iplib.py (complete): fixed bug where paths starting with
4408 * IPython/iplib.py (complete): fixed bug where paths starting with
4405 '/' would be completed as magic names.
4409 '/' would be completed as magic names.
4406
4410
4407 2002-05-04 Fernando Perez <fperez@colorado.edu>
4411 2002-05-04 Fernando Perez <fperez@colorado.edu>
4408
4412
4409 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4413 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4410 allow running full programs under the profiler's control.
4414 allow running full programs under the profiler's control.
4411
4415
4412 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4416 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4413 mode to report exceptions verbosely but without formatting
4417 mode to report exceptions verbosely but without formatting
4414 variables. This addresses the issue of ipython 'freezing' (it's
4418 variables. This addresses the issue of ipython 'freezing' (it's
4415 not frozen, but caught in an expensive formatting loop) when huge
4419 not frozen, but caught in an expensive formatting loop) when huge
4416 variables are in the context of an exception.
4420 variables are in the context of an exception.
4417 (VerboseTB.text): Added '--->' markers at line where exception was
4421 (VerboseTB.text): Added '--->' markers at line where exception was
4418 triggered. Much clearer to read, especially in NoColor modes.
4422 triggered. Much clearer to read, especially in NoColor modes.
4419
4423
4420 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4424 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4421 implemented in reverse when changing to the new parse_options().
4425 implemented in reverse when changing to the new parse_options().
4422
4426
4423 2002-05-03 Fernando Perez <fperez@colorado.edu>
4427 2002-05-03 Fernando Perez <fperez@colorado.edu>
4424
4428
4425 * IPython/Magic.py (Magic.parse_options): new function so that
4429 * IPython/Magic.py (Magic.parse_options): new function so that
4426 magics can parse options easier.
4430 magics can parse options easier.
4427 (Magic.magic_prun): new function similar to profile.run(),
4431 (Magic.magic_prun): new function similar to profile.run(),
4428 suggested by Chris Hart.
4432 suggested by Chris Hart.
4429 (Magic.magic_cd): fixed behavior so that it only changes if
4433 (Magic.magic_cd): fixed behavior so that it only changes if
4430 directory actually is in history.
4434 directory actually is in history.
4431
4435
4432 * IPython/usage.py (__doc__): added information about potential
4436 * IPython/usage.py (__doc__): added information about potential
4433 slowness of Verbose exception mode when there are huge data
4437 slowness of Verbose exception mode when there are huge data
4434 structures to be formatted (thanks to Archie Paulson).
4438 structures to be formatted (thanks to Archie Paulson).
4435
4439
4436 * IPython/ipmaker.py (make_IPython): Changed default logging
4440 * IPython/ipmaker.py (make_IPython): Changed default logging
4437 (when simply called with -log) to use curr_dir/ipython.log in
4441 (when simply called with -log) to use curr_dir/ipython.log in
4438 rotate mode. Fixed crash which was occuring with -log before
4442 rotate mode. Fixed crash which was occuring with -log before
4439 (thanks to Jim Boyle).
4443 (thanks to Jim Boyle).
4440
4444
4441 2002-05-01 Fernando Perez <fperez@colorado.edu>
4445 2002-05-01 Fernando Perez <fperez@colorado.edu>
4442
4446
4443 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4447 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4444 was nasty -- though somewhat of a corner case).
4448 was nasty -- though somewhat of a corner case).
4445
4449
4446 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4450 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4447 text (was a bug).
4451 text (was a bug).
4448
4452
4449 2002-04-30 Fernando Perez <fperez@colorado.edu>
4453 2002-04-30 Fernando Perez <fperez@colorado.edu>
4450
4454
4451 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4455 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4452 a print after ^D or ^C from the user so that the In[] prompt
4456 a print after ^D or ^C from the user so that the In[] prompt
4453 doesn't over-run the gnuplot one.
4457 doesn't over-run the gnuplot one.
4454
4458
4455 2002-04-29 Fernando Perez <fperez@colorado.edu>
4459 2002-04-29 Fernando Perez <fperez@colorado.edu>
4456
4460
4457 * Released 0.2.10
4461 * Released 0.2.10
4458
4462
4459 * IPython/__release__.py (version): get date dynamically.
4463 * IPython/__release__.py (version): get date dynamically.
4460
4464
4461 * Misc. documentation updates thanks to Arnd's comments. Also ran
4465 * Misc. documentation updates thanks to Arnd's comments. Also ran
4462 a full spellcheck on the manual (hadn't been done in a while).
4466 a full spellcheck on the manual (hadn't been done in a while).
4463
4467
4464 2002-04-27 Fernando Perez <fperez@colorado.edu>
4468 2002-04-27 Fernando Perez <fperez@colorado.edu>
4465
4469
4466 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4470 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4467 starting a log in mid-session would reset the input history list.
4471 starting a log in mid-session would reset the input history list.
4468
4472
4469 2002-04-26 Fernando Perez <fperez@colorado.edu>
4473 2002-04-26 Fernando Perez <fperez@colorado.edu>
4470
4474
4471 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4475 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4472 all files were being included in an update. Now anything in
4476 all files were being included in an update. Now anything in
4473 UserConfig that matches [A-Za-z]*.py will go (this excludes
4477 UserConfig that matches [A-Za-z]*.py will go (this excludes
4474 __init__.py)
4478 __init__.py)
4475
4479
4476 2002-04-25 Fernando Perez <fperez@colorado.edu>
4480 2002-04-25 Fernando Perez <fperez@colorado.edu>
4477
4481
4478 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4482 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4479 to __builtins__ so that any form of embedded or imported code can
4483 to __builtins__ so that any form of embedded or imported code can
4480 test for being inside IPython.
4484 test for being inside IPython.
4481
4485
4482 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4486 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4483 changed to GnuplotMagic because it's now an importable module,
4487 changed to GnuplotMagic because it's now an importable module,
4484 this makes the name follow that of the standard Gnuplot module.
4488 this makes the name follow that of the standard Gnuplot module.
4485 GnuplotMagic can now be loaded at any time in mid-session.
4489 GnuplotMagic can now be loaded at any time in mid-session.
4486
4490
4487 2002-04-24 Fernando Perez <fperez@colorado.edu>
4491 2002-04-24 Fernando Perez <fperez@colorado.edu>
4488
4492
4489 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4493 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4490 the globals (IPython has its own namespace) and the
4494 the globals (IPython has its own namespace) and the
4491 PhysicalQuantity stuff is much better anyway.
4495 PhysicalQuantity stuff is much better anyway.
4492
4496
4493 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4497 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4494 embedding example to standard user directory for
4498 embedding example to standard user directory for
4495 distribution. Also put it in the manual.
4499 distribution. Also put it in the manual.
4496
4500
4497 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4501 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4498 instance as first argument (so it doesn't rely on some obscure
4502 instance as first argument (so it doesn't rely on some obscure
4499 hidden global).
4503 hidden global).
4500
4504
4501 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4505 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4502 delimiters. While it prevents ().TAB from working, it allows
4506 delimiters. While it prevents ().TAB from working, it allows
4503 completions in open (... expressions. This is by far a more common
4507 completions in open (... expressions. This is by far a more common
4504 case.
4508 case.
4505
4509
4506 2002-04-23 Fernando Perez <fperez@colorado.edu>
4510 2002-04-23 Fernando Perez <fperez@colorado.edu>
4507
4511
4508 * IPython/Extensions/InterpreterPasteInput.py: new
4512 * IPython/Extensions/InterpreterPasteInput.py: new
4509 syntax-processing module for pasting lines with >>> or ... at the
4513 syntax-processing module for pasting lines with >>> or ... at the
4510 start.
4514 start.
4511
4515
4512 * IPython/Extensions/PhysicalQ_Interactive.py
4516 * IPython/Extensions/PhysicalQ_Interactive.py
4513 (PhysicalQuantityInteractive.__int__): fixed to work with either
4517 (PhysicalQuantityInteractive.__int__): fixed to work with either
4514 Numeric or math.
4518 Numeric or math.
4515
4519
4516 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4520 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4517 provided profiles. Now we have:
4521 provided profiles. Now we have:
4518 -math -> math module as * and cmath with its own namespace.
4522 -math -> math module as * and cmath with its own namespace.
4519 -numeric -> Numeric as *, plus gnuplot & grace
4523 -numeric -> Numeric as *, plus gnuplot & grace
4520 -physics -> same as before
4524 -physics -> same as before
4521
4525
4522 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4526 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4523 user-defined magics wouldn't be found by @magic if they were
4527 user-defined magics wouldn't be found by @magic if they were
4524 defined as class methods. Also cleaned up the namespace search
4528 defined as class methods. Also cleaned up the namespace search
4525 logic and the string building (to use %s instead of many repeated
4529 logic and the string building (to use %s instead of many repeated
4526 string adds).
4530 string adds).
4527
4531
4528 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4532 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4529 of user-defined magics to operate with class methods (cleaner, in
4533 of user-defined magics to operate with class methods (cleaner, in
4530 line with the gnuplot code).
4534 line with the gnuplot code).
4531
4535
4532 2002-04-22 Fernando Perez <fperez@colorado.edu>
4536 2002-04-22 Fernando Perez <fperez@colorado.edu>
4533
4537
4534 * setup.py: updated dependency list so that manual is updated when
4538 * setup.py: updated dependency list so that manual is updated when
4535 all included files change.
4539 all included files change.
4536
4540
4537 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4541 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4538 the delimiter removal option (the fix is ugly right now).
4542 the delimiter removal option (the fix is ugly right now).
4539
4543
4540 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4544 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4541 all of the math profile (quicker loading, no conflict between
4545 all of the math profile (quicker loading, no conflict between
4542 g-9.8 and g-gnuplot).
4546 g-9.8 and g-gnuplot).
4543
4547
4544 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4548 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4545 name of post-mortem files to IPython_crash_report.txt.
4549 name of post-mortem files to IPython_crash_report.txt.
4546
4550
4547 * Cleanup/update of the docs. Added all the new readline info and
4551 * Cleanup/update of the docs. Added all the new readline info and
4548 formatted all lists as 'real lists'.
4552 formatted all lists as 'real lists'.
4549
4553
4550 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4554 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4551 tab-completion options, since the full readline parse_and_bind is
4555 tab-completion options, since the full readline parse_and_bind is
4552 now accessible.
4556 now accessible.
4553
4557
4554 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4558 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4555 handling of readline options. Now users can specify any string to
4559 handling of readline options. Now users can specify any string to
4556 be passed to parse_and_bind(), as well as the delimiters to be
4560 be passed to parse_and_bind(), as well as the delimiters to be
4557 removed.
4561 removed.
4558 (InteractiveShell.__init__): Added __name__ to the global
4562 (InteractiveShell.__init__): Added __name__ to the global
4559 namespace so that things like Itpl which rely on its existence
4563 namespace so that things like Itpl which rely on its existence
4560 don't crash.
4564 don't crash.
4561 (InteractiveShell._prefilter): Defined the default with a _ so
4565 (InteractiveShell._prefilter): Defined the default with a _ so
4562 that prefilter() is easier to override, while the default one
4566 that prefilter() is easier to override, while the default one
4563 remains available.
4567 remains available.
4564
4568
4565 2002-04-18 Fernando Perez <fperez@colorado.edu>
4569 2002-04-18 Fernando Perez <fperez@colorado.edu>
4566
4570
4567 * Added information about pdb in the docs.
4571 * Added information about pdb in the docs.
4568
4572
4569 2002-04-17 Fernando Perez <fperez@colorado.edu>
4573 2002-04-17 Fernando Perez <fperez@colorado.edu>
4570
4574
4571 * IPython/ipmaker.py (make_IPython): added rc_override option to
4575 * IPython/ipmaker.py (make_IPython): added rc_override option to
4572 allow passing config options at creation time which may override
4576 allow passing config options at creation time which may override
4573 anything set in the config files or command line. This is
4577 anything set in the config files or command line. This is
4574 particularly useful for configuring embedded instances.
4578 particularly useful for configuring embedded instances.
4575
4579
4576 2002-04-15 Fernando Perez <fperez@colorado.edu>
4580 2002-04-15 Fernando Perez <fperez@colorado.edu>
4577
4581
4578 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4582 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4579 crash embedded instances because of the input cache falling out of
4583 crash embedded instances because of the input cache falling out of
4580 sync with the output counter.
4584 sync with the output counter.
4581
4585
4582 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4586 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4583 mode which calls pdb after an uncaught exception in IPython itself.
4587 mode which calls pdb after an uncaught exception in IPython itself.
4584
4588
4585 2002-04-14 Fernando Perez <fperez@colorado.edu>
4589 2002-04-14 Fernando Perez <fperez@colorado.edu>
4586
4590
4587 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4591 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4588 readline, fix it back after each call.
4592 readline, fix it back after each call.
4589
4593
4590 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4594 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4591 method to force all access via __call__(), which guarantees that
4595 method to force all access via __call__(), which guarantees that
4592 traceback references are properly deleted.
4596 traceback references are properly deleted.
4593
4597
4594 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4598 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4595 improve printing when pprint is in use.
4599 improve printing when pprint is in use.
4596
4600
4597 2002-04-13 Fernando Perez <fperez@colorado.edu>
4601 2002-04-13 Fernando Perez <fperez@colorado.edu>
4598
4602
4599 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4603 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4600 exceptions aren't caught anymore. If the user triggers one, he
4604 exceptions aren't caught anymore. If the user triggers one, he
4601 should know why he's doing it and it should go all the way up,
4605 should know why he's doing it and it should go all the way up,
4602 just like any other exception. So now @abort will fully kill the
4606 just like any other exception. So now @abort will fully kill the
4603 embedded interpreter and the embedding code (unless that happens
4607 embedded interpreter and the embedding code (unless that happens
4604 to catch SystemExit).
4608 to catch SystemExit).
4605
4609
4606 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4610 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4607 and a debugger() method to invoke the interactive pdb debugger
4611 and a debugger() method to invoke the interactive pdb debugger
4608 after printing exception information. Also added the corresponding
4612 after printing exception information. Also added the corresponding
4609 -pdb option and @pdb magic to control this feature, and updated
4613 -pdb option and @pdb magic to control this feature, and updated
4610 the docs. After a suggestion from Christopher Hart
4614 the docs. After a suggestion from Christopher Hart
4611 (hart-AT-caltech.edu).
4615 (hart-AT-caltech.edu).
4612
4616
4613 2002-04-12 Fernando Perez <fperez@colorado.edu>
4617 2002-04-12 Fernando Perez <fperez@colorado.edu>
4614
4618
4615 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4619 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4616 the exception handlers defined by the user (not the CrashHandler)
4620 the exception handlers defined by the user (not the CrashHandler)
4617 so that user exceptions don't trigger an ipython bug report.
4621 so that user exceptions don't trigger an ipython bug report.
4618
4622
4619 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4623 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4620 configurable (it should have always been so).
4624 configurable (it should have always been so).
4621
4625
4622 2002-03-26 Fernando Perez <fperez@colorado.edu>
4626 2002-03-26 Fernando Perez <fperez@colorado.edu>
4623
4627
4624 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4628 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4625 and there to fix embedding namespace issues. This should all be
4629 and there to fix embedding namespace issues. This should all be
4626 done in a more elegant way.
4630 done in a more elegant way.
4627
4631
4628 2002-03-25 Fernando Perez <fperez@colorado.edu>
4632 2002-03-25 Fernando Perez <fperez@colorado.edu>
4629
4633
4630 * IPython/genutils.py (get_home_dir): Try to make it work under
4634 * IPython/genutils.py (get_home_dir): Try to make it work under
4631 win9x also.
4635 win9x also.
4632
4636
4633 2002-03-20 Fernando Perez <fperez@colorado.edu>
4637 2002-03-20 Fernando Perez <fperez@colorado.edu>
4634
4638
4635 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4639 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4636 sys.displayhook untouched upon __init__.
4640 sys.displayhook untouched upon __init__.
4637
4641
4638 2002-03-19 Fernando Perez <fperez@colorado.edu>
4642 2002-03-19 Fernando Perez <fperez@colorado.edu>
4639
4643
4640 * Released 0.2.9 (for embedding bug, basically).
4644 * Released 0.2.9 (for embedding bug, basically).
4641
4645
4642 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4646 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4643 exceptions so that enclosing shell's state can be restored.
4647 exceptions so that enclosing shell's state can be restored.
4644
4648
4645 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4649 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4646 naming conventions in the .ipython/ dir.
4650 naming conventions in the .ipython/ dir.
4647
4651
4648 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4652 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4649 from delimiters list so filenames with - in them get expanded.
4653 from delimiters list so filenames with - in them get expanded.
4650
4654
4651 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4655 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4652 sys.displayhook not being properly restored after an embedded call.
4656 sys.displayhook not being properly restored after an embedded call.
4653
4657
4654 2002-03-18 Fernando Perez <fperez@colorado.edu>
4658 2002-03-18 Fernando Perez <fperez@colorado.edu>
4655
4659
4656 * Released 0.2.8
4660 * Released 0.2.8
4657
4661
4658 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4662 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4659 some files weren't being included in a -upgrade.
4663 some files weren't being included in a -upgrade.
4660 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4664 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4661 on' so that the first tab completes.
4665 on' so that the first tab completes.
4662 (InteractiveShell.handle_magic): fixed bug with spaces around
4666 (InteractiveShell.handle_magic): fixed bug with spaces around
4663 quotes breaking many magic commands.
4667 quotes breaking many magic commands.
4664
4668
4665 * setup.py: added note about ignoring the syntax error messages at
4669 * setup.py: added note about ignoring the syntax error messages at
4666 installation.
4670 installation.
4667
4671
4668 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4672 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4669 streamlining the gnuplot interface, now there's only one magic @gp.
4673 streamlining the gnuplot interface, now there's only one magic @gp.
4670
4674
4671 2002-03-17 Fernando Perez <fperez@colorado.edu>
4675 2002-03-17 Fernando Perez <fperez@colorado.edu>
4672
4676
4673 * IPython/UserConfig/magic_gnuplot.py: new name for the
4677 * IPython/UserConfig/magic_gnuplot.py: new name for the
4674 example-magic_pm.py file. Much enhanced system, now with a shell
4678 example-magic_pm.py file. Much enhanced system, now with a shell
4675 for communicating directly with gnuplot, one command at a time.
4679 for communicating directly with gnuplot, one command at a time.
4676
4680
4677 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4681 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4678 setting __name__=='__main__'.
4682 setting __name__=='__main__'.
4679
4683
4680 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4684 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4681 mini-shell for accessing gnuplot from inside ipython. Should
4685 mini-shell for accessing gnuplot from inside ipython. Should
4682 extend it later for grace access too. Inspired by Arnd's
4686 extend it later for grace access too. Inspired by Arnd's
4683 suggestion.
4687 suggestion.
4684
4688
4685 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4689 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4686 calling magic functions with () in their arguments. Thanks to Arnd
4690 calling magic functions with () in their arguments. Thanks to Arnd
4687 Baecker for pointing this to me.
4691 Baecker for pointing this to me.
4688
4692
4689 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4693 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4690 infinitely for integer or complex arrays (only worked with floats).
4694 infinitely for integer or complex arrays (only worked with floats).
4691
4695
4692 2002-03-16 Fernando Perez <fperez@colorado.edu>
4696 2002-03-16 Fernando Perez <fperez@colorado.edu>
4693
4697
4694 * setup.py: Merged setup and setup_windows into a single script
4698 * setup.py: Merged setup and setup_windows into a single script
4695 which properly handles things for windows users.
4699 which properly handles things for windows users.
4696
4700
4697 2002-03-15 Fernando Perez <fperez@colorado.edu>
4701 2002-03-15 Fernando Perez <fperez@colorado.edu>
4698
4702
4699 * Big change to the manual: now the magics are all automatically
4703 * Big change to the manual: now the magics are all automatically
4700 documented. This information is generated from their docstrings
4704 documented. This information is generated from their docstrings
4701 and put in a latex file included by the manual lyx file. This way
4705 and put in a latex file included by the manual lyx file. This way
4702 we get always up to date information for the magics. The manual
4706 we get always up to date information for the magics. The manual
4703 now also has proper version information, also auto-synced.
4707 now also has proper version information, also auto-synced.
4704
4708
4705 For this to work, an undocumented --magic_docstrings option was added.
4709 For this to work, an undocumented --magic_docstrings option was added.
4706
4710
4707 2002-03-13 Fernando Perez <fperez@colorado.edu>
4711 2002-03-13 Fernando Perez <fperez@colorado.edu>
4708
4712
4709 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4713 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4710 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4714 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4711
4715
4712 2002-03-12 Fernando Perez <fperez@colorado.edu>
4716 2002-03-12 Fernando Perez <fperez@colorado.edu>
4713
4717
4714 * IPython/ultraTB.py (TermColors): changed color escapes again to
4718 * IPython/ultraTB.py (TermColors): changed color escapes again to
4715 fix the (old, reintroduced) line-wrapping bug. Basically, if
4719 fix the (old, reintroduced) line-wrapping bug. Basically, if
4716 \001..\002 aren't given in the color escapes, lines get wrapped
4720 \001..\002 aren't given in the color escapes, lines get wrapped
4717 weirdly. But giving those screws up old xterms and emacs terms. So
4721 weirdly. But giving those screws up old xterms and emacs terms. So
4718 I added some logic for emacs terms to be ok, but I can't identify old
4722 I added some logic for emacs terms to be ok, but I can't identify old
4719 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4723 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4720
4724
4721 2002-03-10 Fernando Perez <fperez@colorado.edu>
4725 2002-03-10 Fernando Perez <fperez@colorado.edu>
4722
4726
4723 * IPython/usage.py (__doc__): Various documentation cleanups and
4727 * IPython/usage.py (__doc__): Various documentation cleanups and
4724 updates, both in usage docstrings and in the manual.
4728 updates, both in usage docstrings and in the manual.
4725
4729
4726 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4730 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4727 handling of caching. Set minimum acceptabe value for having a
4731 handling of caching. Set minimum acceptabe value for having a
4728 cache at 20 values.
4732 cache at 20 values.
4729
4733
4730 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4734 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4731 install_first_time function to a method, renamed it and added an
4735 install_first_time function to a method, renamed it and added an
4732 'upgrade' mode. Now people can update their config directory with
4736 'upgrade' mode. Now people can update their config directory with
4733 a simple command line switch (-upgrade, also new).
4737 a simple command line switch (-upgrade, also new).
4734
4738
4735 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4739 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4736 @file (convenient for automagic users under Python >= 2.2).
4740 @file (convenient for automagic users under Python >= 2.2).
4737 Removed @files (it seemed more like a plural than an abbrev. of
4741 Removed @files (it seemed more like a plural than an abbrev. of
4738 'file show').
4742 'file show').
4739
4743
4740 * IPython/iplib.py (install_first_time): Fixed crash if there were
4744 * IPython/iplib.py (install_first_time): Fixed crash if there were
4741 backup files ('~') in .ipython/ install directory.
4745 backup files ('~') in .ipython/ install directory.
4742
4746
4743 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4747 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4744 system. Things look fine, but these changes are fairly
4748 system. Things look fine, but these changes are fairly
4745 intrusive. Test them for a few days.
4749 intrusive. Test them for a few days.
4746
4750
4747 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4751 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4748 the prompts system. Now all in/out prompt strings are user
4752 the prompts system. Now all in/out prompt strings are user
4749 controllable. This is particularly useful for embedding, as one
4753 controllable. This is particularly useful for embedding, as one
4750 can tag embedded instances with particular prompts.
4754 can tag embedded instances with particular prompts.
4751
4755
4752 Also removed global use of sys.ps1/2, which now allows nested
4756 Also removed global use of sys.ps1/2, which now allows nested
4753 embeddings without any problems. Added command-line options for
4757 embeddings without any problems. Added command-line options for
4754 the prompt strings.
4758 the prompt strings.
4755
4759
4756 2002-03-08 Fernando Perez <fperez@colorado.edu>
4760 2002-03-08 Fernando Perez <fperez@colorado.edu>
4757
4761
4758 * IPython/UserConfig/example-embed-short.py (ipshell): added
4762 * IPython/UserConfig/example-embed-short.py (ipshell): added
4759 example file with the bare minimum code for embedding.
4763 example file with the bare minimum code for embedding.
4760
4764
4761 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4765 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4762 functionality for the embeddable shell to be activated/deactivated
4766 functionality for the embeddable shell to be activated/deactivated
4763 either globally or at each call.
4767 either globally or at each call.
4764
4768
4765 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4769 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4766 rewriting the prompt with '--->' for auto-inputs with proper
4770 rewriting the prompt with '--->' for auto-inputs with proper
4767 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4771 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4768 this is handled by the prompts class itself, as it should.
4772 this is handled by the prompts class itself, as it should.
4769
4773
4770 2002-03-05 Fernando Perez <fperez@colorado.edu>
4774 2002-03-05 Fernando Perez <fperez@colorado.edu>
4771
4775
4772 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4776 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4773 @logstart to avoid name clashes with the math log function.
4777 @logstart to avoid name clashes with the math log function.
4774
4778
4775 * Big updates to X/Emacs section of the manual.
4779 * Big updates to X/Emacs section of the manual.
4776
4780
4777 * Removed ipython_emacs. Milan explained to me how to pass
4781 * Removed ipython_emacs. Milan explained to me how to pass
4778 arguments to ipython through Emacs. Some day I'm going to end up
4782 arguments to ipython through Emacs. Some day I'm going to end up
4779 learning some lisp...
4783 learning some lisp...
4780
4784
4781 2002-03-04 Fernando Perez <fperez@colorado.edu>
4785 2002-03-04 Fernando Perez <fperez@colorado.edu>
4782
4786
4783 * IPython/ipython_emacs: Created script to be used as the
4787 * IPython/ipython_emacs: Created script to be used as the
4784 py-python-command Emacs variable so we can pass IPython
4788 py-python-command Emacs variable so we can pass IPython
4785 parameters. I can't figure out how to tell Emacs directly to pass
4789 parameters. I can't figure out how to tell Emacs directly to pass
4786 parameters to IPython, so a dummy shell script will do it.
4790 parameters to IPython, so a dummy shell script will do it.
4787
4791
4788 Other enhancements made for things to work better under Emacs'
4792 Other enhancements made for things to work better under Emacs'
4789 various types of terminals. Many thanks to Milan Zamazal
4793 various types of terminals. Many thanks to Milan Zamazal
4790 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4794 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4791
4795
4792 2002-03-01 Fernando Perez <fperez@colorado.edu>
4796 2002-03-01 Fernando Perez <fperez@colorado.edu>
4793
4797
4794 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4798 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4795 that loading of readline is now optional. This gives better
4799 that loading of readline is now optional. This gives better
4796 control to emacs users.
4800 control to emacs users.
4797
4801
4798 * IPython/ultraTB.py (__date__): Modified color escape sequences
4802 * IPython/ultraTB.py (__date__): Modified color escape sequences
4799 and now things work fine under xterm and in Emacs' term buffers
4803 and now things work fine under xterm and in Emacs' term buffers
4800 (though not shell ones). Well, in emacs you get colors, but all
4804 (though not shell ones). Well, in emacs you get colors, but all
4801 seem to be 'light' colors (no difference between dark and light
4805 seem to be 'light' colors (no difference between dark and light
4802 ones). But the garbage chars are gone, and also in xterms. It
4806 ones). But the garbage chars are gone, and also in xterms. It
4803 seems that now I'm using 'cleaner' ansi sequences.
4807 seems that now I'm using 'cleaner' ansi sequences.
4804
4808
4805 2002-02-21 Fernando Perez <fperez@colorado.edu>
4809 2002-02-21 Fernando Perez <fperez@colorado.edu>
4806
4810
4807 * Released 0.2.7 (mainly to publish the scoping fix).
4811 * Released 0.2.7 (mainly to publish the scoping fix).
4808
4812
4809 * IPython/Logger.py (Logger.logstate): added. A corresponding
4813 * IPython/Logger.py (Logger.logstate): added. A corresponding
4810 @logstate magic was created.
4814 @logstate magic was created.
4811
4815
4812 * IPython/Magic.py: fixed nested scoping problem under Python
4816 * IPython/Magic.py: fixed nested scoping problem under Python
4813 2.1.x (automagic wasn't working).
4817 2.1.x (automagic wasn't working).
4814
4818
4815 2002-02-20 Fernando Perez <fperez@colorado.edu>
4819 2002-02-20 Fernando Perez <fperez@colorado.edu>
4816
4820
4817 * Released 0.2.6.
4821 * Released 0.2.6.
4818
4822
4819 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4823 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4820 option so that logs can come out without any headers at all.
4824 option so that logs can come out without any headers at all.
4821
4825
4822 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4826 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4823 SciPy.
4827 SciPy.
4824
4828
4825 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4829 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4826 that embedded IPython calls don't require vars() to be explicitly
4830 that embedded IPython calls don't require vars() to be explicitly
4827 passed. Now they are extracted from the caller's frame (code
4831 passed. Now they are extracted from the caller's frame (code
4828 snatched from Eric Jones' weave). Added better documentation to
4832 snatched from Eric Jones' weave). Added better documentation to
4829 the section on embedding and the example file.
4833 the section on embedding and the example file.
4830
4834
4831 * IPython/genutils.py (page): Changed so that under emacs, it just
4835 * IPython/genutils.py (page): Changed so that under emacs, it just
4832 prints the string. You can then page up and down in the emacs
4836 prints the string. You can then page up and down in the emacs
4833 buffer itself. This is how the builtin help() works.
4837 buffer itself. This is how the builtin help() works.
4834
4838
4835 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4839 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4836 macro scoping: macros need to be executed in the user's namespace
4840 macro scoping: macros need to be executed in the user's namespace
4837 to work as if they had been typed by the user.
4841 to work as if they had been typed by the user.
4838
4842
4839 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4843 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4840 execute automatically (no need to type 'exec...'). They then
4844 execute automatically (no need to type 'exec...'). They then
4841 behave like 'true macros'. The printing system was also modified
4845 behave like 'true macros'. The printing system was also modified
4842 for this to work.
4846 for this to work.
4843
4847
4844 2002-02-19 Fernando Perez <fperez@colorado.edu>
4848 2002-02-19 Fernando Perez <fperez@colorado.edu>
4845
4849
4846 * IPython/genutils.py (page_file): new function for paging files
4850 * IPython/genutils.py (page_file): new function for paging files
4847 in an OS-independent way. Also necessary for file viewing to work
4851 in an OS-independent way. Also necessary for file viewing to work
4848 well inside Emacs buffers.
4852 well inside Emacs buffers.
4849 (page): Added checks for being in an emacs buffer.
4853 (page): Added checks for being in an emacs buffer.
4850 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4854 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4851 same bug in iplib.
4855 same bug in iplib.
4852
4856
4853 2002-02-18 Fernando Perez <fperez@colorado.edu>
4857 2002-02-18 Fernando Perez <fperez@colorado.edu>
4854
4858
4855 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4859 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4856 of readline so that IPython can work inside an Emacs buffer.
4860 of readline so that IPython can work inside an Emacs buffer.
4857
4861
4858 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4862 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4859 method signatures (they weren't really bugs, but it looks cleaner
4863 method signatures (they weren't really bugs, but it looks cleaner
4860 and keeps PyChecker happy).
4864 and keeps PyChecker happy).
4861
4865
4862 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4866 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4863 for implementing various user-defined hooks. Currently only
4867 for implementing various user-defined hooks. Currently only
4864 display is done.
4868 display is done.
4865
4869
4866 * IPython/Prompts.py (CachedOutput._display): changed display
4870 * IPython/Prompts.py (CachedOutput._display): changed display
4867 functions so that they can be dynamically changed by users easily.
4871 functions so that they can be dynamically changed by users easily.
4868
4872
4869 * IPython/Extensions/numeric_formats.py (num_display): added an
4873 * IPython/Extensions/numeric_formats.py (num_display): added an
4870 extension for printing NumPy arrays in flexible manners. It
4874 extension for printing NumPy arrays in flexible manners. It
4871 doesn't do anything yet, but all the structure is in
4875 doesn't do anything yet, but all the structure is in
4872 place. Ultimately the plan is to implement output format control
4876 place. Ultimately the plan is to implement output format control
4873 like in Octave.
4877 like in Octave.
4874
4878
4875 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4879 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4876 methods are found at run-time by all the automatic machinery.
4880 methods are found at run-time by all the automatic machinery.
4877
4881
4878 2002-02-17 Fernando Perez <fperez@colorado.edu>
4882 2002-02-17 Fernando Perez <fperez@colorado.edu>
4879
4883
4880 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4884 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4881 whole file a little.
4885 whole file a little.
4882
4886
4883 * ToDo: closed this document. Now there's a new_design.lyx
4887 * ToDo: closed this document. Now there's a new_design.lyx
4884 document for all new ideas. Added making a pdf of it for the
4888 document for all new ideas. Added making a pdf of it for the
4885 end-user distro.
4889 end-user distro.
4886
4890
4887 * IPython/Logger.py (Logger.switch_log): Created this to replace
4891 * IPython/Logger.py (Logger.switch_log): Created this to replace
4888 logon() and logoff(). It also fixes a nasty crash reported by
4892 logon() and logoff(). It also fixes a nasty crash reported by
4889 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4893 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4890
4894
4891 * IPython/iplib.py (complete): got auto-completion to work with
4895 * IPython/iplib.py (complete): got auto-completion to work with
4892 automagic (I had wanted this for a long time).
4896 automagic (I had wanted this for a long time).
4893
4897
4894 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4898 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4895 to @file, since file() is now a builtin and clashes with automagic
4899 to @file, since file() is now a builtin and clashes with automagic
4896 for @file.
4900 for @file.
4897
4901
4898 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4902 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4899 of this was previously in iplib, which had grown to more than 2000
4903 of this was previously in iplib, which had grown to more than 2000
4900 lines, way too long. No new functionality, but it makes managing
4904 lines, way too long. No new functionality, but it makes managing
4901 the code a bit easier.
4905 the code a bit easier.
4902
4906
4903 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4907 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4904 information to crash reports.
4908 information to crash reports.
4905
4909
4906 2002-02-12 Fernando Perez <fperez@colorado.edu>
4910 2002-02-12 Fernando Perez <fperez@colorado.edu>
4907
4911
4908 * Released 0.2.5.
4912 * Released 0.2.5.
4909
4913
4910 2002-02-11 Fernando Perez <fperez@colorado.edu>
4914 2002-02-11 Fernando Perez <fperez@colorado.edu>
4911
4915
4912 * Wrote a relatively complete Windows installer. It puts
4916 * Wrote a relatively complete Windows installer. It puts
4913 everything in place, creates Start Menu entries and fixes the
4917 everything in place, creates Start Menu entries and fixes the
4914 color issues. Nothing fancy, but it works.
4918 color issues. Nothing fancy, but it works.
4915
4919
4916 2002-02-10 Fernando Perez <fperez@colorado.edu>
4920 2002-02-10 Fernando Perez <fperez@colorado.edu>
4917
4921
4918 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4922 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4919 os.path.expanduser() call so that we can type @run ~/myfile.py and
4923 os.path.expanduser() call so that we can type @run ~/myfile.py and
4920 have thigs work as expected.
4924 have thigs work as expected.
4921
4925
4922 * IPython/genutils.py (page): fixed exception handling so things
4926 * IPython/genutils.py (page): fixed exception handling so things
4923 work both in Unix and Windows correctly. Quitting a pager triggers
4927 work both in Unix and Windows correctly. Quitting a pager triggers
4924 an IOError/broken pipe in Unix, and in windows not finding a pager
4928 an IOError/broken pipe in Unix, and in windows not finding a pager
4925 is also an IOError, so I had to actually look at the return value
4929 is also an IOError, so I had to actually look at the return value
4926 of the exception, not just the exception itself. Should be ok now.
4930 of the exception, not just the exception itself. Should be ok now.
4927
4931
4928 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4932 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4929 modified to allow case-insensitive color scheme changes.
4933 modified to allow case-insensitive color scheme changes.
4930
4934
4931 2002-02-09 Fernando Perez <fperez@colorado.edu>
4935 2002-02-09 Fernando Perez <fperez@colorado.edu>
4932
4936
4933 * IPython/genutils.py (native_line_ends): new function to leave
4937 * IPython/genutils.py (native_line_ends): new function to leave
4934 user config files with os-native line-endings.
4938 user config files with os-native line-endings.
4935
4939
4936 * README and manual updates.
4940 * README and manual updates.
4937
4941
4938 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4942 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4939 instead of StringType to catch Unicode strings.
4943 instead of StringType to catch Unicode strings.
4940
4944
4941 * IPython/genutils.py (filefind): fixed bug for paths with
4945 * IPython/genutils.py (filefind): fixed bug for paths with
4942 embedded spaces (very common in Windows).
4946 embedded spaces (very common in Windows).
4943
4947
4944 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4948 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4945 files under Windows, so that they get automatically associated
4949 files under Windows, so that they get automatically associated
4946 with a text editor. Windows makes it a pain to handle
4950 with a text editor. Windows makes it a pain to handle
4947 extension-less files.
4951 extension-less files.
4948
4952
4949 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4953 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4950 warning about readline only occur for Posix. In Windows there's no
4954 warning about readline only occur for Posix. In Windows there's no
4951 way to get readline, so why bother with the warning.
4955 way to get readline, so why bother with the warning.
4952
4956
4953 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4957 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4954 for __str__ instead of dir(self), since dir() changed in 2.2.
4958 for __str__ instead of dir(self), since dir() changed in 2.2.
4955
4959
4956 * Ported to Windows! Tested on XP, I suspect it should work fine
4960 * Ported to Windows! Tested on XP, I suspect it should work fine
4957 on NT/2000, but I don't think it will work on 98 et al. That
4961 on NT/2000, but I don't think it will work on 98 et al. That
4958 series of Windows is such a piece of junk anyway that I won't try
4962 series of Windows is such a piece of junk anyway that I won't try
4959 porting it there. The XP port was straightforward, showed a few
4963 porting it there. The XP port was straightforward, showed a few
4960 bugs here and there (fixed all), in particular some string
4964 bugs here and there (fixed all), in particular some string
4961 handling stuff which required considering Unicode strings (which
4965 handling stuff which required considering Unicode strings (which
4962 Windows uses). This is good, but hasn't been too tested :) No
4966 Windows uses). This is good, but hasn't been too tested :) No
4963 fancy installer yet, I'll put a note in the manual so people at
4967 fancy installer yet, I'll put a note in the manual so people at
4964 least make manually a shortcut.
4968 least make manually a shortcut.
4965
4969
4966 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4970 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4967 into a single one, "colors". This now controls both prompt and
4971 into a single one, "colors". This now controls both prompt and
4968 exception color schemes, and can be changed both at startup
4972 exception color schemes, and can be changed both at startup
4969 (either via command-line switches or via ipythonrc files) and at
4973 (either via command-line switches or via ipythonrc files) and at
4970 runtime, with @colors.
4974 runtime, with @colors.
4971 (Magic.magic_run): renamed @prun to @run and removed the old
4975 (Magic.magic_run): renamed @prun to @run and removed the old
4972 @run. The two were too similar to warrant keeping both.
4976 @run. The two were too similar to warrant keeping both.
4973
4977
4974 2002-02-03 Fernando Perez <fperez@colorado.edu>
4978 2002-02-03 Fernando Perez <fperez@colorado.edu>
4975
4979
4976 * IPython/iplib.py (install_first_time): Added comment on how to
4980 * IPython/iplib.py (install_first_time): Added comment on how to
4977 configure the color options for first-time users. Put a <return>
4981 configure the color options for first-time users. Put a <return>
4978 request at the end so that small-terminal users get a chance to
4982 request at the end so that small-terminal users get a chance to
4979 read the startup info.
4983 read the startup info.
4980
4984
4981 2002-01-23 Fernando Perez <fperez@colorado.edu>
4985 2002-01-23 Fernando Perez <fperez@colorado.edu>
4982
4986
4983 * IPython/iplib.py (CachedOutput.update): Changed output memory
4987 * IPython/iplib.py (CachedOutput.update): Changed output memory
4984 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4988 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4985 input history we still use _i. Did this b/c these variable are
4989 input history we still use _i. Did this b/c these variable are
4986 very commonly used in interactive work, so the less we need to
4990 very commonly used in interactive work, so the less we need to
4987 type the better off we are.
4991 type the better off we are.
4988 (Magic.magic_prun): updated @prun to better handle the namespaces
4992 (Magic.magic_prun): updated @prun to better handle the namespaces
4989 the file will run in, including a fix for __name__ not being set
4993 the file will run in, including a fix for __name__ not being set
4990 before.
4994 before.
4991
4995
4992 2002-01-20 Fernando Perez <fperez@colorado.edu>
4996 2002-01-20 Fernando Perez <fperez@colorado.edu>
4993
4997
4994 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4998 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4995 extra garbage for Python 2.2. Need to look more carefully into
4999 extra garbage for Python 2.2. Need to look more carefully into
4996 this later.
5000 this later.
4997
5001
4998 2002-01-19 Fernando Perez <fperez@colorado.edu>
5002 2002-01-19 Fernando Perez <fperez@colorado.edu>
4999
5003
5000 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5004 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5001 display SyntaxError exceptions properly formatted when they occur
5005 display SyntaxError exceptions properly formatted when they occur
5002 (they can be triggered by imported code).
5006 (they can be triggered by imported code).
5003
5007
5004 2002-01-18 Fernando Perez <fperez@colorado.edu>
5008 2002-01-18 Fernando Perez <fperez@colorado.edu>
5005
5009
5006 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5010 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5007 SyntaxError exceptions are reported nicely formatted, instead of
5011 SyntaxError exceptions are reported nicely formatted, instead of
5008 spitting out only offset information as before.
5012 spitting out only offset information as before.
5009 (Magic.magic_prun): Added the @prun function for executing
5013 (Magic.magic_prun): Added the @prun function for executing
5010 programs with command line args inside IPython.
5014 programs with command line args inside IPython.
5011
5015
5012 2002-01-16 Fernando Perez <fperez@colorado.edu>
5016 2002-01-16 Fernando Perez <fperez@colorado.edu>
5013
5017
5014 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5018 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5015 to *not* include the last item given in a range. This brings their
5019 to *not* include the last item given in a range. This brings their
5016 behavior in line with Python's slicing:
5020 behavior in line with Python's slicing:
5017 a[n1:n2] -> a[n1]...a[n2-1]
5021 a[n1:n2] -> a[n1]...a[n2-1]
5018 It may be a bit less convenient, but I prefer to stick to Python's
5022 It may be a bit less convenient, but I prefer to stick to Python's
5019 conventions *everywhere*, so users never have to wonder.
5023 conventions *everywhere*, so users never have to wonder.
5020 (Magic.magic_macro): Added @macro function to ease the creation of
5024 (Magic.magic_macro): Added @macro function to ease the creation of
5021 macros.
5025 macros.
5022
5026
5023 2002-01-05 Fernando Perez <fperez@colorado.edu>
5027 2002-01-05 Fernando Perez <fperez@colorado.edu>
5024
5028
5025 * Released 0.2.4.
5029 * Released 0.2.4.
5026
5030
5027 * IPython/iplib.py (Magic.magic_pdef):
5031 * IPython/iplib.py (Magic.magic_pdef):
5028 (InteractiveShell.safe_execfile): report magic lines and error
5032 (InteractiveShell.safe_execfile): report magic lines and error
5029 lines without line numbers so one can easily copy/paste them for
5033 lines without line numbers so one can easily copy/paste them for
5030 re-execution.
5034 re-execution.
5031
5035
5032 * Updated manual with recent changes.
5036 * Updated manual with recent changes.
5033
5037
5034 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5038 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5035 docstring printing when class? is called. Very handy for knowing
5039 docstring printing when class? is called. Very handy for knowing
5036 how to create class instances (as long as __init__ is well
5040 how to create class instances (as long as __init__ is well
5037 documented, of course :)
5041 documented, of course :)
5038 (Magic.magic_doc): print both class and constructor docstrings.
5042 (Magic.magic_doc): print both class and constructor docstrings.
5039 (Magic.magic_pdef): give constructor info if passed a class and
5043 (Magic.magic_pdef): give constructor info if passed a class and
5040 __call__ info for callable object instances.
5044 __call__ info for callable object instances.
5041
5045
5042 2002-01-04 Fernando Perez <fperez@colorado.edu>
5046 2002-01-04 Fernando Perez <fperez@colorado.edu>
5043
5047
5044 * Made deep_reload() off by default. It doesn't always work
5048 * Made deep_reload() off by default. It doesn't always work
5045 exactly as intended, so it's probably safer to have it off. It's
5049 exactly as intended, so it's probably safer to have it off. It's
5046 still available as dreload() anyway, so nothing is lost.
5050 still available as dreload() anyway, so nothing is lost.
5047
5051
5048 2002-01-02 Fernando Perez <fperez@colorado.edu>
5052 2002-01-02 Fernando Perez <fperez@colorado.edu>
5049
5053
5050 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5054 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5051 so I wanted an updated release).
5055 so I wanted an updated release).
5052
5056
5053 2001-12-27 Fernando Perez <fperez@colorado.edu>
5057 2001-12-27 Fernando Perez <fperez@colorado.edu>
5054
5058
5055 * IPython/iplib.py (InteractiveShell.interact): Added the original
5059 * IPython/iplib.py (InteractiveShell.interact): Added the original
5056 code from 'code.py' for this module in order to change the
5060 code from 'code.py' for this module in order to change the
5057 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5061 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5058 the history cache would break when the user hit Ctrl-C, and
5062 the history cache would break when the user hit Ctrl-C, and
5059 interact() offers no way to add any hooks to it.
5063 interact() offers no way to add any hooks to it.
5060
5064
5061 2001-12-23 Fernando Perez <fperez@colorado.edu>
5065 2001-12-23 Fernando Perez <fperez@colorado.edu>
5062
5066
5063 * setup.py: added check for 'MANIFEST' before trying to remove
5067 * setup.py: added check for 'MANIFEST' before trying to remove
5064 it. Thanks to Sean Reifschneider.
5068 it. Thanks to Sean Reifschneider.
5065
5069
5066 2001-12-22 Fernando Perez <fperez@colorado.edu>
5070 2001-12-22 Fernando Perez <fperez@colorado.edu>
5067
5071
5068 * Released 0.2.2.
5072 * Released 0.2.2.
5069
5073
5070 * Finished (reasonably) writing the manual. Later will add the
5074 * Finished (reasonably) writing the manual. Later will add the
5071 python-standard navigation stylesheets, but for the time being
5075 python-standard navigation stylesheets, but for the time being
5072 it's fairly complete. Distribution will include html and pdf
5076 it's fairly complete. Distribution will include html and pdf
5073 versions.
5077 versions.
5074
5078
5075 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5079 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5076 (MayaVi author).
5080 (MayaVi author).
5077
5081
5078 2001-12-21 Fernando Perez <fperez@colorado.edu>
5082 2001-12-21 Fernando Perez <fperez@colorado.edu>
5079
5083
5080 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5084 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5081 good public release, I think (with the manual and the distutils
5085 good public release, I think (with the manual and the distutils
5082 installer). The manual can use some work, but that can go
5086 installer). The manual can use some work, but that can go
5083 slowly. Otherwise I think it's quite nice for end users. Next
5087 slowly. Otherwise I think it's quite nice for end users. Next
5084 summer, rewrite the guts of it...
5088 summer, rewrite the guts of it...
5085
5089
5086 * Changed format of ipythonrc files to use whitespace as the
5090 * Changed format of ipythonrc files to use whitespace as the
5087 separator instead of an explicit '='. Cleaner.
5091 separator instead of an explicit '='. Cleaner.
5088
5092
5089 2001-12-20 Fernando Perez <fperez@colorado.edu>
5093 2001-12-20 Fernando Perez <fperez@colorado.edu>
5090
5094
5091 * Started a manual in LyX. For now it's just a quick merge of the
5095 * Started a manual in LyX. For now it's just a quick merge of the
5092 various internal docstrings and READMEs. Later it may grow into a
5096 various internal docstrings and READMEs. Later it may grow into a
5093 nice, full-blown manual.
5097 nice, full-blown manual.
5094
5098
5095 * Set up a distutils based installer. Installation should now be
5099 * Set up a distutils based installer. Installation should now be
5096 trivially simple for end-users.
5100 trivially simple for end-users.
5097
5101
5098 2001-12-11 Fernando Perez <fperez@colorado.edu>
5102 2001-12-11 Fernando Perez <fperez@colorado.edu>
5099
5103
5100 * Released 0.2.0. First public release, announced it at
5104 * Released 0.2.0. First public release, announced it at
5101 comp.lang.python. From now on, just bugfixes...
5105 comp.lang.python. From now on, just bugfixes...
5102
5106
5103 * Went through all the files, set copyright/license notices and
5107 * Went through all the files, set copyright/license notices and
5104 cleaned up things. Ready for release.
5108 cleaned up things. Ready for release.
5105
5109
5106 2001-12-10 Fernando Perez <fperez@colorado.edu>
5110 2001-12-10 Fernando Perez <fperez@colorado.edu>
5107
5111
5108 * Changed the first-time installer not to use tarfiles. It's more
5112 * Changed the first-time installer not to use tarfiles. It's more
5109 robust now and less unix-dependent. Also makes it easier for
5113 robust now and less unix-dependent. Also makes it easier for
5110 people to later upgrade versions.
5114 people to later upgrade versions.
5111
5115
5112 * Changed @exit to @abort to reflect the fact that it's pretty
5116 * Changed @exit to @abort to reflect the fact that it's pretty
5113 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5117 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5114 becomes significant only when IPyhton is embedded: in that case,
5118 becomes significant only when IPyhton is embedded: in that case,
5115 C-D closes IPython only, but @abort kills the enclosing program
5119 C-D closes IPython only, but @abort kills the enclosing program
5116 too (unless it had called IPython inside a try catching
5120 too (unless it had called IPython inside a try catching
5117 SystemExit).
5121 SystemExit).
5118
5122
5119 * Created Shell module which exposes the actuall IPython Shell
5123 * Created Shell module which exposes the actuall IPython Shell
5120 classes, currently the normal and the embeddable one. This at
5124 classes, currently the normal and the embeddable one. This at
5121 least offers a stable interface we won't need to change when
5125 least offers a stable interface we won't need to change when
5122 (later) the internals are rewritten. That rewrite will be confined
5126 (later) the internals are rewritten. That rewrite will be confined
5123 to iplib and ipmaker, but the Shell interface should remain as is.
5127 to iplib and ipmaker, but the Shell interface should remain as is.
5124
5128
5125 * Added embed module which offers an embeddable IPShell object,
5129 * Added embed module which offers an embeddable IPShell object,
5126 useful to fire up IPython *inside* a running program. Great for
5130 useful to fire up IPython *inside* a running program. Great for
5127 debugging or dynamical data analysis.
5131 debugging or dynamical data analysis.
5128
5132
5129 2001-12-08 Fernando Perez <fperez@colorado.edu>
5133 2001-12-08 Fernando Perez <fperez@colorado.edu>
5130
5134
5131 * Fixed small bug preventing seeing info from methods of defined
5135 * Fixed small bug preventing seeing info from methods of defined
5132 objects (incorrect namespace in _ofind()).
5136 objects (incorrect namespace in _ofind()).
5133
5137
5134 * Documentation cleanup. Moved the main usage docstrings to a
5138 * Documentation cleanup. Moved the main usage docstrings to a
5135 separate file, usage.py (cleaner to maintain, and hopefully in the
5139 separate file, usage.py (cleaner to maintain, and hopefully in the
5136 future some perlpod-like way of producing interactive, man and
5140 future some perlpod-like way of producing interactive, man and
5137 html docs out of it will be found).
5141 html docs out of it will be found).
5138
5142
5139 * Added @profile to see your profile at any time.
5143 * Added @profile to see your profile at any time.
5140
5144
5141 * Added @p as an alias for 'print'. It's especially convenient if
5145 * Added @p as an alias for 'print'. It's especially convenient if
5142 using automagic ('p x' prints x).
5146 using automagic ('p x' prints x).
5143
5147
5144 * Small cleanups and fixes after a pychecker run.
5148 * Small cleanups and fixes after a pychecker run.
5145
5149
5146 * Changed the @cd command to handle @cd - and @cd -<n> for
5150 * Changed the @cd command to handle @cd - and @cd -<n> for
5147 visiting any directory in _dh.
5151 visiting any directory in _dh.
5148
5152
5149 * Introduced _dh, a history of visited directories. @dhist prints
5153 * Introduced _dh, a history of visited directories. @dhist prints
5150 it out with numbers.
5154 it out with numbers.
5151
5155
5152 2001-12-07 Fernando Perez <fperez@colorado.edu>
5156 2001-12-07 Fernando Perez <fperez@colorado.edu>
5153
5157
5154 * Released 0.1.22
5158 * Released 0.1.22
5155
5159
5156 * Made initialization a bit more robust against invalid color
5160 * Made initialization a bit more robust against invalid color
5157 options in user input (exit, not traceback-crash).
5161 options in user input (exit, not traceback-crash).
5158
5162
5159 * Changed the bug crash reporter to write the report only in the
5163 * Changed the bug crash reporter to write the report only in the
5160 user's .ipython directory. That way IPython won't litter people's
5164 user's .ipython directory. That way IPython won't litter people's
5161 hard disks with crash files all over the place. Also print on
5165 hard disks with crash files all over the place. Also print on
5162 screen the necessary mail command.
5166 screen the necessary mail command.
5163
5167
5164 * With the new ultraTB, implemented LightBG color scheme for light
5168 * With the new ultraTB, implemented LightBG color scheme for light
5165 background terminals. A lot of people like white backgrounds, so I
5169 background terminals. A lot of people like white backgrounds, so I
5166 guess we should at least give them something readable.
5170 guess we should at least give them something readable.
5167
5171
5168 2001-12-06 Fernando Perez <fperez@colorado.edu>
5172 2001-12-06 Fernando Perez <fperez@colorado.edu>
5169
5173
5170 * Modified the structure of ultraTB. Now there's a proper class
5174 * Modified the structure of ultraTB. Now there's a proper class
5171 for tables of color schemes which allow adding schemes easily and
5175 for tables of color schemes which allow adding schemes easily and
5172 switching the active scheme without creating a new instance every
5176 switching the active scheme without creating a new instance every
5173 time (which was ridiculous). The syntax for creating new schemes
5177 time (which was ridiculous). The syntax for creating new schemes
5174 is also cleaner. I think ultraTB is finally done, with a clean
5178 is also cleaner. I think ultraTB is finally done, with a clean
5175 class structure. Names are also much cleaner (now there's proper
5179 class structure. Names are also much cleaner (now there's proper
5176 color tables, no need for every variable to also have 'color' in
5180 color tables, no need for every variable to also have 'color' in
5177 its name).
5181 its name).
5178
5182
5179 * Broke down genutils into separate files. Now genutils only
5183 * Broke down genutils into separate files. Now genutils only
5180 contains utility functions, and classes have been moved to their
5184 contains utility functions, and classes have been moved to their
5181 own files (they had enough independent functionality to warrant
5185 own files (they had enough independent functionality to warrant
5182 it): ConfigLoader, OutputTrap, Struct.
5186 it): ConfigLoader, OutputTrap, Struct.
5183
5187
5184 2001-12-05 Fernando Perez <fperez@colorado.edu>
5188 2001-12-05 Fernando Perez <fperez@colorado.edu>
5185
5189
5186 * IPython turns 21! Released version 0.1.21, as a candidate for
5190 * IPython turns 21! Released version 0.1.21, as a candidate for
5187 public consumption. If all goes well, release in a few days.
5191 public consumption. If all goes well, release in a few days.
5188
5192
5189 * Fixed path bug (files in Extensions/ directory wouldn't be found
5193 * Fixed path bug (files in Extensions/ directory wouldn't be found
5190 unless IPython/ was explicitly in sys.path).
5194 unless IPython/ was explicitly in sys.path).
5191
5195
5192 * Extended the FlexCompleter class as MagicCompleter to allow
5196 * Extended the FlexCompleter class as MagicCompleter to allow
5193 completion of @-starting lines.
5197 completion of @-starting lines.
5194
5198
5195 * Created __release__.py file as a central repository for release
5199 * Created __release__.py file as a central repository for release
5196 info that other files can read from.
5200 info that other files can read from.
5197
5201
5198 * Fixed small bug in logging: when logging was turned on in
5202 * Fixed small bug in logging: when logging was turned on in
5199 mid-session, old lines with special meanings (!@?) were being
5203 mid-session, old lines with special meanings (!@?) were being
5200 logged without the prepended comment, which is necessary since
5204 logged without the prepended comment, which is necessary since
5201 they are not truly valid python syntax. This should make session
5205 they are not truly valid python syntax. This should make session
5202 restores produce less errors.
5206 restores produce less errors.
5203
5207
5204 * The namespace cleanup forced me to make a FlexCompleter class
5208 * The namespace cleanup forced me to make a FlexCompleter class
5205 which is nothing but a ripoff of rlcompleter, but with selectable
5209 which is nothing but a ripoff of rlcompleter, but with selectable
5206 namespace (rlcompleter only works in __main__.__dict__). I'll try
5210 namespace (rlcompleter only works in __main__.__dict__). I'll try
5207 to submit a note to the authors to see if this change can be
5211 to submit a note to the authors to see if this change can be
5208 incorporated in future rlcompleter releases (Dec.6: done)
5212 incorporated in future rlcompleter releases (Dec.6: done)
5209
5213
5210 * More fixes to namespace handling. It was a mess! Now all
5214 * More fixes to namespace handling. It was a mess! Now all
5211 explicit references to __main__.__dict__ are gone (except when
5215 explicit references to __main__.__dict__ are gone (except when
5212 really needed) and everything is handled through the namespace
5216 really needed) and everything is handled through the namespace
5213 dicts in the IPython instance. We seem to be getting somewhere
5217 dicts in the IPython instance. We seem to be getting somewhere
5214 with this, finally...
5218 with this, finally...
5215
5219
5216 * Small documentation updates.
5220 * Small documentation updates.
5217
5221
5218 * Created the Extensions directory under IPython (with an
5222 * Created the Extensions directory under IPython (with an
5219 __init__.py). Put the PhysicalQ stuff there. This directory should
5223 __init__.py). Put the PhysicalQ stuff there. This directory should
5220 be used for all special-purpose extensions.
5224 be used for all special-purpose extensions.
5221
5225
5222 * File renaming:
5226 * File renaming:
5223 ipythonlib --> ipmaker
5227 ipythonlib --> ipmaker
5224 ipplib --> iplib
5228 ipplib --> iplib
5225 This makes a bit more sense in terms of what these files actually do.
5229 This makes a bit more sense in terms of what these files actually do.
5226
5230
5227 * Moved all the classes and functions in ipythonlib to ipplib, so
5231 * Moved all the classes and functions in ipythonlib to ipplib, so
5228 now ipythonlib only has make_IPython(). This will ease up its
5232 now ipythonlib only has make_IPython(). This will ease up its
5229 splitting in smaller functional chunks later.
5233 splitting in smaller functional chunks later.
5230
5234
5231 * Cleaned up (done, I think) output of @whos. Better column
5235 * Cleaned up (done, I think) output of @whos. Better column
5232 formatting, and now shows str(var) for as much as it can, which is
5236 formatting, and now shows str(var) for as much as it can, which is
5233 typically what one gets with a 'print var'.
5237 typically what one gets with a 'print var'.
5234
5238
5235 2001-12-04 Fernando Perez <fperez@colorado.edu>
5239 2001-12-04 Fernando Perez <fperez@colorado.edu>
5236
5240
5237 * Fixed namespace problems. Now builtin/IPyhton/user names get
5241 * Fixed namespace problems. Now builtin/IPyhton/user names get
5238 properly reported in their namespace. Internal namespace handling
5242 properly reported in their namespace. Internal namespace handling
5239 is finally getting decent (not perfect yet, but much better than
5243 is finally getting decent (not perfect yet, but much better than
5240 the ad-hoc mess we had).
5244 the ad-hoc mess we had).
5241
5245
5242 * Removed -exit option. If people just want to run a python
5246 * Removed -exit option. If people just want to run a python
5243 script, that's what the normal interpreter is for. Less
5247 script, that's what the normal interpreter is for. Less
5244 unnecessary options, less chances for bugs.
5248 unnecessary options, less chances for bugs.
5245
5249
5246 * Added a crash handler which generates a complete post-mortem if
5250 * Added a crash handler which generates a complete post-mortem if
5247 IPython crashes. This will help a lot in tracking bugs down the
5251 IPython crashes. This will help a lot in tracking bugs down the
5248 road.
5252 road.
5249
5253
5250 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5254 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5251 which were boud to functions being reassigned would bypass the
5255 which were boud to functions being reassigned would bypass the
5252 logger, breaking the sync of _il with the prompt counter. This
5256 logger, breaking the sync of _il with the prompt counter. This
5253 would then crash IPython later when a new line was logged.
5257 would then crash IPython later when a new line was logged.
5254
5258
5255 2001-12-02 Fernando Perez <fperez@colorado.edu>
5259 2001-12-02 Fernando Perez <fperez@colorado.edu>
5256
5260
5257 * Made IPython a package. This means people don't have to clutter
5261 * Made IPython a package. This means people don't have to clutter
5258 their sys.path with yet another directory. Changed the INSTALL
5262 their sys.path with yet another directory. Changed the INSTALL
5259 file accordingly.
5263 file accordingly.
5260
5264
5261 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5265 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5262 sorts its output (so @who shows it sorted) and @whos formats the
5266 sorts its output (so @who shows it sorted) and @whos formats the
5263 table according to the width of the first column. Nicer, easier to
5267 table according to the width of the first column. Nicer, easier to
5264 read. Todo: write a generic table_format() which takes a list of
5268 read. Todo: write a generic table_format() which takes a list of
5265 lists and prints it nicely formatted, with optional row/column
5269 lists and prints it nicely formatted, with optional row/column
5266 separators and proper padding and justification.
5270 separators and proper padding and justification.
5267
5271
5268 * Released 0.1.20
5272 * Released 0.1.20
5269
5273
5270 * Fixed bug in @log which would reverse the inputcache list (a
5274 * Fixed bug in @log which would reverse the inputcache list (a
5271 copy operation was missing).
5275 copy operation was missing).
5272
5276
5273 * Code cleanup. @config was changed to use page(). Better, since
5277 * Code cleanup. @config was changed to use page(). Better, since
5274 its output is always quite long.
5278 its output is always quite long.
5275
5279
5276 * Itpl is back as a dependency. I was having too many problems
5280 * Itpl is back as a dependency. I was having too many problems
5277 getting the parametric aliases to work reliably, and it's just
5281 getting the parametric aliases to work reliably, and it's just
5278 easier to code weird string operations with it than playing %()s
5282 easier to code weird string operations with it than playing %()s
5279 games. It's only ~6k, so I don't think it's too big a deal.
5283 games. It's only ~6k, so I don't think it's too big a deal.
5280
5284
5281 * Found (and fixed) a very nasty bug with history. !lines weren't
5285 * Found (and fixed) a very nasty bug with history. !lines weren't
5282 getting cached, and the out of sync caches would crash
5286 getting cached, and the out of sync caches would crash
5283 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5287 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5284 division of labor a bit better. Bug fixed, cleaner structure.
5288 division of labor a bit better. Bug fixed, cleaner structure.
5285
5289
5286 2001-12-01 Fernando Perez <fperez@colorado.edu>
5290 2001-12-01 Fernando Perez <fperez@colorado.edu>
5287
5291
5288 * Released 0.1.19
5292 * Released 0.1.19
5289
5293
5290 * Added option -n to @hist to prevent line number printing. Much
5294 * Added option -n to @hist to prevent line number printing. Much
5291 easier to copy/paste code this way.
5295 easier to copy/paste code this way.
5292
5296
5293 * Created global _il to hold the input list. Allows easy
5297 * Created global _il to hold the input list. Allows easy
5294 re-execution of blocks of code by slicing it (inspired by Janko's
5298 re-execution of blocks of code by slicing it (inspired by Janko's
5295 comment on 'macros').
5299 comment on 'macros').
5296
5300
5297 * Small fixes and doc updates.
5301 * Small fixes and doc updates.
5298
5302
5299 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5303 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5300 much too fragile with automagic. Handles properly multi-line
5304 much too fragile with automagic. Handles properly multi-line
5301 statements and takes parameters.
5305 statements and takes parameters.
5302
5306
5303 2001-11-30 Fernando Perez <fperez@colorado.edu>
5307 2001-11-30 Fernando Perez <fperez@colorado.edu>
5304
5308
5305 * Version 0.1.18 released.
5309 * Version 0.1.18 released.
5306
5310
5307 * Fixed nasty namespace bug in initial module imports.
5311 * Fixed nasty namespace bug in initial module imports.
5308
5312
5309 * Added copyright/license notes to all code files (except
5313 * Added copyright/license notes to all code files (except
5310 DPyGetOpt). For the time being, LGPL. That could change.
5314 DPyGetOpt). For the time being, LGPL. That could change.
5311
5315
5312 * Rewrote a much nicer README, updated INSTALL, cleaned up
5316 * Rewrote a much nicer README, updated INSTALL, cleaned up
5313 ipythonrc-* samples.
5317 ipythonrc-* samples.
5314
5318
5315 * Overall code/documentation cleanup. Basically ready for
5319 * Overall code/documentation cleanup. Basically ready for
5316 release. Only remaining thing: licence decision (LGPL?).
5320 release. Only remaining thing: licence decision (LGPL?).
5317
5321
5318 * Converted load_config to a class, ConfigLoader. Now recursion
5322 * Converted load_config to a class, ConfigLoader. Now recursion
5319 control is better organized. Doesn't include the same file twice.
5323 control is better organized. Doesn't include the same file twice.
5320
5324
5321 2001-11-29 Fernando Perez <fperez@colorado.edu>
5325 2001-11-29 Fernando Perez <fperez@colorado.edu>
5322
5326
5323 * Got input history working. Changed output history variables from
5327 * Got input history working. Changed output history variables from
5324 _p to _o so that _i is for input and _o for output. Just cleaner
5328 _p to _o so that _i is for input and _o for output. Just cleaner
5325 convention.
5329 convention.
5326
5330
5327 * Implemented parametric aliases. This pretty much allows the
5331 * Implemented parametric aliases. This pretty much allows the
5328 alias system to offer full-blown shell convenience, I think.
5332 alias system to offer full-blown shell convenience, I think.
5329
5333
5330 * Version 0.1.17 released, 0.1.18 opened.
5334 * Version 0.1.17 released, 0.1.18 opened.
5331
5335
5332 * dot_ipython/ipythonrc (alias): added documentation.
5336 * dot_ipython/ipythonrc (alias): added documentation.
5333 (xcolor): Fixed small bug (xcolors -> xcolor)
5337 (xcolor): Fixed small bug (xcolors -> xcolor)
5334
5338
5335 * Changed the alias system. Now alias is a magic command to define
5339 * Changed the alias system. Now alias is a magic command to define
5336 aliases just like the shell. Rationale: the builtin magics should
5340 aliases just like the shell. Rationale: the builtin magics should
5337 be there for things deeply connected to IPython's
5341 be there for things deeply connected to IPython's
5338 architecture. And this is a much lighter system for what I think
5342 architecture. And this is a much lighter system for what I think
5339 is the really important feature: allowing users to define quickly
5343 is the really important feature: allowing users to define quickly
5340 magics that will do shell things for them, so they can customize
5344 magics that will do shell things for them, so they can customize
5341 IPython easily to match their work habits. If someone is really
5345 IPython easily to match their work habits. If someone is really
5342 desperate to have another name for a builtin alias, they can
5346 desperate to have another name for a builtin alias, they can
5343 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5347 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5344 works.
5348 works.
5345
5349
5346 2001-11-28 Fernando Perez <fperez@colorado.edu>
5350 2001-11-28 Fernando Perez <fperez@colorado.edu>
5347
5351
5348 * Changed @file so that it opens the source file at the proper
5352 * Changed @file so that it opens the source file at the proper
5349 line. Since it uses less, if your EDITOR environment is
5353 line. Since it uses less, if your EDITOR environment is
5350 configured, typing v will immediately open your editor of choice
5354 configured, typing v will immediately open your editor of choice
5351 right at the line where the object is defined. Not as quick as
5355 right at the line where the object is defined. Not as quick as
5352 having a direct @edit command, but for all intents and purposes it
5356 having a direct @edit command, but for all intents and purposes it
5353 works. And I don't have to worry about writing @edit to deal with
5357 works. And I don't have to worry about writing @edit to deal with
5354 all the editors, less does that.
5358 all the editors, less does that.
5355
5359
5356 * Version 0.1.16 released, 0.1.17 opened.
5360 * Version 0.1.16 released, 0.1.17 opened.
5357
5361
5358 * Fixed some nasty bugs in the page/page_dumb combo that could
5362 * Fixed some nasty bugs in the page/page_dumb combo that could
5359 crash IPython.
5363 crash IPython.
5360
5364
5361 2001-11-27 Fernando Perez <fperez@colorado.edu>
5365 2001-11-27 Fernando Perez <fperez@colorado.edu>
5362
5366
5363 * Version 0.1.15 released, 0.1.16 opened.
5367 * Version 0.1.15 released, 0.1.16 opened.
5364
5368
5365 * Finally got ? and ?? to work for undefined things: now it's
5369 * Finally got ? and ?? to work for undefined things: now it's
5366 possible to type {}.get? and get information about the get method
5370 possible to type {}.get? and get information about the get method
5367 of dicts, or os.path? even if only os is defined (so technically
5371 of dicts, or os.path? even if only os is defined (so technically
5368 os.path isn't). Works at any level. For example, after import os,
5372 os.path isn't). Works at any level. For example, after import os,
5369 os?, os.path?, os.path.abspath? all work. This is great, took some
5373 os?, os.path?, os.path.abspath? all work. This is great, took some
5370 work in _ofind.
5374 work in _ofind.
5371
5375
5372 * Fixed more bugs with logging. The sanest way to do it was to add
5376 * Fixed more bugs with logging. The sanest way to do it was to add
5373 to @log a 'mode' parameter. Killed two in one shot (this mode
5377 to @log a 'mode' parameter. Killed two in one shot (this mode
5374 option was a request of Janko's). I think it's finally clean
5378 option was a request of Janko's). I think it's finally clean
5375 (famous last words).
5379 (famous last words).
5376
5380
5377 * Added a page_dumb() pager which does a decent job of paging on
5381 * Added a page_dumb() pager which does a decent job of paging on
5378 screen, if better things (like less) aren't available. One less
5382 screen, if better things (like less) aren't available. One less
5379 unix dependency (someday maybe somebody will port this to
5383 unix dependency (someday maybe somebody will port this to
5380 windows).
5384 windows).
5381
5385
5382 * Fixed problem in magic_log: would lock of logging out if log
5386 * Fixed problem in magic_log: would lock of logging out if log
5383 creation failed (because it would still think it had succeeded).
5387 creation failed (because it would still think it had succeeded).
5384
5388
5385 * Improved the page() function using curses to auto-detect screen
5389 * Improved the page() function using curses to auto-detect screen
5386 size. Now it can make a much better decision on whether to print
5390 size. Now it can make a much better decision on whether to print
5387 or page a string. Option screen_length was modified: a value 0
5391 or page a string. Option screen_length was modified: a value 0
5388 means auto-detect, and that's the default now.
5392 means auto-detect, and that's the default now.
5389
5393
5390 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5394 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5391 go out. I'll test it for a few days, then talk to Janko about
5395 go out. I'll test it for a few days, then talk to Janko about
5392 licences and announce it.
5396 licences and announce it.
5393
5397
5394 * Fixed the length of the auto-generated ---> prompt which appears
5398 * Fixed the length of the auto-generated ---> prompt which appears
5395 for auto-parens and auto-quotes. Getting this right isn't trivial,
5399 for auto-parens and auto-quotes. Getting this right isn't trivial,
5396 with all the color escapes, different prompt types and optional
5400 with all the color escapes, different prompt types and optional
5397 separators. But it seems to be working in all the combinations.
5401 separators. But it seems to be working in all the combinations.
5398
5402
5399 2001-11-26 Fernando Perez <fperez@colorado.edu>
5403 2001-11-26 Fernando Perez <fperez@colorado.edu>
5400
5404
5401 * Wrote a regexp filter to get option types from the option names
5405 * Wrote a regexp filter to get option types from the option names
5402 string. This eliminates the need to manually keep two duplicate
5406 string. This eliminates the need to manually keep two duplicate
5403 lists.
5407 lists.
5404
5408
5405 * Removed the unneeded check_option_names. Now options are handled
5409 * Removed the unneeded check_option_names. Now options are handled
5406 in a much saner manner and it's easy to visually check that things
5410 in a much saner manner and it's easy to visually check that things
5407 are ok.
5411 are ok.
5408
5412
5409 * Updated version numbers on all files I modified to carry a
5413 * Updated version numbers on all files I modified to carry a
5410 notice so Janko and Nathan have clear version markers.
5414 notice so Janko and Nathan have clear version markers.
5411
5415
5412 * Updated docstring for ultraTB with my changes. I should send
5416 * Updated docstring for ultraTB with my changes. I should send
5413 this to Nathan.
5417 this to Nathan.
5414
5418
5415 * Lots of small fixes. Ran everything through pychecker again.
5419 * Lots of small fixes. Ran everything through pychecker again.
5416
5420
5417 * Made loading of deep_reload an cmd line option. If it's not too
5421 * Made loading of deep_reload an cmd line option. If it's not too
5418 kosher, now people can just disable it. With -nodeep_reload it's
5422 kosher, now people can just disable it. With -nodeep_reload it's
5419 still available as dreload(), it just won't overwrite reload().
5423 still available as dreload(), it just won't overwrite reload().
5420
5424
5421 * Moved many options to the no| form (-opt and -noopt
5425 * Moved many options to the no| form (-opt and -noopt
5422 accepted). Cleaner.
5426 accepted). Cleaner.
5423
5427
5424 * Changed magic_log so that if called with no parameters, it uses
5428 * Changed magic_log so that if called with no parameters, it uses
5425 'rotate' mode. That way auto-generated logs aren't automatically
5429 'rotate' mode. That way auto-generated logs aren't automatically
5426 over-written. For normal logs, now a backup is made if it exists
5430 over-written. For normal logs, now a backup is made if it exists
5427 (only 1 level of backups). A new 'backup' mode was added to the
5431 (only 1 level of backups). A new 'backup' mode was added to the
5428 Logger class to support this. This was a request by Janko.
5432 Logger class to support this. This was a request by Janko.
5429
5433
5430 * Added @logoff/@logon to stop/restart an active log.
5434 * Added @logoff/@logon to stop/restart an active log.
5431
5435
5432 * Fixed a lot of bugs in log saving/replay. It was pretty
5436 * Fixed a lot of bugs in log saving/replay. It was pretty
5433 broken. Now special lines (!@,/) appear properly in the command
5437 broken. Now special lines (!@,/) appear properly in the command
5434 history after a log replay.
5438 history after a log replay.
5435
5439
5436 * Tried and failed to implement full session saving via pickle. My
5440 * Tried and failed to implement full session saving via pickle. My
5437 idea was to pickle __main__.__dict__, but modules can't be
5441 idea was to pickle __main__.__dict__, but modules can't be
5438 pickled. This would be a better alternative to replaying logs, but
5442 pickled. This would be a better alternative to replaying logs, but
5439 seems quite tricky to get to work. Changed -session to be called
5443 seems quite tricky to get to work. Changed -session to be called
5440 -logplay, which more accurately reflects what it does. And if we
5444 -logplay, which more accurately reflects what it does. And if we
5441 ever get real session saving working, -session is now available.
5445 ever get real session saving working, -session is now available.
5442
5446
5443 * Implemented color schemes for prompts also. As for tracebacks,
5447 * Implemented color schemes for prompts also. As for tracebacks,
5444 currently only NoColor and Linux are supported. But now the
5448 currently only NoColor and Linux are supported. But now the
5445 infrastructure is in place, based on a generic ColorScheme
5449 infrastructure is in place, based on a generic ColorScheme
5446 class. So writing and activating new schemes both for the prompts
5450 class. So writing and activating new schemes both for the prompts
5447 and the tracebacks should be straightforward.
5451 and the tracebacks should be straightforward.
5448
5452
5449 * Version 0.1.13 released, 0.1.14 opened.
5453 * Version 0.1.13 released, 0.1.14 opened.
5450
5454
5451 * Changed handling of options for output cache. Now counter is
5455 * Changed handling of options for output cache. Now counter is
5452 hardwired starting at 1 and one specifies the maximum number of
5456 hardwired starting at 1 and one specifies the maximum number of
5453 entries *in the outcache* (not the max prompt counter). This is
5457 entries *in the outcache* (not the max prompt counter). This is
5454 much better, since many statements won't increase the cache
5458 much better, since many statements won't increase the cache
5455 count. It also eliminated some confusing options, now there's only
5459 count. It also eliminated some confusing options, now there's only
5456 one: cache_size.
5460 one: cache_size.
5457
5461
5458 * Added 'alias' magic function and magic_alias option in the
5462 * Added 'alias' magic function and magic_alias option in the
5459 ipythonrc file. Now the user can easily define whatever names he
5463 ipythonrc file. Now the user can easily define whatever names he
5460 wants for the magic functions without having to play weird
5464 wants for the magic functions without having to play weird
5461 namespace games. This gives IPython a real shell-like feel.
5465 namespace games. This gives IPython a real shell-like feel.
5462
5466
5463 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5467 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5464 @ or not).
5468 @ or not).
5465
5469
5466 This was one of the last remaining 'visible' bugs (that I know
5470 This was one of the last remaining 'visible' bugs (that I know
5467 of). I think if I can clean up the session loading so it works
5471 of). I think if I can clean up the session loading so it works
5468 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5472 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5469 about licensing).
5473 about licensing).
5470
5474
5471 2001-11-25 Fernando Perez <fperez@colorado.edu>
5475 2001-11-25 Fernando Perez <fperez@colorado.edu>
5472
5476
5473 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5477 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5474 there's a cleaner distinction between what ? and ?? show.
5478 there's a cleaner distinction between what ? and ?? show.
5475
5479
5476 * Added screen_length option. Now the user can define his own
5480 * Added screen_length option. Now the user can define his own
5477 screen size for page() operations.
5481 screen size for page() operations.
5478
5482
5479 * Implemented magic shell-like functions with automatic code
5483 * Implemented magic shell-like functions with automatic code
5480 generation. Now adding another function is just a matter of adding
5484 generation. Now adding another function is just a matter of adding
5481 an entry to a dict, and the function is dynamically generated at
5485 an entry to a dict, and the function is dynamically generated at
5482 run-time. Python has some really cool features!
5486 run-time. Python has some really cool features!
5483
5487
5484 * Renamed many options to cleanup conventions a little. Now all
5488 * Renamed many options to cleanup conventions a little. Now all
5485 are lowercase, and only underscores where needed. Also in the code
5489 are lowercase, and only underscores where needed. Also in the code
5486 option name tables are clearer.
5490 option name tables are clearer.
5487
5491
5488 * Changed prompts a little. Now input is 'In [n]:' instead of
5492 * Changed prompts a little. Now input is 'In [n]:' instead of
5489 'In[n]:='. This allows it the numbers to be aligned with the
5493 'In[n]:='. This allows it the numbers to be aligned with the
5490 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5494 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5491 Python (it was a Mathematica thing). The '...' continuation prompt
5495 Python (it was a Mathematica thing). The '...' continuation prompt
5492 was also changed a little to align better.
5496 was also changed a little to align better.
5493
5497
5494 * Fixed bug when flushing output cache. Not all _p<n> variables
5498 * Fixed bug when flushing output cache. Not all _p<n> variables
5495 exist, so their deletion needs to be wrapped in a try:
5499 exist, so their deletion needs to be wrapped in a try:
5496
5500
5497 * Figured out how to properly use inspect.formatargspec() (it
5501 * Figured out how to properly use inspect.formatargspec() (it
5498 requires the args preceded by *). So I removed all the code from
5502 requires the args preceded by *). So I removed all the code from
5499 _get_pdef in Magic, which was just replicating that.
5503 _get_pdef in Magic, which was just replicating that.
5500
5504
5501 * Added test to prefilter to allow redefining magic function names
5505 * Added test to prefilter to allow redefining magic function names
5502 as variables. This is ok, since the @ form is always available,
5506 as variables. This is ok, since the @ form is always available,
5503 but whe should allow the user to define a variable called 'ls' if
5507 but whe should allow the user to define a variable called 'ls' if
5504 he needs it.
5508 he needs it.
5505
5509
5506 * Moved the ToDo information from README into a separate ToDo.
5510 * Moved the ToDo information from README into a separate ToDo.
5507
5511
5508 * General code cleanup and small bugfixes. I think it's close to a
5512 * General code cleanup and small bugfixes. I think it's close to a
5509 state where it can be released, obviously with a big 'beta'
5513 state where it can be released, obviously with a big 'beta'
5510 warning on it.
5514 warning on it.
5511
5515
5512 * Got the magic function split to work. Now all magics are defined
5516 * Got the magic function split to work. Now all magics are defined
5513 in a separate class. It just organizes things a bit, and now
5517 in a separate class. It just organizes things a bit, and now
5514 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5518 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5515 was too long).
5519 was too long).
5516
5520
5517 * Changed @clear to @reset to avoid potential confusions with
5521 * Changed @clear to @reset to avoid potential confusions with
5518 the shell command clear. Also renamed @cl to @clear, which does
5522 the shell command clear. Also renamed @cl to @clear, which does
5519 exactly what people expect it to from their shell experience.
5523 exactly what people expect it to from their shell experience.
5520
5524
5521 Added a check to the @reset command (since it's so
5525 Added a check to the @reset command (since it's so
5522 destructive, it's probably a good idea to ask for confirmation).
5526 destructive, it's probably a good idea to ask for confirmation).
5523 But now reset only works for full namespace resetting. Since the
5527 But now reset only works for full namespace resetting. Since the
5524 del keyword is already there for deleting a few specific
5528 del keyword is already there for deleting a few specific
5525 variables, I don't see the point of having a redundant magic
5529 variables, I don't see the point of having a redundant magic
5526 function for the same task.
5530 function for the same task.
5527
5531
5528 2001-11-24 Fernando Perez <fperez@colorado.edu>
5532 2001-11-24 Fernando Perez <fperez@colorado.edu>
5529
5533
5530 * Updated the builtin docs (esp. the ? ones).
5534 * Updated the builtin docs (esp. the ? ones).
5531
5535
5532 * Ran all the code through pychecker. Not terribly impressed with
5536 * Ran all the code through pychecker. Not terribly impressed with
5533 it: lots of spurious warnings and didn't really find anything of
5537 it: lots of spurious warnings and didn't really find anything of
5534 substance (just a few modules being imported and not used).
5538 substance (just a few modules being imported and not used).
5535
5539
5536 * Implemented the new ultraTB functionality into IPython. New
5540 * Implemented the new ultraTB functionality into IPython. New
5537 option: xcolors. This chooses color scheme. xmode now only selects
5541 option: xcolors. This chooses color scheme. xmode now only selects
5538 between Plain and Verbose. Better orthogonality.
5542 between Plain and Verbose. Better orthogonality.
5539
5543
5540 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5544 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5541 mode and color scheme for the exception handlers. Now it's
5545 mode and color scheme for the exception handlers. Now it's
5542 possible to have the verbose traceback with no coloring.
5546 possible to have the verbose traceback with no coloring.
5543
5547
5544 2001-11-23 Fernando Perez <fperez@colorado.edu>
5548 2001-11-23 Fernando Perez <fperez@colorado.edu>
5545
5549
5546 * Version 0.1.12 released, 0.1.13 opened.
5550 * Version 0.1.12 released, 0.1.13 opened.
5547
5551
5548 * Removed option to set auto-quote and auto-paren escapes by
5552 * Removed option to set auto-quote and auto-paren escapes by
5549 user. The chances of breaking valid syntax are just too high. If
5553 user. The chances of breaking valid syntax are just too high. If
5550 someone *really* wants, they can always dig into the code.
5554 someone *really* wants, they can always dig into the code.
5551
5555
5552 * Made prompt separators configurable.
5556 * Made prompt separators configurable.
5553
5557
5554 2001-11-22 Fernando Perez <fperez@colorado.edu>
5558 2001-11-22 Fernando Perez <fperez@colorado.edu>
5555
5559
5556 * Small bugfixes in many places.
5560 * Small bugfixes in many places.
5557
5561
5558 * Removed the MyCompleter class from ipplib. It seemed redundant
5562 * Removed the MyCompleter class from ipplib. It seemed redundant
5559 with the C-p,C-n history search functionality. Less code to
5563 with the C-p,C-n history search functionality. Less code to
5560 maintain.
5564 maintain.
5561
5565
5562 * Moved all the original ipython.py code into ipythonlib.py. Right
5566 * Moved all the original ipython.py code into ipythonlib.py. Right
5563 now it's just one big dump into a function called make_IPython, so
5567 now it's just one big dump into a function called make_IPython, so
5564 no real modularity has been gained. But at least it makes the
5568 no real modularity has been gained. But at least it makes the
5565 wrapper script tiny, and since ipythonlib is a module, it gets
5569 wrapper script tiny, and since ipythonlib is a module, it gets
5566 compiled and startup is much faster.
5570 compiled and startup is much faster.
5567
5571
5568 This is a reasobably 'deep' change, so we should test it for a
5572 This is a reasobably 'deep' change, so we should test it for a
5569 while without messing too much more with the code.
5573 while without messing too much more with the code.
5570
5574
5571 2001-11-21 Fernando Perez <fperez@colorado.edu>
5575 2001-11-21 Fernando Perez <fperez@colorado.edu>
5572
5576
5573 * Version 0.1.11 released, 0.1.12 opened for further work.
5577 * Version 0.1.11 released, 0.1.12 opened for further work.
5574
5578
5575 * Removed dependency on Itpl. It was only needed in one place. It
5579 * Removed dependency on Itpl. It was only needed in one place. It
5576 would be nice if this became part of python, though. It makes life
5580 would be nice if this became part of python, though. It makes life
5577 *a lot* easier in some cases.
5581 *a lot* easier in some cases.
5578
5582
5579 * Simplified the prefilter code a bit. Now all handlers are
5583 * Simplified the prefilter code a bit. Now all handlers are
5580 expected to explicitly return a value (at least a blank string).
5584 expected to explicitly return a value (at least a blank string).
5581
5585
5582 * Heavy edits in ipplib. Removed the help system altogether. Now
5586 * Heavy edits in ipplib. Removed the help system altogether. Now
5583 obj?/?? is used for inspecting objects, a magic @doc prints
5587 obj?/?? is used for inspecting objects, a magic @doc prints
5584 docstrings, and full-blown Python help is accessed via the 'help'
5588 docstrings, and full-blown Python help is accessed via the 'help'
5585 keyword. This cleans up a lot of code (less to maintain) and does
5589 keyword. This cleans up a lot of code (less to maintain) and does
5586 the job. Since 'help' is now a standard Python component, might as
5590 the job. Since 'help' is now a standard Python component, might as
5587 well use it and remove duplicate functionality.
5591 well use it and remove duplicate functionality.
5588
5592
5589 Also removed the option to use ipplib as a standalone program. By
5593 Also removed the option to use ipplib as a standalone program. By
5590 now it's too dependent on other parts of IPython to function alone.
5594 now it's too dependent on other parts of IPython to function alone.
5591
5595
5592 * Fixed bug in genutils.pager. It would crash if the pager was
5596 * Fixed bug in genutils.pager. It would crash if the pager was
5593 exited immediately after opening (broken pipe).
5597 exited immediately after opening (broken pipe).
5594
5598
5595 * Trimmed down the VerboseTB reporting a little. The header is
5599 * Trimmed down the VerboseTB reporting a little. The header is
5596 much shorter now and the repeated exception arguments at the end
5600 much shorter now and the repeated exception arguments at the end
5597 have been removed. For interactive use the old header seemed a bit
5601 have been removed. For interactive use the old header seemed a bit
5598 excessive.
5602 excessive.
5599
5603
5600 * Fixed small bug in output of @whos for variables with multi-word
5604 * Fixed small bug in output of @whos for variables with multi-word
5601 types (only first word was displayed).
5605 types (only first word was displayed).
5602
5606
5603 2001-11-17 Fernando Perez <fperez@colorado.edu>
5607 2001-11-17 Fernando Perez <fperez@colorado.edu>
5604
5608
5605 * Version 0.1.10 released, 0.1.11 opened for further work.
5609 * Version 0.1.10 released, 0.1.11 opened for further work.
5606
5610
5607 * Modified dirs and friends. dirs now *returns* the stack (not
5611 * Modified dirs and friends. dirs now *returns* the stack (not
5608 prints), so one can manipulate it as a variable. Convenient to
5612 prints), so one can manipulate it as a variable. Convenient to
5609 travel along many directories.
5613 travel along many directories.
5610
5614
5611 * Fixed bug in magic_pdef: would only work with functions with
5615 * Fixed bug in magic_pdef: would only work with functions with
5612 arguments with default values.
5616 arguments with default values.
5613
5617
5614 2001-11-14 Fernando Perez <fperez@colorado.edu>
5618 2001-11-14 Fernando Perez <fperez@colorado.edu>
5615
5619
5616 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5620 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5617 example with IPython. Various other minor fixes and cleanups.
5621 example with IPython. Various other minor fixes and cleanups.
5618
5622
5619 * Version 0.1.9 released, 0.1.10 opened for further work.
5623 * Version 0.1.9 released, 0.1.10 opened for further work.
5620
5624
5621 * Added sys.path to the list of directories searched in the
5625 * Added sys.path to the list of directories searched in the
5622 execfile= option. It used to be the current directory and the
5626 execfile= option. It used to be the current directory and the
5623 user's IPYTHONDIR only.
5627 user's IPYTHONDIR only.
5624
5628
5625 2001-11-13 Fernando Perez <fperez@colorado.edu>
5629 2001-11-13 Fernando Perez <fperez@colorado.edu>
5626
5630
5627 * Reinstated the raw_input/prefilter separation that Janko had
5631 * Reinstated the raw_input/prefilter separation that Janko had
5628 initially. This gives a more convenient setup for extending the
5632 initially. This gives a more convenient setup for extending the
5629 pre-processor from the outside: raw_input always gets a string,
5633 pre-processor from the outside: raw_input always gets a string,
5630 and prefilter has to process it. We can then redefine prefilter
5634 and prefilter has to process it. We can then redefine prefilter
5631 from the outside and implement extensions for special
5635 from the outside and implement extensions for special
5632 purposes.
5636 purposes.
5633
5637
5634 Today I got one for inputting PhysicalQuantity objects
5638 Today I got one for inputting PhysicalQuantity objects
5635 (from Scientific) without needing any function calls at
5639 (from Scientific) without needing any function calls at
5636 all. Extremely convenient, and it's all done as a user-level
5640 all. Extremely convenient, and it's all done as a user-level
5637 extension (no IPython code was touched). Now instead of:
5641 extension (no IPython code was touched). Now instead of:
5638 a = PhysicalQuantity(4.2,'m/s**2')
5642 a = PhysicalQuantity(4.2,'m/s**2')
5639 one can simply say
5643 one can simply say
5640 a = 4.2 m/s**2
5644 a = 4.2 m/s**2
5641 or even
5645 or even
5642 a = 4.2 m/s^2
5646 a = 4.2 m/s^2
5643
5647
5644 I use this, but it's also a proof of concept: IPython really is
5648 I use this, but it's also a proof of concept: IPython really is
5645 fully user-extensible, even at the level of the parsing of the
5649 fully user-extensible, even at the level of the parsing of the
5646 command line. It's not trivial, but it's perfectly doable.
5650 command line. It's not trivial, but it's perfectly doable.
5647
5651
5648 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5652 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5649 the problem of modules being loaded in the inverse order in which
5653 the problem of modules being loaded in the inverse order in which
5650 they were defined in
5654 they were defined in
5651
5655
5652 * Version 0.1.8 released, 0.1.9 opened for further work.
5656 * Version 0.1.8 released, 0.1.9 opened for further work.
5653
5657
5654 * Added magics pdef, source and file. They respectively show the
5658 * Added magics pdef, source and file. They respectively show the
5655 definition line ('prototype' in C), source code and full python
5659 definition line ('prototype' in C), source code and full python
5656 file for any callable object. The object inspector oinfo uses
5660 file for any callable object. The object inspector oinfo uses
5657 these to show the same information.
5661 these to show the same information.
5658
5662
5659 * Version 0.1.7 released, 0.1.8 opened for further work.
5663 * Version 0.1.7 released, 0.1.8 opened for further work.
5660
5664
5661 * Separated all the magic functions into a class called Magic. The
5665 * Separated all the magic functions into a class called Magic. The
5662 InteractiveShell class was becoming too big for Xemacs to handle
5666 InteractiveShell class was becoming too big for Xemacs to handle
5663 (de-indenting a line would lock it up for 10 seconds while it
5667 (de-indenting a line would lock it up for 10 seconds while it
5664 backtracked on the whole class!)
5668 backtracked on the whole class!)
5665
5669
5666 FIXME: didn't work. It can be done, but right now namespaces are
5670 FIXME: didn't work. It can be done, but right now namespaces are
5667 all messed up. Do it later (reverted it for now, so at least
5671 all messed up. Do it later (reverted it for now, so at least
5668 everything works as before).
5672 everything works as before).
5669
5673
5670 * Got the object introspection system (magic_oinfo) working! I
5674 * Got the object introspection system (magic_oinfo) working! I
5671 think this is pretty much ready for release to Janko, so he can
5675 think this is pretty much ready for release to Janko, so he can
5672 test it for a while and then announce it. Pretty much 100% of what
5676 test it for a while and then announce it. Pretty much 100% of what
5673 I wanted for the 'phase 1' release is ready. Happy, tired.
5677 I wanted for the 'phase 1' release is ready. Happy, tired.
5674
5678
5675 2001-11-12 Fernando Perez <fperez@colorado.edu>
5679 2001-11-12 Fernando Perez <fperez@colorado.edu>
5676
5680
5677 * Version 0.1.6 released, 0.1.7 opened for further work.
5681 * Version 0.1.6 released, 0.1.7 opened for further work.
5678
5682
5679 * Fixed bug in printing: it used to test for truth before
5683 * Fixed bug in printing: it used to test for truth before
5680 printing, so 0 wouldn't print. Now checks for None.
5684 printing, so 0 wouldn't print. Now checks for None.
5681
5685
5682 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5686 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5683 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5687 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5684 reaches by hand into the outputcache. Think of a better way to do
5688 reaches by hand into the outputcache. Think of a better way to do
5685 this later.
5689 this later.
5686
5690
5687 * Various small fixes thanks to Nathan's comments.
5691 * Various small fixes thanks to Nathan's comments.
5688
5692
5689 * Changed magic_pprint to magic_Pprint. This way it doesn't
5693 * Changed magic_pprint to magic_Pprint. This way it doesn't
5690 collide with pprint() and the name is consistent with the command
5694 collide with pprint() and the name is consistent with the command
5691 line option.
5695 line option.
5692
5696
5693 * Changed prompt counter behavior to be fully like
5697 * Changed prompt counter behavior to be fully like
5694 Mathematica's. That is, even input that doesn't return a result
5698 Mathematica's. That is, even input that doesn't return a result
5695 raises the prompt counter. The old behavior was kind of confusing
5699 raises the prompt counter. The old behavior was kind of confusing
5696 (getting the same prompt number several times if the operation
5700 (getting the same prompt number several times if the operation
5697 didn't return a result).
5701 didn't return a result).
5698
5702
5699 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5703 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5700
5704
5701 * Fixed -Classic mode (wasn't working anymore).
5705 * Fixed -Classic mode (wasn't working anymore).
5702
5706
5703 * Added colored prompts using Nathan's new code. Colors are
5707 * Added colored prompts using Nathan's new code. Colors are
5704 currently hardwired, they can be user-configurable. For
5708 currently hardwired, they can be user-configurable. For
5705 developers, they can be chosen in file ipythonlib.py, at the
5709 developers, they can be chosen in file ipythonlib.py, at the
5706 beginning of the CachedOutput class def.
5710 beginning of the CachedOutput class def.
5707
5711
5708 2001-11-11 Fernando Perez <fperez@colorado.edu>
5712 2001-11-11 Fernando Perez <fperez@colorado.edu>
5709
5713
5710 * Version 0.1.5 released, 0.1.6 opened for further work.
5714 * Version 0.1.5 released, 0.1.6 opened for further work.
5711
5715
5712 * Changed magic_env to *return* the environment as a dict (not to
5716 * Changed magic_env to *return* the environment as a dict (not to
5713 print it). This way it prints, but it can also be processed.
5717 print it). This way it prints, but it can also be processed.
5714
5718
5715 * Added Verbose exception reporting to interactive
5719 * Added Verbose exception reporting to interactive
5716 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5720 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5717 traceback. Had to make some changes to the ultraTB file. This is
5721 traceback. Had to make some changes to the ultraTB file. This is
5718 probably the last 'big' thing in my mental todo list. This ties
5722 probably the last 'big' thing in my mental todo list. This ties
5719 in with the next entry:
5723 in with the next entry:
5720
5724
5721 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5725 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5722 has to specify is Plain, Color or Verbose for all exception
5726 has to specify is Plain, Color or Verbose for all exception
5723 handling.
5727 handling.
5724
5728
5725 * Removed ShellServices option. All this can really be done via
5729 * Removed ShellServices option. All this can really be done via
5726 the magic system. It's easier to extend, cleaner and has automatic
5730 the magic system. It's easier to extend, cleaner and has automatic
5727 namespace protection and documentation.
5731 namespace protection and documentation.
5728
5732
5729 2001-11-09 Fernando Perez <fperez@colorado.edu>
5733 2001-11-09 Fernando Perez <fperez@colorado.edu>
5730
5734
5731 * Fixed bug in output cache flushing (missing parameter to
5735 * Fixed bug in output cache flushing (missing parameter to
5732 __init__). Other small bugs fixed (found using pychecker).
5736 __init__). Other small bugs fixed (found using pychecker).
5733
5737
5734 * Version 0.1.4 opened for bugfixing.
5738 * Version 0.1.4 opened for bugfixing.
5735
5739
5736 2001-11-07 Fernando Perez <fperez@colorado.edu>
5740 2001-11-07 Fernando Perez <fperez@colorado.edu>
5737
5741
5738 * Version 0.1.3 released, mainly because of the raw_input bug.
5742 * Version 0.1.3 released, mainly because of the raw_input bug.
5739
5743
5740 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5744 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5741 and when testing for whether things were callable, a call could
5745 and when testing for whether things were callable, a call could
5742 actually be made to certain functions. They would get called again
5746 actually be made to certain functions. They would get called again
5743 once 'really' executed, with a resulting double call. A disaster
5747 once 'really' executed, with a resulting double call. A disaster
5744 in many cases (list.reverse() would never work!).
5748 in many cases (list.reverse() would never work!).
5745
5749
5746 * Removed prefilter() function, moved its code to raw_input (which
5750 * Removed prefilter() function, moved its code to raw_input (which
5747 after all was just a near-empty caller for prefilter). This saves
5751 after all was just a near-empty caller for prefilter). This saves
5748 a function call on every prompt, and simplifies the class a tiny bit.
5752 a function call on every prompt, and simplifies the class a tiny bit.
5749
5753
5750 * Fix _ip to __ip name in magic example file.
5754 * Fix _ip to __ip name in magic example file.
5751
5755
5752 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5756 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5753 work with non-gnu versions of tar.
5757 work with non-gnu versions of tar.
5754
5758
5755 2001-11-06 Fernando Perez <fperez@colorado.edu>
5759 2001-11-06 Fernando Perez <fperez@colorado.edu>
5756
5760
5757 * Version 0.1.2. Just to keep track of the recent changes.
5761 * Version 0.1.2. Just to keep track of the recent changes.
5758
5762
5759 * Fixed nasty bug in output prompt routine. It used to check 'if
5763 * Fixed nasty bug in output prompt routine. It used to check 'if
5760 arg != None...'. Problem is, this fails if arg implements a
5764 arg != None...'. Problem is, this fails if arg implements a
5761 special comparison (__cmp__) which disallows comparing to
5765 special comparison (__cmp__) which disallows comparing to
5762 None. Found it when trying to use the PhysicalQuantity module from
5766 None. Found it when trying to use the PhysicalQuantity module from
5763 ScientificPython.
5767 ScientificPython.
5764
5768
5765 2001-11-05 Fernando Perez <fperez@colorado.edu>
5769 2001-11-05 Fernando Perez <fperez@colorado.edu>
5766
5770
5767 * Also added dirs. Now the pushd/popd/dirs family functions
5771 * Also added dirs. Now the pushd/popd/dirs family functions
5768 basically like the shell, with the added convenience of going home
5772 basically like the shell, with the added convenience of going home
5769 when called with no args.
5773 when called with no args.
5770
5774
5771 * pushd/popd slightly modified to mimic shell behavior more
5775 * pushd/popd slightly modified to mimic shell behavior more
5772 closely.
5776 closely.
5773
5777
5774 * Added env,pushd,popd from ShellServices as magic functions. I
5778 * Added env,pushd,popd from ShellServices as magic functions. I
5775 think the cleanest will be to port all desired functions from
5779 think the cleanest will be to port all desired functions from
5776 ShellServices as magics and remove ShellServices altogether. This
5780 ShellServices as magics and remove ShellServices altogether. This
5777 will provide a single, clean way of adding functionality
5781 will provide a single, clean way of adding functionality
5778 (shell-type or otherwise) to IP.
5782 (shell-type or otherwise) to IP.
5779
5783
5780 2001-11-04 Fernando Perez <fperez@colorado.edu>
5784 2001-11-04 Fernando Perez <fperez@colorado.edu>
5781
5785
5782 * Added .ipython/ directory to sys.path. This way users can keep
5786 * Added .ipython/ directory to sys.path. This way users can keep
5783 customizations there and access them via import.
5787 customizations there and access them via import.
5784
5788
5785 2001-11-03 Fernando Perez <fperez@colorado.edu>
5789 2001-11-03 Fernando Perez <fperez@colorado.edu>
5786
5790
5787 * Opened version 0.1.1 for new changes.
5791 * Opened version 0.1.1 for new changes.
5788
5792
5789 * Changed version number to 0.1.0: first 'public' release, sent to
5793 * Changed version number to 0.1.0: first 'public' release, sent to
5790 Nathan and Janko.
5794 Nathan and Janko.
5791
5795
5792 * Lots of small fixes and tweaks.
5796 * Lots of small fixes and tweaks.
5793
5797
5794 * Minor changes to whos format. Now strings are shown, snipped if
5798 * Minor changes to whos format. Now strings are shown, snipped if
5795 too long.
5799 too long.
5796
5800
5797 * Changed ShellServices to work on __main__ so they show up in @who
5801 * Changed ShellServices to work on __main__ so they show up in @who
5798
5802
5799 * Help also works with ? at the end of a line:
5803 * Help also works with ? at the end of a line:
5800 ?sin and sin?
5804 ?sin and sin?
5801 both produce the same effect. This is nice, as often I use the
5805 both produce the same effect. This is nice, as often I use the
5802 tab-complete to find the name of a method, but I used to then have
5806 tab-complete to find the name of a method, but I used to then have
5803 to go to the beginning of the line to put a ? if I wanted more
5807 to go to the beginning of the line to put a ? if I wanted more
5804 info. Now I can just add the ? and hit return. Convenient.
5808 info. Now I can just add the ? and hit return. Convenient.
5805
5809
5806 2001-11-02 Fernando Perez <fperez@colorado.edu>
5810 2001-11-02 Fernando Perez <fperez@colorado.edu>
5807
5811
5808 * Python version check (>=2.1) added.
5812 * Python version check (>=2.1) added.
5809
5813
5810 * Added LazyPython documentation. At this point the docs are quite
5814 * Added LazyPython documentation. At this point the docs are quite
5811 a mess. A cleanup is in order.
5815 a mess. A cleanup is in order.
5812
5816
5813 * Auto-installer created. For some bizarre reason, the zipfiles
5817 * Auto-installer created. For some bizarre reason, the zipfiles
5814 module isn't working on my system. So I made a tar version
5818 module isn't working on my system. So I made a tar version
5815 (hopefully the command line options in various systems won't kill
5819 (hopefully the command line options in various systems won't kill
5816 me).
5820 me).
5817
5821
5818 * Fixes to Struct in genutils. Now all dictionary-like methods are
5822 * Fixes to Struct in genutils. Now all dictionary-like methods are
5819 protected (reasonably).
5823 protected (reasonably).
5820
5824
5821 * Added pager function to genutils and changed ? to print usage
5825 * Added pager function to genutils and changed ? to print usage
5822 note through it (it was too long).
5826 note through it (it was too long).
5823
5827
5824 * Added the LazyPython functionality. Works great! I changed the
5828 * Added the LazyPython functionality. Works great! I changed the
5825 auto-quote escape to ';', it's on home row and next to '. But
5829 auto-quote escape to ';', it's on home row and next to '. But
5826 both auto-quote and auto-paren (still /) escapes are command-line
5830 both auto-quote and auto-paren (still /) escapes are command-line
5827 parameters.
5831 parameters.
5828
5832
5829
5833
5830 2001-11-01 Fernando Perez <fperez@colorado.edu>
5834 2001-11-01 Fernando Perez <fperez@colorado.edu>
5831
5835
5832 * Version changed to 0.0.7. Fairly large change: configuration now
5836 * Version changed to 0.0.7. Fairly large change: configuration now
5833 is all stored in a directory, by default .ipython. There, all
5837 is all stored in a directory, by default .ipython. There, all
5834 config files have normal looking names (not .names)
5838 config files have normal looking names (not .names)
5835
5839
5836 * Version 0.0.6 Released first to Lucas and Archie as a test
5840 * Version 0.0.6 Released first to Lucas and Archie as a test
5837 run. Since it's the first 'semi-public' release, change version to
5841 run. Since it's the first 'semi-public' release, change version to
5838 > 0.0.6 for any changes now.
5842 > 0.0.6 for any changes now.
5839
5843
5840 * Stuff I had put in the ipplib.py changelog:
5844 * Stuff I had put in the ipplib.py changelog:
5841
5845
5842 Changes to InteractiveShell:
5846 Changes to InteractiveShell:
5843
5847
5844 - Made the usage message a parameter.
5848 - Made the usage message a parameter.
5845
5849
5846 - Require the name of the shell variable to be given. It's a bit
5850 - Require the name of the shell variable to be given. It's a bit
5847 of a hack, but allows the name 'shell' not to be hardwired in the
5851 of a hack, but allows the name 'shell' not to be hardwired in the
5848 magic (@) handler, which is problematic b/c it requires
5852 magic (@) handler, which is problematic b/c it requires
5849 polluting the global namespace with 'shell'. This in turn is
5853 polluting the global namespace with 'shell'. This in turn is
5850 fragile: if a user redefines a variable called shell, things
5854 fragile: if a user redefines a variable called shell, things
5851 break.
5855 break.
5852
5856
5853 - magic @: all functions available through @ need to be defined
5857 - magic @: all functions available through @ need to be defined
5854 as magic_<name>, even though they can be called simply as
5858 as magic_<name>, even though they can be called simply as
5855 @<name>. This allows the special command @magic to gather
5859 @<name>. This allows the special command @magic to gather
5856 information automatically about all existing magic functions,
5860 information automatically about all existing magic functions,
5857 even if they are run-time user extensions, by parsing the shell
5861 even if they are run-time user extensions, by parsing the shell
5858 instance __dict__ looking for special magic_ names.
5862 instance __dict__ looking for special magic_ names.
5859
5863
5860 - mainloop: added *two* local namespace parameters. This allows
5864 - mainloop: added *two* local namespace parameters. This allows
5861 the class to differentiate between parameters which were there
5865 the class to differentiate between parameters which were there
5862 before and after command line initialization was processed. This
5866 before and after command line initialization was processed. This
5863 way, later @who can show things loaded at startup by the
5867 way, later @who can show things loaded at startup by the
5864 user. This trick was necessary to make session saving/reloading
5868 user. This trick was necessary to make session saving/reloading
5865 really work: ideally after saving/exiting/reloading a session,
5869 really work: ideally after saving/exiting/reloading a session,
5866 *everything* should look the same, including the output of @who. I
5870 *everything* should look the same, including the output of @who. I
5867 was only able to make this work with this double namespace
5871 was only able to make this work with this double namespace
5868 trick.
5872 trick.
5869
5873
5870 - added a header to the logfile which allows (almost) full
5874 - added a header to the logfile which allows (almost) full
5871 session restoring.
5875 session restoring.
5872
5876
5873 - prepend lines beginning with @ or !, with a and log
5877 - prepend lines beginning with @ or !, with a and log
5874 them. Why? !lines: may be useful to know what you did @lines:
5878 them. Why? !lines: may be useful to know what you did @lines:
5875 they may affect session state. So when restoring a session, at
5879 they may affect session state. So when restoring a session, at
5876 least inform the user of their presence. I couldn't quite get
5880 least inform the user of their presence. I couldn't quite get
5877 them to properly re-execute, but at least the user is warned.
5881 them to properly re-execute, but at least the user is warned.
5878
5882
5879 * Started ChangeLog.
5883 * Started ChangeLog.
@@ -1,12 +1,18 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """IPython -- An enhanced Interactive Python
3 """IPython -- An enhanced Interactive Python
4
4
5 The actual ipython script to be installed with 'python setup.py install' is
5 The actual ipython script to be installed with 'python setup.py install' is
6 in './scripts' directory. This file is here (ipython source root directory)
6 in './scripts' directory. This file is here (ipython source root directory)
7 to facilitate non-root 'zero-installation' (just copy the source tree
7 to facilitate non-root 'zero-installation' (just copy the source tree
8 somewhere and run ipython.py) and development. """
8 somewhere and run ipython.py) and development. """
9
9
10 # Start by cleaning up sys.path: Python automatically inserts the script's
11 # base directory into sys.path, at the front. This can lead to unpleasant
12 # surprises.
13 import sys
14 sys.path.pop(0)
15
10 import IPython
16 import IPython
11
17
12 IPython.Shell.start().mainloop()
18 IPython.Shell.start().mainloop()
@@ -1,28 +1,33 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """IPython -- An enhanced Interactive Python
3 """IPython -- An enhanced Interactive Python
4
4
5 This is just the startup wrapper script, kept deliberately to a minimum.
5 This is just the startup wrapper script, kept deliberately to a minimum.
6
6
7 The shell's mainloop() takes an optional argument, sys_exit (default=0). If
7 The shell's mainloop() takes an optional argument, sys_exit (default=0). If
8 set to 1, it calls sys.exit() at exit time. You can use the following code in
8 set to 1, it calls sys.exit() at exit time. You can use the following code in
9 your PYTHONSTARTUP file:
9 your PYTHONSTARTUP file:
10
10
11 import IPython
11 import IPython
12 IPython.Shell.IPShell().mainloop(sys_exit=1)
12 IPython.Shell.IPShell().mainloop(sys_exit=1)
13
13
14 [or simply IPython.Shell.IPShell().mainloop(1) ]
14 [or simply IPython.Shell.IPShell().mainloop(1) ]
15
15
16 and IPython will be your working environment when you start python. The final
16 and IPython will be your working environment when you start python. The final
17 sys.exit() call will make python exit transparently when IPython finishes, so
17 sys.exit() call will make python exit transparently when IPython finishes, so
18 you don't have an extra prompt to get out of.
18 you don't have an extra prompt to get out of.
19
19
20 This is probably useful to developers who manage multiple Python versions and
20 This is probably useful to developers who manage multiple Python versions and
21 don't want to have correspondingly multiple IPython versions. Note that in
21 don't want to have correspondingly multiple IPython versions. Note that in
22 this mode, there is no way to pass IPython any command-line options, as those
22 this mode, there is no way to pass IPython any command-line options, as those
23 are trapped first by Python itself.
23 are trapped first by Python itself.
24 """
24 """
25
25
26 import IPython
26 # Start by cleaning up sys.path: Python automatically inserts the script's
27 # base directory into sys.path, at the front. This can lead to unpleasant
28 # surprises.
29 import sys
30 sys.path.pop(0)
27
31
32 import IPython
28 IPython.Shell.start().mainloop()
33 IPython.Shell.start().mainloop()
General Comments 0
You need to be logged in to leave comments. Login now