##// END OF EJS Templates
- Automatically prepend 'if 1:' to user input that starts with whitespace,...
fperez -
Show More
@@ -1,2515 +1,2548 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 1879 2006-11-04 00:34:34Z fptest $
9 $Id: iplib.py 1885 2006-11-08 01:07:28Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pydoc
50 import pydoc
51 import re
51 import re
52 import shutil
52 import shutil
53 import string
53 import string
54 import sys
54 import sys
55 import tempfile
55 import tempfile
56 import traceback
56 import traceback
57 import types
57 import types
58 import pickleshare
58 import pickleshare
59 from sets import Set
59 from sets import Set
60 from pprint import pprint, pformat
60 from pprint import pprint, pformat
61
61
62 # IPython's own modules
62 # IPython's own modules
63 import IPython
63 import IPython
64 from IPython import OInspect,PyColorize,ultraTB
64 from IPython import OInspect,PyColorize,ultraTB
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.FakeModule import FakeModule
66 from IPython.FakeModule import FakeModule
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Logger import Logger
68 from IPython.Logger import Logger
69 from IPython.Magic import Magic
69 from IPython.Magic import Magic
70 from IPython.Prompts import CachedOutput
70 from IPython.Prompts import CachedOutput
71 from IPython.ipstruct import Struct
71 from IPython.ipstruct import Struct
72 from IPython.background_jobs import BackgroundJobManager
72 from IPython.background_jobs import BackgroundJobManager
73 from IPython.usage import cmd_line_usage,interactive_usage
73 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.genutils import *
74 from IPython.genutils import *
75 from IPython.strdispatch import StrDispatch
75 from IPython.strdispatch import StrDispatch
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class Quitter(object):
129 class Quitter(object):
130 """Simple class to handle exit, similar to Python 2.5's.
130 """Simple class to handle exit, similar to Python 2.5's.
131
131
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
133 doesn't do (obviously, since it doesn't know about ipython)."""
133 doesn't do (obviously, since it doesn't know about ipython)."""
134
134
135 def __init__(self,shell,name):
135 def __init__(self,shell,name):
136 self.shell = shell
136 self.shell = shell
137 self.name = name
137 self.name = name
138
138
139 def __repr__(self):
139 def __repr__(self):
140 return 'Type %s() to exit.' % self.name
140 return 'Type %s() to exit.' % self.name
141 __str__ = __repr__
141 __str__ = __repr__
142
142
143 def __call__(self):
143 def __call__(self):
144 self.shell.exit()
144 self.shell.exit()
145
145
146 class InputList(list):
146 class InputList(list):
147 """Class to store user input.
147 """Class to store user input.
148
148
149 It's basically a list, but slices return a string instead of a list, thus
149 It's basically a list, but slices return a string instead of a list, thus
150 allowing things like (assuming 'In' is an instance):
150 allowing things like (assuming 'In' is an instance):
151
151
152 exec In[4:7]
152 exec In[4:7]
153
153
154 or
154 or
155
155
156 exec In[5:9] + In[14] + In[21:25]"""
156 exec In[5:9] + In[14] + In[21:25]"""
157
157
158 def __getslice__(self,i,j):
158 def __getslice__(self,i,j):
159 return ''.join(list.__getslice__(self,i,j))
159 return ''.join(list.__getslice__(self,i,j))
160
160
161 class SyntaxTB(ultraTB.ListTB):
161 class SyntaxTB(ultraTB.ListTB):
162 """Extension which holds some state: the last exception value"""
162 """Extension which holds some state: the last exception value"""
163
163
164 def __init__(self,color_scheme = 'NoColor'):
164 def __init__(self,color_scheme = 'NoColor'):
165 ultraTB.ListTB.__init__(self,color_scheme)
165 ultraTB.ListTB.__init__(self,color_scheme)
166 self.last_syntax_error = None
166 self.last_syntax_error = None
167
167
168 def __call__(self, etype, value, elist):
168 def __call__(self, etype, value, elist):
169 self.last_syntax_error = value
169 self.last_syntax_error = value
170 ultraTB.ListTB.__call__(self,etype,value,elist)
170 ultraTB.ListTB.__call__(self,etype,value,elist)
171
171
172 def clear_err_state(self):
172 def clear_err_state(self):
173 """Return the current error state and clear it"""
173 """Return the current error state and clear it"""
174 e = self.last_syntax_error
174 e = self.last_syntax_error
175 self.last_syntax_error = None
175 self.last_syntax_error = None
176 return e
176 return e
177
177
178 #****************************************************************************
178 #****************************************************************************
179 # Main IPython class
179 # Main IPython class
180
180
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
182 # until a full rewrite is made. I've cleaned all cross-class uses of
182 # until a full rewrite is made. I've cleaned all cross-class uses of
183 # attributes and methods, but too much user code out there relies on the
183 # attributes and methods, but too much user code out there relies on the
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
185 #
185 #
186 # But at least now, all the pieces have been separated and we could, in
186 # But at least now, all the pieces have been separated and we could, in
187 # principle, stop using the mixin. This will ease the transition to the
187 # principle, stop using the mixin. This will ease the transition to the
188 # chainsaw branch.
188 # chainsaw branch.
189
189
190 # For reference, the following is the list of 'self.foo' uses in the Magic
190 # For reference, the following is the list of 'self.foo' uses in the Magic
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
192 # class, to prevent clashes.
192 # class, to prevent clashes.
193
193
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 # 'self.value']
197 # 'self.value']
198
198
199 class InteractiveShell(object,Magic):
199 class InteractiveShell(object,Magic):
200 """An enhanced console for Python."""
200 """An enhanced console for Python."""
201
201
202 # class attribute to indicate whether the class supports threads or not.
202 # class attribute to indicate whether the class supports threads or not.
203 # Subclasses with thread support should override this as needed.
203 # Subclasses with thread support should override this as needed.
204 isthreaded = False
204 isthreaded = False
205
205
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
207 user_ns = None,user_global_ns=None,banner2='',
207 user_ns = None,user_global_ns=None,banner2='',
208 custom_exceptions=((),None),embedded=False):
208 custom_exceptions=((),None),embedded=False):
209
209
210 # log system
210 # log system
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212
212
213 # some minimal strict typechecks. For some core data structures, I
213 # some minimal strict typechecks. For some core data structures, I
214 # want actual basic python types, not just anything that looks like
214 # want actual basic python types, not just anything that looks like
215 # one. This is especially true for namespaces.
215 # one. This is especially true for namespaces.
216 for ns in (user_ns,user_global_ns):
216 for ns in (user_ns,user_global_ns):
217 if ns is not None and type(ns) != types.DictType:
217 if ns is not None and type(ns) != types.DictType:
218 raise TypeError,'namespace must be a dictionary'
218 raise TypeError,'namespace must be a dictionary'
219
219
220 # Job manager (for jobs run as background threads)
220 # Job manager (for jobs run as background threads)
221 self.jobs = BackgroundJobManager()
221 self.jobs = BackgroundJobManager()
222
222
223 # Store the actual shell's name
223 # Store the actual shell's name
224 self.name = name
224 self.name = name
225
225
226 # We need to know whether the instance is meant for embedding, since
226 # We need to know whether the instance is meant for embedding, since
227 # global/local namespaces need to be handled differently in that case
227 # global/local namespaces need to be handled differently in that case
228 self.embedded = embedded
228 self.embedded = embedded
229
229
230 # command compiler
230 # command compiler
231 self.compile = codeop.CommandCompiler()
231 self.compile = codeop.CommandCompiler()
232
232
233 # User input buffer
233 # User input buffer
234 self.buffer = []
234 self.buffer = []
235
235
236 # Default name given in compilation of code
236 # Default name given in compilation of code
237 self.filename = '<ipython console>'
237 self.filename = '<ipython console>'
238
238
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
241 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.exit = Quitter(self,'exit')
242 __builtin__.quit = Quitter(self,'quit')
242 __builtin__.quit = Quitter(self,'quit')
243
243
244 # Make an empty namespace, which extension writers can rely on both
244 # Make an empty namespace, which extension writers can rely on both
245 # existing and NEVER being used by ipython itself. This gives them a
245 # existing and NEVER being used by ipython itself. This gives them a
246 # convenient location for storing additional information and state
246 # convenient location for storing additional information and state
247 # their extensions may require, without fear of collisions with other
247 # their extensions may require, without fear of collisions with other
248 # ipython names that may develop later.
248 # ipython names that may develop later.
249 self.meta = Struct()
249 self.meta = Struct()
250
250
251 # Create the namespace where the user will operate. user_ns is
251 # Create the namespace where the user will operate. user_ns is
252 # normally the only one used, and it is passed to the exec calls as
252 # normally the only one used, and it is passed to the exec calls as
253 # the locals argument. But we do carry a user_global_ns namespace
253 # the locals argument. But we do carry a user_global_ns namespace
254 # given as the exec 'globals' argument, This is useful in embedding
254 # given as the exec 'globals' argument, This is useful in embedding
255 # situations where the ipython shell opens in a context where the
255 # situations where the ipython shell opens in a context where the
256 # distinction between locals and globals is meaningful.
256 # distinction between locals and globals is meaningful.
257
257
258 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # FIXME. For some strange reason, __builtins__ is showing up at user
259 # level as a dict instead of a module. This is a manual fix, but I
259 # level as a dict instead of a module. This is a manual fix, but I
260 # should really track down where the problem is coming from. Alex
260 # should really track down where the problem is coming from. Alex
261 # Schmolck reported this problem first.
261 # Schmolck reported this problem first.
262
262
263 # A useful post by Alex Martelli on this topic:
263 # A useful post by Alex Martelli on this topic:
264 # Re: inconsistent value from __builtins__
264 # Re: inconsistent value from __builtins__
265 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Von: Alex Martelli <aleaxit@yahoo.com>
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 # Gruppen: comp.lang.python
267 # Gruppen: comp.lang.python
268
268
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 # > <type 'dict'>
271 # > <type 'dict'>
272 # > >>> print type(__builtins__)
272 # > >>> print type(__builtins__)
273 # > <type 'module'>
273 # > <type 'module'>
274 # > Is this difference in return value intentional?
274 # > Is this difference in return value intentional?
275
275
276 # Well, it's documented that '__builtins__' can be either a dictionary
276 # Well, it's documented that '__builtins__' can be either a dictionary
277 # or a module, and it's been that way for a long time. Whether it's
277 # or a module, and it's been that way for a long time. Whether it's
278 # intentional (or sensible), I don't know. In any case, the idea is
278 # intentional (or sensible), I don't know. In any case, the idea is
279 # that if you need to access the built-in namespace directly, you
279 # that if you need to access the built-in namespace directly, you
280 # should start with "import __builtin__" (note, no 's') which will
280 # should start with "import __builtin__" (note, no 's') which will
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282
282
283 # These routines return properly built dicts as needed by the rest of
283 # These routines return properly built dicts as needed by the rest of
284 # the code, and can also be used by extension writers to generate
284 # the code, and can also be used by extension writers to generate
285 # properly initialized namespaces.
285 # properly initialized namespaces.
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
288
288
289 # Assign namespaces
289 # Assign namespaces
290 # This is the namespace where all normal user variables live
290 # This is the namespace where all normal user variables live
291 self.user_ns = user_ns
291 self.user_ns = user_ns
292 # Embedded instances require a separate namespace for globals.
292 # Embedded instances require a separate namespace for globals.
293 # Normally this one is unused by non-embedded instances.
293 # Normally this one is unused by non-embedded instances.
294 self.user_global_ns = user_global_ns
294 self.user_global_ns = user_global_ns
295 # A namespace to keep track of internal data structures to prevent
295 # A namespace to keep track of internal data structures to prevent
296 # them from cluttering user-visible stuff. Will be updated later
296 # them from cluttering user-visible stuff. Will be updated later
297 self.internal_ns = {}
297 self.internal_ns = {}
298
298
299 # Namespace of system aliases. Each entry in the alias
299 # Namespace of system aliases. Each entry in the alias
300 # table must be a 2-tuple of the form (N,name), where N is the number
300 # table must be a 2-tuple of the form (N,name), where N is the number
301 # of positional arguments of the alias.
301 # of positional arguments of the alias.
302 self.alias_table = {}
302 self.alias_table = {}
303
303
304 # A table holding all the namespaces IPython deals with, so that
304 # A table holding all the namespaces IPython deals with, so that
305 # introspection facilities can search easily.
305 # introspection facilities can search easily.
306 self.ns_table = {'user':user_ns,
306 self.ns_table = {'user':user_ns,
307 'user_global':user_global_ns,
307 'user_global':user_global_ns,
308 'alias':self.alias_table,
308 'alias':self.alias_table,
309 'internal':self.internal_ns,
309 'internal':self.internal_ns,
310 'builtin':__builtin__.__dict__
310 'builtin':__builtin__.__dict__
311 }
311 }
312
312
313 # The user namespace MUST have a pointer to the shell itself.
313 # The user namespace MUST have a pointer to the shell itself.
314 self.user_ns[name] = self
314 self.user_ns[name] = self
315
315
316 # We need to insert into sys.modules something that looks like a
316 # We need to insert into sys.modules something that looks like a
317 # module but which accesses the IPython namespace, for shelve and
317 # module but which accesses the IPython namespace, for shelve and
318 # pickle to work interactively. Normally they rely on getting
318 # pickle to work interactively. Normally they rely on getting
319 # everything out of __main__, but for embedding purposes each IPython
319 # everything out of __main__, but for embedding purposes each IPython
320 # instance has its own private namespace, so we can't go shoving
320 # instance has its own private namespace, so we can't go shoving
321 # everything into __main__.
321 # everything into __main__.
322
322
323 # note, however, that we should only do this for non-embedded
323 # note, however, that we should only do this for non-embedded
324 # ipythons, which really mimic the __main__.__dict__ with their own
324 # ipythons, which really mimic the __main__.__dict__ with their own
325 # namespace. Embedded instances, on the other hand, should not do
325 # namespace. Embedded instances, on the other hand, should not do
326 # this because they need to manage the user local/global namespaces
326 # this because they need to manage the user local/global namespaces
327 # only, but they live within a 'normal' __main__ (meaning, they
327 # only, but they live within a 'normal' __main__ (meaning, they
328 # shouldn't overtake the execution environment of the script they're
328 # shouldn't overtake the execution environment of the script they're
329 # embedded in).
329 # embedded in).
330
330
331 if not embedded:
331 if not embedded:
332 try:
332 try:
333 main_name = self.user_ns['__name__']
333 main_name = self.user_ns['__name__']
334 except KeyError:
334 except KeyError:
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 else:
336 else:
337 #print "pickle hack in place" # dbg
337 #print "pickle hack in place" # dbg
338 #print 'main_name:',main_name # dbg
338 #print 'main_name:',main_name # dbg
339 sys.modules[main_name] = FakeModule(self.user_ns)
339 sys.modules[main_name] = FakeModule(self.user_ns)
340
340
341 # List of input with multi-line handling.
341 # List of input with multi-line handling.
342 # Fill its zero entry, user counter starts at 1
342 # Fill its zero entry, user counter starts at 1
343 self.input_hist = InputList(['\n'])
343 self.input_hist = InputList(['\n'])
344 # This one will hold the 'raw' input history, without any
344 # This one will hold the 'raw' input history, without any
345 # pre-processing. This will allow users to retrieve the input just as
345 # pre-processing. This will allow users to retrieve the input just as
346 # it was exactly typed in by the user, with %hist -r.
346 # it was exactly typed in by the user, with %hist -r.
347 self.input_hist_raw = InputList(['\n'])
347 self.input_hist_raw = InputList(['\n'])
348
348
349 # list of visited directories
349 # list of visited directories
350 try:
350 try:
351 self.dir_hist = [os.getcwd()]
351 self.dir_hist = [os.getcwd()]
352 except IOError, e:
352 except IOError, e:
353 self.dir_hist = []
353 self.dir_hist = []
354
354
355 # dict of output history
355 # dict of output history
356 self.output_hist = {}
356 self.output_hist = {}
357
357
358 # dict of things NOT to alias (keywords, builtins and some magics)
358 # dict of things NOT to alias (keywords, builtins and some magics)
359 no_alias = {}
359 no_alias = {}
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 for key in keyword.kwlist + no_alias_magics:
361 for key in keyword.kwlist + no_alias_magics:
362 no_alias[key] = 1
362 no_alias[key] = 1
363 no_alias.update(__builtin__.__dict__)
363 no_alias.update(__builtin__.__dict__)
364 self.no_alias = no_alias
364 self.no_alias = no_alias
365
365
366 # make global variables for user access to these
366 # make global variables for user access to these
367 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_ih'] = self.input_hist
368 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_oh'] = self.output_hist
369 self.user_ns['_dh'] = self.dir_hist
369 self.user_ns['_dh'] = self.dir_hist
370
370
371 # user aliases to input and output histories
371 # user aliases to input and output histories
372 self.user_ns['In'] = self.input_hist
372 self.user_ns['In'] = self.input_hist
373 self.user_ns['Out'] = self.output_hist
373 self.user_ns['Out'] = self.output_hist
374
374
375 # Object variable to store code object waiting execution. This is
375 # Object variable to store code object waiting execution. This is
376 # used mainly by the multithreaded shells, but it can come in handy in
376 # used mainly by the multithreaded shells, but it can come in handy in
377 # other situations. No need to use a Queue here, since it's a single
377 # other situations. No need to use a Queue here, since it's a single
378 # item which gets cleared once run.
378 # item which gets cleared once run.
379 self.code_to_run = None
379 self.code_to_run = None
380
380
381 # escapes for automatic behavior on the command line
381 # escapes for automatic behavior on the command line
382 self.ESC_SHELL = '!'
382 self.ESC_SHELL = '!'
383 self.ESC_HELP = '?'
383 self.ESC_HELP = '?'
384 self.ESC_MAGIC = '%'
384 self.ESC_MAGIC = '%'
385 self.ESC_QUOTE = ','
385 self.ESC_QUOTE = ','
386 self.ESC_QUOTE2 = ';'
386 self.ESC_QUOTE2 = ';'
387 self.ESC_PAREN = '/'
387 self.ESC_PAREN = '/'
388
388
389 # And their associated handlers
389 # And their associated handlers
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
393 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_MAGIC : self.handle_magic,
394 self.ESC_HELP : self.handle_help,
394 self.ESC_HELP : self.handle_help,
395 self.ESC_SHELL : self.handle_shell_escape,
395 self.ESC_SHELL : self.handle_shell_escape,
396 }
396 }
397
397
398 # class initializations
398 # class initializations
399 Magic.__init__(self,self)
399 Magic.__init__(self,self)
400
400
401 # Python source parser/formatter for syntax highlighting
401 # Python source parser/formatter for syntax highlighting
402 pyformat = PyColorize.Parser().format
402 pyformat = PyColorize.Parser().format
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404
404
405 # hooks holds pointers used for user-side customizations
405 # hooks holds pointers used for user-side customizations
406 self.hooks = Struct()
406 self.hooks = Struct()
407
407
408 self.strdispatchers = {}
408 self.strdispatchers = {}
409
409
410 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
411 hooks = IPython.hooks
411 hooks = IPython.hooks
412 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 #print "bound hook",hook_name
415 #print "bound hook",hook_name
416
416
417 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
418 self.exit_now = False
418 self.exit_now = False
419
419
420 self.usage_min = """\
420 self.usage_min = """\
421 An enhanced console for Python.
421 An enhanced console for Python.
422 Some of its features are:
422 Some of its features are:
423 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
424 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
425 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
426 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 """
430 """
431 if usage: self.usage = usage
431 if usage: self.usage = usage
432 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
433
433
434 # Storage
434 # Storage
435 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
436 self.pager = 'less'
436 self.pager = 'less'
437 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
438 self.tempfiles = []
438 self.tempfiles = []
439
439
440 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
441 self.has_readline = False
441 self.has_readline = False
442
442
443 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
444 # logstart method.
444 # logstart method.
445 self.loghead_tpl = \
445 self.loghead_tpl = \
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 #log# opts = %s
448 #log# opts = %s
449 #log# args = %s
449 #log# args = %s
450 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
451 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
452 """
452 """
453 # for pushd/popd management
453 # for pushd/popd management
454 try:
454 try:
455 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
456 except HomeDirError,msg:
456 except HomeDirError,msg:
457 fatal(msg)
457 fatal(msg)
458
458
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460
460
461 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
462
462
463 # The first is similar to os.system, but it doesn't return a value,
463 # The first is similar to os.system, but it doesn't return a value,
464 # and it allows interpolation of variables in the user's namespace.
464 # and it allows interpolation of variables in the user's namespace.
465 self.system = lambda cmd: \
465 self.system = lambda cmd: \
466 shell(self.var_expand(cmd,depth=2),
466 shell(self.var_expand(cmd,depth=2),
467 header=self.rc.system_header,
467 header=self.rc.system_header,
468 verbose=self.rc.system_verbose)
468 verbose=self.rc.system_verbose)
469
469
470 # These are for getoutput and getoutputerror:
470 # These are for getoutput and getoutputerror:
471 self.getoutput = lambda cmd: \
471 self.getoutput = lambda cmd: \
472 getoutput(self.var_expand(cmd,depth=2),
472 getoutput(self.var_expand(cmd,depth=2),
473 header=self.rc.system_header,
473 header=self.rc.system_header,
474 verbose=self.rc.system_verbose)
474 verbose=self.rc.system_verbose)
475
475
476 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
477 getoutputerror(self.var_expand(cmd,depth=2),
477 getoutputerror(self.var_expand(cmd,depth=2),
478 header=self.rc.system_header,
478 header=self.rc.system_header,
479 verbose=self.rc.system_verbose)
479 verbose=self.rc.system_verbose)
480
480
481 # RegExp for splitting line contents into pre-char//first
481 # RegExp for splitting line contents into pre-char//first
482 # word-method//rest. For clarity, each group in on one line.
482 # word-method//rest. For clarity, each group in on one line.
483
483
484 # WARNING: update the regexp if the above escapes are changed, as they
484 # WARNING: update the regexp if the above escapes are changed, as they
485 # are hardwired in.
485 # are hardwired in.
486
486
487 # Don't get carried away with trying to make the autocalling catch too
487 # Don't get carried away with trying to make the autocalling catch too
488 # much: it's better to be conservative rather than to trigger hidden
488 # much: it's better to be conservative rather than to trigger hidden
489 # evals() somewhere and end up causing side effects.
489 # evals() somewhere and end up causing side effects.
490
490
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 var_expand(self,cmd,depth=0):
619 def var_expand(self,cmd,depth=0):
620 """Expand python variables in a string.
620 """Expand python variables in a string.
621
621
622 The depth argument indicates how many frames above the caller should
622 The depth argument indicates how many frames above the caller should
623 be walked to look for the local namespace where to expand variables.
623 be walked to look for the local namespace where to expand variables.
624
624
625 The global namespace for expansion is always the user's interactive
625 The global namespace for expansion is always the user's interactive
626 namespace.
626 namespace.
627 """
627 """
628
628
629 return str(ItplNS(cmd.replace('#','\#'),
629 return str(ItplNS(cmd.replace('#','\#'),
630 self.user_ns, # globals
630 self.user_ns, # globals
631 # Skip our own frame in searching for locals:
631 # Skip our own frame in searching for locals:
632 sys._getframe(depth+1).f_locals # locals
632 sys._getframe(depth+1).f_locals # locals
633 ))
633 ))
634
634
635 def pre_config_initialization(self):
635 def pre_config_initialization(self):
636 """Pre-configuration init method
636 """Pre-configuration init method
637
637
638 This is called before the configuration files are processed to
638 This is called before the configuration files are processed to
639 prepare the services the config files might need.
639 prepare the services the config files might need.
640
640
641 self.rc already has reasonable default values at this point.
641 self.rc already has reasonable default values at this point.
642 """
642 """
643 rc = self.rc
643 rc = self.rc
644
644
645 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
645 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
646
646
647 def post_config_initialization(self):
647 def post_config_initialization(self):
648 """Post configuration init method
648 """Post configuration init method
649
649
650 This is called after the configuration files have been processed to
650 This is called after the configuration files have been processed to
651 'finalize' the initialization."""
651 'finalize' the initialization."""
652
652
653 rc = self.rc
653 rc = self.rc
654
654
655 # Object inspector
655 # Object inspector
656 self.inspector = OInspect.Inspector(OInspect.InspectColors,
656 self.inspector = OInspect.Inspector(OInspect.InspectColors,
657 PyColorize.ANSICodeColors,
657 PyColorize.ANSICodeColors,
658 'NoColor',
658 'NoColor',
659 rc.object_info_string_level)
659 rc.object_info_string_level)
660
660
661 # Load readline proper
661 # Load readline proper
662 if rc.readline:
662 if rc.readline:
663 self.init_readline()
663 self.init_readline()
664
664
665 # local shortcut, this is used a LOT
665 # local shortcut, this is used a LOT
666 self.log = self.logger.log
666 self.log = self.logger.log
667
667
668 # Initialize cache, set in/out prompts and printing system
668 # Initialize cache, set in/out prompts and printing system
669 self.outputcache = CachedOutput(self,
669 self.outputcache = CachedOutput(self,
670 rc.cache_size,
670 rc.cache_size,
671 rc.pprint,
671 rc.pprint,
672 input_sep = rc.separate_in,
672 input_sep = rc.separate_in,
673 output_sep = rc.separate_out,
673 output_sep = rc.separate_out,
674 output_sep2 = rc.separate_out2,
674 output_sep2 = rc.separate_out2,
675 ps1 = rc.prompt_in1,
675 ps1 = rc.prompt_in1,
676 ps2 = rc.prompt_in2,
676 ps2 = rc.prompt_in2,
677 ps_out = rc.prompt_out,
677 ps_out = rc.prompt_out,
678 pad_left = rc.prompts_pad_left)
678 pad_left = rc.prompts_pad_left)
679
679
680 # user may have over-ridden the default print hook:
680 # user may have over-ridden the default print hook:
681 try:
681 try:
682 self.outputcache.__class__.display = self.hooks.display
682 self.outputcache.__class__.display = self.hooks.display
683 except AttributeError:
683 except AttributeError:
684 pass
684 pass
685
685
686 # I don't like assigning globally to sys, because it means when
686 # I don't like assigning globally to sys, because it means when
687 # embedding instances, each embedded instance overrides the previous
687 # embedding instances, each embedded instance overrides the previous
688 # choice. But sys.displayhook seems to be called internally by exec,
688 # choice. But sys.displayhook seems to be called internally by exec,
689 # so I don't see a way around it. We first save the original and then
689 # so I don't see a way around it. We first save the original and then
690 # overwrite it.
690 # overwrite it.
691 self.sys_displayhook = sys.displayhook
691 self.sys_displayhook = sys.displayhook
692 sys.displayhook = self.outputcache
692 sys.displayhook = self.outputcache
693
693
694 # Set user colors (don't do it in the constructor above so that it
694 # Set user colors (don't do it in the constructor above so that it
695 # doesn't crash if colors option is invalid)
695 # doesn't crash if colors option is invalid)
696 self.magic_colors(rc.colors)
696 self.magic_colors(rc.colors)
697
697
698 # Set calling of pdb on exceptions
698 # Set calling of pdb on exceptions
699 self.call_pdb = rc.pdb
699 self.call_pdb = rc.pdb
700
700
701 # Load user aliases
701 # Load user aliases
702 for alias in rc.alias:
702 for alias in rc.alias:
703 self.magic_alias(alias)
703 self.magic_alias(alias)
704 self.hooks.late_startup_hook()
704 self.hooks.late_startup_hook()
705
705
706 batchrun = False
706 batchrun = False
707 for batchfile in [path(arg) for arg in self.rc.args
707 for batchfile in [path(arg) for arg in self.rc.args
708 if arg.lower().endswith('.ipy')]:
708 if arg.lower().endswith('.ipy')]:
709 if not batchfile.isfile():
709 if not batchfile.isfile():
710 print "No such batch file:", batchfile
710 print "No such batch file:", batchfile
711 continue
711 continue
712 self.api.runlines(batchfile.text())
712 self.api.runlines(batchfile.text())
713 batchrun = True
713 batchrun = True
714 if batchrun:
714 if batchrun:
715 self.exit_now = True
715 self.exit_now = True
716
716
717 def add_builtins(self):
717 def add_builtins(self):
718 """Store ipython references into the builtin namespace.
718 """Store ipython references into the builtin namespace.
719
719
720 Some parts of ipython operate via builtins injected here, which hold a
720 Some parts of ipython operate via builtins injected here, which hold a
721 reference to IPython itself."""
721 reference to IPython itself."""
722
722
723 # TODO: deprecate all except _ip; 'jobs' should be installed
723 # TODO: deprecate all except _ip; 'jobs' should be installed
724 # by an extension and the rest are under _ip, ipalias is redundant
724 # by an extension and the rest are under _ip, ipalias is redundant
725 builtins_new = dict(__IPYTHON__ = self,
725 builtins_new = dict(__IPYTHON__ = self,
726 ip_set_hook = self.set_hook,
726 ip_set_hook = self.set_hook,
727 jobs = self.jobs,
727 jobs = self.jobs,
728 ipmagic = self.ipmagic,
728 ipmagic = self.ipmagic,
729 ipalias = self.ipalias,
729 ipalias = self.ipalias,
730 ipsystem = self.ipsystem,
730 ipsystem = self.ipsystem,
731 ipconfig = self.ipconfig,
731 ipconfig = self.ipconfig,
732 _ip = self.api
732 _ip = self.api
733 )
733 )
734 for biname,bival in builtins_new.items():
734 for biname,bival in builtins_new.items():
735 try:
735 try:
736 # store the orignal value so we can restore it
736 # store the orignal value so we can restore it
737 self.builtins_added[biname] = __builtin__.__dict__[biname]
737 self.builtins_added[biname] = __builtin__.__dict__[biname]
738 except KeyError:
738 except KeyError:
739 # or mark that it wasn't defined, and we'll just delete it at
739 # or mark that it wasn't defined, and we'll just delete it at
740 # cleanup
740 # cleanup
741 self.builtins_added[biname] = Undefined
741 self.builtins_added[biname] = Undefined
742 __builtin__.__dict__[biname] = bival
742 __builtin__.__dict__[biname] = bival
743
743
744 # Keep in the builtins a flag for when IPython is active. We set it
744 # Keep in the builtins a flag for when IPython is active. We set it
745 # with setdefault so that multiple nested IPythons don't clobber one
745 # with setdefault so that multiple nested IPythons don't clobber one
746 # another. Each will increase its value by one upon being activated,
746 # another. Each will increase its value by one upon being activated,
747 # which also gives us a way to determine the nesting level.
747 # which also gives us a way to determine the nesting level.
748 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
748 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
749
749
750 def clean_builtins(self):
750 def clean_builtins(self):
751 """Remove any builtins which might have been added by add_builtins, or
751 """Remove any builtins which might have been added by add_builtins, or
752 restore overwritten ones to their previous values."""
752 restore overwritten ones to their previous values."""
753 for biname,bival in self.builtins_added.items():
753 for biname,bival in self.builtins_added.items():
754 if bival is Undefined:
754 if bival is Undefined:
755 del __builtin__.__dict__[biname]
755 del __builtin__.__dict__[biname]
756 else:
756 else:
757 __builtin__.__dict__[biname] = bival
757 __builtin__.__dict__[biname] = bival
758 self.builtins_added.clear()
758 self.builtins_added.clear()
759
759
760 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
760 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
761 """set_hook(name,hook) -> sets an internal IPython hook.
761 """set_hook(name,hook) -> sets an internal IPython hook.
762
762
763 IPython exposes some of its internal API as user-modifiable hooks. By
763 IPython exposes some of its internal API as user-modifiable hooks. By
764 adding your function to one of these hooks, you can modify IPython's
764 adding your function to one of these hooks, you can modify IPython's
765 behavior to call at runtime your own routines."""
765 behavior to call at runtime your own routines."""
766
766
767 # At some point in the future, this should validate the hook before it
767 # At some point in the future, this should validate the hook before it
768 # accepts it. Probably at least check that the hook takes the number
768 # accepts it. Probably at least check that the hook takes the number
769 # of args it's supposed to.
769 # of args it's supposed to.
770
770
771 f = new.instancemethod(hook,self,self.__class__)
771 f = new.instancemethod(hook,self,self.__class__)
772
772
773 # check if the hook is for strdispatcher first
773 # check if the hook is for strdispatcher first
774 if str_key is not None:
774 if str_key is not None:
775 sdp = self.strdispatchers.get(name, StrDispatch())
775 sdp = self.strdispatchers.get(name, StrDispatch())
776 sdp.add_s(str_key, f, priority )
776 sdp.add_s(str_key, f, priority )
777 self.strdispatchers[name] = sdp
777 self.strdispatchers[name] = sdp
778 return
778 return
779 if re_key is not None:
779 if re_key is not None:
780 sdp = self.strdispatchers.get(name, StrDispatch())
780 sdp = self.strdispatchers.get(name, StrDispatch())
781 sdp.add_re(re.compile(re_key), f, priority )
781 sdp.add_re(re.compile(re_key), f, priority )
782 self.strdispatchers[name] = sdp
782 self.strdispatchers[name] = sdp
783 return
783 return
784
784
785 dp = getattr(self.hooks, name, None)
785 dp = getattr(self.hooks, name, None)
786 if name not in IPython.hooks.__all__:
786 if name not in IPython.hooks.__all__:
787 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
787 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
788 if not dp:
788 if not dp:
789 dp = IPython.hooks.CommandChainDispatcher()
789 dp = IPython.hooks.CommandChainDispatcher()
790
790
791 try:
791 try:
792 dp.add(f,priority)
792 dp.add(f,priority)
793 except AttributeError:
793 except AttributeError:
794 # it was not commandchain, plain old func - replace
794 # it was not commandchain, plain old func - replace
795 dp = f
795 dp = f
796
796
797 setattr(self.hooks,name, dp)
797 setattr(self.hooks,name, dp)
798
798
799
799
800 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
800 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
801
801
802 def set_crash_handler(self,crashHandler):
802 def set_crash_handler(self,crashHandler):
803 """Set the IPython crash handler.
803 """Set the IPython crash handler.
804
804
805 This must be a callable with a signature suitable for use as
805 This must be a callable with a signature suitable for use as
806 sys.excepthook."""
806 sys.excepthook."""
807
807
808 # Install the given crash handler as the Python exception hook
808 # Install the given crash handler as the Python exception hook
809 sys.excepthook = crashHandler
809 sys.excepthook = crashHandler
810
810
811 # The instance will store a pointer to this, so that runtime code
811 # The instance will store a pointer to this, so that runtime code
812 # (such as magics) can access it. This is because during the
812 # (such as magics) can access it. This is because during the
813 # read-eval loop, it gets temporarily overwritten (to deal with GUI
813 # read-eval loop, it gets temporarily overwritten (to deal with GUI
814 # frameworks).
814 # frameworks).
815 self.sys_excepthook = sys.excepthook
815 self.sys_excepthook = sys.excepthook
816
816
817
817
818 def set_custom_exc(self,exc_tuple,handler):
818 def set_custom_exc(self,exc_tuple,handler):
819 """set_custom_exc(exc_tuple,handler)
819 """set_custom_exc(exc_tuple,handler)
820
820
821 Set a custom exception handler, which will be called if any of the
821 Set a custom exception handler, which will be called if any of the
822 exceptions in exc_tuple occur in the mainloop (specifically, in the
822 exceptions in exc_tuple occur in the mainloop (specifically, in the
823 runcode() method.
823 runcode() method.
824
824
825 Inputs:
825 Inputs:
826
826
827 - exc_tuple: a *tuple* of valid exceptions to call the defined
827 - exc_tuple: a *tuple* of valid exceptions to call the defined
828 handler for. It is very important that you use a tuple, and NOT A
828 handler for. It is very important that you use a tuple, and NOT A
829 LIST here, because of the way Python's except statement works. If
829 LIST here, because of the way Python's except statement works. If
830 you only want to trap a single exception, use a singleton tuple:
830 you only want to trap a single exception, use a singleton tuple:
831
831
832 exc_tuple == (MyCustomException,)
832 exc_tuple == (MyCustomException,)
833
833
834 - handler: this must be defined as a function with the following
834 - handler: this must be defined as a function with the following
835 basic interface: def my_handler(self,etype,value,tb).
835 basic interface: def my_handler(self,etype,value,tb).
836
836
837 This will be made into an instance method (via new.instancemethod)
837 This will be made into an instance method (via new.instancemethod)
838 of IPython itself, and it will be called if any of the exceptions
838 of IPython itself, and it will be called if any of the exceptions
839 listed in the exc_tuple are caught. If the handler is None, an
839 listed in the exc_tuple are caught. If the handler is None, an
840 internal basic one is used, which just prints basic info.
840 internal basic one is used, which just prints basic info.
841
841
842 WARNING: by putting in your own exception handler into IPython's main
842 WARNING: by putting in your own exception handler into IPython's main
843 execution loop, you run a very good chance of nasty crashes. This
843 execution loop, you run a very good chance of nasty crashes. This
844 facility should only be used if you really know what you are doing."""
844 facility should only be used if you really know what you are doing."""
845
845
846 assert type(exc_tuple)==type(()) , \
846 assert type(exc_tuple)==type(()) , \
847 "The custom exceptions must be given AS A TUPLE."
847 "The custom exceptions must be given AS A TUPLE."
848
848
849 def dummy_handler(self,etype,value,tb):
849 def dummy_handler(self,etype,value,tb):
850 print '*** Simple custom exception handler ***'
850 print '*** Simple custom exception handler ***'
851 print 'Exception type :',etype
851 print 'Exception type :',etype
852 print 'Exception value:',value
852 print 'Exception value:',value
853 print 'Traceback :',tb
853 print 'Traceback :',tb
854 print 'Source code :','\n'.join(self.buffer)
854 print 'Source code :','\n'.join(self.buffer)
855
855
856 if handler is None: handler = dummy_handler
856 if handler is None: handler = dummy_handler
857
857
858 self.CustomTB = new.instancemethod(handler,self,self.__class__)
858 self.CustomTB = new.instancemethod(handler,self,self.__class__)
859 self.custom_exceptions = exc_tuple
859 self.custom_exceptions = exc_tuple
860
860
861 def set_custom_completer(self,completer,pos=0):
861 def set_custom_completer(self,completer,pos=0):
862 """set_custom_completer(completer,pos=0)
862 """set_custom_completer(completer,pos=0)
863
863
864 Adds a new custom completer function.
864 Adds a new custom completer function.
865
865
866 The position argument (defaults to 0) is the index in the completers
866 The position argument (defaults to 0) is the index in the completers
867 list where you want the completer to be inserted."""
867 list where you want the completer to be inserted."""
868
868
869 newcomp = new.instancemethod(completer,self.Completer,
869 newcomp = new.instancemethod(completer,self.Completer,
870 self.Completer.__class__)
870 self.Completer.__class__)
871 self.Completer.matchers.insert(pos,newcomp)
871 self.Completer.matchers.insert(pos,newcomp)
872
872
873 def _get_call_pdb(self):
873 def _get_call_pdb(self):
874 return self._call_pdb
874 return self._call_pdb
875
875
876 def _set_call_pdb(self,val):
876 def _set_call_pdb(self,val):
877
877
878 if val not in (0,1,False,True):
878 if val not in (0,1,False,True):
879 raise ValueError,'new call_pdb value must be boolean'
879 raise ValueError,'new call_pdb value must be boolean'
880
880
881 # store value in instance
881 # store value in instance
882 self._call_pdb = val
882 self._call_pdb = val
883
883
884 # notify the actual exception handlers
884 # notify the actual exception handlers
885 self.InteractiveTB.call_pdb = val
885 self.InteractiveTB.call_pdb = val
886 if self.isthreaded:
886 if self.isthreaded:
887 try:
887 try:
888 self.sys_excepthook.call_pdb = val
888 self.sys_excepthook.call_pdb = val
889 except:
889 except:
890 warn('Failed to activate pdb for threaded exception handler')
890 warn('Failed to activate pdb for threaded exception handler')
891
891
892 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
892 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
893 'Control auto-activation of pdb at exceptions')
893 'Control auto-activation of pdb at exceptions')
894
894
895
895
896 # These special functions get installed in the builtin namespace, to
896 # These special functions get installed in the builtin namespace, to
897 # provide programmatic (pure python) access to magics, aliases and system
897 # provide programmatic (pure python) access to magics, aliases and system
898 # calls. This is important for logging, user scripting, and more.
898 # calls. This is important for logging, user scripting, and more.
899
899
900 # We are basically exposing, via normal python functions, the three
900 # We are basically exposing, via normal python functions, the three
901 # mechanisms in which ipython offers special call modes (magics for
901 # mechanisms in which ipython offers special call modes (magics for
902 # internal control, aliases for direct system access via pre-selected
902 # internal control, aliases for direct system access via pre-selected
903 # names, and !cmd for calling arbitrary system commands).
903 # names, and !cmd for calling arbitrary system commands).
904
904
905 def ipmagic(self,arg_s):
905 def ipmagic(self,arg_s):
906 """Call a magic function by name.
906 """Call a magic function by name.
907
907
908 Input: a string containing the name of the magic function to call and any
908 Input: a string containing the name of the magic function to call and any
909 additional arguments to be passed to the magic.
909 additional arguments to be passed to the magic.
910
910
911 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
911 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
912 prompt:
912 prompt:
913
913
914 In[1]: %name -opt foo bar
914 In[1]: %name -opt foo bar
915
915
916 To call a magic without arguments, simply use ipmagic('name').
916 To call a magic without arguments, simply use ipmagic('name').
917
917
918 This provides a proper Python function to call IPython's magics in any
918 This provides a proper Python function to call IPython's magics in any
919 valid Python code you can type at the interpreter, including loops and
919 valid Python code you can type at the interpreter, including loops and
920 compound statements. It is added by IPython to the Python builtin
920 compound statements. It is added by IPython to the Python builtin
921 namespace upon initialization."""
921 namespace upon initialization."""
922
922
923 args = arg_s.split(' ',1)
923 args = arg_s.split(' ',1)
924 magic_name = args[0]
924 magic_name = args[0]
925 magic_name = magic_name.lstrip(self.ESC_MAGIC)
925 magic_name = magic_name.lstrip(self.ESC_MAGIC)
926
926
927 try:
927 try:
928 magic_args = args[1]
928 magic_args = args[1]
929 except IndexError:
929 except IndexError:
930 magic_args = ''
930 magic_args = ''
931 fn = getattr(self,'magic_'+magic_name,None)
931 fn = getattr(self,'magic_'+magic_name,None)
932 if fn is None:
932 if fn is None:
933 error("Magic function `%s` not found." % magic_name)
933 error("Magic function `%s` not found." % magic_name)
934 else:
934 else:
935 magic_args = self.var_expand(magic_args,1)
935 magic_args = self.var_expand(magic_args,1)
936 return fn(magic_args)
936 return fn(magic_args)
937
937
938 def ipalias(self,arg_s):
938 def ipalias(self,arg_s):
939 """Call an alias by name.
939 """Call an alias by name.
940
940
941 Input: a string containing the name of the alias to call and any
941 Input: a string containing the name of the alias to call and any
942 additional arguments to be passed to the magic.
942 additional arguments to be passed to the magic.
943
943
944 ipalias('name -opt foo bar') is equivalent to typing at the ipython
944 ipalias('name -opt foo bar') is equivalent to typing at the ipython
945 prompt:
945 prompt:
946
946
947 In[1]: name -opt foo bar
947 In[1]: name -opt foo bar
948
948
949 To call an alias without arguments, simply use ipalias('name').
949 To call an alias without arguments, simply use ipalias('name').
950
950
951 This provides a proper Python function to call IPython's aliases in any
951 This provides a proper Python function to call IPython's aliases in any
952 valid Python code you can type at the interpreter, including loops and
952 valid Python code you can type at the interpreter, including loops and
953 compound statements. It is added by IPython to the Python builtin
953 compound statements. It is added by IPython to the Python builtin
954 namespace upon initialization."""
954 namespace upon initialization."""
955
955
956 args = arg_s.split(' ',1)
956 args = arg_s.split(' ',1)
957 alias_name = args[0]
957 alias_name = args[0]
958 try:
958 try:
959 alias_args = args[1]
959 alias_args = args[1]
960 except IndexError:
960 except IndexError:
961 alias_args = ''
961 alias_args = ''
962 if alias_name in self.alias_table:
962 if alias_name in self.alias_table:
963 self.call_alias(alias_name,alias_args)
963 self.call_alias(alias_name,alias_args)
964 else:
964 else:
965 error("Alias `%s` not found." % alias_name)
965 error("Alias `%s` not found." % alias_name)
966
966
967 def ipconfig(self,key=None,value=None):
967 def ipconfig(self,key=None,value=None):
968 """Manipulate the IPython config.
968 """Manipulate the IPython config.
969
969
970 This provides a python interface to
970 This provides a python interface to
971 If called with no arguments, it prints the internal IPython config
971 If called with no arguments, it prints the internal IPython config
972
972
973 Optional arguments:
973 Optional arguments:
974
974
975 - key(None): if given, what key of the rc structure to return.
975 - key(None): if given, what key of the rc structure to return.
976
976
977 - value(None): if given, set the key to this value."""
977 - value(None): if given, set the key to this value."""
978
978
979 if key is None:
979 if key is None:
980 page('Current configuration structure:\n'+
980 page('Current configuration structure:\n'+
981 pformat(self.rc.dict()))
981 pformat(self.rc.dict()))
982 else:
982 else:
983 if value is None:
983 if value is None:
984 print '%s -> %s' % (key,self.rc[key])
984 print '%s -> %s' % (key,self.rc[key])
985 else:
985 else:
986 if key not in self.rc:
986 if key not in self.rc:
987 raise KeyError(str(key))
987 raise KeyError(str(key))
988 self.rc[key] = value
988 self.rc[key] = value
989
989
990 def ipsystem(self,arg_s):
990 def ipsystem(self,arg_s):
991 """Make a system call, using IPython."""
991 """Make a system call, using IPython."""
992
992
993 self.system(arg_s)
993 self.system(arg_s)
994
994
995 def complete(self,text):
995 def complete(self,text):
996 """Return a sorted list of all possible completions on text.
996 """Return a sorted list of all possible completions on text.
997
997
998 Inputs:
998 Inputs:
999
999
1000 - text: a string of text to be completed on.
1000 - text: a string of text to be completed on.
1001
1001
1002 This is a wrapper around the completion mechanism, similar to what
1002 This is a wrapper around the completion mechanism, similar to what
1003 readline does at the command line when the TAB key is hit. By
1003 readline does at the command line when the TAB key is hit. By
1004 exposing it as a method, it can be used by other non-readline
1004 exposing it as a method, it can be used by other non-readline
1005 environments (such as GUIs) for text completion.
1005 environments (such as GUIs) for text completion.
1006
1006
1007 Simple usage example:
1007 Simple usage example:
1008
1008
1009 In [1]: x = 'hello'
1009 In [1]: x = 'hello'
1010
1010
1011 In [2]: __IP.complete('x.l')
1011 In [2]: __IP.complete('x.l')
1012 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1012 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1013
1013
1014 complete = self.Completer.complete
1014 complete = self.Completer.complete
1015 state = 0
1015 state = 0
1016 # use a dict so we get unique keys, since ipyhton's multiple
1016 # use a dict so we get unique keys, since ipyhton's multiple
1017 # completers can return duplicates.
1017 # completers can return duplicates.
1018 comps = {}
1018 comps = {}
1019 while True:
1019 while True:
1020 newcomp = complete(text,state)
1020 newcomp = complete(text,state)
1021 if newcomp is None:
1021 if newcomp is None:
1022 break
1022 break
1023 comps[newcomp] = 1
1023 comps[newcomp] = 1
1024 state += 1
1024 state += 1
1025 outcomps = comps.keys()
1025 outcomps = comps.keys()
1026 outcomps.sort()
1026 outcomps.sort()
1027 return outcomps
1027 return outcomps
1028
1028
1029 def set_completer_frame(self, frame=None):
1029 def set_completer_frame(self, frame=None):
1030 if frame:
1030 if frame:
1031 self.Completer.namespace = frame.f_locals
1031 self.Completer.namespace = frame.f_locals
1032 self.Completer.global_namespace = frame.f_globals
1032 self.Completer.global_namespace = frame.f_globals
1033 else:
1033 else:
1034 self.Completer.namespace = self.user_ns
1034 self.Completer.namespace = self.user_ns
1035 self.Completer.global_namespace = self.user_global_ns
1035 self.Completer.global_namespace = self.user_global_ns
1036
1036
1037 def init_auto_alias(self):
1037 def init_auto_alias(self):
1038 """Define some aliases automatically.
1038 """Define some aliases automatically.
1039
1039
1040 These are ALL parameter-less aliases"""
1040 These are ALL parameter-less aliases"""
1041
1041
1042 for alias,cmd in self.auto_alias:
1042 for alias,cmd in self.auto_alias:
1043 self.alias_table[alias] = (0,cmd)
1043 self.alias_table[alias] = (0,cmd)
1044
1044
1045 def alias_table_validate(self,verbose=0):
1045 def alias_table_validate(self,verbose=0):
1046 """Update information about the alias table.
1046 """Update information about the alias table.
1047
1047
1048 In particular, make sure no Python keywords/builtins are in it."""
1048 In particular, make sure no Python keywords/builtins are in it."""
1049
1049
1050 no_alias = self.no_alias
1050 no_alias = self.no_alias
1051 for k in self.alias_table.keys():
1051 for k in self.alias_table.keys():
1052 if k in no_alias:
1052 if k in no_alias:
1053 del self.alias_table[k]
1053 del self.alias_table[k]
1054 if verbose:
1054 if verbose:
1055 print ("Deleting alias <%s>, it's a Python "
1055 print ("Deleting alias <%s>, it's a Python "
1056 "keyword or builtin." % k)
1056 "keyword or builtin." % k)
1057
1057
1058 def set_autoindent(self,value=None):
1058 def set_autoindent(self,value=None):
1059 """Set the autoindent flag, checking for readline support.
1059 """Set the autoindent flag, checking for readline support.
1060
1060
1061 If called with no arguments, it acts as a toggle."""
1061 If called with no arguments, it acts as a toggle."""
1062
1062
1063 if not self.has_readline:
1063 if not self.has_readline:
1064 if os.name == 'posix':
1064 if os.name == 'posix':
1065 warn("The auto-indent feature requires the readline library")
1065 warn("The auto-indent feature requires the readline library")
1066 self.autoindent = 0
1066 self.autoindent = 0
1067 return
1067 return
1068 if value is None:
1068 if value is None:
1069 self.autoindent = not self.autoindent
1069 self.autoindent = not self.autoindent
1070 else:
1070 else:
1071 self.autoindent = value
1071 self.autoindent = value
1072
1072
1073 def rc_set_toggle(self,rc_field,value=None):
1073 def rc_set_toggle(self,rc_field,value=None):
1074 """Set or toggle a field in IPython's rc config. structure.
1074 """Set or toggle a field in IPython's rc config. structure.
1075
1075
1076 If called with no arguments, it acts as a toggle.
1076 If called with no arguments, it acts as a toggle.
1077
1077
1078 If called with a non-existent field, the resulting AttributeError
1078 If called with a non-existent field, the resulting AttributeError
1079 exception will propagate out."""
1079 exception will propagate out."""
1080
1080
1081 rc_val = getattr(self.rc,rc_field)
1081 rc_val = getattr(self.rc,rc_field)
1082 if value is None:
1082 if value is None:
1083 value = not rc_val
1083 value = not rc_val
1084 setattr(self.rc,rc_field,value)
1084 setattr(self.rc,rc_field,value)
1085
1085
1086 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1086 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1087 """Install the user configuration directory.
1087 """Install the user configuration directory.
1088
1088
1089 Can be called when running for the first time or to upgrade the user's
1089 Can be called when running for the first time or to upgrade the user's
1090 .ipython/ directory with the mode parameter. Valid modes are 'install'
1090 .ipython/ directory with the mode parameter. Valid modes are 'install'
1091 and 'upgrade'."""
1091 and 'upgrade'."""
1092
1092
1093 def wait():
1093 def wait():
1094 try:
1094 try:
1095 raw_input("Please press <RETURN> to start IPython.")
1095 raw_input("Please press <RETURN> to start IPython.")
1096 except EOFError:
1096 except EOFError:
1097 print >> Term.cout
1097 print >> Term.cout
1098 print '*'*70
1098 print '*'*70
1099
1099
1100 cwd = os.getcwd() # remember where we started
1100 cwd = os.getcwd() # remember where we started
1101 glb = glob.glob
1101 glb = glob.glob
1102 print '*'*70
1102 print '*'*70
1103 if mode == 'install':
1103 if mode == 'install':
1104 print \
1104 print \
1105 """Welcome to IPython. I will try to create a personal configuration directory
1105 """Welcome to IPython. I will try to create a personal configuration directory
1106 where you can customize many aspects of IPython's functionality in:\n"""
1106 where you can customize many aspects of IPython's functionality in:\n"""
1107 else:
1107 else:
1108 print 'I am going to upgrade your configuration in:'
1108 print 'I am going to upgrade your configuration in:'
1109
1109
1110 print ipythondir
1110 print ipythondir
1111
1111
1112 rcdirend = os.path.join('IPython','UserConfig')
1112 rcdirend = os.path.join('IPython','UserConfig')
1113 cfg = lambda d: os.path.join(d,rcdirend)
1113 cfg = lambda d: os.path.join(d,rcdirend)
1114 try:
1114 try:
1115 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1115 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1116 except IOError:
1116 except IOError:
1117 warning = """
1117 warning = """
1118 Installation error. IPython's directory was not found.
1118 Installation error. IPython's directory was not found.
1119
1119
1120 Check the following:
1120 Check the following:
1121
1121
1122 The ipython/IPython directory should be in a directory belonging to your
1122 The ipython/IPython directory should be in a directory belonging to your
1123 PYTHONPATH environment variable (that is, it should be in a directory
1123 PYTHONPATH environment variable (that is, it should be in a directory
1124 belonging to sys.path). You can copy it explicitly there or just link to it.
1124 belonging to sys.path). You can copy it explicitly there or just link to it.
1125
1125
1126 IPython will proceed with builtin defaults.
1126 IPython will proceed with builtin defaults.
1127 """
1127 """
1128 warn(warning)
1128 warn(warning)
1129 wait()
1129 wait()
1130 return
1130 return
1131
1131
1132 if mode == 'install':
1132 if mode == 'install':
1133 try:
1133 try:
1134 shutil.copytree(rcdir,ipythondir)
1134 shutil.copytree(rcdir,ipythondir)
1135 os.chdir(ipythondir)
1135 os.chdir(ipythondir)
1136 rc_files = glb("ipythonrc*")
1136 rc_files = glb("ipythonrc*")
1137 for rc_file in rc_files:
1137 for rc_file in rc_files:
1138 os.rename(rc_file,rc_file+rc_suffix)
1138 os.rename(rc_file,rc_file+rc_suffix)
1139 except:
1139 except:
1140 warning = """
1140 warning = """
1141
1141
1142 There was a problem with the installation:
1142 There was a problem with the installation:
1143 %s
1143 %s
1144 Try to correct it or contact the developers if you think it's a bug.
1144 Try to correct it or contact the developers if you think it's a bug.
1145 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1145 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1146 warn(warning)
1146 warn(warning)
1147 wait()
1147 wait()
1148 return
1148 return
1149
1149
1150 elif mode == 'upgrade':
1150 elif mode == 'upgrade':
1151 try:
1151 try:
1152 os.chdir(ipythondir)
1152 os.chdir(ipythondir)
1153 except:
1153 except:
1154 print """
1154 print """
1155 Can not upgrade: changing to directory %s failed. Details:
1155 Can not upgrade: changing to directory %s failed. Details:
1156 %s
1156 %s
1157 """ % (ipythondir,sys.exc_info()[1])
1157 """ % (ipythondir,sys.exc_info()[1])
1158 wait()
1158 wait()
1159 return
1159 return
1160 else:
1160 else:
1161 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1161 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1162 for new_full_path in sources:
1162 for new_full_path in sources:
1163 new_filename = os.path.basename(new_full_path)
1163 new_filename = os.path.basename(new_full_path)
1164 if new_filename.startswith('ipythonrc'):
1164 if new_filename.startswith('ipythonrc'):
1165 new_filename = new_filename + rc_suffix
1165 new_filename = new_filename + rc_suffix
1166 # The config directory should only contain files, skip any
1166 # The config directory should only contain files, skip any
1167 # directories which may be there (like CVS)
1167 # directories which may be there (like CVS)
1168 if os.path.isdir(new_full_path):
1168 if os.path.isdir(new_full_path):
1169 continue
1169 continue
1170 if os.path.exists(new_filename):
1170 if os.path.exists(new_filename):
1171 old_file = new_filename+'.old'
1171 old_file = new_filename+'.old'
1172 if os.path.exists(old_file):
1172 if os.path.exists(old_file):
1173 os.remove(old_file)
1173 os.remove(old_file)
1174 os.rename(new_filename,old_file)
1174 os.rename(new_filename,old_file)
1175 shutil.copy(new_full_path,new_filename)
1175 shutil.copy(new_full_path,new_filename)
1176 else:
1176 else:
1177 raise ValueError,'unrecognized mode for install:',`mode`
1177 raise ValueError,'unrecognized mode for install:',`mode`
1178
1178
1179 # Fix line-endings to those native to each platform in the config
1179 # Fix line-endings to those native to each platform in the config
1180 # directory.
1180 # directory.
1181 try:
1181 try:
1182 os.chdir(ipythondir)
1182 os.chdir(ipythondir)
1183 except:
1183 except:
1184 print """
1184 print """
1185 Problem: changing to directory %s failed.
1185 Problem: changing to directory %s failed.
1186 Details:
1186 Details:
1187 %s
1187 %s
1188
1188
1189 Some configuration files may have incorrect line endings. This should not
1189 Some configuration files may have incorrect line endings. This should not
1190 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1190 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1191 wait()
1191 wait()
1192 else:
1192 else:
1193 for fname in glb('ipythonrc*'):
1193 for fname in glb('ipythonrc*'):
1194 try:
1194 try:
1195 native_line_ends(fname,backup=0)
1195 native_line_ends(fname,backup=0)
1196 except IOError:
1196 except IOError:
1197 pass
1197 pass
1198
1198
1199 if mode == 'install':
1199 if mode == 'install':
1200 print """
1200 print """
1201 Successful installation!
1201 Successful installation!
1202
1202
1203 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1203 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1204 IPython manual (there are both HTML and PDF versions supplied with the
1204 IPython manual (there are both HTML and PDF versions supplied with the
1205 distribution) to make sure that your system environment is properly configured
1205 distribution) to make sure that your system environment is properly configured
1206 to take advantage of IPython's features.
1206 to take advantage of IPython's features.
1207
1207
1208 Important note: the configuration system has changed! The old system is
1208 Important note: the configuration system has changed! The old system is
1209 still in place, but its setting may be partly overridden by the settings in
1209 still in place, but its setting may be partly overridden by the settings in
1210 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1210 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1211 if some of the new settings bother you.
1211 if some of the new settings bother you.
1212
1212
1213 """
1213 """
1214 else:
1214 else:
1215 print """
1215 print """
1216 Successful upgrade!
1216 Successful upgrade!
1217
1217
1218 All files in your directory:
1218 All files in your directory:
1219 %(ipythondir)s
1219 %(ipythondir)s
1220 which would have been overwritten by the upgrade were backed up with a .old
1220 which would have been overwritten by the upgrade were backed up with a .old
1221 extension. If you had made particular customizations in those files you may
1221 extension. If you had made particular customizations in those files you may
1222 want to merge them back into the new files.""" % locals()
1222 want to merge them back into the new files.""" % locals()
1223 wait()
1223 wait()
1224 os.chdir(cwd)
1224 os.chdir(cwd)
1225 # end user_setup()
1225 # end user_setup()
1226
1226
1227 def atexit_operations(self):
1227 def atexit_operations(self):
1228 """This will be executed at the time of exit.
1228 """This will be executed at the time of exit.
1229
1229
1230 Saving of persistent data should be performed here. """
1230 Saving of persistent data should be performed here. """
1231
1231
1232 #print '*** IPython exit cleanup ***' # dbg
1232 #print '*** IPython exit cleanup ***' # dbg
1233 # input history
1233 # input history
1234 self.savehist()
1234 self.savehist()
1235
1235
1236 # Cleanup all tempfiles left around
1236 # Cleanup all tempfiles left around
1237 for tfile in self.tempfiles:
1237 for tfile in self.tempfiles:
1238 try:
1238 try:
1239 os.unlink(tfile)
1239 os.unlink(tfile)
1240 except OSError:
1240 except OSError:
1241 pass
1241 pass
1242
1242
1243 # save the "persistent data" catch-all dictionary
1243 # save the "persistent data" catch-all dictionary
1244 self.hooks.shutdown_hook()
1244 self.hooks.shutdown_hook()
1245
1245
1246 def savehist(self):
1246 def savehist(self):
1247 """Save input history to a file (via readline library)."""
1247 """Save input history to a file (via readline library)."""
1248 try:
1248 try:
1249 self.readline.write_history_file(self.histfile)
1249 self.readline.write_history_file(self.histfile)
1250 except:
1250 except:
1251 print 'Unable to save IPython command history to file: ' + \
1251 print 'Unable to save IPython command history to file: ' + \
1252 `self.histfile`
1252 `self.histfile`
1253
1253
1254 def history_saving_wrapper(self, func):
1254 def history_saving_wrapper(self, func):
1255 """ Wrap func for readline history saving
1255 """ Wrap func for readline history saving
1256
1256
1257 Convert func into callable that saves & restores
1257 Convert func into callable that saves & restores
1258 history around the call """
1258 history around the call """
1259
1259
1260 if not self.has_readline:
1260 if not self.has_readline:
1261 return func
1261 return func
1262
1262
1263 def wrapper():
1263 def wrapper():
1264 self.savehist()
1264 self.savehist()
1265 try:
1265 try:
1266 func()
1266 func()
1267 finally:
1267 finally:
1268 readline.read_history_file(self.histfile)
1268 readline.read_history_file(self.histfile)
1269 return wrapper
1269 return wrapper
1270
1270
1271
1271
1272 def pre_readline(self):
1272 def pre_readline(self):
1273 """readline hook to be used at the start of each line.
1273 """readline hook to be used at the start of each line.
1274
1274
1275 Currently it handles auto-indent only."""
1275 Currently it handles auto-indent only."""
1276
1276
1277 #debugx('self.indent_current_nsp','pre_readline:')
1277 #debugx('self.indent_current_nsp','pre_readline:')
1278 self.readline.insert_text(self.indent_current_str())
1278 self.readline.insert_text(self.indent_current_str())
1279
1279
1280 def init_readline(self):
1280 def init_readline(self):
1281 """Command history completion/saving/reloading."""
1281 """Command history completion/saving/reloading."""
1282
1282
1283 import IPython.rlineimpl as readline
1283 import IPython.rlineimpl as readline
1284 if not readline.have_readline:
1284 if not readline.have_readline:
1285 self.has_readline = 0
1285 self.has_readline = 0
1286 self.readline = None
1286 self.readline = None
1287 # no point in bugging windows users with this every time:
1287 # no point in bugging windows users with this every time:
1288 warn('Readline services not available on this platform.')
1288 warn('Readline services not available on this platform.')
1289 else:
1289 else:
1290 sys.modules['readline'] = readline
1290 sys.modules['readline'] = readline
1291 import atexit
1291 import atexit
1292 from IPython.completer import IPCompleter
1292 from IPython.completer import IPCompleter
1293 self.Completer = IPCompleter(self,
1293 self.Completer = IPCompleter(self,
1294 self.user_ns,
1294 self.user_ns,
1295 self.user_global_ns,
1295 self.user_global_ns,
1296 self.rc.readline_omit__names,
1296 self.rc.readline_omit__names,
1297 self.alias_table)
1297 self.alias_table)
1298 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1298 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1299 self.strdispatchers['complete_command'] = sdisp
1299 self.strdispatchers['complete_command'] = sdisp
1300 self.Completer.custom_completers = sdisp
1300 self.Completer.custom_completers = sdisp
1301 # Platform-specific configuration
1301 # Platform-specific configuration
1302 if os.name == 'nt':
1302 if os.name == 'nt':
1303 self.readline_startup_hook = readline.set_pre_input_hook
1303 self.readline_startup_hook = readline.set_pre_input_hook
1304 else:
1304 else:
1305 self.readline_startup_hook = readline.set_startup_hook
1305 self.readline_startup_hook = readline.set_startup_hook
1306
1306
1307 # Load user's initrc file (readline config)
1307 # Load user's initrc file (readline config)
1308 inputrc_name = os.environ.get('INPUTRC')
1308 inputrc_name = os.environ.get('INPUTRC')
1309 if inputrc_name is None:
1309 if inputrc_name is None:
1310 home_dir = get_home_dir()
1310 home_dir = get_home_dir()
1311 if home_dir is not None:
1311 if home_dir is not None:
1312 inputrc_name = os.path.join(home_dir,'.inputrc')
1312 inputrc_name = os.path.join(home_dir,'.inputrc')
1313 if os.path.isfile(inputrc_name):
1313 if os.path.isfile(inputrc_name):
1314 try:
1314 try:
1315 readline.read_init_file(inputrc_name)
1315 readline.read_init_file(inputrc_name)
1316 except:
1316 except:
1317 warn('Problems reading readline initialization file <%s>'
1317 warn('Problems reading readline initialization file <%s>'
1318 % inputrc_name)
1318 % inputrc_name)
1319
1319
1320 self.has_readline = 1
1320 self.has_readline = 1
1321 self.readline = readline
1321 self.readline = readline
1322 # save this in sys so embedded copies can restore it properly
1322 # save this in sys so embedded copies can restore it properly
1323 sys.ipcompleter = self.Completer.complete
1323 sys.ipcompleter = self.Completer.complete
1324 readline.set_completer(self.Completer.complete)
1324 readline.set_completer(self.Completer.complete)
1325
1325
1326 # Configure readline according to user's prefs
1326 # Configure readline according to user's prefs
1327 for rlcommand in self.rc.readline_parse_and_bind:
1327 for rlcommand in self.rc.readline_parse_and_bind:
1328 readline.parse_and_bind(rlcommand)
1328 readline.parse_and_bind(rlcommand)
1329
1329
1330 # remove some chars from the delimiters list
1330 # remove some chars from the delimiters list
1331 delims = readline.get_completer_delims()
1331 delims = readline.get_completer_delims()
1332 delims = delims.translate(string._idmap,
1332 delims = delims.translate(string._idmap,
1333 self.rc.readline_remove_delims)
1333 self.rc.readline_remove_delims)
1334 readline.set_completer_delims(delims)
1334 readline.set_completer_delims(delims)
1335 # otherwise we end up with a monster history after a while:
1335 # otherwise we end up with a monster history after a while:
1336 readline.set_history_length(1000)
1336 readline.set_history_length(1000)
1337 try:
1337 try:
1338 #print '*** Reading readline history' # dbg
1338 #print '*** Reading readline history' # dbg
1339 readline.read_history_file(self.histfile)
1339 readline.read_history_file(self.histfile)
1340 except IOError:
1340 except IOError:
1341 pass # It doesn't exist yet.
1341 pass # It doesn't exist yet.
1342
1342
1343 atexit.register(self.atexit_operations)
1343 atexit.register(self.atexit_operations)
1344 del atexit
1344 del atexit
1345
1345
1346 # Configure auto-indent for all platforms
1346 # Configure auto-indent for all platforms
1347 self.set_autoindent(self.rc.autoindent)
1347 self.set_autoindent(self.rc.autoindent)
1348
1348
1349 def ask_yes_no(self,prompt,default=True):
1349 def ask_yes_no(self,prompt,default=True):
1350 if self.rc.quiet:
1350 if self.rc.quiet:
1351 return True
1351 return True
1352 return ask_yes_no(prompt,default)
1352 return ask_yes_no(prompt,default)
1353
1353
1354 def _should_recompile(self,e):
1354 def _should_recompile(self,e):
1355 """Utility routine for edit_syntax_error"""
1355 """Utility routine for edit_syntax_error"""
1356
1356
1357 if e.filename in ('<ipython console>','<input>','<string>',
1357 if e.filename in ('<ipython console>','<input>','<string>',
1358 '<console>','<BackgroundJob compilation>',
1358 '<console>','<BackgroundJob compilation>',
1359 None):
1359 None):
1360
1360
1361 return False
1361 return False
1362 try:
1362 try:
1363 if (self.rc.autoedit_syntax and
1363 if (self.rc.autoedit_syntax and
1364 not self.ask_yes_no('Return to editor to correct syntax error? '
1364 not self.ask_yes_no('Return to editor to correct syntax error? '
1365 '[Y/n] ','y')):
1365 '[Y/n] ','y')):
1366 return False
1366 return False
1367 except EOFError:
1367 except EOFError:
1368 return False
1368 return False
1369
1369
1370 def int0(x):
1370 def int0(x):
1371 try:
1371 try:
1372 return int(x)
1372 return int(x)
1373 except TypeError:
1373 except TypeError:
1374 return 0
1374 return 0
1375 # always pass integer line and offset values to editor hook
1375 # always pass integer line and offset values to editor hook
1376 self.hooks.fix_error_editor(e.filename,
1376 self.hooks.fix_error_editor(e.filename,
1377 int0(e.lineno),int0(e.offset),e.msg)
1377 int0(e.lineno),int0(e.offset),e.msg)
1378 return True
1378 return True
1379
1379
1380 def edit_syntax_error(self):
1380 def edit_syntax_error(self):
1381 """The bottom half of the syntax error handler called in the main loop.
1381 """The bottom half of the syntax error handler called in the main loop.
1382
1382
1383 Loop until syntax error is fixed or user cancels.
1383 Loop until syntax error is fixed or user cancels.
1384 """
1384 """
1385
1385
1386 while self.SyntaxTB.last_syntax_error:
1386 while self.SyntaxTB.last_syntax_error:
1387 # copy and clear last_syntax_error
1387 # copy and clear last_syntax_error
1388 err = self.SyntaxTB.clear_err_state()
1388 err = self.SyntaxTB.clear_err_state()
1389 if not self._should_recompile(err):
1389 if not self._should_recompile(err):
1390 return
1390 return
1391 try:
1391 try:
1392 # may set last_syntax_error again if a SyntaxError is raised
1392 # may set last_syntax_error again if a SyntaxError is raised
1393 self.safe_execfile(err.filename,self.user_ns)
1393 self.safe_execfile(err.filename,self.user_ns)
1394 except:
1394 except:
1395 self.showtraceback()
1395 self.showtraceback()
1396 else:
1396 else:
1397 try:
1397 try:
1398 f = file(err.filename)
1398 f = file(err.filename)
1399 try:
1399 try:
1400 sys.displayhook(f.read())
1400 sys.displayhook(f.read())
1401 finally:
1401 finally:
1402 f.close()
1402 f.close()
1403 except:
1403 except:
1404 self.showtraceback()
1404 self.showtraceback()
1405
1405
1406 def showsyntaxerror(self, filename=None):
1406 def showsyntaxerror(self, filename=None):
1407 """Display the syntax error that just occurred.
1407 """Display the syntax error that just occurred.
1408
1408
1409 This doesn't display a stack trace because there isn't one.
1409 This doesn't display a stack trace because there isn't one.
1410
1410
1411 If a filename is given, it is stuffed in the exception instead
1411 If a filename is given, it is stuffed in the exception instead
1412 of what was there before (because Python's parser always uses
1412 of what was there before (because Python's parser always uses
1413 "<string>" when reading from a string).
1413 "<string>" when reading from a string).
1414 """
1414 """
1415 etype, value, last_traceback = sys.exc_info()
1415 etype, value, last_traceback = sys.exc_info()
1416
1416
1417 # See note about these variables in showtraceback() below
1417 # See note about these variables in showtraceback() below
1418 sys.last_type = etype
1418 sys.last_type = etype
1419 sys.last_value = value
1419 sys.last_value = value
1420 sys.last_traceback = last_traceback
1420 sys.last_traceback = last_traceback
1421
1421
1422 if filename and etype is SyntaxError:
1422 if filename and etype is SyntaxError:
1423 # Work hard to stuff the correct filename in the exception
1423 # Work hard to stuff the correct filename in the exception
1424 try:
1424 try:
1425 msg, (dummy_filename, lineno, offset, line) = value
1425 msg, (dummy_filename, lineno, offset, line) = value
1426 except:
1426 except:
1427 # Not the format we expect; leave it alone
1427 # Not the format we expect; leave it alone
1428 pass
1428 pass
1429 else:
1429 else:
1430 # Stuff in the right filename
1430 # Stuff in the right filename
1431 try:
1431 try:
1432 # Assume SyntaxError is a class exception
1432 # Assume SyntaxError is a class exception
1433 value = SyntaxError(msg, (filename, lineno, offset, line))
1433 value = SyntaxError(msg, (filename, lineno, offset, line))
1434 except:
1434 except:
1435 # If that failed, assume SyntaxError is a string
1435 # If that failed, assume SyntaxError is a string
1436 value = msg, (filename, lineno, offset, line)
1436 value = msg, (filename, lineno, offset, line)
1437 self.SyntaxTB(etype,value,[])
1437 self.SyntaxTB(etype,value,[])
1438
1438
1439 def debugger(self):
1439 def debugger(self):
1440 """Call the pydb/pdb debugger."""
1440 """Call the pydb/pdb debugger."""
1441
1441
1442 if not self.rc.pdb:
1442 if not self.rc.pdb:
1443 return
1443 return
1444 have_pydb = False
1444 have_pydb = False
1445 if sys.version[:3] >= '2.5':
1445 if sys.version[:3] >= '2.5':
1446 try:
1446 try:
1447 from pydb import pm
1447 from pydb import pm
1448 have_pydb = True
1448 have_pydb = True
1449 except ImportError:
1449 except ImportError:
1450 pass
1450 pass
1451 if not have_pydb:
1451 if not have_pydb:
1452 from pdb import pm
1452 from pdb import pm
1453 self.history_saving_wrapper(pm)()
1453 self.history_saving_wrapper(pm)()
1454
1454
1455 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1455 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1456 """Display the exception that just occurred.
1456 """Display the exception that just occurred.
1457
1457
1458 If nothing is known about the exception, this is the method which
1458 If nothing is known about the exception, this is the method which
1459 should be used throughout the code for presenting user tracebacks,
1459 should be used throughout the code for presenting user tracebacks,
1460 rather than directly invoking the InteractiveTB object.
1460 rather than directly invoking the InteractiveTB object.
1461
1461
1462 A specific showsyntaxerror() also exists, but this method can take
1462 A specific showsyntaxerror() also exists, but this method can take
1463 care of calling it if needed, so unless you are explicitly catching a
1463 care of calling it if needed, so unless you are explicitly catching a
1464 SyntaxError exception, don't try to analyze the stack manually and
1464 SyntaxError exception, don't try to analyze the stack manually and
1465 simply call this method."""
1465 simply call this method."""
1466
1466
1467 # Though this won't be called by syntax errors in the input line,
1467 # Though this won't be called by syntax errors in the input line,
1468 # there may be SyntaxError cases whith imported code.
1468 # there may be SyntaxError cases whith imported code.
1469 if exc_tuple is None:
1469 if exc_tuple is None:
1470 etype, value, tb = sys.exc_info()
1470 etype, value, tb = sys.exc_info()
1471 else:
1471 else:
1472 etype, value, tb = exc_tuple
1472 etype, value, tb = exc_tuple
1473 if etype is SyntaxError:
1473 if etype is SyntaxError:
1474 self.showsyntaxerror(filename)
1474 self.showsyntaxerror(filename)
1475 else:
1475 else:
1476 # WARNING: these variables are somewhat deprecated and not
1476 # WARNING: these variables are somewhat deprecated and not
1477 # necessarily safe to use in a threaded environment, but tools
1477 # necessarily safe to use in a threaded environment, but tools
1478 # like pdb depend on their existence, so let's set them. If we
1478 # like pdb depend on their existence, so let's set them. If we
1479 # find problems in the field, we'll need to revisit their use.
1479 # find problems in the field, we'll need to revisit their use.
1480 sys.last_type = etype
1480 sys.last_type = etype
1481 sys.last_value = value
1481 sys.last_value = value
1482 sys.last_traceback = tb
1482 sys.last_traceback = tb
1483
1483
1484 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1484 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1485 if self.InteractiveTB.call_pdb and self.has_readline:
1485 if self.InteractiveTB.call_pdb and self.has_readline:
1486 # pdb mucks up readline, fix it back
1486 # pdb mucks up readline, fix it back
1487 self.readline.set_completer(self.Completer.complete)
1487 self.readline.set_completer(self.Completer.complete)
1488
1488
1489 def mainloop(self,banner=None):
1489 def mainloop(self,banner=None):
1490 """Creates the local namespace and starts the mainloop.
1490 """Creates the local namespace and starts the mainloop.
1491
1491
1492 If an optional banner argument is given, it will override the
1492 If an optional banner argument is given, it will override the
1493 internally created default banner."""
1493 internally created default banner."""
1494
1494
1495 if self.rc.c: # Emulate Python's -c option
1495 if self.rc.c: # Emulate Python's -c option
1496 self.exec_init_cmd()
1496 self.exec_init_cmd()
1497 if banner is None:
1497 if banner is None:
1498 if not self.rc.banner:
1498 if not self.rc.banner:
1499 banner = ''
1499 banner = ''
1500 # banner is string? Use it directly!
1500 # banner is string? Use it directly!
1501 elif isinstance(self.rc.banner,basestring):
1501 elif isinstance(self.rc.banner,basestring):
1502 banner = self.rc.banner
1502 banner = self.rc.banner
1503 else:
1503 else:
1504 banner = self.BANNER+self.banner2
1504 banner = self.BANNER+self.banner2
1505
1505
1506 self.interact(banner)
1506 self.interact(banner)
1507
1507
1508 def exec_init_cmd(self):
1508 def exec_init_cmd(self):
1509 """Execute a command given at the command line.
1509 """Execute a command given at the command line.
1510
1510
1511 This emulates Python's -c option."""
1511 This emulates Python's -c option."""
1512
1512
1513 #sys.argv = ['-c']
1513 #sys.argv = ['-c']
1514 self.push(self.rc.c)
1514 self.push(self.rc.c)
1515
1515
1516 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1516 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1517 """Embeds IPython into a running python program.
1517 """Embeds IPython into a running python program.
1518
1518
1519 Input:
1519 Input:
1520
1520
1521 - header: An optional header message can be specified.
1521 - header: An optional header message can be specified.
1522
1522
1523 - local_ns, global_ns: working namespaces. If given as None, the
1523 - local_ns, global_ns: working namespaces. If given as None, the
1524 IPython-initialized one is updated with __main__.__dict__, so that
1524 IPython-initialized one is updated with __main__.__dict__, so that
1525 program variables become visible but user-specific configuration
1525 program variables become visible but user-specific configuration
1526 remains possible.
1526 remains possible.
1527
1527
1528 - stack_depth: specifies how many levels in the stack to go to
1528 - stack_depth: specifies how many levels in the stack to go to
1529 looking for namespaces (when local_ns and global_ns are None). This
1529 looking for namespaces (when local_ns and global_ns are None). This
1530 allows an intermediate caller to make sure that this function gets
1530 allows an intermediate caller to make sure that this function gets
1531 the namespace from the intended level in the stack. By default (0)
1531 the namespace from the intended level in the stack. By default (0)
1532 it will get its locals and globals from the immediate caller.
1532 it will get its locals and globals from the immediate caller.
1533
1533
1534 Warning: it's possible to use this in a program which is being run by
1534 Warning: it's possible to use this in a program which is being run by
1535 IPython itself (via %run), but some funny things will happen (a few
1535 IPython itself (via %run), but some funny things will happen (a few
1536 globals get overwritten). In the future this will be cleaned up, as
1536 globals get overwritten). In the future this will be cleaned up, as
1537 there is no fundamental reason why it can't work perfectly."""
1537 there is no fundamental reason why it can't work perfectly."""
1538
1538
1539 # Get locals and globals from caller
1539 # Get locals and globals from caller
1540 if local_ns is None or global_ns is None:
1540 if local_ns is None or global_ns is None:
1541 call_frame = sys._getframe(stack_depth).f_back
1541 call_frame = sys._getframe(stack_depth).f_back
1542
1542
1543 if local_ns is None:
1543 if local_ns is None:
1544 local_ns = call_frame.f_locals
1544 local_ns = call_frame.f_locals
1545 if global_ns is None:
1545 if global_ns is None:
1546 global_ns = call_frame.f_globals
1546 global_ns = call_frame.f_globals
1547
1547
1548 # Update namespaces and fire up interpreter
1548 # Update namespaces and fire up interpreter
1549
1549
1550 # The global one is easy, we can just throw it in
1550 # The global one is easy, we can just throw it in
1551 self.user_global_ns = global_ns
1551 self.user_global_ns = global_ns
1552
1552
1553 # but the user/local one is tricky: ipython needs it to store internal
1553 # but the user/local one is tricky: ipython needs it to store internal
1554 # data, but we also need the locals. We'll copy locals in the user
1554 # data, but we also need the locals. We'll copy locals in the user
1555 # one, but will track what got copied so we can delete them at exit.
1555 # one, but will track what got copied so we can delete them at exit.
1556 # This is so that a later embedded call doesn't see locals from a
1556 # This is so that a later embedded call doesn't see locals from a
1557 # previous call (which most likely existed in a separate scope).
1557 # previous call (which most likely existed in a separate scope).
1558 local_varnames = local_ns.keys()
1558 local_varnames = local_ns.keys()
1559 self.user_ns.update(local_ns)
1559 self.user_ns.update(local_ns)
1560
1560
1561 # Patch for global embedding to make sure that things don't overwrite
1561 # Patch for global embedding to make sure that things don't overwrite
1562 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1562 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1563 # FIXME. Test this a bit more carefully (the if.. is new)
1563 # FIXME. Test this a bit more carefully (the if.. is new)
1564 if local_ns is None and global_ns is None:
1564 if local_ns is None and global_ns is None:
1565 self.user_global_ns.update(__main__.__dict__)
1565 self.user_global_ns.update(__main__.__dict__)
1566
1566
1567 # make sure the tab-completer has the correct frame information, so it
1567 # make sure the tab-completer has the correct frame information, so it
1568 # actually completes using the frame's locals/globals
1568 # actually completes using the frame's locals/globals
1569 self.set_completer_frame()
1569 self.set_completer_frame()
1570
1570
1571 # before activating the interactive mode, we need to make sure that
1571 # before activating the interactive mode, we need to make sure that
1572 # all names in the builtin namespace needed by ipython point to
1572 # all names in the builtin namespace needed by ipython point to
1573 # ourselves, and not to other instances.
1573 # ourselves, and not to other instances.
1574 self.add_builtins()
1574 self.add_builtins()
1575
1575
1576 self.interact(header)
1576 self.interact(header)
1577
1577
1578 # now, purge out the user namespace from anything we might have added
1578 # now, purge out the user namespace from anything we might have added
1579 # from the caller's local namespace
1579 # from the caller's local namespace
1580 delvar = self.user_ns.pop
1580 delvar = self.user_ns.pop
1581 for var in local_varnames:
1581 for var in local_varnames:
1582 delvar(var,None)
1582 delvar(var,None)
1583 # and clean builtins we may have overridden
1583 # and clean builtins we may have overridden
1584 self.clean_builtins()
1584 self.clean_builtins()
1585
1585
1586 def interact(self, banner=None):
1586 def interact(self, banner=None):
1587 """Closely emulate the interactive Python console.
1587 """Closely emulate the interactive Python console.
1588
1588
1589 The optional banner argument specify the banner to print
1589 The optional banner argument specify the banner to print
1590 before the first interaction; by default it prints a banner
1590 before the first interaction; by default it prints a banner
1591 similar to the one printed by the real Python interpreter,
1591 similar to the one printed by the real Python interpreter,
1592 followed by the current class name in parentheses (so as not
1592 followed by the current class name in parentheses (so as not
1593 to confuse this with the real interpreter -- since it's so
1593 to confuse this with the real interpreter -- since it's so
1594 close!).
1594 close!).
1595
1595
1596 """
1596 """
1597
1597
1598 if self.exit_now:
1598 if self.exit_now:
1599 # batch run -> do not interact
1599 # batch run -> do not interact
1600 return
1600 return
1601 cprt = 'Type "copyright", "credits" or "license" for more information.'
1601 cprt = 'Type "copyright", "credits" or "license" for more information.'
1602 if banner is None:
1602 if banner is None:
1603 self.write("Python %s on %s\n%s\n(%s)\n" %
1603 self.write("Python %s on %s\n%s\n(%s)\n" %
1604 (sys.version, sys.platform, cprt,
1604 (sys.version, sys.platform, cprt,
1605 self.__class__.__name__))
1605 self.__class__.__name__))
1606 else:
1606 else:
1607 self.write(banner)
1607 self.write(banner)
1608
1608
1609 more = 0
1609 more = 0
1610
1610
1611 # Mark activity in the builtins
1611 # Mark activity in the builtins
1612 __builtin__.__dict__['__IPYTHON__active'] += 1
1612 __builtin__.__dict__['__IPYTHON__active'] += 1
1613
1613
1614 # exit_now is set by a call to %Exit or %Quit
1614 # exit_now is set by a call to %Exit or %Quit
1615 while not self.exit_now:
1615 while not self.exit_now:
1616 if more:
1616 if more:
1617 prompt = self.hooks.generate_prompt(True)
1617 prompt = self.hooks.generate_prompt(True)
1618 if self.autoindent:
1618 if self.autoindent:
1619 self.readline_startup_hook(self.pre_readline)
1619 self.readline_startup_hook(self.pre_readline)
1620 else:
1620 else:
1621 prompt = self.hooks.generate_prompt(False)
1621 prompt = self.hooks.generate_prompt(False)
1622 try:
1622 try:
1623 line = self.raw_input(prompt,more)
1623 line = self.raw_input(prompt,more)
1624 if self.exit_now:
1624 if self.exit_now:
1625 # quick exit on sys.std[in|out] close
1625 # quick exit on sys.std[in|out] close
1626 break
1626 break
1627 if self.autoindent:
1627 if self.autoindent:
1628 self.readline_startup_hook(None)
1628 self.readline_startup_hook(None)
1629 except KeyboardInterrupt:
1629 except KeyboardInterrupt:
1630 self.write('\nKeyboardInterrupt\n')
1630 self.write('\nKeyboardInterrupt\n')
1631 self.resetbuffer()
1631 self.resetbuffer()
1632 # keep cache in sync with the prompt counter:
1632 # keep cache in sync with the prompt counter:
1633 self.outputcache.prompt_count -= 1
1633 self.outputcache.prompt_count -= 1
1634
1634
1635 if self.autoindent:
1635 if self.autoindent:
1636 self.indent_current_nsp = 0
1636 self.indent_current_nsp = 0
1637 more = 0
1637 more = 0
1638 except EOFError:
1638 except EOFError:
1639 if self.autoindent:
1639 if self.autoindent:
1640 self.readline_startup_hook(None)
1640 self.readline_startup_hook(None)
1641 self.write('\n')
1641 self.write('\n')
1642 self.exit()
1642 self.exit()
1643 except bdb.BdbQuit:
1643 except bdb.BdbQuit:
1644 warn('The Python debugger has exited with a BdbQuit exception.\n'
1644 warn('The Python debugger has exited with a BdbQuit exception.\n'
1645 'Because of how pdb handles the stack, it is impossible\n'
1645 'Because of how pdb handles the stack, it is impossible\n'
1646 'for IPython to properly format this particular exception.\n'
1646 'for IPython to properly format this particular exception.\n'
1647 'IPython will resume normal operation.')
1647 'IPython will resume normal operation.')
1648 except:
1648 except:
1649 # exceptions here are VERY RARE, but they can be triggered
1649 # exceptions here are VERY RARE, but they can be triggered
1650 # asynchronously by signal handlers, for example.
1650 # asynchronously by signal handlers, for example.
1651 self.showtraceback()
1651 self.showtraceback()
1652 else:
1652 else:
1653 more = self.push(line)
1653 more = self.push(line)
1654 if (self.SyntaxTB.last_syntax_error and
1654 if (self.SyntaxTB.last_syntax_error and
1655 self.rc.autoedit_syntax):
1655 self.rc.autoedit_syntax):
1656 self.edit_syntax_error()
1656 self.edit_syntax_error()
1657
1657
1658 # We are off again...
1658 # We are off again...
1659 __builtin__.__dict__['__IPYTHON__active'] -= 1
1659 __builtin__.__dict__['__IPYTHON__active'] -= 1
1660
1660
1661 def excepthook(self, etype, value, tb):
1661 def excepthook(self, etype, value, tb):
1662 """One more defense for GUI apps that call sys.excepthook.
1662 """One more defense for GUI apps that call sys.excepthook.
1663
1663
1664 GUI frameworks like wxPython trap exceptions and call
1664 GUI frameworks like wxPython trap exceptions and call
1665 sys.excepthook themselves. I guess this is a feature that
1665 sys.excepthook themselves. I guess this is a feature that
1666 enables them to keep running after exceptions that would
1666 enables them to keep running after exceptions that would
1667 otherwise kill their mainloop. This is a bother for IPython
1667 otherwise kill their mainloop. This is a bother for IPython
1668 which excepts to catch all of the program exceptions with a try:
1668 which excepts to catch all of the program exceptions with a try:
1669 except: statement.
1669 except: statement.
1670
1670
1671 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1671 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1672 any app directly invokes sys.excepthook, it will look to the user like
1672 any app directly invokes sys.excepthook, it will look to the user like
1673 IPython crashed. In order to work around this, we can disable the
1673 IPython crashed. In order to work around this, we can disable the
1674 CrashHandler and replace it with this excepthook instead, which prints a
1674 CrashHandler and replace it with this excepthook instead, which prints a
1675 regular traceback using our InteractiveTB. In this fashion, apps which
1675 regular traceback using our InteractiveTB. In this fashion, apps which
1676 call sys.excepthook will generate a regular-looking exception from
1676 call sys.excepthook will generate a regular-looking exception from
1677 IPython, and the CrashHandler will only be triggered by real IPython
1677 IPython, and the CrashHandler will only be triggered by real IPython
1678 crashes.
1678 crashes.
1679
1679
1680 This hook should be used sparingly, only in places which are not likely
1680 This hook should be used sparingly, only in places which are not likely
1681 to be true IPython errors.
1681 to be true IPython errors.
1682 """
1682 """
1683 self.showtraceback((etype,value,tb),tb_offset=0)
1683 self.showtraceback((etype,value,tb),tb_offset=0)
1684
1684
1685 def expand_aliases(self,fn,rest):
1685 def expand_aliases(self,fn,rest):
1686 """ Expand multiple levels of aliases:
1686 """ Expand multiple levels of aliases:
1687
1687
1688 if:
1688 if:
1689
1689
1690 alias foo bar /tmp
1690 alias foo bar /tmp
1691 alias baz foo
1691 alias baz foo
1692
1692
1693 then:
1693 then:
1694
1694
1695 baz huhhahhei -> bar /tmp huhhahhei
1695 baz huhhahhei -> bar /tmp huhhahhei
1696
1696
1697 """
1697 """
1698 line = fn + " " + rest
1698 line = fn + " " + rest
1699
1699
1700 done = Set()
1700 done = Set()
1701 while 1:
1701 while 1:
1702 pre,fn,rest = self.split_user_input(line)
1702 pre,fn,rest = self.split_user_input(line)
1703 if fn in self.alias_table:
1703 if fn in self.alias_table:
1704 if fn in done:
1704 if fn in done:
1705 warn("Cyclic alias definition, repeated '%s'" % fn)
1705 warn("Cyclic alias definition, repeated '%s'" % fn)
1706 return ""
1706 return ""
1707 done.add(fn)
1707 done.add(fn)
1708
1708
1709 l2 = self.transform_alias(fn,rest)
1709 l2 = self.transform_alias(fn,rest)
1710 # dir -> dir
1710 # dir -> dir
1711 # print "alias",line, "->",l2 #dbg
1711 # print "alias",line, "->",l2 #dbg
1712 if l2 == line:
1712 if l2 == line:
1713 break
1713 break
1714 # ls -> ls -F should not recurse forever
1714 # ls -> ls -F should not recurse forever
1715 if l2.split(None,1)[0] == line.split(None,1)[0]:
1715 if l2.split(None,1)[0] == line.split(None,1)[0]:
1716 line = l2
1716 line = l2
1717 break
1717 break
1718
1718
1719 line=l2
1719 line=l2
1720
1720
1721
1721
1722 # print "al expand to",line #dbg
1722 # print "al expand to",line #dbg
1723 else:
1723 else:
1724 break
1724 break
1725
1725
1726 return line
1726 return line
1727
1727
1728 def transform_alias(self, alias,rest=''):
1728 def transform_alias(self, alias,rest=''):
1729 """ Transform alias to system command string.
1729 """ Transform alias to system command string.
1730 """
1730 """
1731 nargs,cmd = self.alias_table[alias]
1731 nargs,cmd = self.alias_table[alias]
1732 if ' ' in cmd and os.path.isfile(cmd):
1732 if ' ' in cmd and os.path.isfile(cmd):
1733 cmd = '"%s"' % cmd
1733 cmd = '"%s"' % cmd
1734
1734
1735 # Expand the %l special to be the user's input line
1735 # Expand the %l special to be the user's input line
1736 if cmd.find('%l') >= 0:
1736 if cmd.find('%l') >= 0:
1737 cmd = cmd.replace('%l',rest)
1737 cmd = cmd.replace('%l',rest)
1738 rest = ''
1738 rest = ''
1739 if nargs==0:
1739 if nargs==0:
1740 # Simple, argument-less aliases
1740 # Simple, argument-less aliases
1741 cmd = '%s %s' % (cmd,rest)
1741 cmd = '%s %s' % (cmd,rest)
1742 else:
1742 else:
1743 # Handle aliases with positional arguments
1743 # Handle aliases with positional arguments
1744 args = rest.split(None,nargs)
1744 args = rest.split(None,nargs)
1745 if len(args)< nargs:
1745 if len(args)< nargs:
1746 error('Alias <%s> requires %s arguments, %s given.' %
1746 error('Alias <%s> requires %s arguments, %s given.' %
1747 (alias,nargs,len(args)))
1747 (alias,nargs,len(args)))
1748 return None
1748 return None
1749 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1749 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1750 # Now call the macro, evaluating in the user's namespace
1750 # Now call the macro, evaluating in the user's namespace
1751 #print 'new command: <%r>' % cmd # dbg
1751 #print 'new command: <%r>' % cmd # dbg
1752 return cmd
1752 return cmd
1753
1753
1754 def call_alias(self,alias,rest=''):
1754 def call_alias(self,alias,rest=''):
1755 """Call an alias given its name and the rest of the line.
1755 """Call an alias given its name and the rest of the line.
1756
1756
1757 This is only used to provide backwards compatibility for users of
1757 This is only used to provide backwards compatibility for users of
1758 ipalias(), use of which is not recommended for anymore."""
1758 ipalias(), use of which is not recommended for anymore."""
1759
1759
1760 # Now call the macro, evaluating in the user's namespace
1760 # Now call the macro, evaluating in the user's namespace
1761 cmd = self.transform_alias(alias, rest)
1761 cmd = self.transform_alias(alias, rest)
1762 try:
1762 try:
1763 self.system(cmd)
1763 self.system(cmd)
1764 except:
1764 except:
1765 self.showtraceback()
1765 self.showtraceback()
1766
1766
1767 def indent_current_str(self):
1767 def indent_current_str(self):
1768 """return the current level of indentation as a string"""
1768 """return the current level of indentation as a string"""
1769 return self.indent_current_nsp * ' '
1769 return self.indent_current_nsp * ' '
1770
1770
1771 def autoindent_update(self,line):
1771 def autoindent_update(self,line):
1772 """Keep track of the indent level."""
1772 """Keep track of the indent level."""
1773
1773
1774 #debugx('line')
1774 #debugx('line')
1775 #debugx('self.indent_current_nsp')
1775 #debugx('self.indent_current_nsp')
1776 if self.autoindent:
1776 if self.autoindent:
1777 if line:
1777 if line:
1778 inisp = num_ini_spaces(line)
1778 inisp = num_ini_spaces(line)
1779 if inisp < self.indent_current_nsp:
1779 if inisp < self.indent_current_nsp:
1780 self.indent_current_nsp = inisp
1780 self.indent_current_nsp = inisp
1781
1781
1782 if line[-1] == ':':
1782 if line[-1] == ':':
1783 self.indent_current_nsp += 4
1783 self.indent_current_nsp += 4
1784 elif dedent_re.match(line):
1784 elif dedent_re.match(line):
1785 self.indent_current_nsp -= 4
1785 self.indent_current_nsp -= 4
1786 else:
1786 else:
1787 self.indent_current_nsp = 0
1787 self.indent_current_nsp = 0
1788
1788
1789 def runlines(self,lines):
1789 def runlines(self,lines):
1790 """Run a string of one or more lines of source.
1790 """Run a string of one or more lines of source.
1791
1791
1792 This method is capable of running a string containing multiple source
1792 This method is capable of running a string containing multiple source
1793 lines, as if they had been entered at the IPython prompt. Since it
1793 lines, as if they had been entered at the IPython prompt. Since it
1794 exposes IPython's processing machinery, the given strings can contain
1794 exposes IPython's processing machinery, the given strings can contain
1795 magic calls (%magic), special shell access (!cmd), etc."""
1795 magic calls (%magic), special shell access (!cmd), etc."""
1796
1796
1797 # We must start with a clean buffer, in case this is run from an
1797 # We must start with a clean buffer, in case this is run from an
1798 # interactive IPython session (via a magic, for example).
1798 # interactive IPython session (via a magic, for example).
1799 self.resetbuffer()
1799 self.resetbuffer()
1800 lines = lines.split('\n')
1800 lines = lines.split('\n')
1801 more = 0
1801 more = 0
1802 for line in lines:
1802 for line in lines:
1803 # skip blank lines so we don't mess up the prompt counter, but do
1803 # skip blank lines so we don't mess up the prompt counter, but do
1804 # NOT skip even a blank line if we are in a code block (more is
1804 # NOT skip even a blank line if we are in a code block (more is
1805 # true)
1805 # true)
1806 if line or more:
1806 if line or more:
1807 more = self.push(self.prefilter(line,more))
1807 more = self.push(self.prefilter(line,more))
1808 # IPython's runsource returns None if there was an error
1808 # IPython's runsource returns None if there was an error
1809 # compiling the code. This allows us to stop processing right
1809 # compiling the code. This allows us to stop processing right
1810 # away, so the user gets the error message at the right place.
1810 # away, so the user gets the error message at the right place.
1811 if more is None:
1811 if more is None:
1812 break
1812 break
1813 # final newline in case the input didn't have it, so that the code
1813 # final newline in case the input didn't have it, so that the code
1814 # actually does get executed
1814 # actually does get executed
1815 if more:
1815 if more:
1816 self.push('\n')
1816 self.push('\n')
1817
1817
1818 def runsource(self, source, filename='<input>', symbol='single'):
1818 def runsource(self, source, filename='<input>', symbol='single'):
1819 """Compile and run some source in the interpreter.
1819 """Compile and run some source in the interpreter.
1820
1820
1821 Arguments are as for compile_command().
1821 Arguments are as for compile_command().
1822
1822
1823 One several things can happen:
1823 One several things can happen:
1824
1824
1825 1) The input is incorrect; compile_command() raised an
1825 1) The input is incorrect; compile_command() raised an
1826 exception (SyntaxError or OverflowError). A syntax traceback
1826 exception (SyntaxError or OverflowError). A syntax traceback
1827 will be printed by calling the showsyntaxerror() method.
1827 will be printed by calling the showsyntaxerror() method.
1828
1828
1829 2) The input is incomplete, and more input is required;
1829 2) The input is incomplete, and more input is required;
1830 compile_command() returned None. Nothing happens.
1830 compile_command() returned None. Nothing happens.
1831
1831
1832 3) The input is complete; compile_command() returned a code
1832 3) The input is complete; compile_command() returned a code
1833 object. The code is executed by calling self.runcode() (which
1833 object. The code is executed by calling self.runcode() (which
1834 also handles run-time exceptions, except for SystemExit).
1834 also handles run-time exceptions, except for SystemExit).
1835
1835
1836 The return value is:
1836 The return value is:
1837
1837
1838 - True in case 2
1838 - True in case 2
1839
1839
1840 - False in the other cases, unless an exception is raised, where
1840 - False in the other cases, unless an exception is raised, where
1841 None is returned instead. This can be used by external callers to
1841 None is returned instead. This can be used by external callers to
1842 know whether to continue feeding input or not.
1842 know whether to continue feeding input or not.
1843
1843
1844 The return value can be used to decide whether to use sys.ps1 or
1844 The return value can be used to decide whether to use sys.ps1 or
1845 sys.ps2 to prompt the next line."""
1845 sys.ps2 to prompt the next line."""
1846
1846
1847 # if the source code has leading blanks, add 'if 1:\n' to it
1848 # this allows execution of indented pasted code. It is tempting
1849 # to add '\n' at the end of source to run commands like ' a=1'
1850 # directly, but this fails for more complicated scenarios
1851 if source[:1] in [' ', '\t']:
1852 source = 'if 1:\n%s' % source
1853
1847 try:
1854 try:
1848 code = self.compile(source,filename,symbol)
1855 code = self.compile(source,filename,symbol)
1849 except (OverflowError, SyntaxError, ValueError):
1856 except (OverflowError, SyntaxError, ValueError):
1850 # Case 1
1857 # Case 1
1851 self.showsyntaxerror(filename)
1858 self.showsyntaxerror(filename)
1852 return None
1859 return None
1853
1860
1854 if code is None:
1861 if code is None:
1855 # Case 2
1862 # Case 2
1856 return True
1863 return True
1857
1864
1858 # Case 3
1865 # Case 3
1859 # We store the code object so that threaded shells and
1866 # We store the code object so that threaded shells and
1860 # custom exception handlers can access all this info if needed.
1867 # custom exception handlers can access all this info if needed.
1861 # The source corresponding to this can be obtained from the
1868 # The source corresponding to this can be obtained from the
1862 # buffer attribute as '\n'.join(self.buffer).
1869 # buffer attribute as '\n'.join(self.buffer).
1863 self.code_to_run = code
1870 self.code_to_run = code
1864 # now actually execute the code object
1871 # now actually execute the code object
1865 if self.runcode(code) == 0:
1872 if self.runcode(code) == 0:
1866 return False
1873 return False
1867 else:
1874 else:
1868 return None
1875 return None
1869
1876
1870 def runcode(self,code_obj):
1877 def runcode(self,code_obj):
1871 """Execute a code object.
1878 """Execute a code object.
1872
1879
1873 When an exception occurs, self.showtraceback() is called to display a
1880 When an exception occurs, self.showtraceback() is called to display a
1874 traceback.
1881 traceback.
1875
1882
1876 Return value: a flag indicating whether the code to be run completed
1883 Return value: a flag indicating whether the code to be run completed
1877 successfully:
1884 successfully:
1878
1885
1879 - 0: successful execution.
1886 - 0: successful execution.
1880 - 1: an error occurred.
1887 - 1: an error occurred.
1881 """
1888 """
1882
1889
1883 # Set our own excepthook in case the user code tries to call it
1890 # Set our own excepthook in case the user code tries to call it
1884 # directly, so that the IPython crash handler doesn't get triggered
1891 # directly, so that the IPython crash handler doesn't get triggered
1885 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1892 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1886
1893
1887 # we save the original sys.excepthook in the instance, in case config
1894 # we save the original sys.excepthook in the instance, in case config
1888 # code (such as magics) needs access to it.
1895 # code (such as magics) needs access to it.
1889 self.sys_excepthook = old_excepthook
1896 self.sys_excepthook = old_excepthook
1890 outflag = 1 # happens in more places, so it's easier as default
1897 outflag = 1 # happens in more places, so it's easier as default
1891 try:
1898 try:
1892 try:
1899 try:
1893 # Embedded instances require separate global/local namespaces
1900 # Embedded instances require separate global/local namespaces
1894 # so they can see both the surrounding (local) namespace and
1901 # so they can see both the surrounding (local) namespace and
1895 # the module-level globals when called inside another function.
1902 # the module-level globals when called inside another function.
1896 if self.embedded:
1903 if self.embedded:
1897 exec code_obj in self.user_global_ns, self.user_ns
1904 exec code_obj in self.user_global_ns, self.user_ns
1898 # Normal (non-embedded) instances should only have a single
1905 # Normal (non-embedded) instances should only have a single
1899 # namespace for user code execution, otherwise functions won't
1906 # namespace for user code execution, otherwise functions won't
1900 # see interactive top-level globals.
1907 # see interactive top-level globals.
1901 else:
1908 else:
1902 exec code_obj in self.user_ns
1909 exec code_obj in self.user_ns
1903 finally:
1910 finally:
1904 # Reset our crash handler in place
1911 # Reset our crash handler in place
1905 sys.excepthook = old_excepthook
1912 sys.excepthook = old_excepthook
1906 except SystemExit:
1913 except SystemExit:
1907 self.resetbuffer()
1914 self.resetbuffer()
1908 self.showtraceback()
1915 self.showtraceback()
1909 warn("Type %exit or %quit to exit IPython "
1916 warn("Type %exit or %quit to exit IPython "
1910 "(%Exit or %Quit do so unconditionally).",level=1)
1917 "(%Exit or %Quit do so unconditionally).",level=1)
1911 except self.custom_exceptions:
1918 except self.custom_exceptions:
1912 etype,value,tb = sys.exc_info()
1919 etype,value,tb = sys.exc_info()
1913 self.CustomTB(etype,value,tb)
1920 self.CustomTB(etype,value,tb)
1914 except:
1921 except:
1915 self.showtraceback()
1922 self.showtraceback()
1916 else:
1923 else:
1917 outflag = 0
1924 outflag = 0
1918 if softspace(sys.stdout, 0):
1925 if softspace(sys.stdout, 0):
1919 print
1926 print
1920 # Flush out code object which has been run (and source)
1927 # Flush out code object which has been run (and source)
1921 self.code_to_run = None
1928 self.code_to_run = None
1922 return outflag
1929 return outflag
1923
1930
1924 def push(self, line):
1931 def push(self, line):
1925 """Push a line to the interpreter.
1932 """Push a line to the interpreter.
1926
1933
1927 The line should not have a trailing newline; it may have
1934 The line should not have a trailing newline; it may have
1928 internal newlines. The line is appended to a buffer and the
1935 internal newlines. The line is appended to a buffer and the
1929 interpreter's runsource() method is called with the
1936 interpreter's runsource() method is called with the
1930 concatenated contents of the buffer as source. If this
1937 concatenated contents of the buffer as source. If this
1931 indicates that the command was executed or invalid, the buffer
1938 indicates that the command was executed or invalid, the buffer
1932 is reset; otherwise, the command is incomplete, and the buffer
1939 is reset; otherwise, the command is incomplete, and the buffer
1933 is left as it was after the line was appended. The return
1940 is left as it was after the line was appended. The return
1934 value is 1 if more input is required, 0 if the line was dealt
1941 value is 1 if more input is required, 0 if the line was dealt
1935 with in some way (this is the same as runsource()).
1942 with in some way (this is the same as runsource()).
1936 """
1943 """
1937
1944
1938 # autoindent management should be done here, and not in the
1945 # autoindent management should be done here, and not in the
1939 # interactive loop, since that one is only seen by keyboard input. We
1946 # interactive loop, since that one is only seen by keyboard input. We
1940 # need this done correctly even for code run via runlines (which uses
1947 # need this done correctly even for code run via runlines (which uses
1941 # push).
1948 # push).
1942
1949
1943 #print 'push line: <%s>' % line # dbg
1950 #print 'push line: <%s>' % line # dbg
1944 for subline in line.splitlines():
1951 for subline in line.splitlines():
1945 self.autoindent_update(subline)
1952 self.autoindent_update(subline)
1946 self.buffer.append(line)
1953 self.buffer.append(line)
1947 more = self.runsource('\n'.join(self.buffer), self.filename)
1954 more = self.runsource('\n'.join(self.buffer), self.filename)
1948 if not more:
1955 if not more:
1949 self.resetbuffer()
1956 self.resetbuffer()
1950 return more
1957 return more
1951
1958
1952 def resetbuffer(self):
1959 def resetbuffer(self):
1953 """Reset the input buffer."""
1960 """Reset the input buffer."""
1954 self.buffer[:] = []
1961 self.buffer[:] = []
1955
1962
1956 def raw_input(self,prompt='',continue_prompt=False):
1963 def raw_input(self,prompt='',continue_prompt=False):
1957 """Write a prompt and read a line.
1964 """Write a prompt and read a line.
1958
1965
1959 The returned line does not include the trailing newline.
1966 The returned line does not include the trailing newline.
1960 When the user enters the EOF key sequence, EOFError is raised.
1967 When the user enters the EOF key sequence, EOFError is raised.
1961
1968
1962 Optional inputs:
1969 Optional inputs:
1963
1970
1964 - prompt(''): a string to be printed to prompt the user.
1971 - prompt(''): a string to be printed to prompt the user.
1965
1972
1966 - continue_prompt(False): whether this line is the first one or a
1973 - continue_prompt(False): whether this line is the first one or a
1967 continuation in a sequence of inputs.
1974 continuation in a sequence of inputs.
1968 """
1975 """
1969
1976
1970 try:
1977 try:
1971 line = raw_input_original(prompt)
1978 line = raw_input_original(prompt)
1972 except ValueError:
1979 except ValueError:
1973 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1980 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1974 self.exit_now = True
1981 self.exit_now = True
1975 return ""
1982 return ""
1976
1983
1977
1984
1978 # Try to be reasonably smart about not re-indenting pasted input more
1985 # Try to be reasonably smart about not re-indenting pasted input more
1979 # than necessary. We do this by trimming out the auto-indent initial
1986 # than necessary. We do this by trimming out the auto-indent initial
1980 # spaces, if the user's actual input started itself with whitespace.
1987 # spaces, if the user's actual input started itself with whitespace.
1981 #debugx('self.buffer[-1]')
1988 #debugx('self.buffer[-1]')
1982
1989
1983 if self.autoindent:
1990 if self.autoindent:
1984 if num_ini_spaces(line) > self.indent_current_nsp:
1991 if num_ini_spaces(line) > self.indent_current_nsp:
1985 line = line[self.indent_current_nsp:]
1992 line = line[self.indent_current_nsp:]
1986 self.indent_current_nsp = 0
1993 self.indent_current_nsp = 0
1987
1994
1988 # store the unfiltered input before the user has any chance to modify
1995 # store the unfiltered input before the user has any chance to modify
1989 # it.
1996 # it.
1990 if line.strip():
1997 if line.strip():
1991 if continue_prompt:
1998 if continue_prompt:
1992 self.input_hist_raw[-1] += '%s\n' % line
1999 self.input_hist_raw[-1] += '%s\n' % line
1993 if self.has_readline: # and some config option is set?
2000 if self.has_readline: # and some config option is set?
1994 try:
2001 try:
1995 histlen = self.readline.get_current_history_length()
2002 histlen = self.readline.get_current_history_length()
1996 newhist = self.input_hist_raw[-1].rstrip()
2003 newhist = self.input_hist_raw[-1].rstrip()
1997 self.readline.remove_history_item(histlen-1)
2004 self.readline.remove_history_item(histlen-1)
1998 self.readline.replace_history_item(histlen-2,newhist)
2005 self.readline.replace_history_item(histlen-2,newhist)
1999 except AttributeError:
2006 except AttributeError:
2000 pass # re{move,place}_history_item are new in 2.4.
2007 pass # re{move,place}_history_item are new in 2.4.
2001 else:
2008 else:
2002 self.input_hist_raw.append('%s\n' % line)
2009 self.input_hist_raw.append('%s\n' % line)
2003
2010
2004 try:
2011 try:
2005 lineout = self.prefilter(line,continue_prompt)
2012 lineout = self.prefilter(line,continue_prompt)
2006 except:
2013 except:
2007 # blanket except, in case a user-defined prefilter crashes, so it
2014 # blanket except, in case a user-defined prefilter crashes, so it
2008 # can't take all of ipython with it.
2015 # can't take all of ipython with it.
2009 self.showtraceback()
2016 self.showtraceback()
2010 return ''
2017 return ''
2011 else:
2018 else:
2012 return lineout
2019 return lineout
2013
2020
2014 def split_user_input(self,line):
2021 def split_user_input(self,line):
2015 """Split user input into pre-char, function part and rest."""
2022 """Split user input into pre-char, function part and rest."""
2016
2023
2017 lsplit = self.line_split.match(line)
2024 lsplit = self.line_split.match(line)
2018 if lsplit is None: # no regexp match returns None
2025 if lsplit is None: # no regexp match returns None
2019 try:
2026 try:
2020 iFun,theRest = line.split(None,1)
2027 iFun,theRest = line.split(None,1)
2021 except ValueError:
2028 except ValueError:
2022 iFun,theRest = line,''
2029 iFun,theRest = line,''
2023 pre = re.match('^(\s*)(.*)',line).groups()[0]
2030 pre = re.match('^(\s*)(.*)',line).groups()[0]
2024 else:
2031 else:
2025 pre,iFun,theRest = lsplit.groups()
2032 pre,iFun,theRest = lsplit.groups()
2026
2033
2027 #print 'line:<%s>' % line # dbg
2034 #print 'line:<%s>' % line # dbg
2028 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2035 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2029 return pre,iFun.strip(),theRest
2036 return pre,iFun.strip(),theRest
2030
2037
2031 def _prefilter(self, line, continue_prompt):
2038 def _prefilter(self, line, continue_prompt):
2032 """Calls different preprocessors, depending on the form of line."""
2039 """Calls different preprocessors, depending on the form of line."""
2033
2040
2034 # All handlers *must* return a value, even if it's blank ('').
2041 # All handlers *must* return a value, even if it's blank ('').
2035
2042
2036 # Lines are NOT logged here. Handlers should process the line as
2043 # Lines are NOT logged here. Handlers should process the line as
2037 # needed, update the cache AND log it (so that the input cache array
2044 # needed, update the cache AND log it (so that the input cache array
2038 # stays synced).
2045 # stays synced).
2039
2046
2040 # This function is _very_ delicate, and since it's also the one which
2047 # This function is _very_ delicate, and since it's also the one which
2041 # determines IPython's response to user input, it must be as efficient
2048 # determines IPython's response to user input, it must be as efficient
2042 # as possible. For this reason it has _many_ returns in it, trying
2049 # as possible. For this reason it has _many_ returns in it, trying
2043 # always to exit as quickly as it can figure out what it needs to do.
2050 # always to exit as quickly as it can figure out what it needs to do.
2044
2051
2045 # This function is the main responsible for maintaining IPython's
2052 # This function is the main responsible for maintaining IPython's
2046 # behavior respectful of Python's semantics. So be _very_ careful if
2053 # behavior respectful of Python's semantics. So be _very_ careful if
2047 # making changes to anything here.
2054 # making changes to anything here.
2048
2055
2049 #.....................................................................
2056 #.....................................................................
2050 # Code begins
2057 # Code begins
2051
2058
2052 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2059 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2053
2060
2054 # save the line away in case we crash, so the post-mortem handler can
2061 # save the line away in case we crash, so the post-mortem handler can
2055 # record it
2062 # record it
2056 self._last_input_line = line
2063 self._last_input_line = line
2057
2064
2058 #print '***line: <%s>' % line # dbg
2065 #print '***line: <%s>' % line # dbg
2059
2066
2060 # the input history needs to track even empty lines
2067 # the input history needs to track even empty lines
2061 stripped = line.strip()
2068 stripped = line.strip()
2062
2069
2063 if not stripped:
2070 if not stripped:
2064 if not continue_prompt:
2071 if not continue_prompt:
2065 self.outputcache.prompt_count -= 1
2072 self.outputcache.prompt_count -= 1
2066 return self.handle_normal(line,continue_prompt)
2073 return self.handle_normal(line,continue_prompt)
2067 #return self.handle_normal('',continue_prompt)
2074 #return self.handle_normal('',continue_prompt)
2068
2075
2069 # print '***cont',continue_prompt # dbg
2076 # print '***cont',continue_prompt # dbg
2070 # special handlers are only allowed for single line statements
2077 # special handlers are only allowed for single line statements
2071 if continue_prompt and not self.rc.multi_line_specials:
2078 if continue_prompt and not self.rc.multi_line_specials:
2072 return self.handle_normal(line,continue_prompt)
2079 return self.handle_normal(line,continue_prompt)
2073
2080
2074
2081
2075 # For the rest, we need the structure of the input
2082 # For the rest, we need the structure of the input
2076 pre,iFun,theRest = self.split_user_input(line)
2083 pre,iFun,theRest = self.split_user_input(line)
2077
2084
2078 # See whether any pre-existing handler can take care of it
2085 # See whether any pre-existing handler can take care of it
2079
2086
2080 rewritten = self.hooks.input_prefilter(stripped)
2087 rewritten = self.hooks.input_prefilter(stripped)
2081 if rewritten != stripped: # ok, some prefilter did something
2088 if rewritten != stripped: # ok, some prefilter did something
2082 rewritten = pre + rewritten # add indentation
2089 rewritten = pre + rewritten # add indentation
2083 return self.handle_normal(rewritten)
2090 return self.handle_normal(rewritten)
2084
2091
2085 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2092 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2086
2093
2087 # First check for explicit escapes in the last/first character
2094 # First check for explicit escapes in the last/first character
2088 handler = None
2095 handler = None
2089 if line[-1] == self.ESC_HELP:
2096 if line[-1] == self.ESC_HELP:
2090 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2097 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2091 if handler is None:
2098 if handler is None:
2092 # look at the first character of iFun, NOT of line, so we skip
2099 # look at the first character of iFun, NOT of line, so we skip
2093 # leading whitespace in multiline input
2100 # leading whitespace in multiline input
2094 handler = self.esc_handlers.get(iFun[0:1])
2101 handler = self.esc_handlers.get(iFun[0:1])
2095 if handler is not None:
2102 if handler is not None:
2096 return handler(line,continue_prompt,pre,iFun,theRest)
2103 return handler(line,continue_prompt,pre,iFun,theRest)
2097 # Emacs ipython-mode tags certain input lines
2104 # Emacs ipython-mode tags certain input lines
2098 if line.endswith('# PYTHON-MODE'):
2105 if line.endswith('# PYTHON-MODE'):
2099 return self.handle_emacs(line,continue_prompt)
2106 return self.handle_emacs(line,continue_prompt)
2100
2107
2101 # Next, check if we can automatically execute this thing
2108 # Next, check if we can automatically execute this thing
2102
2109
2103 # Allow ! in multi-line statements if multi_line_specials is on:
2110 # Allow ! in multi-line statements if multi_line_specials is on:
2104 if continue_prompt and self.rc.multi_line_specials and \
2111 if continue_prompt and self.rc.multi_line_specials and \
2105 iFun.startswith(self.ESC_SHELL):
2112 iFun.startswith(self.ESC_SHELL):
2106 return self.handle_shell_escape(line,continue_prompt,
2113 return self.handle_shell_escape(line,continue_prompt,
2107 pre=pre,iFun=iFun,
2114 pre=pre,iFun=iFun,
2108 theRest=theRest)
2115 theRest=theRest)
2109
2116
2110 # Let's try to find if the input line is a magic fn
2117 # Let's try to find if the input line is a magic fn
2111 oinfo = None
2118 oinfo = None
2112 if hasattr(self,'magic_'+iFun):
2119 if hasattr(self,'magic_'+iFun):
2113 # WARNING: _ofind uses getattr(), so it can consume generators and
2120 # WARNING: _ofind uses getattr(), so it can consume generators and
2114 # cause other side effects.
2121 # cause other side effects.
2115 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2122 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2116 if oinfo['ismagic']:
2123 if oinfo['ismagic']:
2117 # Be careful not to call magics when a variable assignment is
2124 # Be careful not to call magics when a variable assignment is
2118 # being made (ls='hi', for example)
2125 # being made (ls='hi', for example)
2119 if self.rc.automagic and \
2126 if self.rc.automagic and \
2120 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2127 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2121 (self.rc.multi_line_specials or not continue_prompt):
2128 (self.rc.multi_line_specials or not continue_prompt):
2122 return self.handle_magic(line,continue_prompt,
2129 return self.handle_magic(line,continue_prompt,
2123 pre,iFun,theRest)
2130 pre,iFun,theRest)
2124 else:
2131 else:
2125 return self.handle_normal(line,continue_prompt)
2132 return self.handle_normal(line,continue_prompt)
2126
2133
2127 # If the rest of the line begins with an (in)equality, assginment or
2134 # If the rest of the line begins with an (in)equality, assginment or
2128 # function call, we should not call _ofind but simply execute it.
2135 # function call, we should not call _ofind but simply execute it.
2129 # This avoids spurious geattr() accesses on objects upon assignment.
2136 # This avoids spurious geattr() accesses on objects upon assignment.
2130 #
2137 #
2131 # It also allows users to assign to either alias or magic names true
2138 # It also allows users to assign to either alias or magic names true
2132 # python variables (the magic/alias systems always take second seat to
2139 # python variables (the magic/alias systems always take second seat to
2133 # true python code).
2140 # true python code).
2134 if theRest and theRest[0] in '!=()':
2141 if theRest and theRest[0] in '!=()':
2135 return self.handle_normal(line,continue_prompt)
2142 return self.handle_normal(line,continue_prompt)
2136
2143
2137 if oinfo is None:
2144 if oinfo is None:
2138 # let's try to ensure that _oinfo is ONLY called when autocall is
2145 # let's try to ensure that _oinfo is ONLY called when autocall is
2139 # on. Since it has inevitable potential side effects, at least
2146 # on. Since it has inevitable potential side effects, at least
2140 # having autocall off should be a guarantee to the user that no
2147 # having autocall off should be a guarantee to the user that no
2141 # weird things will happen.
2148 # weird things will happen.
2142
2149
2143 if self.rc.autocall:
2150 if self.rc.autocall:
2144 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2151 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2145 else:
2152 else:
2146 # in this case, all that's left is either an alias or
2153 # in this case, all that's left is either an alias or
2147 # processing the line normally.
2154 # processing the line normally.
2148 if iFun in self.alias_table:
2155 if iFun in self.alias_table:
2149 # if autocall is off, by not running _ofind we won't know
2156 # if autocall is off, by not running _ofind we won't know
2150 # whether the given name may also exist in one of the
2157 # whether the given name may also exist in one of the
2151 # user's namespace. At this point, it's best to do a
2158 # user's namespace. At this point, it's best to do a
2152 # quick check just to be sure that we don't let aliases
2159 # quick check just to be sure that we don't let aliases
2153 # shadow variables.
2160 # shadow variables.
2154 head = iFun.split('.',1)[0]
2161 head = iFun.split('.',1)[0]
2155 if head in self.user_ns or head in self.internal_ns \
2162 if head in self.user_ns or head in self.internal_ns \
2156 or head in __builtin__.__dict__:
2163 or head in __builtin__.__dict__:
2157 return self.handle_normal(line,continue_prompt)
2164 return self.handle_normal(line,continue_prompt)
2158 else:
2165 else:
2159 return self.handle_alias(line,continue_prompt,
2166 return self.handle_alias(line,continue_prompt,
2160 pre,iFun,theRest)
2167 pre,iFun,theRest)
2161
2168
2162 else:
2169 else:
2163 return self.handle_normal(line,continue_prompt)
2170 return self.handle_normal(line,continue_prompt)
2164
2171
2165 if not oinfo['found']:
2172 if not oinfo['found']:
2166 return self.handle_normal(line,continue_prompt)
2173 return self.handle_normal(line,continue_prompt)
2167 else:
2174 else:
2168 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2175 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2169 if oinfo['isalias']:
2176 if oinfo['isalias']:
2170 return self.handle_alias(line,continue_prompt,
2177 return self.handle_alias(line,continue_prompt,
2171 pre,iFun,theRest)
2178 pre,iFun,theRest)
2172
2179
2173 if (self.rc.autocall
2180 if (self.rc.autocall
2174 and
2181 and
2175 (
2182 (
2176 #only consider exclusion re if not "," or ";" autoquoting
2183 #only consider exclusion re if not "," or ";" autoquoting
2177 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2184 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2178 or pre == self.ESC_PAREN) or
2185 or pre == self.ESC_PAREN) or
2179 (not self.re_exclude_auto.match(theRest)))
2186 (not self.re_exclude_auto.match(theRest)))
2180 and
2187 and
2181 self.re_fun_name.match(iFun) and
2188 self.re_fun_name.match(iFun) and
2182 callable(oinfo['obj'])) :
2189 callable(oinfo['obj'])) :
2183 #print 'going auto' # dbg
2190 #print 'going auto' # dbg
2184 return self.handle_auto(line,continue_prompt,
2191 return self.handle_auto(line,continue_prompt,
2185 pre,iFun,theRest,oinfo['obj'])
2192 pre,iFun,theRest,oinfo['obj'])
2186 else:
2193 else:
2187 #print 'was callable?', callable(oinfo['obj']) # dbg
2194 #print 'was callable?', callable(oinfo['obj']) # dbg
2188 return self.handle_normal(line,continue_prompt)
2195 return self.handle_normal(line,continue_prompt)
2189
2196
2190 # If we get here, we have a normal Python line. Log and return.
2197 # If we get here, we have a normal Python line. Log and return.
2191 return self.handle_normal(line,continue_prompt)
2198 return self.handle_normal(line,continue_prompt)
2192
2199
2193 def _prefilter_dumb(self, line, continue_prompt):
2200 def _prefilter_dumb(self, line, continue_prompt):
2194 """simple prefilter function, for debugging"""
2201 """simple prefilter function, for debugging"""
2195 return self.handle_normal(line,continue_prompt)
2202 return self.handle_normal(line,continue_prompt)
2196
2203
2197
2204
2198 def multiline_prefilter(self, line, continue_prompt):
2205 def multiline_prefilter(self, line, continue_prompt):
2199 """ Run _prefilter for each line of input
2206 """ Run _prefilter for each line of input
2200
2207
2201 Covers cases where there are multiple lines in the user entry,
2208 Covers cases where there are multiple lines in the user entry,
2202 which is the case when the user goes back to a multiline history
2209 which is the case when the user goes back to a multiline history
2203 entry and presses enter.
2210 entry and presses enter.
2204
2211
2205 """
2212 """
2206 out = []
2213 out = []
2207 for l in line.rstrip('\n').split('\n'):
2214 for l in line.rstrip('\n').split('\n'):
2208 out.append(self._prefilter(l, continue_prompt))
2215 out.append(self._prefilter(l, continue_prompt))
2209 return '\n'.join(out)
2216 return '\n'.join(out)
2210
2217
2211 # Set the default prefilter() function (this can be user-overridden)
2218 # Set the default prefilter() function (this can be user-overridden)
2212 prefilter = multiline_prefilter
2219 prefilter = multiline_prefilter
2213
2220
2214 def handle_normal(self,line,continue_prompt=None,
2221 def handle_normal(self,line,continue_prompt=None,
2215 pre=None,iFun=None,theRest=None):
2222 pre=None,iFun=None,theRest=None):
2216 """Handle normal input lines. Use as a template for handlers."""
2223 """Handle normal input lines. Use as a template for handlers."""
2217
2224
2218 # With autoindent on, we need some way to exit the input loop, and I
2225 # With autoindent on, we need some way to exit the input loop, and I
2219 # don't want to force the user to have to backspace all the way to
2226 # don't want to force the user to have to backspace all the way to
2220 # clear the line. The rule will be in this case, that either two
2227 # clear the line. The rule will be in this case, that either two
2221 # lines of pure whitespace in a row, or a line of pure whitespace but
2228 # lines of pure whitespace in a row, or a line of pure whitespace but
2222 # of a size different to the indent level, will exit the input loop.
2229 # of a size different to the indent level, will exit the input loop.
2223
2230
2224 if (continue_prompt and self.autoindent and line.isspace() and
2231 if (continue_prompt and self.autoindent and line.isspace() and
2225 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2232 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2226 (self.buffer[-1]).isspace() )):
2233 (self.buffer[-1]).isspace() )):
2227 line = ''
2234 line = ''
2228
2235
2229 self.log(line,line,continue_prompt)
2236 self.log(line,line,continue_prompt)
2230 return line
2237 return line
2231
2238
2232 def handle_alias(self,line,continue_prompt=None,
2239 def handle_alias(self,line,continue_prompt=None,
2233 pre=None,iFun=None,theRest=None):
2240 pre=None,iFun=None,theRest=None):
2234 """Handle alias input lines. """
2241 """Handle alias input lines. """
2235
2242
2236 # pre is needed, because it carries the leading whitespace. Otherwise
2243 # pre is needed, because it carries the leading whitespace. Otherwise
2237 # aliases won't work in indented sections.
2244 # aliases won't work in indented sections.
2238 transformed = self.expand_aliases(iFun, theRest)
2245 transformed = self.expand_aliases(iFun, theRest)
2239 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2246 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2240 self.log(line,line_out,continue_prompt)
2247 self.log(line,line_out,continue_prompt)
2241 #print 'line out:',line_out # dbg
2248 #print 'line out:',line_out # dbg
2242 return line_out
2249 return line_out
2243
2250
2244 def handle_shell_escape(self, line, continue_prompt=None,
2251 def handle_shell_escape(self, line, continue_prompt=None,
2245 pre=None,iFun=None,theRest=None):
2252 pre=None,iFun=None,theRest=None):
2246 """Execute the line in a shell, empty return value"""
2253 """Execute the line in a shell, empty return value"""
2247
2254
2248 #print 'line in :', `line` # dbg
2255 #print 'line in :', `line` # dbg
2249 # Example of a special handler. Others follow a similar pattern.
2256 # Example of a special handler. Others follow a similar pattern.
2250 if line.lstrip().startswith('!!'):
2257 if line.lstrip().startswith('!!'):
2251 # rewrite iFun/theRest to properly hold the call to %sx and
2258 # rewrite iFun/theRest to properly hold the call to %sx and
2252 # the actual command to be executed, so handle_magic can work
2259 # the actual command to be executed, so handle_magic can work
2253 # correctly
2260 # correctly
2254 theRest = '%s %s' % (iFun[2:],theRest)
2261 theRest = '%s %s' % (iFun[2:],theRest)
2255 iFun = 'sx'
2262 iFun = 'sx'
2256 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2263 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2257 line.lstrip()[2:]),
2264 line.lstrip()[2:]),
2258 continue_prompt,pre,iFun,theRest)
2265 continue_prompt,pre,iFun,theRest)
2259 else:
2266 else:
2260 cmd=line.lstrip().lstrip('!')
2267 cmd=line.lstrip().lstrip('!')
2261 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2268 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2262 # update cache/log and return
2269 # update cache/log and return
2263 self.log(line,line_out,continue_prompt)
2270 self.log(line,line_out,continue_prompt)
2264 return line_out
2271 return line_out
2265
2272
2266 def handle_magic(self, line, continue_prompt=None,
2273 def handle_magic(self, line, continue_prompt=None,
2267 pre=None,iFun=None,theRest=None):
2274 pre=None,iFun=None,theRest=None):
2268 """Execute magic functions."""
2275 """Execute magic functions."""
2269
2276
2270
2277
2271 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2278 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2272 self.log(line,cmd,continue_prompt)
2279 self.log(line,cmd,continue_prompt)
2273 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2280 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2274 return cmd
2281 return cmd
2275
2282
2276 def handle_auto(self, line, continue_prompt=None,
2283 def handle_auto(self, line, continue_prompt=None,
2277 pre=None,iFun=None,theRest=None,obj=None):
2284 pre=None,iFun=None,theRest=None,obj=None):
2278 """Hande lines which can be auto-executed, quoting if requested."""
2285 """Hande lines which can be auto-executed, quoting if requested."""
2279
2286
2280 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2287 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2281
2288
2282 # This should only be active for single-line input!
2289 # This should only be active for single-line input!
2283 if continue_prompt:
2290 if continue_prompt:
2284 self.log(line,line,continue_prompt)
2291 self.log(line,line,continue_prompt)
2285 return line
2292 return line
2286
2293
2287 auto_rewrite = True
2294 auto_rewrite = True
2288
2295
2289 if pre == self.ESC_QUOTE:
2296 if pre == self.ESC_QUOTE:
2290 # Auto-quote splitting on whitespace
2297 # Auto-quote splitting on whitespace
2291 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2298 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2292 elif pre == self.ESC_QUOTE2:
2299 elif pre == self.ESC_QUOTE2:
2293 # Auto-quote whole string
2300 # Auto-quote whole string
2294 newcmd = '%s("%s")' % (iFun,theRest)
2301 newcmd = '%s("%s")' % (iFun,theRest)
2295 elif pre == self.ESC_PAREN:
2302 elif pre == self.ESC_PAREN:
2296 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2303 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2297 else:
2304 else:
2298 # Auto-paren.
2305 # Auto-paren.
2299 # We only apply it to argument-less calls if the autocall
2306 # We only apply it to argument-less calls if the autocall
2300 # parameter is set to 2. We only need to check that autocall is <
2307 # parameter is set to 2. We only need to check that autocall is <
2301 # 2, since this function isn't called unless it's at least 1.
2308 # 2, since this function isn't called unless it's at least 1.
2302 if not theRest and (self.rc.autocall < 2):
2309 if not theRest and (self.rc.autocall < 2):
2303 newcmd = '%s %s' % (iFun,theRest)
2310 newcmd = '%s %s' % (iFun,theRest)
2304 auto_rewrite = False
2311 auto_rewrite = False
2305 else:
2312 else:
2306 if theRest.startswith('['):
2313 if theRest.startswith('['):
2307 if hasattr(obj,'__getitem__'):
2314 if hasattr(obj,'__getitem__'):
2308 # Don't autocall in this case: item access for an object
2315 # Don't autocall in this case: item access for an object
2309 # which is BOTH callable and implements __getitem__.
2316 # which is BOTH callable and implements __getitem__.
2310 newcmd = '%s %s' % (iFun,theRest)
2317 newcmd = '%s %s' % (iFun,theRest)
2311 auto_rewrite = False
2318 auto_rewrite = False
2312 else:
2319 else:
2313 # if the object doesn't support [] access, go ahead and
2320 # if the object doesn't support [] access, go ahead and
2314 # autocall
2321 # autocall
2315 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2322 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2316 elif theRest.endswith(';'):
2323 elif theRest.endswith(';'):
2317 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2324 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2318 else:
2325 else:
2319 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2326 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2320
2327
2321 if auto_rewrite:
2328 if auto_rewrite:
2322 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2329 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2323 # log what is now valid Python, not the actual user input (without the
2330 # log what is now valid Python, not the actual user input (without the
2324 # final newline)
2331 # final newline)
2325 self.log(line,newcmd,continue_prompt)
2332 self.log(line,newcmd,continue_prompt)
2326 return newcmd
2333 return newcmd
2327
2334
2328 def handle_help(self, line, continue_prompt=None,
2335 def handle_help(self, line, continue_prompt=None,
2329 pre=None,iFun=None,theRest=None):
2336 pre=None,iFun=None,theRest=None):
2330 """Try to get some help for the object.
2337 """Try to get some help for the object.
2331
2338
2332 obj? or ?obj -> basic information.
2339 obj? or ?obj -> basic information.
2333 obj?? or ??obj -> more details.
2340 obj?? or ??obj -> more details.
2334 """
2341 """
2335
2342
2336 # We need to make sure that we don't process lines which would be
2343 # We need to make sure that we don't process lines which would be
2337 # otherwise valid python, such as "x=1 # what?"
2344 # otherwise valid python, such as "x=1 # what?"
2338 try:
2345 try:
2339 codeop.compile_command(line)
2346 codeop.compile_command(line)
2340 except SyntaxError:
2347 except SyntaxError:
2341 # We should only handle as help stuff which is NOT valid syntax
2348 # We should only handle as help stuff which is NOT valid syntax
2342 if line[0]==self.ESC_HELP:
2349 if line[0]==self.ESC_HELP:
2343 line = line[1:]
2350 line = line[1:]
2344 elif line[-1]==self.ESC_HELP:
2351 elif line[-1]==self.ESC_HELP:
2345 line = line[:-1]
2352 line = line[:-1]
2346 self.log(line,'#?'+line,continue_prompt)
2353 self.log(line,'#?'+line,continue_prompt)
2347 if line:
2354 if line:
2348 self.magic_pinfo(line)
2355 self.magic_pinfo(line)
2349 else:
2356 else:
2350 page(self.usage,screen_lines=self.rc.screen_length)
2357 page(self.usage,screen_lines=self.rc.screen_length)
2351 return '' # Empty string is needed here!
2358 return '' # Empty string is needed here!
2352 except:
2359 except:
2353 # Pass any other exceptions through to the normal handler
2360 # Pass any other exceptions through to the normal handler
2354 return self.handle_normal(line,continue_prompt)
2361 return self.handle_normal(line,continue_prompt)
2355 else:
2362 else:
2356 # If the code compiles ok, we should handle it normally
2363 # If the code compiles ok, we should handle it normally
2357 return self.handle_normal(line,continue_prompt)
2364 return self.handle_normal(line,continue_prompt)
2358
2365
2359 def getapi(self):
2366 def getapi(self):
2360 """ Get an IPApi object for this shell instance
2367 """ Get an IPApi object for this shell instance
2361
2368
2362 Getting an IPApi object is always preferable to accessing the shell
2369 Getting an IPApi object is always preferable to accessing the shell
2363 directly, but this holds true especially for extensions.
2370 directly, but this holds true especially for extensions.
2364
2371
2365 It should always be possible to implement an extension with IPApi
2372 It should always be possible to implement an extension with IPApi
2366 alone. If not, contact maintainer to request an addition.
2373 alone. If not, contact maintainer to request an addition.
2367
2374
2368 """
2375 """
2369 return self.api
2376 return self.api
2370
2377
2371 def handle_emacs(self,line,continue_prompt=None,
2378 def handle_emacs(self,line,continue_prompt=None,
2372 pre=None,iFun=None,theRest=None):
2379 pre=None,iFun=None,theRest=None):
2373 """Handle input lines marked by python-mode."""
2380 """Handle input lines marked by python-mode."""
2374
2381
2375 # Currently, nothing is done. Later more functionality can be added
2382 # Currently, nothing is done. Later more functionality can be added
2376 # here if needed.
2383 # here if needed.
2377
2384
2378 # The input cache shouldn't be updated
2385 # The input cache shouldn't be updated
2379
2386
2380 return line
2387 return line
2381
2388
2382 def mktempfile(self,data=None):
2389 def mktempfile(self,data=None):
2383 """Make a new tempfile and return its filename.
2390 """Make a new tempfile and return its filename.
2384
2391
2385 This makes a call to tempfile.mktemp, but it registers the created
2392 This makes a call to tempfile.mktemp, but it registers the created
2386 filename internally so ipython cleans it up at exit time.
2393 filename internally so ipython cleans it up at exit time.
2387
2394
2388 Optional inputs:
2395 Optional inputs:
2389
2396
2390 - data(None): if data is given, it gets written out to the temp file
2397 - data(None): if data is given, it gets written out to the temp file
2391 immediately, and the file is closed again."""
2398 immediately, and the file is closed again."""
2392
2399
2393 filename = tempfile.mktemp('.py','ipython_edit_')
2400 filename = tempfile.mktemp('.py','ipython_edit_')
2394 self.tempfiles.append(filename)
2401 self.tempfiles.append(filename)
2395
2402
2396 if data:
2403 if data:
2397 tmp_file = open(filename,'w')
2404 tmp_file = open(filename,'w')
2398 tmp_file.write(data)
2405 tmp_file.write(data)
2399 tmp_file.close()
2406 tmp_file.close()
2400 return filename
2407 return filename
2401
2408
2402 def write(self,data):
2409 def write(self,data):
2403 """Write a string to the default output"""
2410 """Write a string to the default output"""
2404 Term.cout.write(data)
2411 Term.cout.write(data)
2405
2412
2406 def write_err(self,data):
2413 def write_err(self,data):
2407 """Write a string to the default error output"""
2414 """Write a string to the default error output"""
2408 Term.cerr.write(data)
2415 Term.cerr.write(data)
2409
2416
2410 def exit(self):
2417 def exit(self):
2411 """Handle interactive exit.
2418 """Handle interactive exit.
2412
2419
2413 This method sets the exit_now attribute."""
2420 This method sets the exit_now attribute."""
2414
2421
2415 if self.rc.confirm_exit:
2422 if self.rc.confirm_exit:
2416 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2423 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2417 self.exit_now = True
2424 self.exit_now = True
2418 else:
2425 else:
2419 self.exit_now = True
2426 self.exit_now = True
2420
2427
2421 def safe_execfile(self,fname,*where,**kw):
2428 def safe_execfile(self,fname,*where,**kw):
2429 """A safe version of the builtin execfile().
2430
2431 This version will never throw an exception, and knows how to handle
2432 ipython logs as well."""
2433
2434 def syspath_cleanup():
2435 """Internal cleanup routine for sys.path."""
2436 if add_dname:
2437 try:
2438 sys.path.remove(dname)
2439 except ValueError:
2440 # For some reason the user has already removed it, ignore.
2441 pass
2442
2422 fname = os.path.expanduser(fname)
2443 fname = os.path.expanduser(fname)
2423
2444
2445 # Find things also in current directory. This is needed to mimic the
2446 # behavior of running a script from the system command line, where
2447 # Python inserts the script's directory into sys.path
2448 dname = os.path.dirname(os.path.abspath(fname))
2449 add_dname = False
2450 if dname not in sys.path:
2451 sys.path.insert(0,dname)
2452 add_dname = True
2453
2424 try:
2454 try:
2425 xfile = open(fname)
2455 xfile = open(fname)
2426 except:
2456 except:
2427 print >> Term.cerr, \
2457 print >> Term.cerr, \
2428 'Could not open file <%s> for safe execution.' % fname
2458 'Could not open file <%s> for safe execution.' % fname
2459 syspath_cleanup()
2429 return None
2460 return None
2430
2461
2431 kw.setdefault('islog',0)
2462 kw.setdefault('islog',0)
2432 kw.setdefault('quiet',1)
2463 kw.setdefault('quiet',1)
2433 kw.setdefault('exit_ignore',0)
2464 kw.setdefault('exit_ignore',0)
2434 first = xfile.readline()
2465 first = xfile.readline()
2435 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2466 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2436 xfile.close()
2467 xfile.close()
2437 # line by line execution
2468 # line by line execution
2438 if first.startswith(loghead) or kw['islog']:
2469 if first.startswith(loghead) or kw['islog']:
2439 print 'Loading log file <%s> one line at a time...' % fname
2470 print 'Loading log file <%s> one line at a time...' % fname
2440 if kw['quiet']:
2471 if kw['quiet']:
2441 stdout_save = sys.stdout
2472 stdout_save = sys.stdout
2442 sys.stdout = StringIO.StringIO()
2473 sys.stdout = StringIO.StringIO()
2443 try:
2474 try:
2444 globs,locs = where[0:2]
2475 globs,locs = where[0:2]
2445 except:
2476 except:
2446 try:
2477 try:
2447 globs = locs = where[0]
2478 globs = locs = where[0]
2448 except:
2479 except:
2449 globs = locs = globals()
2480 globs = locs = globals()
2450 badblocks = []
2481 badblocks = []
2451
2482
2452 # we also need to identify indented blocks of code when replaying
2483 # we also need to identify indented blocks of code when replaying
2453 # logs and put them together before passing them to an exec
2484 # logs and put them together before passing them to an exec
2454 # statement. This takes a bit of regexp and look-ahead work in the
2485 # statement. This takes a bit of regexp and look-ahead work in the
2455 # file. It's easiest if we swallow the whole thing in memory
2486 # file. It's easiest if we swallow the whole thing in memory
2456 # first, and manually walk through the lines list moving the
2487 # first, and manually walk through the lines list moving the
2457 # counter ourselves.
2488 # counter ourselves.
2458 indent_re = re.compile('\s+\S')
2489 indent_re = re.compile('\s+\S')
2459 xfile = open(fname)
2490 xfile = open(fname)
2460 filelines = xfile.readlines()
2491 filelines = xfile.readlines()
2461 xfile.close()
2492 xfile.close()
2462 nlines = len(filelines)
2493 nlines = len(filelines)
2463 lnum = 0
2494 lnum = 0
2464 while lnum < nlines:
2495 while lnum < nlines:
2465 line = filelines[lnum]
2496 line = filelines[lnum]
2466 lnum += 1
2497 lnum += 1
2467 # don't re-insert logger status info into cache
2498 # don't re-insert logger status info into cache
2468 if line.startswith('#log#'):
2499 if line.startswith('#log#'):
2469 continue
2500 continue
2470 else:
2501 else:
2471 # build a block of code (maybe a single line) for execution
2502 # build a block of code (maybe a single line) for execution
2472 block = line
2503 block = line
2473 try:
2504 try:
2474 next = filelines[lnum] # lnum has already incremented
2505 next = filelines[lnum] # lnum has already incremented
2475 except:
2506 except:
2476 next = None
2507 next = None
2477 while next and indent_re.match(next):
2508 while next and indent_re.match(next):
2478 block += next
2509 block += next
2479 lnum += 1
2510 lnum += 1
2480 try:
2511 try:
2481 next = filelines[lnum]
2512 next = filelines[lnum]
2482 except:
2513 except:
2483 next = None
2514 next = None
2484 # now execute the block of one or more lines
2515 # now execute the block of one or more lines
2485 try:
2516 try:
2486 exec block in globs,locs
2517 exec block in globs,locs
2487 except SystemExit:
2518 except SystemExit:
2488 pass
2519 pass
2489 except:
2520 except:
2490 badblocks.append(block.rstrip())
2521 badblocks.append(block.rstrip())
2491 if kw['quiet']: # restore stdout
2522 if kw['quiet']: # restore stdout
2492 sys.stdout.close()
2523 sys.stdout.close()
2493 sys.stdout = stdout_save
2524 sys.stdout = stdout_save
2494 print 'Finished replaying log file <%s>' % fname
2525 print 'Finished replaying log file <%s>' % fname
2495 if badblocks:
2526 if badblocks:
2496 print >> sys.stderr, ('\nThe following lines/blocks in file '
2527 print >> sys.stderr, ('\nThe following lines/blocks in file '
2497 '<%s> reported errors:' % fname)
2528 '<%s> reported errors:' % fname)
2498
2529
2499 for badline in badblocks:
2530 for badline in badblocks:
2500 print >> sys.stderr, badline
2531 print >> sys.stderr, badline
2501 else: # regular file execution
2532 else: # regular file execution
2502 try:
2533 try:
2503 execfile(fname,*where)
2534 execfile(fname,*where)
2504 except SyntaxError:
2535 except SyntaxError:
2505 self.showsyntaxerror()
2536 self.showsyntaxerror()
2506 warn('Failure executing file: <%s>' % fname)
2537 warn('Failure executing file: <%s>' % fname)
2507 except SystemExit,status:
2538 except SystemExit,status:
2508 if not kw['exit_ignore']:
2539 if not kw['exit_ignore']:
2509 self.showtraceback()
2540 self.showtraceback()
2510 warn('Failure executing file: <%s>' % fname)
2541 warn('Failure executing file: <%s>' % fname)
2511 except:
2542 except:
2512 self.showtraceback()
2543 self.showtraceback()
2513 warn('Failure executing file: <%s>' % fname)
2544 warn('Failure executing file: <%s>' % fname)
2514
2545
2546 syspath_cleanup()
2547
2515 #************************* end of file <iplib.py> *****************************
2548 #************************* end of file <iplib.py> *****************************
@@ -1,5927 +1,5936 b''
1 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
4 input if it starts with whitespace. This allows you to paste
5 indented input from any editor without manually having to type in
6 the 'if 1:', which is conveninent when working interactively.
7 Slightly modifed version of a patch by Bo Peng
8 <bpeng-AT-rice.edu>.
9
1 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
10 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
2
11
3 * IPython/irunner.py (main): modified irunner so it automatically
12 * IPython/irunner.py (main): modified irunner so it automatically
4 recognizes the right runner to use based on the extension (.py for
13 recognizes the right runner to use based on the extension (.py for
5 python, .ipy for ipython and .sage for sage).
14 python, .ipy for ipython and .sage for sage).
6
15
7 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
16 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
8 visible in ipapi as ip.config(), to programatically control the
17 visible in ipapi as ip.config(), to programatically control the
9 internal rc object. There's an accompanying %config magic for
18 internal rc object. There's an accompanying %config magic for
10 interactive use, which has been enhanced to match the
19 interactive use, which has been enhanced to match the
11 funtionality in ipconfig.
20 funtionality in ipconfig.
12
21
13 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
22 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
14 so it's not just a toggle, it now takes an argument. Add support
23 so it's not just a toggle, it now takes an argument. Add support
15 for a customizable header when making system calls, as the new
24 for a customizable header when making system calls, as the new
16 system_header variable in the ipythonrc file.
25 system_header variable in the ipythonrc file.
17
26
18 2006-11-03 Walter Doerwald <walter@livinglogic.de>
27 2006-11-03 Walter Doerwald <walter@livinglogic.de>
19
28
20 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
29 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
21 generic functions (using Philip J. Eby's simplegeneric package).
30 generic functions (using Philip J. Eby's simplegeneric package).
22 This makes it possible to customize the display of third-party classes
31 This makes it possible to customize the display of third-party classes
23 without having to monkeypatch them. xiter() no longer supports a mode
32 without having to monkeypatch them. xiter() no longer supports a mode
24 argument and the XMode class has been removed. The same functionality can
33 argument and the XMode class has been removed. The same functionality can
25 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
34 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
26 One consequence of the switch to generic functions is that xrepr() and
35 One consequence of the switch to generic functions is that xrepr() and
27 xattrs() implementation must define the default value for the mode
36 xattrs() implementation must define the default value for the mode
28 argument themselves and xattrs() implementations must return real
37 argument themselves and xattrs() implementations must return real
29 descriptors.
38 descriptors.
30
39
31 * IPython/external: This new subpackage will contain all third-party
40 * IPython/external: This new subpackage will contain all third-party
32 packages that are bundled with IPython. (The first one is simplegeneric).
41 packages that are bundled with IPython. (The first one is simplegeneric).
33
42
34 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
43 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
35 directory which as been dropped in r1703.
44 directory which as been dropped in r1703.
36
45
37 * IPython/Extensions/ipipe.py (iless): Fixed.
46 * IPython/Extensions/ipipe.py (iless): Fixed.
38
47
39 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
48 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
40
49
41 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
50 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
42
51
43 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
52 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
44 handling in variable expansion so that shells and magics recognize
53 handling in variable expansion so that shells and magics recognize
45 function local scopes correctly. Bug reported by Brian.
54 function local scopes correctly. Bug reported by Brian.
46
55
47 * scripts/ipython: remove the very first entry in sys.path which
56 * scripts/ipython: remove the very first entry in sys.path which
48 Python auto-inserts for scripts, so that sys.path under IPython is
57 Python auto-inserts for scripts, so that sys.path under IPython is
49 as similar as possible to that under plain Python.
58 as similar as possible to that under plain Python.
50
59
51 * IPython/completer.py (IPCompleter.file_matches): Fix
60 * IPython/completer.py (IPCompleter.file_matches): Fix
52 tab-completion so that quotes are not closed unless the completion
61 tab-completion so that quotes are not closed unless the completion
53 is unambiguous. After a request by Stefan. Minor cleanups in
62 is unambiguous. After a request by Stefan. Minor cleanups in
54 ipy_stock_completers.
63 ipy_stock_completers.
55
64
56 2006-11-02 Ville Vainio <vivainio@gmail.com>
65 2006-11-02 Ville Vainio <vivainio@gmail.com>
57
66
58 * ipy_stock_completers.py: Add %run and %cd completers.
67 * ipy_stock_completers.py: Add %run and %cd completers.
59
68
60 * completer.py: Try running custom completer for both
69 * completer.py: Try running custom completer for both
61 "foo" and "%foo" if the command is just "foo". Ignore case
70 "foo" and "%foo" if the command is just "foo". Ignore case
62 when filtering possible completions.
71 when filtering possible completions.
63
72
64 * UserConfig/ipy_user_conf.py: install stock completers as default
73 * UserConfig/ipy_user_conf.py: install stock completers as default
65
74
66 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
75 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
67 simplified readline history save / restore through a wrapper
76 simplified readline history save / restore through a wrapper
68 function
77 function
69
78
70
79
71 2006-10-31 Ville Vainio <vivainio@gmail.com>
80 2006-10-31 Ville Vainio <vivainio@gmail.com>
72
81
73 * strdispatch.py, completer.py, ipy_stock_completers.py:
82 * strdispatch.py, completer.py, ipy_stock_completers.py:
74 Allow str_key ("command") in completer hooks. Implement
83 Allow str_key ("command") in completer hooks. Implement
75 trivial completer for 'import' (stdlib modules only). Rename
84 trivial completer for 'import' (stdlib modules only). Rename
76 ipy_linux_package_managers.py to ipy_stock_completers.py.
85 ipy_linux_package_managers.py to ipy_stock_completers.py.
77 SVN completer.
86 SVN completer.
78
87
79 * Extensions/ledit.py: %magic line editor for easily and
88 * Extensions/ledit.py: %magic line editor for easily and
80 incrementally manipulating lists of strings. The magic command
89 incrementally manipulating lists of strings. The magic command
81 name is %led.
90 name is %led.
82
91
83 2006-10-30 Ville Vainio <vivainio@gmail.com>
92 2006-10-30 Ville Vainio <vivainio@gmail.com>
84
93
85 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
94 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
86 Bernsteins's patches for pydb integration.
95 Bernsteins's patches for pydb integration.
87 http://bashdb.sourceforge.net/pydb/
96 http://bashdb.sourceforge.net/pydb/
88
97
89 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
98 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
90 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
99 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
91 custom completer hook to allow the users to implement their own
100 custom completer hook to allow the users to implement their own
92 completers. See ipy_linux_package_managers.py for example. The
101 completers. See ipy_linux_package_managers.py for example. The
93 hook name is 'complete_command'.
102 hook name is 'complete_command'.
94
103
95 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
104 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
96
105
97 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
106 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
98 Numeric leftovers.
107 Numeric leftovers.
99
108
100 * ipython.el (py-execute-region): apply Stefan's patch to fix
109 * ipython.el (py-execute-region): apply Stefan's patch to fix
101 garbled results if the python shell hasn't been previously started.
110 garbled results if the python shell hasn't been previously started.
102
111
103 * IPython/genutils.py (arg_split): moved to genutils, since it's a
112 * IPython/genutils.py (arg_split): moved to genutils, since it's a
104 pretty generic function and useful for other things.
113 pretty generic function and useful for other things.
105
114
106 * IPython/OInspect.py (getsource): Add customizable source
115 * IPython/OInspect.py (getsource): Add customizable source
107 extractor. After a request/patch form W. Stein (SAGE).
116 extractor. After a request/patch form W. Stein (SAGE).
108
117
109 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
118 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
110 window size to a more reasonable value from what pexpect does,
119 window size to a more reasonable value from what pexpect does,
111 since their choice causes wrapping bugs with long input lines.
120 since their choice causes wrapping bugs with long input lines.
112
121
113 2006-10-28 Ville Vainio <vivainio@gmail.com>
122 2006-10-28 Ville Vainio <vivainio@gmail.com>
114
123
115 * Magic.py (%run): Save and restore the readline history from
124 * Magic.py (%run): Save and restore the readline history from
116 file around %run commands to prevent side effects from
125 file around %run commands to prevent side effects from
117 %runned programs that might use readline (e.g. pydb).
126 %runned programs that might use readline (e.g. pydb).
118
127
119 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
128 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
120 invoking the pydb enhanced debugger.
129 invoking the pydb enhanced debugger.
121
130
122 2006-10-23 Walter Doerwald <walter@livinglogic.de>
131 2006-10-23 Walter Doerwald <walter@livinglogic.de>
123
132
124 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
133 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
125 call the base class method and propagate the return value to
134 call the base class method and propagate the return value to
126 ifile. This is now done by path itself.
135 ifile. This is now done by path itself.
127
136
128 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
137 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
129
138
130 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
139 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
131 api: set_crash_handler(), to expose the ability to change the
140 api: set_crash_handler(), to expose the ability to change the
132 internal crash handler.
141 internal crash handler.
133
142
134 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
143 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
135 the various parameters of the crash handler so that apps using
144 the various parameters of the crash handler so that apps using
136 IPython as their engine can customize crash handling. Ipmlemented
145 IPython as their engine can customize crash handling. Ipmlemented
137 at the request of SAGE.
146 at the request of SAGE.
138
147
139 2006-10-14 Ville Vainio <vivainio@gmail.com>
148 2006-10-14 Ville Vainio <vivainio@gmail.com>
140
149
141 * Magic.py, ipython.el: applied first "safe" part of Rocky
150 * Magic.py, ipython.el: applied first "safe" part of Rocky
142 Bernstein's patch set for pydb integration.
151 Bernstein's patch set for pydb integration.
143
152
144 * Magic.py (%unalias, %alias): %store'd aliases can now be
153 * Magic.py (%unalias, %alias): %store'd aliases can now be
145 removed with '%unalias'. %alias w/o args now shows most
154 removed with '%unalias'. %alias w/o args now shows most
146 interesting (stored / manually defined) aliases last
155 interesting (stored / manually defined) aliases last
147 where they catch the eye w/o scrolling.
156 where they catch the eye w/o scrolling.
148
157
149 * Magic.py (%rehashx), ext_rehashdir.py: files with
158 * Magic.py (%rehashx), ext_rehashdir.py: files with
150 'py' extension are always considered executable, even
159 'py' extension are always considered executable, even
151 when not in PATHEXT environment variable.
160 when not in PATHEXT environment variable.
152
161
153 2006-10-12 Ville Vainio <vivainio@gmail.com>
162 2006-10-12 Ville Vainio <vivainio@gmail.com>
154
163
155 * jobctrl.py: Add new "jobctrl" extension for spawning background
164 * jobctrl.py: Add new "jobctrl" extension for spawning background
156 processes with "&find /". 'import jobctrl' to try it out. Requires
165 processes with "&find /". 'import jobctrl' to try it out. Requires
157 'subprocess' module, standard in python 2.4+.
166 'subprocess' module, standard in python 2.4+.
158
167
159 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
168 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
160 so if foo -> bar and bar -> baz, then foo -> baz.
169 so if foo -> bar and bar -> baz, then foo -> baz.
161
170
162 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
171 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
163
172
164 * IPython/Magic.py (Magic.parse_options): add a new posix option
173 * IPython/Magic.py (Magic.parse_options): add a new posix option
165 to allow parsing of input args in magics that doesn't strip quotes
174 to allow parsing of input args in magics that doesn't strip quotes
166 (if posix=False). This also closes %timeit bug reported by
175 (if posix=False). This also closes %timeit bug reported by
167 Stefan.
176 Stefan.
168
177
169 2006-10-03 Ville Vainio <vivainio@gmail.com>
178 2006-10-03 Ville Vainio <vivainio@gmail.com>
170
179
171 * iplib.py (raw_input, interact): Return ValueError catching for
180 * iplib.py (raw_input, interact): Return ValueError catching for
172 raw_input. Fixes infinite loop for sys.stdin.close() or
181 raw_input. Fixes infinite loop for sys.stdin.close() or
173 sys.stdout.close().
182 sys.stdout.close().
174
183
175 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
184 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
176
185
177 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
186 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
178 to help in handling doctests. irunner is now pretty useful for
187 to help in handling doctests. irunner is now pretty useful for
179 running standalone scripts and simulate a full interactive session
188 running standalone scripts and simulate a full interactive session
180 in a format that can be then pasted as a doctest.
189 in a format that can be then pasted as a doctest.
181
190
182 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
191 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
183 on top of the default (useless) ones. This also fixes the nasty
192 on top of the default (useless) ones. This also fixes the nasty
184 way in which 2.5's Quitter() exits (reverted [1785]).
193 way in which 2.5's Quitter() exits (reverted [1785]).
185
194
186 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
195 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
187 2.5.
196 2.5.
188
197
189 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
198 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
190 color scheme is updated as well when color scheme is changed
199 color scheme is updated as well when color scheme is changed
191 interactively.
200 interactively.
192
201
193 2006-09-27 Ville Vainio <vivainio@gmail.com>
202 2006-09-27 Ville Vainio <vivainio@gmail.com>
194
203
195 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
204 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
196 infinite loop and just exit. It's a hack, but will do for a while.
205 infinite loop and just exit. It's a hack, but will do for a while.
197
206
198 2006-08-25 Walter Doerwald <walter@livinglogic.de>
207 2006-08-25 Walter Doerwald <walter@livinglogic.de>
199
208
200 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
209 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
201 the constructor, this makes it possible to get a list of only directories
210 the constructor, this makes it possible to get a list of only directories
202 or only files.
211 or only files.
203
212
204 2006-08-12 Ville Vainio <vivainio@gmail.com>
213 2006-08-12 Ville Vainio <vivainio@gmail.com>
205
214
206 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
215 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
207 they broke unittest
216 they broke unittest
208
217
209 2006-08-11 Ville Vainio <vivainio@gmail.com>
218 2006-08-11 Ville Vainio <vivainio@gmail.com>
210
219
211 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
220 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
212 by resolving issue properly, i.e. by inheriting FakeModule
221 by resolving issue properly, i.e. by inheriting FakeModule
213 from types.ModuleType. Pickling ipython interactive data
222 from types.ModuleType. Pickling ipython interactive data
214 should still work as usual (testing appreciated).
223 should still work as usual (testing appreciated).
215
224
216 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
225 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
217
226
218 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
227 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
219 running under python 2.3 with code from 2.4 to fix a bug with
228 running under python 2.3 with code from 2.4 to fix a bug with
220 help(). Reported by the Debian maintainers, Norbert Tretkowski
229 help(). Reported by the Debian maintainers, Norbert Tretkowski
221 <norbert-AT-tretkowski.de> and Alexandre Fayolle
230 <norbert-AT-tretkowski.de> and Alexandre Fayolle
222 <afayolle-AT-debian.org>.
231 <afayolle-AT-debian.org>.
223
232
224 2006-08-04 Walter Doerwald <walter@livinglogic.de>
233 2006-08-04 Walter Doerwald <walter@livinglogic.de>
225
234
226 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
235 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
227 (which was displaying "quit" twice).
236 (which was displaying "quit" twice).
228
237
229 2006-07-28 Walter Doerwald <walter@livinglogic.de>
238 2006-07-28 Walter Doerwald <walter@livinglogic.de>
230
239
231 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
240 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
232 the mode argument).
241 the mode argument).
233
242
234 2006-07-27 Walter Doerwald <walter@livinglogic.de>
243 2006-07-27 Walter Doerwald <walter@livinglogic.de>
235
244
236 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
245 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
237 not running under IPython.
246 not running under IPython.
238
247
239 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
248 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
240 and make it iterable (iterating over the attribute itself). Add two new
249 and make it iterable (iterating over the attribute itself). Add two new
241 magic strings for __xattrs__(): If the string starts with "-", the attribute
250 magic strings for __xattrs__(): If the string starts with "-", the attribute
242 will not be displayed in ibrowse's detail view (but it can still be
251 will not be displayed in ibrowse's detail view (but it can still be
243 iterated over). This makes it possible to add attributes that are large
252 iterated over). This makes it possible to add attributes that are large
244 lists or generator methods to the detail view. Replace magic attribute names
253 lists or generator methods to the detail view. Replace magic attribute names
245 and _attrname() and _getattr() with "descriptors": For each type of magic
254 and _attrname() and _getattr() with "descriptors": For each type of magic
246 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
255 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
247 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
256 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
248 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
257 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
249 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
258 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
250 are still supported.
259 are still supported.
251
260
252 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
261 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
253 fails in ibrowse.fetch(), the exception object is added as the last item
262 fails in ibrowse.fetch(), the exception object is added as the last item
254 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
263 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
255 a generator throws an exception midway through execution.
264 a generator throws an exception midway through execution.
256
265
257 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
266 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
258 encoding into methods.
267 encoding into methods.
259
268
260 2006-07-26 Ville Vainio <vivainio@gmail.com>
269 2006-07-26 Ville Vainio <vivainio@gmail.com>
261
270
262 * iplib.py: history now stores multiline input as single
271 * iplib.py: history now stores multiline input as single
263 history entries. Patch by Jorgen Cederlof.
272 history entries. Patch by Jorgen Cederlof.
264
273
265 2006-07-18 Walter Doerwald <walter@livinglogic.de>
274 2006-07-18 Walter Doerwald <walter@livinglogic.de>
266
275
267 * IPython/Extensions/ibrowse.py: Make cursor visible over
276 * IPython/Extensions/ibrowse.py: Make cursor visible over
268 non existing attributes.
277 non existing attributes.
269
278
270 2006-07-14 Walter Doerwald <walter@livinglogic.de>
279 2006-07-14 Walter Doerwald <walter@livinglogic.de>
271
280
272 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
281 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
273 error output of the running command doesn't mess up the screen.
282 error output of the running command doesn't mess up the screen.
274
283
275 2006-07-13 Walter Doerwald <walter@livinglogic.de>
284 2006-07-13 Walter Doerwald <walter@livinglogic.de>
276
285
277 * IPython/Extensions/ipipe.py (isort): Make isort usable without
286 * IPython/Extensions/ipipe.py (isort): Make isort usable without
278 argument. This sorts the items themselves.
287 argument. This sorts the items themselves.
279
288
280 2006-07-12 Walter Doerwald <walter@livinglogic.de>
289 2006-07-12 Walter Doerwald <walter@livinglogic.de>
281
290
282 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
291 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
283 Compile expression strings into code objects. This should speed
292 Compile expression strings into code objects. This should speed
284 up ifilter and friends somewhat.
293 up ifilter and friends somewhat.
285
294
286 2006-07-08 Ville Vainio <vivainio@gmail.com>
295 2006-07-08 Ville Vainio <vivainio@gmail.com>
287
296
288 * Magic.py: %cpaste now strips > from the beginning of lines
297 * Magic.py: %cpaste now strips > from the beginning of lines
289 to ease pasting quoted code from emails. Contributed by
298 to ease pasting quoted code from emails. Contributed by
290 Stefan van der Walt.
299 Stefan van der Walt.
291
300
292 2006-06-29 Ville Vainio <vivainio@gmail.com>
301 2006-06-29 Ville Vainio <vivainio@gmail.com>
293
302
294 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
303 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
295 mode, patch contributed by Darren Dale. NEEDS TESTING!
304 mode, patch contributed by Darren Dale. NEEDS TESTING!
296
305
297 2006-06-28 Walter Doerwald <walter@livinglogic.de>
306 2006-06-28 Walter Doerwald <walter@livinglogic.de>
298
307
299 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
308 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
300 a blue background. Fix fetching new display rows when the browser
309 a blue background. Fix fetching new display rows when the browser
301 scrolls more than a screenful (e.g. by using the goto command).
310 scrolls more than a screenful (e.g. by using the goto command).
302
311
303 2006-06-27 Ville Vainio <vivainio@gmail.com>
312 2006-06-27 Ville Vainio <vivainio@gmail.com>
304
313
305 * Magic.py (_inspect, _ofind) Apply David Huard's
314 * Magic.py (_inspect, _ofind) Apply David Huard's
306 patch for displaying the correct docstring for 'property'
315 patch for displaying the correct docstring for 'property'
307 attributes.
316 attributes.
308
317
309 2006-06-23 Walter Doerwald <walter@livinglogic.de>
318 2006-06-23 Walter Doerwald <walter@livinglogic.de>
310
319
311 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
320 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
312 commands into the methods implementing them.
321 commands into the methods implementing them.
313
322
314 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
323 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
315
324
316 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
325 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
317 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
326 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
318 autoindent support was authored by Jin Liu.
327 autoindent support was authored by Jin Liu.
319
328
320 2006-06-22 Walter Doerwald <walter@livinglogic.de>
329 2006-06-22 Walter Doerwald <walter@livinglogic.de>
321
330
322 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
331 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
323 for keymaps with a custom class that simplifies handling.
332 for keymaps with a custom class that simplifies handling.
324
333
325 2006-06-19 Walter Doerwald <walter@livinglogic.de>
334 2006-06-19 Walter Doerwald <walter@livinglogic.de>
326
335
327 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
336 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
328 resizing. This requires Python 2.5 to work.
337 resizing. This requires Python 2.5 to work.
329
338
330 2006-06-16 Walter Doerwald <walter@livinglogic.de>
339 2006-06-16 Walter Doerwald <walter@livinglogic.de>
331
340
332 * IPython/Extensions/ibrowse.py: Add two new commands to
341 * IPython/Extensions/ibrowse.py: Add two new commands to
333 ibrowse: "hideattr" (mapped to "h") hides the attribute under
342 ibrowse: "hideattr" (mapped to "h") hides the attribute under
334 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
343 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
335 attributes again. Remapped the help command to "?". Display
344 attributes again. Remapped the help command to "?". Display
336 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
345 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
337 as keys for the "home" and "end" commands. Add three new commands
346 as keys for the "home" and "end" commands. Add three new commands
338 to the input mode for "find" and friends: "delend" (CTRL-K)
347 to the input mode for "find" and friends: "delend" (CTRL-K)
339 deletes to the end of line. "incsearchup" searches upwards in the
348 deletes to the end of line. "incsearchup" searches upwards in the
340 command history for an input that starts with the text before the cursor.
349 command history for an input that starts with the text before the cursor.
341 "incsearchdown" does the same downwards. Removed a bogus mapping of
350 "incsearchdown" does the same downwards. Removed a bogus mapping of
342 the x key to "delete".
351 the x key to "delete".
343
352
344 2006-06-15 Ville Vainio <vivainio@gmail.com>
353 2006-06-15 Ville Vainio <vivainio@gmail.com>
345
354
346 * iplib.py, hooks.py: Added new generate_prompt hook that can be
355 * iplib.py, hooks.py: Added new generate_prompt hook that can be
347 used to create prompts dynamically, instead of the "old" way of
356 used to create prompts dynamically, instead of the "old" way of
348 assigning "magic" strings to prompt_in1 and prompt_in2. The old
357 assigning "magic" strings to prompt_in1 and prompt_in2. The old
349 way still works (it's invoked by the default hook), of course.
358 way still works (it's invoked by the default hook), of course.
350
359
351 * Prompts.py: added generate_output_prompt hook for altering output
360 * Prompts.py: added generate_output_prompt hook for altering output
352 prompt
361 prompt
353
362
354 * Release.py: Changed version string to 0.7.3.svn.
363 * Release.py: Changed version string to 0.7.3.svn.
355
364
356 2006-06-15 Walter Doerwald <walter@livinglogic.de>
365 2006-06-15 Walter Doerwald <walter@livinglogic.de>
357
366
358 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
367 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
359 the call to fetch() always tries to fetch enough data for at least one
368 the call to fetch() always tries to fetch enough data for at least one
360 full screen. This makes it possible to simply call moveto(0,0,True) in
369 full screen. This makes it possible to simply call moveto(0,0,True) in
361 the constructor. Fix typos and removed the obsolete goto attribute.
370 the constructor. Fix typos and removed the obsolete goto attribute.
362
371
363 2006-06-12 Ville Vainio <vivainio@gmail.com>
372 2006-06-12 Ville Vainio <vivainio@gmail.com>
364
373
365 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
374 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
366 allowing $variable interpolation within multiline statements,
375 allowing $variable interpolation within multiline statements,
367 though so far only with "sh" profile for a testing period.
376 though so far only with "sh" profile for a testing period.
368 The patch also enables splitting long commands with \ but it
377 The patch also enables splitting long commands with \ but it
369 doesn't work properly yet.
378 doesn't work properly yet.
370
379
371 2006-06-12 Walter Doerwald <walter@livinglogic.de>
380 2006-06-12 Walter Doerwald <walter@livinglogic.de>
372
381
373 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
382 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
374 input history and the position of the cursor in the input history for
383 input history and the position of the cursor in the input history for
375 the find, findbackwards and goto command.
384 the find, findbackwards and goto command.
376
385
377 2006-06-10 Walter Doerwald <walter@livinglogic.de>
386 2006-06-10 Walter Doerwald <walter@livinglogic.de>
378
387
379 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
388 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
380 implements the basic functionality of browser commands that require
389 implements the basic functionality of browser commands that require
381 input. Reimplement the goto, find and findbackwards commands as
390 input. Reimplement the goto, find and findbackwards commands as
382 subclasses of _CommandInput. Add an input history and keymaps to those
391 subclasses of _CommandInput. Add an input history and keymaps to those
383 commands. Add "\r" as a keyboard shortcut for the enterdefault and
392 commands. Add "\r" as a keyboard shortcut for the enterdefault and
384 execute commands.
393 execute commands.
385
394
386 2006-06-07 Ville Vainio <vivainio@gmail.com>
395 2006-06-07 Ville Vainio <vivainio@gmail.com>
387
396
388 * iplib.py: ipython mybatch.ipy exits ipython immediately after
397 * iplib.py: ipython mybatch.ipy exits ipython immediately after
389 running the batch files instead of leaving the session open.
398 running the batch files instead of leaving the session open.
390
399
391 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
400 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
392
401
393 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
402 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
394 the original fix was incomplete. Patch submitted by W. Maier.
403 the original fix was incomplete. Patch submitted by W. Maier.
395
404
396 2006-06-07 Ville Vainio <vivainio@gmail.com>
405 2006-06-07 Ville Vainio <vivainio@gmail.com>
397
406
398 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
407 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
399 Confirmation prompts can be supressed by 'quiet' option.
408 Confirmation prompts can be supressed by 'quiet' option.
400 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
409 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
401
410
402 2006-06-06 *** Released version 0.7.2
411 2006-06-06 *** Released version 0.7.2
403
412
404 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
413 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
405
414
406 * IPython/Release.py (version): Made 0.7.2 final for release.
415 * IPython/Release.py (version): Made 0.7.2 final for release.
407 Repo tagged and release cut.
416 Repo tagged and release cut.
408
417
409 2006-06-05 Ville Vainio <vivainio@gmail.com>
418 2006-06-05 Ville Vainio <vivainio@gmail.com>
410
419
411 * Magic.py (magic_rehashx): Honor no_alias list earlier in
420 * Magic.py (magic_rehashx): Honor no_alias list earlier in
412 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
421 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
413
422
414 * upgrade_dir.py: try import 'path' module a bit harder
423 * upgrade_dir.py: try import 'path' module a bit harder
415 (for %upgrade)
424 (for %upgrade)
416
425
417 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
426 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
418
427
419 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
428 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
420 instead of looping 20 times.
429 instead of looping 20 times.
421
430
422 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
431 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
423 correctly at initialization time. Bug reported by Krishna Mohan
432 correctly at initialization time. Bug reported by Krishna Mohan
424 Gundu <gkmohan-AT-gmail.com> on the user list.
433 Gundu <gkmohan-AT-gmail.com> on the user list.
425
434
426 * IPython/Release.py (version): Mark 0.7.2 version to start
435 * IPython/Release.py (version): Mark 0.7.2 version to start
427 testing for release on 06/06.
436 testing for release on 06/06.
428
437
429 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
438 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
430
439
431 * scripts/irunner: thin script interface so users don't have to
440 * scripts/irunner: thin script interface so users don't have to
432 find the module and call it as an executable, since modules rarely
441 find the module and call it as an executable, since modules rarely
433 live in people's PATH.
442 live in people's PATH.
434
443
435 * IPython/irunner.py (InteractiveRunner.__init__): added
444 * IPython/irunner.py (InteractiveRunner.__init__): added
436 delaybeforesend attribute to control delays with newer versions of
445 delaybeforesend attribute to control delays with newer versions of
437 pexpect. Thanks to detailed help from pexpect's author, Noah
446 pexpect. Thanks to detailed help from pexpect's author, Noah
438 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
447 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
439 correctly (it works in NoColor mode).
448 correctly (it works in NoColor mode).
440
449
441 * IPython/iplib.py (handle_normal): fix nasty crash reported on
450 * IPython/iplib.py (handle_normal): fix nasty crash reported on
442 SAGE list, from improper log() calls.
451 SAGE list, from improper log() calls.
443
452
444 2006-05-31 Ville Vainio <vivainio@gmail.com>
453 2006-05-31 Ville Vainio <vivainio@gmail.com>
445
454
446 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
455 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
447 with args in parens to work correctly with dirs that have spaces.
456 with args in parens to work correctly with dirs that have spaces.
448
457
449 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
458 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
450
459
451 * IPython/Logger.py (Logger.logstart): add option to log raw input
460 * IPython/Logger.py (Logger.logstart): add option to log raw input
452 instead of the processed one. A -r flag was added to the
461 instead of the processed one. A -r flag was added to the
453 %logstart magic used for controlling logging.
462 %logstart magic used for controlling logging.
454
463
455 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
464 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
456
465
457 * IPython/iplib.py (InteractiveShell.__init__): add check for the
466 * IPython/iplib.py (InteractiveShell.__init__): add check for the
458 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
467 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
459 recognize the option. After a bug report by Will Maier. This
468 recognize the option. After a bug report by Will Maier. This
460 closes #64 (will do it after confirmation from W. Maier).
469 closes #64 (will do it after confirmation from W. Maier).
461
470
462 * IPython/irunner.py: New module to run scripts as if manually
471 * IPython/irunner.py: New module to run scripts as if manually
463 typed into an interactive environment, based on pexpect. After a
472 typed into an interactive environment, based on pexpect. After a
464 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
473 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
465 ipython-user list. Simple unittests in the tests/ directory.
474 ipython-user list. Simple unittests in the tests/ directory.
466
475
467 * tools/release: add Will Maier, OpenBSD port maintainer, to
476 * tools/release: add Will Maier, OpenBSD port maintainer, to
468 recepients list. We are now officially part of the OpenBSD ports:
477 recepients list. We are now officially part of the OpenBSD ports:
469 http://www.openbsd.org/ports.html ! Many thanks to Will for the
478 http://www.openbsd.org/ports.html ! Many thanks to Will for the
470 work.
479 work.
471
480
472 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
481 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
473
482
474 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
483 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
475 so that it doesn't break tkinter apps.
484 so that it doesn't break tkinter apps.
476
485
477 * IPython/iplib.py (_prefilter): fix bug where aliases would
486 * IPython/iplib.py (_prefilter): fix bug where aliases would
478 shadow variables when autocall was fully off. Reported by SAGE
487 shadow variables when autocall was fully off. Reported by SAGE
479 author William Stein.
488 author William Stein.
480
489
481 * IPython/OInspect.py (Inspector.__init__): add a flag to control
490 * IPython/OInspect.py (Inspector.__init__): add a flag to control
482 at what detail level strings are computed when foo? is requested.
491 at what detail level strings are computed when foo? is requested.
483 This allows users to ask for example that the string form of an
492 This allows users to ask for example that the string form of an
484 object is only computed when foo?? is called, or even never, by
493 object is only computed when foo?? is called, or even never, by
485 setting the object_info_string_level >= 2 in the configuration
494 setting the object_info_string_level >= 2 in the configuration
486 file. This new option has been added and documented. After a
495 file. This new option has been added and documented. After a
487 request by SAGE to be able to control the printing of very large
496 request by SAGE to be able to control the printing of very large
488 objects more easily.
497 objects more easily.
489
498
490 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
499 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
491
500
492 * IPython/ipmaker.py (make_IPython): remove the ipython call path
501 * IPython/ipmaker.py (make_IPython): remove the ipython call path
493 from sys.argv, to be 100% consistent with how Python itself works
502 from sys.argv, to be 100% consistent with how Python itself works
494 (as seen for example with python -i file.py). After a bug report
503 (as seen for example with python -i file.py). After a bug report
495 by Jeffrey Collins.
504 by Jeffrey Collins.
496
505
497 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
506 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
498 nasty bug which was preventing custom namespaces with -pylab,
507 nasty bug which was preventing custom namespaces with -pylab,
499 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
508 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
500 compatibility (long gone from mpl).
509 compatibility (long gone from mpl).
501
510
502 * IPython/ipapi.py (make_session): name change: create->make. We
511 * IPython/ipapi.py (make_session): name change: create->make. We
503 use make in other places (ipmaker,...), it's shorter and easier to
512 use make in other places (ipmaker,...), it's shorter and easier to
504 type and say, etc. I'm trying to clean things before 0.7.2 so
513 type and say, etc. I'm trying to clean things before 0.7.2 so
505 that I can keep things stable wrt to ipapi in the chainsaw branch.
514 that I can keep things stable wrt to ipapi in the chainsaw branch.
506
515
507 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
516 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
508 python-mode recognizes our debugger mode. Add support for
517 python-mode recognizes our debugger mode. Add support for
509 autoindent inside (X)emacs. After a patch sent in by Jin Liu
518 autoindent inside (X)emacs. After a patch sent in by Jin Liu
510 <m.liu.jin-AT-gmail.com> originally written by
519 <m.liu.jin-AT-gmail.com> originally written by
511 doxgen-AT-newsmth.net (with minor modifications for xemacs
520 doxgen-AT-newsmth.net (with minor modifications for xemacs
512 compatibility)
521 compatibility)
513
522
514 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
523 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
515 tracebacks when walking the stack so that the stack tracking system
524 tracebacks when walking the stack so that the stack tracking system
516 in emacs' python-mode can identify the frames correctly.
525 in emacs' python-mode can identify the frames correctly.
517
526
518 * IPython/ipmaker.py (make_IPython): make the internal (and
527 * IPython/ipmaker.py (make_IPython): make the internal (and
519 default config) autoedit_syntax value false by default. Too many
528 default config) autoedit_syntax value false by default. Too many
520 users have complained to me (both on and off-list) about problems
529 users have complained to me (both on and off-list) about problems
521 with this option being on by default, so I'm making it default to
530 with this option being on by default, so I'm making it default to
522 off. It can still be enabled by anyone via the usual mechanisms.
531 off. It can still be enabled by anyone via the usual mechanisms.
523
532
524 * IPython/completer.py (Completer.attr_matches): add support for
533 * IPython/completer.py (Completer.attr_matches): add support for
525 PyCrust-style _getAttributeNames magic method. Patch contributed
534 PyCrust-style _getAttributeNames magic method. Patch contributed
526 by <mscott-AT-goldenspud.com>. Closes #50.
535 by <mscott-AT-goldenspud.com>. Closes #50.
527
536
528 * IPython/iplib.py (InteractiveShell.__init__): remove the
537 * IPython/iplib.py (InteractiveShell.__init__): remove the
529 deletion of exit/quit from __builtin__, which can break
538 deletion of exit/quit from __builtin__, which can break
530 third-party tools like the Zope debugging console. The
539 third-party tools like the Zope debugging console. The
531 %exit/%quit magics remain. In general, it's probably a good idea
540 %exit/%quit magics remain. In general, it's probably a good idea
532 not to delete anything from __builtin__, since we never know what
541 not to delete anything from __builtin__, since we never know what
533 that will break. In any case, python now (for 2.5) will support
542 that will break. In any case, python now (for 2.5) will support
534 'real' exit/quit, so this issue is moot. Closes #55.
543 'real' exit/quit, so this issue is moot. Closes #55.
535
544
536 * IPython/genutils.py (with_obj): rename the 'with' function to
545 * IPython/genutils.py (with_obj): rename the 'with' function to
537 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
546 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
538 becomes a language keyword. Closes #53.
547 becomes a language keyword. Closes #53.
539
548
540 * IPython/FakeModule.py (FakeModule.__init__): add a proper
549 * IPython/FakeModule.py (FakeModule.__init__): add a proper
541 __file__ attribute to this so it fools more things into thinking
550 __file__ attribute to this so it fools more things into thinking
542 it is a real module. Closes #59.
551 it is a real module. Closes #59.
543
552
544 * IPython/Magic.py (magic_edit): add -n option to open the editor
553 * IPython/Magic.py (magic_edit): add -n option to open the editor
545 at a specific line number. After a patch by Stefan van der Walt.
554 at a specific line number. After a patch by Stefan van der Walt.
546
555
547 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
556 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
548
557
549 * IPython/iplib.py (edit_syntax_error): fix crash when for some
558 * IPython/iplib.py (edit_syntax_error): fix crash when for some
550 reason the file could not be opened. After automatic crash
559 reason the file could not be opened. After automatic crash
551 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
560 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
552 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
561 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
553 (_should_recompile): Don't fire editor if using %bg, since there
562 (_should_recompile): Don't fire editor if using %bg, since there
554 is no file in the first place. From the same report as above.
563 is no file in the first place. From the same report as above.
555 (raw_input): protect against faulty third-party prefilters. After
564 (raw_input): protect against faulty third-party prefilters. After
556 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
565 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
557 while running under SAGE.
566 while running under SAGE.
558
567
559 2006-05-23 Ville Vainio <vivainio@gmail.com>
568 2006-05-23 Ville Vainio <vivainio@gmail.com>
560
569
561 * ipapi.py: Stripped down ip.to_user_ns() to work only as
570 * ipapi.py: Stripped down ip.to_user_ns() to work only as
562 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
571 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
563 now returns None (again), unless dummy is specifically allowed by
572 now returns None (again), unless dummy is specifically allowed by
564 ipapi.get(allow_dummy=True).
573 ipapi.get(allow_dummy=True).
565
574
566 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
575 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
567
576
568 * IPython: remove all 2.2-compatibility objects and hacks from
577 * IPython: remove all 2.2-compatibility objects and hacks from
569 everywhere, since we only support 2.3 at this point. Docs
578 everywhere, since we only support 2.3 at this point. Docs
570 updated.
579 updated.
571
580
572 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
581 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
573 Anything requiring extra validation can be turned into a Python
582 Anything requiring extra validation can be turned into a Python
574 property in the future. I used a property for the db one b/c
583 property in the future. I used a property for the db one b/c
575 there was a nasty circularity problem with the initialization
584 there was a nasty circularity problem with the initialization
576 order, which right now I don't have time to clean up.
585 order, which right now I don't have time to clean up.
577
586
578 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
587 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
579 another locking bug reported by Jorgen. I'm not 100% sure though,
588 another locking bug reported by Jorgen. I'm not 100% sure though,
580 so more testing is needed...
589 so more testing is needed...
581
590
582 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
591 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
583
592
584 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
593 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
585 local variables from any routine in user code (typically executed
594 local variables from any routine in user code (typically executed
586 with %run) directly into the interactive namespace. Very useful
595 with %run) directly into the interactive namespace. Very useful
587 when doing complex debugging.
596 when doing complex debugging.
588 (IPythonNotRunning): Changed the default None object to a dummy
597 (IPythonNotRunning): Changed the default None object to a dummy
589 whose attributes can be queried as well as called without
598 whose attributes can be queried as well as called without
590 exploding, to ease writing code which works transparently both in
599 exploding, to ease writing code which works transparently both in
591 and out of ipython and uses some of this API.
600 and out of ipython and uses some of this API.
592
601
593 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
602 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
594
603
595 * IPython/hooks.py (result_display): Fix the fact that our display
604 * IPython/hooks.py (result_display): Fix the fact that our display
596 hook was using str() instead of repr(), as the default python
605 hook was using str() instead of repr(), as the default python
597 console does. This had gone unnoticed b/c it only happened if
606 console does. This had gone unnoticed b/c it only happened if
598 %Pprint was off, but the inconsistency was there.
607 %Pprint was off, but the inconsistency was there.
599
608
600 2006-05-15 Ville Vainio <vivainio@gmail.com>
609 2006-05-15 Ville Vainio <vivainio@gmail.com>
601
610
602 * Oinspect.py: Only show docstring for nonexisting/binary files
611 * Oinspect.py: Only show docstring for nonexisting/binary files
603 when doing object??, closing ticket #62
612 when doing object??, closing ticket #62
604
613
605 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
614 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
606
615
607 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
616 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
608 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
617 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
609 was being released in a routine which hadn't checked if it had
618 was being released in a routine which hadn't checked if it had
610 been the one to acquire it.
619 been the one to acquire it.
611
620
612 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
621 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
613
622
614 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
623 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
615
624
616 2006-04-11 Ville Vainio <vivainio@gmail.com>
625 2006-04-11 Ville Vainio <vivainio@gmail.com>
617
626
618 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
627 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
619 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
628 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
620 prefilters, allowing stuff like magics and aliases in the file.
629 prefilters, allowing stuff like magics and aliases in the file.
621
630
622 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
631 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
623 added. Supported now are "%clear in" and "%clear out" (clear input and
632 added. Supported now are "%clear in" and "%clear out" (clear input and
624 output history, respectively). Also fixed CachedOutput.flush to
633 output history, respectively). Also fixed CachedOutput.flush to
625 properly flush the output cache.
634 properly flush the output cache.
626
635
627 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
636 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
628 half-success (and fail explicitly).
637 half-success (and fail explicitly).
629
638
630 2006-03-28 Ville Vainio <vivainio@gmail.com>
639 2006-03-28 Ville Vainio <vivainio@gmail.com>
631
640
632 * iplib.py: Fix quoting of aliases so that only argless ones
641 * iplib.py: Fix quoting of aliases so that only argless ones
633 are quoted
642 are quoted
634
643
635 2006-03-28 Ville Vainio <vivainio@gmail.com>
644 2006-03-28 Ville Vainio <vivainio@gmail.com>
636
645
637 * iplib.py: Quote aliases with spaces in the name.
646 * iplib.py: Quote aliases with spaces in the name.
638 "c:\program files\blah\bin" is now legal alias target.
647 "c:\program files\blah\bin" is now legal alias target.
639
648
640 * ext_rehashdir.py: Space no longer allowed as arg
649 * ext_rehashdir.py: Space no longer allowed as arg
641 separator, since space is legal in path names.
650 separator, since space is legal in path names.
642
651
643 2006-03-16 Ville Vainio <vivainio@gmail.com>
652 2006-03-16 Ville Vainio <vivainio@gmail.com>
644
653
645 * upgrade_dir.py: Take path.py from Extensions, correcting
654 * upgrade_dir.py: Take path.py from Extensions, correcting
646 %upgrade magic
655 %upgrade magic
647
656
648 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
657 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
649
658
650 * hooks.py: Only enclose editor binary in quotes if legal and
659 * hooks.py: Only enclose editor binary in quotes if legal and
651 necessary (space in the name, and is an existing file). Fixes a bug
660 necessary (space in the name, and is an existing file). Fixes a bug
652 reported by Zachary Pincus.
661 reported by Zachary Pincus.
653
662
654 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
663 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
655
664
656 * Manual: thanks to a tip on proper color handling for Emacs, by
665 * Manual: thanks to a tip on proper color handling for Emacs, by
657 Eric J Haywiser <ejh1-AT-MIT.EDU>.
666 Eric J Haywiser <ejh1-AT-MIT.EDU>.
658
667
659 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
668 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
660 by applying the provided patch. Thanks to Liu Jin
669 by applying the provided patch. Thanks to Liu Jin
661 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
670 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
662 XEmacs/Linux, I'm trusting the submitter that it actually helps
671 XEmacs/Linux, I'm trusting the submitter that it actually helps
663 under win32/GNU Emacs. Will revisit if any problems are reported.
672 under win32/GNU Emacs. Will revisit if any problems are reported.
664
673
665 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
674 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
666
675
667 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
676 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
668 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
677 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
669
678
670 2006-03-12 Ville Vainio <vivainio@gmail.com>
679 2006-03-12 Ville Vainio <vivainio@gmail.com>
671
680
672 * Magic.py (magic_timeit): Added %timeit magic, contributed by
681 * Magic.py (magic_timeit): Added %timeit magic, contributed by
673 Torsten Marek.
682 Torsten Marek.
674
683
675 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
684 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
676
685
677 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
686 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
678 line ranges works again.
687 line ranges works again.
679
688
680 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
689 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
681
690
682 * IPython/iplib.py (showtraceback): add back sys.last_traceback
691 * IPython/iplib.py (showtraceback): add back sys.last_traceback
683 and friends, after a discussion with Zach Pincus on ipython-user.
692 and friends, after a discussion with Zach Pincus on ipython-user.
684 I'm not 100% sure, but after thinking about it quite a bit, it may
693 I'm not 100% sure, but after thinking about it quite a bit, it may
685 be OK. Testing with the multithreaded shells didn't reveal any
694 be OK. Testing with the multithreaded shells didn't reveal any
686 problems, but let's keep an eye out.
695 problems, but let's keep an eye out.
687
696
688 In the process, I fixed a few things which were calling
697 In the process, I fixed a few things which were calling
689 self.InteractiveTB() directly (like safe_execfile), which is a
698 self.InteractiveTB() directly (like safe_execfile), which is a
690 mistake: ALL exception reporting should be done by calling
699 mistake: ALL exception reporting should be done by calling
691 self.showtraceback(), which handles state and tab-completion and
700 self.showtraceback(), which handles state and tab-completion and
692 more.
701 more.
693
702
694 2006-03-01 Ville Vainio <vivainio@gmail.com>
703 2006-03-01 Ville Vainio <vivainio@gmail.com>
695
704
696 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
705 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
697 To use, do "from ipipe import *".
706 To use, do "from ipipe import *".
698
707
699 2006-02-24 Ville Vainio <vivainio@gmail.com>
708 2006-02-24 Ville Vainio <vivainio@gmail.com>
700
709
701 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
710 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
702 "cleanly" and safely than the older upgrade mechanism.
711 "cleanly" and safely than the older upgrade mechanism.
703
712
704 2006-02-21 Ville Vainio <vivainio@gmail.com>
713 2006-02-21 Ville Vainio <vivainio@gmail.com>
705
714
706 * Magic.py: %save works again.
715 * Magic.py: %save works again.
707
716
708 2006-02-15 Ville Vainio <vivainio@gmail.com>
717 2006-02-15 Ville Vainio <vivainio@gmail.com>
709
718
710 * Magic.py: %Pprint works again
719 * Magic.py: %Pprint works again
711
720
712 * Extensions/ipy_sane_defaults.py: Provide everything provided
721 * Extensions/ipy_sane_defaults.py: Provide everything provided
713 in default ipythonrc, to make it possible to have a completely empty
722 in default ipythonrc, to make it possible to have a completely empty
714 ipythonrc (and thus completely rc-file free configuration)
723 ipythonrc (and thus completely rc-file free configuration)
715
724
716 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
725 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
717
726
718 * IPython/hooks.py (editor): quote the call to the editor command,
727 * IPython/hooks.py (editor): quote the call to the editor command,
719 to allow commands with spaces in them. Problem noted by watching
728 to allow commands with spaces in them. Problem noted by watching
720 Ian Oswald's video about textpad under win32 at
729 Ian Oswald's video about textpad under win32 at
721 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
730 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
722
731
723 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
732 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
724 describing magics (we haven't used @ for a loong time).
733 describing magics (we haven't used @ for a loong time).
725
734
726 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
735 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
727 contributed by marienz to close
736 contributed by marienz to close
728 http://www.scipy.net/roundup/ipython/issue53.
737 http://www.scipy.net/roundup/ipython/issue53.
729
738
730 2006-02-10 Ville Vainio <vivainio@gmail.com>
739 2006-02-10 Ville Vainio <vivainio@gmail.com>
731
740
732 * genutils.py: getoutput now works in win32 too
741 * genutils.py: getoutput now works in win32 too
733
742
734 * completer.py: alias and magic completion only invoked
743 * completer.py: alias and magic completion only invoked
735 at the first "item" in the line, to avoid "cd %store"
744 at the first "item" in the line, to avoid "cd %store"
736 nonsense.
745 nonsense.
737
746
738 2006-02-09 Ville Vainio <vivainio@gmail.com>
747 2006-02-09 Ville Vainio <vivainio@gmail.com>
739
748
740 * test/*: Added a unit testing framework (finally).
749 * test/*: Added a unit testing framework (finally).
741 '%run runtests.py' to run test_*.
750 '%run runtests.py' to run test_*.
742
751
743 * ipapi.py: Exposed runlines and set_custom_exc
752 * ipapi.py: Exposed runlines and set_custom_exc
744
753
745 2006-02-07 Ville Vainio <vivainio@gmail.com>
754 2006-02-07 Ville Vainio <vivainio@gmail.com>
746
755
747 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
756 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
748 instead use "f(1 2)" as before.
757 instead use "f(1 2)" as before.
749
758
750 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
759 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
751
760
752 * IPython/demo.py (IPythonDemo): Add new classes to the demo
761 * IPython/demo.py (IPythonDemo): Add new classes to the demo
753 facilities, for demos processed by the IPython input filter
762 facilities, for demos processed by the IPython input filter
754 (IPythonDemo), and for running a script one-line-at-a-time as a
763 (IPythonDemo), and for running a script one-line-at-a-time as a
755 demo, both for pure Python (LineDemo) and for IPython-processed
764 demo, both for pure Python (LineDemo) and for IPython-processed
756 input (IPythonLineDemo). After a request by Dave Kohel, from the
765 input (IPythonLineDemo). After a request by Dave Kohel, from the
757 SAGE team.
766 SAGE team.
758 (Demo.edit): added an edit() method to the demo objects, to edit
767 (Demo.edit): added an edit() method to the demo objects, to edit
759 the in-memory copy of the last executed block.
768 the in-memory copy of the last executed block.
760
769
761 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
770 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
762 processing to %edit, %macro and %save. These commands can now be
771 processing to %edit, %macro and %save. These commands can now be
763 invoked on the unprocessed input as it was typed by the user
772 invoked on the unprocessed input as it was typed by the user
764 (without any prefilters applied). After requests by the SAGE team
773 (without any prefilters applied). After requests by the SAGE team
765 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
774 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
766
775
767 2006-02-01 Ville Vainio <vivainio@gmail.com>
776 2006-02-01 Ville Vainio <vivainio@gmail.com>
768
777
769 * setup.py, eggsetup.py: easy_install ipython==dev works
778 * setup.py, eggsetup.py: easy_install ipython==dev works
770 correctly now (on Linux)
779 correctly now (on Linux)
771
780
772 * ipy_user_conf,ipmaker: user config changes, removed spurious
781 * ipy_user_conf,ipmaker: user config changes, removed spurious
773 warnings
782 warnings
774
783
775 * iplib: if rc.banner is string, use it as is.
784 * iplib: if rc.banner is string, use it as is.
776
785
777 * Magic: %pycat accepts a string argument and pages it's contents.
786 * Magic: %pycat accepts a string argument and pages it's contents.
778
787
779
788
780 2006-01-30 Ville Vainio <vivainio@gmail.com>
789 2006-01-30 Ville Vainio <vivainio@gmail.com>
781
790
782 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
791 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
783 Now %store and bookmarks work through PickleShare, meaning that
792 Now %store and bookmarks work through PickleShare, meaning that
784 concurrent access is possible and all ipython sessions see the
793 concurrent access is possible and all ipython sessions see the
785 same database situation all the time, instead of snapshot of
794 same database situation all the time, instead of snapshot of
786 the situation when the session was started. Hence, %bookmark
795 the situation when the session was started. Hence, %bookmark
787 results are immediately accessible from othes sessions. The database
796 results are immediately accessible from othes sessions. The database
788 is also available for use by user extensions. See:
797 is also available for use by user extensions. See:
789 http://www.python.org/pypi/pickleshare
798 http://www.python.org/pypi/pickleshare
790
799
791 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
800 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
792
801
793 * aliases can now be %store'd
802 * aliases can now be %store'd
794
803
795 * path.py moved to Extensions so that pickleshare does not need
804 * path.py moved to Extensions so that pickleshare does not need
796 IPython-specific import. Extensions added to pythonpath right
805 IPython-specific import. Extensions added to pythonpath right
797 at __init__.
806 at __init__.
798
807
799 * iplib.py: ipalias deprecated/redundant; aliases are converted and
808 * iplib.py: ipalias deprecated/redundant; aliases are converted and
800 called with _ip.system and the pre-transformed command string.
809 called with _ip.system and the pre-transformed command string.
801
810
802 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
811 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
803
812
804 * IPython/iplib.py (interact): Fix that we were not catching
813 * IPython/iplib.py (interact): Fix that we were not catching
805 KeyboardInterrupt exceptions properly. I'm not quite sure why the
814 KeyboardInterrupt exceptions properly. I'm not quite sure why the
806 logic here had to change, but it's fixed now.
815 logic here had to change, but it's fixed now.
807
816
808 2006-01-29 Ville Vainio <vivainio@gmail.com>
817 2006-01-29 Ville Vainio <vivainio@gmail.com>
809
818
810 * iplib.py: Try to import pyreadline on Windows.
819 * iplib.py: Try to import pyreadline on Windows.
811
820
812 2006-01-27 Ville Vainio <vivainio@gmail.com>
821 2006-01-27 Ville Vainio <vivainio@gmail.com>
813
822
814 * iplib.py: Expose ipapi as _ip in builtin namespace.
823 * iplib.py: Expose ipapi as _ip in builtin namespace.
815 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
824 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
816 and ip_set_hook (-> _ip.set_hook) redundant. % and !
825 and ip_set_hook (-> _ip.set_hook) redundant. % and !
817 syntax now produce _ip.* variant of the commands.
826 syntax now produce _ip.* variant of the commands.
818
827
819 * "_ip.options().autoedit_syntax = 2" automatically throws
828 * "_ip.options().autoedit_syntax = 2" automatically throws
820 user to editor for syntax error correction without prompting.
829 user to editor for syntax error correction without prompting.
821
830
822 2006-01-27 Ville Vainio <vivainio@gmail.com>
831 2006-01-27 Ville Vainio <vivainio@gmail.com>
823
832
824 * ipmaker.py: Give "realistic" sys.argv for scripts (without
833 * ipmaker.py: Give "realistic" sys.argv for scripts (without
825 'ipython' at argv[0]) executed through command line.
834 'ipython' at argv[0]) executed through command line.
826 NOTE: this DEPRECATES calling ipython with multiple scripts
835 NOTE: this DEPRECATES calling ipython with multiple scripts
827 ("ipython a.py b.py c.py")
836 ("ipython a.py b.py c.py")
828
837
829 * iplib.py, hooks.py: Added configurable input prefilter,
838 * iplib.py, hooks.py: Added configurable input prefilter,
830 named 'input_prefilter'. See ext_rescapture.py for example
839 named 'input_prefilter'. See ext_rescapture.py for example
831 usage.
840 usage.
832
841
833 * ext_rescapture.py, Magic.py: Better system command output capture
842 * ext_rescapture.py, Magic.py: Better system command output capture
834 through 'var = !ls' (deprecates user-visible %sc). Same notation
843 through 'var = !ls' (deprecates user-visible %sc). Same notation
835 applies for magics, 'var = %alias' assigns alias list to var.
844 applies for magics, 'var = %alias' assigns alias list to var.
836
845
837 * ipapi.py: added meta() for accessing extension-usable data store.
846 * ipapi.py: added meta() for accessing extension-usable data store.
838
847
839 * iplib.py: added InteractiveShell.getapi(). New magics should be
848 * iplib.py: added InteractiveShell.getapi(). New magics should be
840 written doing self.getapi() instead of using the shell directly.
849 written doing self.getapi() instead of using the shell directly.
841
850
842 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
851 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
843 %store foo >> ~/myfoo.txt to store variables to files (in clean
852 %store foo >> ~/myfoo.txt to store variables to files (in clean
844 textual form, not a restorable pickle).
853 textual form, not a restorable pickle).
845
854
846 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
855 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
847
856
848 * usage.py, Magic.py: added %quickref
857 * usage.py, Magic.py: added %quickref
849
858
850 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
859 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
851
860
852 * GetoptErrors when invoking magics etc. with wrong args
861 * GetoptErrors when invoking magics etc. with wrong args
853 are now more helpful:
862 are now more helpful:
854 GetoptError: option -l not recognized (allowed: "qb" )
863 GetoptError: option -l not recognized (allowed: "qb" )
855
864
856 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
865 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
857
866
858 * IPython/demo.py (Demo.show): Flush stdout after each block, so
867 * IPython/demo.py (Demo.show): Flush stdout after each block, so
859 computationally intensive blocks don't appear to stall the demo.
868 computationally intensive blocks don't appear to stall the demo.
860
869
861 2006-01-24 Ville Vainio <vivainio@gmail.com>
870 2006-01-24 Ville Vainio <vivainio@gmail.com>
862
871
863 * iplib.py, hooks.py: 'result_display' hook can return a non-None
872 * iplib.py, hooks.py: 'result_display' hook can return a non-None
864 value to manipulate resulting history entry.
873 value to manipulate resulting history entry.
865
874
866 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
875 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
867 to instance methods of IPApi class, to make extending an embedded
876 to instance methods of IPApi class, to make extending an embedded
868 IPython feasible. See ext_rehashdir.py for example usage.
877 IPython feasible. See ext_rehashdir.py for example usage.
869
878
870 * Merged 1071-1076 from branches/0.7.1
879 * Merged 1071-1076 from branches/0.7.1
871
880
872
881
873 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
882 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
874
883
875 * tools/release (daystamp): Fix build tools to use the new
884 * tools/release (daystamp): Fix build tools to use the new
876 eggsetup.py script to build lightweight eggs.
885 eggsetup.py script to build lightweight eggs.
877
886
878 * Applied changesets 1062 and 1064 before 0.7.1 release.
887 * Applied changesets 1062 and 1064 before 0.7.1 release.
879
888
880 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
889 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
881 see the raw input history (without conversions like %ls ->
890 see the raw input history (without conversions like %ls ->
882 ipmagic("ls")). After a request from W. Stein, SAGE
891 ipmagic("ls")). After a request from W. Stein, SAGE
883 (http://modular.ucsd.edu/sage) developer. This information is
892 (http://modular.ucsd.edu/sage) developer. This information is
884 stored in the input_hist_raw attribute of the IPython instance, so
893 stored in the input_hist_raw attribute of the IPython instance, so
885 developers can access it if needed (it's an InputList instance).
894 developers can access it if needed (it's an InputList instance).
886
895
887 * Versionstring = 0.7.2.svn
896 * Versionstring = 0.7.2.svn
888
897
889 * eggsetup.py: A separate script for constructing eggs, creates
898 * eggsetup.py: A separate script for constructing eggs, creates
890 proper launch scripts even on Windows (an .exe file in
899 proper launch scripts even on Windows (an .exe file in
891 \python24\scripts).
900 \python24\scripts).
892
901
893 * ipapi.py: launch_new_instance, launch entry point needed for the
902 * ipapi.py: launch_new_instance, launch entry point needed for the
894 egg.
903 egg.
895
904
896 2006-01-23 Ville Vainio <vivainio@gmail.com>
905 2006-01-23 Ville Vainio <vivainio@gmail.com>
897
906
898 * Added %cpaste magic for pasting python code
907 * Added %cpaste magic for pasting python code
899
908
900 2006-01-22 Ville Vainio <vivainio@gmail.com>
909 2006-01-22 Ville Vainio <vivainio@gmail.com>
901
910
902 * Merge from branches/0.7.1 into trunk, revs 1052-1057
911 * Merge from branches/0.7.1 into trunk, revs 1052-1057
903
912
904 * Versionstring = 0.7.2.svn
913 * Versionstring = 0.7.2.svn
905
914
906 * eggsetup.py: A separate script for constructing eggs, creates
915 * eggsetup.py: A separate script for constructing eggs, creates
907 proper launch scripts even on Windows (an .exe file in
916 proper launch scripts even on Windows (an .exe file in
908 \python24\scripts).
917 \python24\scripts).
909
918
910 * ipapi.py: launch_new_instance, launch entry point needed for the
919 * ipapi.py: launch_new_instance, launch entry point needed for the
911 egg.
920 egg.
912
921
913 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
922 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
914
923
915 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
924 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
916 %pfile foo would print the file for foo even if it was a binary.
925 %pfile foo would print the file for foo even if it was a binary.
917 Now, extensions '.so' and '.dll' are skipped.
926 Now, extensions '.so' and '.dll' are skipped.
918
927
919 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
928 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
920 bug, where macros would fail in all threaded modes. I'm not 100%
929 bug, where macros would fail in all threaded modes. I'm not 100%
921 sure, so I'm going to put out an rc instead of making a release
930 sure, so I'm going to put out an rc instead of making a release
922 today, and wait for feedback for at least a few days.
931 today, and wait for feedback for at least a few days.
923
932
924 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
933 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
925 it...) the handling of pasting external code with autoindent on.
934 it...) the handling of pasting external code with autoindent on.
926 To get out of a multiline input, the rule will appear for most
935 To get out of a multiline input, the rule will appear for most
927 users unchanged: two blank lines or change the indent level
936 users unchanged: two blank lines or change the indent level
928 proposed by IPython. But there is a twist now: you can
937 proposed by IPython. But there is a twist now: you can
929 add/subtract only *one or two spaces*. If you add/subtract three
938 add/subtract only *one or two spaces*. If you add/subtract three
930 or more (unless you completely delete the line), IPython will
939 or more (unless you completely delete the line), IPython will
931 accept that line, and you'll need to enter a second one of pure
940 accept that line, and you'll need to enter a second one of pure
932 whitespace. I know it sounds complicated, but I can't find a
941 whitespace. I know it sounds complicated, but I can't find a
933 different solution that covers all the cases, with the right
942 different solution that covers all the cases, with the right
934 heuristics. Hopefully in actual use, nobody will really notice
943 heuristics. Hopefully in actual use, nobody will really notice
935 all these strange rules and things will 'just work'.
944 all these strange rules and things will 'just work'.
936
945
937 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
946 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
938
947
939 * IPython/iplib.py (interact): catch exceptions which can be
948 * IPython/iplib.py (interact): catch exceptions which can be
940 triggered asynchronously by signal handlers. Thanks to an
949 triggered asynchronously by signal handlers. Thanks to an
941 automatic crash report, submitted by Colin Kingsley
950 automatic crash report, submitted by Colin Kingsley
942 <tercel-AT-gentoo.org>.
951 <tercel-AT-gentoo.org>.
943
952
944 2006-01-20 Ville Vainio <vivainio@gmail.com>
953 2006-01-20 Ville Vainio <vivainio@gmail.com>
945
954
946 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
955 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
947 (%rehashdir, very useful, try it out) of how to extend ipython
956 (%rehashdir, very useful, try it out) of how to extend ipython
948 with new magics. Also added Extensions dir to pythonpath to make
957 with new magics. Also added Extensions dir to pythonpath to make
949 importing extensions easy.
958 importing extensions easy.
950
959
951 * %store now complains when trying to store interactively declared
960 * %store now complains when trying to store interactively declared
952 classes / instances of those classes.
961 classes / instances of those classes.
953
962
954 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
963 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
955 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
964 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
956 if they exist, and ipy_user_conf.py with some defaults is created for
965 if they exist, and ipy_user_conf.py with some defaults is created for
957 the user.
966 the user.
958
967
959 * Startup rehashing done by the config file, not InterpreterExec.
968 * Startup rehashing done by the config file, not InterpreterExec.
960 This means system commands are available even without selecting the
969 This means system commands are available even without selecting the
961 pysh profile. It's the sensible default after all.
970 pysh profile. It's the sensible default after all.
962
971
963 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
972 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
964
973
965 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
974 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
966 multiline code with autoindent on working. But I am really not
975 multiline code with autoindent on working. But I am really not
967 sure, so this needs more testing. Will commit a debug-enabled
976 sure, so this needs more testing. Will commit a debug-enabled
968 version for now, while I test it some more, so that Ville and
977 version for now, while I test it some more, so that Ville and
969 others may also catch any problems. Also made
978 others may also catch any problems. Also made
970 self.indent_current_str() a method, to ensure that there's no
979 self.indent_current_str() a method, to ensure that there's no
971 chance of the indent space count and the corresponding string
980 chance of the indent space count and the corresponding string
972 falling out of sync. All code needing the string should just call
981 falling out of sync. All code needing the string should just call
973 the method.
982 the method.
974
983
975 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
984 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
976
985
977 * IPython/Magic.py (magic_edit): fix check for when users don't
986 * IPython/Magic.py (magic_edit): fix check for when users don't
978 save their output files, the try/except was in the wrong section.
987 save their output files, the try/except was in the wrong section.
979
988
980 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
989 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
981
990
982 * IPython/Magic.py (magic_run): fix __file__ global missing from
991 * IPython/Magic.py (magic_run): fix __file__ global missing from
983 script's namespace when executed via %run. After a report by
992 script's namespace when executed via %run. After a report by
984 Vivian.
993 Vivian.
985
994
986 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
995 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
987 when using python 2.4. The parent constructor changed in 2.4, and
996 when using python 2.4. The parent constructor changed in 2.4, and
988 we need to track it directly (we can't call it, as it messes up
997 we need to track it directly (we can't call it, as it messes up
989 readline and tab-completion inside our pdb would stop working).
998 readline and tab-completion inside our pdb would stop working).
990 After a bug report by R. Bernstein <rocky-AT-panix.com>.
999 After a bug report by R. Bernstein <rocky-AT-panix.com>.
991
1000
992 2006-01-16 Ville Vainio <vivainio@gmail.com>
1001 2006-01-16 Ville Vainio <vivainio@gmail.com>
993
1002
994 * Ipython/magic.py: Reverted back to old %edit functionality
1003 * Ipython/magic.py: Reverted back to old %edit functionality
995 that returns file contents on exit.
1004 that returns file contents on exit.
996
1005
997 * IPython/path.py: Added Jason Orendorff's "path" module to
1006 * IPython/path.py: Added Jason Orendorff's "path" module to
998 IPython tree, http://www.jorendorff.com/articles/python/path/.
1007 IPython tree, http://www.jorendorff.com/articles/python/path/.
999 You can get path objects conveniently through %sc, and !!, e.g.:
1008 You can get path objects conveniently through %sc, and !!, e.g.:
1000 sc files=ls
1009 sc files=ls
1001 for p in files.paths: # or files.p
1010 for p in files.paths: # or files.p
1002 print p,p.mtime
1011 print p,p.mtime
1003
1012
1004 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1013 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1005 now work again without considering the exclusion regexp -
1014 now work again without considering the exclusion regexp -
1006 hence, things like ',foo my/path' turn to 'foo("my/path")'
1015 hence, things like ',foo my/path' turn to 'foo("my/path")'
1007 instead of syntax error.
1016 instead of syntax error.
1008
1017
1009
1018
1010 2006-01-14 Ville Vainio <vivainio@gmail.com>
1019 2006-01-14 Ville Vainio <vivainio@gmail.com>
1011
1020
1012 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1021 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1013 ipapi decorators for python 2.4 users, options() provides access to rc
1022 ipapi decorators for python 2.4 users, options() provides access to rc
1014 data.
1023 data.
1015
1024
1016 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1025 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1017 as path separators (even on Linux ;-). Space character after
1026 as path separators (even on Linux ;-). Space character after
1018 backslash (as yielded by tab completer) is still space;
1027 backslash (as yielded by tab completer) is still space;
1019 "%cd long\ name" works as expected.
1028 "%cd long\ name" works as expected.
1020
1029
1021 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1030 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1022 as "chain of command", with priority. API stays the same,
1031 as "chain of command", with priority. API stays the same,
1023 TryNext exception raised by a hook function signals that
1032 TryNext exception raised by a hook function signals that
1024 current hook failed and next hook should try handling it, as
1033 current hook failed and next hook should try handling it, as
1025 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1034 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1026 requested configurable display hook, which is now implemented.
1035 requested configurable display hook, which is now implemented.
1027
1036
1028 2006-01-13 Ville Vainio <vivainio@gmail.com>
1037 2006-01-13 Ville Vainio <vivainio@gmail.com>
1029
1038
1030 * IPython/platutils*.py: platform specific utility functions,
1039 * IPython/platutils*.py: platform specific utility functions,
1031 so far only set_term_title is implemented (change terminal
1040 so far only set_term_title is implemented (change terminal
1032 label in windowing systems). %cd now changes the title to
1041 label in windowing systems). %cd now changes the title to
1033 current dir.
1042 current dir.
1034
1043
1035 * IPython/Release.py: Added myself to "authors" list,
1044 * IPython/Release.py: Added myself to "authors" list,
1036 had to create new files.
1045 had to create new files.
1037
1046
1038 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1047 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1039 shell escape; not a known bug but had potential to be one in the
1048 shell escape; not a known bug but had potential to be one in the
1040 future.
1049 future.
1041
1050
1042 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1051 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1043 extension API for IPython! See the module for usage example. Fix
1052 extension API for IPython! See the module for usage example. Fix
1044 OInspect for docstring-less magic functions.
1053 OInspect for docstring-less magic functions.
1045
1054
1046
1055
1047 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1056 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1048
1057
1049 * IPython/iplib.py (raw_input): temporarily deactivate all
1058 * IPython/iplib.py (raw_input): temporarily deactivate all
1050 attempts at allowing pasting of code with autoindent on. It
1059 attempts at allowing pasting of code with autoindent on. It
1051 introduced bugs (reported by Prabhu) and I can't seem to find a
1060 introduced bugs (reported by Prabhu) and I can't seem to find a
1052 robust combination which works in all cases. Will have to revisit
1061 robust combination which works in all cases. Will have to revisit
1053 later.
1062 later.
1054
1063
1055 * IPython/genutils.py: remove isspace() function. We've dropped
1064 * IPython/genutils.py: remove isspace() function. We've dropped
1056 2.2 compatibility, so it's OK to use the string method.
1065 2.2 compatibility, so it's OK to use the string method.
1057
1066
1058 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1067 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1059
1068
1060 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1069 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1061 matching what NOT to autocall on, to include all python binary
1070 matching what NOT to autocall on, to include all python binary
1062 operators (including things like 'and', 'or', 'is' and 'in').
1071 operators (including things like 'and', 'or', 'is' and 'in').
1063 Prompted by a bug report on 'foo & bar', but I realized we had
1072 Prompted by a bug report on 'foo & bar', but I realized we had
1064 many more potential bug cases with other operators. The regexp is
1073 many more potential bug cases with other operators. The regexp is
1065 self.re_exclude_auto, it's fairly commented.
1074 self.re_exclude_auto, it's fairly commented.
1066
1075
1067 2006-01-12 Ville Vainio <vivainio@gmail.com>
1076 2006-01-12 Ville Vainio <vivainio@gmail.com>
1068
1077
1069 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1078 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1070 Prettified and hardened string/backslash quoting with ipsystem(),
1079 Prettified and hardened string/backslash quoting with ipsystem(),
1071 ipalias() and ipmagic(). Now even \ characters are passed to
1080 ipalias() and ipmagic(). Now even \ characters are passed to
1072 %magics, !shell escapes and aliases exactly as they are in the
1081 %magics, !shell escapes and aliases exactly as they are in the
1073 ipython command line. Should improve backslash experience,
1082 ipython command line. Should improve backslash experience,
1074 particularly in Windows (path delimiter for some commands that
1083 particularly in Windows (path delimiter for some commands that
1075 won't understand '/'), but Unix benefits as well (regexps). %cd
1084 won't understand '/'), but Unix benefits as well (regexps). %cd
1076 magic still doesn't support backslash path delimiters, though. Also
1085 magic still doesn't support backslash path delimiters, though. Also
1077 deleted all pretense of supporting multiline command strings in
1086 deleted all pretense of supporting multiline command strings in
1078 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1087 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1079
1088
1080 * doc/build_doc_instructions.txt added. Documentation on how to
1089 * doc/build_doc_instructions.txt added. Documentation on how to
1081 use doc/update_manual.py, added yesterday. Both files contributed
1090 use doc/update_manual.py, added yesterday. Both files contributed
1082 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1091 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1083 doc/*.sh for deprecation at a later date.
1092 doc/*.sh for deprecation at a later date.
1084
1093
1085 * /ipython.py Added ipython.py to root directory for
1094 * /ipython.py Added ipython.py to root directory for
1086 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1095 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1087 ipython.py) and development convenience (no need to keep doing
1096 ipython.py) and development convenience (no need to keep doing
1088 "setup.py install" between changes).
1097 "setup.py install" between changes).
1089
1098
1090 * Made ! and !! shell escapes work (again) in multiline expressions:
1099 * Made ! and !! shell escapes work (again) in multiline expressions:
1091 if 1:
1100 if 1:
1092 !ls
1101 !ls
1093 !!ls
1102 !!ls
1094
1103
1095 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1104 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1096
1105
1097 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1106 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1098 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1107 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1099 module in case-insensitive installation. Was causing crashes
1108 module in case-insensitive installation. Was causing crashes
1100 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1109 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1101
1110
1102 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1111 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1103 <marienz-AT-gentoo.org>, closes
1112 <marienz-AT-gentoo.org>, closes
1104 http://www.scipy.net/roundup/ipython/issue51.
1113 http://www.scipy.net/roundup/ipython/issue51.
1105
1114
1106 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1115 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1107
1116
1108 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1117 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1109 problem of excessive CPU usage under *nix and keyboard lag under
1118 problem of excessive CPU usage under *nix and keyboard lag under
1110 win32.
1119 win32.
1111
1120
1112 2006-01-10 *** Released version 0.7.0
1121 2006-01-10 *** Released version 0.7.0
1113
1122
1114 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1123 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1115
1124
1116 * IPython/Release.py (revision): tag version number to 0.7.0,
1125 * IPython/Release.py (revision): tag version number to 0.7.0,
1117 ready for release.
1126 ready for release.
1118
1127
1119 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1128 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1120 it informs the user of the name of the temp. file used. This can
1129 it informs the user of the name of the temp. file used. This can
1121 help if you decide later to reuse that same file, so you know
1130 help if you decide later to reuse that same file, so you know
1122 where to copy the info from.
1131 where to copy the info from.
1123
1132
1124 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1133 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1125
1134
1126 * setup_bdist_egg.py: little script to build an egg. Added
1135 * setup_bdist_egg.py: little script to build an egg. Added
1127 support in the release tools as well.
1136 support in the release tools as well.
1128
1137
1129 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1138 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1130
1139
1131 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1140 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1132 version selection (new -wxversion command line and ipythonrc
1141 version selection (new -wxversion command line and ipythonrc
1133 parameter). Patch contributed by Arnd Baecker
1142 parameter). Patch contributed by Arnd Baecker
1134 <arnd.baecker-AT-web.de>.
1143 <arnd.baecker-AT-web.de>.
1135
1144
1136 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1145 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1137 embedded instances, for variables defined at the interactive
1146 embedded instances, for variables defined at the interactive
1138 prompt of the embedded ipython. Reported by Arnd.
1147 prompt of the embedded ipython. Reported by Arnd.
1139
1148
1140 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1149 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1141 it can be used as a (stateful) toggle, or with a direct parameter.
1150 it can be used as a (stateful) toggle, or with a direct parameter.
1142
1151
1143 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1152 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1144 could be triggered in certain cases and cause the traceback
1153 could be triggered in certain cases and cause the traceback
1145 printer not to work.
1154 printer not to work.
1146
1155
1147 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1156 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1148
1157
1149 * IPython/iplib.py (_should_recompile): Small fix, closes
1158 * IPython/iplib.py (_should_recompile): Small fix, closes
1150 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1159 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1151
1160
1152 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1161 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1153
1162
1154 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1163 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1155 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1164 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1156 Moad for help with tracking it down.
1165 Moad for help with tracking it down.
1157
1166
1158 * IPython/iplib.py (handle_auto): fix autocall handling for
1167 * IPython/iplib.py (handle_auto): fix autocall handling for
1159 objects which support BOTH __getitem__ and __call__ (so that f [x]
1168 objects which support BOTH __getitem__ and __call__ (so that f [x]
1160 is left alone, instead of becoming f([x]) automatically).
1169 is left alone, instead of becoming f([x]) automatically).
1161
1170
1162 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1171 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1163 Ville's patch.
1172 Ville's patch.
1164
1173
1165 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1174 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1166
1175
1167 * IPython/iplib.py (handle_auto): changed autocall semantics to
1176 * IPython/iplib.py (handle_auto): changed autocall semantics to
1168 include 'smart' mode, where the autocall transformation is NOT
1177 include 'smart' mode, where the autocall transformation is NOT
1169 applied if there are no arguments on the line. This allows you to
1178 applied if there are no arguments on the line. This allows you to
1170 just type 'foo' if foo is a callable to see its internal form,
1179 just type 'foo' if foo is a callable to see its internal form,
1171 instead of having it called with no arguments (typically a
1180 instead of having it called with no arguments (typically a
1172 mistake). The old 'full' autocall still exists: for that, you
1181 mistake). The old 'full' autocall still exists: for that, you
1173 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1182 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1174
1183
1175 * IPython/completer.py (Completer.attr_matches): add
1184 * IPython/completer.py (Completer.attr_matches): add
1176 tab-completion support for Enthoughts' traits. After a report by
1185 tab-completion support for Enthoughts' traits. After a report by
1177 Arnd and a patch by Prabhu.
1186 Arnd and a patch by Prabhu.
1178
1187
1179 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1188 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1180
1189
1181 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1190 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1182 Schmolck's patch to fix inspect.getinnerframes().
1191 Schmolck's patch to fix inspect.getinnerframes().
1183
1192
1184 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1193 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1185 for embedded instances, regarding handling of namespaces and items
1194 for embedded instances, regarding handling of namespaces and items
1186 added to the __builtin__ one. Multiple embedded instances and
1195 added to the __builtin__ one. Multiple embedded instances and
1187 recursive embeddings should work better now (though I'm not sure
1196 recursive embeddings should work better now (though I'm not sure
1188 I've got all the corner cases fixed, that code is a bit of a brain
1197 I've got all the corner cases fixed, that code is a bit of a brain
1189 twister).
1198 twister).
1190
1199
1191 * IPython/Magic.py (magic_edit): added support to edit in-memory
1200 * IPython/Magic.py (magic_edit): added support to edit in-memory
1192 macros (automatically creates the necessary temp files). %edit
1201 macros (automatically creates the necessary temp files). %edit
1193 also doesn't return the file contents anymore, it's just noise.
1202 also doesn't return the file contents anymore, it's just noise.
1194
1203
1195 * IPython/completer.py (Completer.attr_matches): revert change to
1204 * IPython/completer.py (Completer.attr_matches): revert change to
1196 complete only on attributes listed in __all__. I realized it
1205 complete only on attributes listed in __all__. I realized it
1197 cripples the tab-completion system as a tool for exploring the
1206 cripples the tab-completion system as a tool for exploring the
1198 internals of unknown libraries (it renders any non-__all__
1207 internals of unknown libraries (it renders any non-__all__
1199 attribute off-limits). I got bit by this when trying to see
1208 attribute off-limits). I got bit by this when trying to see
1200 something inside the dis module.
1209 something inside the dis module.
1201
1210
1202 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1211 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1203
1212
1204 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1213 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1205 namespace for users and extension writers to hold data in. This
1214 namespace for users and extension writers to hold data in. This
1206 follows the discussion in
1215 follows the discussion in
1207 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1216 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1208
1217
1209 * IPython/completer.py (IPCompleter.complete): small patch to help
1218 * IPython/completer.py (IPCompleter.complete): small patch to help
1210 tab-completion under Emacs, after a suggestion by John Barnard
1219 tab-completion under Emacs, after a suggestion by John Barnard
1211 <barnarj-AT-ccf.org>.
1220 <barnarj-AT-ccf.org>.
1212
1221
1213 * IPython/Magic.py (Magic.extract_input_slices): added support for
1222 * IPython/Magic.py (Magic.extract_input_slices): added support for
1214 the slice notation in magics to use N-M to represent numbers N...M
1223 the slice notation in magics to use N-M to represent numbers N...M
1215 (closed endpoints). This is used by %macro and %save.
1224 (closed endpoints). This is used by %macro and %save.
1216
1225
1217 * IPython/completer.py (Completer.attr_matches): for modules which
1226 * IPython/completer.py (Completer.attr_matches): for modules which
1218 define __all__, complete only on those. After a patch by Jeffrey
1227 define __all__, complete only on those. After a patch by Jeffrey
1219 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1228 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1220 speed up this routine.
1229 speed up this routine.
1221
1230
1222 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1231 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1223 don't know if this is the end of it, but the behavior now is
1232 don't know if this is the end of it, but the behavior now is
1224 certainly much more correct. Note that coupled with macros,
1233 certainly much more correct. Note that coupled with macros,
1225 slightly surprising (at first) behavior may occur: a macro will in
1234 slightly surprising (at first) behavior may occur: a macro will in
1226 general expand to multiple lines of input, so upon exiting, the
1235 general expand to multiple lines of input, so upon exiting, the
1227 in/out counters will both be bumped by the corresponding amount
1236 in/out counters will both be bumped by the corresponding amount
1228 (as if the macro's contents had been typed interactively). Typing
1237 (as if the macro's contents had been typed interactively). Typing
1229 %hist will reveal the intermediate (silently processed) lines.
1238 %hist will reveal the intermediate (silently processed) lines.
1230
1239
1231 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1240 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1232 pickle to fail (%run was overwriting __main__ and not restoring
1241 pickle to fail (%run was overwriting __main__ and not restoring
1233 it, but pickle relies on __main__ to operate).
1242 it, but pickle relies on __main__ to operate).
1234
1243
1235 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1244 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1236 using properties, but forgot to make the main InteractiveShell
1245 using properties, but forgot to make the main InteractiveShell
1237 class a new-style class. Properties fail silently, and
1246 class a new-style class. Properties fail silently, and
1238 mysteriously, with old-style class (getters work, but
1247 mysteriously, with old-style class (getters work, but
1239 setters don't do anything).
1248 setters don't do anything).
1240
1249
1241 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1250 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1242
1251
1243 * IPython/Magic.py (magic_history): fix history reporting bug (I
1252 * IPython/Magic.py (magic_history): fix history reporting bug (I
1244 know some nasties are still there, I just can't seem to find a
1253 know some nasties are still there, I just can't seem to find a
1245 reproducible test case to track them down; the input history is
1254 reproducible test case to track them down; the input history is
1246 falling out of sync...)
1255 falling out of sync...)
1247
1256
1248 * IPython/iplib.py (handle_shell_escape): fix bug where both
1257 * IPython/iplib.py (handle_shell_escape): fix bug where both
1249 aliases and system accesses where broken for indented code (such
1258 aliases and system accesses where broken for indented code (such
1250 as loops).
1259 as loops).
1251
1260
1252 * IPython/genutils.py (shell): fix small but critical bug for
1261 * IPython/genutils.py (shell): fix small but critical bug for
1253 win32 system access.
1262 win32 system access.
1254
1263
1255 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1264 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1256
1265
1257 * IPython/iplib.py (showtraceback): remove use of the
1266 * IPython/iplib.py (showtraceback): remove use of the
1258 sys.last_{type/value/traceback} structures, which are non
1267 sys.last_{type/value/traceback} structures, which are non
1259 thread-safe.
1268 thread-safe.
1260 (_prefilter): change control flow to ensure that we NEVER
1269 (_prefilter): change control flow to ensure that we NEVER
1261 introspect objects when autocall is off. This will guarantee that
1270 introspect objects when autocall is off. This will guarantee that
1262 having an input line of the form 'x.y', where access to attribute
1271 having an input line of the form 'x.y', where access to attribute
1263 'y' has side effects, doesn't trigger the side effect TWICE. It
1272 'y' has side effects, doesn't trigger the side effect TWICE. It
1264 is important to note that, with autocall on, these side effects
1273 is important to note that, with autocall on, these side effects
1265 can still happen.
1274 can still happen.
1266 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1275 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1267 trio. IPython offers these three kinds of special calls which are
1276 trio. IPython offers these three kinds of special calls which are
1268 not python code, and it's a good thing to have their call method
1277 not python code, and it's a good thing to have their call method
1269 be accessible as pure python functions (not just special syntax at
1278 be accessible as pure python functions (not just special syntax at
1270 the command line). It gives us a better internal implementation
1279 the command line). It gives us a better internal implementation
1271 structure, as well as exposing these for user scripting more
1280 structure, as well as exposing these for user scripting more
1272 cleanly.
1281 cleanly.
1273
1282
1274 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1283 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1275 file. Now that they'll be more likely to be used with the
1284 file. Now that they'll be more likely to be used with the
1276 persistance system (%store), I want to make sure their module path
1285 persistance system (%store), I want to make sure their module path
1277 doesn't change in the future, so that we don't break things for
1286 doesn't change in the future, so that we don't break things for
1278 users' persisted data.
1287 users' persisted data.
1279
1288
1280 * IPython/iplib.py (autoindent_update): move indentation
1289 * IPython/iplib.py (autoindent_update): move indentation
1281 management into the _text_ processing loop, not the keyboard
1290 management into the _text_ processing loop, not the keyboard
1282 interactive one. This is necessary to correctly process non-typed
1291 interactive one. This is necessary to correctly process non-typed
1283 multiline input (such as macros).
1292 multiline input (such as macros).
1284
1293
1285 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1294 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1286 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1295 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1287 which was producing problems in the resulting manual.
1296 which was producing problems in the resulting manual.
1288 (magic_whos): improve reporting of instances (show their class,
1297 (magic_whos): improve reporting of instances (show their class,
1289 instead of simply printing 'instance' which isn't terribly
1298 instead of simply printing 'instance' which isn't terribly
1290 informative).
1299 informative).
1291
1300
1292 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1301 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1293 (minor mods) to support network shares under win32.
1302 (minor mods) to support network shares under win32.
1294
1303
1295 * IPython/winconsole.py (get_console_size): add new winconsole
1304 * IPython/winconsole.py (get_console_size): add new winconsole
1296 module and fixes to page_dumb() to improve its behavior under
1305 module and fixes to page_dumb() to improve its behavior under
1297 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1306 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1298
1307
1299 * IPython/Magic.py (Macro): simplified Macro class to just
1308 * IPython/Magic.py (Macro): simplified Macro class to just
1300 subclass list. We've had only 2.2 compatibility for a very long
1309 subclass list. We've had only 2.2 compatibility for a very long
1301 time, yet I was still avoiding subclassing the builtin types. No
1310 time, yet I was still avoiding subclassing the builtin types. No
1302 more (I'm also starting to use properties, though I won't shift to
1311 more (I'm also starting to use properties, though I won't shift to
1303 2.3-specific features quite yet).
1312 2.3-specific features quite yet).
1304 (magic_store): added Ville's patch for lightweight variable
1313 (magic_store): added Ville's patch for lightweight variable
1305 persistence, after a request on the user list by Matt Wilkie
1314 persistence, after a request on the user list by Matt Wilkie
1306 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1315 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1307 details.
1316 details.
1308
1317
1309 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1318 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1310 changed the default logfile name from 'ipython.log' to
1319 changed the default logfile name from 'ipython.log' to
1311 'ipython_log.py'. These logs are real python files, and now that
1320 'ipython_log.py'. These logs are real python files, and now that
1312 we have much better multiline support, people are more likely to
1321 we have much better multiline support, people are more likely to
1313 want to use them as such. Might as well name them correctly.
1322 want to use them as such. Might as well name them correctly.
1314
1323
1315 * IPython/Magic.py: substantial cleanup. While we can't stop
1324 * IPython/Magic.py: substantial cleanup. While we can't stop
1316 using magics as mixins, due to the existing customizations 'out
1325 using magics as mixins, due to the existing customizations 'out
1317 there' which rely on the mixin naming conventions, at least I
1326 there' which rely on the mixin naming conventions, at least I
1318 cleaned out all cross-class name usage. So once we are OK with
1327 cleaned out all cross-class name usage. So once we are OK with
1319 breaking compatibility, the two systems can be separated.
1328 breaking compatibility, the two systems can be separated.
1320
1329
1321 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1330 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1322 anymore, and the class is a fair bit less hideous as well. New
1331 anymore, and the class is a fair bit less hideous as well. New
1323 features were also introduced: timestamping of input, and logging
1332 features were also introduced: timestamping of input, and logging
1324 of output results. These are user-visible with the -t and -o
1333 of output results. These are user-visible with the -t and -o
1325 options to %logstart. Closes
1334 options to %logstart. Closes
1326 http://www.scipy.net/roundup/ipython/issue11 and a request by
1335 http://www.scipy.net/roundup/ipython/issue11 and a request by
1327 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1336 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1328
1337
1329 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1338 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1330
1339
1331 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1340 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1332 better handle backslashes in paths. See the thread 'More Windows
1341 better handle backslashes in paths. See the thread 'More Windows
1333 questions part 2 - \/ characters revisited' on the iypthon user
1342 questions part 2 - \/ characters revisited' on the iypthon user
1334 list:
1343 list:
1335 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1344 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1336
1345
1337 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1346 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1338
1347
1339 (InteractiveShell.__init__): change threaded shells to not use the
1348 (InteractiveShell.__init__): change threaded shells to not use the
1340 ipython crash handler. This was causing more problems than not,
1349 ipython crash handler. This was causing more problems than not,
1341 as exceptions in the main thread (GUI code, typically) would
1350 as exceptions in the main thread (GUI code, typically) would
1342 always show up as a 'crash', when they really weren't.
1351 always show up as a 'crash', when they really weren't.
1343
1352
1344 The colors and exception mode commands (%colors/%xmode) have been
1353 The colors and exception mode commands (%colors/%xmode) have been
1345 synchronized to also take this into account, so users can get
1354 synchronized to also take this into account, so users can get
1346 verbose exceptions for their threaded code as well. I also added
1355 verbose exceptions for their threaded code as well. I also added
1347 support for activating pdb inside this exception handler as well,
1356 support for activating pdb inside this exception handler as well,
1348 so now GUI authors can use IPython's enhanced pdb at runtime.
1357 so now GUI authors can use IPython's enhanced pdb at runtime.
1349
1358
1350 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1359 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1351 true by default, and add it to the shipped ipythonrc file. Since
1360 true by default, and add it to the shipped ipythonrc file. Since
1352 this asks the user before proceeding, I think it's OK to make it
1361 this asks the user before proceeding, I think it's OK to make it
1353 true by default.
1362 true by default.
1354
1363
1355 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1364 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1356 of the previous special-casing of input in the eval loop. I think
1365 of the previous special-casing of input in the eval loop. I think
1357 this is cleaner, as they really are commands and shouldn't have
1366 this is cleaner, as they really are commands and shouldn't have
1358 a special role in the middle of the core code.
1367 a special role in the middle of the core code.
1359
1368
1360 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1369 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1361
1370
1362 * IPython/iplib.py (edit_syntax_error): added support for
1371 * IPython/iplib.py (edit_syntax_error): added support for
1363 automatically reopening the editor if the file had a syntax error
1372 automatically reopening the editor if the file had a syntax error
1364 in it. Thanks to scottt who provided the patch at:
1373 in it. Thanks to scottt who provided the patch at:
1365 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1374 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1366 version committed).
1375 version committed).
1367
1376
1368 * IPython/iplib.py (handle_normal): add suport for multi-line
1377 * IPython/iplib.py (handle_normal): add suport for multi-line
1369 input with emtpy lines. This fixes
1378 input with emtpy lines. This fixes
1370 http://www.scipy.net/roundup/ipython/issue43 and a similar
1379 http://www.scipy.net/roundup/ipython/issue43 and a similar
1371 discussion on the user list.
1380 discussion on the user list.
1372
1381
1373 WARNING: a behavior change is necessarily introduced to support
1382 WARNING: a behavior change is necessarily introduced to support
1374 blank lines: now a single blank line with whitespace does NOT
1383 blank lines: now a single blank line with whitespace does NOT
1375 break the input loop, which means that when autoindent is on, by
1384 break the input loop, which means that when autoindent is on, by
1376 default hitting return on the next (indented) line does NOT exit.
1385 default hitting return on the next (indented) line does NOT exit.
1377
1386
1378 Instead, to exit a multiline input you can either have:
1387 Instead, to exit a multiline input you can either have:
1379
1388
1380 - TWO whitespace lines (just hit return again), or
1389 - TWO whitespace lines (just hit return again), or
1381 - a single whitespace line of a different length than provided
1390 - a single whitespace line of a different length than provided
1382 by the autoindent (add or remove a space).
1391 by the autoindent (add or remove a space).
1383
1392
1384 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1393 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1385 module to better organize all readline-related functionality.
1394 module to better organize all readline-related functionality.
1386 I've deleted FlexCompleter and put all completion clases here.
1395 I've deleted FlexCompleter and put all completion clases here.
1387
1396
1388 * IPython/iplib.py (raw_input): improve indentation management.
1397 * IPython/iplib.py (raw_input): improve indentation management.
1389 It is now possible to paste indented code with autoindent on, and
1398 It is now possible to paste indented code with autoindent on, and
1390 the code is interpreted correctly (though it still looks bad on
1399 the code is interpreted correctly (though it still looks bad on
1391 screen, due to the line-oriented nature of ipython).
1400 screen, due to the line-oriented nature of ipython).
1392 (MagicCompleter.complete): change behavior so that a TAB key on an
1401 (MagicCompleter.complete): change behavior so that a TAB key on an
1393 otherwise empty line actually inserts a tab, instead of completing
1402 otherwise empty line actually inserts a tab, instead of completing
1394 on the entire global namespace. This makes it easier to use the
1403 on the entire global namespace. This makes it easier to use the
1395 TAB key for indentation. After a request by Hans Meine
1404 TAB key for indentation. After a request by Hans Meine
1396 <hans_meine-AT-gmx.net>
1405 <hans_meine-AT-gmx.net>
1397 (_prefilter): add support so that typing plain 'exit' or 'quit'
1406 (_prefilter): add support so that typing plain 'exit' or 'quit'
1398 does a sensible thing. Originally I tried to deviate as little as
1407 does a sensible thing. Originally I tried to deviate as little as
1399 possible from the default python behavior, but even that one may
1408 possible from the default python behavior, but even that one may
1400 change in this direction (thread on python-dev to that effect).
1409 change in this direction (thread on python-dev to that effect).
1401 Regardless, ipython should do the right thing even if CPython's
1410 Regardless, ipython should do the right thing even if CPython's
1402 '>>>' prompt doesn't.
1411 '>>>' prompt doesn't.
1403 (InteractiveShell): removed subclassing code.InteractiveConsole
1412 (InteractiveShell): removed subclassing code.InteractiveConsole
1404 class. By now we'd overridden just about all of its methods: I've
1413 class. By now we'd overridden just about all of its methods: I've
1405 copied the remaining two over, and now ipython is a standalone
1414 copied the remaining two over, and now ipython is a standalone
1406 class. This will provide a clearer picture for the chainsaw
1415 class. This will provide a clearer picture for the chainsaw
1407 branch refactoring.
1416 branch refactoring.
1408
1417
1409 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1418 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1410
1419
1411 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1420 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1412 failures for objects which break when dir() is called on them.
1421 failures for objects which break when dir() is called on them.
1413
1422
1414 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1423 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1415 distinct local and global namespaces in the completer API. This
1424 distinct local and global namespaces in the completer API. This
1416 change allows us to properly handle completion with distinct
1425 change allows us to properly handle completion with distinct
1417 scopes, including in embedded instances (this had never really
1426 scopes, including in embedded instances (this had never really
1418 worked correctly).
1427 worked correctly).
1419
1428
1420 Note: this introduces a change in the constructor for
1429 Note: this introduces a change in the constructor for
1421 MagicCompleter, as a new global_namespace parameter is now the
1430 MagicCompleter, as a new global_namespace parameter is now the
1422 second argument (the others were bumped one position).
1431 second argument (the others were bumped one position).
1423
1432
1424 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1433 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1425
1434
1426 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1435 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1427 embedded instances (which can be done now thanks to Vivian's
1436 embedded instances (which can be done now thanks to Vivian's
1428 frame-handling fixes for pdb).
1437 frame-handling fixes for pdb).
1429 (InteractiveShell.__init__): Fix namespace handling problem in
1438 (InteractiveShell.__init__): Fix namespace handling problem in
1430 embedded instances. We were overwriting __main__ unconditionally,
1439 embedded instances. We were overwriting __main__ unconditionally,
1431 and this should only be done for 'full' (non-embedded) IPython;
1440 and this should only be done for 'full' (non-embedded) IPython;
1432 embedded instances must respect the caller's __main__. Thanks to
1441 embedded instances must respect the caller's __main__. Thanks to
1433 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1442 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1434
1443
1435 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1444 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1436
1445
1437 * setup.py: added download_url to setup(). This registers the
1446 * setup.py: added download_url to setup(). This registers the
1438 download address at PyPI, which is not only useful to humans
1447 download address at PyPI, which is not only useful to humans
1439 browsing the site, but is also picked up by setuptools (the Eggs
1448 browsing the site, but is also picked up by setuptools (the Eggs
1440 machinery). Thanks to Ville and R. Kern for the info/discussion
1449 machinery). Thanks to Ville and R. Kern for the info/discussion
1441 on this.
1450 on this.
1442
1451
1443 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1452 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1444
1453
1445 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1454 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1446 This brings a lot of nice functionality to the pdb mode, which now
1455 This brings a lot of nice functionality to the pdb mode, which now
1447 has tab-completion, syntax highlighting, and better stack handling
1456 has tab-completion, syntax highlighting, and better stack handling
1448 than before. Many thanks to Vivian De Smedt
1457 than before. Many thanks to Vivian De Smedt
1449 <vivian-AT-vdesmedt.com> for the original patches.
1458 <vivian-AT-vdesmedt.com> for the original patches.
1450
1459
1451 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1460 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1452
1461
1453 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1462 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1454 sequence to consistently accept the banner argument. The
1463 sequence to consistently accept the banner argument. The
1455 inconsistency was tripping SAGE, thanks to Gary Zablackis
1464 inconsistency was tripping SAGE, thanks to Gary Zablackis
1456 <gzabl-AT-yahoo.com> for the report.
1465 <gzabl-AT-yahoo.com> for the report.
1457
1466
1458 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1467 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1459
1468
1460 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1469 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1461 Fix bug where a naked 'alias' call in the ipythonrc file would
1470 Fix bug where a naked 'alias' call in the ipythonrc file would
1462 cause a crash. Bug reported by Jorgen Stenarson.
1471 cause a crash. Bug reported by Jorgen Stenarson.
1463
1472
1464 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1473 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1465
1474
1466 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1475 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1467 startup time.
1476 startup time.
1468
1477
1469 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1478 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1470 instances had introduced a bug with globals in normal code. Now
1479 instances had introduced a bug with globals in normal code. Now
1471 it's working in all cases.
1480 it's working in all cases.
1472
1481
1473 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1482 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1474 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1483 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1475 has been introduced to set the default case sensitivity of the
1484 has been introduced to set the default case sensitivity of the
1476 searches. Users can still select either mode at runtime on a
1485 searches. Users can still select either mode at runtime on a
1477 per-search basis.
1486 per-search basis.
1478
1487
1479 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1488 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1480
1489
1481 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1490 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1482 attributes in wildcard searches for subclasses. Modified version
1491 attributes in wildcard searches for subclasses. Modified version
1483 of a patch by Jorgen.
1492 of a patch by Jorgen.
1484
1493
1485 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1494 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1486
1495
1487 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1496 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1488 embedded instances. I added a user_global_ns attribute to the
1497 embedded instances. I added a user_global_ns attribute to the
1489 InteractiveShell class to handle this.
1498 InteractiveShell class to handle this.
1490
1499
1491 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1500 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1492
1501
1493 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1502 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1494 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1503 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1495 (reported under win32, but may happen also in other platforms).
1504 (reported under win32, but may happen also in other platforms).
1496 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1505 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1497
1506
1498 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1507 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1499
1508
1500 * IPython/Magic.py (magic_psearch): new support for wildcard
1509 * IPython/Magic.py (magic_psearch): new support for wildcard
1501 patterns. Now, typing ?a*b will list all names which begin with a
1510 patterns. Now, typing ?a*b will list all names which begin with a
1502 and end in b, for example. The %psearch magic has full
1511 and end in b, for example. The %psearch magic has full
1503 docstrings. Many thanks to JΓΆrgen Stenarson
1512 docstrings. Many thanks to JΓΆrgen Stenarson
1504 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1513 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1505 implementing this functionality.
1514 implementing this functionality.
1506
1515
1507 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1516 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1508
1517
1509 * Manual: fixed long-standing annoyance of double-dashes (as in
1518 * Manual: fixed long-standing annoyance of double-dashes (as in
1510 --prefix=~, for example) being stripped in the HTML version. This
1519 --prefix=~, for example) being stripped in the HTML version. This
1511 is a latex2html bug, but a workaround was provided. Many thanks
1520 is a latex2html bug, but a workaround was provided. Many thanks
1512 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1521 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1513 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1522 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1514 rolling. This seemingly small issue had tripped a number of users
1523 rolling. This seemingly small issue had tripped a number of users
1515 when first installing, so I'm glad to see it gone.
1524 when first installing, so I'm glad to see it gone.
1516
1525
1517 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1526 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1518
1527
1519 * IPython/Extensions/numeric_formats.py: fix missing import,
1528 * IPython/Extensions/numeric_formats.py: fix missing import,
1520 reported by Stephen Walton.
1529 reported by Stephen Walton.
1521
1530
1522 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1531 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1523
1532
1524 * IPython/demo.py: finish demo module, fully documented now.
1533 * IPython/demo.py: finish demo module, fully documented now.
1525
1534
1526 * IPython/genutils.py (file_read): simple little utility to read a
1535 * IPython/genutils.py (file_read): simple little utility to read a
1527 file and ensure it's closed afterwards.
1536 file and ensure it's closed afterwards.
1528
1537
1529 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1538 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1530
1539
1531 * IPython/demo.py (Demo.__init__): added support for individually
1540 * IPython/demo.py (Demo.__init__): added support for individually
1532 tagging blocks for automatic execution.
1541 tagging blocks for automatic execution.
1533
1542
1534 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1543 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1535 syntax-highlighted python sources, requested by John.
1544 syntax-highlighted python sources, requested by John.
1536
1545
1537 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1546 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1538
1547
1539 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1548 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1540 finishing.
1549 finishing.
1541
1550
1542 * IPython/genutils.py (shlex_split): moved from Magic to here,
1551 * IPython/genutils.py (shlex_split): moved from Magic to here,
1543 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1552 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1544
1553
1545 * IPython/demo.py (Demo.__init__): added support for silent
1554 * IPython/demo.py (Demo.__init__): added support for silent
1546 blocks, improved marks as regexps, docstrings written.
1555 blocks, improved marks as regexps, docstrings written.
1547 (Demo.__init__): better docstring, added support for sys.argv.
1556 (Demo.__init__): better docstring, added support for sys.argv.
1548
1557
1549 * IPython/genutils.py (marquee): little utility used by the demo
1558 * IPython/genutils.py (marquee): little utility used by the demo
1550 code, handy in general.
1559 code, handy in general.
1551
1560
1552 * IPython/demo.py (Demo.__init__): new class for interactive
1561 * IPython/demo.py (Demo.__init__): new class for interactive
1553 demos. Not documented yet, I just wrote it in a hurry for
1562 demos. Not documented yet, I just wrote it in a hurry for
1554 scipy'05. Will docstring later.
1563 scipy'05. Will docstring later.
1555
1564
1556 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1565 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1557
1566
1558 * IPython/Shell.py (sigint_handler): Drastic simplification which
1567 * IPython/Shell.py (sigint_handler): Drastic simplification which
1559 also seems to make Ctrl-C work correctly across threads! This is
1568 also seems to make Ctrl-C work correctly across threads! This is
1560 so simple, that I can't beleive I'd missed it before. Needs more
1569 so simple, that I can't beleive I'd missed it before. Needs more
1561 testing, though.
1570 testing, though.
1562 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1571 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1563 like this before...
1572 like this before...
1564
1573
1565 * IPython/genutils.py (get_home_dir): add protection against
1574 * IPython/genutils.py (get_home_dir): add protection against
1566 non-dirs in win32 registry.
1575 non-dirs in win32 registry.
1567
1576
1568 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1577 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1569 bug where dict was mutated while iterating (pysh crash).
1578 bug where dict was mutated while iterating (pysh crash).
1570
1579
1571 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1580 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1572
1581
1573 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1582 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1574 spurious newlines added by this routine. After a report by
1583 spurious newlines added by this routine. After a report by
1575 F. Mantegazza.
1584 F. Mantegazza.
1576
1585
1577 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1586 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1578
1587
1579 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1588 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1580 calls. These were a leftover from the GTK 1.x days, and can cause
1589 calls. These were a leftover from the GTK 1.x days, and can cause
1581 problems in certain cases (after a report by John Hunter).
1590 problems in certain cases (after a report by John Hunter).
1582
1591
1583 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1592 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1584 os.getcwd() fails at init time. Thanks to patch from David Remahl
1593 os.getcwd() fails at init time. Thanks to patch from David Remahl
1585 <chmod007-AT-mac.com>.
1594 <chmod007-AT-mac.com>.
1586 (InteractiveShell.__init__): prevent certain special magics from
1595 (InteractiveShell.__init__): prevent certain special magics from
1587 being shadowed by aliases. Closes
1596 being shadowed by aliases. Closes
1588 http://www.scipy.net/roundup/ipython/issue41.
1597 http://www.scipy.net/roundup/ipython/issue41.
1589
1598
1590 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1599 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1591
1600
1592 * IPython/iplib.py (InteractiveShell.complete): Added new
1601 * IPython/iplib.py (InteractiveShell.complete): Added new
1593 top-level completion method to expose the completion mechanism
1602 top-level completion method to expose the completion mechanism
1594 beyond readline-based environments.
1603 beyond readline-based environments.
1595
1604
1596 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1605 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1597
1606
1598 * tools/ipsvnc (svnversion): fix svnversion capture.
1607 * tools/ipsvnc (svnversion): fix svnversion capture.
1599
1608
1600 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1609 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1601 attribute to self, which was missing. Before, it was set by a
1610 attribute to self, which was missing. Before, it was set by a
1602 routine which in certain cases wasn't being called, so the
1611 routine which in certain cases wasn't being called, so the
1603 instance could end up missing the attribute. This caused a crash.
1612 instance could end up missing the attribute. This caused a crash.
1604 Closes http://www.scipy.net/roundup/ipython/issue40.
1613 Closes http://www.scipy.net/roundup/ipython/issue40.
1605
1614
1606 2005-08-16 Fernando Perez <fperez@colorado.edu>
1615 2005-08-16 Fernando Perez <fperez@colorado.edu>
1607
1616
1608 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1617 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1609 contains non-string attribute. Closes
1618 contains non-string attribute. Closes
1610 http://www.scipy.net/roundup/ipython/issue38.
1619 http://www.scipy.net/roundup/ipython/issue38.
1611
1620
1612 2005-08-14 Fernando Perez <fperez@colorado.edu>
1621 2005-08-14 Fernando Perez <fperez@colorado.edu>
1613
1622
1614 * tools/ipsvnc: Minor improvements, to add changeset info.
1623 * tools/ipsvnc: Minor improvements, to add changeset info.
1615
1624
1616 2005-08-12 Fernando Perez <fperez@colorado.edu>
1625 2005-08-12 Fernando Perez <fperez@colorado.edu>
1617
1626
1618 * IPython/iplib.py (runsource): remove self.code_to_run_src
1627 * IPython/iplib.py (runsource): remove self.code_to_run_src
1619 attribute. I realized this is nothing more than
1628 attribute. I realized this is nothing more than
1620 '\n'.join(self.buffer), and having the same data in two different
1629 '\n'.join(self.buffer), and having the same data in two different
1621 places is just asking for synchronization bugs. This may impact
1630 places is just asking for synchronization bugs. This may impact
1622 people who have custom exception handlers, so I need to warn
1631 people who have custom exception handlers, so I need to warn
1623 ipython-dev about it (F. Mantegazza may use them).
1632 ipython-dev about it (F. Mantegazza may use them).
1624
1633
1625 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1634 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1626
1635
1627 * IPython/genutils.py: fix 2.2 compatibility (generators)
1636 * IPython/genutils.py: fix 2.2 compatibility (generators)
1628
1637
1629 2005-07-18 Fernando Perez <fperez@colorado.edu>
1638 2005-07-18 Fernando Perez <fperez@colorado.edu>
1630
1639
1631 * IPython/genutils.py (get_home_dir): fix to help users with
1640 * IPython/genutils.py (get_home_dir): fix to help users with
1632 invalid $HOME under win32.
1641 invalid $HOME under win32.
1633
1642
1634 2005-07-17 Fernando Perez <fperez@colorado.edu>
1643 2005-07-17 Fernando Perez <fperez@colorado.edu>
1635
1644
1636 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1645 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1637 some old hacks and clean up a bit other routines; code should be
1646 some old hacks and clean up a bit other routines; code should be
1638 simpler and a bit faster.
1647 simpler and a bit faster.
1639
1648
1640 * IPython/iplib.py (interact): removed some last-resort attempts
1649 * IPython/iplib.py (interact): removed some last-resort attempts
1641 to survive broken stdout/stderr. That code was only making it
1650 to survive broken stdout/stderr. That code was only making it
1642 harder to abstract out the i/o (necessary for gui integration),
1651 harder to abstract out the i/o (necessary for gui integration),
1643 and the crashes it could prevent were extremely rare in practice
1652 and the crashes it could prevent were extremely rare in practice
1644 (besides being fully user-induced in a pretty violent manner).
1653 (besides being fully user-induced in a pretty violent manner).
1645
1654
1646 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1655 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1647 Nothing major yet, but the code is simpler to read; this should
1656 Nothing major yet, but the code is simpler to read; this should
1648 make it easier to do more serious modifications in the future.
1657 make it easier to do more serious modifications in the future.
1649
1658
1650 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1659 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1651 which broke in .15 (thanks to a report by Ville).
1660 which broke in .15 (thanks to a report by Ville).
1652
1661
1653 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1662 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1654 be quite correct, I know next to nothing about unicode). This
1663 be quite correct, I know next to nothing about unicode). This
1655 will allow unicode strings to be used in prompts, amongst other
1664 will allow unicode strings to be used in prompts, amongst other
1656 cases. It also will prevent ipython from crashing when unicode
1665 cases. It also will prevent ipython from crashing when unicode
1657 shows up unexpectedly in many places. If ascii encoding fails, we
1666 shows up unexpectedly in many places. If ascii encoding fails, we
1658 assume utf_8. Currently the encoding is not a user-visible
1667 assume utf_8. Currently the encoding is not a user-visible
1659 setting, though it could be made so if there is demand for it.
1668 setting, though it could be made so if there is demand for it.
1660
1669
1661 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1670 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1662
1671
1663 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1672 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1664
1673
1665 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1674 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1666
1675
1667 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1676 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1668 code can work transparently for 2.2/2.3.
1677 code can work transparently for 2.2/2.3.
1669
1678
1670 2005-07-16 Fernando Perez <fperez@colorado.edu>
1679 2005-07-16 Fernando Perez <fperez@colorado.edu>
1671
1680
1672 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1681 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1673 out of the color scheme table used for coloring exception
1682 out of the color scheme table used for coloring exception
1674 tracebacks. This allows user code to add new schemes at runtime.
1683 tracebacks. This allows user code to add new schemes at runtime.
1675 This is a minimally modified version of the patch at
1684 This is a minimally modified version of the patch at
1676 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1685 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1677 for the contribution.
1686 for the contribution.
1678
1687
1679 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1688 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1680 slightly modified version of the patch in
1689 slightly modified version of the patch in
1681 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1690 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1682 to remove the previous try/except solution (which was costlier).
1691 to remove the previous try/except solution (which was costlier).
1683 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1692 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1684
1693
1685 2005-06-08 Fernando Perez <fperez@colorado.edu>
1694 2005-06-08 Fernando Perez <fperez@colorado.edu>
1686
1695
1687 * IPython/iplib.py (write/write_err): Add methods to abstract all
1696 * IPython/iplib.py (write/write_err): Add methods to abstract all
1688 I/O a bit more.
1697 I/O a bit more.
1689
1698
1690 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1699 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1691 warning, reported by Aric Hagberg, fix by JD Hunter.
1700 warning, reported by Aric Hagberg, fix by JD Hunter.
1692
1701
1693 2005-06-02 *** Released version 0.6.15
1702 2005-06-02 *** Released version 0.6.15
1694
1703
1695 2005-06-01 Fernando Perez <fperez@colorado.edu>
1704 2005-06-01 Fernando Perez <fperez@colorado.edu>
1696
1705
1697 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1706 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1698 tab-completion of filenames within open-quoted strings. Note that
1707 tab-completion of filenames within open-quoted strings. Note that
1699 this requires that in ~/.ipython/ipythonrc, users change the
1708 this requires that in ~/.ipython/ipythonrc, users change the
1700 readline delimiters configuration to read:
1709 readline delimiters configuration to read:
1701
1710
1702 readline_remove_delims -/~
1711 readline_remove_delims -/~
1703
1712
1704
1713
1705 2005-05-31 *** Released version 0.6.14
1714 2005-05-31 *** Released version 0.6.14
1706
1715
1707 2005-05-29 Fernando Perez <fperez@colorado.edu>
1716 2005-05-29 Fernando Perez <fperez@colorado.edu>
1708
1717
1709 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1718 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1710 with files not on the filesystem. Reported by Eliyahu Sandler
1719 with files not on the filesystem. Reported by Eliyahu Sandler
1711 <eli@gondolin.net>
1720 <eli@gondolin.net>
1712
1721
1713 2005-05-22 Fernando Perez <fperez@colorado.edu>
1722 2005-05-22 Fernando Perez <fperez@colorado.edu>
1714
1723
1715 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1724 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1716 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1725 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1717
1726
1718 2005-05-19 Fernando Perez <fperez@colorado.edu>
1727 2005-05-19 Fernando Perez <fperez@colorado.edu>
1719
1728
1720 * IPython/iplib.py (safe_execfile): close a file which could be
1729 * IPython/iplib.py (safe_execfile): close a file which could be
1721 left open (causing problems in win32, which locks open files).
1730 left open (causing problems in win32, which locks open files).
1722 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1731 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1723
1732
1724 2005-05-18 Fernando Perez <fperez@colorado.edu>
1733 2005-05-18 Fernando Perez <fperez@colorado.edu>
1725
1734
1726 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1735 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1727 keyword arguments correctly to safe_execfile().
1736 keyword arguments correctly to safe_execfile().
1728
1737
1729 2005-05-13 Fernando Perez <fperez@colorado.edu>
1738 2005-05-13 Fernando Perez <fperez@colorado.edu>
1730
1739
1731 * ipython.1: Added info about Qt to manpage, and threads warning
1740 * ipython.1: Added info about Qt to manpage, and threads warning
1732 to usage page (invoked with --help).
1741 to usage page (invoked with --help).
1733
1742
1734 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1743 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1735 new matcher (it goes at the end of the priority list) to do
1744 new matcher (it goes at the end of the priority list) to do
1736 tab-completion on named function arguments. Submitted by George
1745 tab-completion on named function arguments. Submitted by George
1737 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1746 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1738 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1747 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1739 for more details.
1748 for more details.
1740
1749
1741 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1750 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1742 SystemExit exceptions in the script being run. Thanks to a report
1751 SystemExit exceptions in the script being run. Thanks to a report
1743 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1752 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1744 producing very annoying behavior when running unit tests.
1753 producing very annoying behavior when running unit tests.
1745
1754
1746 2005-05-12 Fernando Perez <fperez@colorado.edu>
1755 2005-05-12 Fernando Perez <fperez@colorado.edu>
1747
1756
1748 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1757 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1749 which I'd broken (again) due to a changed regexp. In the process,
1758 which I'd broken (again) due to a changed regexp. In the process,
1750 added ';' as an escape to auto-quote the whole line without
1759 added ';' as an escape to auto-quote the whole line without
1751 splitting its arguments. Thanks to a report by Jerry McRae
1760 splitting its arguments. Thanks to a report by Jerry McRae
1752 <qrs0xyc02-AT-sneakemail.com>.
1761 <qrs0xyc02-AT-sneakemail.com>.
1753
1762
1754 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1763 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1755 possible crashes caused by a TokenError. Reported by Ed Schofield
1764 possible crashes caused by a TokenError. Reported by Ed Schofield
1756 <schofield-AT-ftw.at>.
1765 <schofield-AT-ftw.at>.
1757
1766
1758 2005-05-06 Fernando Perez <fperez@colorado.edu>
1767 2005-05-06 Fernando Perez <fperez@colorado.edu>
1759
1768
1760 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1769 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1761
1770
1762 2005-04-29 Fernando Perez <fperez@colorado.edu>
1771 2005-04-29 Fernando Perez <fperez@colorado.edu>
1763
1772
1764 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1773 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1765 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1774 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1766 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1775 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1767 which provides support for Qt interactive usage (similar to the
1776 which provides support for Qt interactive usage (similar to the
1768 existing one for WX and GTK). This had been often requested.
1777 existing one for WX and GTK). This had been often requested.
1769
1778
1770 2005-04-14 *** Released version 0.6.13
1779 2005-04-14 *** Released version 0.6.13
1771
1780
1772 2005-04-08 Fernando Perez <fperez@colorado.edu>
1781 2005-04-08 Fernando Perez <fperez@colorado.edu>
1773
1782
1774 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1783 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1775 from _ofind, which gets called on almost every input line. Now,
1784 from _ofind, which gets called on almost every input line. Now,
1776 we only try to get docstrings if they are actually going to be
1785 we only try to get docstrings if they are actually going to be
1777 used (the overhead of fetching unnecessary docstrings can be
1786 used (the overhead of fetching unnecessary docstrings can be
1778 noticeable for certain objects, such as Pyro proxies).
1787 noticeable for certain objects, such as Pyro proxies).
1779
1788
1780 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1789 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1781 for completers. For some reason I had been passing them the state
1790 for completers. For some reason I had been passing them the state
1782 variable, which completers never actually need, and was in
1791 variable, which completers never actually need, and was in
1783 conflict with the rlcompleter API. Custom completers ONLY need to
1792 conflict with the rlcompleter API. Custom completers ONLY need to
1784 take the text parameter.
1793 take the text parameter.
1785
1794
1786 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1795 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1787 work correctly in pysh. I've also moved all the logic which used
1796 work correctly in pysh. I've also moved all the logic which used
1788 to be in pysh.py here, which will prevent problems with future
1797 to be in pysh.py here, which will prevent problems with future
1789 upgrades. However, this time I must warn users to update their
1798 upgrades. However, this time I must warn users to update their
1790 pysh profile to include the line
1799 pysh profile to include the line
1791
1800
1792 import_all IPython.Extensions.InterpreterExec
1801 import_all IPython.Extensions.InterpreterExec
1793
1802
1794 because otherwise things won't work for them. They MUST also
1803 because otherwise things won't work for them. They MUST also
1795 delete pysh.py and the line
1804 delete pysh.py and the line
1796
1805
1797 execfile pysh.py
1806 execfile pysh.py
1798
1807
1799 from their ipythonrc-pysh.
1808 from their ipythonrc-pysh.
1800
1809
1801 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1810 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1802 robust in the face of objects whose dir() returns non-strings
1811 robust in the face of objects whose dir() returns non-strings
1803 (which it shouldn't, but some broken libs like ITK do). Thanks to
1812 (which it shouldn't, but some broken libs like ITK do). Thanks to
1804 a patch by John Hunter (implemented differently, though). Also
1813 a patch by John Hunter (implemented differently, though). Also
1805 minor improvements by using .extend instead of + on lists.
1814 minor improvements by using .extend instead of + on lists.
1806
1815
1807 * pysh.py:
1816 * pysh.py:
1808
1817
1809 2005-04-06 Fernando Perez <fperez@colorado.edu>
1818 2005-04-06 Fernando Perez <fperez@colorado.edu>
1810
1819
1811 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1820 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1812 by default, so that all users benefit from it. Those who don't
1821 by default, so that all users benefit from it. Those who don't
1813 want it can still turn it off.
1822 want it can still turn it off.
1814
1823
1815 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1824 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1816 config file, I'd forgotten about this, so users were getting it
1825 config file, I'd forgotten about this, so users were getting it
1817 off by default.
1826 off by default.
1818
1827
1819 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1828 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1820 consistency. Now magics can be called in multiline statements,
1829 consistency. Now magics can be called in multiline statements,
1821 and python variables can be expanded in magic calls via $var.
1830 and python variables can be expanded in magic calls via $var.
1822 This makes the magic system behave just like aliases or !system
1831 This makes the magic system behave just like aliases or !system
1823 calls.
1832 calls.
1824
1833
1825 2005-03-28 Fernando Perez <fperez@colorado.edu>
1834 2005-03-28 Fernando Perez <fperez@colorado.edu>
1826
1835
1827 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1836 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1828 expensive string additions for building command. Add support for
1837 expensive string additions for building command. Add support for
1829 trailing ';' when autocall is used.
1838 trailing ';' when autocall is used.
1830
1839
1831 2005-03-26 Fernando Perez <fperez@colorado.edu>
1840 2005-03-26 Fernando Perez <fperez@colorado.edu>
1832
1841
1833 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1842 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1834 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1843 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1835 ipython.el robust against prompts with any number of spaces
1844 ipython.el robust against prompts with any number of spaces
1836 (including 0) after the ':' character.
1845 (including 0) after the ':' character.
1837
1846
1838 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1847 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1839 continuation prompt, which misled users to think the line was
1848 continuation prompt, which misled users to think the line was
1840 already indented. Closes debian Bug#300847, reported to me by
1849 already indented. Closes debian Bug#300847, reported to me by
1841 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1850 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1842
1851
1843 2005-03-23 Fernando Perez <fperez@colorado.edu>
1852 2005-03-23 Fernando Perez <fperez@colorado.edu>
1844
1853
1845 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1854 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1846 properly aligned if they have embedded newlines.
1855 properly aligned if they have embedded newlines.
1847
1856
1848 * IPython/iplib.py (runlines): Add a public method to expose
1857 * IPython/iplib.py (runlines): Add a public method to expose
1849 IPython's code execution machinery, so that users can run strings
1858 IPython's code execution machinery, so that users can run strings
1850 as if they had been typed at the prompt interactively.
1859 as if they had been typed at the prompt interactively.
1851 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1860 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1852 methods which can call the system shell, but with python variable
1861 methods which can call the system shell, but with python variable
1853 expansion. The three such methods are: __IPYTHON__.system,
1862 expansion. The three such methods are: __IPYTHON__.system,
1854 .getoutput and .getoutputerror. These need to be documented in a
1863 .getoutput and .getoutputerror. These need to be documented in a
1855 'public API' section (to be written) of the manual.
1864 'public API' section (to be written) of the manual.
1856
1865
1857 2005-03-20 Fernando Perez <fperez@colorado.edu>
1866 2005-03-20 Fernando Perez <fperez@colorado.edu>
1858
1867
1859 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1868 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1860 for custom exception handling. This is quite powerful, and it
1869 for custom exception handling. This is quite powerful, and it
1861 allows for user-installable exception handlers which can trap
1870 allows for user-installable exception handlers which can trap
1862 custom exceptions at runtime and treat them separately from
1871 custom exceptions at runtime and treat them separately from
1863 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1872 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1864 Mantegazza <mantegazza-AT-ill.fr>.
1873 Mantegazza <mantegazza-AT-ill.fr>.
1865 (InteractiveShell.set_custom_completer): public API function to
1874 (InteractiveShell.set_custom_completer): public API function to
1866 add new completers at runtime.
1875 add new completers at runtime.
1867
1876
1868 2005-03-19 Fernando Perez <fperez@colorado.edu>
1877 2005-03-19 Fernando Perez <fperez@colorado.edu>
1869
1878
1870 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1879 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1871 allow objects which provide their docstrings via non-standard
1880 allow objects which provide their docstrings via non-standard
1872 mechanisms (like Pyro proxies) to still be inspected by ipython's
1881 mechanisms (like Pyro proxies) to still be inspected by ipython's
1873 ? system.
1882 ? system.
1874
1883
1875 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1884 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1876 automatic capture system. I tried quite hard to make it work
1885 automatic capture system. I tried quite hard to make it work
1877 reliably, and simply failed. I tried many combinations with the
1886 reliably, and simply failed. I tried many combinations with the
1878 subprocess module, but eventually nothing worked in all needed
1887 subprocess module, but eventually nothing worked in all needed
1879 cases (not blocking stdin for the child, duplicating stdout
1888 cases (not blocking stdin for the child, duplicating stdout
1880 without blocking, etc). The new %sc/%sx still do capture to these
1889 without blocking, etc). The new %sc/%sx still do capture to these
1881 magical list/string objects which make shell use much more
1890 magical list/string objects which make shell use much more
1882 conveninent, so not all is lost.
1891 conveninent, so not all is lost.
1883
1892
1884 XXX - FIX MANUAL for the change above!
1893 XXX - FIX MANUAL for the change above!
1885
1894
1886 (runsource): I copied code.py's runsource() into ipython to modify
1895 (runsource): I copied code.py's runsource() into ipython to modify
1887 it a bit. Now the code object and source to be executed are
1896 it a bit. Now the code object and source to be executed are
1888 stored in ipython. This makes this info accessible to third-party
1897 stored in ipython. This makes this info accessible to third-party
1889 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1898 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1890 Mantegazza <mantegazza-AT-ill.fr>.
1899 Mantegazza <mantegazza-AT-ill.fr>.
1891
1900
1892 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1901 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1893 history-search via readline (like C-p/C-n). I'd wanted this for a
1902 history-search via readline (like C-p/C-n). I'd wanted this for a
1894 long time, but only recently found out how to do it. For users
1903 long time, but only recently found out how to do it. For users
1895 who already have their ipythonrc files made and want this, just
1904 who already have their ipythonrc files made and want this, just
1896 add:
1905 add:
1897
1906
1898 readline_parse_and_bind "\e[A": history-search-backward
1907 readline_parse_and_bind "\e[A": history-search-backward
1899 readline_parse_and_bind "\e[B": history-search-forward
1908 readline_parse_and_bind "\e[B": history-search-forward
1900
1909
1901 2005-03-18 Fernando Perez <fperez@colorado.edu>
1910 2005-03-18 Fernando Perez <fperez@colorado.edu>
1902
1911
1903 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1912 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1904 LSString and SList classes which allow transparent conversions
1913 LSString and SList classes which allow transparent conversions
1905 between list mode and whitespace-separated string.
1914 between list mode and whitespace-separated string.
1906 (magic_r): Fix recursion problem in %r.
1915 (magic_r): Fix recursion problem in %r.
1907
1916
1908 * IPython/genutils.py (LSString): New class to be used for
1917 * IPython/genutils.py (LSString): New class to be used for
1909 automatic storage of the results of all alias/system calls in _o
1918 automatic storage of the results of all alias/system calls in _o
1910 and _e (stdout/err). These provide a .l/.list attribute which
1919 and _e (stdout/err). These provide a .l/.list attribute which
1911 does automatic splitting on newlines. This means that for most
1920 does automatic splitting on newlines. This means that for most
1912 uses, you'll never need to do capturing of output with %sc/%sx
1921 uses, you'll never need to do capturing of output with %sc/%sx
1913 anymore, since ipython keeps this always done for you. Note that
1922 anymore, since ipython keeps this always done for you. Note that
1914 only the LAST results are stored, the _o/e variables are
1923 only the LAST results are stored, the _o/e variables are
1915 overwritten on each call. If you need to save their contents
1924 overwritten on each call. If you need to save their contents
1916 further, simply bind them to any other name.
1925 further, simply bind them to any other name.
1917
1926
1918 2005-03-17 Fernando Perez <fperez@colorado.edu>
1927 2005-03-17 Fernando Perez <fperez@colorado.edu>
1919
1928
1920 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1929 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1921 prompt namespace handling.
1930 prompt namespace handling.
1922
1931
1923 2005-03-16 Fernando Perez <fperez@colorado.edu>
1932 2005-03-16 Fernando Perez <fperez@colorado.edu>
1924
1933
1925 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1934 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1926 classic prompts to be '>>> ' (final space was missing, and it
1935 classic prompts to be '>>> ' (final space was missing, and it
1927 trips the emacs python mode).
1936 trips the emacs python mode).
1928 (BasePrompt.__str__): Added safe support for dynamic prompt
1937 (BasePrompt.__str__): Added safe support for dynamic prompt
1929 strings. Now you can set your prompt string to be '$x', and the
1938 strings. Now you can set your prompt string to be '$x', and the
1930 value of x will be printed from your interactive namespace. The
1939 value of x will be printed from your interactive namespace. The
1931 interpolation syntax includes the full Itpl support, so
1940 interpolation syntax includes the full Itpl support, so
1932 ${foo()+x+bar()} is a valid prompt string now, and the function
1941 ${foo()+x+bar()} is a valid prompt string now, and the function
1933 calls will be made at runtime.
1942 calls will be made at runtime.
1934
1943
1935 2005-03-15 Fernando Perez <fperez@colorado.edu>
1944 2005-03-15 Fernando Perez <fperez@colorado.edu>
1936
1945
1937 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1946 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1938 avoid name clashes in pylab. %hist still works, it just forwards
1947 avoid name clashes in pylab. %hist still works, it just forwards
1939 the call to %history.
1948 the call to %history.
1940
1949
1941 2005-03-02 *** Released version 0.6.12
1950 2005-03-02 *** Released version 0.6.12
1942
1951
1943 2005-03-02 Fernando Perez <fperez@colorado.edu>
1952 2005-03-02 Fernando Perez <fperez@colorado.edu>
1944
1953
1945 * IPython/iplib.py (handle_magic): log magic calls properly as
1954 * IPython/iplib.py (handle_magic): log magic calls properly as
1946 ipmagic() function calls.
1955 ipmagic() function calls.
1947
1956
1948 * IPython/Magic.py (magic_time): Improved %time to support
1957 * IPython/Magic.py (magic_time): Improved %time to support
1949 statements and provide wall-clock as well as CPU time.
1958 statements and provide wall-clock as well as CPU time.
1950
1959
1951 2005-02-27 Fernando Perez <fperez@colorado.edu>
1960 2005-02-27 Fernando Perez <fperez@colorado.edu>
1952
1961
1953 * IPython/hooks.py: New hooks module, to expose user-modifiable
1962 * IPython/hooks.py: New hooks module, to expose user-modifiable
1954 IPython functionality in a clean manner. For now only the editor
1963 IPython functionality in a clean manner. For now only the editor
1955 hook is actually written, and other thigns which I intend to turn
1964 hook is actually written, and other thigns which I intend to turn
1956 into proper hooks aren't yet there. The display and prefilter
1965 into proper hooks aren't yet there. The display and prefilter
1957 stuff, for example, should be hooks. But at least now the
1966 stuff, for example, should be hooks. But at least now the
1958 framework is in place, and the rest can be moved here with more
1967 framework is in place, and the rest can be moved here with more
1959 time later. IPython had had a .hooks variable for a long time for
1968 time later. IPython had had a .hooks variable for a long time for
1960 this purpose, but I'd never actually used it for anything.
1969 this purpose, but I'd never actually used it for anything.
1961
1970
1962 2005-02-26 Fernando Perez <fperez@colorado.edu>
1971 2005-02-26 Fernando Perez <fperez@colorado.edu>
1963
1972
1964 * IPython/ipmaker.py (make_IPython): make the default ipython
1973 * IPython/ipmaker.py (make_IPython): make the default ipython
1965 directory be called _ipython under win32, to follow more the
1974 directory be called _ipython under win32, to follow more the
1966 naming peculiarities of that platform (where buggy software like
1975 naming peculiarities of that platform (where buggy software like
1967 Visual Sourcesafe breaks with .named directories). Reported by
1976 Visual Sourcesafe breaks with .named directories). Reported by
1968 Ville Vainio.
1977 Ville Vainio.
1969
1978
1970 2005-02-23 Fernando Perez <fperez@colorado.edu>
1979 2005-02-23 Fernando Perez <fperez@colorado.edu>
1971
1980
1972 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1981 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1973 auto_aliases for win32 which were causing problems. Users can
1982 auto_aliases for win32 which were causing problems. Users can
1974 define the ones they personally like.
1983 define the ones they personally like.
1975
1984
1976 2005-02-21 Fernando Perez <fperez@colorado.edu>
1985 2005-02-21 Fernando Perez <fperez@colorado.edu>
1977
1986
1978 * IPython/Magic.py (magic_time): new magic to time execution of
1987 * IPython/Magic.py (magic_time): new magic to time execution of
1979 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1988 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1980
1989
1981 2005-02-19 Fernando Perez <fperez@colorado.edu>
1990 2005-02-19 Fernando Perez <fperez@colorado.edu>
1982
1991
1983 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1992 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1984 into keys (for prompts, for example).
1993 into keys (for prompts, for example).
1985
1994
1986 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1995 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1987 prompts in case users want them. This introduces a small behavior
1996 prompts in case users want them. This introduces a small behavior
1988 change: ipython does not automatically add a space to all prompts
1997 change: ipython does not automatically add a space to all prompts
1989 anymore. To get the old prompts with a space, users should add it
1998 anymore. To get the old prompts with a space, users should add it
1990 manually to their ipythonrc file, so for example prompt_in1 should
1999 manually to their ipythonrc file, so for example prompt_in1 should
1991 now read 'In [\#]: ' instead of 'In [\#]:'.
2000 now read 'In [\#]: ' instead of 'In [\#]:'.
1992 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2001 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1993 file) to control left-padding of secondary prompts.
2002 file) to control left-padding of secondary prompts.
1994
2003
1995 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2004 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1996 the profiler can't be imported. Fix for Debian, which removed
2005 the profiler can't be imported. Fix for Debian, which removed
1997 profile.py because of License issues. I applied a slightly
2006 profile.py because of License issues. I applied a slightly
1998 modified version of the original Debian patch at
2007 modified version of the original Debian patch at
1999 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2008 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2000
2009
2001 2005-02-17 Fernando Perez <fperez@colorado.edu>
2010 2005-02-17 Fernando Perez <fperez@colorado.edu>
2002
2011
2003 * IPython/genutils.py (native_line_ends): Fix bug which would
2012 * IPython/genutils.py (native_line_ends): Fix bug which would
2004 cause improper line-ends under win32 b/c I was not opening files
2013 cause improper line-ends under win32 b/c I was not opening files
2005 in binary mode. Bug report and fix thanks to Ville.
2014 in binary mode. Bug report and fix thanks to Ville.
2006
2015
2007 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2016 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2008 trying to catch spurious foo[1] autocalls. My fix actually broke
2017 trying to catch spurious foo[1] autocalls. My fix actually broke
2009 ',/' autoquote/call with explicit escape (bad regexp).
2018 ',/' autoquote/call with explicit escape (bad regexp).
2010
2019
2011 2005-02-15 *** Released version 0.6.11
2020 2005-02-15 *** Released version 0.6.11
2012
2021
2013 2005-02-14 Fernando Perez <fperez@colorado.edu>
2022 2005-02-14 Fernando Perez <fperez@colorado.edu>
2014
2023
2015 * IPython/background_jobs.py: New background job management
2024 * IPython/background_jobs.py: New background job management
2016 subsystem. This is implemented via a new set of classes, and
2025 subsystem. This is implemented via a new set of classes, and
2017 IPython now provides a builtin 'jobs' object for background job
2026 IPython now provides a builtin 'jobs' object for background job
2018 execution. A convenience %bg magic serves as a lightweight
2027 execution. A convenience %bg magic serves as a lightweight
2019 frontend for starting the more common type of calls. This was
2028 frontend for starting the more common type of calls. This was
2020 inspired by discussions with B. Granger and the BackgroundCommand
2029 inspired by discussions with B. Granger and the BackgroundCommand
2021 class described in the book Python Scripting for Computational
2030 class described in the book Python Scripting for Computational
2022 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2031 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2023 (although ultimately no code from this text was used, as IPython's
2032 (although ultimately no code from this text was used, as IPython's
2024 system is a separate implementation).
2033 system is a separate implementation).
2025
2034
2026 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2035 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2027 to control the completion of single/double underscore names
2036 to control the completion of single/double underscore names
2028 separately. As documented in the example ipytonrc file, the
2037 separately. As documented in the example ipytonrc file, the
2029 readline_omit__names variable can now be set to 2, to omit even
2038 readline_omit__names variable can now be set to 2, to omit even
2030 single underscore names. Thanks to a patch by Brian Wong
2039 single underscore names. Thanks to a patch by Brian Wong
2031 <BrianWong-AT-AirgoNetworks.Com>.
2040 <BrianWong-AT-AirgoNetworks.Com>.
2032 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2041 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2033 be autocalled as foo([1]) if foo were callable. A problem for
2042 be autocalled as foo([1]) if foo were callable. A problem for
2034 things which are both callable and implement __getitem__.
2043 things which are both callable and implement __getitem__.
2035 (init_readline): Fix autoindentation for win32. Thanks to a patch
2044 (init_readline): Fix autoindentation for win32. Thanks to a patch
2036 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2045 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2037
2046
2038 2005-02-12 Fernando Perez <fperez@colorado.edu>
2047 2005-02-12 Fernando Perez <fperez@colorado.edu>
2039
2048
2040 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2049 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2041 which I had written long ago to sort out user error messages which
2050 which I had written long ago to sort out user error messages which
2042 may occur during startup. This seemed like a good idea initially,
2051 may occur during startup. This seemed like a good idea initially,
2043 but it has proven a disaster in retrospect. I don't want to
2052 but it has proven a disaster in retrospect. I don't want to
2044 change much code for now, so my fix is to set the internal 'debug'
2053 change much code for now, so my fix is to set the internal 'debug'
2045 flag to true everywhere, whose only job was precisely to control
2054 flag to true everywhere, whose only job was precisely to control
2046 this subsystem. This closes issue 28 (as well as avoiding all
2055 this subsystem. This closes issue 28 (as well as avoiding all
2047 sorts of strange hangups which occur from time to time).
2056 sorts of strange hangups which occur from time to time).
2048
2057
2049 2005-02-07 Fernando Perez <fperez@colorado.edu>
2058 2005-02-07 Fernando Perez <fperez@colorado.edu>
2050
2059
2051 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2060 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2052 previous call produced a syntax error.
2061 previous call produced a syntax error.
2053
2062
2054 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2063 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2055 classes without constructor.
2064 classes without constructor.
2056
2065
2057 2005-02-06 Fernando Perez <fperez@colorado.edu>
2066 2005-02-06 Fernando Perez <fperez@colorado.edu>
2058
2067
2059 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2068 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2060 completions with the results of each matcher, so we return results
2069 completions with the results of each matcher, so we return results
2061 to the user from all namespaces. This breaks with ipython
2070 to the user from all namespaces. This breaks with ipython
2062 tradition, but I think it's a nicer behavior. Now you get all
2071 tradition, but I think it's a nicer behavior. Now you get all
2063 possible completions listed, from all possible namespaces (python,
2072 possible completions listed, from all possible namespaces (python,
2064 filesystem, magics...) After a request by John Hunter
2073 filesystem, magics...) After a request by John Hunter
2065 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2074 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2066
2075
2067 2005-02-05 Fernando Perez <fperez@colorado.edu>
2076 2005-02-05 Fernando Perez <fperez@colorado.edu>
2068
2077
2069 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2078 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2070 the call had quote characters in it (the quotes were stripped).
2079 the call had quote characters in it (the quotes were stripped).
2071
2080
2072 2005-01-31 Fernando Perez <fperez@colorado.edu>
2081 2005-01-31 Fernando Perez <fperez@colorado.edu>
2073
2082
2074 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2083 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2075 Itpl.itpl() to make the code more robust against psyco
2084 Itpl.itpl() to make the code more robust against psyco
2076 optimizations.
2085 optimizations.
2077
2086
2078 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2087 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2079 of causing an exception. Quicker, cleaner.
2088 of causing an exception. Quicker, cleaner.
2080
2089
2081 2005-01-28 Fernando Perez <fperez@colorado.edu>
2090 2005-01-28 Fernando Perez <fperez@colorado.edu>
2082
2091
2083 * scripts/ipython_win_post_install.py (install): hardcode
2092 * scripts/ipython_win_post_install.py (install): hardcode
2084 sys.prefix+'python.exe' as the executable path. It turns out that
2093 sys.prefix+'python.exe' as the executable path. It turns out that
2085 during the post-installation run, sys.executable resolves to the
2094 during the post-installation run, sys.executable resolves to the
2086 name of the binary installer! I should report this as a distutils
2095 name of the binary installer! I should report this as a distutils
2087 bug, I think. I updated the .10 release with this tiny fix, to
2096 bug, I think. I updated the .10 release with this tiny fix, to
2088 avoid annoying the lists further.
2097 avoid annoying the lists further.
2089
2098
2090 2005-01-27 *** Released version 0.6.10
2099 2005-01-27 *** Released version 0.6.10
2091
2100
2092 2005-01-27 Fernando Perez <fperez@colorado.edu>
2101 2005-01-27 Fernando Perez <fperez@colorado.edu>
2093
2102
2094 * IPython/numutils.py (norm): Added 'inf' as optional name for
2103 * IPython/numutils.py (norm): Added 'inf' as optional name for
2095 L-infinity norm, included references to mathworld.com for vector
2104 L-infinity norm, included references to mathworld.com for vector
2096 norm definitions.
2105 norm definitions.
2097 (amin/amax): added amin/amax for array min/max. Similar to what
2106 (amin/amax): added amin/amax for array min/max. Similar to what
2098 pylab ships with after the recent reorganization of names.
2107 pylab ships with after the recent reorganization of names.
2099 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2108 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2100
2109
2101 * ipython.el: committed Alex's recent fixes and improvements.
2110 * ipython.el: committed Alex's recent fixes and improvements.
2102 Tested with python-mode from CVS, and it looks excellent. Since
2111 Tested with python-mode from CVS, and it looks excellent. Since
2103 python-mode hasn't released anything in a while, I'm temporarily
2112 python-mode hasn't released anything in a while, I'm temporarily
2104 putting a copy of today's CVS (v 4.70) of python-mode in:
2113 putting a copy of today's CVS (v 4.70) of python-mode in:
2105 http://ipython.scipy.org/tmp/python-mode.el
2114 http://ipython.scipy.org/tmp/python-mode.el
2106
2115
2107 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2116 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2108 sys.executable for the executable name, instead of assuming it's
2117 sys.executable for the executable name, instead of assuming it's
2109 called 'python.exe' (the post-installer would have produced broken
2118 called 'python.exe' (the post-installer would have produced broken
2110 setups on systems with a differently named python binary).
2119 setups on systems with a differently named python binary).
2111
2120
2112 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2121 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2113 references to os.linesep, to make the code more
2122 references to os.linesep, to make the code more
2114 platform-independent. This is also part of the win32 coloring
2123 platform-independent. This is also part of the win32 coloring
2115 fixes.
2124 fixes.
2116
2125
2117 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2126 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2118 lines, which actually cause coloring bugs because the length of
2127 lines, which actually cause coloring bugs because the length of
2119 the line is very difficult to correctly compute with embedded
2128 the line is very difficult to correctly compute with embedded
2120 escapes. This was the source of all the coloring problems under
2129 escapes. This was the source of all the coloring problems under
2121 Win32. I think that _finally_, Win32 users have a properly
2130 Win32. I think that _finally_, Win32 users have a properly
2122 working ipython in all respects. This would never have happened
2131 working ipython in all respects. This would never have happened
2123 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2132 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2124
2133
2125 2005-01-26 *** Released version 0.6.9
2134 2005-01-26 *** Released version 0.6.9
2126
2135
2127 2005-01-25 Fernando Perez <fperez@colorado.edu>
2136 2005-01-25 Fernando Perez <fperez@colorado.edu>
2128
2137
2129 * setup.py: finally, we have a true Windows installer, thanks to
2138 * setup.py: finally, we have a true Windows installer, thanks to
2130 the excellent work of Viktor Ransmayr
2139 the excellent work of Viktor Ransmayr
2131 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2140 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2132 Windows users. The setup routine is quite a bit cleaner thanks to
2141 Windows users. The setup routine is quite a bit cleaner thanks to
2133 this, and the post-install script uses the proper functions to
2142 this, and the post-install script uses the proper functions to
2134 allow a clean de-installation using the standard Windows Control
2143 allow a clean de-installation using the standard Windows Control
2135 Panel.
2144 Panel.
2136
2145
2137 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2146 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2138 environment variable under all OSes (including win32) if
2147 environment variable under all OSes (including win32) if
2139 available. This will give consistency to win32 users who have set
2148 available. This will give consistency to win32 users who have set
2140 this variable for any reason. If os.environ['HOME'] fails, the
2149 this variable for any reason. If os.environ['HOME'] fails, the
2141 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2150 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2142
2151
2143 2005-01-24 Fernando Perez <fperez@colorado.edu>
2152 2005-01-24 Fernando Perez <fperez@colorado.edu>
2144
2153
2145 * IPython/numutils.py (empty_like): add empty_like(), similar to
2154 * IPython/numutils.py (empty_like): add empty_like(), similar to
2146 zeros_like() but taking advantage of the new empty() Numeric routine.
2155 zeros_like() but taking advantage of the new empty() Numeric routine.
2147
2156
2148 2005-01-23 *** Released version 0.6.8
2157 2005-01-23 *** Released version 0.6.8
2149
2158
2150 2005-01-22 Fernando Perez <fperez@colorado.edu>
2159 2005-01-22 Fernando Perez <fperez@colorado.edu>
2151
2160
2152 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2161 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2153 automatic show() calls. After discussing things with JDH, it
2162 automatic show() calls. After discussing things with JDH, it
2154 turns out there are too many corner cases where this can go wrong.
2163 turns out there are too many corner cases where this can go wrong.
2155 It's best not to try to be 'too smart', and simply have ipython
2164 It's best not to try to be 'too smart', and simply have ipython
2156 reproduce as much as possible the default behavior of a normal
2165 reproduce as much as possible the default behavior of a normal
2157 python shell.
2166 python shell.
2158
2167
2159 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2168 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2160 line-splitting regexp and _prefilter() to avoid calling getattr()
2169 line-splitting regexp and _prefilter() to avoid calling getattr()
2161 on assignments. This closes
2170 on assignments. This closes
2162 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2171 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2163 readline uses getattr(), so a simple <TAB> keypress is still
2172 readline uses getattr(), so a simple <TAB> keypress is still
2164 enough to trigger getattr() calls on an object.
2173 enough to trigger getattr() calls on an object.
2165
2174
2166 2005-01-21 Fernando Perez <fperez@colorado.edu>
2175 2005-01-21 Fernando Perez <fperez@colorado.edu>
2167
2176
2168 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2177 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2169 docstring under pylab so it doesn't mask the original.
2178 docstring under pylab so it doesn't mask the original.
2170
2179
2171 2005-01-21 *** Released version 0.6.7
2180 2005-01-21 *** Released version 0.6.7
2172
2181
2173 2005-01-21 Fernando Perez <fperez@colorado.edu>
2182 2005-01-21 Fernando Perez <fperez@colorado.edu>
2174
2183
2175 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2184 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2176 signal handling for win32 users in multithreaded mode.
2185 signal handling for win32 users in multithreaded mode.
2177
2186
2178 2005-01-17 Fernando Perez <fperez@colorado.edu>
2187 2005-01-17 Fernando Perez <fperez@colorado.edu>
2179
2188
2180 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2189 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2181 instances with no __init__. After a crash report by Norbert Nemec
2190 instances with no __init__. After a crash report by Norbert Nemec
2182 <Norbert-AT-nemec-online.de>.
2191 <Norbert-AT-nemec-online.de>.
2183
2192
2184 2005-01-14 Fernando Perez <fperez@colorado.edu>
2193 2005-01-14 Fernando Perez <fperez@colorado.edu>
2185
2194
2186 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2195 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2187 names for verbose exceptions, when multiple dotted names and the
2196 names for verbose exceptions, when multiple dotted names and the
2188 'parent' object were present on the same line.
2197 'parent' object were present on the same line.
2189
2198
2190 2005-01-11 Fernando Perez <fperez@colorado.edu>
2199 2005-01-11 Fernando Perez <fperez@colorado.edu>
2191
2200
2192 * IPython/genutils.py (flag_calls): new utility to trap and flag
2201 * IPython/genutils.py (flag_calls): new utility to trap and flag
2193 calls in functions. I need it to clean up matplotlib support.
2202 calls in functions. I need it to clean up matplotlib support.
2194 Also removed some deprecated code in genutils.
2203 Also removed some deprecated code in genutils.
2195
2204
2196 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2205 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2197 that matplotlib scripts called with %run, which don't call show()
2206 that matplotlib scripts called with %run, which don't call show()
2198 themselves, still have their plotting windows open.
2207 themselves, still have their plotting windows open.
2199
2208
2200 2005-01-05 Fernando Perez <fperez@colorado.edu>
2209 2005-01-05 Fernando Perez <fperez@colorado.edu>
2201
2210
2202 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2211 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2203 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2212 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2204
2213
2205 2004-12-19 Fernando Perez <fperez@colorado.edu>
2214 2004-12-19 Fernando Perez <fperez@colorado.edu>
2206
2215
2207 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2216 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2208 parent_runcode, which was an eyesore. The same result can be
2217 parent_runcode, which was an eyesore. The same result can be
2209 obtained with Python's regular superclass mechanisms.
2218 obtained with Python's regular superclass mechanisms.
2210
2219
2211 2004-12-17 Fernando Perez <fperez@colorado.edu>
2220 2004-12-17 Fernando Perez <fperez@colorado.edu>
2212
2221
2213 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2222 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2214 reported by Prabhu.
2223 reported by Prabhu.
2215 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2224 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2216 sys.stderr) instead of explicitly calling sys.stderr. This helps
2225 sys.stderr) instead of explicitly calling sys.stderr. This helps
2217 maintain our I/O abstractions clean, for future GUI embeddings.
2226 maintain our I/O abstractions clean, for future GUI embeddings.
2218
2227
2219 * IPython/genutils.py (info): added new utility for sys.stderr
2228 * IPython/genutils.py (info): added new utility for sys.stderr
2220 unified info message handling (thin wrapper around warn()).
2229 unified info message handling (thin wrapper around warn()).
2221
2230
2222 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2231 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2223 composite (dotted) names on verbose exceptions.
2232 composite (dotted) names on verbose exceptions.
2224 (VerboseTB.nullrepr): harden against another kind of errors which
2233 (VerboseTB.nullrepr): harden against another kind of errors which
2225 Python's inspect module can trigger, and which were crashing
2234 Python's inspect module can trigger, and which were crashing
2226 IPython. Thanks to a report by Marco Lombardi
2235 IPython. Thanks to a report by Marco Lombardi
2227 <mlombard-AT-ma010192.hq.eso.org>.
2236 <mlombard-AT-ma010192.hq.eso.org>.
2228
2237
2229 2004-12-13 *** Released version 0.6.6
2238 2004-12-13 *** Released version 0.6.6
2230
2239
2231 2004-12-12 Fernando Perez <fperez@colorado.edu>
2240 2004-12-12 Fernando Perez <fperez@colorado.edu>
2232
2241
2233 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2242 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2234 generated by pygtk upon initialization if it was built without
2243 generated by pygtk upon initialization if it was built without
2235 threads (for matplotlib users). After a crash reported by
2244 threads (for matplotlib users). After a crash reported by
2236 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2245 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2237
2246
2238 * IPython/ipmaker.py (make_IPython): fix small bug in the
2247 * IPython/ipmaker.py (make_IPython): fix small bug in the
2239 import_some parameter for multiple imports.
2248 import_some parameter for multiple imports.
2240
2249
2241 * IPython/iplib.py (ipmagic): simplified the interface of
2250 * IPython/iplib.py (ipmagic): simplified the interface of
2242 ipmagic() to take a single string argument, just as it would be
2251 ipmagic() to take a single string argument, just as it would be
2243 typed at the IPython cmd line.
2252 typed at the IPython cmd line.
2244 (ipalias): Added new ipalias() with an interface identical to
2253 (ipalias): Added new ipalias() with an interface identical to
2245 ipmagic(). This completes exposing a pure python interface to the
2254 ipmagic(). This completes exposing a pure python interface to the
2246 alias and magic system, which can be used in loops or more complex
2255 alias and magic system, which can be used in loops or more complex
2247 code where IPython's automatic line mangling is not active.
2256 code where IPython's automatic line mangling is not active.
2248
2257
2249 * IPython/genutils.py (timing): changed interface of timing to
2258 * IPython/genutils.py (timing): changed interface of timing to
2250 simply run code once, which is the most common case. timings()
2259 simply run code once, which is the most common case. timings()
2251 remains unchanged, for the cases where you want multiple runs.
2260 remains unchanged, for the cases where you want multiple runs.
2252
2261
2253 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2262 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2254 bug where Python2.2 crashes with exec'ing code which does not end
2263 bug where Python2.2 crashes with exec'ing code which does not end
2255 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2264 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2256 before.
2265 before.
2257
2266
2258 2004-12-10 Fernando Perez <fperez@colorado.edu>
2267 2004-12-10 Fernando Perez <fperez@colorado.edu>
2259
2268
2260 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2269 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2261 -t to -T, to accomodate the new -t flag in %run (the %run and
2270 -t to -T, to accomodate the new -t flag in %run (the %run and
2262 %prun options are kind of intermixed, and it's not easy to change
2271 %prun options are kind of intermixed, and it's not easy to change
2263 this with the limitations of python's getopt).
2272 this with the limitations of python's getopt).
2264
2273
2265 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2274 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2266 the execution of scripts. It's not as fine-tuned as timeit.py,
2275 the execution of scripts. It's not as fine-tuned as timeit.py,
2267 but it works from inside ipython (and under 2.2, which lacks
2276 but it works from inside ipython (and under 2.2, which lacks
2268 timeit.py). Optionally a number of runs > 1 can be given for
2277 timeit.py). Optionally a number of runs > 1 can be given for
2269 timing very short-running code.
2278 timing very short-running code.
2270
2279
2271 * IPython/genutils.py (uniq_stable): new routine which returns a
2280 * IPython/genutils.py (uniq_stable): new routine which returns a
2272 list of unique elements in any iterable, but in stable order of
2281 list of unique elements in any iterable, but in stable order of
2273 appearance. I needed this for the ultraTB fixes, and it's a handy
2282 appearance. I needed this for the ultraTB fixes, and it's a handy
2274 utility.
2283 utility.
2275
2284
2276 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2285 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2277 dotted names in Verbose exceptions. This had been broken since
2286 dotted names in Verbose exceptions. This had been broken since
2278 the very start, now x.y will properly be printed in a Verbose
2287 the very start, now x.y will properly be printed in a Verbose
2279 traceback, instead of x being shown and y appearing always as an
2288 traceback, instead of x being shown and y appearing always as an
2280 'undefined global'. Getting this to work was a bit tricky,
2289 'undefined global'. Getting this to work was a bit tricky,
2281 because by default python tokenizers are stateless. Saved by
2290 because by default python tokenizers are stateless. Saved by
2282 python's ability to easily add a bit of state to an arbitrary
2291 python's ability to easily add a bit of state to an arbitrary
2283 function (without needing to build a full-blown callable object).
2292 function (without needing to build a full-blown callable object).
2284
2293
2285 Also big cleanup of this code, which had horrendous runtime
2294 Also big cleanup of this code, which had horrendous runtime
2286 lookups of zillions of attributes for colorization. Moved all
2295 lookups of zillions of attributes for colorization. Moved all
2287 this code into a few templates, which make it cleaner and quicker.
2296 this code into a few templates, which make it cleaner and quicker.
2288
2297
2289 Printout quality was also improved for Verbose exceptions: one
2298 Printout quality was also improved for Verbose exceptions: one
2290 variable per line, and memory addresses are printed (this can be
2299 variable per line, and memory addresses are printed (this can be
2291 quite handy in nasty debugging situations, which is what Verbose
2300 quite handy in nasty debugging situations, which is what Verbose
2292 is for).
2301 is for).
2293
2302
2294 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2303 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2295 the command line as scripts to be loaded by embedded instances.
2304 the command line as scripts to be loaded by embedded instances.
2296 Doing so has the potential for an infinite recursion if there are
2305 Doing so has the potential for an infinite recursion if there are
2297 exceptions thrown in the process. This fixes a strange crash
2306 exceptions thrown in the process. This fixes a strange crash
2298 reported by Philippe MULLER <muller-AT-irit.fr>.
2307 reported by Philippe MULLER <muller-AT-irit.fr>.
2299
2308
2300 2004-12-09 Fernando Perez <fperez@colorado.edu>
2309 2004-12-09 Fernando Perez <fperez@colorado.edu>
2301
2310
2302 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2311 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2303 to reflect new names in matplotlib, which now expose the
2312 to reflect new names in matplotlib, which now expose the
2304 matlab-compatible interface via a pylab module instead of the
2313 matlab-compatible interface via a pylab module instead of the
2305 'matlab' name. The new code is backwards compatible, so users of
2314 'matlab' name. The new code is backwards compatible, so users of
2306 all matplotlib versions are OK. Patch by J. Hunter.
2315 all matplotlib versions are OK. Patch by J. Hunter.
2307
2316
2308 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2317 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2309 of __init__ docstrings for instances (class docstrings are already
2318 of __init__ docstrings for instances (class docstrings are already
2310 automatically printed). Instances with customized docstrings
2319 automatically printed). Instances with customized docstrings
2311 (indep. of the class) are also recognized and all 3 separate
2320 (indep. of the class) are also recognized and all 3 separate
2312 docstrings are printed (instance, class, constructor). After some
2321 docstrings are printed (instance, class, constructor). After some
2313 comments/suggestions by J. Hunter.
2322 comments/suggestions by J. Hunter.
2314
2323
2315 2004-12-05 Fernando Perez <fperez@colorado.edu>
2324 2004-12-05 Fernando Perez <fperez@colorado.edu>
2316
2325
2317 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2326 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2318 warnings when tab-completion fails and triggers an exception.
2327 warnings when tab-completion fails and triggers an exception.
2319
2328
2320 2004-12-03 Fernando Perez <fperez@colorado.edu>
2329 2004-12-03 Fernando Perez <fperez@colorado.edu>
2321
2330
2322 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2331 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2323 be triggered when using 'run -p'. An incorrect option flag was
2332 be triggered when using 'run -p'. An incorrect option flag was
2324 being set ('d' instead of 'D').
2333 being set ('d' instead of 'D').
2325 (manpage): fix missing escaped \- sign.
2334 (manpage): fix missing escaped \- sign.
2326
2335
2327 2004-11-30 *** Released version 0.6.5
2336 2004-11-30 *** Released version 0.6.5
2328
2337
2329 2004-11-30 Fernando Perez <fperez@colorado.edu>
2338 2004-11-30 Fernando Perez <fperez@colorado.edu>
2330
2339
2331 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2340 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2332 setting with -d option.
2341 setting with -d option.
2333
2342
2334 * setup.py (docfiles): Fix problem where the doc glob I was using
2343 * setup.py (docfiles): Fix problem where the doc glob I was using
2335 was COMPLETELY BROKEN. It was giving the right files by pure
2344 was COMPLETELY BROKEN. It was giving the right files by pure
2336 accident, but failed once I tried to include ipython.el. Note:
2345 accident, but failed once I tried to include ipython.el. Note:
2337 glob() does NOT allow you to do exclusion on multiple endings!
2346 glob() does NOT allow you to do exclusion on multiple endings!
2338
2347
2339 2004-11-29 Fernando Perez <fperez@colorado.edu>
2348 2004-11-29 Fernando Perez <fperez@colorado.edu>
2340
2349
2341 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2350 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2342 the manpage as the source. Better formatting & consistency.
2351 the manpage as the source. Better formatting & consistency.
2343
2352
2344 * IPython/Magic.py (magic_run): Added new -d option, to run
2353 * IPython/Magic.py (magic_run): Added new -d option, to run
2345 scripts under the control of the python pdb debugger. Note that
2354 scripts under the control of the python pdb debugger. Note that
2346 this required changing the %prun option -d to -D, to avoid a clash
2355 this required changing the %prun option -d to -D, to avoid a clash
2347 (since %run must pass options to %prun, and getopt is too dumb to
2356 (since %run must pass options to %prun, and getopt is too dumb to
2348 handle options with string values with embedded spaces). Thanks
2357 handle options with string values with embedded spaces). Thanks
2349 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2358 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2350 (magic_who_ls): added type matching to %who and %whos, so that one
2359 (magic_who_ls): added type matching to %who and %whos, so that one
2351 can filter their output to only include variables of certain
2360 can filter their output to only include variables of certain
2352 types. Another suggestion by Matthew.
2361 types. Another suggestion by Matthew.
2353 (magic_whos): Added memory summaries in kb and Mb for arrays.
2362 (magic_whos): Added memory summaries in kb and Mb for arrays.
2354 (magic_who): Improve formatting (break lines every 9 vars).
2363 (magic_who): Improve formatting (break lines every 9 vars).
2355
2364
2356 2004-11-28 Fernando Perez <fperez@colorado.edu>
2365 2004-11-28 Fernando Perez <fperez@colorado.edu>
2357
2366
2358 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2367 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2359 cache when empty lines were present.
2368 cache when empty lines were present.
2360
2369
2361 2004-11-24 Fernando Perez <fperez@colorado.edu>
2370 2004-11-24 Fernando Perez <fperez@colorado.edu>
2362
2371
2363 * IPython/usage.py (__doc__): document the re-activated threading
2372 * IPython/usage.py (__doc__): document the re-activated threading
2364 options for WX and GTK.
2373 options for WX and GTK.
2365
2374
2366 2004-11-23 Fernando Perez <fperez@colorado.edu>
2375 2004-11-23 Fernando Perez <fperez@colorado.edu>
2367
2376
2368 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2377 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2369 the -wthread and -gthread options, along with a new -tk one to try
2378 the -wthread and -gthread options, along with a new -tk one to try
2370 and coordinate Tk threading with wx/gtk. The tk support is very
2379 and coordinate Tk threading with wx/gtk. The tk support is very
2371 platform dependent, since it seems to require Tcl and Tk to be
2380 platform dependent, since it seems to require Tcl and Tk to be
2372 built with threads (Fedora1/2 appears NOT to have it, but in
2381 built with threads (Fedora1/2 appears NOT to have it, but in
2373 Prabhu's Debian boxes it works OK). But even with some Tk
2382 Prabhu's Debian boxes it works OK). But even with some Tk
2374 limitations, this is a great improvement.
2383 limitations, this is a great improvement.
2375
2384
2376 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2385 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2377 info in user prompts. Patch by Prabhu.
2386 info in user prompts. Patch by Prabhu.
2378
2387
2379 2004-11-18 Fernando Perez <fperez@colorado.edu>
2388 2004-11-18 Fernando Perez <fperez@colorado.edu>
2380
2389
2381 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2390 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2382 EOFErrors and bail, to avoid infinite loops if a non-terminating
2391 EOFErrors and bail, to avoid infinite loops if a non-terminating
2383 file is fed into ipython. Patch submitted in issue 19 by user,
2392 file is fed into ipython. Patch submitted in issue 19 by user,
2384 many thanks.
2393 many thanks.
2385
2394
2386 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2395 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2387 autoquote/parens in continuation prompts, which can cause lots of
2396 autoquote/parens in continuation prompts, which can cause lots of
2388 problems. Closes roundup issue 20.
2397 problems. Closes roundup issue 20.
2389
2398
2390 2004-11-17 Fernando Perez <fperez@colorado.edu>
2399 2004-11-17 Fernando Perez <fperez@colorado.edu>
2391
2400
2392 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2401 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2393 reported as debian bug #280505. I'm not sure my local changelog
2402 reported as debian bug #280505. I'm not sure my local changelog
2394 entry has the proper debian format (Jack?).
2403 entry has the proper debian format (Jack?).
2395
2404
2396 2004-11-08 *** Released version 0.6.4
2405 2004-11-08 *** Released version 0.6.4
2397
2406
2398 2004-11-08 Fernando Perez <fperez@colorado.edu>
2407 2004-11-08 Fernando Perez <fperez@colorado.edu>
2399
2408
2400 * IPython/iplib.py (init_readline): Fix exit message for Windows
2409 * IPython/iplib.py (init_readline): Fix exit message for Windows
2401 when readline is active. Thanks to a report by Eric Jones
2410 when readline is active. Thanks to a report by Eric Jones
2402 <eric-AT-enthought.com>.
2411 <eric-AT-enthought.com>.
2403
2412
2404 2004-11-07 Fernando Perez <fperez@colorado.edu>
2413 2004-11-07 Fernando Perez <fperez@colorado.edu>
2405
2414
2406 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2415 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2407 sometimes seen by win2k/cygwin users.
2416 sometimes seen by win2k/cygwin users.
2408
2417
2409 2004-11-06 Fernando Perez <fperez@colorado.edu>
2418 2004-11-06 Fernando Perez <fperez@colorado.edu>
2410
2419
2411 * IPython/iplib.py (interact): Change the handling of %Exit from
2420 * IPython/iplib.py (interact): Change the handling of %Exit from
2412 trying to propagate a SystemExit to an internal ipython flag.
2421 trying to propagate a SystemExit to an internal ipython flag.
2413 This is less elegant than using Python's exception mechanism, but
2422 This is less elegant than using Python's exception mechanism, but
2414 I can't get that to work reliably with threads, so under -pylab
2423 I can't get that to work reliably with threads, so under -pylab
2415 %Exit was hanging IPython. Cross-thread exception handling is
2424 %Exit was hanging IPython. Cross-thread exception handling is
2416 really a bitch. Thaks to a bug report by Stephen Walton
2425 really a bitch. Thaks to a bug report by Stephen Walton
2417 <stephen.walton-AT-csun.edu>.
2426 <stephen.walton-AT-csun.edu>.
2418
2427
2419 2004-11-04 Fernando Perez <fperez@colorado.edu>
2428 2004-11-04 Fernando Perez <fperez@colorado.edu>
2420
2429
2421 * IPython/iplib.py (raw_input_original): store a pointer to the
2430 * IPython/iplib.py (raw_input_original): store a pointer to the
2422 true raw_input to harden against code which can modify it
2431 true raw_input to harden against code which can modify it
2423 (wx.py.PyShell does this and would otherwise crash ipython).
2432 (wx.py.PyShell does this and would otherwise crash ipython).
2424 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2433 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2425
2434
2426 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2435 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2427 Ctrl-C problem, which does not mess up the input line.
2436 Ctrl-C problem, which does not mess up the input line.
2428
2437
2429 2004-11-03 Fernando Perez <fperez@colorado.edu>
2438 2004-11-03 Fernando Perez <fperez@colorado.edu>
2430
2439
2431 * IPython/Release.py: Changed licensing to BSD, in all files.
2440 * IPython/Release.py: Changed licensing to BSD, in all files.
2432 (name): lowercase name for tarball/RPM release.
2441 (name): lowercase name for tarball/RPM release.
2433
2442
2434 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2443 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2435 use throughout ipython.
2444 use throughout ipython.
2436
2445
2437 * IPython/Magic.py (Magic._ofind): Switch to using the new
2446 * IPython/Magic.py (Magic._ofind): Switch to using the new
2438 OInspect.getdoc() function.
2447 OInspect.getdoc() function.
2439
2448
2440 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2449 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2441 of the line currently being canceled via Ctrl-C. It's extremely
2450 of the line currently being canceled via Ctrl-C. It's extremely
2442 ugly, but I don't know how to do it better (the problem is one of
2451 ugly, but I don't know how to do it better (the problem is one of
2443 handling cross-thread exceptions).
2452 handling cross-thread exceptions).
2444
2453
2445 2004-10-28 Fernando Perez <fperez@colorado.edu>
2454 2004-10-28 Fernando Perez <fperez@colorado.edu>
2446
2455
2447 * IPython/Shell.py (signal_handler): add signal handlers to trap
2456 * IPython/Shell.py (signal_handler): add signal handlers to trap
2448 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2457 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2449 report by Francesc Alted.
2458 report by Francesc Alted.
2450
2459
2451 2004-10-21 Fernando Perez <fperez@colorado.edu>
2460 2004-10-21 Fernando Perez <fperez@colorado.edu>
2452
2461
2453 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2462 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2454 to % for pysh syntax extensions.
2463 to % for pysh syntax extensions.
2455
2464
2456 2004-10-09 Fernando Perez <fperez@colorado.edu>
2465 2004-10-09 Fernando Perez <fperez@colorado.edu>
2457
2466
2458 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2467 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2459 arrays to print a more useful summary, without calling str(arr).
2468 arrays to print a more useful summary, without calling str(arr).
2460 This avoids the problem of extremely lengthy computations which
2469 This avoids the problem of extremely lengthy computations which
2461 occur if arr is large, and appear to the user as a system lockup
2470 occur if arr is large, and appear to the user as a system lockup
2462 with 100% cpu activity. After a suggestion by Kristian Sandberg
2471 with 100% cpu activity. After a suggestion by Kristian Sandberg
2463 <Kristian.Sandberg@colorado.edu>.
2472 <Kristian.Sandberg@colorado.edu>.
2464 (Magic.__init__): fix bug in global magic escapes not being
2473 (Magic.__init__): fix bug in global magic escapes not being
2465 correctly set.
2474 correctly set.
2466
2475
2467 2004-10-08 Fernando Perez <fperez@colorado.edu>
2476 2004-10-08 Fernando Perez <fperez@colorado.edu>
2468
2477
2469 * IPython/Magic.py (__license__): change to absolute imports of
2478 * IPython/Magic.py (__license__): change to absolute imports of
2470 ipython's own internal packages, to start adapting to the absolute
2479 ipython's own internal packages, to start adapting to the absolute
2471 import requirement of PEP-328.
2480 import requirement of PEP-328.
2472
2481
2473 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2482 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2474 files, and standardize author/license marks through the Release
2483 files, and standardize author/license marks through the Release
2475 module instead of having per/file stuff (except for files with
2484 module instead of having per/file stuff (except for files with
2476 particular licenses, like the MIT/PSF-licensed codes).
2485 particular licenses, like the MIT/PSF-licensed codes).
2477
2486
2478 * IPython/Debugger.py: remove dead code for python 2.1
2487 * IPython/Debugger.py: remove dead code for python 2.1
2479
2488
2480 2004-10-04 Fernando Perez <fperez@colorado.edu>
2489 2004-10-04 Fernando Perez <fperez@colorado.edu>
2481
2490
2482 * IPython/iplib.py (ipmagic): New function for accessing magics
2491 * IPython/iplib.py (ipmagic): New function for accessing magics
2483 via a normal python function call.
2492 via a normal python function call.
2484
2493
2485 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2494 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2486 from '@' to '%', to accomodate the new @decorator syntax of python
2495 from '@' to '%', to accomodate the new @decorator syntax of python
2487 2.4.
2496 2.4.
2488
2497
2489 2004-09-29 Fernando Perez <fperez@colorado.edu>
2498 2004-09-29 Fernando Perez <fperez@colorado.edu>
2490
2499
2491 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2500 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2492 matplotlib.use to prevent running scripts which try to switch
2501 matplotlib.use to prevent running scripts which try to switch
2493 interactive backends from within ipython. This will just crash
2502 interactive backends from within ipython. This will just crash
2494 the python interpreter, so we can't allow it (but a detailed error
2503 the python interpreter, so we can't allow it (but a detailed error
2495 is given to the user).
2504 is given to the user).
2496
2505
2497 2004-09-28 Fernando Perez <fperez@colorado.edu>
2506 2004-09-28 Fernando Perez <fperez@colorado.edu>
2498
2507
2499 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2508 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2500 matplotlib-related fixes so that using @run with non-matplotlib
2509 matplotlib-related fixes so that using @run with non-matplotlib
2501 scripts doesn't pop up spurious plot windows. This requires
2510 scripts doesn't pop up spurious plot windows. This requires
2502 matplotlib >= 0.63, where I had to make some changes as well.
2511 matplotlib >= 0.63, where I had to make some changes as well.
2503
2512
2504 * IPython/ipmaker.py (make_IPython): update version requirement to
2513 * IPython/ipmaker.py (make_IPython): update version requirement to
2505 python 2.2.
2514 python 2.2.
2506
2515
2507 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2516 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2508 banner arg for embedded customization.
2517 banner arg for embedded customization.
2509
2518
2510 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2519 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2511 explicit uses of __IP as the IPython's instance name. Now things
2520 explicit uses of __IP as the IPython's instance name. Now things
2512 are properly handled via the shell.name value. The actual code
2521 are properly handled via the shell.name value. The actual code
2513 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2522 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2514 is much better than before. I'll clean things completely when the
2523 is much better than before. I'll clean things completely when the
2515 magic stuff gets a real overhaul.
2524 magic stuff gets a real overhaul.
2516
2525
2517 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2526 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2518 minor changes to debian dir.
2527 minor changes to debian dir.
2519
2528
2520 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2529 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2521 pointer to the shell itself in the interactive namespace even when
2530 pointer to the shell itself in the interactive namespace even when
2522 a user-supplied dict is provided. This is needed for embedding
2531 a user-supplied dict is provided. This is needed for embedding
2523 purposes (found by tests with Michel Sanner).
2532 purposes (found by tests with Michel Sanner).
2524
2533
2525 2004-09-27 Fernando Perez <fperez@colorado.edu>
2534 2004-09-27 Fernando Perez <fperez@colorado.edu>
2526
2535
2527 * IPython/UserConfig/ipythonrc: remove []{} from
2536 * IPython/UserConfig/ipythonrc: remove []{} from
2528 readline_remove_delims, so that things like [modname.<TAB> do
2537 readline_remove_delims, so that things like [modname.<TAB> do
2529 proper completion. This disables [].TAB, but that's a less common
2538 proper completion. This disables [].TAB, but that's a less common
2530 case than module names in list comprehensions, for example.
2539 case than module names in list comprehensions, for example.
2531 Thanks to a report by Andrea Riciputi.
2540 Thanks to a report by Andrea Riciputi.
2532
2541
2533 2004-09-09 Fernando Perez <fperez@colorado.edu>
2542 2004-09-09 Fernando Perez <fperez@colorado.edu>
2534
2543
2535 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2544 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2536 blocking problems in win32 and osx. Fix by John.
2545 blocking problems in win32 and osx. Fix by John.
2537
2546
2538 2004-09-08 Fernando Perez <fperez@colorado.edu>
2547 2004-09-08 Fernando Perez <fperez@colorado.edu>
2539
2548
2540 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2549 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2541 for Win32 and OSX. Fix by John Hunter.
2550 for Win32 and OSX. Fix by John Hunter.
2542
2551
2543 2004-08-30 *** Released version 0.6.3
2552 2004-08-30 *** Released version 0.6.3
2544
2553
2545 2004-08-30 Fernando Perez <fperez@colorado.edu>
2554 2004-08-30 Fernando Perez <fperez@colorado.edu>
2546
2555
2547 * setup.py (isfile): Add manpages to list of dependent files to be
2556 * setup.py (isfile): Add manpages to list of dependent files to be
2548 updated.
2557 updated.
2549
2558
2550 2004-08-27 Fernando Perez <fperez@colorado.edu>
2559 2004-08-27 Fernando Perez <fperez@colorado.edu>
2551
2560
2552 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2561 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2553 for now. They don't really work with standalone WX/GTK code
2562 for now. They don't really work with standalone WX/GTK code
2554 (though matplotlib IS working fine with both of those backends).
2563 (though matplotlib IS working fine with both of those backends).
2555 This will neeed much more testing. I disabled most things with
2564 This will neeed much more testing. I disabled most things with
2556 comments, so turning it back on later should be pretty easy.
2565 comments, so turning it back on later should be pretty easy.
2557
2566
2558 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2567 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2559 autocalling of expressions like r'foo', by modifying the line
2568 autocalling of expressions like r'foo', by modifying the line
2560 split regexp. Closes
2569 split regexp. Closes
2561 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2570 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2562 Riley <ipythonbugs-AT-sabi.net>.
2571 Riley <ipythonbugs-AT-sabi.net>.
2563 (InteractiveShell.mainloop): honor --nobanner with banner
2572 (InteractiveShell.mainloop): honor --nobanner with banner
2564 extensions.
2573 extensions.
2565
2574
2566 * IPython/Shell.py: Significant refactoring of all classes, so
2575 * IPython/Shell.py: Significant refactoring of all classes, so
2567 that we can really support ALL matplotlib backends and threading
2576 that we can really support ALL matplotlib backends and threading
2568 models (John spotted a bug with Tk which required this). Now we
2577 models (John spotted a bug with Tk which required this). Now we
2569 should support single-threaded, WX-threads and GTK-threads, both
2578 should support single-threaded, WX-threads and GTK-threads, both
2570 for generic code and for matplotlib.
2579 for generic code and for matplotlib.
2571
2580
2572 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2581 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2573 -pylab, to simplify things for users. Will also remove the pylab
2582 -pylab, to simplify things for users. Will also remove the pylab
2574 profile, since now all of matplotlib configuration is directly
2583 profile, since now all of matplotlib configuration is directly
2575 handled here. This also reduces startup time.
2584 handled here. This also reduces startup time.
2576
2585
2577 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2586 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2578 shell wasn't being correctly called. Also in IPShellWX.
2587 shell wasn't being correctly called. Also in IPShellWX.
2579
2588
2580 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2589 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2581 fine-tune banner.
2590 fine-tune banner.
2582
2591
2583 * IPython/numutils.py (spike): Deprecate these spike functions,
2592 * IPython/numutils.py (spike): Deprecate these spike functions,
2584 delete (long deprecated) gnuplot_exec handler.
2593 delete (long deprecated) gnuplot_exec handler.
2585
2594
2586 2004-08-26 Fernando Perez <fperez@colorado.edu>
2595 2004-08-26 Fernando Perez <fperez@colorado.edu>
2587
2596
2588 * ipython.1: Update for threading options, plus some others which
2597 * ipython.1: Update for threading options, plus some others which
2589 were missing.
2598 were missing.
2590
2599
2591 * IPython/ipmaker.py (__call__): Added -wthread option for
2600 * IPython/ipmaker.py (__call__): Added -wthread option for
2592 wxpython thread handling. Make sure threading options are only
2601 wxpython thread handling. Make sure threading options are only
2593 valid at the command line.
2602 valid at the command line.
2594
2603
2595 * scripts/ipython: moved shell selection into a factory function
2604 * scripts/ipython: moved shell selection into a factory function
2596 in Shell.py, to keep the starter script to a minimum.
2605 in Shell.py, to keep the starter script to a minimum.
2597
2606
2598 2004-08-25 Fernando Perez <fperez@colorado.edu>
2607 2004-08-25 Fernando Perez <fperez@colorado.edu>
2599
2608
2600 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2609 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2601 John. Along with some recent changes he made to matplotlib, the
2610 John. Along with some recent changes he made to matplotlib, the
2602 next versions of both systems should work very well together.
2611 next versions of both systems should work very well together.
2603
2612
2604 2004-08-24 Fernando Perez <fperez@colorado.edu>
2613 2004-08-24 Fernando Perez <fperez@colorado.edu>
2605
2614
2606 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2615 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2607 tried to switch the profiling to using hotshot, but I'm getting
2616 tried to switch the profiling to using hotshot, but I'm getting
2608 strange errors from prof.runctx() there. I may be misreading the
2617 strange errors from prof.runctx() there. I may be misreading the
2609 docs, but it looks weird. For now the profiling code will
2618 docs, but it looks weird. For now the profiling code will
2610 continue to use the standard profiler.
2619 continue to use the standard profiler.
2611
2620
2612 2004-08-23 Fernando Perez <fperez@colorado.edu>
2621 2004-08-23 Fernando Perez <fperez@colorado.edu>
2613
2622
2614 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2623 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2615 threaded shell, by John Hunter. It's not quite ready yet, but
2624 threaded shell, by John Hunter. It's not quite ready yet, but
2616 close.
2625 close.
2617
2626
2618 2004-08-22 Fernando Perez <fperez@colorado.edu>
2627 2004-08-22 Fernando Perez <fperez@colorado.edu>
2619
2628
2620 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2629 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2621 in Magic and ultraTB.
2630 in Magic and ultraTB.
2622
2631
2623 * ipython.1: document threading options in manpage.
2632 * ipython.1: document threading options in manpage.
2624
2633
2625 * scripts/ipython: Changed name of -thread option to -gthread,
2634 * scripts/ipython: Changed name of -thread option to -gthread,
2626 since this is GTK specific. I want to leave the door open for a
2635 since this is GTK specific. I want to leave the door open for a
2627 -wthread option for WX, which will most likely be necessary. This
2636 -wthread option for WX, which will most likely be necessary. This
2628 change affects usage and ipmaker as well.
2637 change affects usage and ipmaker as well.
2629
2638
2630 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2639 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2631 handle the matplotlib shell issues. Code by John Hunter
2640 handle the matplotlib shell issues. Code by John Hunter
2632 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2641 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2633 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2642 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2634 broken (and disabled for end users) for now, but it puts the
2643 broken (and disabled for end users) for now, but it puts the
2635 infrastructure in place.
2644 infrastructure in place.
2636
2645
2637 2004-08-21 Fernando Perez <fperez@colorado.edu>
2646 2004-08-21 Fernando Perez <fperez@colorado.edu>
2638
2647
2639 * ipythonrc-pylab: Add matplotlib support.
2648 * ipythonrc-pylab: Add matplotlib support.
2640
2649
2641 * matplotlib_config.py: new files for matplotlib support, part of
2650 * matplotlib_config.py: new files for matplotlib support, part of
2642 the pylab profile.
2651 the pylab profile.
2643
2652
2644 * IPython/usage.py (__doc__): documented the threading options.
2653 * IPython/usage.py (__doc__): documented the threading options.
2645
2654
2646 2004-08-20 Fernando Perez <fperez@colorado.edu>
2655 2004-08-20 Fernando Perez <fperez@colorado.edu>
2647
2656
2648 * ipython: Modified the main calling routine to handle the -thread
2657 * ipython: Modified the main calling routine to handle the -thread
2649 and -mpthread options. This needs to be done as a top-level hack,
2658 and -mpthread options. This needs to be done as a top-level hack,
2650 because it determines which class to instantiate for IPython
2659 because it determines which class to instantiate for IPython
2651 itself.
2660 itself.
2652
2661
2653 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2662 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2654 classes to support multithreaded GTK operation without blocking,
2663 classes to support multithreaded GTK operation without blocking,
2655 and matplotlib with all backends. This is a lot of still very
2664 and matplotlib with all backends. This is a lot of still very
2656 experimental code, and threads are tricky. So it may still have a
2665 experimental code, and threads are tricky. So it may still have a
2657 few rough edges... This code owes a lot to
2666 few rough edges... This code owes a lot to
2658 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2667 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2659 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2668 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2660 to John Hunter for all the matplotlib work.
2669 to John Hunter for all the matplotlib work.
2661
2670
2662 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2671 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2663 options for gtk thread and matplotlib support.
2672 options for gtk thread and matplotlib support.
2664
2673
2665 2004-08-16 Fernando Perez <fperez@colorado.edu>
2674 2004-08-16 Fernando Perez <fperez@colorado.edu>
2666
2675
2667 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2676 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2668 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2677 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2669 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2678 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2670
2679
2671 2004-08-11 Fernando Perez <fperez@colorado.edu>
2680 2004-08-11 Fernando Perez <fperez@colorado.edu>
2672
2681
2673 * setup.py (isfile): Fix build so documentation gets updated for
2682 * setup.py (isfile): Fix build so documentation gets updated for
2674 rpms (it was only done for .tgz builds).
2683 rpms (it was only done for .tgz builds).
2675
2684
2676 2004-08-10 Fernando Perez <fperez@colorado.edu>
2685 2004-08-10 Fernando Perez <fperez@colorado.edu>
2677
2686
2678 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2687 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2679
2688
2680 * iplib.py : Silence syntax error exceptions in tab-completion.
2689 * iplib.py : Silence syntax error exceptions in tab-completion.
2681
2690
2682 2004-08-05 Fernando Perez <fperez@colorado.edu>
2691 2004-08-05 Fernando Perez <fperez@colorado.edu>
2683
2692
2684 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2693 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2685 'color off' mark for continuation prompts. This was causing long
2694 'color off' mark for continuation prompts. This was causing long
2686 continuation lines to mis-wrap.
2695 continuation lines to mis-wrap.
2687
2696
2688 2004-08-01 Fernando Perez <fperez@colorado.edu>
2697 2004-08-01 Fernando Perez <fperez@colorado.edu>
2689
2698
2690 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2699 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2691 for building ipython to be a parameter. All this is necessary
2700 for building ipython to be a parameter. All this is necessary
2692 right now to have a multithreaded version, but this insane
2701 right now to have a multithreaded version, but this insane
2693 non-design will be cleaned up soon. For now, it's a hack that
2702 non-design will be cleaned up soon. For now, it's a hack that
2694 works.
2703 works.
2695
2704
2696 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2705 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2697 args in various places. No bugs so far, but it's a dangerous
2706 args in various places. No bugs so far, but it's a dangerous
2698 practice.
2707 practice.
2699
2708
2700 2004-07-31 Fernando Perez <fperez@colorado.edu>
2709 2004-07-31 Fernando Perez <fperez@colorado.edu>
2701
2710
2702 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2711 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2703 fix completion of files with dots in their names under most
2712 fix completion of files with dots in their names under most
2704 profiles (pysh was OK because the completion order is different).
2713 profiles (pysh was OK because the completion order is different).
2705
2714
2706 2004-07-27 Fernando Perez <fperez@colorado.edu>
2715 2004-07-27 Fernando Perez <fperez@colorado.edu>
2707
2716
2708 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2717 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2709 keywords manually, b/c the one in keyword.py was removed in python
2718 keywords manually, b/c the one in keyword.py was removed in python
2710 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2719 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2711 This is NOT a bug under python 2.3 and earlier.
2720 This is NOT a bug under python 2.3 and earlier.
2712
2721
2713 2004-07-26 Fernando Perez <fperez@colorado.edu>
2722 2004-07-26 Fernando Perez <fperez@colorado.edu>
2714
2723
2715 * IPython/ultraTB.py (VerboseTB.text): Add another
2724 * IPython/ultraTB.py (VerboseTB.text): Add another
2716 linecache.checkcache() call to try to prevent inspect.py from
2725 linecache.checkcache() call to try to prevent inspect.py from
2717 crashing under python 2.3. I think this fixes
2726 crashing under python 2.3. I think this fixes
2718 http://www.scipy.net/roundup/ipython/issue17.
2727 http://www.scipy.net/roundup/ipython/issue17.
2719
2728
2720 2004-07-26 *** Released version 0.6.2
2729 2004-07-26 *** Released version 0.6.2
2721
2730
2722 2004-07-26 Fernando Perez <fperez@colorado.edu>
2731 2004-07-26 Fernando Perez <fperez@colorado.edu>
2723
2732
2724 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2733 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2725 fail for any number.
2734 fail for any number.
2726 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2735 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2727 empty bookmarks.
2736 empty bookmarks.
2728
2737
2729 2004-07-26 *** Released version 0.6.1
2738 2004-07-26 *** Released version 0.6.1
2730
2739
2731 2004-07-26 Fernando Perez <fperez@colorado.edu>
2740 2004-07-26 Fernando Perez <fperez@colorado.edu>
2732
2741
2733 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2742 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2734
2743
2735 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2744 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2736 escaping '()[]{}' in filenames.
2745 escaping '()[]{}' in filenames.
2737
2746
2738 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2747 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2739 Python 2.2 users who lack a proper shlex.split.
2748 Python 2.2 users who lack a proper shlex.split.
2740
2749
2741 2004-07-19 Fernando Perez <fperez@colorado.edu>
2750 2004-07-19 Fernando Perez <fperez@colorado.edu>
2742
2751
2743 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2752 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2744 for reading readline's init file. I follow the normal chain:
2753 for reading readline's init file. I follow the normal chain:
2745 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2754 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2746 report by Mike Heeter. This closes
2755 report by Mike Heeter. This closes
2747 http://www.scipy.net/roundup/ipython/issue16.
2756 http://www.scipy.net/roundup/ipython/issue16.
2748
2757
2749 2004-07-18 Fernando Perez <fperez@colorado.edu>
2758 2004-07-18 Fernando Perez <fperez@colorado.edu>
2750
2759
2751 * IPython/iplib.py (__init__): Add better handling of '\' under
2760 * IPython/iplib.py (__init__): Add better handling of '\' under
2752 Win32 for filenames. After a patch by Ville.
2761 Win32 for filenames. After a patch by Ville.
2753
2762
2754 2004-07-17 Fernando Perez <fperez@colorado.edu>
2763 2004-07-17 Fernando Perez <fperez@colorado.edu>
2755
2764
2756 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2765 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2757 autocalling would be triggered for 'foo is bar' if foo is
2766 autocalling would be triggered for 'foo is bar' if foo is
2758 callable. I also cleaned up the autocall detection code to use a
2767 callable. I also cleaned up the autocall detection code to use a
2759 regexp, which is faster. Bug reported by Alexander Schmolck.
2768 regexp, which is faster. Bug reported by Alexander Schmolck.
2760
2769
2761 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2770 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2762 '?' in them would confuse the help system. Reported by Alex
2771 '?' in them would confuse the help system. Reported by Alex
2763 Schmolck.
2772 Schmolck.
2764
2773
2765 2004-07-16 Fernando Perez <fperez@colorado.edu>
2774 2004-07-16 Fernando Perez <fperez@colorado.edu>
2766
2775
2767 * IPython/GnuplotInteractive.py (__all__): added plot2.
2776 * IPython/GnuplotInteractive.py (__all__): added plot2.
2768
2777
2769 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2778 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2770 plotting dictionaries, lists or tuples of 1d arrays.
2779 plotting dictionaries, lists or tuples of 1d arrays.
2771
2780
2772 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2781 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2773 optimizations.
2782 optimizations.
2774
2783
2775 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2784 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2776 the information which was there from Janko's original IPP code:
2785 the information which was there from Janko's original IPP code:
2777
2786
2778 03.05.99 20:53 porto.ifm.uni-kiel.de
2787 03.05.99 20:53 porto.ifm.uni-kiel.de
2779 --Started changelog.
2788 --Started changelog.
2780 --make clear do what it say it does
2789 --make clear do what it say it does
2781 --added pretty output of lines from inputcache
2790 --added pretty output of lines from inputcache
2782 --Made Logger a mixin class, simplifies handling of switches
2791 --Made Logger a mixin class, simplifies handling of switches
2783 --Added own completer class. .string<TAB> expands to last history
2792 --Added own completer class. .string<TAB> expands to last history
2784 line which starts with string. The new expansion is also present
2793 line which starts with string. The new expansion is also present
2785 with Ctrl-r from the readline library. But this shows, who this
2794 with Ctrl-r from the readline library. But this shows, who this
2786 can be done for other cases.
2795 can be done for other cases.
2787 --Added convention that all shell functions should accept a
2796 --Added convention that all shell functions should accept a
2788 parameter_string This opens the door for different behaviour for
2797 parameter_string This opens the door for different behaviour for
2789 each function. @cd is a good example of this.
2798 each function. @cd is a good example of this.
2790
2799
2791 04.05.99 12:12 porto.ifm.uni-kiel.de
2800 04.05.99 12:12 porto.ifm.uni-kiel.de
2792 --added logfile rotation
2801 --added logfile rotation
2793 --added new mainloop method which freezes first the namespace
2802 --added new mainloop method which freezes first the namespace
2794
2803
2795 07.05.99 21:24 porto.ifm.uni-kiel.de
2804 07.05.99 21:24 porto.ifm.uni-kiel.de
2796 --added the docreader classes. Now there is a help system.
2805 --added the docreader classes. Now there is a help system.
2797 -This is only a first try. Currently it's not easy to put new
2806 -This is only a first try. Currently it's not easy to put new
2798 stuff in the indices. But this is the way to go. Info would be
2807 stuff in the indices. But this is the way to go. Info would be
2799 better, but HTML is every where and not everybody has an info
2808 better, but HTML is every where and not everybody has an info
2800 system installed and it's not so easy to change html-docs to info.
2809 system installed and it's not so easy to change html-docs to info.
2801 --added global logfile option
2810 --added global logfile option
2802 --there is now a hook for object inspection method pinfo needs to
2811 --there is now a hook for object inspection method pinfo needs to
2803 be provided for this. Can be reached by two '??'.
2812 be provided for this. Can be reached by two '??'.
2804
2813
2805 08.05.99 20:51 porto.ifm.uni-kiel.de
2814 08.05.99 20:51 porto.ifm.uni-kiel.de
2806 --added a README
2815 --added a README
2807 --bug in rc file. Something has changed so functions in the rc
2816 --bug in rc file. Something has changed so functions in the rc
2808 file need to reference the shell and not self. Not clear if it's a
2817 file need to reference the shell and not self. Not clear if it's a
2809 bug or feature.
2818 bug or feature.
2810 --changed rc file for new behavior
2819 --changed rc file for new behavior
2811
2820
2812 2004-07-15 Fernando Perez <fperez@colorado.edu>
2821 2004-07-15 Fernando Perez <fperez@colorado.edu>
2813
2822
2814 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2823 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2815 cache was falling out of sync in bizarre manners when multi-line
2824 cache was falling out of sync in bizarre manners when multi-line
2816 input was present. Minor optimizations and cleanup.
2825 input was present. Minor optimizations and cleanup.
2817
2826
2818 (Logger): Remove old Changelog info for cleanup. This is the
2827 (Logger): Remove old Changelog info for cleanup. This is the
2819 information which was there from Janko's original code:
2828 information which was there from Janko's original code:
2820
2829
2821 Changes to Logger: - made the default log filename a parameter
2830 Changes to Logger: - made the default log filename a parameter
2822
2831
2823 - put a check for lines beginning with !@? in log(). Needed
2832 - put a check for lines beginning with !@? in log(). Needed
2824 (even if the handlers properly log their lines) for mid-session
2833 (even if the handlers properly log their lines) for mid-session
2825 logging activation to work properly. Without this, lines logged
2834 logging activation to work properly. Without this, lines logged
2826 in mid session, which get read from the cache, would end up
2835 in mid session, which get read from the cache, would end up
2827 'bare' (with !@? in the open) in the log. Now they are caught
2836 'bare' (with !@? in the open) in the log. Now they are caught
2828 and prepended with a #.
2837 and prepended with a #.
2829
2838
2830 * IPython/iplib.py (InteractiveShell.init_readline): added check
2839 * IPython/iplib.py (InteractiveShell.init_readline): added check
2831 in case MagicCompleter fails to be defined, so we don't crash.
2840 in case MagicCompleter fails to be defined, so we don't crash.
2832
2841
2833 2004-07-13 Fernando Perez <fperez@colorado.edu>
2842 2004-07-13 Fernando Perez <fperez@colorado.edu>
2834
2843
2835 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2844 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2836 of EPS if the requested filename ends in '.eps'.
2845 of EPS if the requested filename ends in '.eps'.
2837
2846
2838 2004-07-04 Fernando Perez <fperez@colorado.edu>
2847 2004-07-04 Fernando Perez <fperez@colorado.edu>
2839
2848
2840 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2849 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2841 escaping of quotes when calling the shell.
2850 escaping of quotes when calling the shell.
2842
2851
2843 2004-07-02 Fernando Perez <fperez@colorado.edu>
2852 2004-07-02 Fernando Perez <fperez@colorado.edu>
2844
2853
2845 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2854 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2846 gettext not working because we were clobbering '_'. Fixes
2855 gettext not working because we were clobbering '_'. Fixes
2847 http://www.scipy.net/roundup/ipython/issue6.
2856 http://www.scipy.net/roundup/ipython/issue6.
2848
2857
2849 2004-07-01 Fernando Perez <fperez@colorado.edu>
2858 2004-07-01 Fernando Perez <fperez@colorado.edu>
2850
2859
2851 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2860 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2852 into @cd. Patch by Ville.
2861 into @cd. Patch by Ville.
2853
2862
2854 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2863 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2855 new function to store things after ipmaker runs. Patch by Ville.
2864 new function to store things after ipmaker runs. Patch by Ville.
2856 Eventually this will go away once ipmaker is removed and the class
2865 Eventually this will go away once ipmaker is removed and the class
2857 gets cleaned up, but for now it's ok. Key functionality here is
2866 gets cleaned up, but for now it's ok. Key functionality here is
2858 the addition of the persistent storage mechanism, a dict for
2867 the addition of the persistent storage mechanism, a dict for
2859 keeping data across sessions (for now just bookmarks, but more can
2868 keeping data across sessions (for now just bookmarks, but more can
2860 be implemented later).
2869 be implemented later).
2861
2870
2862 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2871 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2863 persistent across sections. Patch by Ville, I modified it
2872 persistent across sections. Patch by Ville, I modified it
2864 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2873 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2865 added a '-l' option to list all bookmarks.
2874 added a '-l' option to list all bookmarks.
2866
2875
2867 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2876 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2868 center for cleanup. Registered with atexit.register(). I moved
2877 center for cleanup. Registered with atexit.register(). I moved
2869 here the old exit_cleanup(). After a patch by Ville.
2878 here the old exit_cleanup(). After a patch by Ville.
2870
2879
2871 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2880 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2872 characters in the hacked shlex_split for python 2.2.
2881 characters in the hacked shlex_split for python 2.2.
2873
2882
2874 * IPython/iplib.py (file_matches): more fixes to filenames with
2883 * IPython/iplib.py (file_matches): more fixes to filenames with
2875 whitespace in them. It's not perfect, but limitations in python's
2884 whitespace in them. It's not perfect, but limitations in python's
2876 readline make it impossible to go further.
2885 readline make it impossible to go further.
2877
2886
2878 2004-06-29 Fernando Perez <fperez@colorado.edu>
2887 2004-06-29 Fernando Perez <fperez@colorado.edu>
2879
2888
2880 * IPython/iplib.py (file_matches): escape whitespace correctly in
2889 * IPython/iplib.py (file_matches): escape whitespace correctly in
2881 filename completions. Bug reported by Ville.
2890 filename completions. Bug reported by Ville.
2882
2891
2883 2004-06-28 Fernando Perez <fperez@colorado.edu>
2892 2004-06-28 Fernando Perez <fperez@colorado.edu>
2884
2893
2885 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2894 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2886 the history file will be called 'history-PROFNAME' (or just
2895 the history file will be called 'history-PROFNAME' (or just
2887 'history' if no profile is loaded). I was getting annoyed at
2896 'history' if no profile is loaded). I was getting annoyed at
2888 getting my Numerical work history clobbered by pysh sessions.
2897 getting my Numerical work history clobbered by pysh sessions.
2889
2898
2890 * IPython/iplib.py (InteractiveShell.__init__): Internal
2899 * IPython/iplib.py (InteractiveShell.__init__): Internal
2891 getoutputerror() function so that we can honor the system_verbose
2900 getoutputerror() function so that we can honor the system_verbose
2892 flag for _all_ system calls. I also added escaping of #
2901 flag for _all_ system calls. I also added escaping of #
2893 characters here to avoid confusing Itpl.
2902 characters here to avoid confusing Itpl.
2894
2903
2895 * IPython/Magic.py (shlex_split): removed call to shell in
2904 * IPython/Magic.py (shlex_split): removed call to shell in
2896 parse_options and replaced it with shlex.split(). The annoying
2905 parse_options and replaced it with shlex.split(). The annoying
2897 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2906 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2898 to backport it from 2.3, with several frail hacks (the shlex
2907 to backport it from 2.3, with several frail hacks (the shlex
2899 module is rather limited in 2.2). Thanks to a suggestion by Ville
2908 module is rather limited in 2.2). Thanks to a suggestion by Ville
2900 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2909 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2901 problem.
2910 problem.
2902
2911
2903 (Magic.magic_system_verbose): new toggle to print the actual
2912 (Magic.magic_system_verbose): new toggle to print the actual
2904 system calls made by ipython. Mainly for debugging purposes.
2913 system calls made by ipython. Mainly for debugging purposes.
2905
2914
2906 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2915 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2907 doesn't support persistence. Reported (and fix suggested) by
2916 doesn't support persistence. Reported (and fix suggested) by
2908 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2917 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2909
2918
2910 2004-06-26 Fernando Perez <fperez@colorado.edu>
2919 2004-06-26 Fernando Perez <fperez@colorado.edu>
2911
2920
2912 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2921 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2913 continue prompts.
2922 continue prompts.
2914
2923
2915 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2924 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2916 function (basically a big docstring) and a few more things here to
2925 function (basically a big docstring) and a few more things here to
2917 speedup startup. pysh.py is now very lightweight. We want because
2926 speedup startup. pysh.py is now very lightweight. We want because
2918 it gets execfile'd, while InterpreterExec gets imported, so
2927 it gets execfile'd, while InterpreterExec gets imported, so
2919 byte-compilation saves time.
2928 byte-compilation saves time.
2920
2929
2921 2004-06-25 Fernando Perez <fperez@colorado.edu>
2930 2004-06-25 Fernando Perez <fperez@colorado.edu>
2922
2931
2923 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2932 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2924 -NUM', which was recently broken.
2933 -NUM', which was recently broken.
2925
2934
2926 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2935 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2927 in multi-line input (but not !!, which doesn't make sense there).
2936 in multi-line input (but not !!, which doesn't make sense there).
2928
2937
2929 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2938 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2930 It's just too useful, and people can turn it off in the less
2939 It's just too useful, and people can turn it off in the less
2931 common cases where it's a problem.
2940 common cases where it's a problem.
2932
2941
2933 2004-06-24 Fernando Perez <fperez@colorado.edu>
2942 2004-06-24 Fernando Perez <fperez@colorado.edu>
2934
2943
2935 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2944 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2936 special syntaxes (like alias calling) is now allied in multi-line
2945 special syntaxes (like alias calling) is now allied in multi-line
2937 input. This is still _very_ experimental, but it's necessary for
2946 input. This is still _very_ experimental, but it's necessary for
2938 efficient shell usage combining python looping syntax with system
2947 efficient shell usage combining python looping syntax with system
2939 calls. For now it's restricted to aliases, I don't think it
2948 calls. For now it's restricted to aliases, I don't think it
2940 really even makes sense to have this for magics.
2949 really even makes sense to have this for magics.
2941
2950
2942 2004-06-23 Fernando Perez <fperez@colorado.edu>
2951 2004-06-23 Fernando Perez <fperez@colorado.edu>
2943
2952
2944 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2953 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2945 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2954 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2946
2955
2947 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2956 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2948 extensions under Windows (after code sent by Gary Bishop). The
2957 extensions under Windows (after code sent by Gary Bishop). The
2949 extensions considered 'executable' are stored in IPython's rc
2958 extensions considered 'executable' are stored in IPython's rc
2950 structure as win_exec_ext.
2959 structure as win_exec_ext.
2951
2960
2952 * IPython/genutils.py (shell): new function, like system() but
2961 * IPython/genutils.py (shell): new function, like system() but
2953 without return value. Very useful for interactive shell work.
2962 without return value. Very useful for interactive shell work.
2954
2963
2955 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2964 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2956 delete aliases.
2965 delete aliases.
2957
2966
2958 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2967 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2959 sure that the alias table doesn't contain python keywords.
2968 sure that the alias table doesn't contain python keywords.
2960
2969
2961 2004-06-21 Fernando Perez <fperez@colorado.edu>
2970 2004-06-21 Fernando Perez <fperez@colorado.edu>
2962
2971
2963 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2972 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2964 non-existent items are found in $PATH. Reported by Thorsten.
2973 non-existent items are found in $PATH. Reported by Thorsten.
2965
2974
2966 2004-06-20 Fernando Perez <fperez@colorado.edu>
2975 2004-06-20 Fernando Perez <fperez@colorado.edu>
2967
2976
2968 * IPython/iplib.py (complete): modified the completer so that the
2977 * IPython/iplib.py (complete): modified the completer so that the
2969 order of priorities can be easily changed at runtime.
2978 order of priorities can be easily changed at runtime.
2970
2979
2971 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2980 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2972 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2981 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2973
2982
2974 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2983 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2975 expand Python variables prepended with $ in all system calls. The
2984 expand Python variables prepended with $ in all system calls. The
2976 same was done to InteractiveShell.handle_shell_escape. Now all
2985 same was done to InteractiveShell.handle_shell_escape. Now all
2977 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2986 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2978 expansion of python variables and expressions according to the
2987 expansion of python variables and expressions according to the
2979 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2988 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2980
2989
2981 Though PEP-215 has been rejected, a similar (but simpler) one
2990 Though PEP-215 has been rejected, a similar (but simpler) one
2982 seems like it will go into Python 2.4, PEP-292 -
2991 seems like it will go into Python 2.4, PEP-292 -
2983 http://www.python.org/peps/pep-0292.html.
2992 http://www.python.org/peps/pep-0292.html.
2984
2993
2985 I'll keep the full syntax of PEP-215, since IPython has since the
2994 I'll keep the full syntax of PEP-215, since IPython has since the
2986 start used Ka-Ping Yee's reference implementation discussed there
2995 start used Ka-Ping Yee's reference implementation discussed there
2987 (Itpl), and I actually like the powerful semantics it offers.
2996 (Itpl), and I actually like the powerful semantics it offers.
2988
2997
2989 In order to access normal shell variables, the $ has to be escaped
2998 In order to access normal shell variables, the $ has to be escaped
2990 via an extra $. For example:
2999 via an extra $. For example:
2991
3000
2992 In [7]: PATH='a python variable'
3001 In [7]: PATH='a python variable'
2993
3002
2994 In [8]: !echo $PATH
3003 In [8]: !echo $PATH
2995 a python variable
3004 a python variable
2996
3005
2997 In [9]: !echo $$PATH
3006 In [9]: !echo $$PATH
2998 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3007 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2999
3008
3000 (Magic.parse_options): escape $ so the shell doesn't evaluate
3009 (Magic.parse_options): escape $ so the shell doesn't evaluate
3001 things prematurely.
3010 things prematurely.
3002
3011
3003 * IPython/iplib.py (InteractiveShell.call_alias): added the
3012 * IPython/iplib.py (InteractiveShell.call_alias): added the
3004 ability for aliases to expand python variables via $.
3013 ability for aliases to expand python variables via $.
3005
3014
3006 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3015 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3007 system, now there's a @rehash/@rehashx pair of magics. These work
3016 system, now there's a @rehash/@rehashx pair of magics. These work
3008 like the csh rehash command, and can be invoked at any time. They
3017 like the csh rehash command, and can be invoked at any time. They
3009 build a table of aliases to everything in the user's $PATH
3018 build a table of aliases to everything in the user's $PATH
3010 (@rehash uses everything, @rehashx is slower but only adds
3019 (@rehash uses everything, @rehashx is slower but only adds
3011 executable files). With this, the pysh.py-based shell profile can
3020 executable files). With this, the pysh.py-based shell profile can
3012 now simply call rehash upon startup, and full access to all
3021 now simply call rehash upon startup, and full access to all
3013 programs in the user's path is obtained.
3022 programs in the user's path is obtained.
3014
3023
3015 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3024 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3016 functionality is now fully in place. I removed the old dynamic
3025 functionality is now fully in place. I removed the old dynamic
3017 code generation based approach, in favor of a much lighter one
3026 code generation based approach, in favor of a much lighter one
3018 based on a simple dict. The advantage is that this allows me to
3027 based on a simple dict. The advantage is that this allows me to
3019 now have thousands of aliases with negligible cost (unthinkable
3028 now have thousands of aliases with negligible cost (unthinkable
3020 with the old system).
3029 with the old system).
3021
3030
3022 2004-06-19 Fernando Perez <fperez@colorado.edu>
3031 2004-06-19 Fernando Perez <fperez@colorado.edu>
3023
3032
3024 * IPython/iplib.py (__init__): extended MagicCompleter class to
3033 * IPython/iplib.py (__init__): extended MagicCompleter class to
3025 also complete (last in priority) on user aliases.
3034 also complete (last in priority) on user aliases.
3026
3035
3027 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3036 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3028 call to eval.
3037 call to eval.
3029 (ItplNS.__init__): Added a new class which functions like Itpl,
3038 (ItplNS.__init__): Added a new class which functions like Itpl,
3030 but allows configuring the namespace for the evaluation to occur
3039 but allows configuring the namespace for the evaluation to occur
3031 in.
3040 in.
3032
3041
3033 2004-06-18 Fernando Perez <fperez@colorado.edu>
3042 2004-06-18 Fernando Perez <fperez@colorado.edu>
3034
3043
3035 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3044 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3036 better message when 'exit' or 'quit' are typed (a common newbie
3045 better message when 'exit' or 'quit' are typed (a common newbie
3037 confusion).
3046 confusion).
3038
3047
3039 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3048 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3040 check for Windows users.
3049 check for Windows users.
3041
3050
3042 * IPython/iplib.py (InteractiveShell.user_setup): removed
3051 * IPython/iplib.py (InteractiveShell.user_setup): removed
3043 disabling of colors for Windows. I'll test at runtime and issue a
3052 disabling of colors for Windows. I'll test at runtime and issue a
3044 warning if Gary's readline isn't found, as to nudge users to
3053 warning if Gary's readline isn't found, as to nudge users to
3045 download it.
3054 download it.
3046
3055
3047 2004-06-16 Fernando Perez <fperez@colorado.edu>
3056 2004-06-16 Fernando Perez <fperez@colorado.edu>
3048
3057
3049 * IPython/genutils.py (Stream.__init__): changed to print errors
3058 * IPython/genutils.py (Stream.__init__): changed to print errors
3050 to sys.stderr. I had a circular dependency here. Now it's
3059 to sys.stderr. I had a circular dependency here. Now it's
3051 possible to run ipython as IDLE's shell (consider this pre-alpha,
3060 possible to run ipython as IDLE's shell (consider this pre-alpha,
3052 since true stdout things end up in the starting terminal instead
3061 since true stdout things end up in the starting terminal instead
3053 of IDLE's out).
3062 of IDLE's out).
3054
3063
3055 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3064 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3056 users who haven't # updated their prompt_in2 definitions. Remove
3065 users who haven't # updated their prompt_in2 definitions. Remove
3057 eventually.
3066 eventually.
3058 (multiple_replace): added credit to original ASPN recipe.
3067 (multiple_replace): added credit to original ASPN recipe.
3059
3068
3060 2004-06-15 Fernando Perez <fperez@colorado.edu>
3069 2004-06-15 Fernando Perez <fperez@colorado.edu>
3061
3070
3062 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3071 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3063 list of auto-defined aliases.
3072 list of auto-defined aliases.
3064
3073
3065 2004-06-13 Fernando Perez <fperez@colorado.edu>
3074 2004-06-13 Fernando Perez <fperez@colorado.edu>
3066
3075
3067 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3076 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3068 install was really requested (so setup.py can be used for other
3077 install was really requested (so setup.py can be used for other
3069 things under Windows).
3078 things under Windows).
3070
3079
3071 2004-06-10 Fernando Perez <fperez@colorado.edu>
3080 2004-06-10 Fernando Perez <fperez@colorado.edu>
3072
3081
3073 * IPython/Logger.py (Logger.create_log): Manually remove any old
3082 * IPython/Logger.py (Logger.create_log): Manually remove any old
3074 backup, since os.remove may fail under Windows. Fixes bug
3083 backup, since os.remove may fail under Windows. Fixes bug
3075 reported by Thorsten.
3084 reported by Thorsten.
3076
3085
3077 2004-06-09 Fernando Perez <fperez@colorado.edu>
3086 2004-06-09 Fernando Perez <fperez@colorado.edu>
3078
3087
3079 * examples/example-embed.py: fixed all references to %n (replaced
3088 * examples/example-embed.py: fixed all references to %n (replaced
3080 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3089 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3081 for all examples and the manual as well.
3090 for all examples and the manual as well.
3082
3091
3083 2004-06-08 Fernando Perez <fperez@colorado.edu>
3092 2004-06-08 Fernando Perez <fperez@colorado.edu>
3084
3093
3085 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3094 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3086 alignment and color management. All 3 prompt subsystems now
3095 alignment and color management. All 3 prompt subsystems now
3087 inherit from BasePrompt.
3096 inherit from BasePrompt.
3088
3097
3089 * tools/release: updates for windows installer build and tag rpms
3098 * tools/release: updates for windows installer build and tag rpms
3090 with python version (since paths are fixed).
3099 with python version (since paths are fixed).
3091
3100
3092 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3101 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3093 which will become eventually obsolete. Also fixed the default
3102 which will become eventually obsolete. Also fixed the default
3094 prompt_in2 to use \D, so at least new users start with the correct
3103 prompt_in2 to use \D, so at least new users start with the correct
3095 defaults.
3104 defaults.
3096 WARNING: Users with existing ipythonrc files will need to apply
3105 WARNING: Users with existing ipythonrc files will need to apply
3097 this fix manually!
3106 this fix manually!
3098
3107
3099 * setup.py: make windows installer (.exe). This is finally the
3108 * setup.py: make windows installer (.exe). This is finally the
3100 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3109 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3101 which I hadn't included because it required Python 2.3 (or recent
3110 which I hadn't included because it required Python 2.3 (or recent
3102 distutils).
3111 distutils).
3103
3112
3104 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3113 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3105 usage of new '\D' escape.
3114 usage of new '\D' escape.
3106
3115
3107 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3116 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3108 lacks os.getuid())
3117 lacks os.getuid())
3109 (CachedOutput.set_colors): Added the ability to turn coloring
3118 (CachedOutput.set_colors): Added the ability to turn coloring
3110 on/off with @colors even for manually defined prompt colors. It
3119 on/off with @colors even for manually defined prompt colors. It
3111 uses a nasty global, but it works safely and via the generic color
3120 uses a nasty global, but it works safely and via the generic color
3112 handling mechanism.
3121 handling mechanism.
3113 (Prompt2.__init__): Introduced new escape '\D' for continuation
3122 (Prompt2.__init__): Introduced new escape '\D' for continuation
3114 prompts. It represents the counter ('\#') as dots.
3123 prompts. It represents the counter ('\#') as dots.
3115 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3124 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3116 need to update their ipythonrc files and replace '%n' with '\D' in
3125 need to update their ipythonrc files and replace '%n' with '\D' in
3117 their prompt_in2 settings everywhere. Sorry, but there's
3126 their prompt_in2 settings everywhere. Sorry, but there's
3118 otherwise no clean way to get all prompts to properly align. The
3127 otherwise no clean way to get all prompts to properly align. The
3119 ipythonrc shipped with IPython has been updated.
3128 ipythonrc shipped with IPython has been updated.
3120
3129
3121 2004-06-07 Fernando Perez <fperez@colorado.edu>
3130 2004-06-07 Fernando Perez <fperez@colorado.edu>
3122
3131
3123 * setup.py (isfile): Pass local_icons option to latex2html, so the
3132 * setup.py (isfile): Pass local_icons option to latex2html, so the
3124 resulting HTML file is self-contained. Thanks to
3133 resulting HTML file is self-contained. Thanks to
3125 dryice-AT-liu.com.cn for the tip.
3134 dryice-AT-liu.com.cn for the tip.
3126
3135
3127 * pysh.py: I created a new profile 'shell', which implements a
3136 * pysh.py: I created a new profile 'shell', which implements a
3128 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3137 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3129 system shell, nor will it become one anytime soon. It's mainly
3138 system shell, nor will it become one anytime soon. It's mainly
3130 meant to illustrate the use of the new flexible bash-like prompts.
3139 meant to illustrate the use of the new flexible bash-like prompts.
3131 I guess it could be used by hardy souls for true shell management,
3140 I guess it could be used by hardy souls for true shell management,
3132 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3141 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3133 profile. This uses the InterpreterExec extension provided by
3142 profile. This uses the InterpreterExec extension provided by
3134 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3143 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3135
3144
3136 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3145 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3137 auto-align itself with the length of the previous input prompt
3146 auto-align itself with the length of the previous input prompt
3138 (taking into account the invisible color escapes).
3147 (taking into account the invisible color escapes).
3139 (CachedOutput.__init__): Large restructuring of this class. Now
3148 (CachedOutput.__init__): Large restructuring of this class. Now
3140 all three prompts (primary1, primary2, output) are proper objects,
3149 all three prompts (primary1, primary2, output) are proper objects,
3141 managed by the 'parent' CachedOutput class. The code is still a
3150 managed by the 'parent' CachedOutput class. The code is still a
3142 bit hackish (all prompts share state via a pointer to the cache),
3151 bit hackish (all prompts share state via a pointer to the cache),
3143 but it's overall far cleaner than before.
3152 but it's overall far cleaner than before.
3144
3153
3145 * IPython/genutils.py (getoutputerror): modified to add verbose,
3154 * IPython/genutils.py (getoutputerror): modified to add verbose,
3146 debug and header options. This makes the interface of all getout*
3155 debug and header options. This makes the interface of all getout*
3147 functions uniform.
3156 functions uniform.
3148 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3157 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3149
3158
3150 * IPython/Magic.py (Magic.default_option): added a function to
3159 * IPython/Magic.py (Magic.default_option): added a function to
3151 allow registering default options for any magic command. This
3160 allow registering default options for any magic command. This
3152 makes it easy to have profiles which customize the magics globally
3161 makes it easy to have profiles which customize the magics globally
3153 for a certain use. The values set through this function are
3162 for a certain use. The values set through this function are
3154 picked up by the parse_options() method, which all magics should
3163 picked up by the parse_options() method, which all magics should
3155 use to parse their options.
3164 use to parse their options.
3156
3165
3157 * IPython/genutils.py (warn): modified the warnings framework to
3166 * IPython/genutils.py (warn): modified the warnings framework to
3158 use the Term I/O class. I'm trying to slowly unify all of
3167 use the Term I/O class. I'm trying to slowly unify all of
3159 IPython's I/O operations to pass through Term.
3168 IPython's I/O operations to pass through Term.
3160
3169
3161 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3170 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3162 the secondary prompt to correctly match the length of the primary
3171 the secondary prompt to correctly match the length of the primary
3163 one for any prompt. Now multi-line code will properly line up
3172 one for any prompt. Now multi-line code will properly line up
3164 even for path dependent prompts, such as the new ones available
3173 even for path dependent prompts, such as the new ones available
3165 via the prompt_specials.
3174 via the prompt_specials.
3166
3175
3167 2004-06-06 Fernando Perez <fperez@colorado.edu>
3176 2004-06-06 Fernando Perez <fperez@colorado.edu>
3168
3177
3169 * IPython/Prompts.py (prompt_specials): Added the ability to have
3178 * IPython/Prompts.py (prompt_specials): Added the ability to have
3170 bash-like special sequences in the prompts, which get
3179 bash-like special sequences in the prompts, which get
3171 automatically expanded. Things like hostname, current working
3180 automatically expanded. Things like hostname, current working
3172 directory and username are implemented already, but it's easy to
3181 directory and username are implemented already, but it's easy to
3173 add more in the future. Thanks to a patch by W.J. van der Laan
3182 add more in the future. Thanks to a patch by W.J. van der Laan
3174 <gnufnork-AT-hetdigitalegat.nl>
3183 <gnufnork-AT-hetdigitalegat.nl>
3175 (prompt_specials): Added color support for prompt strings, so
3184 (prompt_specials): Added color support for prompt strings, so
3176 users can define arbitrary color setups for their prompts.
3185 users can define arbitrary color setups for their prompts.
3177
3186
3178 2004-06-05 Fernando Perez <fperez@colorado.edu>
3187 2004-06-05 Fernando Perez <fperez@colorado.edu>
3179
3188
3180 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3189 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3181 code to load Gary Bishop's readline and configure it
3190 code to load Gary Bishop's readline and configure it
3182 automatically. Thanks to Gary for help on this.
3191 automatically. Thanks to Gary for help on this.
3183
3192
3184 2004-06-01 Fernando Perez <fperez@colorado.edu>
3193 2004-06-01 Fernando Perez <fperez@colorado.edu>
3185
3194
3186 * IPython/Logger.py (Logger.create_log): fix bug for logging
3195 * IPython/Logger.py (Logger.create_log): fix bug for logging
3187 with no filename (previous fix was incomplete).
3196 with no filename (previous fix was incomplete).
3188
3197
3189 2004-05-25 Fernando Perez <fperez@colorado.edu>
3198 2004-05-25 Fernando Perez <fperez@colorado.edu>
3190
3199
3191 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3200 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3192 parens would get passed to the shell.
3201 parens would get passed to the shell.
3193
3202
3194 2004-05-20 Fernando Perez <fperez@colorado.edu>
3203 2004-05-20 Fernando Perez <fperez@colorado.edu>
3195
3204
3196 * IPython/Magic.py (Magic.magic_prun): changed default profile
3205 * IPython/Magic.py (Magic.magic_prun): changed default profile
3197 sort order to 'time' (the more common profiling need).
3206 sort order to 'time' (the more common profiling need).
3198
3207
3199 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3208 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3200 so that source code shown is guaranteed in sync with the file on
3209 so that source code shown is guaranteed in sync with the file on
3201 disk (also changed in psource). Similar fix to the one for
3210 disk (also changed in psource). Similar fix to the one for
3202 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3211 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3203 <yann.ledu-AT-noos.fr>.
3212 <yann.ledu-AT-noos.fr>.
3204
3213
3205 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3214 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3206 with a single option would not be correctly parsed. Closes
3215 with a single option would not be correctly parsed. Closes
3207 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3216 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3208 introduced in 0.6.0 (on 2004-05-06).
3217 introduced in 0.6.0 (on 2004-05-06).
3209
3218
3210 2004-05-13 *** Released version 0.6.0
3219 2004-05-13 *** Released version 0.6.0
3211
3220
3212 2004-05-13 Fernando Perez <fperez@colorado.edu>
3221 2004-05-13 Fernando Perez <fperez@colorado.edu>
3213
3222
3214 * debian/: Added debian/ directory to CVS, so that debian support
3223 * debian/: Added debian/ directory to CVS, so that debian support
3215 is publicly accessible. The debian package is maintained by Jack
3224 is publicly accessible. The debian package is maintained by Jack
3216 Moffit <jack-AT-xiph.org>.
3225 Moffit <jack-AT-xiph.org>.
3217
3226
3218 * Documentation: included the notes about an ipython-based system
3227 * Documentation: included the notes about an ipython-based system
3219 shell (the hypothetical 'pysh') into the new_design.pdf document,
3228 shell (the hypothetical 'pysh') into the new_design.pdf document,
3220 so that these ideas get distributed to users along with the
3229 so that these ideas get distributed to users along with the
3221 official documentation.
3230 official documentation.
3222
3231
3223 2004-05-10 Fernando Perez <fperez@colorado.edu>
3232 2004-05-10 Fernando Perez <fperez@colorado.edu>
3224
3233
3225 * IPython/Logger.py (Logger.create_log): fix recently introduced
3234 * IPython/Logger.py (Logger.create_log): fix recently introduced
3226 bug (misindented line) where logstart would fail when not given an
3235 bug (misindented line) where logstart would fail when not given an
3227 explicit filename.
3236 explicit filename.
3228
3237
3229 2004-05-09 Fernando Perez <fperez@colorado.edu>
3238 2004-05-09 Fernando Perez <fperez@colorado.edu>
3230
3239
3231 * IPython/Magic.py (Magic.parse_options): skip system call when
3240 * IPython/Magic.py (Magic.parse_options): skip system call when
3232 there are no options to look for. Faster, cleaner for the common
3241 there are no options to look for. Faster, cleaner for the common
3233 case.
3242 case.
3234
3243
3235 * Documentation: many updates to the manual: describing Windows
3244 * Documentation: many updates to the manual: describing Windows
3236 support better, Gnuplot updates, credits, misc small stuff. Also
3245 support better, Gnuplot updates, credits, misc small stuff. Also
3237 updated the new_design doc a bit.
3246 updated the new_design doc a bit.
3238
3247
3239 2004-05-06 *** Released version 0.6.0.rc1
3248 2004-05-06 *** Released version 0.6.0.rc1
3240
3249
3241 2004-05-06 Fernando Perez <fperez@colorado.edu>
3250 2004-05-06 Fernando Perez <fperez@colorado.edu>
3242
3251
3243 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3252 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3244 operations to use the vastly more efficient list/''.join() method.
3253 operations to use the vastly more efficient list/''.join() method.
3245 (FormattedTB.text): Fix
3254 (FormattedTB.text): Fix
3246 http://www.scipy.net/roundup/ipython/issue12 - exception source
3255 http://www.scipy.net/roundup/ipython/issue12 - exception source
3247 extract not updated after reload. Thanks to Mike Salib
3256 extract not updated after reload. Thanks to Mike Salib
3248 <msalib-AT-mit.edu> for pinning the source of the problem.
3257 <msalib-AT-mit.edu> for pinning the source of the problem.
3249 Fortunately, the solution works inside ipython and doesn't require
3258 Fortunately, the solution works inside ipython and doesn't require
3250 any changes to python proper.
3259 any changes to python proper.
3251
3260
3252 * IPython/Magic.py (Magic.parse_options): Improved to process the
3261 * IPython/Magic.py (Magic.parse_options): Improved to process the
3253 argument list as a true shell would (by actually using the
3262 argument list as a true shell would (by actually using the
3254 underlying system shell). This way, all @magics automatically get
3263 underlying system shell). This way, all @magics automatically get
3255 shell expansion for variables. Thanks to a comment by Alex
3264 shell expansion for variables. Thanks to a comment by Alex
3256 Schmolck.
3265 Schmolck.
3257
3266
3258 2004-04-04 Fernando Perez <fperez@colorado.edu>
3267 2004-04-04 Fernando Perez <fperez@colorado.edu>
3259
3268
3260 * IPython/iplib.py (InteractiveShell.interact): Added a special
3269 * IPython/iplib.py (InteractiveShell.interact): Added a special
3261 trap for a debugger quit exception, which is basically impossible
3270 trap for a debugger quit exception, which is basically impossible
3262 to handle by normal mechanisms, given what pdb does to the stack.
3271 to handle by normal mechanisms, given what pdb does to the stack.
3263 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3272 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3264
3273
3265 2004-04-03 Fernando Perez <fperez@colorado.edu>
3274 2004-04-03 Fernando Perez <fperez@colorado.edu>
3266
3275
3267 * IPython/genutils.py (Term): Standardized the names of the Term
3276 * IPython/genutils.py (Term): Standardized the names of the Term
3268 class streams to cin/cout/cerr, following C++ naming conventions
3277 class streams to cin/cout/cerr, following C++ naming conventions
3269 (I can't use in/out/err because 'in' is not a valid attribute
3278 (I can't use in/out/err because 'in' is not a valid attribute
3270 name).
3279 name).
3271
3280
3272 * IPython/iplib.py (InteractiveShell.interact): don't increment
3281 * IPython/iplib.py (InteractiveShell.interact): don't increment
3273 the prompt if there's no user input. By Daniel 'Dang' Griffith
3282 the prompt if there's no user input. By Daniel 'Dang' Griffith
3274 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3283 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3275 Francois Pinard.
3284 Francois Pinard.
3276
3285
3277 2004-04-02 Fernando Perez <fperez@colorado.edu>
3286 2004-04-02 Fernando Perez <fperez@colorado.edu>
3278
3287
3279 * IPython/genutils.py (Stream.__init__): Modified to survive at
3288 * IPython/genutils.py (Stream.__init__): Modified to survive at
3280 least importing in contexts where stdin/out/err aren't true file
3289 least importing in contexts where stdin/out/err aren't true file
3281 objects, such as PyCrust (they lack fileno() and mode). However,
3290 objects, such as PyCrust (they lack fileno() and mode). However,
3282 the recovery facilities which rely on these things existing will
3291 the recovery facilities which rely on these things existing will
3283 not work.
3292 not work.
3284
3293
3285 2004-04-01 Fernando Perez <fperez@colorado.edu>
3294 2004-04-01 Fernando Perez <fperez@colorado.edu>
3286
3295
3287 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3296 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3288 use the new getoutputerror() function, so it properly
3297 use the new getoutputerror() function, so it properly
3289 distinguishes stdout/err.
3298 distinguishes stdout/err.
3290
3299
3291 * IPython/genutils.py (getoutputerror): added a function to
3300 * IPython/genutils.py (getoutputerror): added a function to
3292 capture separately the standard output and error of a command.
3301 capture separately the standard output and error of a command.
3293 After a comment from dang on the mailing lists. This code is
3302 After a comment from dang on the mailing lists. This code is
3294 basically a modified version of commands.getstatusoutput(), from
3303 basically a modified version of commands.getstatusoutput(), from
3295 the standard library.
3304 the standard library.
3296
3305
3297 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3306 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3298 '!!' as a special syntax (shorthand) to access @sx.
3307 '!!' as a special syntax (shorthand) to access @sx.
3299
3308
3300 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3309 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3301 command and return its output as a list split on '\n'.
3310 command and return its output as a list split on '\n'.
3302
3311
3303 2004-03-31 Fernando Perez <fperez@colorado.edu>
3312 2004-03-31 Fernando Perez <fperez@colorado.edu>
3304
3313
3305 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3314 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3306 method to dictionaries used as FakeModule instances if they lack
3315 method to dictionaries used as FakeModule instances if they lack
3307 it. At least pydoc in python2.3 breaks for runtime-defined
3316 it. At least pydoc in python2.3 breaks for runtime-defined
3308 functions without this hack. At some point I need to _really_
3317 functions without this hack. At some point I need to _really_
3309 understand what FakeModule is doing, because it's a gross hack.
3318 understand what FakeModule is doing, because it's a gross hack.
3310 But it solves Arnd's problem for now...
3319 But it solves Arnd's problem for now...
3311
3320
3312 2004-02-27 Fernando Perez <fperez@colorado.edu>
3321 2004-02-27 Fernando Perez <fperez@colorado.edu>
3313
3322
3314 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3323 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3315 mode would behave erratically. Also increased the number of
3324 mode would behave erratically. Also increased the number of
3316 possible logs in rotate mod to 999. Thanks to Rod Holland
3325 possible logs in rotate mod to 999. Thanks to Rod Holland
3317 <rhh@StructureLABS.com> for the report and fixes.
3326 <rhh@StructureLABS.com> for the report and fixes.
3318
3327
3319 2004-02-26 Fernando Perez <fperez@colorado.edu>
3328 2004-02-26 Fernando Perez <fperez@colorado.edu>
3320
3329
3321 * IPython/genutils.py (page): Check that the curses module really
3330 * IPython/genutils.py (page): Check that the curses module really
3322 has the initscr attribute before trying to use it. For some
3331 has the initscr attribute before trying to use it. For some
3323 reason, the Solaris curses module is missing this. I think this
3332 reason, the Solaris curses module is missing this. I think this
3324 should be considered a Solaris python bug, but I'm not sure.
3333 should be considered a Solaris python bug, but I'm not sure.
3325
3334
3326 2004-01-17 Fernando Perez <fperez@colorado.edu>
3335 2004-01-17 Fernando Perez <fperez@colorado.edu>
3327
3336
3328 * IPython/genutils.py (Stream.__init__): Changes to try to make
3337 * IPython/genutils.py (Stream.__init__): Changes to try to make
3329 ipython robust against stdin/out/err being closed by the user.
3338 ipython robust against stdin/out/err being closed by the user.
3330 This is 'user error' (and blocks a normal python session, at least
3339 This is 'user error' (and blocks a normal python session, at least
3331 the stdout case). However, Ipython should be able to survive such
3340 the stdout case). However, Ipython should be able to survive such
3332 instances of abuse as gracefully as possible. To simplify the
3341 instances of abuse as gracefully as possible. To simplify the
3333 coding and maintain compatibility with Gary Bishop's Term
3342 coding and maintain compatibility with Gary Bishop's Term
3334 contributions, I've made use of classmethods for this. I think
3343 contributions, I've made use of classmethods for this. I think
3335 this introduces a dependency on python 2.2.
3344 this introduces a dependency on python 2.2.
3336
3345
3337 2004-01-13 Fernando Perez <fperez@colorado.edu>
3346 2004-01-13 Fernando Perez <fperez@colorado.edu>
3338
3347
3339 * IPython/numutils.py (exp_safe): simplified the code a bit and
3348 * IPython/numutils.py (exp_safe): simplified the code a bit and
3340 removed the need for importing the kinds module altogether.
3349 removed the need for importing the kinds module altogether.
3341
3350
3342 2004-01-06 Fernando Perez <fperez@colorado.edu>
3351 2004-01-06 Fernando Perez <fperez@colorado.edu>
3343
3352
3344 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3353 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3345 a magic function instead, after some community feedback. No
3354 a magic function instead, after some community feedback. No
3346 special syntax will exist for it, but its name is deliberately
3355 special syntax will exist for it, but its name is deliberately
3347 very short.
3356 very short.
3348
3357
3349 2003-12-20 Fernando Perez <fperez@colorado.edu>
3358 2003-12-20 Fernando Perez <fperez@colorado.edu>
3350
3359
3351 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3360 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3352 new functionality, to automagically assign the result of a shell
3361 new functionality, to automagically assign the result of a shell
3353 command to a variable. I'll solicit some community feedback on
3362 command to a variable. I'll solicit some community feedback on
3354 this before making it permanent.
3363 this before making it permanent.
3355
3364
3356 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3365 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3357 requested about callables for which inspect couldn't obtain a
3366 requested about callables for which inspect couldn't obtain a
3358 proper argspec. Thanks to a crash report sent by Etienne
3367 proper argspec. Thanks to a crash report sent by Etienne
3359 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3368 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3360
3369
3361 2003-12-09 Fernando Perez <fperez@colorado.edu>
3370 2003-12-09 Fernando Perez <fperez@colorado.edu>
3362
3371
3363 * IPython/genutils.py (page): patch for the pager to work across
3372 * IPython/genutils.py (page): patch for the pager to work across
3364 various versions of Windows. By Gary Bishop.
3373 various versions of Windows. By Gary Bishop.
3365
3374
3366 2003-12-04 Fernando Perez <fperez@colorado.edu>
3375 2003-12-04 Fernando Perez <fperez@colorado.edu>
3367
3376
3368 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3377 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3369 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3378 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3370 While I tested this and it looks ok, there may still be corner
3379 While I tested this and it looks ok, there may still be corner
3371 cases I've missed.
3380 cases I've missed.
3372
3381
3373 2003-12-01 Fernando Perez <fperez@colorado.edu>
3382 2003-12-01 Fernando Perez <fperez@colorado.edu>
3374
3383
3375 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3384 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3376 where a line like 'p,q=1,2' would fail because the automagic
3385 where a line like 'p,q=1,2' would fail because the automagic
3377 system would be triggered for @p.
3386 system would be triggered for @p.
3378
3387
3379 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3388 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3380 cleanups, code unmodified.
3389 cleanups, code unmodified.
3381
3390
3382 * IPython/genutils.py (Term): added a class for IPython to handle
3391 * IPython/genutils.py (Term): added a class for IPython to handle
3383 output. In most cases it will just be a proxy for stdout/err, but
3392 output. In most cases it will just be a proxy for stdout/err, but
3384 having this allows modifications to be made for some platforms,
3393 having this allows modifications to be made for some platforms,
3385 such as handling color escapes under Windows. All of this code
3394 such as handling color escapes under Windows. All of this code
3386 was contributed by Gary Bishop, with minor modifications by me.
3395 was contributed by Gary Bishop, with minor modifications by me.
3387 The actual changes affect many files.
3396 The actual changes affect many files.
3388
3397
3389 2003-11-30 Fernando Perez <fperez@colorado.edu>
3398 2003-11-30 Fernando Perez <fperez@colorado.edu>
3390
3399
3391 * IPython/iplib.py (file_matches): new completion code, courtesy
3400 * IPython/iplib.py (file_matches): new completion code, courtesy
3392 of Jeff Collins. This enables filename completion again under
3401 of Jeff Collins. This enables filename completion again under
3393 python 2.3, which disabled it at the C level.
3402 python 2.3, which disabled it at the C level.
3394
3403
3395 2003-11-11 Fernando Perez <fperez@colorado.edu>
3404 2003-11-11 Fernando Perez <fperez@colorado.edu>
3396
3405
3397 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3406 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3398 for Numeric.array(map(...)), but often convenient.
3407 for Numeric.array(map(...)), but often convenient.
3399
3408
3400 2003-11-05 Fernando Perez <fperez@colorado.edu>
3409 2003-11-05 Fernando Perez <fperez@colorado.edu>
3401
3410
3402 * IPython/numutils.py (frange): Changed a call from int() to
3411 * IPython/numutils.py (frange): Changed a call from int() to
3403 int(round()) to prevent a problem reported with arange() in the
3412 int(round()) to prevent a problem reported with arange() in the
3404 numpy list.
3413 numpy list.
3405
3414
3406 2003-10-06 Fernando Perez <fperez@colorado.edu>
3415 2003-10-06 Fernando Perez <fperez@colorado.edu>
3407
3416
3408 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3417 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3409 prevent crashes if sys lacks an argv attribute (it happens with
3418 prevent crashes if sys lacks an argv attribute (it happens with
3410 embedded interpreters which build a bare-bones sys module).
3419 embedded interpreters which build a bare-bones sys module).
3411 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3420 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3412
3421
3413 2003-09-24 Fernando Perez <fperez@colorado.edu>
3422 2003-09-24 Fernando Perez <fperez@colorado.edu>
3414
3423
3415 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3424 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3416 to protect against poorly written user objects where __getattr__
3425 to protect against poorly written user objects where __getattr__
3417 raises exceptions other than AttributeError. Thanks to a bug
3426 raises exceptions other than AttributeError. Thanks to a bug
3418 report by Oliver Sander <osander-AT-gmx.de>.
3427 report by Oliver Sander <osander-AT-gmx.de>.
3419
3428
3420 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3429 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3421 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3430 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3422
3431
3423 2003-09-09 Fernando Perez <fperez@colorado.edu>
3432 2003-09-09 Fernando Perez <fperez@colorado.edu>
3424
3433
3425 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3434 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3426 unpacking a list whith a callable as first element would
3435 unpacking a list whith a callable as first element would
3427 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3436 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3428 Collins.
3437 Collins.
3429
3438
3430 2003-08-25 *** Released version 0.5.0
3439 2003-08-25 *** Released version 0.5.0
3431
3440
3432 2003-08-22 Fernando Perez <fperez@colorado.edu>
3441 2003-08-22 Fernando Perez <fperez@colorado.edu>
3433
3442
3434 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3443 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3435 improperly defined user exceptions. Thanks to feedback from Mark
3444 improperly defined user exceptions. Thanks to feedback from Mark
3436 Russell <mrussell-AT-verio.net>.
3445 Russell <mrussell-AT-verio.net>.
3437
3446
3438 2003-08-20 Fernando Perez <fperez@colorado.edu>
3447 2003-08-20 Fernando Perez <fperez@colorado.edu>
3439
3448
3440 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3449 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3441 printing so that it would print multi-line string forms starting
3450 printing so that it would print multi-line string forms starting
3442 with a new line. This way the formatting is better respected for
3451 with a new line. This way the formatting is better respected for
3443 objects which work hard to make nice string forms.
3452 objects which work hard to make nice string forms.
3444
3453
3445 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3454 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3446 autocall would overtake data access for objects with both
3455 autocall would overtake data access for objects with both
3447 __getitem__ and __call__.
3456 __getitem__ and __call__.
3448
3457
3449 2003-08-19 *** Released version 0.5.0-rc1
3458 2003-08-19 *** Released version 0.5.0-rc1
3450
3459
3451 2003-08-19 Fernando Perez <fperez@colorado.edu>
3460 2003-08-19 Fernando Perez <fperez@colorado.edu>
3452
3461
3453 * IPython/deep_reload.py (load_tail): single tiny change here
3462 * IPython/deep_reload.py (load_tail): single tiny change here
3454 seems to fix the long-standing bug of dreload() failing to work
3463 seems to fix the long-standing bug of dreload() failing to work
3455 for dotted names. But this module is pretty tricky, so I may have
3464 for dotted names. But this module is pretty tricky, so I may have
3456 missed some subtlety. Needs more testing!.
3465 missed some subtlety. Needs more testing!.
3457
3466
3458 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3467 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3459 exceptions which have badly implemented __str__ methods.
3468 exceptions which have badly implemented __str__ methods.
3460 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3469 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3461 which I've been getting reports about from Python 2.3 users. I
3470 which I've been getting reports about from Python 2.3 users. I
3462 wish I had a simple test case to reproduce the problem, so I could
3471 wish I had a simple test case to reproduce the problem, so I could
3463 either write a cleaner workaround or file a bug report if
3472 either write a cleaner workaround or file a bug report if
3464 necessary.
3473 necessary.
3465
3474
3466 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3475 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3467 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3476 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3468 a bug report by Tjabo Kloppenburg.
3477 a bug report by Tjabo Kloppenburg.
3469
3478
3470 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3479 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3471 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3480 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3472 seems rather unstable. Thanks to a bug report by Tjabo
3481 seems rather unstable. Thanks to a bug report by Tjabo
3473 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3482 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3474
3483
3475 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3484 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3476 this out soon because of the critical fixes in the inner loop for
3485 this out soon because of the critical fixes in the inner loop for
3477 generators.
3486 generators.
3478
3487
3479 * IPython/Magic.py (Magic.getargspec): removed. This (and
3488 * IPython/Magic.py (Magic.getargspec): removed. This (and
3480 _get_def) have been obsoleted by OInspect for a long time, I
3489 _get_def) have been obsoleted by OInspect for a long time, I
3481 hadn't noticed that they were dead code.
3490 hadn't noticed that they were dead code.
3482 (Magic._ofind): restored _ofind functionality for a few literals
3491 (Magic._ofind): restored _ofind functionality for a few literals
3483 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3492 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3484 for things like "hello".capitalize?, since that would require a
3493 for things like "hello".capitalize?, since that would require a
3485 potentially dangerous eval() again.
3494 potentially dangerous eval() again.
3486
3495
3487 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3496 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3488 logic a bit more to clean up the escapes handling and minimize the
3497 logic a bit more to clean up the escapes handling and minimize the
3489 use of _ofind to only necessary cases. The interactive 'feel' of
3498 use of _ofind to only necessary cases. The interactive 'feel' of
3490 IPython should have improved quite a bit with the changes in
3499 IPython should have improved quite a bit with the changes in
3491 _prefilter and _ofind (besides being far safer than before).
3500 _prefilter and _ofind (besides being far safer than before).
3492
3501
3493 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3502 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3494 obscure, never reported). Edit would fail to find the object to
3503 obscure, never reported). Edit would fail to find the object to
3495 edit under some circumstances.
3504 edit under some circumstances.
3496 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3505 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3497 which were causing double-calling of generators. Those eval calls
3506 which were causing double-calling of generators. Those eval calls
3498 were _very_ dangerous, since code with side effects could be
3507 were _very_ dangerous, since code with side effects could be
3499 triggered. As they say, 'eval is evil'... These were the
3508 triggered. As they say, 'eval is evil'... These were the
3500 nastiest evals in IPython. Besides, _ofind is now far simpler,
3509 nastiest evals in IPython. Besides, _ofind is now far simpler,
3501 and it should also be quite a bit faster. Its use of inspect is
3510 and it should also be quite a bit faster. Its use of inspect is
3502 also safer, so perhaps some of the inspect-related crashes I've
3511 also safer, so perhaps some of the inspect-related crashes I've
3503 seen lately with Python 2.3 might be taken care of. That will
3512 seen lately with Python 2.3 might be taken care of. That will
3504 need more testing.
3513 need more testing.
3505
3514
3506 2003-08-17 Fernando Perez <fperez@colorado.edu>
3515 2003-08-17 Fernando Perez <fperez@colorado.edu>
3507
3516
3508 * IPython/iplib.py (InteractiveShell._prefilter): significant
3517 * IPython/iplib.py (InteractiveShell._prefilter): significant
3509 simplifications to the logic for handling user escapes. Faster
3518 simplifications to the logic for handling user escapes. Faster
3510 and simpler code.
3519 and simpler code.
3511
3520
3512 2003-08-14 Fernando Perez <fperez@colorado.edu>
3521 2003-08-14 Fernando Perez <fperez@colorado.edu>
3513
3522
3514 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3523 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3515 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3524 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3516 but it should be quite a bit faster. And the recursive version
3525 but it should be quite a bit faster. And the recursive version
3517 generated O(log N) intermediate storage for all rank>1 arrays,
3526 generated O(log N) intermediate storage for all rank>1 arrays,
3518 even if they were contiguous.
3527 even if they were contiguous.
3519 (l1norm): Added this function.
3528 (l1norm): Added this function.
3520 (norm): Added this function for arbitrary norms (including
3529 (norm): Added this function for arbitrary norms (including
3521 l-infinity). l1 and l2 are still special cases for convenience
3530 l-infinity). l1 and l2 are still special cases for convenience
3522 and speed.
3531 and speed.
3523
3532
3524 2003-08-03 Fernando Perez <fperez@colorado.edu>
3533 2003-08-03 Fernando Perez <fperez@colorado.edu>
3525
3534
3526 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3535 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3527 exceptions, which now raise PendingDeprecationWarnings in Python
3536 exceptions, which now raise PendingDeprecationWarnings in Python
3528 2.3. There were some in Magic and some in Gnuplot2.
3537 2.3. There were some in Magic and some in Gnuplot2.
3529
3538
3530 2003-06-30 Fernando Perez <fperez@colorado.edu>
3539 2003-06-30 Fernando Perez <fperez@colorado.edu>
3531
3540
3532 * IPython/genutils.py (page): modified to call curses only for
3541 * IPython/genutils.py (page): modified to call curses only for
3533 terminals where TERM=='xterm'. After problems under many other
3542 terminals where TERM=='xterm'. After problems under many other
3534 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3543 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3535
3544
3536 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3545 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3537 would be triggered when readline was absent. This was just an old
3546 would be triggered when readline was absent. This was just an old
3538 debugging statement I'd forgotten to take out.
3547 debugging statement I'd forgotten to take out.
3539
3548
3540 2003-06-20 Fernando Perez <fperez@colorado.edu>
3549 2003-06-20 Fernando Perez <fperez@colorado.edu>
3541
3550
3542 * IPython/genutils.py (clock): modified to return only user time
3551 * IPython/genutils.py (clock): modified to return only user time
3543 (not counting system time), after a discussion on scipy. While
3552 (not counting system time), after a discussion on scipy. While
3544 system time may be a useful quantity occasionally, it may much
3553 system time may be a useful quantity occasionally, it may much
3545 more easily be skewed by occasional swapping or other similar
3554 more easily be skewed by occasional swapping or other similar
3546 activity.
3555 activity.
3547
3556
3548 2003-06-05 Fernando Perez <fperez@colorado.edu>
3557 2003-06-05 Fernando Perez <fperez@colorado.edu>
3549
3558
3550 * IPython/numutils.py (identity): new function, for building
3559 * IPython/numutils.py (identity): new function, for building
3551 arbitrary rank Kronecker deltas (mostly backwards compatible with
3560 arbitrary rank Kronecker deltas (mostly backwards compatible with
3552 Numeric.identity)
3561 Numeric.identity)
3553
3562
3554 2003-06-03 Fernando Perez <fperez@colorado.edu>
3563 2003-06-03 Fernando Perez <fperez@colorado.edu>
3555
3564
3556 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3565 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3557 arguments passed to magics with spaces, to allow trailing '\' to
3566 arguments passed to magics with spaces, to allow trailing '\' to
3558 work normally (mainly for Windows users).
3567 work normally (mainly for Windows users).
3559
3568
3560 2003-05-29 Fernando Perez <fperez@colorado.edu>
3569 2003-05-29 Fernando Perez <fperez@colorado.edu>
3561
3570
3562 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3571 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3563 instead of pydoc.help. This fixes a bizarre behavior where
3572 instead of pydoc.help. This fixes a bizarre behavior where
3564 printing '%s' % locals() would trigger the help system. Now
3573 printing '%s' % locals() would trigger the help system. Now
3565 ipython behaves like normal python does.
3574 ipython behaves like normal python does.
3566
3575
3567 Note that if one does 'from pydoc import help', the bizarre
3576 Note that if one does 'from pydoc import help', the bizarre
3568 behavior returns, but this will also happen in normal python, so
3577 behavior returns, but this will also happen in normal python, so
3569 it's not an ipython bug anymore (it has to do with how pydoc.help
3578 it's not an ipython bug anymore (it has to do with how pydoc.help
3570 is implemented).
3579 is implemented).
3571
3580
3572 2003-05-22 Fernando Perez <fperez@colorado.edu>
3581 2003-05-22 Fernando Perez <fperez@colorado.edu>
3573
3582
3574 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3583 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3575 return [] instead of None when nothing matches, also match to end
3584 return [] instead of None when nothing matches, also match to end
3576 of line. Patch by Gary Bishop.
3585 of line. Patch by Gary Bishop.
3577
3586
3578 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3587 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3579 protection as before, for files passed on the command line. This
3588 protection as before, for files passed on the command line. This
3580 prevents the CrashHandler from kicking in if user files call into
3589 prevents the CrashHandler from kicking in if user files call into
3581 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3590 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3582 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3591 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3583
3592
3584 2003-05-20 *** Released version 0.4.0
3593 2003-05-20 *** Released version 0.4.0
3585
3594
3586 2003-05-20 Fernando Perez <fperez@colorado.edu>
3595 2003-05-20 Fernando Perez <fperez@colorado.edu>
3587
3596
3588 * setup.py: added support for manpages. It's a bit hackish b/c of
3597 * setup.py: added support for manpages. It's a bit hackish b/c of
3589 a bug in the way the bdist_rpm distutils target handles gzipped
3598 a bug in the way the bdist_rpm distutils target handles gzipped
3590 manpages, but it works. After a patch by Jack.
3599 manpages, but it works. After a patch by Jack.
3591
3600
3592 2003-05-19 Fernando Perez <fperez@colorado.edu>
3601 2003-05-19 Fernando Perez <fperez@colorado.edu>
3593
3602
3594 * IPython/numutils.py: added a mockup of the kinds module, since
3603 * IPython/numutils.py: added a mockup of the kinds module, since
3595 it was recently removed from Numeric. This way, numutils will
3604 it was recently removed from Numeric. This way, numutils will
3596 work for all users even if they are missing kinds.
3605 work for all users even if they are missing kinds.
3597
3606
3598 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3607 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3599 failure, which can occur with SWIG-wrapped extensions. After a
3608 failure, which can occur with SWIG-wrapped extensions. After a
3600 crash report from Prabhu.
3609 crash report from Prabhu.
3601
3610
3602 2003-05-16 Fernando Perez <fperez@colorado.edu>
3611 2003-05-16 Fernando Perez <fperez@colorado.edu>
3603
3612
3604 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3613 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3605 protect ipython from user code which may call directly
3614 protect ipython from user code which may call directly
3606 sys.excepthook (this looks like an ipython crash to the user, even
3615 sys.excepthook (this looks like an ipython crash to the user, even
3607 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3616 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3608 This is especially important to help users of WxWindows, but may
3617 This is especially important to help users of WxWindows, but may
3609 also be useful in other cases.
3618 also be useful in other cases.
3610
3619
3611 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3620 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3612 an optional tb_offset to be specified, and to preserve exception
3621 an optional tb_offset to be specified, and to preserve exception
3613 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3622 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3614
3623
3615 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3624 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3616
3625
3617 2003-05-15 Fernando Perez <fperez@colorado.edu>
3626 2003-05-15 Fernando Perez <fperez@colorado.edu>
3618
3627
3619 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3628 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3620 installing for a new user under Windows.
3629 installing for a new user under Windows.
3621
3630
3622 2003-05-12 Fernando Perez <fperez@colorado.edu>
3631 2003-05-12 Fernando Perez <fperez@colorado.edu>
3623
3632
3624 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3633 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3625 handler for Emacs comint-based lines. Currently it doesn't do
3634 handler for Emacs comint-based lines. Currently it doesn't do
3626 much (but importantly, it doesn't update the history cache). In
3635 much (but importantly, it doesn't update the history cache). In
3627 the future it may be expanded if Alex needs more functionality
3636 the future it may be expanded if Alex needs more functionality
3628 there.
3637 there.
3629
3638
3630 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3639 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3631 info to crash reports.
3640 info to crash reports.
3632
3641
3633 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3642 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3634 just like Python's -c. Also fixed crash with invalid -color
3643 just like Python's -c. Also fixed crash with invalid -color
3635 option value at startup. Thanks to Will French
3644 option value at startup. Thanks to Will French
3636 <wfrench-AT-bestweb.net> for the bug report.
3645 <wfrench-AT-bestweb.net> for the bug report.
3637
3646
3638 2003-05-09 Fernando Perez <fperez@colorado.edu>
3647 2003-05-09 Fernando Perez <fperez@colorado.edu>
3639
3648
3640 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3649 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3641 to EvalDict (it's a mapping, after all) and simplified its code
3650 to EvalDict (it's a mapping, after all) and simplified its code
3642 quite a bit, after a nice discussion on c.l.py where Gustavo
3651 quite a bit, after a nice discussion on c.l.py where Gustavo
3643 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3652 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3644
3653
3645 2003-04-30 Fernando Perez <fperez@colorado.edu>
3654 2003-04-30 Fernando Perez <fperez@colorado.edu>
3646
3655
3647 * IPython/genutils.py (timings_out): modified it to reduce its
3656 * IPython/genutils.py (timings_out): modified it to reduce its
3648 overhead in the common reps==1 case.
3657 overhead in the common reps==1 case.
3649
3658
3650 2003-04-29 Fernando Perez <fperez@colorado.edu>
3659 2003-04-29 Fernando Perez <fperez@colorado.edu>
3651
3660
3652 * IPython/genutils.py (timings_out): Modified to use the resource
3661 * IPython/genutils.py (timings_out): Modified to use the resource
3653 module, which avoids the wraparound problems of time.clock().
3662 module, which avoids the wraparound problems of time.clock().
3654
3663
3655 2003-04-17 *** Released version 0.2.15pre4
3664 2003-04-17 *** Released version 0.2.15pre4
3656
3665
3657 2003-04-17 Fernando Perez <fperez@colorado.edu>
3666 2003-04-17 Fernando Perez <fperez@colorado.edu>
3658
3667
3659 * setup.py (scriptfiles): Split windows-specific stuff over to a
3668 * setup.py (scriptfiles): Split windows-specific stuff over to a
3660 separate file, in an attempt to have a Windows GUI installer.
3669 separate file, in an attempt to have a Windows GUI installer.
3661 That didn't work, but part of the groundwork is done.
3670 That didn't work, but part of the groundwork is done.
3662
3671
3663 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3672 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3664 indent/unindent with 4 spaces. Particularly useful in combination
3673 indent/unindent with 4 spaces. Particularly useful in combination
3665 with the new auto-indent option.
3674 with the new auto-indent option.
3666
3675
3667 2003-04-16 Fernando Perez <fperez@colorado.edu>
3676 2003-04-16 Fernando Perez <fperez@colorado.edu>
3668
3677
3669 * IPython/Magic.py: various replacements of self.rc for
3678 * IPython/Magic.py: various replacements of self.rc for
3670 self.shell.rc. A lot more remains to be done to fully disentangle
3679 self.shell.rc. A lot more remains to be done to fully disentangle
3671 this class from the main Shell class.
3680 this class from the main Shell class.
3672
3681
3673 * IPython/GnuplotRuntime.py: added checks for mouse support so
3682 * IPython/GnuplotRuntime.py: added checks for mouse support so
3674 that we don't try to enable it if the current gnuplot doesn't
3683 that we don't try to enable it if the current gnuplot doesn't
3675 really support it. Also added checks so that we don't try to
3684 really support it. Also added checks so that we don't try to
3676 enable persist under Windows (where Gnuplot doesn't recognize the
3685 enable persist under Windows (where Gnuplot doesn't recognize the
3677 option).
3686 option).
3678
3687
3679 * IPython/iplib.py (InteractiveShell.interact): Added optional
3688 * IPython/iplib.py (InteractiveShell.interact): Added optional
3680 auto-indenting code, after a patch by King C. Shu
3689 auto-indenting code, after a patch by King C. Shu
3681 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3690 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3682 get along well with pasting indented code. If I ever figure out
3691 get along well with pasting indented code. If I ever figure out
3683 how to make that part go well, it will become on by default.
3692 how to make that part go well, it will become on by default.
3684
3693
3685 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3694 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3686 crash ipython if there was an unmatched '%' in the user's prompt
3695 crash ipython if there was an unmatched '%' in the user's prompt
3687 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3696 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3688
3697
3689 * IPython/iplib.py (InteractiveShell.interact): removed the
3698 * IPython/iplib.py (InteractiveShell.interact): removed the
3690 ability to ask the user whether he wants to crash or not at the
3699 ability to ask the user whether he wants to crash or not at the
3691 'last line' exception handler. Calling functions at that point
3700 'last line' exception handler. Calling functions at that point
3692 changes the stack, and the error reports would have incorrect
3701 changes the stack, and the error reports would have incorrect
3693 tracebacks.
3702 tracebacks.
3694
3703
3695 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3704 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3696 pass through a peger a pretty-printed form of any object. After a
3705 pass through a peger a pretty-printed form of any object. After a
3697 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3706 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3698
3707
3699 2003-04-14 Fernando Perez <fperez@colorado.edu>
3708 2003-04-14 Fernando Perez <fperez@colorado.edu>
3700
3709
3701 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3710 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3702 all files in ~ would be modified at first install (instead of
3711 all files in ~ would be modified at first install (instead of
3703 ~/.ipython). This could be potentially disastrous, as the
3712 ~/.ipython). This could be potentially disastrous, as the
3704 modification (make line-endings native) could damage binary files.
3713 modification (make line-endings native) could damage binary files.
3705
3714
3706 2003-04-10 Fernando Perez <fperez@colorado.edu>
3715 2003-04-10 Fernando Perez <fperez@colorado.edu>
3707
3716
3708 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3717 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3709 handle only lines which are invalid python. This now means that
3718 handle only lines which are invalid python. This now means that
3710 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3719 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3711 for the bug report.
3720 for the bug report.
3712
3721
3713 2003-04-01 Fernando Perez <fperez@colorado.edu>
3722 2003-04-01 Fernando Perez <fperez@colorado.edu>
3714
3723
3715 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3724 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3716 where failing to set sys.last_traceback would crash pdb.pm().
3725 where failing to set sys.last_traceback would crash pdb.pm().
3717 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3726 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3718 report.
3727 report.
3719
3728
3720 2003-03-25 Fernando Perez <fperez@colorado.edu>
3729 2003-03-25 Fernando Perez <fperez@colorado.edu>
3721
3730
3722 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3731 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3723 before printing it (it had a lot of spurious blank lines at the
3732 before printing it (it had a lot of spurious blank lines at the
3724 end).
3733 end).
3725
3734
3726 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3735 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3727 output would be sent 21 times! Obviously people don't use this
3736 output would be sent 21 times! Obviously people don't use this
3728 too often, or I would have heard about it.
3737 too often, or I would have heard about it.
3729
3738
3730 2003-03-24 Fernando Perez <fperez@colorado.edu>
3739 2003-03-24 Fernando Perez <fperez@colorado.edu>
3731
3740
3732 * setup.py (scriptfiles): renamed the data_files parameter from
3741 * setup.py (scriptfiles): renamed the data_files parameter from
3733 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3742 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3734 for the patch.
3743 for the patch.
3735
3744
3736 2003-03-20 Fernando Perez <fperez@colorado.edu>
3745 2003-03-20 Fernando Perez <fperez@colorado.edu>
3737
3746
3738 * IPython/genutils.py (error): added error() and fatal()
3747 * IPython/genutils.py (error): added error() and fatal()
3739 functions.
3748 functions.
3740
3749
3741 2003-03-18 *** Released version 0.2.15pre3
3750 2003-03-18 *** Released version 0.2.15pre3
3742
3751
3743 2003-03-18 Fernando Perez <fperez@colorado.edu>
3752 2003-03-18 Fernando Perez <fperez@colorado.edu>
3744
3753
3745 * setupext/install_data_ext.py
3754 * setupext/install_data_ext.py
3746 (install_data_ext.initialize_options): Class contributed by Jack
3755 (install_data_ext.initialize_options): Class contributed by Jack
3747 Moffit for fixing the old distutils hack. He is sending this to
3756 Moffit for fixing the old distutils hack. He is sending this to
3748 the distutils folks so in the future we may not need it as a
3757 the distutils folks so in the future we may not need it as a
3749 private fix.
3758 private fix.
3750
3759
3751 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3760 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3752 changes for Debian packaging. See his patch for full details.
3761 changes for Debian packaging. See his patch for full details.
3753 The old distutils hack of making the ipythonrc* files carry a
3762 The old distutils hack of making the ipythonrc* files carry a
3754 bogus .py extension is gone, at last. Examples were moved to a
3763 bogus .py extension is gone, at last. Examples were moved to a
3755 separate subdir under doc/, and the separate executable scripts
3764 separate subdir under doc/, and the separate executable scripts
3756 now live in their own directory. Overall a great cleanup. The
3765 now live in their own directory. Overall a great cleanup. The
3757 manual was updated to use the new files, and setup.py has been
3766 manual was updated to use the new files, and setup.py has been
3758 fixed for this setup.
3767 fixed for this setup.
3759
3768
3760 * IPython/PyColorize.py (Parser.usage): made non-executable and
3769 * IPython/PyColorize.py (Parser.usage): made non-executable and
3761 created a pycolor wrapper around it to be included as a script.
3770 created a pycolor wrapper around it to be included as a script.
3762
3771
3763 2003-03-12 *** Released version 0.2.15pre2
3772 2003-03-12 *** Released version 0.2.15pre2
3764
3773
3765 2003-03-12 Fernando Perez <fperez@colorado.edu>
3774 2003-03-12 Fernando Perez <fperez@colorado.edu>
3766
3775
3767 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3776 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3768 long-standing problem with garbage characters in some terminals.
3777 long-standing problem with garbage characters in some terminals.
3769 The issue was really that the \001 and \002 escapes must _only_ be
3778 The issue was really that the \001 and \002 escapes must _only_ be
3770 passed to input prompts (which call readline), but _never_ to
3779 passed to input prompts (which call readline), but _never_ to
3771 normal text to be printed on screen. I changed ColorANSI to have
3780 normal text to be printed on screen. I changed ColorANSI to have
3772 two classes: TermColors and InputTermColors, each with the
3781 two classes: TermColors and InputTermColors, each with the
3773 appropriate escapes for input prompts or normal text. The code in
3782 appropriate escapes for input prompts or normal text. The code in
3774 Prompts.py got slightly more complicated, but this very old and
3783 Prompts.py got slightly more complicated, but this very old and
3775 annoying bug is finally fixed.
3784 annoying bug is finally fixed.
3776
3785
3777 All the credit for nailing down the real origin of this problem
3786 All the credit for nailing down the real origin of this problem
3778 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3787 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3779 *Many* thanks to him for spending quite a bit of effort on this.
3788 *Many* thanks to him for spending quite a bit of effort on this.
3780
3789
3781 2003-03-05 *** Released version 0.2.15pre1
3790 2003-03-05 *** Released version 0.2.15pre1
3782
3791
3783 2003-03-03 Fernando Perez <fperez@colorado.edu>
3792 2003-03-03 Fernando Perez <fperez@colorado.edu>
3784
3793
3785 * IPython/FakeModule.py: Moved the former _FakeModule to a
3794 * IPython/FakeModule.py: Moved the former _FakeModule to a
3786 separate file, because it's also needed by Magic (to fix a similar
3795 separate file, because it's also needed by Magic (to fix a similar
3787 pickle-related issue in @run).
3796 pickle-related issue in @run).
3788
3797
3789 2003-03-02 Fernando Perez <fperez@colorado.edu>
3798 2003-03-02 Fernando Perez <fperez@colorado.edu>
3790
3799
3791 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3800 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3792 the autocall option at runtime.
3801 the autocall option at runtime.
3793 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3802 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3794 across Magic.py to start separating Magic from InteractiveShell.
3803 across Magic.py to start separating Magic from InteractiveShell.
3795 (Magic._ofind): Fixed to return proper namespace for dotted
3804 (Magic._ofind): Fixed to return proper namespace for dotted
3796 names. Before, a dotted name would always return 'not currently
3805 names. Before, a dotted name would always return 'not currently
3797 defined', because it would find the 'parent'. s.x would be found,
3806 defined', because it would find the 'parent'. s.x would be found,
3798 but since 'x' isn't defined by itself, it would get confused.
3807 but since 'x' isn't defined by itself, it would get confused.
3799 (Magic.magic_run): Fixed pickling problems reported by Ralf
3808 (Magic.magic_run): Fixed pickling problems reported by Ralf
3800 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3809 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3801 that I'd used when Mike Heeter reported similar issues at the
3810 that I'd used when Mike Heeter reported similar issues at the
3802 top-level, but now for @run. It boils down to injecting the
3811 top-level, but now for @run. It boils down to injecting the
3803 namespace where code is being executed with something that looks
3812 namespace where code is being executed with something that looks
3804 enough like a module to fool pickle.dump(). Since a pickle stores
3813 enough like a module to fool pickle.dump(). Since a pickle stores
3805 a named reference to the importing module, we need this for
3814 a named reference to the importing module, we need this for
3806 pickles to save something sensible.
3815 pickles to save something sensible.
3807
3816
3808 * IPython/ipmaker.py (make_IPython): added an autocall option.
3817 * IPython/ipmaker.py (make_IPython): added an autocall option.
3809
3818
3810 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3819 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3811 the auto-eval code. Now autocalling is an option, and the code is
3820 the auto-eval code. Now autocalling is an option, and the code is
3812 also vastly safer. There is no more eval() involved at all.
3821 also vastly safer. There is no more eval() involved at all.
3813
3822
3814 2003-03-01 Fernando Perez <fperez@colorado.edu>
3823 2003-03-01 Fernando Perez <fperez@colorado.edu>
3815
3824
3816 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3825 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3817 dict with named keys instead of a tuple.
3826 dict with named keys instead of a tuple.
3818
3827
3819 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3828 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3820
3829
3821 * setup.py (make_shortcut): Fixed message about directories
3830 * setup.py (make_shortcut): Fixed message about directories
3822 created during Windows installation (the directories were ok, just
3831 created during Windows installation (the directories were ok, just
3823 the printed message was misleading). Thanks to Chris Liechti
3832 the printed message was misleading). Thanks to Chris Liechti
3824 <cliechti-AT-gmx.net> for the heads up.
3833 <cliechti-AT-gmx.net> for the heads up.
3825
3834
3826 2003-02-21 Fernando Perez <fperez@colorado.edu>
3835 2003-02-21 Fernando Perez <fperez@colorado.edu>
3827
3836
3828 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3837 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3829 of ValueError exception when checking for auto-execution. This
3838 of ValueError exception when checking for auto-execution. This
3830 one is raised by things like Numeric arrays arr.flat when the
3839 one is raised by things like Numeric arrays arr.flat when the
3831 array is non-contiguous.
3840 array is non-contiguous.
3832
3841
3833 2003-01-31 Fernando Perez <fperez@colorado.edu>
3842 2003-01-31 Fernando Perez <fperez@colorado.edu>
3834
3843
3835 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3844 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3836 not return any value at all (even though the command would get
3845 not return any value at all (even though the command would get
3837 executed).
3846 executed).
3838 (xsys): Flush stdout right after printing the command to ensure
3847 (xsys): Flush stdout right after printing the command to ensure
3839 proper ordering of commands and command output in the total
3848 proper ordering of commands and command output in the total
3840 output.
3849 output.
3841 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3850 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3842 system/getoutput as defaults. The old ones are kept for
3851 system/getoutput as defaults. The old ones are kept for
3843 compatibility reasons, so no code which uses this library needs
3852 compatibility reasons, so no code which uses this library needs
3844 changing.
3853 changing.
3845
3854
3846 2003-01-27 *** Released version 0.2.14
3855 2003-01-27 *** Released version 0.2.14
3847
3856
3848 2003-01-25 Fernando Perez <fperez@colorado.edu>
3857 2003-01-25 Fernando Perez <fperez@colorado.edu>
3849
3858
3850 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3859 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3851 functions defined in previous edit sessions could not be re-edited
3860 functions defined in previous edit sessions could not be re-edited
3852 (because the temp files were immediately removed). Now temp files
3861 (because the temp files were immediately removed). Now temp files
3853 are removed only at IPython's exit.
3862 are removed only at IPython's exit.
3854 (Magic.magic_run): Improved @run to perform shell-like expansions
3863 (Magic.magic_run): Improved @run to perform shell-like expansions
3855 on its arguments (~users and $VARS). With this, @run becomes more
3864 on its arguments (~users and $VARS). With this, @run becomes more
3856 like a normal command-line.
3865 like a normal command-line.
3857
3866
3858 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3867 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3859 bugs related to embedding and cleaned up that code. A fairly
3868 bugs related to embedding and cleaned up that code. A fairly
3860 important one was the impossibility to access the global namespace
3869 important one was the impossibility to access the global namespace
3861 through the embedded IPython (only local variables were visible).
3870 through the embedded IPython (only local variables were visible).
3862
3871
3863 2003-01-14 Fernando Perez <fperez@colorado.edu>
3872 2003-01-14 Fernando Perez <fperez@colorado.edu>
3864
3873
3865 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3874 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3866 auto-calling to be a bit more conservative. Now it doesn't get
3875 auto-calling to be a bit more conservative. Now it doesn't get
3867 triggered if any of '!=()<>' are in the rest of the input line, to
3876 triggered if any of '!=()<>' are in the rest of the input line, to
3868 allow comparing callables. Thanks to Alex for the heads up.
3877 allow comparing callables. Thanks to Alex for the heads up.
3869
3878
3870 2003-01-07 Fernando Perez <fperez@colorado.edu>
3879 2003-01-07 Fernando Perez <fperez@colorado.edu>
3871
3880
3872 * IPython/genutils.py (page): fixed estimation of the number of
3881 * IPython/genutils.py (page): fixed estimation of the number of
3873 lines in a string to be paged to simply count newlines. This
3882 lines in a string to be paged to simply count newlines. This
3874 prevents over-guessing due to embedded escape sequences. A better
3883 prevents over-guessing due to embedded escape sequences. A better
3875 long-term solution would involve stripping out the control chars
3884 long-term solution would involve stripping out the control chars
3876 for the count, but it's potentially so expensive I just don't
3885 for the count, but it's potentially so expensive I just don't
3877 think it's worth doing.
3886 think it's worth doing.
3878
3887
3879 2002-12-19 *** Released version 0.2.14pre50
3888 2002-12-19 *** Released version 0.2.14pre50
3880
3889
3881 2002-12-19 Fernando Perez <fperez@colorado.edu>
3890 2002-12-19 Fernando Perez <fperez@colorado.edu>
3882
3891
3883 * tools/release (version): Changed release scripts to inform
3892 * tools/release (version): Changed release scripts to inform
3884 Andrea and build a NEWS file with a list of recent changes.
3893 Andrea and build a NEWS file with a list of recent changes.
3885
3894
3886 * IPython/ColorANSI.py (__all__): changed terminal detection
3895 * IPython/ColorANSI.py (__all__): changed terminal detection
3887 code. Seems to work better for xterms without breaking
3896 code. Seems to work better for xterms without breaking
3888 konsole. Will need more testing to determine if WinXP and Mac OSX
3897 konsole. Will need more testing to determine if WinXP and Mac OSX
3889 also work ok.
3898 also work ok.
3890
3899
3891 2002-12-18 *** Released version 0.2.14pre49
3900 2002-12-18 *** Released version 0.2.14pre49
3892
3901
3893 2002-12-18 Fernando Perez <fperez@colorado.edu>
3902 2002-12-18 Fernando Perez <fperez@colorado.edu>
3894
3903
3895 * Docs: added new info about Mac OSX, from Andrea.
3904 * Docs: added new info about Mac OSX, from Andrea.
3896
3905
3897 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3906 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3898 allow direct plotting of python strings whose format is the same
3907 allow direct plotting of python strings whose format is the same
3899 of gnuplot data files.
3908 of gnuplot data files.
3900
3909
3901 2002-12-16 Fernando Perez <fperez@colorado.edu>
3910 2002-12-16 Fernando Perez <fperez@colorado.edu>
3902
3911
3903 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3912 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3904 value of exit question to be acknowledged.
3913 value of exit question to be acknowledged.
3905
3914
3906 2002-12-03 Fernando Perez <fperez@colorado.edu>
3915 2002-12-03 Fernando Perez <fperez@colorado.edu>
3907
3916
3908 * IPython/ipmaker.py: removed generators, which had been added
3917 * IPython/ipmaker.py: removed generators, which had been added
3909 by mistake in an earlier debugging run. This was causing trouble
3918 by mistake in an earlier debugging run. This was causing trouble
3910 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3919 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3911 for pointing this out.
3920 for pointing this out.
3912
3921
3913 2002-11-17 Fernando Perez <fperez@colorado.edu>
3922 2002-11-17 Fernando Perez <fperez@colorado.edu>
3914
3923
3915 * Manual: updated the Gnuplot section.
3924 * Manual: updated the Gnuplot section.
3916
3925
3917 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3926 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3918 a much better split of what goes in Runtime and what goes in
3927 a much better split of what goes in Runtime and what goes in
3919 Interactive.
3928 Interactive.
3920
3929
3921 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3930 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3922 being imported from iplib.
3931 being imported from iplib.
3923
3932
3924 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3933 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3925 for command-passing. Now the global Gnuplot instance is called
3934 for command-passing. Now the global Gnuplot instance is called
3926 'gp' instead of 'g', which was really a far too fragile and
3935 'gp' instead of 'g', which was really a far too fragile and
3927 common name.
3936 common name.
3928
3937
3929 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3938 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3930 bounding boxes generated by Gnuplot for square plots.
3939 bounding boxes generated by Gnuplot for square plots.
3931
3940
3932 * IPython/genutils.py (popkey): new function added. I should
3941 * IPython/genutils.py (popkey): new function added. I should
3933 suggest this on c.l.py as a dict method, it seems useful.
3942 suggest this on c.l.py as a dict method, it seems useful.
3934
3943
3935 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3944 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3936 to transparently handle PostScript generation. MUCH better than
3945 to transparently handle PostScript generation. MUCH better than
3937 the previous plot_eps/replot_eps (which I removed now). The code
3946 the previous plot_eps/replot_eps (which I removed now). The code
3938 is also fairly clean and well documented now (including
3947 is also fairly clean and well documented now (including
3939 docstrings).
3948 docstrings).
3940
3949
3941 2002-11-13 Fernando Perez <fperez@colorado.edu>
3950 2002-11-13 Fernando Perez <fperez@colorado.edu>
3942
3951
3943 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3952 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3944 (inconsistent with options).
3953 (inconsistent with options).
3945
3954
3946 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3955 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3947 manually disabled, I don't know why. Fixed it.
3956 manually disabled, I don't know why. Fixed it.
3948 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3957 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3949 eps output.
3958 eps output.
3950
3959
3951 2002-11-12 Fernando Perez <fperez@colorado.edu>
3960 2002-11-12 Fernando Perez <fperez@colorado.edu>
3952
3961
3953 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3962 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3954 don't propagate up to caller. Fixes crash reported by François
3963 don't propagate up to caller. Fixes crash reported by François
3955 Pinard.
3964 Pinard.
3956
3965
3957 2002-11-09 Fernando Perez <fperez@colorado.edu>
3966 2002-11-09 Fernando Perez <fperez@colorado.edu>
3958
3967
3959 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3968 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3960 history file for new users.
3969 history file for new users.
3961 (make_IPython): fixed bug where initial install would leave the
3970 (make_IPython): fixed bug where initial install would leave the
3962 user running in the .ipython dir.
3971 user running in the .ipython dir.
3963 (make_IPython): fixed bug where config dir .ipython would be
3972 (make_IPython): fixed bug where config dir .ipython would be
3964 created regardless of the given -ipythondir option. Thanks to Cory
3973 created regardless of the given -ipythondir option. Thanks to Cory
3965 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3974 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3966
3975
3967 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3976 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3968 type confirmations. Will need to use it in all of IPython's code
3977 type confirmations. Will need to use it in all of IPython's code
3969 consistently.
3978 consistently.
3970
3979
3971 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3980 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3972 context to print 31 lines instead of the default 5. This will make
3981 context to print 31 lines instead of the default 5. This will make
3973 the crash reports extremely detailed in case the problem is in
3982 the crash reports extremely detailed in case the problem is in
3974 libraries I don't have access to.
3983 libraries I don't have access to.
3975
3984
3976 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3985 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3977 line of defense' code to still crash, but giving users fair
3986 line of defense' code to still crash, but giving users fair
3978 warning. I don't want internal errors to go unreported: if there's
3987 warning. I don't want internal errors to go unreported: if there's
3979 an internal problem, IPython should crash and generate a full
3988 an internal problem, IPython should crash and generate a full
3980 report.
3989 report.
3981
3990
3982 2002-11-08 Fernando Perez <fperez@colorado.edu>
3991 2002-11-08 Fernando Perez <fperez@colorado.edu>
3983
3992
3984 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3993 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3985 otherwise uncaught exceptions which can appear if people set
3994 otherwise uncaught exceptions which can appear if people set
3986 sys.stdout to something badly broken. Thanks to a crash report
3995 sys.stdout to something badly broken. Thanks to a crash report
3987 from henni-AT-mail.brainbot.com.
3996 from henni-AT-mail.brainbot.com.
3988
3997
3989 2002-11-04 Fernando Perez <fperez@colorado.edu>
3998 2002-11-04 Fernando Perez <fperez@colorado.edu>
3990
3999
3991 * IPython/iplib.py (InteractiveShell.interact): added
4000 * IPython/iplib.py (InteractiveShell.interact): added
3992 __IPYTHON__active to the builtins. It's a flag which goes on when
4001 __IPYTHON__active to the builtins. It's a flag which goes on when
3993 the interaction starts and goes off again when it stops. This
4002 the interaction starts and goes off again when it stops. This
3994 allows embedding code to detect being inside IPython. Before this
4003 allows embedding code to detect being inside IPython. Before this
3995 was done via __IPYTHON__, but that only shows that an IPython
4004 was done via __IPYTHON__, but that only shows that an IPython
3996 instance has been created.
4005 instance has been created.
3997
4006
3998 * IPython/Magic.py (Magic.magic_env): I realized that in a
4007 * IPython/Magic.py (Magic.magic_env): I realized that in a
3999 UserDict, instance.data holds the data as a normal dict. So I
4008 UserDict, instance.data holds the data as a normal dict. So I
4000 modified @env to return os.environ.data instead of rebuilding a
4009 modified @env to return os.environ.data instead of rebuilding a
4001 dict by hand.
4010 dict by hand.
4002
4011
4003 2002-11-02 Fernando Perez <fperez@colorado.edu>
4012 2002-11-02 Fernando Perez <fperez@colorado.edu>
4004
4013
4005 * IPython/genutils.py (warn): changed so that level 1 prints no
4014 * IPython/genutils.py (warn): changed so that level 1 prints no
4006 header. Level 2 is now the default (with 'WARNING' header, as
4015 header. Level 2 is now the default (with 'WARNING' header, as
4007 before). I think I tracked all places where changes were needed in
4016 before). I think I tracked all places where changes were needed in
4008 IPython, but outside code using the old level numbering may have
4017 IPython, but outside code using the old level numbering may have
4009 broken.
4018 broken.
4010
4019
4011 * IPython/iplib.py (InteractiveShell.runcode): added this to
4020 * IPython/iplib.py (InteractiveShell.runcode): added this to
4012 handle the tracebacks in SystemExit traps correctly. The previous
4021 handle the tracebacks in SystemExit traps correctly. The previous
4013 code (through interact) was printing more of the stack than
4022 code (through interact) was printing more of the stack than
4014 necessary, showing IPython internal code to the user.
4023 necessary, showing IPython internal code to the user.
4015
4024
4016 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4025 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4017 default. Now that the default at the confirmation prompt is yes,
4026 default. Now that the default at the confirmation prompt is yes,
4018 it's not so intrusive. François' argument that ipython sessions
4027 it's not so intrusive. François' argument that ipython sessions
4019 tend to be complex enough not to lose them from an accidental C-d,
4028 tend to be complex enough not to lose them from an accidental C-d,
4020 is a valid one.
4029 is a valid one.
4021
4030
4022 * IPython/iplib.py (InteractiveShell.interact): added a
4031 * IPython/iplib.py (InteractiveShell.interact): added a
4023 showtraceback() call to the SystemExit trap, and modified the exit
4032 showtraceback() call to the SystemExit trap, and modified the exit
4024 confirmation to have yes as the default.
4033 confirmation to have yes as the default.
4025
4034
4026 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4035 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4027 this file. It's been gone from the code for a long time, this was
4036 this file. It's been gone from the code for a long time, this was
4028 simply leftover junk.
4037 simply leftover junk.
4029
4038
4030 2002-11-01 Fernando Perez <fperez@colorado.edu>
4039 2002-11-01 Fernando Perez <fperez@colorado.edu>
4031
4040
4032 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4041 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4033 added. If set, IPython now traps EOF and asks for
4042 added. If set, IPython now traps EOF and asks for
4034 confirmation. After a request by François Pinard.
4043 confirmation. After a request by François Pinard.
4035
4044
4036 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4045 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4037 of @abort, and with a new (better) mechanism for handling the
4046 of @abort, and with a new (better) mechanism for handling the
4038 exceptions.
4047 exceptions.
4039
4048
4040 2002-10-27 Fernando Perez <fperez@colorado.edu>
4049 2002-10-27 Fernando Perez <fperez@colorado.edu>
4041
4050
4042 * IPython/usage.py (__doc__): updated the --help information and
4051 * IPython/usage.py (__doc__): updated the --help information and
4043 the ipythonrc file to indicate that -log generates
4052 the ipythonrc file to indicate that -log generates
4044 ./ipython.log. Also fixed the corresponding info in @logstart.
4053 ./ipython.log. Also fixed the corresponding info in @logstart.
4045 This and several other fixes in the manuals thanks to reports by
4054 This and several other fixes in the manuals thanks to reports by
4046 François Pinard <pinard-AT-iro.umontreal.ca>.
4055 François Pinard <pinard-AT-iro.umontreal.ca>.
4047
4056
4048 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4057 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4049 refer to @logstart (instead of @log, which doesn't exist).
4058 refer to @logstart (instead of @log, which doesn't exist).
4050
4059
4051 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4060 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4052 AttributeError crash. Thanks to Christopher Armstrong
4061 AttributeError crash. Thanks to Christopher Armstrong
4053 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4062 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4054 introduced recently (in 0.2.14pre37) with the fix to the eval
4063 introduced recently (in 0.2.14pre37) with the fix to the eval
4055 problem mentioned below.
4064 problem mentioned below.
4056
4065
4057 2002-10-17 Fernando Perez <fperez@colorado.edu>
4066 2002-10-17 Fernando Perez <fperez@colorado.edu>
4058
4067
4059 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4068 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4060 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4069 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4061
4070
4062 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4071 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4063 this function to fix a problem reported by Alex Schmolck. He saw
4072 this function to fix a problem reported by Alex Schmolck. He saw
4064 it with list comprehensions and generators, which were getting
4073 it with list comprehensions and generators, which were getting
4065 called twice. The real problem was an 'eval' call in testing for
4074 called twice. The real problem was an 'eval' call in testing for
4066 automagic which was evaluating the input line silently.
4075 automagic which was evaluating the input line silently.
4067
4076
4068 This is a potentially very nasty bug, if the input has side
4077 This is a potentially very nasty bug, if the input has side
4069 effects which must not be repeated. The code is much cleaner now,
4078 effects which must not be repeated. The code is much cleaner now,
4070 without any blanket 'except' left and with a regexp test for
4079 without any blanket 'except' left and with a regexp test for
4071 actual function names.
4080 actual function names.
4072
4081
4073 But an eval remains, which I'm not fully comfortable with. I just
4082 But an eval remains, which I'm not fully comfortable with. I just
4074 don't know how to find out if an expression could be a callable in
4083 don't know how to find out if an expression could be a callable in
4075 the user's namespace without doing an eval on the string. However
4084 the user's namespace without doing an eval on the string. However
4076 that string is now much more strictly checked so that no code
4085 that string is now much more strictly checked so that no code
4077 slips by, so the eval should only happen for things that can
4086 slips by, so the eval should only happen for things that can
4078 really be only function/method names.
4087 really be only function/method names.
4079
4088
4080 2002-10-15 Fernando Perez <fperez@colorado.edu>
4089 2002-10-15 Fernando Perez <fperez@colorado.edu>
4081
4090
4082 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4091 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4083 OSX information to main manual, removed README_Mac_OSX file from
4092 OSX information to main manual, removed README_Mac_OSX file from
4084 distribution. Also updated credits for recent additions.
4093 distribution. Also updated credits for recent additions.
4085
4094
4086 2002-10-10 Fernando Perez <fperez@colorado.edu>
4095 2002-10-10 Fernando Perez <fperez@colorado.edu>
4087
4096
4088 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4097 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4089 terminal-related issues. Many thanks to Andrea Riciputi
4098 terminal-related issues. Many thanks to Andrea Riciputi
4090 <andrea.riciputi-AT-libero.it> for writing it.
4099 <andrea.riciputi-AT-libero.it> for writing it.
4091
4100
4092 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4101 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4093 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4102 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4094
4103
4095 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4104 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4096 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4105 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4097 <syver-en-AT-online.no> who both submitted patches for this problem.
4106 <syver-en-AT-online.no> who both submitted patches for this problem.
4098
4107
4099 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4108 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4100 global embedding to make sure that things don't overwrite user
4109 global embedding to make sure that things don't overwrite user
4101 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4110 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4102
4111
4103 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4112 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4104 compatibility. Thanks to Hayden Callow
4113 compatibility. Thanks to Hayden Callow
4105 <h.callow-AT-elec.canterbury.ac.nz>
4114 <h.callow-AT-elec.canterbury.ac.nz>
4106
4115
4107 2002-10-04 Fernando Perez <fperez@colorado.edu>
4116 2002-10-04 Fernando Perez <fperez@colorado.edu>
4108
4117
4109 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4118 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4110 Gnuplot.File objects.
4119 Gnuplot.File objects.
4111
4120
4112 2002-07-23 Fernando Perez <fperez@colorado.edu>
4121 2002-07-23 Fernando Perez <fperez@colorado.edu>
4113
4122
4114 * IPython/genutils.py (timing): Added timings() and timing() for
4123 * IPython/genutils.py (timing): Added timings() and timing() for
4115 quick access to the most commonly needed data, the execution
4124 quick access to the most commonly needed data, the execution
4116 times. Old timing() renamed to timings_out().
4125 times. Old timing() renamed to timings_out().
4117
4126
4118 2002-07-18 Fernando Perez <fperez@colorado.edu>
4127 2002-07-18 Fernando Perez <fperez@colorado.edu>
4119
4128
4120 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4129 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4121 bug with nested instances disrupting the parent's tab completion.
4130 bug with nested instances disrupting the parent's tab completion.
4122
4131
4123 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4132 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4124 all_completions code to begin the emacs integration.
4133 all_completions code to begin the emacs integration.
4125
4134
4126 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4135 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4127 argument to allow titling individual arrays when plotting.
4136 argument to allow titling individual arrays when plotting.
4128
4137
4129 2002-07-15 Fernando Perez <fperez@colorado.edu>
4138 2002-07-15 Fernando Perez <fperez@colorado.edu>
4130
4139
4131 * setup.py (make_shortcut): changed to retrieve the value of
4140 * setup.py (make_shortcut): changed to retrieve the value of
4132 'Program Files' directory from the registry (this value changes in
4141 'Program Files' directory from the registry (this value changes in
4133 non-english versions of Windows). Thanks to Thomas Fanslau
4142 non-english versions of Windows). Thanks to Thomas Fanslau
4134 <tfanslau-AT-gmx.de> for the report.
4143 <tfanslau-AT-gmx.de> for the report.
4135
4144
4136 2002-07-10 Fernando Perez <fperez@colorado.edu>
4145 2002-07-10 Fernando Perez <fperez@colorado.edu>
4137
4146
4138 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4147 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4139 a bug in pdb, which crashes if a line with only whitespace is
4148 a bug in pdb, which crashes if a line with only whitespace is
4140 entered. Bug report submitted to sourceforge.
4149 entered. Bug report submitted to sourceforge.
4141
4150
4142 2002-07-09 Fernando Perez <fperez@colorado.edu>
4151 2002-07-09 Fernando Perez <fperez@colorado.edu>
4143
4152
4144 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4153 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4145 reporting exceptions (it's a bug in inspect.py, I just set a
4154 reporting exceptions (it's a bug in inspect.py, I just set a
4146 workaround).
4155 workaround).
4147
4156
4148 2002-07-08 Fernando Perez <fperez@colorado.edu>
4157 2002-07-08 Fernando Perez <fperez@colorado.edu>
4149
4158
4150 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4159 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4151 __IPYTHON__ in __builtins__ to show up in user_ns.
4160 __IPYTHON__ in __builtins__ to show up in user_ns.
4152
4161
4153 2002-07-03 Fernando Perez <fperez@colorado.edu>
4162 2002-07-03 Fernando Perez <fperez@colorado.edu>
4154
4163
4155 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4164 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4156 name from @gp_set_instance to @gp_set_default.
4165 name from @gp_set_instance to @gp_set_default.
4157
4166
4158 * IPython/ipmaker.py (make_IPython): default editor value set to
4167 * IPython/ipmaker.py (make_IPython): default editor value set to
4159 '0' (a string), to match the rc file. Otherwise will crash when
4168 '0' (a string), to match the rc file. Otherwise will crash when
4160 .strip() is called on it.
4169 .strip() is called on it.
4161
4170
4162
4171
4163 2002-06-28 Fernando Perez <fperez@colorado.edu>
4172 2002-06-28 Fernando Perez <fperez@colorado.edu>
4164
4173
4165 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4174 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4166 of files in current directory when a file is executed via
4175 of files in current directory when a file is executed via
4167 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4176 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4168
4177
4169 * setup.py (manfiles): fix for rpm builds, submitted by RA
4178 * setup.py (manfiles): fix for rpm builds, submitted by RA
4170 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4179 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4171
4180
4172 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4181 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4173 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4182 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4174 string!). A. Schmolck caught this one.
4183 string!). A. Schmolck caught this one.
4175
4184
4176 2002-06-27 Fernando Perez <fperez@colorado.edu>
4185 2002-06-27 Fernando Perez <fperez@colorado.edu>
4177
4186
4178 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4187 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4179 defined files at the cmd line. __name__ wasn't being set to
4188 defined files at the cmd line. __name__ wasn't being set to
4180 __main__.
4189 __main__.
4181
4190
4182 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4191 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4183 regular lists and tuples besides Numeric arrays.
4192 regular lists and tuples besides Numeric arrays.
4184
4193
4185 * IPython/Prompts.py (CachedOutput.__call__): Added output
4194 * IPython/Prompts.py (CachedOutput.__call__): Added output
4186 supression for input ending with ';'. Similar to Mathematica and
4195 supression for input ending with ';'. Similar to Mathematica and
4187 Matlab. The _* vars and Out[] list are still updated, just like
4196 Matlab. The _* vars and Out[] list are still updated, just like
4188 Mathematica behaves.
4197 Mathematica behaves.
4189
4198
4190 2002-06-25 Fernando Perez <fperez@colorado.edu>
4199 2002-06-25 Fernando Perez <fperez@colorado.edu>
4191
4200
4192 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4201 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4193 .ini extensions for profiels under Windows.
4202 .ini extensions for profiels under Windows.
4194
4203
4195 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4204 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4196 string form. Fix contributed by Alexander Schmolck
4205 string form. Fix contributed by Alexander Schmolck
4197 <a.schmolck-AT-gmx.net>
4206 <a.schmolck-AT-gmx.net>
4198
4207
4199 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4208 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4200 pre-configured Gnuplot instance.
4209 pre-configured Gnuplot instance.
4201
4210
4202 2002-06-21 Fernando Perez <fperez@colorado.edu>
4211 2002-06-21 Fernando Perez <fperez@colorado.edu>
4203
4212
4204 * IPython/numutils.py (exp_safe): new function, works around the
4213 * IPython/numutils.py (exp_safe): new function, works around the
4205 underflow problems in Numeric.
4214 underflow problems in Numeric.
4206 (log2): New fn. Safe log in base 2: returns exact integer answer
4215 (log2): New fn. Safe log in base 2: returns exact integer answer
4207 for exact integer powers of 2.
4216 for exact integer powers of 2.
4208
4217
4209 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4218 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4210 properly.
4219 properly.
4211
4220
4212 2002-06-20 Fernando Perez <fperez@colorado.edu>
4221 2002-06-20 Fernando Perez <fperez@colorado.edu>
4213
4222
4214 * IPython/genutils.py (timing): new function like
4223 * IPython/genutils.py (timing): new function like
4215 Mathematica's. Similar to time_test, but returns more info.
4224 Mathematica's. Similar to time_test, but returns more info.
4216
4225
4217 2002-06-18 Fernando Perez <fperez@colorado.edu>
4226 2002-06-18 Fernando Perez <fperez@colorado.edu>
4218
4227
4219 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4228 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4220 according to Mike Heeter's suggestions.
4229 according to Mike Heeter's suggestions.
4221
4230
4222 2002-06-16 Fernando Perez <fperez@colorado.edu>
4231 2002-06-16 Fernando Perez <fperez@colorado.edu>
4223
4232
4224 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4233 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4225 system. GnuplotMagic is gone as a user-directory option. New files
4234 system. GnuplotMagic is gone as a user-directory option. New files
4226 make it easier to use all the gnuplot stuff both from external
4235 make it easier to use all the gnuplot stuff both from external
4227 programs as well as from IPython. Had to rewrite part of
4236 programs as well as from IPython. Had to rewrite part of
4228 hardcopy() b/c of a strange bug: often the ps files simply don't
4237 hardcopy() b/c of a strange bug: often the ps files simply don't
4229 get created, and require a repeat of the command (often several
4238 get created, and require a repeat of the command (often several
4230 times).
4239 times).
4231
4240
4232 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4241 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4233 resolve output channel at call time, so that if sys.stderr has
4242 resolve output channel at call time, so that if sys.stderr has
4234 been redirected by user this gets honored.
4243 been redirected by user this gets honored.
4235
4244
4236 2002-06-13 Fernando Perez <fperez@colorado.edu>
4245 2002-06-13 Fernando Perez <fperez@colorado.edu>
4237
4246
4238 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4247 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4239 IPShell. Kept a copy with the old names to avoid breaking people's
4248 IPShell. Kept a copy with the old names to avoid breaking people's
4240 embedded code.
4249 embedded code.
4241
4250
4242 * IPython/ipython: simplified it to the bare minimum after
4251 * IPython/ipython: simplified it to the bare minimum after
4243 Holger's suggestions. Added info about how to use it in
4252 Holger's suggestions. Added info about how to use it in
4244 PYTHONSTARTUP.
4253 PYTHONSTARTUP.
4245
4254
4246 * IPython/Shell.py (IPythonShell): changed the options passing
4255 * IPython/Shell.py (IPythonShell): changed the options passing
4247 from a string with funky %s replacements to a straight list. Maybe
4256 from a string with funky %s replacements to a straight list. Maybe
4248 a bit more typing, but it follows sys.argv conventions, so there's
4257 a bit more typing, but it follows sys.argv conventions, so there's
4249 less special-casing to remember.
4258 less special-casing to remember.
4250
4259
4251 2002-06-12 Fernando Perez <fperez@colorado.edu>
4260 2002-06-12 Fernando Perez <fperez@colorado.edu>
4252
4261
4253 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4262 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4254 command. Thanks to a suggestion by Mike Heeter.
4263 command. Thanks to a suggestion by Mike Heeter.
4255 (Magic.magic_pfile): added behavior to look at filenames if given
4264 (Magic.magic_pfile): added behavior to look at filenames if given
4256 arg is not a defined object.
4265 arg is not a defined object.
4257 (Magic.magic_save): New @save function to save code snippets. Also
4266 (Magic.magic_save): New @save function to save code snippets. Also
4258 a Mike Heeter idea.
4267 a Mike Heeter idea.
4259
4268
4260 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4269 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4261 plot() and replot(). Much more convenient now, especially for
4270 plot() and replot(). Much more convenient now, especially for
4262 interactive use.
4271 interactive use.
4263
4272
4264 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4273 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4265 filenames.
4274 filenames.
4266
4275
4267 2002-06-02 Fernando Perez <fperez@colorado.edu>
4276 2002-06-02 Fernando Perez <fperez@colorado.edu>
4268
4277
4269 * IPython/Struct.py (Struct.__init__): modified to admit
4278 * IPython/Struct.py (Struct.__init__): modified to admit
4270 initialization via another struct.
4279 initialization via another struct.
4271
4280
4272 * IPython/genutils.py (SystemExec.__init__): New stateful
4281 * IPython/genutils.py (SystemExec.__init__): New stateful
4273 interface to xsys and bq. Useful for writing system scripts.
4282 interface to xsys and bq. Useful for writing system scripts.
4274
4283
4275 2002-05-30 Fernando Perez <fperez@colorado.edu>
4284 2002-05-30 Fernando Perez <fperez@colorado.edu>
4276
4285
4277 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4286 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4278 documents. This will make the user download smaller (it's getting
4287 documents. This will make the user download smaller (it's getting
4279 too big).
4288 too big).
4280
4289
4281 2002-05-29 Fernando Perez <fperez@colorado.edu>
4290 2002-05-29 Fernando Perez <fperez@colorado.edu>
4282
4291
4283 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4292 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4284 fix problems with shelve and pickle. Seems to work, but I don't
4293 fix problems with shelve and pickle. Seems to work, but I don't
4285 know if corner cases break it. Thanks to Mike Heeter
4294 know if corner cases break it. Thanks to Mike Heeter
4286 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4295 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4287
4296
4288 2002-05-24 Fernando Perez <fperez@colorado.edu>
4297 2002-05-24 Fernando Perez <fperez@colorado.edu>
4289
4298
4290 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4299 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4291 macros having broken.
4300 macros having broken.
4292
4301
4293 2002-05-21 Fernando Perez <fperez@colorado.edu>
4302 2002-05-21 Fernando Perez <fperez@colorado.edu>
4294
4303
4295 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4304 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4296 introduced logging bug: all history before logging started was
4305 introduced logging bug: all history before logging started was
4297 being written one character per line! This came from the redesign
4306 being written one character per line! This came from the redesign
4298 of the input history as a special list which slices to strings,
4307 of the input history as a special list which slices to strings,
4299 not to lists.
4308 not to lists.
4300
4309
4301 2002-05-20 Fernando Perez <fperez@colorado.edu>
4310 2002-05-20 Fernando Perez <fperez@colorado.edu>
4302
4311
4303 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4312 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4304 be an attribute of all classes in this module. The design of these
4313 be an attribute of all classes in this module. The design of these
4305 classes needs some serious overhauling.
4314 classes needs some serious overhauling.
4306
4315
4307 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4316 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4308 which was ignoring '_' in option names.
4317 which was ignoring '_' in option names.
4309
4318
4310 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4319 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4311 'Verbose_novars' to 'Context' and made it the new default. It's a
4320 'Verbose_novars' to 'Context' and made it the new default. It's a
4312 bit more readable and also safer than verbose.
4321 bit more readable and also safer than verbose.
4313
4322
4314 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4323 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4315 triple-quoted strings.
4324 triple-quoted strings.
4316
4325
4317 * IPython/OInspect.py (__all__): new module exposing the object
4326 * IPython/OInspect.py (__all__): new module exposing the object
4318 introspection facilities. Now the corresponding magics are dummy
4327 introspection facilities. Now the corresponding magics are dummy
4319 wrappers around this. Having this module will make it much easier
4328 wrappers around this. Having this module will make it much easier
4320 to put these functions into our modified pdb.
4329 to put these functions into our modified pdb.
4321 This new object inspector system uses the new colorizing module,
4330 This new object inspector system uses the new colorizing module,
4322 so source code and other things are nicely syntax highlighted.
4331 so source code and other things are nicely syntax highlighted.
4323
4332
4324 2002-05-18 Fernando Perez <fperez@colorado.edu>
4333 2002-05-18 Fernando Perez <fperez@colorado.edu>
4325
4334
4326 * IPython/ColorANSI.py: Split the coloring tools into a separate
4335 * IPython/ColorANSI.py: Split the coloring tools into a separate
4327 module so I can use them in other code easier (they were part of
4336 module so I can use them in other code easier (they were part of
4328 ultraTB).
4337 ultraTB).
4329
4338
4330 2002-05-17 Fernando Perez <fperez@colorado.edu>
4339 2002-05-17 Fernando Perez <fperez@colorado.edu>
4331
4340
4332 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4341 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4333 fixed it to set the global 'g' also to the called instance, as
4342 fixed it to set the global 'g' also to the called instance, as
4334 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4343 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4335 user's 'g' variables).
4344 user's 'g' variables).
4336
4345
4337 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4346 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4338 global variables (aliases to _ih,_oh) so that users which expect
4347 global variables (aliases to _ih,_oh) so that users which expect
4339 In[5] or Out[7] to work aren't unpleasantly surprised.
4348 In[5] or Out[7] to work aren't unpleasantly surprised.
4340 (InputList.__getslice__): new class to allow executing slices of
4349 (InputList.__getslice__): new class to allow executing slices of
4341 input history directly. Very simple class, complements the use of
4350 input history directly. Very simple class, complements the use of
4342 macros.
4351 macros.
4343
4352
4344 2002-05-16 Fernando Perez <fperez@colorado.edu>
4353 2002-05-16 Fernando Perez <fperez@colorado.edu>
4345
4354
4346 * setup.py (docdirbase): make doc directory be just doc/IPython
4355 * setup.py (docdirbase): make doc directory be just doc/IPython
4347 without version numbers, it will reduce clutter for users.
4356 without version numbers, it will reduce clutter for users.
4348
4357
4349 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4358 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4350 execfile call to prevent possible memory leak. See for details:
4359 execfile call to prevent possible memory leak. See for details:
4351 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4360 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4352
4361
4353 2002-05-15 Fernando Perez <fperez@colorado.edu>
4362 2002-05-15 Fernando Perez <fperez@colorado.edu>
4354
4363
4355 * IPython/Magic.py (Magic.magic_psource): made the object
4364 * IPython/Magic.py (Magic.magic_psource): made the object
4356 introspection names be more standard: pdoc, pdef, pfile and
4365 introspection names be more standard: pdoc, pdef, pfile and
4357 psource. They all print/page their output, and it makes
4366 psource. They all print/page their output, and it makes
4358 remembering them easier. Kept old names for compatibility as
4367 remembering them easier. Kept old names for compatibility as
4359 aliases.
4368 aliases.
4360
4369
4361 2002-05-14 Fernando Perez <fperez@colorado.edu>
4370 2002-05-14 Fernando Perez <fperez@colorado.edu>
4362
4371
4363 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4372 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4364 what the mouse problem was. The trick is to use gnuplot with temp
4373 what the mouse problem was. The trick is to use gnuplot with temp
4365 files and NOT with pipes (for data communication), because having
4374 files and NOT with pipes (for data communication), because having
4366 both pipes and the mouse on is bad news.
4375 both pipes and the mouse on is bad news.
4367
4376
4368 2002-05-13 Fernando Perez <fperez@colorado.edu>
4377 2002-05-13 Fernando Perez <fperez@colorado.edu>
4369
4378
4370 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4379 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4371 bug. Information would be reported about builtins even when
4380 bug. Information would be reported about builtins even when
4372 user-defined functions overrode them.
4381 user-defined functions overrode them.
4373
4382
4374 2002-05-11 Fernando Perez <fperez@colorado.edu>
4383 2002-05-11 Fernando Perez <fperez@colorado.edu>
4375
4384
4376 * IPython/__init__.py (__all__): removed FlexCompleter from
4385 * IPython/__init__.py (__all__): removed FlexCompleter from
4377 __all__ so that things don't fail in platforms without readline.
4386 __all__ so that things don't fail in platforms without readline.
4378
4387
4379 2002-05-10 Fernando Perez <fperez@colorado.edu>
4388 2002-05-10 Fernando Perez <fperez@colorado.edu>
4380
4389
4381 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4390 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4382 it requires Numeric, effectively making Numeric a dependency for
4391 it requires Numeric, effectively making Numeric a dependency for
4383 IPython.
4392 IPython.
4384
4393
4385 * Released 0.2.13
4394 * Released 0.2.13
4386
4395
4387 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4396 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4388 profiler interface. Now all the major options from the profiler
4397 profiler interface. Now all the major options from the profiler
4389 module are directly supported in IPython, both for single
4398 module are directly supported in IPython, both for single
4390 expressions (@prun) and for full programs (@run -p).
4399 expressions (@prun) and for full programs (@run -p).
4391
4400
4392 2002-05-09 Fernando Perez <fperez@colorado.edu>
4401 2002-05-09 Fernando Perez <fperez@colorado.edu>
4393
4402
4394 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4403 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4395 magic properly formatted for screen.
4404 magic properly formatted for screen.
4396
4405
4397 * setup.py (make_shortcut): Changed things to put pdf version in
4406 * setup.py (make_shortcut): Changed things to put pdf version in
4398 doc/ instead of doc/manual (had to change lyxport a bit).
4407 doc/ instead of doc/manual (had to change lyxport a bit).
4399
4408
4400 * IPython/Magic.py (Profile.string_stats): made profile runs go
4409 * IPython/Magic.py (Profile.string_stats): made profile runs go
4401 through pager (they are long and a pager allows searching, saving,
4410 through pager (they are long and a pager allows searching, saving,
4402 etc.)
4411 etc.)
4403
4412
4404 2002-05-08 Fernando Perez <fperez@colorado.edu>
4413 2002-05-08 Fernando Perez <fperez@colorado.edu>
4405
4414
4406 * Released 0.2.12
4415 * Released 0.2.12
4407
4416
4408 2002-05-06 Fernando Perez <fperez@colorado.edu>
4417 2002-05-06 Fernando Perez <fperez@colorado.edu>
4409
4418
4410 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4419 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4411 introduced); 'hist n1 n2' was broken.
4420 introduced); 'hist n1 n2' was broken.
4412 (Magic.magic_pdb): added optional on/off arguments to @pdb
4421 (Magic.magic_pdb): added optional on/off arguments to @pdb
4413 (Magic.magic_run): added option -i to @run, which executes code in
4422 (Magic.magic_run): added option -i to @run, which executes code in
4414 the IPython namespace instead of a clean one. Also added @irun as
4423 the IPython namespace instead of a clean one. Also added @irun as
4415 an alias to @run -i.
4424 an alias to @run -i.
4416
4425
4417 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4426 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4418 fixed (it didn't really do anything, the namespaces were wrong).
4427 fixed (it didn't really do anything, the namespaces were wrong).
4419
4428
4420 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4429 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4421
4430
4422 * IPython/__init__.py (__all__): Fixed package namespace, now
4431 * IPython/__init__.py (__all__): Fixed package namespace, now
4423 'import IPython' does give access to IPython.<all> as
4432 'import IPython' does give access to IPython.<all> as
4424 expected. Also renamed __release__ to Release.
4433 expected. Also renamed __release__ to Release.
4425
4434
4426 * IPython/Debugger.py (__license__): created new Pdb class which
4435 * IPython/Debugger.py (__license__): created new Pdb class which
4427 functions like a drop-in for the normal pdb.Pdb but does NOT
4436 functions like a drop-in for the normal pdb.Pdb but does NOT
4428 import readline by default. This way it doesn't muck up IPython's
4437 import readline by default. This way it doesn't muck up IPython's
4429 readline handling, and now tab-completion finally works in the
4438 readline handling, and now tab-completion finally works in the
4430 debugger -- sort of. It completes things globally visible, but the
4439 debugger -- sort of. It completes things globally visible, but the
4431 completer doesn't track the stack as pdb walks it. That's a bit
4440 completer doesn't track the stack as pdb walks it. That's a bit
4432 tricky, and I'll have to implement it later.
4441 tricky, and I'll have to implement it later.
4433
4442
4434 2002-05-05 Fernando Perez <fperez@colorado.edu>
4443 2002-05-05 Fernando Perez <fperez@colorado.edu>
4435
4444
4436 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4445 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4437 magic docstrings when printed via ? (explicit \'s were being
4446 magic docstrings when printed via ? (explicit \'s were being
4438 printed).
4447 printed).
4439
4448
4440 * IPython/ipmaker.py (make_IPython): fixed namespace
4449 * IPython/ipmaker.py (make_IPython): fixed namespace
4441 identification bug. Now variables loaded via logs or command-line
4450 identification bug. Now variables loaded via logs or command-line
4442 files are recognized in the interactive namespace by @who.
4451 files are recognized in the interactive namespace by @who.
4443
4452
4444 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4453 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4445 log replay system stemming from the string form of Structs.
4454 log replay system stemming from the string form of Structs.
4446
4455
4447 * IPython/Magic.py (Macro.__init__): improved macros to properly
4456 * IPython/Magic.py (Macro.__init__): improved macros to properly
4448 handle magic commands in them.
4457 handle magic commands in them.
4449 (Magic.magic_logstart): usernames are now expanded so 'logstart
4458 (Magic.magic_logstart): usernames are now expanded so 'logstart
4450 ~/mylog' now works.
4459 ~/mylog' now works.
4451
4460
4452 * IPython/iplib.py (complete): fixed bug where paths starting with
4461 * IPython/iplib.py (complete): fixed bug where paths starting with
4453 '/' would be completed as magic names.
4462 '/' would be completed as magic names.
4454
4463
4455 2002-05-04 Fernando Perez <fperez@colorado.edu>
4464 2002-05-04 Fernando Perez <fperez@colorado.edu>
4456
4465
4457 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4466 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4458 allow running full programs under the profiler's control.
4467 allow running full programs under the profiler's control.
4459
4468
4460 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4469 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4461 mode to report exceptions verbosely but without formatting
4470 mode to report exceptions verbosely but without formatting
4462 variables. This addresses the issue of ipython 'freezing' (it's
4471 variables. This addresses the issue of ipython 'freezing' (it's
4463 not frozen, but caught in an expensive formatting loop) when huge
4472 not frozen, but caught in an expensive formatting loop) when huge
4464 variables are in the context of an exception.
4473 variables are in the context of an exception.
4465 (VerboseTB.text): Added '--->' markers at line where exception was
4474 (VerboseTB.text): Added '--->' markers at line where exception was
4466 triggered. Much clearer to read, especially in NoColor modes.
4475 triggered. Much clearer to read, especially in NoColor modes.
4467
4476
4468 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4477 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4469 implemented in reverse when changing to the new parse_options().
4478 implemented in reverse when changing to the new parse_options().
4470
4479
4471 2002-05-03 Fernando Perez <fperez@colorado.edu>
4480 2002-05-03 Fernando Perez <fperez@colorado.edu>
4472
4481
4473 * IPython/Magic.py (Magic.parse_options): new function so that
4482 * IPython/Magic.py (Magic.parse_options): new function so that
4474 magics can parse options easier.
4483 magics can parse options easier.
4475 (Magic.magic_prun): new function similar to profile.run(),
4484 (Magic.magic_prun): new function similar to profile.run(),
4476 suggested by Chris Hart.
4485 suggested by Chris Hart.
4477 (Magic.magic_cd): fixed behavior so that it only changes if
4486 (Magic.magic_cd): fixed behavior so that it only changes if
4478 directory actually is in history.
4487 directory actually is in history.
4479
4488
4480 * IPython/usage.py (__doc__): added information about potential
4489 * IPython/usage.py (__doc__): added information about potential
4481 slowness of Verbose exception mode when there are huge data
4490 slowness of Verbose exception mode when there are huge data
4482 structures to be formatted (thanks to Archie Paulson).
4491 structures to be formatted (thanks to Archie Paulson).
4483
4492
4484 * IPython/ipmaker.py (make_IPython): Changed default logging
4493 * IPython/ipmaker.py (make_IPython): Changed default logging
4485 (when simply called with -log) to use curr_dir/ipython.log in
4494 (when simply called with -log) to use curr_dir/ipython.log in
4486 rotate mode. Fixed crash which was occuring with -log before
4495 rotate mode. Fixed crash which was occuring with -log before
4487 (thanks to Jim Boyle).
4496 (thanks to Jim Boyle).
4488
4497
4489 2002-05-01 Fernando Perez <fperez@colorado.edu>
4498 2002-05-01 Fernando Perez <fperez@colorado.edu>
4490
4499
4491 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4500 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4492 was nasty -- though somewhat of a corner case).
4501 was nasty -- though somewhat of a corner case).
4493
4502
4494 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4503 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4495 text (was a bug).
4504 text (was a bug).
4496
4505
4497 2002-04-30 Fernando Perez <fperez@colorado.edu>
4506 2002-04-30 Fernando Perez <fperez@colorado.edu>
4498
4507
4499 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4508 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4500 a print after ^D or ^C from the user so that the In[] prompt
4509 a print after ^D or ^C from the user so that the In[] prompt
4501 doesn't over-run the gnuplot one.
4510 doesn't over-run the gnuplot one.
4502
4511
4503 2002-04-29 Fernando Perez <fperez@colorado.edu>
4512 2002-04-29 Fernando Perez <fperez@colorado.edu>
4504
4513
4505 * Released 0.2.10
4514 * Released 0.2.10
4506
4515
4507 * IPython/__release__.py (version): get date dynamically.
4516 * IPython/__release__.py (version): get date dynamically.
4508
4517
4509 * Misc. documentation updates thanks to Arnd's comments. Also ran
4518 * Misc. documentation updates thanks to Arnd's comments. Also ran
4510 a full spellcheck on the manual (hadn't been done in a while).
4519 a full spellcheck on the manual (hadn't been done in a while).
4511
4520
4512 2002-04-27 Fernando Perez <fperez@colorado.edu>
4521 2002-04-27 Fernando Perez <fperez@colorado.edu>
4513
4522
4514 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4523 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4515 starting a log in mid-session would reset the input history list.
4524 starting a log in mid-session would reset the input history list.
4516
4525
4517 2002-04-26 Fernando Perez <fperez@colorado.edu>
4526 2002-04-26 Fernando Perez <fperez@colorado.edu>
4518
4527
4519 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4528 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4520 all files were being included in an update. Now anything in
4529 all files were being included in an update. Now anything in
4521 UserConfig that matches [A-Za-z]*.py will go (this excludes
4530 UserConfig that matches [A-Za-z]*.py will go (this excludes
4522 __init__.py)
4531 __init__.py)
4523
4532
4524 2002-04-25 Fernando Perez <fperez@colorado.edu>
4533 2002-04-25 Fernando Perez <fperez@colorado.edu>
4525
4534
4526 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4535 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4527 to __builtins__ so that any form of embedded or imported code can
4536 to __builtins__ so that any form of embedded or imported code can
4528 test for being inside IPython.
4537 test for being inside IPython.
4529
4538
4530 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4539 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4531 changed to GnuplotMagic because it's now an importable module,
4540 changed to GnuplotMagic because it's now an importable module,
4532 this makes the name follow that of the standard Gnuplot module.
4541 this makes the name follow that of the standard Gnuplot module.
4533 GnuplotMagic can now be loaded at any time in mid-session.
4542 GnuplotMagic can now be loaded at any time in mid-session.
4534
4543
4535 2002-04-24 Fernando Perez <fperez@colorado.edu>
4544 2002-04-24 Fernando Perez <fperez@colorado.edu>
4536
4545
4537 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4546 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4538 the globals (IPython has its own namespace) and the
4547 the globals (IPython has its own namespace) and the
4539 PhysicalQuantity stuff is much better anyway.
4548 PhysicalQuantity stuff is much better anyway.
4540
4549
4541 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4550 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4542 embedding example to standard user directory for
4551 embedding example to standard user directory for
4543 distribution. Also put it in the manual.
4552 distribution. Also put it in the manual.
4544
4553
4545 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4554 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4546 instance as first argument (so it doesn't rely on some obscure
4555 instance as first argument (so it doesn't rely on some obscure
4547 hidden global).
4556 hidden global).
4548
4557
4549 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4558 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4550 delimiters. While it prevents ().TAB from working, it allows
4559 delimiters. While it prevents ().TAB from working, it allows
4551 completions in open (... expressions. This is by far a more common
4560 completions in open (... expressions. This is by far a more common
4552 case.
4561 case.
4553
4562
4554 2002-04-23 Fernando Perez <fperez@colorado.edu>
4563 2002-04-23 Fernando Perez <fperez@colorado.edu>
4555
4564
4556 * IPython/Extensions/InterpreterPasteInput.py: new
4565 * IPython/Extensions/InterpreterPasteInput.py: new
4557 syntax-processing module for pasting lines with >>> or ... at the
4566 syntax-processing module for pasting lines with >>> or ... at the
4558 start.
4567 start.
4559
4568
4560 * IPython/Extensions/PhysicalQ_Interactive.py
4569 * IPython/Extensions/PhysicalQ_Interactive.py
4561 (PhysicalQuantityInteractive.__int__): fixed to work with either
4570 (PhysicalQuantityInteractive.__int__): fixed to work with either
4562 Numeric or math.
4571 Numeric or math.
4563
4572
4564 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4573 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4565 provided profiles. Now we have:
4574 provided profiles. Now we have:
4566 -math -> math module as * and cmath with its own namespace.
4575 -math -> math module as * and cmath with its own namespace.
4567 -numeric -> Numeric as *, plus gnuplot & grace
4576 -numeric -> Numeric as *, plus gnuplot & grace
4568 -physics -> same as before
4577 -physics -> same as before
4569
4578
4570 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4579 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4571 user-defined magics wouldn't be found by @magic if they were
4580 user-defined magics wouldn't be found by @magic if they were
4572 defined as class methods. Also cleaned up the namespace search
4581 defined as class methods. Also cleaned up the namespace search
4573 logic and the string building (to use %s instead of many repeated
4582 logic and the string building (to use %s instead of many repeated
4574 string adds).
4583 string adds).
4575
4584
4576 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4585 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4577 of user-defined magics to operate with class methods (cleaner, in
4586 of user-defined magics to operate with class methods (cleaner, in
4578 line with the gnuplot code).
4587 line with the gnuplot code).
4579
4588
4580 2002-04-22 Fernando Perez <fperez@colorado.edu>
4589 2002-04-22 Fernando Perez <fperez@colorado.edu>
4581
4590
4582 * setup.py: updated dependency list so that manual is updated when
4591 * setup.py: updated dependency list so that manual is updated when
4583 all included files change.
4592 all included files change.
4584
4593
4585 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4594 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4586 the delimiter removal option (the fix is ugly right now).
4595 the delimiter removal option (the fix is ugly right now).
4587
4596
4588 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4597 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4589 all of the math profile (quicker loading, no conflict between
4598 all of the math profile (quicker loading, no conflict between
4590 g-9.8 and g-gnuplot).
4599 g-9.8 and g-gnuplot).
4591
4600
4592 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4601 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4593 name of post-mortem files to IPython_crash_report.txt.
4602 name of post-mortem files to IPython_crash_report.txt.
4594
4603
4595 * Cleanup/update of the docs. Added all the new readline info and
4604 * Cleanup/update of the docs. Added all the new readline info and
4596 formatted all lists as 'real lists'.
4605 formatted all lists as 'real lists'.
4597
4606
4598 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4607 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4599 tab-completion options, since the full readline parse_and_bind is
4608 tab-completion options, since the full readline parse_and_bind is
4600 now accessible.
4609 now accessible.
4601
4610
4602 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4611 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4603 handling of readline options. Now users can specify any string to
4612 handling of readline options. Now users can specify any string to
4604 be passed to parse_and_bind(), as well as the delimiters to be
4613 be passed to parse_and_bind(), as well as the delimiters to be
4605 removed.
4614 removed.
4606 (InteractiveShell.__init__): Added __name__ to the global
4615 (InteractiveShell.__init__): Added __name__ to the global
4607 namespace so that things like Itpl which rely on its existence
4616 namespace so that things like Itpl which rely on its existence
4608 don't crash.
4617 don't crash.
4609 (InteractiveShell._prefilter): Defined the default with a _ so
4618 (InteractiveShell._prefilter): Defined the default with a _ so
4610 that prefilter() is easier to override, while the default one
4619 that prefilter() is easier to override, while the default one
4611 remains available.
4620 remains available.
4612
4621
4613 2002-04-18 Fernando Perez <fperez@colorado.edu>
4622 2002-04-18 Fernando Perez <fperez@colorado.edu>
4614
4623
4615 * Added information about pdb in the docs.
4624 * Added information about pdb in the docs.
4616
4625
4617 2002-04-17 Fernando Perez <fperez@colorado.edu>
4626 2002-04-17 Fernando Perez <fperez@colorado.edu>
4618
4627
4619 * IPython/ipmaker.py (make_IPython): added rc_override option to
4628 * IPython/ipmaker.py (make_IPython): added rc_override option to
4620 allow passing config options at creation time which may override
4629 allow passing config options at creation time which may override
4621 anything set in the config files or command line. This is
4630 anything set in the config files or command line. This is
4622 particularly useful for configuring embedded instances.
4631 particularly useful for configuring embedded instances.
4623
4632
4624 2002-04-15 Fernando Perez <fperez@colorado.edu>
4633 2002-04-15 Fernando Perez <fperez@colorado.edu>
4625
4634
4626 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4635 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4627 crash embedded instances because of the input cache falling out of
4636 crash embedded instances because of the input cache falling out of
4628 sync with the output counter.
4637 sync with the output counter.
4629
4638
4630 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4639 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4631 mode which calls pdb after an uncaught exception in IPython itself.
4640 mode which calls pdb after an uncaught exception in IPython itself.
4632
4641
4633 2002-04-14 Fernando Perez <fperez@colorado.edu>
4642 2002-04-14 Fernando Perez <fperez@colorado.edu>
4634
4643
4635 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4644 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4636 readline, fix it back after each call.
4645 readline, fix it back after each call.
4637
4646
4638 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4647 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4639 method to force all access via __call__(), which guarantees that
4648 method to force all access via __call__(), which guarantees that
4640 traceback references are properly deleted.
4649 traceback references are properly deleted.
4641
4650
4642 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4651 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4643 improve printing when pprint is in use.
4652 improve printing when pprint is in use.
4644
4653
4645 2002-04-13 Fernando Perez <fperez@colorado.edu>
4654 2002-04-13 Fernando Perez <fperez@colorado.edu>
4646
4655
4647 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4656 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4648 exceptions aren't caught anymore. If the user triggers one, he
4657 exceptions aren't caught anymore. If the user triggers one, he
4649 should know why he's doing it and it should go all the way up,
4658 should know why he's doing it and it should go all the way up,
4650 just like any other exception. So now @abort will fully kill the
4659 just like any other exception. So now @abort will fully kill the
4651 embedded interpreter and the embedding code (unless that happens
4660 embedded interpreter and the embedding code (unless that happens
4652 to catch SystemExit).
4661 to catch SystemExit).
4653
4662
4654 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4663 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4655 and a debugger() method to invoke the interactive pdb debugger
4664 and a debugger() method to invoke the interactive pdb debugger
4656 after printing exception information. Also added the corresponding
4665 after printing exception information. Also added the corresponding
4657 -pdb option and @pdb magic to control this feature, and updated
4666 -pdb option and @pdb magic to control this feature, and updated
4658 the docs. After a suggestion from Christopher Hart
4667 the docs. After a suggestion from Christopher Hart
4659 (hart-AT-caltech.edu).
4668 (hart-AT-caltech.edu).
4660
4669
4661 2002-04-12 Fernando Perez <fperez@colorado.edu>
4670 2002-04-12 Fernando Perez <fperez@colorado.edu>
4662
4671
4663 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4672 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4664 the exception handlers defined by the user (not the CrashHandler)
4673 the exception handlers defined by the user (not the CrashHandler)
4665 so that user exceptions don't trigger an ipython bug report.
4674 so that user exceptions don't trigger an ipython bug report.
4666
4675
4667 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4676 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4668 configurable (it should have always been so).
4677 configurable (it should have always been so).
4669
4678
4670 2002-03-26 Fernando Perez <fperez@colorado.edu>
4679 2002-03-26 Fernando Perez <fperez@colorado.edu>
4671
4680
4672 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4681 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4673 and there to fix embedding namespace issues. This should all be
4682 and there to fix embedding namespace issues. This should all be
4674 done in a more elegant way.
4683 done in a more elegant way.
4675
4684
4676 2002-03-25 Fernando Perez <fperez@colorado.edu>
4685 2002-03-25 Fernando Perez <fperez@colorado.edu>
4677
4686
4678 * IPython/genutils.py (get_home_dir): Try to make it work under
4687 * IPython/genutils.py (get_home_dir): Try to make it work under
4679 win9x also.
4688 win9x also.
4680
4689
4681 2002-03-20 Fernando Perez <fperez@colorado.edu>
4690 2002-03-20 Fernando Perez <fperez@colorado.edu>
4682
4691
4683 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4692 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4684 sys.displayhook untouched upon __init__.
4693 sys.displayhook untouched upon __init__.
4685
4694
4686 2002-03-19 Fernando Perez <fperez@colorado.edu>
4695 2002-03-19 Fernando Perez <fperez@colorado.edu>
4687
4696
4688 * Released 0.2.9 (for embedding bug, basically).
4697 * Released 0.2.9 (for embedding bug, basically).
4689
4698
4690 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4699 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4691 exceptions so that enclosing shell's state can be restored.
4700 exceptions so that enclosing shell's state can be restored.
4692
4701
4693 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4702 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4694 naming conventions in the .ipython/ dir.
4703 naming conventions in the .ipython/ dir.
4695
4704
4696 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4705 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4697 from delimiters list so filenames with - in them get expanded.
4706 from delimiters list so filenames with - in them get expanded.
4698
4707
4699 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4708 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4700 sys.displayhook not being properly restored after an embedded call.
4709 sys.displayhook not being properly restored after an embedded call.
4701
4710
4702 2002-03-18 Fernando Perez <fperez@colorado.edu>
4711 2002-03-18 Fernando Perez <fperez@colorado.edu>
4703
4712
4704 * Released 0.2.8
4713 * Released 0.2.8
4705
4714
4706 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4715 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4707 some files weren't being included in a -upgrade.
4716 some files weren't being included in a -upgrade.
4708 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4717 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4709 on' so that the first tab completes.
4718 on' so that the first tab completes.
4710 (InteractiveShell.handle_magic): fixed bug with spaces around
4719 (InteractiveShell.handle_magic): fixed bug with spaces around
4711 quotes breaking many magic commands.
4720 quotes breaking many magic commands.
4712
4721
4713 * setup.py: added note about ignoring the syntax error messages at
4722 * setup.py: added note about ignoring the syntax error messages at
4714 installation.
4723 installation.
4715
4724
4716 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4725 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4717 streamlining the gnuplot interface, now there's only one magic @gp.
4726 streamlining the gnuplot interface, now there's only one magic @gp.
4718
4727
4719 2002-03-17 Fernando Perez <fperez@colorado.edu>
4728 2002-03-17 Fernando Perez <fperez@colorado.edu>
4720
4729
4721 * IPython/UserConfig/magic_gnuplot.py: new name for the
4730 * IPython/UserConfig/magic_gnuplot.py: new name for the
4722 example-magic_pm.py file. Much enhanced system, now with a shell
4731 example-magic_pm.py file. Much enhanced system, now with a shell
4723 for communicating directly with gnuplot, one command at a time.
4732 for communicating directly with gnuplot, one command at a time.
4724
4733
4725 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4734 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4726 setting __name__=='__main__'.
4735 setting __name__=='__main__'.
4727
4736
4728 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4737 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4729 mini-shell for accessing gnuplot from inside ipython. Should
4738 mini-shell for accessing gnuplot from inside ipython. Should
4730 extend it later for grace access too. Inspired by Arnd's
4739 extend it later for grace access too. Inspired by Arnd's
4731 suggestion.
4740 suggestion.
4732
4741
4733 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4742 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4734 calling magic functions with () in their arguments. Thanks to Arnd
4743 calling magic functions with () in their arguments. Thanks to Arnd
4735 Baecker for pointing this to me.
4744 Baecker for pointing this to me.
4736
4745
4737 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4746 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4738 infinitely for integer or complex arrays (only worked with floats).
4747 infinitely for integer or complex arrays (only worked with floats).
4739
4748
4740 2002-03-16 Fernando Perez <fperez@colorado.edu>
4749 2002-03-16 Fernando Perez <fperez@colorado.edu>
4741
4750
4742 * setup.py: Merged setup and setup_windows into a single script
4751 * setup.py: Merged setup and setup_windows into a single script
4743 which properly handles things for windows users.
4752 which properly handles things for windows users.
4744
4753
4745 2002-03-15 Fernando Perez <fperez@colorado.edu>
4754 2002-03-15 Fernando Perez <fperez@colorado.edu>
4746
4755
4747 * Big change to the manual: now the magics are all automatically
4756 * Big change to the manual: now the magics are all automatically
4748 documented. This information is generated from their docstrings
4757 documented. This information is generated from their docstrings
4749 and put in a latex file included by the manual lyx file. This way
4758 and put in a latex file included by the manual lyx file. This way
4750 we get always up to date information for the magics. The manual
4759 we get always up to date information for the magics. The manual
4751 now also has proper version information, also auto-synced.
4760 now also has proper version information, also auto-synced.
4752
4761
4753 For this to work, an undocumented --magic_docstrings option was added.
4762 For this to work, an undocumented --magic_docstrings option was added.
4754
4763
4755 2002-03-13 Fernando Perez <fperez@colorado.edu>
4764 2002-03-13 Fernando Perez <fperez@colorado.edu>
4756
4765
4757 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4766 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4758 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4767 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4759
4768
4760 2002-03-12 Fernando Perez <fperez@colorado.edu>
4769 2002-03-12 Fernando Perez <fperez@colorado.edu>
4761
4770
4762 * IPython/ultraTB.py (TermColors): changed color escapes again to
4771 * IPython/ultraTB.py (TermColors): changed color escapes again to
4763 fix the (old, reintroduced) line-wrapping bug. Basically, if
4772 fix the (old, reintroduced) line-wrapping bug. Basically, if
4764 \001..\002 aren't given in the color escapes, lines get wrapped
4773 \001..\002 aren't given in the color escapes, lines get wrapped
4765 weirdly. But giving those screws up old xterms and emacs terms. So
4774 weirdly. But giving those screws up old xterms and emacs terms. So
4766 I added some logic for emacs terms to be ok, but I can't identify old
4775 I added some logic for emacs terms to be ok, but I can't identify old
4767 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4776 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4768
4777
4769 2002-03-10 Fernando Perez <fperez@colorado.edu>
4778 2002-03-10 Fernando Perez <fperez@colorado.edu>
4770
4779
4771 * IPython/usage.py (__doc__): Various documentation cleanups and
4780 * IPython/usage.py (__doc__): Various documentation cleanups and
4772 updates, both in usage docstrings and in the manual.
4781 updates, both in usage docstrings and in the manual.
4773
4782
4774 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4783 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4775 handling of caching. Set minimum acceptabe value for having a
4784 handling of caching. Set minimum acceptabe value for having a
4776 cache at 20 values.
4785 cache at 20 values.
4777
4786
4778 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4787 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4779 install_first_time function to a method, renamed it and added an
4788 install_first_time function to a method, renamed it and added an
4780 'upgrade' mode. Now people can update their config directory with
4789 'upgrade' mode. Now people can update their config directory with
4781 a simple command line switch (-upgrade, also new).
4790 a simple command line switch (-upgrade, also new).
4782
4791
4783 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4792 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4784 @file (convenient for automagic users under Python >= 2.2).
4793 @file (convenient for automagic users under Python >= 2.2).
4785 Removed @files (it seemed more like a plural than an abbrev. of
4794 Removed @files (it seemed more like a plural than an abbrev. of
4786 'file show').
4795 'file show').
4787
4796
4788 * IPython/iplib.py (install_first_time): Fixed crash if there were
4797 * IPython/iplib.py (install_first_time): Fixed crash if there were
4789 backup files ('~') in .ipython/ install directory.
4798 backup files ('~') in .ipython/ install directory.
4790
4799
4791 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4800 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4792 system. Things look fine, but these changes are fairly
4801 system. Things look fine, but these changes are fairly
4793 intrusive. Test them for a few days.
4802 intrusive. Test them for a few days.
4794
4803
4795 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4804 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4796 the prompts system. Now all in/out prompt strings are user
4805 the prompts system. Now all in/out prompt strings are user
4797 controllable. This is particularly useful for embedding, as one
4806 controllable. This is particularly useful for embedding, as one
4798 can tag embedded instances with particular prompts.
4807 can tag embedded instances with particular prompts.
4799
4808
4800 Also removed global use of sys.ps1/2, which now allows nested
4809 Also removed global use of sys.ps1/2, which now allows nested
4801 embeddings without any problems. Added command-line options for
4810 embeddings without any problems. Added command-line options for
4802 the prompt strings.
4811 the prompt strings.
4803
4812
4804 2002-03-08 Fernando Perez <fperez@colorado.edu>
4813 2002-03-08 Fernando Perez <fperez@colorado.edu>
4805
4814
4806 * IPython/UserConfig/example-embed-short.py (ipshell): added
4815 * IPython/UserConfig/example-embed-short.py (ipshell): added
4807 example file with the bare minimum code for embedding.
4816 example file with the bare minimum code for embedding.
4808
4817
4809 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4818 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4810 functionality for the embeddable shell to be activated/deactivated
4819 functionality for the embeddable shell to be activated/deactivated
4811 either globally or at each call.
4820 either globally or at each call.
4812
4821
4813 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4822 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4814 rewriting the prompt with '--->' for auto-inputs with proper
4823 rewriting the prompt with '--->' for auto-inputs with proper
4815 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4824 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4816 this is handled by the prompts class itself, as it should.
4825 this is handled by the prompts class itself, as it should.
4817
4826
4818 2002-03-05 Fernando Perez <fperez@colorado.edu>
4827 2002-03-05 Fernando Perez <fperez@colorado.edu>
4819
4828
4820 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4829 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4821 @logstart to avoid name clashes with the math log function.
4830 @logstart to avoid name clashes with the math log function.
4822
4831
4823 * Big updates to X/Emacs section of the manual.
4832 * Big updates to X/Emacs section of the manual.
4824
4833
4825 * Removed ipython_emacs. Milan explained to me how to pass
4834 * Removed ipython_emacs. Milan explained to me how to pass
4826 arguments to ipython through Emacs. Some day I'm going to end up
4835 arguments to ipython through Emacs. Some day I'm going to end up
4827 learning some lisp...
4836 learning some lisp...
4828
4837
4829 2002-03-04 Fernando Perez <fperez@colorado.edu>
4838 2002-03-04 Fernando Perez <fperez@colorado.edu>
4830
4839
4831 * IPython/ipython_emacs: Created script to be used as the
4840 * IPython/ipython_emacs: Created script to be used as the
4832 py-python-command Emacs variable so we can pass IPython
4841 py-python-command Emacs variable so we can pass IPython
4833 parameters. I can't figure out how to tell Emacs directly to pass
4842 parameters. I can't figure out how to tell Emacs directly to pass
4834 parameters to IPython, so a dummy shell script will do it.
4843 parameters to IPython, so a dummy shell script will do it.
4835
4844
4836 Other enhancements made for things to work better under Emacs'
4845 Other enhancements made for things to work better under Emacs'
4837 various types of terminals. Many thanks to Milan Zamazal
4846 various types of terminals. Many thanks to Milan Zamazal
4838 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4847 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4839
4848
4840 2002-03-01 Fernando Perez <fperez@colorado.edu>
4849 2002-03-01 Fernando Perez <fperez@colorado.edu>
4841
4850
4842 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4851 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4843 that loading of readline is now optional. This gives better
4852 that loading of readline is now optional. This gives better
4844 control to emacs users.
4853 control to emacs users.
4845
4854
4846 * IPython/ultraTB.py (__date__): Modified color escape sequences
4855 * IPython/ultraTB.py (__date__): Modified color escape sequences
4847 and now things work fine under xterm and in Emacs' term buffers
4856 and now things work fine under xterm and in Emacs' term buffers
4848 (though not shell ones). Well, in emacs you get colors, but all
4857 (though not shell ones). Well, in emacs you get colors, but all
4849 seem to be 'light' colors (no difference between dark and light
4858 seem to be 'light' colors (no difference between dark and light
4850 ones). But the garbage chars are gone, and also in xterms. It
4859 ones). But the garbage chars are gone, and also in xterms. It
4851 seems that now I'm using 'cleaner' ansi sequences.
4860 seems that now I'm using 'cleaner' ansi sequences.
4852
4861
4853 2002-02-21 Fernando Perez <fperez@colorado.edu>
4862 2002-02-21 Fernando Perez <fperez@colorado.edu>
4854
4863
4855 * Released 0.2.7 (mainly to publish the scoping fix).
4864 * Released 0.2.7 (mainly to publish the scoping fix).
4856
4865
4857 * IPython/Logger.py (Logger.logstate): added. A corresponding
4866 * IPython/Logger.py (Logger.logstate): added. A corresponding
4858 @logstate magic was created.
4867 @logstate magic was created.
4859
4868
4860 * IPython/Magic.py: fixed nested scoping problem under Python
4869 * IPython/Magic.py: fixed nested scoping problem under Python
4861 2.1.x (automagic wasn't working).
4870 2.1.x (automagic wasn't working).
4862
4871
4863 2002-02-20 Fernando Perez <fperez@colorado.edu>
4872 2002-02-20 Fernando Perez <fperez@colorado.edu>
4864
4873
4865 * Released 0.2.6.
4874 * Released 0.2.6.
4866
4875
4867 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4876 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4868 option so that logs can come out without any headers at all.
4877 option so that logs can come out without any headers at all.
4869
4878
4870 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4879 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4871 SciPy.
4880 SciPy.
4872
4881
4873 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4882 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4874 that embedded IPython calls don't require vars() to be explicitly
4883 that embedded IPython calls don't require vars() to be explicitly
4875 passed. Now they are extracted from the caller's frame (code
4884 passed. Now they are extracted from the caller's frame (code
4876 snatched from Eric Jones' weave). Added better documentation to
4885 snatched from Eric Jones' weave). Added better documentation to
4877 the section on embedding and the example file.
4886 the section on embedding and the example file.
4878
4887
4879 * IPython/genutils.py (page): Changed so that under emacs, it just
4888 * IPython/genutils.py (page): Changed so that under emacs, it just
4880 prints the string. You can then page up and down in the emacs
4889 prints the string. You can then page up and down in the emacs
4881 buffer itself. This is how the builtin help() works.
4890 buffer itself. This is how the builtin help() works.
4882
4891
4883 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4892 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4884 macro scoping: macros need to be executed in the user's namespace
4893 macro scoping: macros need to be executed in the user's namespace
4885 to work as if they had been typed by the user.
4894 to work as if they had been typed by the user.
4886
4895
4887 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4896 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4888 execute automatically (no need to type 'exec...'). They then
4897 execute automatically (no need to type 'exec...'). They then
4889 behave like 'true macros'. The printing system was also modified
4898 behave like 'true macros'. The printing system was also modified
4890 for this to work.
4899 for this to work.
4891
4900
4892 2002-02-19 Fernando Perez <fperez@colorado.edu>
4901 2002-02-19 Fernando Perez <fperez@colorado.edu>
4893
4902
4894 * IPython/genutils.py (page_file): new function for paging files
4903 * IPython/genutils.py (page_file): new function for paging files
4895 in an OS-independent way. Also necessary for file viewing to work
4904 in an OS-independent way. Also necessary for file viewing to work
4896 well inside Emacs buffers.
4905 well inside Emacs buffers.
4897 (page): Added checks for being in an emacs buffer.
4906 (page): Added checks for being in an emacs buffer.
4898 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4907 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4899 same bug in iplib.
4908 same bug in iplib.
4900
4909
4901 2002-02-18 Fernando Perez <fperez@colorado.edu>
4910 2002-02-18 Fernando Perez <fperez@colorado.edu>
4902
4911
4903 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4912 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4904 of readline so that IPython can work inside an Emacs buffer.
4913 of readline so that IPython can work inside an Emacs buffer.
4905
4914
4906 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4915 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4907 method signatures (they weren't really bugs, but it looks cleaner
4916 method signatures (they weren't really bugs, but it looks cleaner
4908 and keeps PyChecker happy).
4917 and keeps PyChecker happy).
4909
4918
4910 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4919 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4911 for implementing various user-defined hooks. Currently only
4920 for implementing various user-defined hooks. Currently only
4912 display is done.
4921 display is done.
4913
4922
4914 * IPython/Prompts.py (CachedOutput._display): changed display
4923 * IPython/Prompts.py (CachedOutput._display): changed display
4915 functions so that they can be dynamically changed by users easily.
4924 functions so that they can be dynamically changed by users easily.
4916
4925
4917 * IPython/Extensions/numeric_formats.py (num_display): added an
4926 * IPython/Extensions/numeric_formats.py (num_display): added an
4918 extension for printing NumPy arrays in flexible manners. It
4927 extension for printing NumPy arrays in flexible manners. It
4919 doesn't do anything yet, but all the structure is in
4928 doesn't do anything yet, but all the structure is in
4920 place. Ultimately the plan is to implement output format control
4929 place. Ultimately the plan is to implement output format control
4921 like in Octave.
4930 like in Octave.
4922
4931
4923 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4932 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4924 methods are found at run-time by all the automatic machinery.
4933 methods are found at run-time by all the automatic machinery.
4925
4934
4926 2002-02-17 Fernando Perez <fperez@colorado.edu>
4935 2002-02-17 Fernando Perez <fperez@colorado.edu>
4927
4936
4928 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4937 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4929 whole file a little.
4938 whole file a little.
4930
4939
4931 * ToDo: closed this document. Now there's a new_design.lyx
4940 * ToDo: closed this document. Now there's a new_design.lyx
4932 document for all new ideas. Added making a pdf of it for the
4941 document for all new ideas. Added making a pdf of it for the
4933 end-user distro.
4942 end-user distro.
4934
4943
4935 * IPython/Logger.py (Logger.switch_log): Created this to replace
4944 * IPython/Logger.py (Logger.switch_log): Created this to replace
4936 logon() and logoff(). It also fixes a nasty crash reported by
4945 logon() and logoff(). It also fixes a nasty crash reported by
4937 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4946 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4938
4947
4939 * IPython/iplib.py (complete): got auto-completion to work with
4948 * IPython/iplib.py (complete): got auto-completion to work with
4940 automagic (I had wanted this for a long time).
4949 automagic (I had wanted this for a long time).
4941
4950
4942 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4951 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4943 to @file, since file() is now a builtin and clashes with automagic
4952 to @file, since file() is now a builtin and clashes with automagic
4944 for @file.
4953 for @file.
4945
4954
4946 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4955 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4947 of this was previously in iplib, which had grown to more than 2000
4956 of this was previously in iplib, which had grown to more than 2000
4948 lines, way too long. No new functionality, but it makes managing
4957 lines, way too long. No new functionality, but it makes managing
4949 the code a bit easier.
4958 the code a bit easier.
4950
4959
4951 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4960 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4952 information to crash reports.
4961 information to crash reports.
4953
4962
4954 2002-02-12 Fernando Perez <fperez@colorado.edu>
4963 2002-02-12 Fernando Perez <fperez@colorado.edu>
4955
4964
4956 * Released 0.2.5.
4965 * Released 0.2.5.
4957
4966
4958 2002-02-11 Fernando Perez <fperez@colorado.edu>
4967 2002-02-11 Fernando Perez <fperez@colorado.edu>
4959
4968
4960 * Wrote a relatively complete Windows installer. It puts
4969 * Wrote a relatively complete Windows installer. It puts
4961 everything in place, creates Start Menu entries and fixes the
4970 everything in place, creates Start Menu entries and fixes the
4962 color issues. Nothing fancy, but it works.
4971 color issues. Nothing fancy, but it works.
4963
4972
4964 2002-02-10 Fernando Perez <fperez@colorado.edu>
4973 2002-02-10 Fernando Perez <fperez@colorado.edu>
4965
4974
4966 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4975 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4967 os.path.expanduser() call so that we can type @run ~/myfile.py and
4976 os.path.expanduser() call so that we can type @run ~/myfile.py and
4968 have thigs work as expected.
4977 have thigs work as expected.
4969
4978
4970 * IPython/genutils.py (page): fixed exception handling so things
4979 * IPython/genutils.py (page): fixed exception handling so things
4971 work both in Unix and Windows correctly. Quitting a pager triggers
4980 work both in Unix and Windows correctly. Quitting a pager triggers
4972 an IOError/broken pipe in Unix, and in windows not finding a pager
4981 an IOError/broken pipe in Unix, and in windows not finding a pager
4973 is also an IOError, so I had to actually look at the return value
4982 is also an IOError, so I had to actually look at the return value
4974 of the exception, not just the exception itself. Should be ok now.
4983 of the exception, not just the exception itself. Should be ok now.
4975
4984
4976 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4985 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4977 modified to allow case-insensitive color scheme changes.
4986 modified to allow case-insensitive color scheme changes.
4978
4987
4979 2002-02-09 Fernando Perez <fperez@colorado.edu>
4988 2002-02-09 Fernando Perez <fperez@colorado.edu>
4980
4989
4981 * IPython/genutils.py (native_line_ends): new function to leave
4990 * IPython/genutils.py (native_line_ends): new function to leave
4982 user config files with os-native line-endings.
4991 user config files with os-native line-endings.
4983
4992
4984 * README and manual updates.
4993 * README and manual updates.
4985
4994
4986 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4995 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4987 instead of StringType to catch Unicode strings.
4996 instead of StringType to catch Unicode strings.
4988
4997
4989 * IPython/genutils.py (filefind): fixed bug for paths with
4998 * IPython/genutils.py (filefind): fixed bug for paths with
4990 embedded spaces (very common in Windows).
4999 embedded spaces (very common in Windows).
4991
5000
4992 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5001 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4993 files under Windows, so that they get automatically associated
5002 files under Windows, so that they get automatically associated
4994 with a text editor. Windows makes it a pain to handle
5003 with a text editor. Windows makes it a pain to handle
4995 extension-less files.
5004 extension-less files.
4996
5005
4997 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5006 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4998 warning about readline only occur for Posix. In Windows there's no
5007 warning about readline only occur for Posix. In Windows there's no
4999 way to get readline, so why bother with the warning.
5008 way to get readline, so why bother with the warning.
5000
5009
5001 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5010 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5002 for __str__ instead of dir(self), since dir() changed in 2.2.
5011 for __str__ instead of dir(self), since dir() changed in 2.2.
5003
5012
5004 * Ported to Windows! Tested on XP, I suspect it should work fine
5013 * Ported to Windows! Tested on XP, I suspect it should work fine
5005 on NT/2000, but I don't think it will work on 98 et al. That
5014 on NT/2000, but I don't think it will work on 98 et al. That
5006 series of Windows is such a piece of junk anyway that I won't try
5015 series of Windows is such a piece of junk anyway that I won't try
5007 porting it there. The XP port was straightforward, showed a few
5016 porting it there. The XP port was straightforward, showed a few
5008 bugs here and there (fixed all), in particular some string
5017 bugs here and there (fixed all), in particular some string
5009 handling stuff which required considering Unicode strings (which
5018 handling stuff which required considering Unicode strings (which
5010 Windows uses). This is good, but hasn't been too tested :) No
5019 Windows uses). This is good, but hasn't been too tested :) No
5011 fancy installer yet, I'll put a note in the manual so people at
5020 fancy installer yet, I'll put a note in the manual so people at
5012 least make manually a shortcut.
5021 least make manually a shortcut.
5013
5022
5014 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5023 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5015 into a single one, "colors". This now controls both prompt and
5024 into a single one, "colors". This now controls both prompt and
5016 exception color schemes, and can be changed both at startup
5025 exception color schemes, and can be changed both at startup
5017 (either via command-line switches or via ipythonrc files) and at
5026 (either via command-line switches or via ipythonrc files) and at
5018 runtime, with @colors.
5027 runtime, with @colors.
5019 (Magic.magic_run): renamed @prun to @run and removed the old
5028 (Magic.magic_run): renamed @prun to @run and removed the old
5020 @run. The two were too similar to warrant keeping both.
5029 @run. The two were too similar to warrant keeping both.
5021
5030
5022 2002-02-03 Fernando Perez <fperez@colorado.edu>
5031 2002-02-03 Fernando Perez <fperez@colorado.edu>
5023
5032
5024 * IPython/iplib.py (install_first_time): Added comment on how to
5033 * IPython/iplib.py (install_first_time): Added comment on how to
5025 configure the color options for first-time users. Put a <return>
5034 configure the color options for first-time users. Put a <return>
5026 request at the end so that small-terminal users get a chance to
5035 request at the end so that small-terminal users get a chance to
5027 read the startup info.
5036 read the startup info.
5028
5037
5029 2002-01-23 Fernando Perez <fperez@colorado.edu>
5038 2002-01-23 Fernando Perez <fperez@colorado.edu>
5030
5039
5031 * IPython/iplib.py (CachedOutput.update): Changed output memory
5040 * IPython/iplib.py (CachedOutput.update): Changed output memory
5032 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5041 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5033 input history we still use _i. Did this b/c these variable are
5042 input history we still use _i. Did this b/c these variable are
5034 very commonly used in interactive work, so the less we need to
5043 very commonly used in interactive work, so the less we need to
5035 type the better off we are.
5044 type the better off we are.
5036 (Magic.magic_prun): updated @prun to better handle the namespaces
5045 (Magic.magic_prun): updated @prun to better handle the namespaces
5037 the file will run in, including a fix for __name__ not being set
5046 the file will run in, including a fix for __name__ not being set
5038 before.
5047 before.
5039
5048
5040 2002-01-20 Fernando Perez <fperez@colorado.edu>
5049 2002-01-20 Fernando Perez <fperez@colorado.edu>
5041
5050
5042 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5051 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5043 extra garbage for Python 2.2. Need to look more carefully into
5052 extra garbage for Python 2.2. Need to look more carefully into
5044 this later.
5053 this later.
5045
5054
5046 2002-01-19 Fernando Perez <fperez@colorado.edu>
5055 2002-01-19 Fernando Perez <fperez@colorado.edu>
5047
5056
5048 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5057 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5049 display SyntaxError exceptions properly formatted when they occur
5058 display SyntaxError exceptions properly formatted when they occur
5050 (they can be triggered by imported code).
5059 (they can be triggered by imported code).
5051
5060
5052 2002-01-18 Fernando Perez <fperez@colorado.edu>
5061 2002-01-18 Fernando Perez <fperez@colorado.edu>
5053
5062
5054 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5063 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5055 SyntaxError exceptions are reported nicely formatted, instead of
5064 SyntaxError exceptions are reported nicely formatted, instead of
5056 spitting out only offset information as before.
5065 spitting out only offset information as before.
5057 (Magic.magic_prun): Added the @prun function for executing
5066 (Magic.magic_prun): Added the @prun function for executing
5058 programs with command line args inside IPython.
5067 programs with command line args inside IPython.
5059
5068
5060 2002-01-16 Fernando Perez <fperez@colorado.edu>
5069 2002-01-16 Fernando Perez <fperez@colorado.edu>
5061
5070
5062 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5071 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5063 to *not* include the last item given in a range. This brings their
5072 to *not* include the last item given in a range. This brings their
5064 behavior in line with Python's slicing:
5073 behavior in line with Python's slicing:
5065 a[n1:n2] -> a[n1]...a[n2-1]
5074 a[n1:n2] -> a[n1]...a[n2-1]
5066 It may be a bit less convenient, but I prefer to stick to Python's
5075 It may be a bit less convenient, but I prefer to stick to Python's
5067 conventions *everywhere*, so users never have to wonder.
5076 conventions *everywhere*, so users never have to wonder.
5068 (Magic.magic_macro): Added @macro function to ease the creation of
5077 (Magic.magic_macro): Added @macro function to ease the creation of
5069 macros.
5078 macros.
5070
5079
5071 2002-01-05 Fernando Perez <fperez@colorado.edu>
5080 2002-01-05 Fernando Perez <fperez@colorado.edu>
5072
5081
5073 * Released 0.2.4.
5082 * Released 0.2.4.
5074
5083
5075 * IPython/iplib.py (Magic.magic_pdef):
5084 * IPython/iplib.py (Magic.magic_pdef):
5076 (InteractiveShell.safe_execfile): report magic lines and error
5085 (InteractiveShell.safe_execfile): report magic lines and error
5077 lines without line numbers so one can easily copy/paste them for
5086 lines without line numbers so one can easily copy/paste them for
5078 re-execution.
5087 re-execution.
5079
5088
5080 * Updated manual with recent changes.
5089 * Updated manual with recent changes.
5081
5090
5082 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5091 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5083 docstring printing when class? is called. Very handy for knowing
5092 docstring printing when class? is called. Very handy for knowing
5084 how to create class instances (as long as __init__ is well
5093 how to create class instances (as long as __init__ is well
5085 documented, of course :)
5094 documented, of course :)
5086 (Magic.magic_doc): print both class and constructor docstrings.
5095 (Magic.magic_doc): print both class and constructor docstrings.
5087 (Magic.magic_pdef): give constructor info if passed a class and
5096 (Magic.magic_pdef): give constructor info if passed a class and
5088 __call__ info for callable object instances.
5097 __call__ info for callable object instances.
5089
5098
5090 2002-01-04 Fernando Perez <fperez@colorado.edu>
5099 2002-01-04 Fernando Perez <fperez@colorado.edu>
5091
5100
5092 * Made deep_reload() off by default. It doesn't always work
5101 * Made deep_reload() off by default. It doesn't always work
5093 exactly as intended, so it's probably safer to have it off. It's
5102 exactly as intended, so it's probably safer to have it off. It's
5094 still available as dreload() anyway, so nothing is lost.
5103 still available as dreload() anyway, so nothing is lost.
5095
5104
5096 2002-01-02 Fernando Perez <fperez@colorado.edu>
5105 2002-01-02 Fernando Perez <fperez@colorado.edu>
5097
5106
5098 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5107 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5099 so I wanted an updated release).
5108 so I wanted an updated release).
5100
5109
5101 2001-12-27 Fernando Perez <fperez@colorado.edu>
5110 2001-12-27 Fernando Perez <fperez@colorado.edu>
5102
5111
5103 * IPython/iplib.py (InteractiveShell.interact): Added the original
5112 * IPython/iplib.py (InteractiveShell.interact): Added the original
5104 code from 'code.py' for this module in order to change the
5113 code from 'code.py' for this module in order to change the
5105 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5114 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5106 the history cache would break when the user hit Ctrl-C, and
5115 the history cache would break when the user hit Ctrl-C, and
5107 interact() offers no way to add any hooks to it.
5116 interact() offers no way to add any hooks to it.
5108
5117
5109 2001-12-23 Fernando Perez <fperez@colorado.edu>
5118 2001-12-23 Fernando Perez <fperez@colorado.edu>
5110
5119
5111 * setup.py: added check for 'MANIFEST' before trying to remove
5120 * setup.py: added check for 'MANIFEST' before trying to remove
5112 it. Thanks to Sean Reifschneider.
5121 it. Thanks to Sean Reifschneider.
5113
5122
5114 2001-12-22 Fernando Perez <fperez@colorado.edu>
5123 2001-12-22 Fernando Perez <fperez@colorado.edu>
5115
5124
5116 * Released 0.2.2.
5125 * Released 0.2.2.
5117
5126
5118 * Finished (reasonably) writing the manual. Later will add the
5127 * Finished (reasonably) writing the manual. Later will add the
5119 python-standard navigation stylesheets, but for the time being
5128 python-standard navigation stylesheets, but for the time being
5120 it's fairly complete. Distribution will include html and pdf
5129 it's fairly complete. Distribution will include html and pdf
5121 versions.
5130 versions.
5122
5131
5123 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5132 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5124 (MayaVi author).
5133 (MayaVi author).
5125
5134
5126 2001-12-21 Fernando Perez <fperez@colorado.edu>
5135 2001-12-21 Fernando Perez <fperez@colorado.edu>
5127
5136
5128 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5137 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5129 good public release, I think (with the manual and the distutils
5138 good public release, I think (with the manual and the distutils
5130 installer). The manual can use some work, but that can go
5139 installer). The manual can use some work, but that can go
5131 slowly. Otherwise I think it's quite nice for end users. Next
5140 slowly. Otherwise I think it's quite nice for end users. Next
5132 summer, rewrite the guts of it...
5141 summer, rewrite the guts of it...
5133
5142
5134 * Changed format of ipythonrc files to use whitespace as the
5143 * Changed format of ipythonrc files to use whitespace as the
5135 separator instead of an explicit '='. Cleaner.
5144 separator instead of an explicit '='. Cleaner.
5136
5145
5137 2001-12-20 Fernando Perez <fperez@colorado.edu>
5146 2001-12-20 Fernando Perez <fperez@colorado.edu>
5138
5147
5139 * Started a manual in LyX. For now it's just a quick merge of the
5148 * Started a manual in LyX. For now it's just a quick merge of the
5140 various internal docstrings and READMEs. Later it may grow into a
5149 various internal docstrings and READMEs. Later it may grow into a
5141 nice, full-blown manual.
5150 nice, full-blown manual.
5142
5151
5143 * Set up a distutils based installer. Installation should now be
5152 * Set up a distutils based installer. Installation should now be
5144 trivially simple for end-users.
5153 trivially simple for end-users.
5145
5154
5146 2001-12-11 Fernando Perez <fperez@colorado.edu>
5155 2001-12-11 Fernando Perez <fperez@colorado.edu>
5147
5156
5148 * Released 0.2.0. First public release, announced it at
5157 * Released 0.2.0. First public release, announced it at
5149 comp.lang.python. From now on, just bugfixes...
5158 comp.lang.python. From now on, just bugfixes...
5150
5159
5151 * Went through all the files, set copyright/license notices and
5160 * Went through all the files, set copyright/license notices and
5152 cleaned up things. Ready for release.
5161 cleaned up things. Ready for release.
5153
5162
5154 2001-12-10 Fernando Perez <fperez@colorado.edu>
5163 2001-12-10 Fernando Perez <fperez@colorado.edu>
5155
5164
5156 * Changed the first-time installer not to use tarfiles. It's more
5165 * Changed the first-time installer not to use tarfiles. It's more
5157 robust now and less unix-dependent. Also makes it easier for
5166 robust now and less unix-dependent. Also makes it easier for
5158 people to later upgrade versions.
5167 people to later upgrade versions.
5159
5168
5160 * Changed @exit to @abort to reflect the fact that it's pretty
5169 * Changed @exit to @abort to reflect the fact that it's pretty
5161 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5170 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5162 becomes significant only when IPyhton is embedded: in that case,
5171 becomes significant only when IPyhton is embedded: in that case,
5163 C-D closes IPython only, but @abort kills the enclosing program
5172 C-D closes IPython only, but @abort kills the enclosing program
5164 too (unless it had called IPython inside a try catching
5173 too (unless it had called IPython inside a try catching
5165 SystemExit).
5174 SystemExit).
5166
5175
5167 * Created Shell module which exposes the actuall IPython Shell
5176 * Created Shell module which exposes the actuall IPython Shell
5168 classes, currently the normal and the embeddable one. This at
5177 classes, currently the normal and the embeddable one. This at
5169 least offers a stable interface we won't need to change when
5178 least offers a stable interface we won't need to change when
5170 (later) the internals are rewritten. That rewrite will be confined
5179 (later) the internals are rewritten. That rewrite will be confined
5171 to iplib and ipmaker, but the Shell interface should remain as is.
5180 to iplib and ipmaker, but the Shell interface should remain as is.
5172
5181
5173 * Added embed module which offers an embeddable IPShell object,
5182 * Added embed module which offers an embeddable IPShell object,
5174 useful to fire up IPython *inside* a running program. Great for
5183 useful to fire up IPython *inside* a running program. Great for
5175 debugging or dynamical data analysis.
5184 debugging or dynamical data analysis.
5176
5185
5177 2001-12-08 Fernando Perez <fperez@colorado.edu>
5186 2001-12-08 Fernando Perez <fperez@colorado.edu>
5178
5187
5179 * Fixed small bug preventing seeing info from methods of defined
5188 * Fixed small bug preventing seeing info from methods of defined
5180 objects (incorrect namespace in _ofind()).
5189 objects (incorrect namespace in _ofind()).
5181
5190
5182 * Documentation cleanup. Moved the main usage docstrings to a
5191 * Documentation cleanup. Moved the main usage docstrings to a
5183 separate file, usage.py (cleaner to maintain, and hopefully in the
5192 separate file, usage.py (cleaner to maintain, and hopefully in the
5184 future some perlpod-like way of producing interactive, man and
5193 future some perlpod-like way of producing interactive, man and
5185 html docs out of it will be found).
5194 html docs out of it will be found).
5186
5195
5187 * Added @profile to see your profile at any time.
5196 * Added @profile to see your profile at any time.
5188
5197
5189 * Added @p as an alias for 'print'. It's especially convenient if
5198 * Added @p as an alias for 'print'. It's especially convenient if
5190 using automagic ('p x' prints x).
5199 using automagic ('p x' prints x).
5191
5200
5192 * Small cleanups and fixes after a pychecker run.
5201 * Small cleanups and fixes after a pychecker run.
5193
5202
5194 * Changed the @cd command to handle @cd - and @cd -<n> for
5203 * Changed the @cd command to handle @cd - and @cd -<n> for
5195 visiting any directory in _dh.
5204 visiting any directory in _dh.
5196
5205
5197 * Introduced _dh, a history of visited directories. @dhist prints
5206 * Introduced _dh, a history of visited directories. @dhist prints
5198 it out with numbers.
5207 it out with numbers.
5199
5208
5200 2001-12-07 Fernando Perez <fperez@colorado.edu>
5209 2001-12-07 Fernando Perez <fperez@colorado.edu>
5201
5210
5202 * Released 0.1.22
5211 * Released 0.1.22
5203
5212
5204 * Made initialization a bit more robust against invalid color
5213 * Made initialization a bit more robust against invalid color
5205 options in user input (exit, not traceback-crash).
5214 options in user input (exit, not traceback-crash).
5206
5215
5207 * Changed the bug crash reporter to write the report only in the
5216 * Changed the bug crash reporter to write the report only in the
5208 user's .ipython directory. That way IPython won't litter people's
5217 user's .ipython directory. That way IPython won't litter people's
5209 hard disks with crash files all over the place. Also print on
5218 hard disks with crash files all over the place. Also print on
5210 screen the necessary mail command.
5219 screen the necessary mail command.
5211
5220
5212 * With the new ultraTB, implemented LightBG color scheme for light
5221 * With the new ultraTB, implemented LightBG color scheme for light
5213 background terminals. A lot of people like white backgrounds, so I
5222 background terminals. A lot of people like white backgrounds, so I
5214 guess we should at least give them something readable.
5223 guess we should at least give them something readable.
5215
5224
5216 2001-12-06 Fernando Perez <fperez@colorado.edu>
5225 2001-12-06 Fernando Perez <fperez@colorado.edu>
5217
5226
5218 * Modified the structure of ultraTB. Now there's a proper class
5227 * Modified the structure of ultraTB. Now there's a proper class
5219 for tables of color schemes which allow adding schemes easily and
5228 for tables of color schemes which allow adding schemes easily and
5220 switching the active scheme without creating a new instance every
5229 switching the active scheme without creating a new instance every
5221 time (which was ridiculous). The syntax for creating new schemes
5230 time (which was ridiculous). The syntax for creating new schemes
5222 is also cleaner. I think ultraTB is finally done, with a clean
5231 is also cleaner. I think ultraTB is finally done, with a clean
5223 class structure. Names are also much cleaner (now there's proper
5232 class structure. Names are also much cleaner (now there's proper
5224 color tables, no need for every variable to also have 'color' in
5233 color tables, no need for every variable to also have 'color' in
5225 its name).
5234 its name).
5226
5235
5227 * Broke down genutils into separate files. Now genutils only
5236 * Broke down genutils into separate files. Now genutils only
5228 contains utility functions, and classes have been moved to their
5237 contains utility functions, and classes have been moved to their
5229 own files (they had enough independent functionality to warrant
5238 own files (they had enough independent functionality to warrant
5230 it): ConfigLoader, OutputTrap, Struct.
5239 it): ConfigLoader, OutputTrap, Struct.
5231
5240
5232 2001-12-05 Fernando Perez <fperez@colorado.edu>
5241 2001-12-05 Fernando Perez <fperez@colorado.edu>
5233
5242
5234 * IPython turns 21! Released version 0.1.21, as a candidate for
5243 * IPython turns 21! Released version 0.1.21, as a candidate for
5235 public consumption. If all goes well, release in a few days.
5244 public consumption. If all goes well, release in a few days.
5236
5245
5237 * Fixed path bug (files in Extensions/ directory wouldn't be found
5246 * Fixed path bug (files in Extensions/ directory wouldn't be found
5238 unless IPython/ was explicitly in sys.path).
5247 unless IPython/ was explicitly in sys.path).
5239
5248
5240 * Extended the FlexCompleter class as MagicCompleter to allow
5249 * Extended the FlexCompleter class as MagicCompleter to allow
5241 completion of @-starting lines.
5250 completion of @-starting lines.
5242
5251
5243 * Created __release__.py file as a central repository for release
5252 * Created __release__.py file as a central repository for release
5244 info that other files can read from.
5253 info that other files can read from.
5245
5254
5246 * Fixed small bug in logging: when logging was turned on in
5255 * Fixed small bug in logging: when logging was turned on in
5247 mid-session, old lines with special meanings (!@?) were being
5256 mid-session, old lines with special meanings (!@?) were being
5248 logged without the prepended comment, which is necessary since
5257 logged without the prepended comment, which is necessary since
5249 they are not truly valid python syntax. This should make session
5258 they are not truly valid python syntax. This should make session
5250 restores produce less errors.
5259 restores produce less errors.
5251
5260
5252 * The namespace cleanup forced me to make a FlexCompleter class
5261 * The namespace cleanup forced me to make a FlexCompleter class
5253 which is nothing but a ripoff of rlcompleter, but with selectable
5262 which is nothing but a ripoff of rlcompleter, but with selectable
5254 namespace (rlcompleter only works in __main__.__dict__). I'll try
5263 namespace (rlcompleter only works in __main__.__dict__). I'll try
5255 to submit a note to the authors to see if this change can be
5264 to submit a note to the authors to see if this change can be
5256 incorporated in future rlcompleter releases (Dec.6: done)
5265 incorporated in future rlcompleter releases (Dec.6: done)
5257
5266
5258 * More fixes to namespace handling. It was a mess! Now all
5267 * More fixes to namespace handling. It was a mess! Now all
5259 explicit references to __main__.__dict__ are gone (except when
5268 explicit references to __main__.__dict__ are gone (except when
5260 really needed) and everything is handled through the namespace
5269 really needed) and everything is handled through the namespace
5261 dicts in the IPython instance. We seem to be getting somewhere
5270 dicts in the IPython instance. We seem to be getting somewhere
5262 with this, finally...
5271 with this, finally...
5263
5272
5264 * Small documentation updates.
5273 * Small documentation updates.
5265
5274
5266 * Created the Extensions directory under IPython (with an
5275 * Created the Extensions directory under IPython (with an
5267 __init__.py). Put the PhysicalQ stuff there. This directory should
5276 __init__.py). Put the PhysicalQ stuff there. This directory should
5268 be used for all special-purpose extensions.
5277 be used for all special-purpose extensions.
5269
5278
5270 * File renaming:
5279 * File renaming:
5271 ipythonlib --> ipmaker
5280 ipythonlib --> ipmaker
5272 ipplib --> iplib
5281 ipplib --> iplib
5273 This makes a bit more sense in terms of what these files actually do.
5282 This makes a bit more sense in terms of what these files actually do.
5274
5283
5275 * Moved all the classes and functions in ipythonlib to ipplib, so
5284 * Moved all the classes and functions in ipythonlib to ipplib, so
5276 now ipythonlib only has make_IPython(). This will ease up its
5285 now ipythonlib only has make_IPython(). This will ease up its
5277 splitting in smaller functional chunks later.
5286 splitting in smaller functional chunks later.
5278
5287
5279 * Cleaned up (done, I think) output of @whos. Better column
5288 * Cleaned up (done, I think) output of @whos. Better column
5280 formatting, and now shows str(var) for as much as it can, which is
5289 formatting, and now shows str(var) for as much as it can, which is
5281 typically what one gets with a 'print var'.
5290 typically what one gets with a 'print var'.
5282
5291
5283 2001-12-04 Fernando Perez <fperez@colorado.edu>
5292 2001-12-04 Fernando Perez <fperez@colorado.edu>
5284
5293
5285 * Fixed namespace problems. Now builtin/IPyhton/user names get
5294 * Fixed namespace problems. Now builtin/IPyhton/user names get
5286 properly reported in their namespace. Internal namespace handling
5295 properly reported in their namespace. Internal namespace handling
5287 is finally getting decent (not perfect yet, but much better than
5296 is finally getting decent (not perfect yet, but much better than
5288 the ad-hoc mess we had).
5297 the ad-hoc mess we had).
5289
5298
5290 * Removed -exit option. If people just want to run a python
5299 * Removed -exit option. If people just want to run a python
5291 script, that's what the normal interpreter is for. Less
5300 script, that's what the normal interpreter is for. Less
5292 unnecessary options, less chances for bugs.
5301 unnecessary options, less chances for bugs.
5293
5302
5294 * Added a crash handler which generates a complete post-mortem if
5303 * Added a crash handler which generates a complete post-mortem if
5295 IPython crashes. This will help a lot in tracking bugs down the
5304 IPython crashes. This will help a lot in tracking bugs down the
5296 road.
5305 road.
5297
5306
5298 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5307 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5299 which were boud to functions being reassigned would bypass the
5308 which were boud to functions being reassigned would bypass the
5300 logger, breaking the sync of _il with the prompt counter. This
5309 logger, breaking the sync of _il with the prompt counter. This
5301 would then crash IPython later when a new line was logged.
5310 would then crash IPython later when a new line was logged.
5302
5311
5303 2001-12-02 Fernando Perez <fperez@colorado.edu>
5312 2001-12-02 Fernando Perez <fperez@colorado.edu>
5304
5313
5305 * Made IPython a package. This means people don't have to clutter
5314 * Made IPython a package. This means people don't have to clutter
5306 their sys.path with yet another directory. Changed the INSTALL
5315 their sys.path with yet another directory. Changed the INSTALL
5307 file accordingly.
5316 file accordingly.
5308
5317
5309 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5318 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5310 sorts its output (so @who shows it sorted) and @whos formats the
5319 sorts its output (so @who shows it sorted) and @whos formats the
5311 table according to the width of the first column. Nicer, easier to
5320 table according to the width of the first column. Nicer, easier to
5312 read. Todo: write a generic table_format() which takes a list of
5321 read. Todo: write a generic table_format() which takes a list of
5313 lists and prints it nicely formatted, with optional row/column
5322 lists and prints it nicely formatted, with optional row/column
5314 separators and proper padding and justification.
5323 separators and proper padding and justification.
5315
5324
5316 * Released 0.1.20
5325 * Released 0.1.20
5317
5326
5318 * Fixed bug in @log which would reverse the inputcache list (a
5327 * Fixed bug in @log which would reverse the inputcache list (a
5319 copy operation was missing).
5328 copy operation was missing).
5320
5329
5321 * Code cleanup. @config was changed to use page(). Better, since
5330 * Code cleanup. @config was changed to use page(). Better, since
5322 its output is always quite long.
5331 its output is always quite long.
5323
5332
5324 * Itpl is back as a dependency. I was having too many problems
5333 * Itpl is back as a dependency. I was having too many problems
5325 getting the parametric aliases to work reliably, and it's just
5334 getting the parametric aliases to work reliably, and it's just
5326 easier to code weird string operations with it than playing %()s
5335 easier to code weird string operations with it than playing %()s
5327 games. It's only ~6k, so I don't think it's too big a deal.
5336 games. It's only ~6k, so I don't think it's too big a deal.
5328
5337
5329 * Found (and fixed) a very nasty bug with history. !lines weren't
5338 * Found (and fixed) a very nasty bug with history. !lines weren't
5330 getting cached, and the out of sync caches would crash
5339 getting cached, and the out of sync caches would crash
5331 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5340 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5332 division of labor a bit better. Bug fixed, cleaner structure.
5341 division of labor a bit better. Bug fixed, cleaner structure.
5333
5342
5334 2001-12-01 Fernando Perez <fperez@colorado.edu>
5343 2001-12-01 Fernando Perez <fperez@colorado.edu>
5335
5344
5336 * Released 0.1.19
5345 * Released 0.1.19
5337
5346
5338 * Added option -n to @hist to prevent line number printing. Much
5347 * Added option -n to @hist to prevent line number printing. Much
5339 easier to copy/paste code this way.
5348 easier to copy/paste code this way.
5340
5349
5341 * Created global _il to hold the input list. Allows easy
5350 * Created global _il to hold the input list. Allows easy
5342 re-execution of blocks of code by slicing it (inspired by Janko's
5351 re-execution of blocks of code by slicing it (inspired by Janko's
5343 comment on 'macros').
5352 comment on 'macros').
5344
5353
5345 * Small fixes and doc updates.
5354 * Small fixes and doc updates.
5346
5355
5347 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5356 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5348 much too fragile with automagic. Handles properly multi-line
5357 much too fragile with automagic. Handles properly multi-line
5349 statements and takes parameters.
5358 statements and takes parameters.
5350
5359
5351 2001-11-30 Fernando Perez <fperez@colorado.edu>
5360 2001-11-30 Fernando Perez <fperez@colorado.edu>
5352
5361
5353 * Version 0.1.18 released.
5362 * Version 0.1.18 released.
5354
5363
5355 * Fixed nasty namespace bug in initial module imports.
5364 * Fixed nasty namespace bug in initial module imports.
5356
5365
5357 * Added copyright/license notes to all code files (except
5366 * Added copyright/license notes to all code files (except
5358 DPyGetOpt). For the time being, LGPL. That could change.
5367 DPyGetOpt). For the time being, LGPL. That could change.
5359
5368
5360 * Rewrote a much nicer README, updated INSTALL, cleaned up
5369 * Rewrote a much nicer README, updated INSTALL, cleaned up
5361 ipythonrc-* samples.
5370 ipythonrc-* samples.
5362
5371
5363 * Overall code/documentation cleanup. Basically ready for
5372 * Overall code/documentation cleanup. Basically ready for
5364 release. Only remaining thing: licence decision (LGPL?).
5373 release. Only remaining thing: licence decision (LGPL?).
5365
5374
5366 * Converted load_config to a class, ConfigLoader. Now recursion
5375 * Converted load_config to a class, ConfigLoader. Now recursion
5367 control is better organized. Doesn't include the same file twice.
5376 control is better organized. Doesn't include the same file twice.
5368
5377
5369 2001-11-29 Fernando Perez <fperez@colorado.edu>
5378 2001-11-29 Fernando Perez <fperez@colorado.edu>
5370
5379
5371 * Got input history working. Changed output history variables from
5380 * Got input history working. Changed output history variables from
5372 _p to _o so that _i is for input and _o for output. Just cleaner
5381 _p to _o so that _i is for input and _o for output. Just cleaner
5373 convention.
5382 convention.
5374
5383
5375 * Implemented parametric aliases. This pretty much allows the
5384 * Implemented parametric aliases. This pretty much allows the
5376 alias system to offer full-blown shell convenience, I think.
5385 alias system to offer full-blown shell convenience, I think.
5377
5386
5378 * Version 0.1.17 released, 0.1.18 opened.
5387 * Version 0.1.17 released, 0.1.18 opened.
5379
5388
5380 * dot_ipython/ipythonrc (alias): added documentation.
5389 * dot_ipython/ipythonrc (alias): added documentation.
5381 (xcolor): Fixed small bug (xcolors -> xcolor)
5390 (xcolor): Fixed small bug (xcolors -> xcolor)
5382
5391
5383 * Changed the alias system. Now alias is a magic command to define
5392 * Changed the alias system. Now alias is a magic command to define
5384 aliases just like the shell. Rationale: the builtin magics should
5393 aliases just like the shell. Rationale: the builtin magics should
5385 be there for things deeply connected to IPython's
5394 be there for things deeply connected to IPython's
5386 architecture. And this is a much lighter system for what I think
5395 architecture. And this is a much lighter system for what I think
5387 is the really important feature: allowing users to define quickly
5396 is the really important feature: allowing users to define quickly
5388 magics that will do shell things for them, so they can customize
5397 magics that will do shell things for them, so they can customize
5389 IPython easily to match their work habits. If someone is really
5398 IPython easily to match their work habits. If someone is really
5390 desperate to have another name for a builtin alias, they can
5399 desperate to have another name for a builtin alias, they can
5391 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5400 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5392 works.
5401 works.
5393
5402
5394 2001-11-28 Fernando Perez <fperez@colorado.edu>
5403 2001-11-28 Fernando Perez <fperez@colorado.edu>
5395
5404
5396 * Changed @file so that it opens the source file at the proper
5405 * Changed @file so that it opens the source file at the proper
5397 line. Since it uses less, if your EDITOR environment is
5406 line. Since it uses less, if your EDITOR environment is
5398 configured, typing v will immediately open your editor of choice
5407 configured, typing v will immediately open your editor of choice
5399 right at the line where the object is defined. Not as quick as
5408 right at the line where the object is defined. Not as quick as
5400 having a direct @edit command, but for all intents and purposes it
5409 having a direct @edit command, but for all intents and purposes it
5401 works. And I don't have to worry about writing @edit to deal with
5410 works. And I don't have to worry about writing @edit to deal with
5402 all the editors, less does that.
5411 all the editors, less does that.
5403
5412
5404 * Version 0.1.16 released, 0.1.17 opened.
5413 * Version 0.1.16 released, 0.1.17 opened.
5405
5414
5406 * Fixed some nasty bugs in the page/page_dumb combo that could
5415 * Fixed some nasty bugs in the page/page_dumb combo that could
5407 crash IPython.
5416 crash IPython.
5408
5417
5409 2001-11-27 Fernando Perez <fperez@colorado.edu>
5418 2001-11-27 Fernando Perez <fperez@colorado.edu>
5410
5419
5411 * Version 0.1.15 released, 0.1.16 opened.
5420 * Version 0.1.15 released, 0.1.16 opened.
5412
5421
5413 * Finally got ? and ?? to work for undefined things: now it's
5422 * Finally got ? and ?? to work for undefined things: now it's
5414 possible to type {}.get? and get information about the get method
5423 possible to type {}.get? and get information about the get method
5415 of dicts, or os.path? even if only os is defined (so technically
5424 of dicts, or os.path? even if only os is defined (so technically
5416 os.path isn't). Works at any level. For example, after import os,
5425 os.path isn't). Works at any level. For example, after import os,
5417 os?, os.path?, os.path.abspath? all work. This is great, took some
5426 os?, os.path?, os.path.abspath? all work. This is great, took some
5418 work in _ofind.
5427 work in _ofind.
5419
5428
5420 * Fixed more bugs with logging. The sanest way to do it was to add
5429 * Fixed more bugs with logging. The sanest way to do it was to add
5421 to @log a 'mode' parameter. Killed two in one shot (this mode
5430 to @log a 'mode' parameter. Killed two in one shot (this mode
5422 option was a request of Janko's). I think it's finally clean
5431 option was a request of Janko's). I think it's finally clean
5423 (famous last words).
5432 (famous last words).
5424
5433
5425 * Added a page_dumb() pager which does a decent job of paging on
5434 * Added a page_dumb() pager which does a decent job of paging on
5426 screen, if better things (like less) aren't available. One less
5435 screen, if better things (like less) aren't available. One less
5427 unix dependency (someday maybe somebody will port this to
5436 unix dependency (someday maybe somebody will port this to
5428 windows).
5437 windows).
5429
5438
5430 * Fixed problem in magic_log: would lock of logging out if log
5439 * Fixed problem in magic_log: would lock of logging out if log
5431 creation failed (because it would still think it had succeeded).
5440 creation failed (because it would still think it had succeeded).
5432
5441
5433 * Improved the page() function using curses to auto-detect screen
5442 * Improved the page() function using curses to auto-detect screen
5434 size. Now it can make a much better decision on whether to print
5443 size. Now it can make a much better decision on whether to print
5435 or page a string. Option screen_length was modified: a value 0
5444 or page a string. Option screen_length was modified: a value 0
5436 means auto-detect, and that's the default now.
5445 means auto-detect, and that's the default now.
5437
5446
5438 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5447 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5439 go out. I'll test it for a few days, then talk to Janko about
5448 go out. I'll test it for a few days, then talk to Janko about
5440 licences and announce it.
5449 licences and announce it.
5441
5450
5442 * Fixed the length of the auto-generated ---> prompt which appears
5451 * Fixed the length of the auto-generated ---> prompt which appears
5443 for auto-parens and auto-quotes. Getting this right isn't trivial,
5452 for auto-parens and auto-quotes. Getting this right isn't trivial,
5444 with all the color escapes, different prompt types and optional
5453 with all the color escapes, different prompt types and optional
5445 separators. But it seems to be working in all the combinations.
5454 separators. But it seems to be working in all the combinations.
5446
5455
5447 2001-11-26 Fernando Perez <fperez@colorado.edu>
5456 2001-11-26 Fernando Perez <fperez@colorado.edu>
5448
5457
5449 * Wrote a regexp filter to get option types from the option names
5458 * Wrote a regexp filter to get option types from the option names
5450 string. This eliminates the need to manually keep two duplicate
5459 string. This eliminates the need to manually keep two duplicate
5451 lists.
5460 lists.
5452
5461
5453 * Removed the unneeded check_option_names. Now options are handled
5462 * Removed the unneeded check_option_names. Now options are handled
5454 in a much saner manner and it's easy to visually check that things
5463 in a much saner manner and it's easy to visually check that things
5455 are ok.
5464 are ok.
5456
5465
5457 * Updated version numbers on all files I modified to carry a
5466 * Updated version numbers on all files I modified to carry a
5458 notice so Janko and Nathan have clear version markers.
5467 notice so Janko and Nathan have clear version markers.
5459
5468
5460 * Updated docstring for ultraTB with my changes. I should send
5469 * Updated docstring for ultraTB with my changes. I should send
5461 this to Nathan.
5470 this to Nathan.
5462
5471
5463 * Lots of small fixes. Ran everything through pychecker again.
5472 * Lots of small fixes. Ran everything through pychecker again.
5464
5473
5465 * Made loading of deep_reload an cmd line option. If it's not too
5474 * Made loading of deep_reload an cmd line option. If it's not too
5466 kosher, now people can just disable it. With -nodeep_reload it's
5475 kosher, now people can just disable it. With -nodeep_reload it's
5467 still available as dreload(), it just won't overwrite reload().
5476 still available as dreload(), it just won't overwrite reload().
5468
5477
5469 * Moved many options to the no| form (-opt and -noopt
5478 * Moved many options to the no| form (-opt and -noopt
5470 accepted). Cleaner.
5479 accepted). Cleaner.
5471
5480
5472 * Changed magic_log so that if called with no parameters, it uses
5481 * Changed magic_log so that if called with no parameters, it uses
5473 'rotate' mode. That way auto-generated logs aren't automatically
5482 'rotate' mode. That way auto-generated logs aren't automatically
5474 over-written. For normal logs, now a backup is made if it exists
5483 over-written. For normal logs, now a backup is made if it exists
5475 (only 1 level of backups). A new 'backup' mode was added to the
5484 (only 1 level of backups). A new 'backup' mode was added to the
5476 Logger class to support this. This was a request by Janko.
5485 Logger class to support this. This was a request by Janko.
5477
5486
5478 * Added @logoff/@logon to stop/restart an active log.
5487 * Added @logoff/@logon to stop/restart an active log.
5479
5488
5480 * Fixed a lot of bugs in log saving/replay. It was pretty
5489 * Fixed a lot of bugs in log saving/replay. It was pretty
5481 broken. Now special lines (!@,/) appear properly in the command
5490 broken. Now special lines (!@,/) appear properly in the command
5482 history after a log replay.
5491 history after a log replay.
5483
5492
5484 * Tried and failed to implement full session saving via pickle. My
5493 * Tried and failed to implement full session saving via pickle. My
5485 idea was to pickle __main__.__dict__, but modules can't be
5494 idea was to pickle __main__.__dict__, but modules can't be
5486 pickled. This would be a better alternative to replaying logs, but
5495 pickled. This would be a better alternative to replaying logs, but
5487 seems quite tricky to get to work. Changed -session to be called
5496 seems quite tricky to get to work. Changed -session to be called
5488 -logplay, which more accurately reflects what it does. And if we
5497 -logplay, which more accurately reflects what it does. And if we
5489 ever get real session saving working, -session is now available.
5498 ever get real session saving working, -session is now available.
5490
5499
5491 * Implemented color schemes for prompts also. As for tracebacks,
5500 * Implemented color schemes for prompts also. As for tracebacks,
5492 currently only NoColor and Linux are supported. But now the
5501 currently only NoColor and Linux are supported. But now the
5493 infrastructure is in place, based on a generic ColorScheme
5502 infrastructure is in place, based on a generic ColorScheme
5494 class. So writing and activating new schemes both for the prompts
5503 class. So writing and activating new schemes both for the prompts
5495 and the tracebacks should be straightforward.
5504 and the tracebacks should be straightforward.
5496
5505
5497 * Version 0.1.13 released, 0.1.14 opened.
5506 * Version 0.1.13 released, 0.1.14 opened.
5498
5507
5499 * Changed handling of options for output cache. Now counter is
5508 * Changed handling of options for output cache. Now counter is
5500 hardwired starting at 1 and one specifies the maximum number of
5509 hardwired starting at 1 and one specifies the maximum number of
5501 entries *in the outcache* (not the max prompt counter). This is
5510 entries *in the outcache* (not the max prompt counter). This is
5502 much better, since many statements won't increase the cache
5511 much better, since many statements won't increase the cache
5503 count. It also eliminated some confusing options, now there's only
5512 count. It also eliminated some confusing options, now there's only
5504 one: cache_size.
5513 one: cache_size.
5505
5514
5506 * Added 'alias' magic function and magic_alias option in the
5515 * Added 'alias' magic function and magic_alias option in the
5507 ipythonrc file. Now the user can easily define whatever names he
5516 ipythonrc file. Now the user can easily define whatever names he
5508 wants for the magic functions without having to play weird
5517 wants for the magic functions without having to play weird
5509 namespace games. This gives IPython a real shell-like feel.
5518 namespace games. This gives IPython a real shell-like feel.
5510
5519
5511 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5520 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5512 @ or not).
5521 @ or not).
5513
5522
5514 This was one of the last remaining 'visible' bugs (that I know
5523 This was one of the last remaining 'visible' bugs (that I know
5515 of). I think if I can clean up the session loading so it works
5524 of). I think if I can clean up the session loading so it works
5516 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5525 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5517 about licensing).
5526 about licensing).
5518
5527
5519 2001-11-25 Fernando Perez <fperez@colorado.edu>
5528 2001-11-25 Fernando Perez <fperez@colorado.edu>
5520
5529
5521 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5530 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5522 there's a cleaner distinction between what ? and ?? show.
5531 there's a cleaner distinction between what ? and ?? show.
5523
5532
5524 * Added screen_length option. Now the user can define his own
5533 * Added screen_length option. Now the user can define his own
5525 screen size for page() operations.
5534 screen size for page() operations.
5526
5535
5527 * Implemented magic shell-like functions with automatic code
5536 * Implemented magic shell-like functions with automatic code
5528 generation. Now adding another function is just a matter of adding
5537 generation. Now adding another function is just a matter of adding
5529 an entry to a dict, and the function is dynamically generated at
5538 an entry to a dict, and the function is dynamically generated at
5530 run-time. Python has some really cool features!
5539 run-time. Python has some really cool features!
5531
5540
5532 * Renamed many options to cleanup conventions a little. Now all
5541 * Renamed many options to cleanup conventions a little. Now all
5533 are lowercase, and only underscores where needed. Also in the code
5542 are lowercase, and only underscores where needed. Also in the code
5534 option name tables are clearer.
5543 option name tables are clearer.
5535
5544
5536 * Changed prompts a little. Now input is 'In [n]:' instead of
5545 * Changed prompts a little. Now input is 'In [n]:' instead of
5537 'In[n]:='. This allows it the numbers to be aligned with the
5546 'In[n]:='. This allows it the numbers to be aligned with the
5538 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5547 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5539 Python (it was a Mathematica thing). The '...' continuation prompt
5548 Python (it was a Mathematica thing). The '...' continuation prompt
5540 was also changed a little to align better.
5549 was also changed a little to align better.
5541
5550
5542 * Fixed bug when flushing output cache. Not all _p<n> variables
5551 * Fixed bug when flushing output cache. Not all _p<n> variables
5543 exist, so their deletion needs to be wrapped in a try:
5552 exist, so their deletion needs to be wrapped in a try:
5544
5553
5545 * Figured out how to properly use inspect.formatargspec() (it
5554 * Figured out how to properly use inspect.formatargspec() (it
5546 requires the args preceded by *). So I removed all the code from
5555 requires the args preceded by *). So I removed all the code from
5547 _get_pdef in Magic, which was just replicating that.
5556 _get_pdef in Magic, which was just replicating that.
5548
5557
5549 * Added test to prefilter to allow redefining magic function names
5558 * Added test to prefilter to allow redefining magic function names
5550 as variables. This is ok, since the @ form is always available,
5559 as variables. This is ok, since the @ form is always available,
5551 but whe should allow the user to define a variable called 'ls' if
5560 but whe should allow the user to define a variable called 'ls' if
5552 he needs it.
5561 he needs it.
5553
5562
5554 * Moved the ToDo information from README into a separate ToDo.
5563 * Moved the ToDo information from README into a separate ToDo.
5555
5564
5556 * General code cleanup and small bugfixes. I think it's close to a
5565 * General code cleanup and small bugfixes. I think it's close to a
5557 state where it can be released, obviously with a big 'beta'
5566 state where it can be released, obviously with a big 'beta'
5558 warning on it.
5567 warning on it.
5559
5568
5560 * Got the magic function split to work. Now all magics are defined
5569 * Got the magic function split to work. Now all magics are defined
5561 in a separate class. It just organizes things a bit, and now
5570 in a separate class. It just organizes things a bit, and now
5562 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5571 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5563 was too long).
5572 was too long).
5564
5573
5565 * Changed @clear to @reset to avoid potential confusions with
5574 * Changed @clear to @reset to avoid potential confusions with
5566 the shell command clear. Also renamed @cl to @clear, which does
5575 the shell command clear. Also renamed @cl to @clear, which does
5567 exactly what people expect it to from their shell experience.
5576 exactly what people expect it to from their shell experience.
5568
5577
5569 Added a check to the @reset command (since it's so
5578 Added a check to the @reset command (since it's so
5570 destructive, it's probably a good idea to ask for confirmation).
5579 destructive, it's probably a good idea to ask for confirmation).
5571 But now reset only works for full namespace resetting. Since the
5580 But now reset only works for full namespace resetting. Since the
5572 del keyword is already there for deleting a few specific
5581 del keyword is already there for deleting a few specific
5573 variables, I don't see the point of having a redundant magic
5582 variables, I don't see the point of having a redundant magic
5574 function for the same task.
5583 function for the same task.
5575
5584
5576 2001-11-24 Fernando Perez <fperez@colorado.edu>
5585 2001-11-24 Fernando Perez <fperez@colorado.edu>
5577
5586
5578 * Updated the builtin docs (esp. the ? ones).
5587 * Updated the builtin docs (esp. the ? ones).
5579
5588
5580 * Ran all the code through pychecker. Not terribly impressed with
5589 * Ran all the code through pychecker. Not terribly impressed with
5581 it: lots of spurious warnings and didn't really find anything of
5590 it: lots of spurious warnings and didn't really find anything of
5582 substance (just a few modules being imported and not used).
5591 substance (just a few modules being imported and not used).
5583
5592
5584 * Implemented the new ultraTB functionality into IPython. New
5593 * Implemented the new ultraTB functionality into IPython. New
5585 option: xcolors. This chooses color scheme. xmode now only selects
5594 option: xcolors. This chooses color scheme. xmode now only selects
5586 between Plain and Verbose. Better orthogonality.
5595 between Plain and Verbose. Better orthogonality.
5587
5596
5588 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5597 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5589 mode and color scheme for the exception handlers. Now it's
5598 mode and color scheme for the exception handlers. Now it's
5590 possible to have the verbose traceback with no coloring.
5599 possible to have the verbose traceback with no coloring.
5591
5600
5592 2001-11-23 Fernando Perez <fperez@colorado.edu>
5601 2001-11-23 Fernando Perez <fperez@colorado.edu>
5593
5602
5594 * Version 0.1.12 released, 0.1.13 opened.
5603 * Version 0.1.12 released, 0.1.13 opened.
5595
5604
5596 * Removed option to set auto-quote and auto-paren escapes by
5605 * Removed option to set auto-quote and auto-paren escapes by
5597 user. The chances of breaking valid syntax are just too high. If
5606 user. The chances of breaking valid syntax are just too high. If
5598 someone *really* wants, they can always dig into the code.
5607 someone *really* wants, they can always dig into the code.
5599
5608
5600 * Made prompt separators configurable.
5609 * Made prompt separators configurable.
5601
5610
5602 2001-11-22 Fernando Perez <fperez@colorado.edu>
5611 2001-11-22 Fernando Perez <fperez@colorado.edu>
5603
5612
5604 * Small bugfixes in many places.
5613 * Small bugfixes in many places.
5605
5614
5606 * Removed the MyCompleter class from ipplib. It seemed redundant
5615 * Removed the MyCompleter class from ipplib. It seemed redundant
5607 with the C-p,C-n history search functionality. Less code to
5616 with the C-p,C-n history search functionality. Less code to
5608 maintain.
5617 maintain.
5609
5618
5610 * Moved all the original ipython.py code into ipythonlib.py. Right
5619 * Moved all the original ipython.py code into ipythonlib.py. Right
5611 now it's just one big dump into a function called make_IPython, so
5620 now it's just one big dump into a function called make_IPython, so
5612 no real modularity has been gained. But at least it makes the
5621 no real modularity has been gained. But at least it makes the
5613 wrapper script tiny, and since ipythonlib is a module, it gets
5622 wrapper script tiny, and since ipythonlib is a module, it gets
5614 compiled and startup is much faster.
5623 compiled and startup is much faster.
5615
5624
5616 This is a reasobably 'deep' change, so we should test it for a
5625 This is a reasobably 'deep' change, so we should test it for a
5617 while without messing too much more with the code.
5626 while without messing too much more with the code.
5618
5627
5619 2001-11-21 Fernando Perez <fperez@colorado.edu>
5628 2001-11-21 Fernando Perez <fperez@colorado.edu>
5620
5629
5621 * Version 0.1.11 released, 0.1.12 opened for further work.
5630 * Version 0.1.11 released, 0.1.12 opened for further work.
5622
5631
5623 * Removed dependency on Itpl. It was only needed in one place. It
5632 * Removed dependency on Itpl. It was only needed in one place. It
5624 would be nice if this became part of python, though. It makes life
5633 would be nice if this became part of python, though. It makes life
5625 *a lot* easier in some cases.
5634 *a lot* easier in some cases.
5626
5635
5627 * Simplified the prefilter code a bit. Now all handlers are
5636 * Simplified the prefilter code a bit. Now all handlers are
5628 expected to explicitly return a value (at least a blank string).
5637 expected to explicitly return a value (at least a blank string).
5629
5638
5630 * Heavy edits in ipplib. Removed the help system altogether. Now
5639 * Heavy edits in ipplib. Removed the help system altogether. Now
5631 obj?/?? is used for inspecting objects, a magic @doc prints
5640 obj?/?? is used for inspecting objects, a magic @doc prints
5632 docstrings, and full-blown Python help is accessed via the 'help'
5641 docstrings, and full-blown Python help is accessed via the 'help'
5633 keyword. This cleans up a lot of code (less to maintain) and does
5642 keyword. This cleans up a lot of code (less to maintain) and does
5634 the job. Since 'help' is now a standard Python component, might as
5643 the job. Since 'help' is now a standard Python component, might as
5635 well use it and remove duplicate functionality.
5644 well use it and remove duplicate functionality.
5636
5645
5637 Also removed the option to use ipplib as a standalone program. By
5646 Also removed the option to use ipplib as a standalone program. By
5638 now it's too dependent on other parts of IPython to function alone.
5647 now it's too dependent on other parts of IPython to function alone.
5639
5648
5640 * Fixed bug in genutils.pager. It would crash if the pager was
5649 * Fixed bug in genutils.pager. It would crash if the pager was
5641 exited immediately after opening (broken pipe).
5650 exited immediately after opening (broken pipe).
5642
5651
5643 * Trimmed down the VerboseTB reporting a little. The header is
5652 * Trimmed down the VerboseTB reporting a little. The header is
5644 much shorter now and the repeated exception arguments at the end
5653 much shorter now and the repeated exception arguments at the end
5645 have been removed. For interactive use the old header seemed a bit
5654 have been removed. For interactive use the old header seemed a bit
5646 excessive.
5655 excessive.
5647
5656
5648 * Fixed small bug in output of @whos for variables with multi-word
5657 * Fixed small bug in output of @whos for variables with multi-word
5649 types (only first word was displayed).
5658 types (only first word was displayed).
5650
5659
5651 2001-11-17 Fernando Perez <fperez@colorado.edu>
5660 2001-11-17 Fernando Perez <fperez@colorado.edu>
5652
5661
5653 * Version 0.1.10 released, 0.1.11 opened for further work.
5662 * Version 0.1.10 released, 0.1.11 opened for further work.
5654
5663
5655 * Modified dirs and friends. dirs now *returns* the stack (not
5664 * Modified dirs and friends. dirs now *returns* the stack (not
5656 prints), so one can manipulate it as a variable. Convenient to
5665 prints), so one can manipulate it as a variable. Convenient to
5657 travel along many directories.
5666 travel along many directories.
5658
5667
5659 * Fixed bug in magic_pdef: would only work with functions with
5668 * Fixed bug in magic_pdef: would only work with functions with
5660 arguments with default values.
5669 arguments with default values.
5661
5670
5662 2001-11-14 Fernando Perez <fperez@colorado.edu>
5671 2001-11-14 Fernando Perez <fperez@colorado.edu>
5663
5672
5664 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5673 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5665 example with IPython. Various other minor fixes and cleanups.
5674 example with IPython. Various other minor fixes and cleanups.
5666
5675
5667 * Version 0.1.9 released, 0.1.10 opened for further work.
5676 * Version 0.1.9 released, 0.1.10 opened for further work.
5668
5677
5669 * Added sys.path to the list of directories searched in the
5678 * Added sys.path to the list of directories searched in the
5670 execfile= option. It used to be the current directory and the
5679 execfile= option. It used to be the current directory and the
5671 user's IPYTHONDIR only.
5680 user's IPYTHONDIR only.
5672
5681
5673 2001-11-13 Fernando Perez <fperez@colorado.edu>
5682 2001-11-13 Fernando Perez <fperez@colorado.edu>
5674
5683
5675 * Reinstated the raw_input/prefilter separation that Janko had
5684 * Reinstated the raw_input/prefilter separation that Janko had
5676 initially. This gives a more convenient setup for extending the
5685 initially. This gives a more convenient setup for extending the
5677 pre-processor from the outside: raw_input always gets a string,
5686 pre-processor from the outside: raw_input always gets a string,
5678 and prefilter has to process it. We can then redefine prefilter
5687 and prefilter has to process it. We can then redefine prefilter
5679 from the outside and implement extensions for special
5688 from the outside and implement extensions for special
5680 purposes.
5689 purposes.
5681
5690
5682 Today I got one for inputting PhysicalQuantity objects
5691 Today I got one for inputting PhysicalQuantity objects
5683 (from Scientific) without needing any function calls at
5692 (from Scientific) without needing any function calls at
5684 all. Extremely convenient, and it's all done as a user-level
5693 all. Extremely convenient, and it's all done as a user-level
5685 extension (no IPython code was touched). Now instead of:
5694 extension (no IPython code was touched). Now instead of:
5686 a = PhysicalQuantity(4.2,'m/s**2')
5695 a = PhysicalQuantity(4.2,'m/s**2')
5687 one can simply say
5696 one can simply say
5688 a = 4.2 m/s**2
5697 a = 4.2 m/s**2
5689 or even
5698 or even
5690 a = 4.2 m/s^2
5699 a = 4.2 m/s^2
5691
5700
5692 I use this, but it's also a proof of concept: IPython really is
5701 I use this, but it's also a proof of concept: IPython really is
5693 fully user-extensible, even at the level of the parsing of the
5702 fully user-extensible, even at the level of the parsing of the
5694 command line. It's not trivial, but it's perfectly doable.
5703 command line. It's not trivial, but it's perfectly doable.
5695
5704
5696 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5705 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5697 the problem of modules being loaded in the inverse order in which
5706 the problem of modules being loaded in the inverse order in which
5698 they were defined in
5707 they were defined in
5699
5708
5700 * Version 0.1.8 released, 0.1.9 opened for further work.
5709 * Version 0.1.8 released, 0.1.9 opened for further work.
5701
5710
5702 * Added magics pdef, source and file. They respectively show the
5711 * Added magics pdef, source and file. They respectively show the
5703 definition line ('prototype' in C), source code and full python
5712 definition line ('prototype' in C), source code and full python
5704 file for any callable object. The object inspector oinfo uses
5713 file for any callable object. The object inspector oinfo uses
5705 these to show the same information.
5714 these to show the same information.
5706
5715
5707 * Version 0.1.7 released, 0.1.8 opened for further work.
5716 * Version 0.1.7 released, 0.1.8 opened for further work.
5708
5717
5709 * Separated all the magic functions into a class called Magic. The
5718 * Separated all the magic functions into a class called Magic. The
5710 InteractiveShell class was becoming too big for Xemacs to handle
5719 InteractiveShell class was becoming too big for Xemacs to handle
5711 (de-indenting a line would lock it up for 10 seconds while it
5720 (de-indenting a line would lock it up for 10 seconds while it
5712 backtracked on the whole class!)
5721 backtracked on the whole class!)
5713
5722
5714 FIXME: didn't work. It can be done, but right now namespaces are
5723 FIXME: didn't work. It can be done, but right now namespaces are
5715 all messed up. Do it later (reverted it for now, so at least
5724 all messed up. Do it later (reverted it for now, so at least
5716 everything works as before).
5725 everything works as before).
5717
5726
5718 * Got the object introspection system (magic_oinfo) working! I
5727 * Got the object introspection system (magic_oinfo) working! I
5719 think this is pretty much ready for release to Janko, so he can
5728 think this is pretty much ready for release to Janko, so he can
5720 test it for a while and then announce it. Pretty much 100% of what
5729 test it for a while and then announce it. Pretty much 100% of what
5721 I wanted for the 'phase 1' release is ready. Happy, tired.
5730 I wanted for the 'phase 1' release is ready. Happy, tired.
5722
5731
5723 2001-11-12 Fernando Perez <fperez@colorado.edu>
5732 2001-11-12 Fernando Perez <fperez@colorado.edu>
5724
5733
5725 * Version 0.1.6 released, 0.1.7 opened for further work.
5734 * Version 0.1.6 released, 0.1.7 opened for further work.
5726
5735
5727 * Fixed bug in printing: it used to test for truth before
5736 * Fixed bug in printing: it used to test for truth before
5728 printing, so 0 wouldn't print. Now checks for None.
5737 printing, so 0 wouldn't print. Now checks for None.
5729
5738
5730 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5739 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5731 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5740 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5732 reaches by hand into the outputcache. Think of a better way to do
5741 reaches by hand into the outputcache. Think of a better way to do
5733 this later.
5742 this later.
5734
5743
5735 * Various small fixes thanks to Nathan's comments.
5744 * Various small fixes thanks to Nathan's comments.
5736
5745
5737 * Changed magic_pprint to magic_Pprint. This way it doesn't
5746 * Changed magic_pprint to magic_Pprint. This way it doesn't
5738 collide with pprint() and the name is consistent with the command
5747 collide with pprint() and the name is consistent with the command
5739 line option.
5748 line option.
5740
5749
5741 * Changed prompt counter behavior to be fully like
5750 * Changed prompt counter behavior to be fully like
5742 Mathematica's. That is, even input that doesn't return a result
5751 Mathematica's. That is, even input that doesn't return a result
5743 raises the prompt counter. The old behavior was kind of confusing
5752 raises the prompt counter. The old behavior was kind of confusing
5744 (getting the same prompt number several times if the operation
5753 (getting the same prompt number several times if the operation
5745 didn't return a result).
5754 didn't return a result).
5746
5755
5747 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5756 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5748
5757
5749 * Fixed -Classic mode (wasn't working anymore).
5758 * Fixed -Classic mode (wasn't working anymore).
5750
5759
5751 * Added colored prompts using Nathan's new code. Colors are
5760 * Added colored prompts using Nathan's new code. Colors are
5752 currently hardwired, they can be user-configurable. For
5761 currently hardwired, they can be user-configurable. For
5753 developers, they can be chosen in file ipythonlib.py, at the
5762 developers, they can be chosen in file ipythonlib.py, at the
5754 beginning of the CachedOutput class def.
5763 beginning of the CachedOutput class def.
5755
5764
5756 2001-11-11 Fernando Perez <fperez@colorado.edu>
5765 2001-11-11 Fernando Perez <fperez@colorado.edu>
5757
5766
5758 * Version 0.1.5 released, 0.1.6 opened for further work.
5767 * Version 0.1.5 released, 0.1.6 opened for further work.
5759
5768
5760 * Changed magic_env to *return* the environment as a dict (not to
5769 * Changed magic_env to *return* the environment as a dict (not to
5761 print it). This way it prints, but it can also be processed.
5770 print it). This way it prints, but it can also be processed.
5762
5771
5763 * Added Verbose exception reporting to interactive
5772 * Added Verbose exception reporting to interactive
5764 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5773 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5765 traceback. Had to make some changes to the ultraTB file. This is
5774 traceback. Had to make some changes to the ultraTB file. This is
5766 probably the last 'big' thing in my mental todo list. This ties
5775 probably the last 'big' thing in my mental todo list. This ties
5767 in with the next entry:
5776 in with the next entry:
5768
5777
5769 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5778 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5770 has to specify is Plain, Color or Verbose for all exception
5779 has to specify is Plain, Color or Verbose for all exception
5771 handling.
5780 handling.
5772
5781
5773 * Removed ShellServices option. All this can really be done via
5782 * Removed ShellServices option. All this can really be done via
5774 the magic system. It's easier to extend, cleaner and has automatic
5783 the magic system. It's easier to extend, cleaner and has automatic
5775 namespace protection and documentation.
5784 namespace protection and documentation.
5776
5785
5777 2001-11-09 Fernando Perez <fperez@colorado.edu>
5786 2001-11-09 Fernando Perez <fperez@colorado.edu>
5778
5787
5779 * Fixed bug in output cache flushing (missing parameter to
5788 * Fixed bug in output cache flushing (missing parameter to
5780 __init__). Other small bugs fixed (found using pychecker).
5789 __init__). Other small bugs fixed (found using pychecker).
5781
5790
5782 * Version 0.1.4 opened for bugfixing.
5791 * Version 0.1.4 opened for bugfixing.
5783
5792
5784 2001-11-07 Fernando Perez <fperez@colorado.edu>
5793 2001-11-07 Fernando Perez <fperez@colorado.edu>
5785
5794
5786 * Version 0.1.3 released, mainly because of the raw_input bug.
5795 * Version 0.1.3 released, mainly because of the raw_input bug.
5787
5796
5788 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5797 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5789 and when testing for whether things were callable, a call could
5798 and when testing for whether things were callable, a call could
5790 actually be made to certain functions. They would get called again
5799 actually be made to certain functions. They would get called again
5791 once 'really' executed, with a resulting double call. A disaster
5800 once 'really' executed, with a resulting double call. A disaster
5792 in many cases (list.reverse() would never work!).
5801 in many cases (list.reverse() would never work!).
5793
5802
5794 * Removed prefilter() function, moved its code to raw_input (which
5803 * Removed prefilter() function, moved its code to raw_input (which
5795 after all was just a near-empty caller for prefilter). This saves
5804 after all was just a near-empty caller for prefilter). This saves
5796 a function call on every prompt, and simplifies the class a tiny bit.
5805 a function call on every prompt, and simplifies the class a tiny bit.
5797
5806
5798 * Fix _ip to __ip name in magic example file.
5807 * Fix _ip to __ip name in magic example file.
5799
5808
5800 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5809 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5801 work with non-gnu versions of tar.
5810 work with non-gnu versions of tar.
5802
5811
5803 2001-11-06 Fernando Perez <fperez@colorado.edu>
5812 2001-11-06 Fernando Perez <fperez@colorado.edu>
5804
5813
5805 * Version 0.1.2. Just to keep track of the recent changes.
5814 * Version 0.1.2. Just to keep track of the recent changes.
5806
5815
5807 * Fixed nasty bug in output prompt routine. It used to check 'if
5816 * Fixed nasty bug in output prompt routine. It used to check 'if
5808 arg != None...'. Problem is, this fails if arg implements a
5817 arg != None...'. Problem is, this fails if arg implements a
5809 special comparison (__cmp__) which disallows comparing to
5818 special comparison (__cmp__) which disallows comparing to
5810 None. Found it when trying to use the PhysicalQuantity module from
5819 None. Found it when trying to use the PhysicalQuantity module from
5811 ScientificPython.
5820 ScientificPython.
5812
5821
5813 2001-11-05 Fernando Perez <fperez@colorado.edu>
5822 2001-11-05 Fernando Perez <fperez@colorado.edu>
5814
5823
5815 * Also added dirs. Now the pushd/popd/dirs family functions
5824 * Also added dirs. Now the pushd/popd/dirs family functions
5816 basically like the shell, with the added convenience of going home
5825 basically like the shell, with the added convenience of going home
5817 when called with no args.
5826 when called with no args.
5818
5827
5819 * pushd/popd slightly modified to mimic shell behavior more
5828 * pushd/popd slightly modified to mimic shell behavior more
5820 closely.
5829 closely.
5821
5830
5822 * Added env,pushd,popd from ShellServices as magic functions. I
5831 * Added env,pushd,popd from ShellServices as magic functions. I
5823 think the cleanest will be to port all desired functions from
5832 think the cleanest will be to port all desired functions from
5824 ShellServices as magics and remove ShellServices altogether. This
5833 ShellServices as magics and remove ShellServices altogether. This
5825 will provide a single, clean way of adding functionality
5834 will provide a single, clean way of adding functionality
5826 (shell-type or otherwise) to IP.
5835 (shell-type or otherwise) to IP.
5827
5836
5828 2001-11-04 Fernando Perez <fperez@colorado.edu>
5837 2001-11-04 Fernando Perez <fperez@colorado.edu>
5829
5838
5830 * Added .ipython/ directory to sys.path. This way users can keep
5839 * Added .ipython/ directory to sys.path. This way users can keep
5831 customizations there and access them via import.
5840 customizations there and access them via import.
5832
5841
5833 2001-11-03 Fernando Perez <fperez@colorado.edu>
5842 2001-11-03 Fernando Perez <fperez@colorado.edu>
5834
5843
5835 * Opened version 0.1.1 for new changes.
5844 * Opened version 0.1.1 for new changes.
5836
5845
5837 * Changed version number to 0.1.0: first 'public' release, sent to
5846 * Changed version number to 0.1.0: first 'public' release, sent to
5838 Nathan and Janko.
5847 Nathan and Janko.
5839
5848
5840 * Lots of small fixes and tweaks.
5849 * Lots of small fixes and tweaks.
5841
5850
5842 * Minor changes to whos format. Now strings are shown, snipped if
5851 * Minor changes to whos format. Now strings are shown, snipped if
5843 too long.
5852 too long.
5844
5853
5845 * Changed ShellServices to work on __main__ so they show up in @who
5854 * Changed ShellServices to work on __main__ so they show up in @who
5846
5855
5847 * Help also works with ? at the end of a line:
5856 * Help also works with ? at the end of a line:
5848 ?sin and sin?
5857 ?sin and sin?
5849 both produce the same effect. This is nice, as often I use the
5858 both produce the same effect. This is nice, as often I use the
5850 tab-complete to find the name of a method, but I used to then have
5859 tab-complete to find the name of a method, but I used to then have
5851 to go to the beginning of the line to put a ? if I wanted more
5860 to go to the beginning of the line to put a ? if I wanted more
5852 info. Now I can just add the ? and hit return. Convenient.
5861 info. Now I can just add the ? and hit return. Convenient.
5853
5862
5854 2001-11-02 Fernando Perez <fperez@colorado.edu>
5863 2001-11-02 Fernando Perez <fperez@colorado.edu>
5855
5864
5856 * Python version check (>=2.1) added.
5865 * Python version check (>=2.1) added.
5857
5866
5858 * Added LazyPython documentation. At this point the docs are quite
5867 * Added LazyPython documentation. At this point the docs are quite
5859 a mess. A cleanup is in order.
5868 a mess. A cleanup is in order.
5860
5869
5861 * Auto-installer created. For some bizarre reason, the zipfiles
5870 * Auto-installer created. For some bizarre reason, the zipfiles
5862 module isn't working on my system. So I made a tar version
5871 module isn't working on my system. So I made a tar version
5863 (hopefully the command line options in various systems won't kill
5872 (hopefully the command line options in various systems won't kill
5864 me).
5873 me).
5865
5874
5866 * Fixes to Struct in genutils. Now all dictionary-like methods are
5875 * Fixes to Struct in genutils. Now all dictionary-like methods are
5867 protected (reasonably).
5876 protected (reasonably).
5868
5877
5869 * Added pager function to genutils and changed ? to print usage
5878 * Added pager function to genutils and changed ? to print usage
5870 note through it (it was too long).
5879 note through it (it was too long).
5871
5880
5872 * Added the LazyPython functionality. Works great! I changed the
5881 * Added the LazyPython functionality. Works great! I changed the
5873 auto-quote escape to ';', it's on home row and next to '. But
5882 auto-quote escape to ';', it's on home row and next to '. But
5874 both auto-quote and auto-paren (still /) escapes are command-line
5883 both auto-quote and auto-paren (still /) escapes are command-line
5875 parameters.
5884 parameters.
5876
5885
5877
5886
5878 2001-11-01 Fernando Perez <fperez@colorado.edu>
5887 2001-11-01 Fernando Perez <fperez@colorado.edu>
5879
5888
5880 * Version changed to 0.0.7. Fairly large change: configuration now
5889 * Version changed to 0.0.7. Fairly large change: configuration now
5881 is all stored in a directory, by default .ipython. There, all
5890 is all stored in a directory, by default .ipython. There, all
5882 config files have normal looking names (not .names)
5891 config files have normal looking names (not .names)
5883
5892
5884 * Version 0.0.6 Released first to Lucas and Archie as a test
5893 * Version 0.0.6 Released first to Lucas and Archie as a test
5885 run. Since it's the first 'semi-public' release, change version to
5894 run. Since it's the first 'semi-public' release, change version to
5886 > 0.0.6 for any changes now.
5895 > 0.0.6 for any changes now.
5887
5896
5888 * Stuff I had put in the ipplib.py changelog:
5897 * Stuff I had put in the ipplib.py changelog:
5889
5898
5890 Changes to InteractiveShell:
5899 Changes to InteractiveShell:
5891
5900
5892 - Made the usage message a parameter.
5901 - Made the usage message a parameter.
5893
5902
5894 - Require the name of the shell variable to be given. It's a bit
5903 - Require the name of the shell variable to be given. It's a bit
5895 of a hack, but allows the name 'shell' not to be hardwired in the
5904 of a hack, but allows the name 'shell' not to be hardwired in the
5896 magic (@) handler, which is problematic b/c it requires
5905 magic (@) handler, which is problematic b/c it requires
5897 polluting the global namespace with 'shell'. This in turn is
5906 polluting the global namespace with 'shell'. This in turn is
5898 fragile: if a user redefines a variable called shell, things
5907 fragile: if a user redefines a variable called shell, things
5899 break.
5908 break.
5900
5909
5901 - magic @: all functions available through @ need to be defined
5910 - magic @: all functions available through @ need to be defined
5902 as magic_<name>, even though they can be called simply as
5911 as magic_<name>, even though they can be called simply as
5903 @<name>. This allows the special command @magic to gather
5912 @<name>. This allows the special command @magic to gather
5904 information automatically about all existing magic functions,
5913 information automatically about all existing magic functions,
5905 even if they are run-time user extensions, by parsing the shell
5914 even if they are run-time user extensions, by parsing the shell
5906 instance __dict__ looking for special magic_ names.
5915 instance __dict__ looking for special magic_ names.
5907
5916
5908 - mainloop: added *two* local namespace parameters. This allows
5917 - mainloop: added *two* local namespace parameters. This allows
5909 the class to differentiate between parameters which were there
5918 the class to differentiate between parameters which were there
5910 before and after command line initialization was processed. This
5919 before and after command line initialization was processed. This
5911 way, later @who can show things loaded at startup by the
5920 way, later @who can show things loaded at startup by the
5912 user. This trick was necessary to make session saving/reloading
5921 user. This trick was necessary to make session saving/reloading
5913 really work: ideally after saving/exiting/reloading a session,
5922 really work: ideally after saving/exiting/reloading a session,
5914 *everything* should look the same, including the output of @who. I
5923 *everything* should look the same, including the output of @who. I
5915 was only able to make this work with this double namespace
5924 was only able to make this work with this double namespace
5916 trick.
5925 trick.
5917
5926
5918 - added a header to the logfile which allows (almost) full
5927 - added a header to the logfile which allows (almost) full
5919 session restoring.
5928 session restoring.
5920
5929
5921 - prepend lines beginning with @ or !, with a and log
5930 - prepend lines beginning with @ or !, with a and log
5922 them. Why? !lines: may be useful to know what you did @lines:
5931 them. Why? !lines: may be useful to know what you did @lines:
5923 they may affect session state. So when restoring a session, at
5932 they may affect session state. So when restoring a session, at
5924 least inform the user of their presence. I couldn't quite get
5933 least inform the user of their presence. I couldn't quite get
5925 them to properly re-execute, but at least the user is warned.
5934 them to properly re-execute, but at least the user is warned.
5926
5935
5927 * Started ChangeLog.
5936 * Started ChangeLog.
@@ -1,18 +1,12 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
16 import IPython
10 import IPython
17
11
18 IPython.Shell.start().mainloop()
12 IPython.Shell.start().mainloop()
@@ -1,33 +1,27 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 # 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)
31
32 import IPython
26 import IPython
33 IPython.Shell.start().mainloop()
27 IPython.Shell.start().mainloop()
General Comments 0
You need to be logged in to leave comments. Login now