##// END OF EJS Templates
Update BSD fix for aliases, the previous patch was incomplete. Submitted by...
fperez -
Show More
@@ -1,2320 +1,2320 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 1355 2006-06-07 16:56:50Z vivainio $
9 $Id: iplib.py 1356 2006-06-07 23:51:05Z 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 pdb
50 import pdb
51 import pydoc
51 import pydoc
52 import re
52 import re
53 import shutil
53 import shutil
54 import string
54 import string
55 import sys
55 import sys
56 import tempfile
56 import tempfile
57 import traceback
57 import traceback
58 import types
58 import types
59 import pickleshare
59 import pickleshare
60
60
61 from pprint import pprint, pformat
61 from pprint import pprint, pformat
62
62
63 # IPython's own modules
63 # IPython's own modules
64 import IPython
64 import IPython
65 from IPython import OInspect,PyColorize,ultraTB
65 from IPython import OInspect,PyColorize,ultraTB
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.FakeModule import FakeModule
67 from IPython.FakeModule import FakeModule
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 from IPython.Logger import Logger
69 from IPython.Logger import Logger
70 from IPython.Magic import Magic
70 from IPython.Magic import Magic
71 from IPython.Prompts import CachedOutput
71 from IPython.Prompts import CachedOutput
72 from IPython.ipstruct import Struct
72 from IPython.ipstruct import Struct
73 from IPython.background_jobs import BackgroundJobManager
73 from IPython.background_jobs import BackgroundJobManager
74 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.genutils import *
75 from IPython.genutils import *
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 InputList(list):
129 class InputList(list):
130 """Class to store user input.
130 """Class to store user input.
131
131
132 It's basically a list, but slices return a string instead of a list, thus
132 It's basically a list, but slices return a string instead of a list, thus
133 allowing things like (assuming 'In' is an instance):
133 allowing things like (assuming 'In' is an instance):
134
134
135 exec In[4:7]
135 exec In[4:7]
136
136
137 or
137 or
138
138
139 exec In[5:9] + In[14] + In[21:25]"""
139 exec In[5:9] + In[14] + In[21:25]"""
140
140
141 def __getslice__(self,i,j):
141 def __getslice__(self,i,j):
142 return ''.join(list.__getslice__(self,i,j))
142 return ''.join(list.__getslice__(self,i,j))
143
143
144 class SyntaxTB(ultraTB.ListTB):
144 class SyntaxTB(ultraTB.ListTB):
145 """Extension which holds some state: the last exception value"""
145 """Extension which holds some state: the last exception value"""
146
146
147 def __init__(self,color_scheme = 'NoColor'):
147 def __init__(self,color_scheme = 'NoColor'):
148 ultraTB.ListTB.__init__(self,color_scheme)
148 ultraTB.ListTB.__init__(self,color_scheme)
149 self.last_syntax_error = None
149 self.last_syntax_error = None
150
150
151 def __call__(self, etype, value, elist):
151 def __call__(self, etype, value, elist):
152 self.last_syntax_error = value
152 self.last_syntax_error = value
153 ultraTB.ListTB.__call__(self,etype,value,elist)
153 ultraTB.ListTB.__call__(self,etype,value,elist)
154
154
155 def clear_err_state(self):
155 def clear_err_state(self):
156 """Return the current error state and clear it"""
156 """Return the current error state and clear it"""
157 e = self.last_syntax_error
157 e = self.last_syntax_error
158 self.last_syntax_error = None
158 self.last_syntax_error = None
159 return e
159 return e
160
160
161 #****************************************************************************
161 #****************************************************************************
162 # Main IPython class
162 # Main IPython class
163
163
164 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
164 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
165 # until a full rewrite is made. I've cleaned all cross-class uses of
165 # until a full rewrite is made. I've cleaned all cross-class uses of
166 # attributes and methods, but too much user code out there relies on the
166 # attributes and methods, but too much user code out there relies on the
167 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
167 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
168 #
168 #
169 # But at least now, all the pieces have been separated and we could, in
169 # But at least now, all the pieces have been separated and we could, in
170 # principle, stop using the mixin. This will ease the transition to the
170 # principle, stop using the mixin. This will ease the transition to the
171 # chainsaw branch.
171 # chainsaw branch.
172
172
173 # For reference, the following is the list of 'self.foo' uses in the Magic
173 # For reference, the following is the list of 'self.foo' uses in the Magic
174 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
174 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
175 # class, to prevent clashes.
175 # class, to prevent clashes.
176
176
177 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
177 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
178 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
178 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
179 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
179 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
180 # 'self.value']
180 # 'self.value']
181
181
182 class InteractiveShell(object,Magic):
182 class InteractiveShell(object,Magic):
183 """An enhanced console for Python."""
183 """An enhanced console for Python."""
184
184
185 # class attribute to indicate whether the class supports threads or not.
185 # class attribute to indicate whether the class supports threads or not.
186 # Subclasses with thread support should override this as needed.
186 # Subclasses with thread support should override this as needed.
187 isthreaded = False
187 isthreaded = False
188
188
189 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
189 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
190 user_ns = None,user_global_ns=None,banner2='',
190 user_ns = None,user_global_ns=None,banner2='',
191 custom_exceptions=((),None),embedded=False):
191 custom_exceptions=((),None),embedded=False):
192
192
193 # log system
193 # log system
194 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
194 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
195
195
196 # some minimal strict typechecks. For some core data structures, I
196 # some minimal strict typechecks. For some core data structures, I
197 # want actual basic python types, not just anything that looks like
197 # want actual basic python types, not just anything that looks like
198 # one. This is especially true for namespaces.
198 # one. This is especially true for namespaces.
199 for ns in (user_ns,user_global_ns):
199 for ns in (user_ns,user_global_ns):
200 if ns is not None and type(ns) != types.DictType:
200 if ns is not None and type(ns) != types.DictType:
201 raise TypeError,'namespace must be a dictionary'
201 raise TypeError,'namespace must be a dictionary'
202
202
203 # Job manager (for jobs run as background threads)
203 # Job manager (for jobs run as background threads)
204 self.jobs = BackgroundJobManager()
204 self.jobs = BackgroundJobManager()
205
205
206 # Store the actual shell's name
206 # Store the actual shell's name
207 self.name = name
207 self.name = name
208
208
209 # We need to know whether the instance is meant for embedding, since
209 # We need to know whether the instance is meant for embedding, since
210 # global/local namespaces need to be handled differently in that case
210 # global/local namespaces need to be handled differently in that case
211 self.embedded = embedded
211 self.embedded = embedded
212
212
213 # command compiler
213 # command compiler
214 self.compile = codeop.CommandCompiler()
214 self.compile = codeop.CommandCompiler()
215
215
216 # User input buffer
216 # User input buffer
217 self.buffer = []
217 self.buffer = []
218
218
219 # Default name given in compilation of code
219 # Default name given in compilation of code
220 self.filename = '<ipython console>'
220 self.filename = '<ipython console>'
221
221
222 # Make an empty namespace, which extension writers can rely on both
222 # Make an empty namespace, which extension writers can rely on both
223 # existing and NEVER being used by ipython itself. This gives them a
223 # existing and NEVER being used by ipython itself. This gives them a
224 # convenient location for storing additional information and state
224 # convenient location for storing additional information and state
225 # their extensions may require, without fear of collisions with other
225 # their extensions may require, without fear of collisions with other
226 # ipython names that may develop later.
226 # ipython names that may develop later.
227 self.meta = Struct()
227 self.meta = Struct()
228
228
229 # Create the namespace where the user will operate. user_ns is
229 # Create the namespace where the user will operate. user_ns is
230 # normally the only one used, and it is passed to the exec calls as
230 # normally the only one used, and it is passed to the exec calls as
231 # the locals argument. But we do carry a user_global_ns namespace
231 # the locals argument. But we do carry a user_global_ns namespace
232 # given as the exec 'globals' argument, This is useful in embedding
232 # given as the exec 'globals' argument, This is useful in embedding
233 # situations where the ipython shell opens in a context where the
233 # situations where the ipython shell opens in a context where the
234 # distinction between locals and globals is meaningful.
234 # distinction between locals and globals is meaningful.
235
235
236 # FIXME. For some strange reason, __builtins__ is showing up at user
236 # FIXME. For some strange reason, __builtins__ is showing up at user
237 # level as a dict instead of a module. This is a manual fix, but I
237 # level as a dict instead of a module. This is a manual fix, but I
238 # should really track down where the problem is coming from. Alex
238 # should really track down where the problem is coming from. Alex
239 # Schmolck reported this problem first.
239 # Schmolck reported this problem first.
240
240
241 # A useful post by Alex Martelli on this topic:
241 # A useful post by Alex Martelli on this topic:
242 # Re: inconsistent value from __builtins__
242 # Re: inconsistent value from __builtins__
243 # Von: Alex Martelli <aleaxit@yahoo.com>
243 # Von: Alex Martelli <aleaxit@yahoo.com>
244 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
244 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
245 # Gruppen: comp.lang.python
245 # Gruppen: comp.lang.python
246
246
247 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
247 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
248 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
248 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
249 # > <type 'dict'>
249 # > <type 'dict'>
250 # > >>> print type(__builtins__)
250 # > >>> print type(__builtins__)
251 # > <type 'module'>
251 # > <type 'module'>
252 # > Is this difference in return value intentional?
252 # > Is this difference in return value intentional?
253
253
254 # Well, it's documented that '__builtins__' can be either a dictionary
254 # Well, it's documented that '__builtins__' can be either a dictionary
255 # or a module, and it's been that way for a long time. Whether it's
255 # or a module, and it's been that way for a long time. Whether it's
256 # intentional (or sensible), I don't know. In any case, the idea is
256 # intentional (or sensible), I don't know. In any case, the idea is
257 # that if you need to access the built-in namespace directly, you
257 # that if you need to access the built-in namespace directly, you
258 # should start with "import __builtin__" (note, no 's') which will
258 # should start with "import __builtin__" (note, no 's') which will
259 # definitely give you a module. Yeah, it's somewhat confusing:-(.
259 # definitely give you a module. Yeah, it's somewhat confusing:-(.
260
260
261 # These routines return properly built dicts as needed by the rest of
261 # These routines return properly built dicts as needed by the rest of
262 # the code, and can also be used by extension writers to generate
262 # the code, and can also be used by extension writers to generate
263 # properly initialized namespaces.
263 # properly initialized namespaces.
264 user_ns = IPython.ipapi.make_user_ns(user_ns)
264 user_ns = IPython.ipapi.make_user_ns(user_ns)
265 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
265 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
266
266
267 # Assign namespaces
267 # Assign namespaces
268 # This is the namespace where all normal user variables live
268 # This is the namespace where all normal user variables live
269 self.user_ns = user_ns
269 self.user_ns = user_ns
270 # Embedded instances require a separate namespace for globals.
270 # Embedded instances require a separate namespace for globals.
271 # Normally this one is unused by non-embedded instances.
271 # Normally this one is unused by non-embedded instances.
272 self.user_global_ns = user_global_ns
272 self.user_global_ns = user_global_ns
273 # A namespace to keep track of internal data structures to prevent
273 # A namespace to keep track of internal data structures to prevent
274 # them from cluttering user-visible stuff. Will be updated later
274 # them from cluttering user-visible stuff. Will be updated later
275 self.internal_ns = {}
275 self.internal_ns = {}
276
276
277 # Namespace of system aliases. Each entry in the alias
277 # Namespace of system aliases. Each entry in the alias
278 # table must be a 2-tuple of the form (N,name), where N is the number
278 # table must be a 2-tuple of the form (N,name), where N is the number
279 # of positional arguments of the alias.
279 # of positional arguments of the alias.
280 self.alias_table = {}
280 self.alias_table = {}
281
281
282 # A table holding all the namespaces IPython deals with, so that
282 # A table holding all the namespaces IPython deals with, so that
283 # introspection facilities can search easily.
283 # introspection facilities can search easily.
284 self.ns_table = {'user':user_ns,
284 self.ns_table = {'user':user_ns,
285 'user_global':user_global_ns,
285 'user_global':user_global_ns,
286 'alias':self.alias_table,
286 'alias':self.alias_table,
287 'internal':self.internal_ns,
287 'internal':self.internal_ns,
288 'builtin':__builtin__.__dict__
288 'builtin':__builtin__.__dict__
289 }
289 }
290
290
291 # The user namespace MUST have a pointer to the shell itself.
291 # The user namespace MUST have a pointer to the shell itself.
292 self.user_ns[name] = self
292 self.user_ns[name] = self
293
293
294 # We need to insert into sys.modules something that looks like a
294 # We need to insert into sys.modules something that looks like a
295 # module but which accesses the IPython namespace, for shelve and
295 # module but which accesses the IPython namespace, for shelve and
296 # pickle to work interactively. Normally they rely on getting
296 # pickle to work interactively. Normally they rely on getting
297 # everything out of __main__, but for embedding purposes each IPython
297 # everything out of __main__, but for embedding purposes each IPython
298 # instance has its own private namespace, so we can't go shoving
298 # instance has its own private namespace, so we can't go shoving
299 # everything into __main__.
299 # everything into __main__.
300
300
301 # note, however, that we should only do this for non-embedded
301 # note, however, that we should only do this for non-embedded
302 # ipythons, which really mimic the __main__.__dict__ with their own
302 # ipythons, which really mimic the __main__.__dict__ with their own
303 # namespace. Embedded instances, on the other hand, should not do
303 # namespace. Embedded instances, on the other hand, should not do
304 # this because they need to manage the user local/global namespaces
304 # this because they need to manage the user local/global namespaces
305 # only, but they live within a 'normal' __main__ (meaning, they
305 # only, but they live within a 'normal' __main__ (meaning, they
306 # shouldn't overtake the execution environment of the script they're
306 # shouldn't overtake the execution environment of the script they're
307 # embedded in).
307 # embedded in).
308
308
309 if not embedded:
309 if not embedded:
310 try:
310 try:
311 main_name = self.user_ns['__name__']
311 main_name = self.user_ns['__name__']
312 except KeyError:
312 except KeyError:
313 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
313 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
314 else:
314 else:
315 #print "pickle hack in place" # dbg
315 #print "pickle hack in place" # dbg
316 #print 'main_name:',main_name # dbg
316 #print 'main_name:',main_name # dbg
317 sys.modules[main_name] = FakeModule(self.user_ns)
317 sys.modules[main_name] = FakeModule(self.user_ns)
318
318
319 # List of input with multi-line handling.
319 # List of input with multi-line handling.
320 # Fill its zero entry, user counter starts at 1
320 # Fill its zero entry, user counter starts at 1
321 self.input_hist = InputList(['\n'])
321 self.input_hist = InputList(['\n'])
322 # This one will hold the 'raw' input history, without any
322 # This one will hold the 'raw' input history, without any
323 # pre-processing. This will allow users to retrieve the input just as
323 # pre-processing. This will allow users to retrieve the input just as
324 # it was exactly typed in by the user, with %hist -r.
324 # it was exactly typed in by the user, with %hist -r.
325 self.input_hist_raw = InputList(['\n'])
325 self.input_hist_raw = InputList(['\n'])
326
326
327 # list of visited directories
327 # list of visited directories
328 try:
328 try:
329 self.dir_hist = [os.getcwd()]
329 self.dir_hist = [os.getcwd()]
330 except IOError, e:
330 except IOError, e:
331 self.dir_hist = []
331 self.dir_hist = []
332
332
333 # dict of output history
333 # dict of output history
334 self.output_hist = {}
334 self.output_hist = {}
335
335
336 # dict of things NOT to alias (keywords, builtins and some magics)
336 # dict of things NOT to alias (keywords, builtins and some magics)
337 no_alias = {}
337 no_alias = {}
338 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
338 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
339 for key in keyword.kwlist + no_alias_magics:
339 for key in keyword.kwlist + no_alias_magics:
340 no_alias[key] = 1
340 no_alias[key] = 1
341 no_alias.update(__builtin__.__dict__)
341 no_alias.update(__builtin__.__dict__)
342 self.no_alias = no_alias
342 self.no_alias = no_alias
343
343
344 # make global variables for user access to these
344 # make global variables for user access to these
345 self.user_ns['_ih'] = self.input_hist
345 self.user_ns['_ih'] = self.input_hist
346 self.user_ns['_oh'] = self.output_hist
346 self.user_ns['_oh'] = self.output_hist
347 self.user_ns['_dh'] = self.dir_hist
347 self.user_ns['_dh'] = self.dir_hist
348
348
349 # user aliases to input and output histories
349 # user aliases to input and output histories
350 self.user_ns['In'] = self.input_hist
350 self.user_ns['In'] = self.input_hist
351 self.user_ns['Out'] = self.output_hist
351 self.user_ns['Out'] = self.output_hist
352
352
353 # Object variable to store code object waiting execution. This is
353 # Object variable to store code object waiting execution. This is
354 # used mainly by the multithreaded shells, but it can come in handy in
354 # used mainly by the multithreaded shells, but it can come in handy in
355 # other situations. No need to use a Queue here, since it's a single
355 # other situations. No need to use a Queue here, since it's a single
356 # item which gets cleared once run.
356 # item which gets cleared once run.
357 self.code_to_run = None
357 self.code_to_run = None
358
358
359 # escapes for automatic behavior on the command line
359 # escapes for automatic behavior on the command line
360 self.ESC_SHELL = '!'
360 self.ESC_SHELL = '!'
361 self.ESC_HELP = '?'
361 self.ESC_HELP = '?'
362 self.ESC_MAGIC = '%'
362 self.ESC_MAGIC = '%'
363 self.ESC_QUOTE = ','
363 self.ESC_QUOTE = ','
364 self.ESC_QUOTE2 = ';'
364 self.ESC_QUOTE2 = ';'
365 self.ESC_PAREN = '/'
365 self.ESC_PAREN = '/'
366
366
367 # And their associated handlers
367 # And their associated handlers
368 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
368 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
369 self.ESC_QUOTE : self.handle_auto,
369 self.ESC_QUOTE : self.handle_auto,
370 self.ESC_QUOTE2 : self.handle_auto,
370 self.ESC_QUOTE2 : self.handle_auto,
371 self.ESC_MAGIC : self.handle_magic,
371 self.ESC_MAGIC : self.handle_magic,
372 self.ESC_HELP : self.handle_help,
372 self.ESC_HELP : self.handle_help,
373 self.ESC_SHELL : self.handle_shell_escape,
373 self.ESC_SHELL : self.handle_shell_escape,
374 }
374 }
375
375
376 # class initializations
376 # class initializations
377 Magic.__init__(self,self)
377 Magic.__init__(self,self)
378
378
379 # Python source parser/formatter for syntax highlighting
379 # Python source parser/formatter for syntax highlighting
380 pyformat = PyColorize.Parser().format
380 pyformat = PyColorize.Parser().format
381 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
381 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
382
382
383 # hooks holds pointers used for user-side customizations
383 # hooks holds pointers used for user-side customizations
384 self.hooks = Struct()
384 self.hooks = Struct()
385
385
386 # Set all default hooks, defined in the IPython.hooks module.
386 # Set all default hooks, defined in the IPython.hooks module.
387 hooks = IPython.hooks
387 hooks = IPython.hooks
388 for hook_name in hooks.__all__:
388 for hook_name in hooks.__all__:
389 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
389 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
390 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
390 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
391 #print "bound hook",hook_name
391 #print "bound hook",hook_name
392
392
393 # Flag to mark unconditional exit
393 # Flag to mark unconditional exit
394 self.exit_now = False
394 self.exit_now = False
395
395
396 self.usage_min = """\
396 self.usage_min = """\
397 An enhanced console for Python.
397 An enhanced console for Python.
398 Some of its features are:
398 Some of its features are:
399 - Readline support if the readline library is present.
399 - Readline support if the readline library is present.
400 - Tab completion in the local namespace.
400 - Tab completion in the local namespace.
401 - Logging of input, see command-line options.
401 - Logging of input, see command-line options.
402 - System shell escape via ! , eg !ls.
402 - System shell escape via ! , eg !ls.
403 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
403 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
404 - Keeps track of locally defined variables via %who, %whos.
404 - Keeps track of locally defined variables via %who, %whos.
405 - Show object information with a ? eg ?x or x? (use ?? for more info).
405 - Show object information with a ? eg ?x or x? (use ?? for more info).
406 """
406 """
407 if usage: self.usage = usage
407 if usage: self.usage = usage
408 else: self.usage = self.usage_min
408 else: self.usage = self.usage_min
409
409
410 # Storage
410 # Storage
411 self.rc = rc # This will hold all configuration information
411 self.rc = rc # This will hold all configuration information
412 self.pager = 'less'
412 self.pager = 'less'
413 # temporary files used for various purposes. Deleted at exit.
413 # temporary files used for various purposes. Deleted at exit.
414 self.tempfiles = []
414 self.tempfiles = []
415
415
416 # Keep track of readline usage (later set by init_readline)
416 # Keep track of readline usage (later set by init_readline)
417 self.has_readline = False
417 self.has_readline = False
418
418
419 # template for logfile headers. It gets resolved at runtime by the
419 # template for logfile headers. It gets resolved at runtime by the
420 # logstart method.
420 # logstart method.
421 self.loghead_tpl = \
421 self.loghead_tpl = \
422 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
422 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
423 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
423 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
424 #log# opts = %s
424 #log# opts = %s
425 #log# args = %s
425 #log# args = %s
426 #log# It is safe to make manual edits below here.
426 #log# It is safe to make manual edits below here.
427 #log#-----------------------------------------------------------------------
427 #log#-----------------------------------------------------------------------
428 """
428 """
429 # for pushd/popd management
429 # for pushd/popd management
430 try:
430 try:
431 self.home_dir = get_home_dir()
431 self.home_dir = get_home_dir()
432 except HomeDirError,msg:
432 except HomeDirError,msg:
433 fatal(msg)
433 fatal(msg)
434
434
435 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
435 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
436
436
437 # Functions to call the underlying shell.
437 # Functions to call the underlying shell.
438
438
439 # utility to expand user variables via Itpl
439 # utility to expand user variables via Itpl
440 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
440 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
441 self.user_ns))
441 self.user_ns))
442 # The first is similar to os.system, but it doesn't return a value,
442 # The first is similar to os.system, but it doesn't return a value,
443 # and it allows interpolation of variables in the user's namespace.
443 # and it allows interpolation of variables in the user's namespace.
444 self.system = lambda cmd: shell(self.var_expand(cmd),
444 self.system = lambda cmd: shell(self.var_expand(cmd),
445 header='IPython system call: ',
445 header='IPython system call: ',
446 verbose=self.rc.system_verbose)
446 verbose=self.rc.system_verbose)
447 # These are for getoutput and getoutputerror:
447 # These are for getoutput and getoutputerror:
448 self.getoutput = lambda cmd: \
448 self.getoutput = lambda cmd: \
449 getoutput(self.var_expand(cmd),
449 getoutput(self.var_expand(cmd),
450 header='IPython system call: ',
450 header='IPython system call: ',
451 verbose=self.rc.system_verbose)
451 verbose=self.rc.system_verbose)
452 self.getoutputerror = lambda cmd: \
452 self.getoutputerror = lambda cmd: \
453 getoutputerror(self.var_expand(cmd),
453 getoutputerror(self.var_expand(cmd),
454 header='IPython system call: ',
454 header='IPython system call: ',
455 verbose=self.rc.system_verbose)
455 verbose=self.rc.system_verbose)
456
456
457 # RegExp for splitting line contents into pre-char//first
457 # RegExp for splitting line contents into pre-char//first
458 # word-method//rest. For clarity, each group in on one line.
458 # word-method//rest. For clarity, each group in on one line.
459
459
460 # WARNING: update the regexp if the above escapes are changed, as they
460 # WARNING: update the regexp if the above escapes are changed, as they
461 # are hardwired in.
461 # are hardwired in.
462
462
463 # Don't get carried away with trying to make the autocalling catch too
463 # Don't get carried away with trying to make the autocalling catch too
464 # much: it's better to be conservative rather than to trigger hidden
464 # much: it's better to be conservative rather than to trigger hidden
465 # evals() somewhere and end up causing side effects.
465 # evals() somewhere and end up causing side effects.
466
466
467 self.line_split = re.compile(r'^([\s*,;/])'
467 self.line_split = re.compile(r'^([\s*,;/])'
468 r'([\?\w\.]+\w*\s*)'
468 r'([\?\w\.]+\w*\s*)'
469 r'(\(?.*$)')
469 r'(\(?.*$)')
470
470
471 # Original re, keep around for a while in case changes break something
471 # Original re, keep around for a while in case changes break something
472 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
472 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
473 # r'(\s*[\?\w\.]+\w*\s*)'
473 # r'(\s*[\?\w\.]+\w*\s*)'
474 # r'(\(?.*$)')
474 # r'(\(?.*$)')
475
475
476 # RegExp to identify potential function names
476 # RegExp to identify potential function names
477 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
477 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
478
478
479 # RegExp to exclude strings with this start from autocalling. In
479 # RegExp to exclude strings with this start from autocalling. In
480 # particular, all binary operators should be excluded, so that if foo
480 # particular, all binary operators should be excluded, so that if foo
481 # is callable, foo OP bar doesn't become foo(OP bar), which is
481 # is callable, foo OP bar doesn't become foo(OP bar), which is
482 # invalid. The characters '!=()' don't need to be checked for, as the
482 # invalid. The characters '!=()' don't need to be checked for, as the
483 # _prefilter routine explicitely does so, to catch direct calls and
483 # _prefilter routine explicitely does so, to catch direct calls and
484 # rebindings of existing names.
484 # rebindings of existing names.
485
485
486 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
486 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
487 # it affects the rest of the group in square brackets.
487 # it affects the rest of the group in square brackets.
488 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
488 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
489 '|^is |^not |^in |^and |^or ')
489 '|^is |^not |^in |^and |^or ')
490
490
491 # try to catch also methods for stuff in lists/tuples/dicts: off
491 # try to catch also methods for stuff in lists/tuples/dicts: off
492 # (experimental). For this to work, the line_split regexp would need
492 # (experimental). For this to work, the line_split regexp would need
493 # to be modified so it wouldn't break things at '['. That line is
493 # to be modified so it wouldn't break things at '['. That line is
494 # nasty enough that I shouldn't change it until I can test it _well_.
494 # nasty enough that I shouldn't change it until I can test it _well_.
495 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
495 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
496
496
497 # keep track of where we started running (mainly for crash post-mortem)
497 # keep track of where we started running (mainly for crash post-mortem)
498 self.starting_dir = os.getcwd()
498 self.starting_dir = os.getcwd()
499
499
500 # Various switches which can be set
500 # Various switches which can be set
501 self.CACHELENGTH = 5000 # this is cheap, it's just text
501 self.CACHELENGTH = 5000 # this is cheap, it's just text
502 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
502 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
503 self.banner2 = banner2
503 self.banner2 = banner2
504
504
505 # TraceBack handlers:
505 # TraceBack handlers:
506
506
507 # Syntax error handler.
507 # Syntax error handler.
508 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
508 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
509
509
510 # The interactive one is initialized with an offset, meaning we always
510 # The interactive one is initialized with an offset, meaning we always
511 # want to remove the topmost item in the traceback, which is our own
511 # want to remove the topmost item in the traceback, which is our own
512 # internal code. Valid modes: ['Plain','Context','Verbose']
512 # internal code. Valid modes: ['Plain','Context','Verbose']
513 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
513 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
514 color_scheme='NoColor',
514 color_scheme='NoColor',
515 tb_offset = 1)
515 tb_offset = 1)
516
516
517 # IPython itself shouldn't crash. This will produce a detailed
517 # IPython itself shouldn't crash. This will produce a detailed
518 # post-mortem if it does. But we only install the crash handler for
518 # post-mortem if it does. But we only install the crash handler for
519 # non-threaded shells, the threaded ones use a normal verbose reporter
519 # non-threaded shells, the threaded ones use a normal verbose reporter
520 # and lose the crash handler. This is because exceptions in the main
520 # and lose the crash handler. This is because exceptions in the main
521 # thread (such as in GUI code) propagate directly to sys.excepthook,
521 # thread (such as in GUI code) propagate directly to sys.excepthook,
522 # and there's no point in printing crash dumps for every user exception.
522 # and there's no point in printing crash dumps for every user exception.
523 if self.isthreaded:
523 if self.isthreaded:
524 sys.excepthook = ultraTB.FormattedTB()
524 sys.excepthook = ultraTB.FormattedTB()
525 else:
525 else:
526 from IPython import CrashHandler
526 from IPython import CrashHandler
527 sys.excepthook = CrashHandler.CrashHandler(self)
527 sys.excepthook = CrashHandler.CrashHandler(self)
528
528
529 # The instance will store a pointer to this, so that runtime code
529 # The instance will store a pointer to this, so that runtime code
530 # (such as magics) can access it. This is because during the
530 # (such as magics) can access it. This is because during the
531 # read-eval loop, it gets temporarily overwritten (to deal with GUI
531 # read-eval loop, it gets temporarily overwritten (to deal with GUI
532 # frameworks).
532 # frameworks).
533 self.sys_excepthook = sys.excepthook
533 self.sys_excepthook = sys.excepthook
534
534
535 # and add any custom exception handlers the user may have specified
535 # and add any custom exception handlers the user may have specified
536 self.set_custom_exc(*custom_exceptions)
536 self.set_custom_exc(*custom_exceptions)
537
537
538 # indentation management
538 # indentation management
539 self.autoindent = False
539 self.autoindent = False
540 self.indent_current_nsp = 0
540 self.indent_current_nsp = 0
541
541
542 # Make some aliases automatically
542 # Make some aliases automatically
543 # Prepare list of shell aliases to auto-define
543 # Prepare list of shell aliases to auto-define
544 if os.name == 'posix':
544 if os.name == 'posix':
545 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
545 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
546 'mv mv -i','rm rm -i','cp cp -i',
546 'mv mv -i','rm rm -i','cp cp -i',
547 'cat cat','less less','clear clear',
547 'cat cat','less less','clear clear',
548 # a better ls
548 # a better ls
549 'ls ls -F',
549 'ls ls -F',
550 # long ls
550 # long ls
551 'll ls -lF')
551 'll ls -lF')
552 # Extra ls aliases with color, which need special treatment on BSD
552 # Extra ls aliases with color, which need special treatment on BSD
553 # variants
553 # variants
554 ls_extra = ( # color ls
554 ls_extra = ( # color ls
555 'lc ls -F -o --color',
555 'lc ls -F -o --color',
556 # ls normal files only
556 # ls normal files only
557 'lf ls -F -o --color %l | grep ^-',
557 'lf ls -F -o --color %l | grep ^-',
558 # ls symbolic links
558 # ls symbolic links
559 'lk ls -F -o --color %l | grep ^l',
559 'lk ls -F -o --color %l | grep ^l',
560 # directories or links to directories,
560 # directories or links to directories,
561 'ldir ls -F -o --color %l | grep /$',
561 'ldir ls -F -o --color %l | grep /$',
562 # things which are executable
562 # things which are executable
563 'lx ls -F -o --color %l | grep ^-..x',
563 'lx ls -F -o --color %l | grep ^-..x',
564 )
564 )
565 # The BSDs don't ship GNU ls, so they don't understand the
565 # The BSDs don't ship GNU ls, so they don't understand the
566 # --color switch out of the box
566 # --color switch out of the box
567 if 'bsd' in sys.platform:
567 if 'bsd' in sys.platform:
568 ls_extra = ( # ls normal files only
568 ls_extra = ( # ls normal files only
569 'lf ls -F -o %l | grep ^-',
569 'lf ls -lF | grep ^-',
570 # ls symbolic links
570 # ls symbolic links
571 'lk ls -F -o %l | grep ^l',
571 'lk ls -lF | grep ^l',
572 # directories or links to directories,
572 # directories or links to directories,
573 'ldir ls -F -o %l | grep /$',
573 'ldir ls -lF | grep /$',
574 # things which are executable
574 # things which are executable
575 'lx ls -F -o %l | grep ^-..x',
575 'lx ls -lF | grep ^-..x',
576 )
576 )
577 auto_alias = auto_alias + ls_extra
577 auto_alias = auto_alias + ls_extra
578 elif os.name in ['nt','dos']:
578 elif os.name in ['nt','dos']:
579 auto_alias = ('dir dir /on', 'ls dir /on',
579 auto_alias = ('dir dir /on', 'ls dir /on',
580 'ddir dir /ad /on', 'ldir dir /ad /on',
580 'ddir dir /ad /on', 'ldir dir /ad /on',
581 'mkdir mkdir','rmdir rmdir','echo echo',
581 'mkdir mkdir','rmdir rmdir','echo echo',
582 'ren ren','cls cls','copy copy')
582 'ren ren','cls cls','copy copy')
583 else:
583 else:
584 auto_alias = ()
584 auto_alias = ()
585 self.auto_alias = [s.split(None,1) for s in auto_alias]
585 self.auto_alias = [s.split(None,1) for s in auto_alias]
586 # Call the actual (public) initializer
586 # Call the actual (public) initializer
587 self.init_auto_alias()
587 self.init_auto_alias()
588
588
589 # Produce a public API instance
589 # Produce a public API instance
590 self.api = IPython.ipapi.IPApi(self)
590 self.api = IPython.ipapi.IPApi(self)
591
591
592 # track which builtins we add, so we can clean up later
592 # track which builtins we add, so we can clean up later
593 self.builtins_added = {}
593 self.builtins_added = {}
594 # This method will add the necessary builtins for operation, but
594 # This method will add the necessary builtins for operation, but
595 # tracking what it did via the builtins_added dict.
595 # tracking what it did via the builtins_added dict.
596 self.add_builtins()
596 self.add_builtins()
597
597
598 # end __init__
598 # end __init__
599
599
600 def pre_config_initialization(self):
600 def pre_config_initialization(self):
601 """Pre-configuration init method
601 """Pre-configuration init method
602
602
603 This is called before the configuration files are processed to
603 This is called before the configuration files are processed to
604 prepare the services the config files might need.
604 prepare the services the config files might need.
605
605
606 self.rc already has reasonable default values at this point.
606 self.rc already has reasonable default values at this point.
607 """
607 """
608 rc = self.rc
608 rc = self.rc
609
609
610 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
610 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
611
611
612 def post_config_initialization(self):
612 def post_config_initialization(self):
613 """Post configuration init method
613 """Post configuration init method
614
614
615 This is called after the configuration files have been processed to
615 This is called after the configuration files have been processed to
616 'finalize' the initialization."""
616 'finalize' the initialization."""
617
617
618 rc = self.rc
618 rc = self.rc
619
619
620 # Object inspector
620 # Object inspector
621 self.inspector = OInspect.Inspector(OInspect.InspectColors,
621 self.inspector = OInspect.Inspector(OInspect.InspectColors,
622 PyColorize.ANSICodeColors,
622 PyColorize.ANSICodeColors,
623 'NoColor',
623 'NoColor',
624 rc.object_info_string_level)
624 rc.object_info_string_level)
625
625
626 # Load readline proper
626 # Load readline proper
627 if rc.readline:
627 if rc.readline:
628 self.init_readline()
628 self.init_readline()
629
629
630 # local shortcut, this is used a LOT
630 # local shortcut, this is used a LOT
631 self.log = self.logger.log
631 self.log = self.logger.log
632
632
633 # Initialize cache, set in/out prompts and printing system
633 # Initialize cache, set in/out prompts and printing system
634 self.outputcache = CachedOutput(self,
634 self.outputcache = CachedOutput(self,
635 rc.cache_size,
635 rc.cache_size,
636 rc.pprint,
636 rc.pprint,
637 input_sep = rc.separate_in,
637 input_sep = rc.separate_in,
638 output_sep = rc.separate_out,
638 output_sep = rc.separate_out,
639 output_sep2 = rc.separate_out2,
639 output_sep2 = rc.separate_out2,
640 ps1 = rc.prompt_in1,
640 ps1 = rc.prompt_in1,
641 ps2 = rc.prompt_in2,
641 ps2 = rc.prompt_in2,
642 ps_out = rc.prompt_out,
642 ps_out = rc.prompt_out,
643 pad_left = rc.prompts_pad_left)
643 pad_left = rc.prompts_pad_left)
644
644
645 # user may have over-ridden the default print hook:
645 # user may have over-ridden the default print hook:
646 try:
646 try:
647 self.outputcache.__class__.display = self.hooks.display
647 self.outputcache.__class__.display = self.hooks.display
648 except AttributeError:
648 except AttributeError:
649 pass
649 pass
650
650
651 # I don't like assigning globally to sys, because it means when embedding
651 # I don't like assigning globally to sys, because it means when embedding
652 # instances, each embedded instance overrides the previous choice. But
652 # instances, each embedded instance overrides the previous choice. But
653 # sys.displayhook seems to be called internally by exec, so I don't see a
653 # sys.displayhook seems to be called internally by exec, so I don't see a
654 # way around it.
654 # way around it.
655 sys.displayhook = self.outputcache
655 sys.displayhook = self.outputcache
656
656
657 # Set user colors (don't do it in the constructor above so that it
657 # Set user colors (don't do it in the constructor above so that it
658 # doesn't crash if colors option is invalid)
658 # doesn't crash if colors option is invalid)
659 self.magic_colors(rc.colors)
659 self.magic_colors(rc.colors)
660
660
661 # Set calling of pdb on exceptions
661 # Set calling of pdb on exceptions
662 self.call_pdb = rc.pdb
662 self.call_pdb = rc.pdb
663
663
664 # Load user aliases
664 # Load user aliases
665 for alias in rc.alias:
665 for alias in rc.alias:
666 self.magic_alias(alias)
666 self.magic_alias(alias)
667 self.hooks.late_startup_hook()
667 self.hooks.late_startup_hook()
668
668
669 for batchfile in [path(arg) for arg in self.rc.args
669 for batchfile in [path(arg) for arg in self.rc.args
670 if arg.lower().endswith('.ipy')]:
670 if arg.lower().endswith('.ipy')]:
671 if not batchfile.isfile():
671 if not batchfile.isfile():
672 print "No such batch file:", batchfile
672 print "No such batch file:", batchfile
673 continue
673 continue
674 self.api.runlines(batchfile.text())
674 self.api.runlines(batchfile.text())
675
675
676 def add_builtins(self):
676 def add_builtins(self):
677 """Store ipython references into the builtin namespace.
677 """Store ipython references into the builtin namespace.
678
678
679 Some parts of ipython operate via builtins injected here, which hold a
679 Some parts of ipython operate via builtins injected here, which hold a
680 reference to IPython itself."""
680 reference to IPython itself."""
681
681
682 # TODO: deprecate all except _ip; 'jobs' should be installed
682 # TODO: deprecate all except _ip; 'jobs' should be installed
683 # by an extension and the rest are under _ip, ipalias is redundant
683 # by an extension and the rest are under _ip, ipalias is redundant
684 builtins_new = dict(__IPYTHON__ = self,
684 builtins_new = dict(__IPYTHON__ = self,
685 ip_set_hook = self.set_hook,
685 ip_set_hook = self.set_hook,
686 jobs = self.jobs,
686 jobs = self.jobs,
687 ipmagic = self.ipmagic,
687 ipmagic = self.ipmagic,
688 ipalias = self.ipalias,
688 ipalias = self.ipalias,
689 ipsystem = self.ipsystem,
689 ipsystem = self.ipsystem,
690 _ip = self.api
690 _ip = self.api
691 )
691 )
692 for biname,bival in builtins_new.items():
692 for biname,bival in builtins_new.items():
693 try:
693 try:
694 # store the orignal value so we can restore it
694 # store the orignal value so we can restore it
695 self.builtins_added[biname] = __builtin__.__dict__[biname]
695 self.builtins_added[biname] = __builtin__.__dict__[biname]
696 except KeyError:
696 except KeyError:
697 # or mark that it wasn't defined, and we'll just delete it at
697 # or mark that it wasn't defined, and we'll just delete it at
698 # cleanup
698 # cleanup
699 self.builtins_added[biname] = Undefined
699 self.builtins_added[biname] = Undefined
700 __builtin__.__dict__[biname] = bival
700 __builtin__.__dict__[biname] = bival
701
701
702 # Keep in the builtins a flag for when IPython is active. We set it
702 # Keep in the builtins a flag for when IPython is active. We set it
703 # with setdefault so that multiple nested IPythons don't clobber one
703 # with setdefault so that multiple nested IPythons don't clobber one
704 # another. Each will increase its value by one upon being activated,
704 # another. Each will increase its value by one upon being activated,
705 # which also gives us a way to determine the nesting level.
705 # which also gives us a way to determine the nesting level.
706 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
706 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
707
707
708 def clean_builtins(self):
708 def clean_builtins(self):
709 """Remove any builtins which might have been added by add_builtins, or
709 """Remove any builtins which might have been added by add_builtins, or
710 restore overwritten ones to their previous values."""
710 restore overwritten ones to their previous values."""
711 for biname,bival in self.builtins_added.items():
711 for biname,bival in self.builtins_added.items():
712 if bival is Undefined:
712 if bival is Undefined:
713 del __builtin__.__dict__[biname]
713 del __builtin__.__dict__[biname]
714 else:
714 else:
715 __builtin__.__dict__[biname] = bival
715 __builtin__.__dict__[biname] = bival
716 self.builtins_added.clear()
716 self.builtins_added.clear()
717
717
718 def set_hook(self,name,hook, priority = 50):
718 def set_hook(self,name,hook, priority = 50):
719 """set_hook(name,hook) -> sets an internal IPython hook.
719 """set_hook(name,hook) -> sets an internal IPython hook.
720
720
721 IPython exposes some of its internal API as user-modifiable hooks. By
721 IPython exposes some of its internal API as user-modifiable hooks. By
722 adding your function to one of these hooks, you can modify IPython's
722 adding your function to one of these hooks, you can modify IPython's
723 behavior to call at runtime your own routines."""
723 behavior to call at runtime your own routines."""
724
724
725 # At some point in the future, this should validate the hook before it
725 # At some point in the future, this should validate the hook before it
726 # accepts it. Probably at least check that the hook takes the number
726 # accepts it. Probably at least check that the hook takes the number
727 # of args it's supposed to.
727 # of args it's supposed to.
728 dp = getattr(self.hooks, name, None)
728 dp = getattr(self.hooks, name, None)
729 if name not in IPython.hooks.__all__:
729 if name not in IPython.hooks.__all__:
730 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
730 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
731 if not dp:
731 if not dp:
732 dp = IPython.hooks.CommandChainDispatcher()
732 dp = IPython.hooks.CommandChainDispatcher()
733
733
734 f = new.instancemethod(hook,self,self.__class__)
734 f = new.instancemethod(hook,self,self.__class__)
735 try:
735 try:
736 dp.add(f,priority)
736 dp.add(f,priority)
737 except AttributeError:
737 except AttributeError:
738 # it was not commandchain, plain old func - replace
738 # it was not commandchain, plain old func - replace
739 dp = f
739 dp = f
740
740
741 setattr(self.hooks,name, dp)
741 setattr(self.hooks,name, dp)
742
742
743
743
744 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
744 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
745
745
746 def set_custom_exc(self,exc_tuple,handler):
746 def set_custom_exc(self,exc_tuple,handler):
747 """set_custom_exc(exc_tuple,handler)
747 """set_custom_exc(exc_tuple,handler)
748
748
749 Set a custom exception handler, which will be called if any of the
749 Set a custom exception handler, which will be called if any of the
750 exceptions in exc_tuple occur in the mainloop (specifically, in the
750 exceptions in exc_tuple occur in the mainloop (specifically, in the
751 runcode() method.
751 runcode() method.
752
752
753 Inputs:
753 Inputs:
754
754
755 - exc_tuple: a *tuple* of valid exceptions to call the defined
755 - exc_tuple: a *tuple* of valid exceptions to call the defined
756 handler for. It is very important that you use a tuple, and NOT A
756 handler for. It is very important that you use a tuple, and NOT A
757 LIST here, because of the way Python's except statement works. If
757 LIST here, because of the way Python's except statement works. If
758 you only want to trap a single exception, use a singleton tuple:
758 you only want to trap a single exception, use a singleton tuple:
759
759
760 exc_tuple == (MyCustomException,)
760 exc_tuple == (MyCustomException,)
761
761
762 - handler: this must be defined as a function with the following
762 - handler: this must be defined as a function with the following
763 basic interface: def my_handler(self,etype,value,tb).
763 basic interface: def my_handler(self,etype,value,tb).
764
764
765 This will be made into an instance method (via new.instancemethod)
765 This will be made into an instance method (via new.instancemethod)
766 of IPython itself, and it will be called if any of the exceptions
766 of IPython itself, and it will be called if any of the exceptions
767 listed in the exc_tuple are caught. If the handler is None, an
767 listed in the exc_tuple are caught. If the handler is None, an
768 internal basic one is used, which just prints basic info.
768 internal basic one is used, which just prints basic info.
769
769
770 WARNING: by putting in your own exception handler into IPython's main
770 WARNING: by putting in your own exception handler into IPython's main
771 execution loop, you run a very good chance of nasty crashes. This
771 execution loop, you run a very good chance of nasty crashes. This
772 facility should only be used if you really know what you are doing."""
772 facility should only be used if you really know what you are doing."""
773
773
774 assert type(exc_tuple)==type(()) , \
774 assert type(exc_tuple)==type(()) , \
775 "The custom exceptions must be given AS A TUPLE."
775 "The custom exceptions must be given AS A TUPLE."
776
776
777 def dummy_handler(self,etype,value,tb):
777 def dummy_handler(self,etype,value,tb):
778 print '*** Simple custom exception handler ***'
778 print '*** Simple custom exception handler ***'
779 print 'Exception type :',etype
779 print 'Exception type :',etype
780 print 'Exception value:',value
780 print 'Exception value:',value
781 print 'Traceback :',tb
781 print 'Traceback :',tb
782 print 'Source code :','\n'.join(self.buffer)
782 print 'Source code :','\n'.join(self.buffer)
783
783
784 if handler is None: handler = dummy_handler
784 if handler is None: handler = dummy_handler
785
785
786 self.CustomTB = new.instancemethod(handler,self,self.__class__)
786 self.CustomTB = new.instancemethod(handler,self,self.__class__)
787 self.custom_exceptions = exc_tuple
787 self.custom_exceptions = exc_tuple
788
788
789 def set_custom_completer(self,completer,pos=0):
789 def set_custom_completer(self,completer,pos=0):
790 """set_custom_completer(completer,pos=0)
790 """set_custom_completer(completer,pos=0)
791
791
792 Adds a new custom completer function.
792 Adds a new custom completer function.
793
793
794 The position argument (defaults to 0) is the index in the completers
794 The position argument (defaults to 0) is the index in the completers
795 list where you want the completer to be inserted."""
795 list where you want the completer to be inserted."""
796
796
797 newcomp = new.instancemethod(completer,self.Completer,
797 newcomp = new.instancemethod(completer,self.Completer,
798 self.Completer.__class__)
798 self.Completer.__class__)
799 self.Completer.matchers.insert(pos,newcomp)
799 self.Completer.matchers.insert(pos,newcomp)
800
800
801 def _get_call_pdb(self):
801 def _get_call_pdb(self):
802 return self._call_pdb
802 return self._call_pdb
803
803
804 def _set_call_pdb(self,val):
804 def _set_call_pdb(self,val):
805
805
806 if val not in (0,1,False,True):
806 if val not in (0,1,False,True):
807 raise ValueError,'new call_pdb value must be boolean'
807 raise ValueError,'new call_pdb value must be boolean'
808
808
809 # store value in instance
809 # store value in instance
810 self._call_pdb = val
810 self._call_pdb = val
811
811
812 # notify the actual exception handlers
812 # notify the actual exception handlers
813 self.InteractiveTB.call_pdb = val
813 self.InteractiveTB.call_pdb = val
814 if self.isthreaded:
814 if self.isthreaded:
815 try:
815 try:
816 self.sys_excepthook.call_pdb = val
816 self.sys_excepthook.call_pdb = val
817 except:
817 except:
818 warn('Failed to activate pdb for threaded exception handler')
818 warn('Failed to activate pdb for threaded exception handler')
819
819
820 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
820 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
821 'Control auto-activation of pdb at exceptions')
821 'Control auto-activation of pdb at exceptions')
822
822
823
823
824 # These special functions get installed in the builtin namespace, to
824 # These special functions get installed in the builtin namespace, to
825 # provide programmatic (pure python) access to magics, aliases and system
825 # provide programmatic (pure python) access to magics, aliases and system
826 # calls. This is important for logging, user scripting, and more.
826 # calls. This is important for logging, user scripting, and more.
827
827
828 # We are basically exposing, via normal python functions, the three
828 # We are basically exposing, via normal python functions, the three
829 # mechanisms in which ipython offers special call modes (magics for
829 # mechanisms in which ipython offers special call modes (magics for
830 # internal control, aliases for direct system access via pre-selected
830 # internal control, aliases for direct system access via pre-selected
831 # names, and !cmd for calling arbitrary system commands).
831 # names, and !cmd for calling arbitrary system commands).
832
832
833 def ipmagic(self,arg_s):
833 def ipmagic(self,arg_s):
834 """Call a magic function by name.
834 """Call a magic function by name.
835
835
836 Input: a string containing the name of the magic function to call and any
836 Input: a string containing the name of the magic function to call and any
837 additional arguments to be passed to the magic.
837 additional arguments to be passed to the magic.
838
838
839 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
839 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
840 prompt:
840 prompt:
841
841
842 In[1]: %name -opt foo bar
842 In[1]: %name -opt foo bar
843
843
844 To call a magic without arguments, simply use ipmagic('name').
844 To call a magic without arguments, simply use ipmagic('name').
845
845
846 This provides a proper Python function to call IPython's magics in any
846 This provides a proper Python function to call IPython's magics in any
847 valid Python code you can type at the interpreter, including loops and
847 valid Python code you can type at the interpreter, including loops and
848 compound statements. It is added by IPython to the Python builtin
848 compound statements. It is added by IPython to the Python builtin
849 namespace upon initialization."""
849 namespace upon initialization."""
850
850
851 args = arg_s.split(' ',1)
851 args = arg_s.split(' ',1)
852 magic_name = args[0]
852 magic_name = args[0]
853 magic_name = magic_name.lstrip(self.ESC_MAGIC)
853 magic_name = magic_name.lstrip(self.ESC_MAGIC)
854
854
855 try:
855 try:
856 magic_args = args[1]
856 magic_args = args[1]
857 except IndexError:
857 except IndexError:
858 magic_args = ''
858 magic_args = ''
859 fn = getattr(self,'magic_'+magic_name,None)
859 fn = getattr(self,'magic_'+magic_name,None)
860 if fn is None:
860 if fn is None:
861 error("Magic function `%s` not found." % magic_name)
861 error("Magic function `%s` not found." % magic_name)
862 else:
862 else:
863 magic_args = self.var_expand(magic_args)
863 magic_args = self.var_expand(magic_args)
864 return fn(magic_args)
864 return fn(magic_args)
865
865
866 def ipalias(self,arg_s):
866 def ipalias(self,arg_s):
867 """Call an alias by name.
867 """Call an alias by name.
868
868
869 Input: a string containing the name of the alias to call and any
869 Input: a string containing the name of the alias to call and any
870 additional arguments to be passed to the magic.
870 additional arguments to be passed to the magic.
871
871
872 ipalias('name -opt foo bar') is equivalent to typing at the ipython
872 ipalias('name -opt foo bar') is equivalent to typing at the ipython
873 prompt:
873 prompt:
874
874
875 In[1]: name -opt foo bar
875 In[1]: name -opt foo bar
876
876
877 To call an alias without arguments, simply use ipalias('name').
877 To call an alias without arguments, simply use ipalias('name').
878
878
879 This provides a proper Python function to call IPython's aliases in any
879 This provides a proper Python function to call IPython's aliases in any
880 valid Python code you can type at the interpreter, including loops and
880 valid Python code you can type at the interpreter, including loops and
881 compound statements. It is added by IPython to the Python builtin
881 compound statements. It is added by IPython to the Python builtin
882 namespace upon initialization."""
882 namespace upon initialization."""
883
883
884 args = arg_s.split(' ',1)
884 args = arg_s.split(' ',1)
885 alias_name = args[0]
885 alias_name = args[0]
886 try:
886 try:
887 alias_args = args[1]
887 alias_args = args[1]
888 except IndexError:
888 except IndexError:
889 alias_args = ''
889 alias_args = ''
890 if alias_name in self.alias_table:
890 if alias_name in self.alias_table:
891 self.call_alias(alias_name,alias_args)
891 self.call_alias(alias_name,alias_args)
892 else:
892 else:
893 error("Alias `%s` not found." % alias_name)
893 error("Alias `%s` not found." % alias_name)
894
894
895 def ipsystem(self,arg_s):
895 def ipsystem(self,arg_s):
896 """Make a system call, using IPython."""
896 """Make a system call, using IPython."""
897
897
898 self.system(arg_s)
898 self.system(arg_s)
899
899
900 def complete(self,text):
900 def complete(self,text):
901 """Return a sorted list of all possible completions on text.
901 """Return a sorted list of all possible completions on text.
902
902
903 Inputs:
903 Inputs:
904
904
905 - text: a string of text to be completed on.
905 - text: a string of text to be completed on.
906
906
907 This is a wrapper around the completion mechanism, similar to what
907 This is a wrapper around the completion mechanism, similar to what
908 readline does at the command line when the TAB key is hit. By
908 readline does at the command line when the TAB key is hit. By
909 exposing it as a method, it can be used by other non-readline
909 exposing it as a method, it can be used by other non-readline
910 environments (such as GUIs) for text completion.
910 environments (such as GUIs) for text completion.
911
911
912 Simple usage example:
912 Simple usage example:
913
913
914 In [1]: x = 'hello'
914 In [1]: x = 'hello'
915
915
916 In [2]: __IP.complete('x.l')
916 In [2]: __IP.complete('x.l')
917 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
917 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
918
918
919 complete = self.Completer.complete
919 complete = self.Completer.complete
920 state = 0
920 state = 0
921 # use a dict so we get unique keys, since ipyhton's multiple
921 # use a dict so we get unique keys, since ipyhton's multiple
922 # completers can return duplicates.
922 # completers can return duplicates.
923 comps = {}
923 comps = {}
924 while True:
924 while True:
925 newcomp = complete(text,state)
925 newcomp = complete(text,state)
926 if newcomp is None:
926 if newcomp is None:
927 break
927 break
928 comps[newcomp] = 1
928 comps[newcomp] = 1
929 state += 1
929 state += 1
930 outcomps = comps.keys()
930 outcomps = comps.keys()
931 outcomps.sort()
931 outcomps.sort()
932 return outcomps
932 return outcomps
933
933
934 def set_completer_frame(self, frame=None):
934 def set_completer_frame(self, frame=None):
935 if frame:
935 if frame:
936 self.Completer.namespace = frame.f_locals
936 self.Completer.namespace = frame.f_locals
937 self.Completer.global_namespace = frame.f_globals
937 self.Completer.global_namespace = frame.f_globals
938 else:
938 else:
939 self.Completer.namespace = self.user_ns
939 self.Completer.namespace = self.user_ns
940 self.Completer.global_namespace = self.user_global_ns
940 self.Completer.global_namespace = self.user_global_ns
941
941
942 def init_auto_alias(self):
942 def init_auto_alias(self):
943 """Define some aliases automatically.
943 """Define some aliases automatically.
944
944
945 These are ALL parameter-less aliases"""
945 These are ALL parameter-less aliases"""
946
946
947 for alias,cmd in self.auto_alias:
947 for alias,cmd in self.auto_alias:
948 self.alias_table[alias] = (0,cmd)
948 self.alias_table[alias] = (0,cmd)
949
949
950 def alias_table_validate(self,verbose=0):
950 def alias_table_validate(self,verbose=0):
951 """Update information about the alias table.
951 """Update information about the alias table.
952
952
953 In particular, make sure no Python keywords/builtins are in it."""
953 In particular, make sure no Python keywords/builtins are in it."""
954
954
955 no_alias = self.no_alias
955 no_alias = self.no_alias
956 for k in self.alias_table.keys():
956 for k in self.alias_table.keys():
957 if k in no_alias:
957 if k in no_alias:
958 del self.alias_table[k]
958 del self.alias_table[k]
959 if verbose:
959 if verbose:
960 print ("Deleting alias <%s>, it's a Python "
960 print ("Deleting alias <%s>, it's a Python "
961 "keyword or builtin." % k)
961 "keyword or builtin." % k)
962
962
963 def set_autoindent(self,value=None):
963 def set_autoindent(self,value=None):
964 """Set the autoindent flag, checking for readline support.
964 """Set the autoindent flag, checking for readline support.
965
965
966 If called with no arguments, it acts as a toggle."""
966 If called with no arguments, it acts as a toggle."""
967
967
968 if not self.has_readline:
968 if not self.has_readline:
969 if os.name == 'posix':
969 if os.name == 'posix':
970 warn("The auto-indent feature requires the readline library")
970 warn("The auto-indent feature requires the readline library")
971 self.autoindent = 0
971 self.autoindent = 0
972 return
972 return
973 if value is None:
973 if value is None:
974 self.autoindent = not self.autoindent
974 self.autoindent = not self.autoindent
975 else:
975 else:
976 self.autoindent = value
976 self.autoindent = value
977
977
978 def rc_set_toggle(self,rc_field,value=None):
978 def rc_set_toggle(self,rc_field,value=None):
979 """Set or toggle a field in IPython's rc config. structure.
979 """Set or toggle a field in IPython's rc config. structure.
980
980
981 If called with no arguments, it acts as a toggle.
981 If called with no arguments, it acts as a toggle.
982
982
983 If called with a non-existent field, the resulting AttributeError
983 If called with a non-existent field, the resulting AttributeError
984 exception will propagate out."""
984 exception will propagate out."""
985
985
986 rc_val = getattr(self.rc,rc_field)
986 rc_val = getattr(self.rc,rc_field)
987 if value is None:
987 if value is None:
988 value = not rc_val
988 value = not rc_val
989 setattr(self.rc,rc_field,value)
989 setattr(self.rc,rc_field,value)
990
990
991 def user_setup(self,ipythondir,rc_suffix,mode='install'):
991 def user_setup(self,ipythondir,rc_suffix,mode='install'):
992 """Install the user configuration directory.
992 """Install the user configuration directory.
993
993
994 Can be called when running for the first time or to upgrade the user's
994 Can be called when running for the first time or to upgrade the user's
995 .ipython/ directory with the mode parameter. Valid modes are 'install'
995 .ipython/ directory with the mode parameter. Valid modes are 'install'
996 and 'upgrade'."""
996 and 'upgrade'."""
997
997
998 def wait():
998 def wait():
999 try:
999 try:
1000 raw_input("Please press <RETURN> to start IPython.")
1000 raw_input("Please press <RETURN> to start IPython.")
1001 except EOFError:
1001 except EOFError:
1002 print >> Term.cout
1002 print >> Term.cout
1003 print '*'*70
1003 print '*'*70
1004
1004
1005 cwd = os.getcwd() # remember where we started
1005 cwd = os.getcwd() # remember where we started
1006 glb = glob.glob
1006 glb = glob.glob
1007 print '*'*70
1007 print '*'*70
1008 if mode == 'install':
1008 if mode == 'install':
1009 print \
1009 print \
1010 """Welcome to IPython. I will try to create a personal configuration directory
1010 """Welcome to IPython. I will try to create a personal configuration directory
1011 where you can customize many aspects of IPython's functionality in:\n"""
1011 where you can customize many aspects of IPython's functionality in:\n"""
1012 else:
1012 else:
1013 print 'I am going to upgrade your configuration in:'
1013 print 'I am going to upgrade your configuration in:'
1014
1014
1015 print ipythondir
1015 print ipythondir
1016
1016
1017 rcdirend = os.path.join('IPython','UserConfig')
1017 rcdirend = os.path.join('IPython','UserConfig')
1018 cfg = lambda d: os.path.join(d,rcdirend)
1018 cfg = lambda d: os.path.join(d,rcdirend)
1019 try:
1019 try:
1020 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1020 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1021 except IOError:
1021 except IOError:
1022 warning = """
1022 warning = """
1023 Installation error. IPython's directory was not found.
1023 Installation error. IPython's directory was not found.
1024
1024
1025 Check the following:
1025 Check the following:
1026
1026
1027 The ipython/IPython directory should be in a directory belonging to your
1027 The ipython/IPython directory should be in a directory belonging to your
1028 PYTHONPATH environment variable (that is, it should be in a directory
1028 PYTHONPATH environment variable (that is, it should be in a directory
1029 belonging to sys.path). You can copy it explicitly there or just link to it.
1029 belonging to sys.path). You can copy it explicitly there or just link to it.
1030
1030
1031 IPython will proceed with builtin defaults.
1031 IPython will proceed with builtin defaults.
1032 """
1032 """
1033 warn(warning)
1033 warn(warning)
1034 wait()
1034 wait()
1035 return
1035 return
1036
1036
1037 if mode == 'install':
1037 if mode == 'install':
1038 try:
1038 try:
1039 shutil.copytree(rcdir,ipythondir)
1039 shutil.copytree(rcdir,ipythondir)
1040 os.chdir(ipythondir)
1040 os.chdir(ipythondir)
1041 rc_files = glb("ipythonrc*")
1041 rc_files = glb("ipythonrc*")
1042 for rc_file in rc_files:
1042 for rc_file in rc_files:
1043 os.rename(rc_file,rc_file+rc_suffix)
1043 os.rename(rc_file,rc_file+rc_suffix)
1044 except:
1044 except:
1045 warning = """
1045 warning = """
1046
1046
1047 There was a problem with the installation:
1047 There was a problem with the installation:
1048 %s
1048 %s
1049 Try to correct it or contact the developers if you think it's a bug.
1049 Try to correct it or contact the developers if you think it's a bug.
1050 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1050 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1051 warn(warning)
1051 warn(warning)
1052 wait()
1052 wait()
1053 return
1053 return
1054
1054
1055 elif mode == 'upgrade':
1055 elif mode == 'upgrade':
1056 try:
1056 try:
1057 os.chdir(ipythondir)
1057 os.chdir(ipythondir)
1058 except:
1058 except:
1059 print """
1059 print """
1060 Can not upgrade: changing to directory %s failed. Details:
1060 Can not upgrade: changing to directory %s failed. Details:
1061 %s
1061 %s
1062 """ % (ipythondir,sys.exc_info()[1])
1062 """ % (ipythondir,sys.exc_info()[1])
1063 wait()
1063 wait()
1064 return
1064 return
1065 else:
1065 else:
1066 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1066 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1067 for new_full_path in sources:
1067 for new_full_path in sources:
1068 new_filename = os.path.basename(new_full_path)
1068 new_filename = os.path.basename(new_full_path)
1069 if new_filename.startswith('ipythonrc'):
1069 if new_filename.startswith('ipythonrc'):
1070 new_filename = new_filename + rc_suffix
1070 new_filename = new_filename + rc_suffix
1071 # The config directory should only contain files, skip any
1071 # The config directory should only contain files, skip any
1072 # directories which may be there (like CVS)
1072 # directories which may be there (like CVS)
1073 if os.path.isdir(new_full_path):
1073 if os.path.isdir(new_full_path):
1074 continue
1074 continue
1075 if os.path.exists(new_filename):
1075 if os.path.exists(new_filename):
1076 old_file = new_filename+'.old'
1076 old_file = new_filename+'.old'
1077 if os.path.exists(old_file):
1077 if os.path.exists(old_file):
1078 os.remove(old_file)
1078 os.remove(old_file)
1079 os.rename(new_filename,old_file)
1079 os.rename(new_filename,old_file)
1080 shutil.copy(new_full_path,new_filename)
1080 shutil.copy(new_full_path,new_filename)
1081 else:
1081 else:
1082 raise ValueError,'unrecognized mode for install:',`mode`
1082 raise ValueError,'unrecognized mode for install:',`mode`
1083
1083
1084 # Fix line-endings to those native to each platform in the config
1084 # Fix line-endings to those native to each platform in the config
1085 # directory.
1085 # directory.
1086 try:
1086 try:
1087 os.chdir(ipythondir)
1087 os.chdir(ipythondir)
1088 except:
1088 except:
1089 print """
1089 print """
1090 Problem: changing to directory %s failed.
1090 Problem: changing to directory %s failed.
1091 Details:
1091 Details:
1092 %s
1092 %s
1093
1093
1094 Some configuration files may have incorrect line endings. This should not
1094 Some configuration files may have incorrect line endings. This should not
1095 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1095 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1096 wait()
1096 wait()
1097 else:
1097 else:
1098 for fname in glb('ipythonrc*'):
1098 for fname in glb('ipythonrc*'):
1099 try:
1099 try:
1100 native_line_ends(fname,backup=0)
1100 native_line_ends(fname,backup=0)
1101 except IOError:
1101 except IOError:
1102 pass
1102 pass
1103
1103
1104 if mode == 'install':
1104 if mode == 'install':
1105 print """
1105 print """
1106 Successful installation!
1106 Successful installation!
1107
1107
1108 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1108 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1109 IPython manual (there are both HTML and PDF versions supplied with the
1109 IPython manual (there are both HTML and PDF versions supplied with the
1110 distribution) to make sure that your system environment is properly configured
1110 distribution) to make sure that your system environment is properly configured
1111 to take advantage of IPython's features.
1111 to take advantage of IPython's features.
1112
1112
1113 Important note: the configuration system has changed! The old system is
1113 Important note: the configuration system has changed! The old system is
1114 still in place, but its setting may be partly overridden by the settings in
1114 still in place, but its setting may be partly overridden by the settings in
1115 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1115 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1116 if some of the new settings bother you.
1116 if some of the new settings bother you.
1117
1117
1118 """
1118 """
1119 else:
1119 else:
1120 print """
1120 print """
1121 Successful upgrade!
1121 Successful upgrade!
1122
1122
1123 All files in your directory:
1123 All files in your directory:
1124 %(ipythondir)s
1124 %(ipythondir)s
1125 which would have been overwritten by the upgrade were backed up with a .old
1125 which would have been overwritten by the upgrade were backed up with a .old
1126 extension. If you had made particular customizations in those files you may
1126 extension. If you had made particular customizations in those files you may
1127 want to merge them back into the new files.""" % locals()
1127 want to merge them back into the new files.""" % locals()
1128 wait()
1128 wait()
1129 os.chdir(cwd)
1129 os.chdir(cwd)
1130 # end user_setup()
1130 # end user_setup()
1131
1131
1132 def atexit_operations(self):
1132 def atexit_operations(self):
1133 """This will be executed at the time of exit.
1133 """This will be executed at the time of exit.
1134
1134
1135 Saving of persistent data should be performed here. """
1135 Saving of persistent data should be performed here. """
1136
1136
1137 #print '*** IPython exit cleanup ***' # dbg
1137 #print '*** IPython exit cleanup ***' # dbg
1138 # input history
1138 # input history
1139 self.savehist()
1139 self.savehist()
1140
1140
1141 # Cleanup all tempfiles left around
1141 # Cleanup all tempfiles left around
1142 for tfile in self.tempfiles:
1142 for tfile in self.tempfiles:
1143 try:
1143 try:
1144 os.unlink(tfile)
1144 os.unlink(tfile)
1145 except OSError:
1145 except OSError:
1146 pass
1146 pass
1147
1147
1148 # save the "persistent data" catch-all dictionary
1148 # save the "persistent data" catch-all dictionary
1149 self.hooks.shutdown_hook()
1149 self.hooks.shutdown_hook()
1150
1150
1151 def savehist(self):
1151 def savehist(self):
1152 """Save input history to a file (via readline library)."""
1152 """Save input history to a file (via readline library)."""
1153 try:
1153 try:
1154 self.readline.write_history_file(self.histfile)
1154 self.readline.write_history_file(self.histfile)
1155 except:
1155 except:
1156 print 'Unable to save IPython command history to file: ' + \
1156 print 'Unable to save IPython command history to file: ' + \
1157 `self.histfile`
1157 `self.histfile`
1158
1158
1159 def pre_readline(self):
1159 def pre_readline(self):
1160 """readline hook to be used at the start of each line.
1160 """readline hook to be used at the start of each line.
1161
1161
1162 Currently it handles auto-indent only."""
1162 Currently it handles auto-indent only."""
1163
1163
1164 #debugx('self.indent_current_nsp','pre_readline:')
1164 #debugx('self.indent_current_nsp','pre_readline:')
1165 self.readline.insert_text(self.indent_current_str())
1165 self.readline.insert_text(self.indent_current_str())
1166
1166
1167 def init_readline(self):
1167 def init_readline(self):
1168 """Command history completion/saving/reloading."""
1168 """Command history completion/saving/reloading."""
1169
1169
1170 import IPython.rlineimpl as readline
1170 import IPython.rlineimpl as readline
1171 if not readline.have_readline:
1171 if not readline.have_readline:
1172 self.has_readline = 0
1172 self.has_readline = 0
1173 self.readline = None
1173 self.readline = None
1174 # no point in bugging windows users with this every time:
1174 # no point in bugging windows users with this every time:
1175 warn('Readline services not available on this platform.')
1175 warn('Readline services not available on this platform.')
1176 else:
1176 else:
1177 sys.modules['readline'] = readline
1177 sys.modules['readline'] = readline
1178 import atexit
1178 import atexit
1179 from IPython.completer import IPCompleter
1179 from IPython.completer import IPCompleter
1180 self.Completer = IPCompleter(self,
1180 self.Completer = IPCompleter(self,
1181 self.user_ns,
1181 self.user_ns,
1182 self.user_global_ns,
1182 self.user_global_ns,
1183 self.rc.readline_omit__names,
1183 self.rc.readline_omit__names,
1184 self.alias_table)
1184 self.alias_table)
1185
1185
1186 # Platform-specific configuration
1186 # Platform-specific configuration
1187 if os.name == 'nt':
1187 if os.name == 'nt':
1188 self.readline_startup_hook = readline.set_pre_input_hook
1188 self.readline_startup_hook = readline.set_pre_input_hook
1189 else:
1189 else:
1190 self.readline_startup_hook = readline.set_startup_hook
1190 self.readline_startup_hook = readline.set_startup_hook
1191
1191
1192 # Load user's initrc file (readline config)
1192 # Load user's initrc file (readline config)
1193 inputrc_name = os.environ.get('INPUTRC')
1193 inputrc_name = os.environ.get('INPUTRC')
1194 if inputrc_name is None:
1194 if inputrc_name is None:
1195 home_dir = get_home_dir()
1195 home_dir = get_home_dir()
1196 if home_dir is not None:
1196 if home_dir is not None:
1197 inputrc_name = os.path.join(home_dir,'.inputrc')
1197 inputrc_name = os.path.join(home_dir,'.inputrc')
1198 if os.path.isfile(inputrc_name):
1198 if os.path.isfile(inputrc_name):
1199 try:
1199 try:
1200 readline.read_init_file(inputrc_name)
1200 readline.read_init_file(inputrc_name)
1201 except:
1201 except:
1202 warn('Problems reading readline initialization file <%s>'
1202 warn('Problems reading readline initialization file <%s>'
1203 % inputrc_name)
1203 % inputrc_name)
1204
1204
1205 self.has_readline = 1
1205 self.has_readline = 1
1206 self.readline = readline
1206 self.readline = readline
1207 # save this in sys so embedded copies can restore it properly
1207 # save this in sys so embedded copies can restore it properly
1208 sys.ipcompleter = self.Completer.complete
1208 sys.ipcompleter = self.Completer.complete
1209 readline.set_completer(self.Completer.complete)
1209 readline.set_completer(self.Completer.complete)
1210
1210
1211 # Configure readline according to user's prefs
1211 # Configure readline according to user's prefs
1212 for rlcommand in self.rc.readline_parse_and_bind:
1212 for rlcommand in self.rc.readline_parse_and_bind:
1213 readline.parse_and_bind(rlcommand)
1213 readline.parse_and_bind(rlcommand)
1214
1214
1215 # remove some chars from the delimiters list
1215 # remove some chars from the delimiters list
1216 delims = readline.get_completer_delims()
1216 delims = readline.get_completer_delims()
1217 delims = delims.translate(string._idmap,
1217 delims = delims.translate(string._idmap,
1218 self.rc.readline_remove_delims)
1218 self.rc.readline_remove_delims)
1219 readline.set_completer_delims(delims)
1219 readline.set_completer_delims(delims)
1220 # otherwise we end up with a monster history after a while:
1220 # otherwise we end up with a monster history after a while:
1221 readline.set_history_length(1000)
1221 readline.set_history_length(1000)
1222 try:
1222 try:
1223 #print '*** Reading readline history' # dbg
1223 #print '*** Reading readline history' # dbg
1224 readline.read_history_file(self.histfile)
1224 readline.read_history_file(self.histfile)
1225 except IOError:
1225 except IOError:
1226 pass # It doesn't exist yet.
1226 pass # It doesn't exist yet.
1227
1227
1228 atexit.register(self.atexit_operations)
1228 atexit.register(self.atexit_operations)
1229 del atexit
1229 del atexit
1230
1230
1231 # Configure auto-indent for all platforms
1231 # Configure auto-indent for all platforms
1232 self.set_autoindent(self.rc.autoindent)
1232 self.set_autoindent(self.rc.autoindent)
1233
1233
1234 def ask_yes_no(self,prompt,default=True):
1234 def ask_yes_no(self,prompt,default=True):
1235 if self.rc.quiet:
1235 if self.rc.quiet:
1236 return True
1236 return True
1237 return ask_yes_no(prompt,default)
1237 return ask_yes_no(prompt,default)
1238
1238
1239 def _should_recompile(self,e):
1239 def _should_recompile(self,e):
1240 """Utility routine for edit_syntax_error"""
1240 """Utility routine for edit_syntax_error"""
1241
1241
1242 if e.filename in ('<ipython console>','<input>','<string>',
1242 if e.filename in ('<ipython console>','<input>','<string>',
1243 '<console>','<BackgroundJob compilation>',
1243 '<console>','<BackgroundJob compilation>',
1244 None):
1244 None):
1245
1245
1246 return False
1246 return False
1247 try:
1247 try:
1248 if (self.rc.autoedit_syntax and
1248 if (self.rc.autoedit_syntax and
1249 not self.ask_yes_no('Return to editor to correct syntax error? '
1249 not self.ask_yes_no('Return to editor to correct syntax error? '
1250 '[Y/n] ','y')):
1250 '[Y/n] ','y')):
1251 return False
1251 return False
1252 except EOFError:
1252 except EOFError:
1253 return False
1253 return False
1254
1254
1255 def int0(x):
1255 def int0(x):
1256 try:
1256 try:
1257 return int(x)
1257 return int(x)
1258 except TypeError:
1258 except TypeError:
1259 return 0
1259 return 0
1260 # always pass integer line and offset values to editor hook
1260 # always pass integer line and offset values to editor hook
1261 self.hooks.fix_error_editor(e.filename,
1261 self.hooks.fix_error_editor(e.filename,
1262 int0(e.lineno),int0(e.offset),e.msg)
1262 int0(e.lineno),int0(e.offset),e.msg)
1263 return True
1263 return True
1264
1264
1265 def edit_syntax_error(self):
1265 def edit_syntax_error(self):
1266 """The bottom half of the syntax error handler called in the main loop.
1266 """The bottom half of the syntax error handler called in the main loop.
1267
1267
1268 Loop until syntax error is fixed or user cancels.
1268 Loop until syntax error is fixed or user cancels.
1269 """
1269 """
1270
1270
1271 while self.SyntaxTB.last_syntax_error:
1271 while self.SyntaxTB.last_syntax_error:
1272 # copy and clear last_syntax_error
1272 # copy and clear last_syntax_error
1273 err = self.SyntaxTB.clear_err_state()
1273 err = self.SyntaxTB.clear_err_state()
1274 if not self._should_recompile(err):
1274 if not self._should_recompile(err):
1275 return
1275 return
1276 try:
1276 try:
1277 # may set last_syntax_error again if a SyntaxError is raised
1277 # may set last_syntax_error again if a SyntaxError is raised
1278 self.safe_execfile(err.filename,self.user_ns)
1278 self.safe_execfile(err.filename,self.user_ns)
1279 except:
1279 except:
1280 self.showtraceback()
1280 self.showtraceback()
1281 else:
1281 else:
1282 try:
1282 try:
1283 f = file(err.filename)
1283 f = file(err.filename)
1284 try:
1284 try:
1285 sys.displayhook(f.read())
1285 sys.displayhook(f.read())
1286 finally:
1286 finally:
1287 f.close()
1287 f.close()
1288 except:
1288 except:
1289 self.showtraceback()
1289 self.showtraceback()
1290
1290
1291 def showsyntaxerror(self, filename=None):
1291 def showsyntaxerror(self, filename=None):
1292 """Display the syntax error that just occurred.
1292 """Display the syntax error that just occurred.
1293
1293
1294 This doesn't display a stack trace because there isn't one.
1294 This doesn't display a stack trace because there isn't one.
1295
1295
1296 If a filename is given, it is stuffed in the exception instead
1296 If a filename is given, it is stuffed in the exception instead
1297 of what was there before (because Python's parser always uses
1297 of what was there before (because Python's parser always uses
1298 "<string>" when reading from a string).
1298 "<string>" when reading from a string).
1299 """
1299 """
1300 etype, value, last_traceback = sys.exc_info()
1300 etype, value, last_traceback = sys.exc_info()
1301
1301
1302 # See note about these variables in showtraceback() below
1302 # See note about these variables in showtraceback() below
1303 sys.last_type = etype
1303 sys.last_type = etype
1304 sys.last_value = value
1304 sys.last_value = value
1305 sys.last_traceback = last_traceback
1305 sys.last_traceback = last_traceback
1306
1306
1307 if filename and etype is SyntaxError:
1307 if filename and etype is SyntaxError:
1308 # Work hard to stuff the correct filename in the exception
1308 # Work hard to stuff the correct filename in the exception
1309 try:
1309 try:
1310 msg, (dummy_filename, lineno, offset, line) = value
1310 msg, (dummy_filename, lineno, offset, line) = value
1311 except:
1311 except:
1312 # Not the format we expect; leave it alone
1312 # Not the format we expect; leave it alone
1313 pass
1313 pass
1314 else:
1314 else:
1315 # Stuff in the right filename
1315 # Stuff in the right filename
1316 try:
1316 try:
1317 # Assume SyntaxError is a class exception
1317 # Assume SyntaxError is a class exception
1318 value = SyntaxError(msg, (filename, lineno, offset, line))
1318 value = SyntaxError(msg, (filename, lineno, offset, line))
1319 except:
1319 except:
1320 # If that failed, assume SyntaxError is a string
1320 # If that failed, assume SyntaxError is a string
1321 value = msg, (filename, lineno, offset, line)
1321 value = msg, (filename, lineno, offset, line)
1322 self.SyntaxTB(etype,value,[])
1322 self.SyntaxTB(etype,value,[])
1323
1323
1324 def debugger(self):
1324 def debugger(self):
1325 """Call the pdb debugger."""
1325 """Call the pdb debugger."""
1326
1326
1327 if not self.rc.pdb:
1327 if not self.rc.pdb:
1328 return
1328 return
1329 pdb.pm()
1329 pdb.pm()
1330
1330
1331 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1331 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1332 """Display the exception that just occurred.
1332 """Display the exception that just occurred.
1333
1333
1334 If nothing is known about the exception, this is the method which
1334 If nothing is known about the exception, this is the method which
1335 should be used throughout the code for presenting user tracebacks,
1335 should be used throughout the code for presenting user tracebacks,
1336 rather than directly invoking the InteractiveTB object.
1336 rather than directly invoking the InteractiveTB object.
1337
1337
1338 A specific showsyntaxerror() also exists, but this method can take
1338 A specific showsyntaxerror() also exists, but this method can take
1339 care of calling it if needed, so unless you are explicitly catching a
1339 care of calling it if needed, so unless you are explicitly catching a
1340 SyntaxError exception, don't try to analyze the stack manually and
1340 SyntaxError exception, don't try to analyze the stack manually and
1341 simply call this method."""
1341 simply call this method."""
1342
1342
1343 # Though this won't be called by syntax errors in the input line,
1343 # Though this won't be called by syntax errors in the input line,
1344 # there may be SyntaxError cases whith imported code.
1344 # there may be SyntaxError cases whith imported code.
1345 if exc_tuple is None:
1345 if exc_tuple is None:
1346 etype, value, tb = sys.exc_info()
1346 etype, value, tb = sys.exc_info()
1347 else:
1347 else:
1348 etype, value, tb = exc_tuple
1348 etype, value, tb = exc_tuple
1349 if etype is SyntaxError:
1349 if etype is SyntaxError:
1350 self.showsyntaxerror(filename)
1350 self.showsyntaxerror(filename)
1351 else:
1351 else:
1352 # WARNING: these variables are somewhat deprecated and not
1352 # WARNING: these variables are somewhat deprecated and not
1353 # necessarily safe to use in a threaded environment, but tools
1353 # necessarily safe to use in a threaded environment, but tools
1354 # like pdb depend on their existence, so let's set them. If we
1354 # like pdb depend on their existence, so let's set them. If we
1355 # find problems in the field, we'll need to revisit their use.
1355 # find problems in the field, we'll need to revisit their use.
1356 sys.last_type = etype
1356 sys.last_type = etype
1357 sys.last_value = value
1357 sys.last_value = value
1358 sys.last_traceback = tb
1358 sys.last_traceback = tb
1359
1359
1360 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1360 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1361 if self.InteractiveTB.call_pdb and self.has_readline:
1361 if self.InteractiveTB.call_pdb and self.has_readline:
1362 # pdb mucks up readline, fix it back
1362 # pdb mucks up readline, fix it back
1363 self.readline.set_completer(self.Completer.complete)
1363 self.readline.set_completer(self.Completer.complete)
1364
1364
1365 def mainloop(self,banner=None):
1365 def mainloop(self,banner=None):
1366 """Creates the local namespace and starts the mainloop.
1366 """Creates the local namespace and starts the mainloop.
1367
1367
1368 If an optional banner argument is given, it will override the
1368 If an optional banner argument is given, it will override the
1369 internally created default banner."""
1369 internally created default banner."""
1370
1370
1371 if self.rc.c: # Emulate Python's -c option
1371 if self.rc.c: # Emulate Python's -c option
1372 self.exec_init_cmd()
1372 self.exec_init_cmd()
1373 if banner is None:
1373 if banner is None:
1374 if not self.rc.banner:
1374 if not self.rc.banner:
1375 banner = ''
1375 banner = ''
1376 # banner is string? Use it directly!
1376 # banner is string? Use it directly!
1377 elif isinstance(self.rc.banner,basestring):
1377 elif isinstance(self.rc.banner,basestring):
1378 banner = self.rc.banner
1378 banner = self.rc.banner
1379 else:
1379 else:
1380 banner = self.BANNER+self.banner2
1380 banner = self.BANNER+self.banner2
1381
1381
1382 self.interact(banner)
1382 self.interact(banner)
1383
1383
1384 def exec_init_cmd(self):
1384 def exec_init_cmd(self):
1385 """Execute a command given at the command line.
1385 """Execute a command given at the command line.
1386
1386
1387 This emulates Python's -c option."""
1387 This emulates Python's -c option."""
1388
1388
1389 #sys.argv = ['-c']
1389 #sys.argv = ['-c']
1390 self.push(self.rc.c)
1390 self.push(self.rc.c)
1391
1391
1392 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1392 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1393 """Embeds IPython into a running python program.
1393 """Embeds IPython into a running python program.
1394
1394
1395 Input:
1395 Input:
1396
1396
1397 - header: An optional header message can be specified.
1397 - header: An optional header message can be specified.
1398
1398
1399 - local_ns, global_ns: working namespaces. If given as None, the
1399 - local_ns, global_ns: working namespaces. If given as None, the
1400 IPython-initialized one is updated with __main__.__dict__, so that
1400 IPython-initialized one is updated with __main__.__dict__, so that
1401 program variables become visible but user-specific configuration
1401 program variables become visible but user-specific configuration
1402 remains possible.
1402 remains possible.
1403
1403
1404 - stack_depth: specifies how many levels in the stack to go to
1404 - stack_depth: specifies how many levels in the stack to go to
1405 looking for namespaces (when local_ns and global_ns are None). This
1405 looking for namespaces (when local_ns and global_ns are None). This
1406 allows an intermediate caller to make sure that this function gets
1406 allows an intermediate caller to make sure that this function gets
1407 the namespace from the intended level in the stack. By default (0)
1407 the namespace from the intended level in the stack. By default (0)
1408 it will get its locals and globals from the immediate caller.
1408 it will get its locals and globals from the immediate caller.
1409
1409
1410 Warning: it's possible to use this in a program which is being run by
1410 Warning: it's possible to use this in a program which is being run by
1411 IPython itself (via %run), but some funny things will happen (a few
1411 IPython itself (via %run), but some funny things will happen (a few
1412 globals get overwritten). In the future this will be cleaned up, as
1412 globals get overwritten). In the future this will be cleaned up, as
1413 there is no fundamental reason why it can't work perfectly."""
1413 there is no fundamental reason why it can't work perfectly."""
1414
1414
1415 # Get locals and globals from caller
1415 # Get locals and globals from caller
1416 if local_ns is None or global_ns is None:
1416 if local_ns is None or global_ns is None:
1417 call_frame = sys._getframe(stack_depth).f_back
1417 call_frame = sys._getframe(stack_depth).f_back
1418
1418
1419 if local_ns is None:
1419 if local_ns is None:
1420 local_ns = call_frame.f_locals
1420 local_ns = call_frame.f_locals
1421 if global_ns is None:
1421 if global_ns is None:
1422 global_ns = call_frame.f_globals
1422 global_ns = call_frame.f_globals
1423
1423
1424 # Update namespaces and fire up interpreter
1424 # Update namespaces and fire up interpreter
1425
1425
1426 # The global one is easy, we can just throw it in
1426 # The global one is easy, we can just throw it in
1427 self.user_global_ns = global_ns
1427 self.user_global_ns = global_ns
1428
1428
1429 # but the user/local one is tricky: ipython needs it to store internal
1429 # but the user/local one is tricky: ipython needs it to store internal
1430 # data, but we also need the locals. We'll copy locals in the user
1430 # data, but we also need the locals. We'll copy locals in the user
1431 # one, but will track what got copied so we can delete them at exit.
1431 # one, but will track what got copied so we can delete them at exit.
1432 # This is so that a later embedded call doesn't see locals from a
1432 # This is so that a later embedded call doesn't see locals from a
1433 # previous call (which most likely existed in a separate scope).
1433 # previous call (which most likely existed in a separate scope).
1434 local_varnames = local_ns.keys()
1434 local_varnames = local_ns.keys()
1435 self.user_ns.update(local_ns)
1435 self.user_ns.update(local_ns)
1436
1436
1437 # Patch for global embedding to make sure that things don't overwrite
1437 # Patch for global embedding to make sure that things don't overwrite
1438 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1438 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1439 # FIXME. Test this a bit more carefully (the if.. is new)
1439 # FIXME. Test this a bit more carefully (the if.. is new)
1440 if local_ns is None and global_ns is None:
1440 if local_ns is None and global_ns is None:
1441 self.user_global_ns.update(__main__.__dict__)
1441 self.user_global_ns.update(__main__.__dict__)
1442
1442
1443 # make sure the tab-completer has the correct frame information, so it
1443 # make sure the tab-completer has the correct frame information, so it
1444 # actually completes using the frame's locals/globals
1444 # actually completes using the frame's locals/globals
1445 self.set_completer_frame()
1445 self.set_completer_frame()
1446
1446
1447 # before activating the interactive mode, we need to make sure that
1447 # before activating the interactive mode, we need to make sure that
1448 # all names in the builtin namespace needed by ipython point to
1448 # all names in the builtin namespace needed by ipython point to
1449 # ourselves, and not to other instances.
1449 # ourselves, and not to other instances.
1450 self.add_builtins()
1450 self.add_builtins()
1451
1451
1452 self.interact(header)
1452 self.interact(header)
1453
1453
1454 # now, purge out the user namespace from anything we might have added
1454 # now, purge out the user namespace from anything we might have added
1455 # from the caller's local namespace
1455 # from the caller's local namespace
1456 delvar = self.user_ns.pop
1456 delvar = self.user_ns.pop
1457 for var in local_varnames:
1457 for var in local_varnames:
1458 delvar(var,None)
1458 delvar(var,None)
1459 # and clean builtins we may have overridden
1459 # and clean builtins we may have overridden
1460 self.clean_builtins()
1460 self.clean_builtins()
1461
1461
1462 def interact(self, banner=None):
1462 def interact(self, banner=None):
1463 """Closely emulate the interactive Python console.
1463 """Closely emulate the interactive Python console.
1464
1464
1465 The optional banner argument specify the banner to print
1465 The optional banner argument specify the banner to print
1466 before the first interaction; by default it prints a banner
1466 before the first interaction; by default it prints a banner
1467 similar to the one printed by the real Python interpreter,
1467 similar to the one printed by the real Python interpreter,
1468 followed by the current class name in parentheses (so as not
1468 followed by the current class name in parentheses (so as not
1469 to confuse this with the real interpreter -- since it's so
1469 to confuse this with the real interpreter -- since it's so
1470 close!).
1470 close!).
1471
1471
1472 """
1472 """
1473 cprt = 'Type "copyright", "credits" or "license" for more information.'
1473 cprt = 'Type "copyright", "credits" or "license" for more information.'
1474 if banner is None:
1474 if banner is None:
1475 self.write("Python %s on %s\n%s\n(%s)\n" %
1475 self.write("Python %s on %s\n%s\n(%s)\n" %
1476 (sys.version, sys.platform, cprt,
1476 (sys.version, sys.platform, cprt,
1477 self.__class__.__name__))
1477 self.__class__.__name__))
1478 else:
1478 else:
1479 self.write(banner)
1479 self.write(banner)
1480
1480
1481 more = 0
1481 more = 0
1482
1482
1483 # Mark activity in the builtins
1483 # Mark activity in the builtins
1484 __builtin__.__dict__['__IPYTHON__active'] += 1
1484 __builtin__.__dict__['__IPYTHON__active'] += 1
1485
1485
1486 # exit_now is set by a call to %Exit or %Quit
1486 # exit_now is set by a call to %Exit or %Quit
1487 self.exit_now = False
1487 self.exit_now = False
1488 while not self.exit_now:
1488 while not self.exit_now:
1489 if more:
1489 if more:
1490 prompt = self.outputcache.prompt2
1490 prompt = self.outputcache.prompt2
1491 if self.autoindent:
1491 if self.autoindent:
1492 self.readline_startup_hook(self.pre_readline)
1492 self.readline_startup_hook(self.pre_readline)
1493 else:
1493 else:
1494 prompt = self.outputcache.prompt1
1494 prompt = self.outputcache.prompt1
1495 try:
1495 try:
1496 line = self.raw_input(prompt,more)
1496 line = self.raw_input(prompt,more)
1497 if self.autoindent:
1497 if self.autoindent:
1498 self.readline_startup_hook(None)
1498 self.readline_startup_hook(None)
1499 except KeyboardInterrupt:
1499 except KeyboardInterrupt:
1500 self.write('\nKeyboardInterrupt\n')
1500 self.write('\nKeyboardInterrupt\n')
1501 self.resetbuffer()
1501 self.resetbuffer()
1502 # keep cache in sync with the prompt counter:
1502 # keep cache in sync with the prompt counter:
1503 self.outputcache.prompt_count -= 1
1503 self.outputcache.prompt_count -= 1
1504
1504
1505 if self.autoindent:
1505 if self.autoindent:
1506 self.indent_current_nsp = 0
1506 self.indent_current_nsp = 0
1507 more = 0
1507 more = 0
1508 except EOFError:
1508 except EOFError:
1509 if self.autoindent:
1509 if self.autoindent:
1510 self.readline_startup_hook(None)
1510 self.readline_startup_hook(None)
1511 self.write('\n')
1511 self.write('\n')
1512 self.exit()
1512 self.exit()
1513 except bdb.BdbQuit:
1513 except bdb.BdbQuit:
1514 warn('The Python debugger has exited with a BdbQuit exception.\n'
1514 warn('The Python debugger has exited with a BdbQuit exception.\n'
1515 'Because of how pdb handles the stack, it is impossible\n'
1515 'Because of how pdb handles the stack, it is impossible\n'
1516 'for IPython to properly format this particular exception.\n'
1516 'for IPython to properly format this particular exception.\n'
1517 'IPython will resume normal operation.')
1517 'IPython will resume normal operation.')
1518 except:
1518 except:
1519 # exceptions here are VERY RARE, but they can be triggered
1519 # exceptions here are VERY RARE, but they can be triggered
1520 # asynchronously by signal handlers, for example.
1520 # asynchronously by signal handlers, for example.
1521 self.showtraceback()
1521 self.showtraceback()
1522 else:
1522 else:
1523 more = self.push(line)
1523 more = self.push(line)
1524 if (self.SyntaxTB.last_syntax_error and
1524 if (self.SyntaxTB.last_syntax_error and
1525 self.rc.autoedit_syntax):
1525 self.rc.autoedit_syntax):
1526 self.edit_syntax_error()
1526 self.edit_syntax_error()
1527
1527
1528 # We are off again...
1528 # We are off again...
1529 __builtin__.__dict__['__IPYTHON__active'] -= 1
1529 __builtin__.__dict__['__IPYTHON__active'] -= 1
1530
1530
1531 def excepthook(self, etype, value, tb):
1531 def excepthook(self, etype, value, tb):
1532 """One more defense for GUI apps that call sys.excepthook.
1532 """One more defense for GUI apps that call sys.excepthook.
1533
1533
1534 GUI frameworks like wxPython trap exceptions and call
1534 GUI frameworks like wxPython trap exceptions and call
1535 sys.excepthook themselves. I guess this is a feature that
1535 sys.excepthook themselves. I guess this is a feature that
1536 enables them to keep running after exceptions that would
1536 enables them to keep running after exceptions that would
1537 otherwise kill their mainloop. This is a bother for IPython
1537 otherwise kill their mainloop. This is a bother for IPython
1538 which excepts to catch all of the program exceptions with a try:
1538 which excepts to catch all of the program exceptions with a try:
1539 except: statement.
1539 except: statement.
1540
1540
1541 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1541 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1542 any app directly invokes sys.excepthook, it will look to the user like
1542 any app directly invokes sys.excepthook, it will look to the user like
1543 IPython crashed. In order to work around this, we can disable the
1543 IPython crashed. In order to work around this, we can disable the
1544 CrashHandler and replace it with this excepthook instead, which prints a
1544 CrashHandler and replace it with this excepthook instead, which prints a
1545 regular traceback using our InteractiveTB. In this fashion, apps which
1545 regular traceback using our InteractiveTB. In this fashion, apps which
1546 call sys.excepthook will generate a regular-looking exception from
1546 call sys.excepthook will generate a regular-looking exception from
1547 IPython, and the CrashHandler will only be triggered by real IPython
1547 IPython, and the CrashHandler will only be triggered by real IPython
1548 crashes.
1548 crashes.
1549
1549
1550 This hook should be used sparingly, only in places which are not likely
1550 This hook should be used sparingly, only in places which are not likely
1551 to be true IPython errors.
1551 to be true IPython errors.
1552 """
1552 """
1553 self.showtraceback((etype,value,tb),tb_offset=0)
1553 self.showtraceback((etype,value,tb),tb_offset=0)
1554
1554
1555 def transform_alias(self, alias,rest=''):
1555 def transform_alias(self, alias,rest=''):
1556 """ Transform alias to system command string.
1556 """ Transform alias to system command string.
1557 """
1557 """
1558 nargs,cmd = self.alias_table[alias]
1558 nargs,cmd = self.alias_table[alias]
1559 if ' ' in cmd and os.path.isfile(cmd):
1559 if ' ' in cmd and os.path.isfile(cmd):
1560 cmd = '"%s"' % cmd
1560 cmd = '"%s"' % cmd
1561
1561
1562 # Expand the %l special to be the user's input line
1562 # Expand the %l special to be the user's input line
1563 if cmd.find('%l') >= 0:
1563 if cmd.find('%l') >= 0:
1564 cmd = cmd.replace('%l',rest)
1564 cmd = cmd.replace('%l',rest)
1565 rest = ''
1565 rest = ''
1566 if nargs==0:
1566 if nargs==0:
1567 # Simple, argument-less aliases
1567 # Simple, argument-less aliases
1568 cmd = '%s %s' % (cmd,rest)
1568 cmd = '%s %s' % (cmd,rest)
1569 else:
1569 else:
1570 # Handle aliases with positional arguments
1570 # Handle aliases with positional arguments
1571 args = rest.split(None,nargs)
1571 args = rest.split(None,nargs)
1572 if len(args)< nargs:
1572 if len(args)< nargs:
1573 error('Alias <%s> requires %s arguments, %s given.' %
1573 error('Alias <%s> requires %s arguments, %s given.' %
1574 (alias,nargs,len(args)))
1574 (alias,nargs,len(args)))
1575 return None
1575 return None
1576 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1576 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1577 # Now call the macro, evaluating in the user's namespace
1577 # Now call the macro, evaluating in the user's namespace
1578 #print 'new command: <%r>' % cmd # dbg
1578 #print 'new command: <%r>' % cmd # dbg
1579 return cmd
1579 return cmd
1580
1580
1581 def call_alias(self,alias,rest=''):
1581 def call_alias(self,alias,rest=''):
1582 """Call an alias given its name and the rest of the line.
1582 """Call an alias given its name and the rest of the line.
1583
1583
1584 This is only used to provide backwards compatibility for users of
1584 This is only used to provide backwards compatibility for users of
1585 ipalias(), use of which is not recommended for anymore."""
1585 ipalias(), use of which is not recommended for anymore."""
1586
1586
1587 # Now call the macro, evaluating in the user's namespace
1587 # Now call the macro, evaluating in the user's namespace
1588 cmd = self.transform_alias(alias, rest)
1588 cmd = self.transform_alias(alias, rest)
1589 try:
1589 try:
1590 self.system(cmd)
1590 self.system(cmd)
1591 except:
1591 except:
1592 self.showtraceback()
1592 self.showtraceback()
1593
1593
1594 def indent_current_str(self):
1594 def indent_current_str(self):
1595 """return the current level of indentation as a string"""
1595 """return the current level of indentation as a string"""
1596 return self.indent_current_nsp * ' '
1596 return self.indent_current_nsp * ' '
1597
1597
1598 def autoindent_update(self,line):
1598 def autoindent_update(self,line):
1599 """Keep track of the indent level."""
1599 """Keep track of the indent level."""
1600
1600
1601 #debugx('line')
1601 #debugx('line')
1602 #debugx('self.indent_current_nsp')
1602 #debugx('self.indent_current_nsp')
1603 if self.autoindent:
1603 if self.autoindent:
1604 if line:
1604 if line:
1605 inisp = num_ini_spaces(line)
1605 inisp = num_ini_spaces(line)
1606 if inisp < self.indent_current_nsp:
1606 if inisp < self.indent_current_nsp:
1607 self.indent_current_nsp = inisp
1607 self.indent_current_nsp = inisp
1608
1608
1609 if line[-1] == ':':
1609 if line[-1] == ':':
1610 self.indent_current_nsp += 4
1610 self.indent_current_nsp += 4
1611 elif dedent_re.match(line):
1611 elif dedent_re.match(line):
1612 self.indent_current_nsp -= 4
1612 self.indent_current_nsp -= 4
1613 else:
1613 else:
1614 self.indent_current_nsp = 0
1614 self.indent_current_nsp = 0
1615
1615
1616 def runlines(self,lines):
1616 def runlines(self,lines):
1617 """Run a string of one or more lines of source.
1617 """Run a string of one or more lines of source.
1618
1618
1619 This method is capable of running a string containing multiple source
1619 This method is capable of running a string containing multiple source
1620 lines, as if they had been entered at the IPython prompt. Since it
1620 lines, as if they had been entered at the IPython prompt. Since it
1621 exposes IPython's processing machinery, the given strings can contain
1621 exposes IPython's processing machinery, the given strings can contain
1622 magic calls (%magic), special shell access (!cmd), etc."""
1622 magic calls (%magic), special shell access (!cmd), etc."""
1623
1623
1624 # We must start with a clean buffer, in case this is run from an
1624 # We must start with a clean buffer, in case this is run from an
1625 # interactive IPython session (via a magic, for example).
1625 # interactive IPython session (via a magic, for example).
1626 self.resetbuffer()
1626 self.resetbuffer()
1627 lines = lines.split('\n')
1627 lines = lines.split('\n')
1628 more = 0
1628 more = 0
1629 for line in lines:
1629 for line in lines:
1630 # skip blank lines so we don't mess up the prompt counter, but do
1630 # skip blank lines so we don't mess up the prompt counter, but do
1631 # NOT skip even a blank line if we are in a code block (more is
1631 # NOT skip even a blank line if we are in a code block (more is
1632 # true)
1632 # true)
1633 if line or more:
1633 if line or more:
1634 more = self.push(self.prefilter(line,more))
1634 more = self.push(self.prefilter(line,more))
1635 # IPython's runsource returns None if there was an error
1635 # IPython's runsource returns None if there was an error
1636 # compiling the code. This allows us to stop processing right
1636 # compiling the code. This allows us to stop processing right
1637 # away, so the user gets the error message at the right place.
1637 # away, so the user gets the error message at the right place.
1638 if more is None:
1638 if more is None:
1639 break
1639 break
1640 # final newline in case the input didn't have it, so that the code
1640 # final newline in case the input didn't have it, so that the code
1641 # actually does get executed
1641 # actually does get executed
1642 if more:
1642 if more:
1643 self.push('\n')
1643 self.push('\n')
1644
1644
1645 def runsource(self, source, filename='<input>', symbol='single'):
1645 def runsource(self, source, filename='<input>', symbol='single'):
1646 """Compile and run some source in the interpreter.
1646 """Compile and run some source in the interpreter.
1647
1647
1648 Arguments are as for compile_command().
1648 Arguments are as for compile_command().
1649
1649
1650 One several things can happen:
1650 One several things can happen:
1651
1651
1652 1) The input is incorrect; compile_command() raised an
1652 1) The input is incorrect; compile_command() raised an
1653 exception (SyntaxError or OverflowError). A syntax traceback
1653 exception (SyntaxError or OverflowError). A syntax traceback
1654 will be printed by calling the showsyntaxerror() method.
1654 will be printed by calling the showsyntaxerror() method.
1655
1655
1656 2) The input is incomplete, and more input is required;
1656 2) The input is incomplete, and more input is required;
1657 compile_command() returned None. Nothing happens.
1657 compile_command() returned None. Nothing happens.
1658
1658
1659 3) The input is complete; compile_command() returned a code
1659 3) The input is complete; compile_command() returned a code
1660 object. The code is executed by calling self.runcode() (which
1660 object. The code is executed by calling self.runcode() (which
1661 also handles run-time exceptions, except for SystemExit).
1661 also handles run-time exceptions, except for SystemExit).
1662
1662
1663 The return value is:
1663 The return value is:
1664
1664
1665 - True in case 2
1665 - True in case 2
1666
1666
1667 - False in the other cases, unless an exception is raised, where
1667 - False in the other cases, unless an exception is raised, where
1668 None is returned instead. This can be used by external callers to
1668 None is returned instead. This can be used by external callers to
1669 know whether to continue feeding input or not.
1669 know whether to continue feeding input or not.
1670
1670
1671 The return value can be used to decide whether to use sys.ps1 or
1671 The return value can be used to decide whether to use sys.ps1 or
1672 sys.ps2 to prompt the next line."""
1672 sys.ps2 to prompt the next line."""
1673
1673
1674 try:
1674 try:
1675 code = self.compile(source,filename,symbol)
1675 code = self.compile(source,filename,symbol)
1676 except (OverflowError, SyntaxError, ValueError):
1676 except (OverflowError, SyntaxError, ValueError):
1677 # Case 1
1677 # Case 1
1678 self.showsyntaxerror(filename)
1678 self.showsyntaxerror(filename)
1679 return None
1679 return None
1680
1680
1681 if code is None:
1681 if code is None:
1682 # Case 2
1682 # Case 2
1683 return True
1683 return True
1684
1684
1685 # Case 3
1685 # Case 3
1686 # We store the code object so that threaded shells and
1686 # We store the code object so that threaded shells and
1687 # custom exception handlers can access all this info if needed.
1687 # custom exception handlers can access all this info if needed.
1688 # The source corresponding to this can be obtained from the
1688 # The source corresponding to this can be obtained from the
1689 # buffer attribute as '\n'.join(self.buffer).
1689 # buffer attribute as '\n'.join(self.buffer).
1690 self.code_to_run = code
1690 self.code_to_run = code
1691 # now actually execute the code object
1691 # now actually execute the code object
1692 if self.runcode(code) == 0:
1692 if self.runcode(code) == 0:
1693 return False
1693 return False
1694 else:
1694 else:
1695 return None
1695 return None
1696
1696
1697 def runcode(self,code_obj):
1697 def runcode(self,code_obj):
1698 """Execute a code object.
1698 """Execute a code object.
1699
1699
1700 When an exception occurs, self.showtraceback() is called to display a
1700 When an exception occurs, self.showtraceback() is called to display a
1701 traceback.
1701 traceback.
1702
1702
1703 Return value: a flag indicating whether the code to be run completed
1703 Return value: a flag indicating whether the code to be run completed
1704 successfully:
1704 successfully:
1705
1705
1706 - 0: successful execution.
1706 - 0: successful execution.
1707 - 1: an error occurred.
1707 - 1: an error occurred.
1708 """
1708 """
1709
1709
1710 # Set our own excepthook in case the user code tries to call it
1710 # Set our own excepthook in case the user code tries to call it
1711 # directly, so that the IPython crash handler doesn't get triggered
1711 # directly, so that the IPython crash handler doesn't get triggered
1712 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1712 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1713
1713
1714 # we save the original sys.excepthook in the instance, in case config
1714 # we save the original sys.excepthook in the instance, in case config
1715 # code (such as magics) needs access to it.
1715 # code (such as magics) needs access to it.
1716 self.sys_excepthook = old_excepthook
1716 self.sys_excepthook = old_excepthook
1717 outflag = 1 # happens in more places, so it's easier as default
1717 outflag = 1 # happens in more places, so it's easier as default
1718 try:
1718 try:
1719 try:
1719 try:
1720 # Embedded instances require separate global/local namespaces
1720 # Embedded instances require separate global/local namespaces
1721 # so they can see both the surrounding (local) namespace and
1721 # so they can see both the surrounding (local) namespace and
1722 # the module-level globals when called inside another function.
1722 # the module-level globals when called inside another function.
1723 if self.embedded:
1723 if self.embedded:
1724 exec code_obj in self.user_global_ns, self.user_ns
1724 exec code_obj in self.user_global_ns, self.user_ns
1725 # Normal (non-embedded) instances should only have a single
1725 # Normal (non-embedded) instances should only have a single
1726 # namespace for user code execution, otherwise functions won't
1726 # namespace for user code execution, otherwise functions won't
1727 # see interactive top-level globals.
1727 # see interactive top-level globals.
1728 else:
1728 else:
1729 exec code_obj in self.user_ns
1729 exec code_obj in self.user_ns
1730 finally:
1730 finally:
1731 # Reset our crash handler in place
1731 # Reset our crash handler in place
1732 sys.excepthook = old_excepthook
1732 sys.excepthook = old_excepthook
1733 except SystemExit:
1733 except SystemExit:
1734 self.resetbuffer()
1734 self.resetbuffer()
1735 self.showtraceback()
1735 self.showtraceback()
1736 warn("Type exit or quit to exit IPython "
1736 warn("Type exit or quit to exit IPython "
1737 "(%Exit or %Quit do so unconditionally).",level=1)
1737 "(%Exit or %Quit do so unconditionally).",level=1)
1738 except self.custom_exceptions:
1738 except self.custom_exceptions:
1739 etype,value,tb = sys.exc_info()
1739 etype,value,tb = sys.exc_info()
1740 self.CustomTB(etype,value,tb)
1740 self.CustomTB(etype,value,tb)
1741 except:
1741 except:
1742 self.showtraceback()
1742 self.showtraceback()
1743 else:
1743 else:
1744 outflag = 0
1744 outflag = 0
1745 if softspace(sys.stdout, 0):
1745 if softspace(sys.stdout, 0):
1746 print
1746 print
1747 # Flush out code object which has been run (and source)
1747 # Flush out code object which has been run (and source)
1748 self.code_to_run = None
1748 self.code_to_run = None
1749 return outflag
1749 return outflag
1750
1750
1751 def push(self, line):
1751 def push(self, line):
1752 """Push a line to the interpreter.
1752 """Push a line to the interpreter.
1753
1753
1754 The line should not have a trailing newline; it may have
1754 The line should not have a trailing newline; it may have
1755 internal newlines. The line is appended to a buffer and the
1755 internal newlines. The line is appended to a buffer and the
1756 interpreter's runsource() method is called with the
1756 interpreter's runsource() method is called with the
1757 concatenated contents of the buffer as source. If this
1757 concatenated contents of the buffer as source. If this
1758 indicates that the command was executed or invalid, the buffer
1758 indicates that the command was executed or invalid, the buffer
1759 is reset; otherwise, the command is incomplete, and the buffer
1759 is reset; otherwise, the command is incomplete, and the buffer
1760 is left as it was after the line was appended. The return
1760 is left as it was after the line was appended. The return
1761 value is 1 if more input is required, 0 if the line was dealt
1761 value is 1 if more input is required, 0 if the line was dealt
1762 with in some way (this is the same as runsource()).
1762 with in some way (this is the same as runsource()).
1763 """
1763 """
1764
1764
1765 # autoindent management should be done here, and not in the
1765 # autoindent management should be done here, and not in the
1766 # interactive loop, since that one is only seen by keyboard input. We
1766 # interactive loop, since that one is only seen by keyboard input. We
1767 # need this done correctly even for code run via runlines (which uses
1767 # need this done correctly even for code run via runlines (which uses
1768 # push).
1768 # push).
1769
1769
1770 #print 'push line: <%s>' % line # dbg
1770 #print 'push line: <%s>' % line # dbg
1771 self.autoindent_update(line)
1771 self.autoindent_update(line)
1772
1772
1773 self.buffer.append(line)
1773 self.buffer.append(line)
1774 more = self.runsource('\n'.join(self.buffer), self.filename)
1774 more = self.runsource('\n'.join(self.buffer), self.filename)
1775 if not more:
1775 if not more:
1776 self.resetbuffer()
1776 self.resetbuffer()
1777 return more
1777 return more
1778
1778
1779 def resetbuffer(self):
1779 def resetbuffer(self):
1780 """Reset the input buffer."""
1780 """Reset the input buffer."""
1781 self.buffer[:] = []
1781 self.buffer[:] = []
1782
1782
1783 def raw_input(self,prompt='',continue_prompt=False):
1783 def raw_input(self,prompt='',continue_prompt=False):
1784 """Write a prompt and read a line.
1784 """Write a prompt and read a line.
1785
1785
1786 The returned line does not include the trailing newline.
1786 The returned line does not include the trailing newline.
1787 When the user enters the EOF key sequence, EOFError is raised.
1787 When the user enters the EOF key sequence, EOFError is raised.
1788
1788
1789 Optional inputs:
1789 Optional inputs:
1790
1790
1791 - prompt(''): a string to be printed to prompt the user.
1791 - prompt(''): a string to be printed to prompt the user.
1792
1792
1793 - continue_prompt(False): whether this line is the first one or a
1793 - continue_prompt(False): whether this line is the first one or a
1794 continuation in a sequence of inputs.
1794 continuation in a sequence of inputs.
1795 """
1795 """
1796
1796
1797 line = raw_input_original(prompt)
1797 line = raw_input_original(prompt)
1798
1798
1799 # Try to be reasonably smart about not re-indenting pasted input more
1799 # Try to be reasonably smart about not re-indenting pasted input more
1800 # than necessary. We do this by trimming out the auto-indent initial
1800 # than necessary. We do this by trimming out the auto-indent initial
1801 # spaces, if the user's actual input started itself with whitespace.
1801 # spaces, if the user's actual input started itself with whitespace.
1802 #debugx('self.buffer[-1]')
1802 #debugx('self.buffer[-1]')
1803
1803
1804 if self.autoindent:
1804 if self.autoindent:
1805 if num_ini_spaces(line) > self.indent_current_nsp:
1805 if num_ini_spaces(line) > self.indent_current_nsp:
1806 line = line[self.indent_current_nsp:]
1806 line = line[self.indent_current_nsp:]
1807 self.indent_current_nsp = 0
1807 self.indent_current_nsp = 0
1808
1808
1809 # store the unfiltered input before the user has any chance to modify
1809 # store the unfiltered input before the user has any chance to modify
1810 # it.
1810 # it.
1811 if line.strip():
1811 if line.strip():
1812 if continue_prompt:
1812 if continue_prompt:
1813 self.input_hist_raw[-1] += '%s\n' % line
1813 self.input_hist_raw[-1] += '%s\n' % line
1814 else:
1814 else:
1815 self.input_hist_raw.append('%s\n' % line)
1815 self.input_hist_raw.append('%s\n' % line)
1816
1816
1817 try:
1817 try:
1818 lineout = self.prefilter(line,continue_prompt)
1818 lineout = self.prefilter(line,continue_prompt)
1819 except:
1819 except:
1820 # blanket except, in case a user-defined prefilter crashes, so it
1820 # blanket except, in case a user-defined prefilter crashes, so it
1821 # can't take all of ipython with it.
1821 # can't take all of ipython with it.
1822 self.showtraceback()
1822 self.showtraceback()
1823 return ''
1823 return ''
1824 else:
1824 else:
1825 return lineout
1825 return lineout
1826
1826
1827 def split_user_input(self,line):
1827 def split_user_input(self,line):
1828 """Split user input into pre-char, function part and rest."""
1828 """Split user input into pre-char, function part and rest."""
1829
1829
1830 lsplit = self.line_split.match(line)
1830 lsplit = self.line_split.match(line)
1831 if lsplit is None: # no regexp match returns None
1831 if lsplit is None: # no regexp match returns None
1832 try:
1832 try:
1833 iFun,theRest = line.split(None,1)
1833 iFun,theRest = line.split(None,1)
1834 except ValueError:
1834 except ValueError:
1835 iFun,theRest = line,''
1835 iFun,theRest = line,''
1836 pre = re.match('^(\s*)(.*)',line).groups()[0]
1836 pre = re.match('^(\s*)(.*)',line).groups()[0]
1837 else:
1837 else:
1838 pre,iFun,theRest = lsplit.groups()
1838 pre,iFun,theRest = lsplit.groups()
1839
1839
1840 #print 'line:<%s>' % line # dbg
1840 #print 'line:<%s>' % line # dbg
1841 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1841 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1842 return pre,iFun.strip(),theRest
1842 return pre,iFun.strip(),theRest
1843
1843
1844 def _prefilter(self, line, continue_prompt):
1844 def _prefilter(self, line, continue_prompt):
1845 """Calls different preprocessors, depending on the form of line."""
1845 """Calls different preprocessors, depending on the form of line."""
1846
1846
1847 # All handlers *must* return a value, even if it's blank ('').
1847 # All handlers *must* return a value, even if it's blank ('').
1848
1848
1849 # Lines are NOT logged here. Handlers should process the line as
1849 # Lines are NOT logged here. Handlers should process the line as
1850 # needed, update the cache AND log it (so that the input cache array
1850 # needed, update the cache AND log it (so that the input cache array
1851 # stays synced).
1851 # stays synced).
1852
1852
1853 # This function is _very_ delicate, and since it's also the one which
1853 # This function is _very_ delicate, and since it's also the one which
1854 # determines IPython's response to user input, it must be as efficient
1854 # determines IPython's response to user input, it must be as efficient
1855 # as possible. For this reason it has _many_ returns in it, trying
1855 # as possible. For this reason it has _many_ returns in it, trying
1856 # always to exit as quickly as it can figure out what it needs to do.
1856 # always to exit as quickly as it can figure out what it needs to do.
1857
1857
1858 # This function is the main responsible for maintaining IPython's
1858 # This function is the main responsible for maintaining IPython's
1859 # behavior respectful of Python's semantics. So be _very_ careful if
1859 # behavior respectful of Python's semantics. So be _very_ careful if
1860 # making changes to anything here.
1860 # making changes to anything here.
1861
1861
1862 #.....................................................................
1862 #.....................................................................
1863 # Code begins
1863 # Code begins
1864
1864
1865 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1865 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1866
1866
1867 # save the line away in case we crash, so the post-mortem handler can
1867 # save the line away in case we crash, so the post-mortem handler can
1868 # record it
1868 # record it
1869 self._last_input_line = line
1869 self._last_input_line = line
1870
1870
1871 #print '***line: <%s>' % line # dbg
1871 #print '***line: <%s>' % line # dbg
1872
1872
1873 # the input history needs to track even empty lines
1873 # the input history needs to track even empty lines
1874 stripped = line.strip()
1874 stripped = line.strip()
1875
1875
1876 if not stripped:
1876 if not stripped:
1877 if not continue_prompt:
1877 if not continue_prompt:
1878 self.outputcache.prompt_count -= 1
1878 self.outputcache.prompt_count -= 1
1879 return self.handle_normal(line,continue_prompt)
1879 return self.handle_normal(line,continue_prompt)
1880 #return self.handle_normal('',continue_prompt)
1880 #return self.handle_normal('',continue_prompt)
1881
1881
1882 # print '***cont',continue_prompt # dbg
1882 # print '***cont',continue_prompt # dbg
1883 # special handlers are only allowed for single line statements
1883 # special handlers are only allowed for single line statements
1884 if continue_prompt and not self.rc.multi_line_specials:
1884 if continue_prompt and not self.rc.multi_line_specials:
1885 return self.handle_normal(line,continue_prompt)
1885 return self.handle_normal(line,continue_prompt)
1886
1886
1887
1887
1888 # For the rest, we need the structure of the input
1888 # For the rest, we need the structure of the input
1889 pre,iFun,theRest = self.split_user_input(line)
1889 pre,iFun,theRest = self.split_user_input(line)
1890
1890
1891 # See whether any pre-existing handler can take care of it
1891 # See whether any pre-existing handler can take care of it
1892
1892
1893 rewritten = self.hooks.input_prefilter(stripped)
1893 rewritten = self.hooks.input_prefilter(stripped)
1894 if rewritten != stripped: # ok, some prefilter did something
1894 if rewritten != stripped: # ok, some prefilter did something
1895 rewritten = pre + rewritten # add indentation
1895 rewritten = pre + rewritten # add indentation
1896 return self.handle_normal(rewritten)
1896 return self.handle_normal(rewritten)
1897
1897
1898 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1898 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1899
1899
1900 # First check for explicit escapes in the last/first character
1900 # First check for explicit escapes in the last/first character
1901 handler = None
1901 handler = None
1902 if line[-1] == self.ESC_HELP:
1902 if line[-1] == self.ESC_HELP:
1903 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1903 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1904 if handler is None:
1904 if handler is None:
1905 # look at the first character of iFun, NOT of line, so we skip
1905 # look at the first character of iFun, NOT of line, so we skip
1906 # leading whitespace in multiline input
1906 # leading whitespace in multiline input
1907 handler = self.esc_handlers.get(iFun[0:1])
1907 handler = self.esc_handlers.get(iFun[0:1])
1908 if handler is not None:
1908 if handler is not None:
1909 return handler(line,continue_prompt,pre,iFun,theRest)
1909 return handler(line,continue_prompt,pre,iFun,theRest)
1910 # Emacs ipython-mode tags certain input lines
1910 # Emacs ipython-mode tags certain input lines
1911 if line.endswith('# PYTHON-MODE'):
1911 if line.endswith('# PYTHON-MODE'):
1912 return self.handle_emacs(line,continue_prompt)
1912 return self.handle_emacs(line,continue_prompt)
1913
1913
1914 # Next, check if we can automatically execute this thing
1914 # Next, check if we can automatically execute this thing
1915
1915
1916 # Allow ! in multi-line statements if multi_line_specials is on:
1916 # Allow ! in multi-line statements if multi_line_specials is on:
1917 if continue_prompt and self.rc.multi_line_specials and \
1917 if continue_prompt and self.rc.multi_line_specials and \
1918 iFun.startswith(self.ESC_SHELL):
1918 iFun.startswith(self.ESC_SHELL):
1919 return self.handle_shell_escape(line,continue_prompt,
1919 return self.handle_shell_escape(line,continue_prompt,
1920 pre=pre,iFun=iFun,
1920 pre=pre,iFun=iFun,
1921 theRest=theRest)
1921 theRest=theRest)
1922
1922
1923 # Let's try to find if the input line is a magic fn
1923 # Let's try to find if the input line is a magic fn
1924 oinfo = None
1924 oinfo = None
1925 if hasattr(self,'magic_'+iFun):
1925 if hasattr(self,'magic_'+iFun):
1926 # WARNING: _ofind uses getattr(), so it can consume generators and
1926 # WARNING: _ofind uses getattr(), so it can consume generators and
1927 # cause other side effects.
1927 # cause other side effects.
1928 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1928 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1929 if oinfo['ismagic']:
1929 if oinfo['ismagic']:
1930 # Be careful not to call magics when a variable assignment is
1930 # Be careful not to call magics when a variable assignment is
1931 # being made (ls='hi', for example)
1931 # being made (ls='hi', for example)
1932 if self.rc.automagic and \
1932 if self.rc.automagic and \
1933 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1933 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1934 (self.rc.multi_line_specials or not continue_prompt):
1934 (self.rc.multi_line_specials or not continue_prompt):
1935 return self.handle_magic(line,continue_prompt,
1935 return self.handle_magic(line,continue_prompt,
1936 pre,iFun,theRest)
1936 pre,iFun,theRest)
1937 else:
1937 else:
1938 return self.handle_normal(line,continue_prompt)
1938 return self.handle_normal(line,continue_prompt)
1939
1939
1940 # If the rest of the line begins with an (in)equality, assginment or
1940 # If the rest of the line begins with an (in)equality, assginment or
1941 # function call, we should not call _ofind but simply execute it.
1941 # function call, we should not call _ofind but simply execute it.
1942 # This avoids spurious geattr() accesses on objects upon assignment.
1942 # This avoids spurious geattr() accesses on objects upon assignment.
1943 #
1943 #
1944 # It also allows users to assign to either alias or magic names true
1944 # It also allows users to assign to either alias or magic names true
1945 # python variables (the magic/alias systems always take second seat to
1945 # python variables (the magic/alias systems always take second seat to
1946 # true python code).
1946 # true python code).
1947 if theRest and theRest[0] in '!=()':
1947 if theRest and theRest[0] in '!=()':
1948 return self.handle_normal(line,continue_prompt)
1948 return self.handle_normal(line,continue_prompt)
1949
1949
1950 if oinfo is None:
1950 if oinfo is None:
1951 # let's try to ensure that _oinfo is ONLY called when autocall is
1951 # let's try to ensure that _oinfo is ONLY called when autocall is
1952 # on. Since it has inevitable potential side effects, at least
1952 # on. Since it has inevitable potential side effects, at least
1953 # having autocall off should be a guarantee to the user that no
1953 # having autocall off should be a guarantee to the user that no
1954 # weird things will happen.
1954 # weird things will happen.
1955
1955
1956 if self.rc.autocall:
1956 if self.rc.autocall:
1957 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1957 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1958 else:
1958 else:
1959 # in this case, all that's left is either an alias or
1959 # in this case, all that's left is either an alias or
1960 # processing the line normally.
1960 # processing the line normally.
1961 if iFun in self.alias_table:
1961 if iFun in self.alias_table:
1962 # if autocall is off, by not running _ofind we won't know
1962 # if autocall is off, by not running _ofind we won't know
1963 # whether the given name may also exist in one of the
1963 # whether the given name may also exist in one of the
1964 # user's namespace. At this point, it's best to do a
1964 # user's namespace. At this point, it's best to do a
1965 # quick check just to be sure that we don't let aliases
1965 # quick check just to be sure that we don't let aliases
1966 # shadow variables.
1966 # shadow variables.
1967 head = iFun.split('.',1)[0]
1967 head = iFun.split('.',1)[0]
1968 if head in self.user_ns or head in self.internal_ns \
1968 if head in self.user_ns or head in self.internal_ns \
1969 or head in __builtin__.__dict__:
1969 or head in __builtin__.__dict__:
1970 return self.handle_normal(line,continue_prompt)
1970 return self.handle_normal(line,continue_prompt)
1971 else:
1971 else:
1972 return self.handle_alias(line,continue_prompt,
1972 return self.handle_alias(line,continue_prompt,
1973 pre,iFun,theRest)
1973 pre,iFun,theRest)
1974
1974
1975 else:
1975 else:
1976 return self.handle_normal(line,continue_prompt)
1976 return self.handle_normal(line,continue_prompt)
1977
1977
1978 if not oinfo['found']:
1978 if not oinfo['found']:
1979 return self.handle_normal(line,continue_prompt)
1979 return self.handle_normal(line,continue_prompt)
1980 else:
1980 else:
1981 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1981 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1982 if oinfo['isalias']:
1982 if oinfo['isalias']:
1983 return self.handle_alias(line,continue_prompt,
1983 return self.handle_alias(line,continue_prompt,
1984 pre,iFun,theRest)
1984 pre,iFun,theRest)
1985
1985
1986 if (self.rc.autocall
1986 if (self.rc.autocall
1987 and
1987 and
1988 (
1988 (
1989 #only consider exclusion re if not "," or ";" autoquoting
1989 #only consider exclusion re if not "," or ";" autoquoting
1990 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1990 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1991 or pre == self.ESC_PAREN) or
1991 or pre == self.ESC_PAREN) or
1992 (not self.re_exclude_auto.match(theRest)))
1992 (not self.re_exclude_auto.match(theRest)))
1993 and
1993 and
1994 self.re_fun_name.match(iFun) and
1994 self.re_fun_name.match(iFun) and
1995 callable(oinfo['obj'])) :
1995 callable(oinfo['obj'])) :
1996 #print 'going auto' # dbg
1996 #print 'going auto' # dbg
1997 return self.handle_auto(line,continue_prompt,
1997 return self.handle_auto(line,continue_prompt,
1998 pre,iFun,theRest,oinfo['obj'])
1998 pre,iFun,theRest,oinfo['obj'])
1999 else:
1999 else:
2000 #print 'was callable?', callable(oinfo['obj']) # dbg
2000 #print 'was callable?', callable(oinfo['obj']) # dbg
2001 return self.handle_normal(line,continue_prompt)
2001 return self.handle_normal(line,continue_prompt)
2002
2002
2003 # If we get here, we have a normal Python line. Log and return.
2003 # If we get here, we have a normal Python line. Log and return.
2004 return self.handle_normal(line,continue_prompt)
2004 return self.handle_normal(line,continue_prompt)
2005
2005
2006 def _prefilter_dumb(self, line, continue_prompt):
2006 def _prefilter_dumb(self, line, continue_prompt):
2007 """simple prefilter function, for debugging"""
2007 """simple prefilter function, for debugging"""
2008 return self.handle_normal(line,continue_prompt)
2008 return self.handle_normal(line,continue_prompt)
2009
2009
2010 # Set the default prefilter() function (this can be user-overridden)
2010 # Set the default prefilter() function (this can be user-overridden)
2011 prefilter = _prefilter
2011 prefilter = _prefilter
2012
2012
2013 def handle_normal(self,line,continue_prompt=None,
2013 def handle_normal(self,line,continue_prompt=None,
2014 pre=None,iFun=None,theRest=None):
2014 pre=None,iFun=None,theRest=None):
2015 """Handle normal input lines. Use as a template for handlers."""
2015 """Handle normal input lines. Use as a template for handlers."""
2016
2016
2017 # With autoindent on, we need some way to exit the input loop, and I
2017 # With autoindent on, we need some way to exit the input loop, and I
2018 # don't want to force the user to have to backspace all the way to
2018 # don't want to force the user to have to backspace all the way to
2019 # clear the line. The rule will be in this case, that either two
2019 # clear the line. The rule will be in this case, that either two
2020 # lines of pure whitespace in a row, or a line of pure whitespace but
2020 # lines of pure whitespace in a row, or a line of pure whitespace but
2021 # of a size different to the indent level, will exit the input loop.
2021 # of a size different to the indent level, will exit the input loop.
2022
2022
2023 if (continue_prompt and self.autoindent and line.isspace() and
2023 if (continue_prompt and self.autoindent and line.isspace() and
2024 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2024 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2025 (self.buffer[-1]).isspace() )):
2025 (self.buffer[-1]).isspace() )):
2026 line = ''
2026 line = ''
2027
2027
2028 self.log(line,line,continue_prompt)
2028 self.log(line,line,continue_prompt)
2029 return line
2029 return line
2030
2030
2031 def handle_alias(self,line,continue_prompt=None,
2031 def handle_alias(self,line,continue_prompt=None,
2032 pre=None,iFun=None,theRest=None):
2032 pre=None,iFun=None,theRest=None):
2033 """Handle alias input lines. """
2033 """Handle alias input lines. """
2034
2034
2035 # pre is needed, because it carries the leading whitespace. Otherwise
2035 # pre is needed, because it carries the leading whitespace. Otherwise
2036 # aliases won't work in indented sections.
2036 # aliases won't work in indented sections.
2037 transformed = self.transform_alias(iFun, theRest)
2037 transformed = self.transform_alias(iFun, theRest)
2038 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2038 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2039 self.log(line,line_out,continue_prompt)
2039 self.log(line,line_out,continue_prompt)
2040 #print 'line out:',line_out # dbg
2040 #print 'line out:',line_out # dbg
2041 return line_out
2041 return line_out
2042
2042
2043 def handle_shell_escape(self, line, continue_prompt=None,
2043 def handle_shell_escape(self, line, continue_prompt=None,
2044 pre=None,iFun=None,theRest=None):
2044 pre=None,iFun=None,theRest=None):
2045 """Execute the line in a shell, empty return value"""
2045 """Execute the line in a shell, empty return value"""
2046
2046
2047 #print 'line in :', `line` # dbg
2047 #print 'line in :', `line` # dbg
2048 # Example of a special handler. Others follow a similar pattern.
2048 # Example of a special handler. Others follow a similar pattern.
2049 if line.lstrip().startswith('!!'):
2049 if line.lstrip().startswith('!!'):
2050 # rewrite iFun/theRest to properly hold the call to %sx and
2050 # rewrite iFun/theRest to properly hold the call to %sx and
2051 # the actual command to be executed, so handle_magic can work
2051 # the actual command to be executed, so handle_magic can work
2052 # correctly
2052 # correctly
2053 theRest = '%s %s' % (iFun[2:],theRest)
2053 theRest = '%s %s' % (iFun[2:],theRest)
2054 iFun = 'sx'
2054 iFun = 'sx'
2055 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2055 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2056 line.lstrip()[2:]),
2056 line.lstrip()[2:]),
2057 continue_prompt,pre,iFun,theRest)
2057 continue_prompt,pre,iFun,theRest)
2058 else:
2058 else:
2059 cmd=line.lstrip().lstrip('!')
2059 cmd=line.lstrip().lstrip('!')
2060 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2060 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2061 # update cache/log and return
2061 # update cache/log and return
2062 self.log(line,line_out,continue_prompt)
2062 self.log(line,line_out,continue_prompt)
2063 return line_out
2063 return line_out
2064
2064
2065 def handle_magic(self, line, continue_prompt=None,
2065 def handle_magic(self, line, continue_prompt=None,
2066 pre=None,iFun=None,theRest=None):
2066 pre=None,iFun=None,theRest=None):
2067 """Execute magic functions."""
2067 """Execute magic functions."""
2068
2068
2069
2069
2070 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2070 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2071 self.log(line,cmd,continue_prompt)
2071 self.log(line,cmd,continue_prompt)
2072 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2072 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2073 return cmd
2073 return cmd
2074
2074
2075 def handle_auto(self, line, continue_prompt=None,
2075 def handle_auto(self, line, continue_prompt=None,
2076 pre=None,iFun=None,theRest=None,obj=None):
2076 pre=None,iFun=None,theRest=None,obj=None):
2077 """Hande lines which can be auto-executed, quoting if requested."""
2077 """Hande lines which can be auto-executed, quoting if requested."""
2078
2078
2079 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2079 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2080
2080
2081 # This should only be active for single-line input!
2081 # This should only be active for single-line input!
2082 if continue_prompt:
2082 if continue_prompt:
2083 self.log(line,line,continue_prompt)
2083 self.log(line,line,continue_prompt)
2084 return line
2084 return line
2085
2085
2086 auto_rewrite = True
2086 auto_rewrite = True
2087
2087
2088 if pre == self.ESC_QUOTE:
2088 if pre == self.ESC_QUOTE:
2089 # Auto-quote splitting on whitespace
2089 # Auto-quote splitting on whitespace
2090 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2090 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2091 elif pre == self.ESC_QUOTE2:
2091 elif pre == self.ESC_QUOTE2:
2092 # Auto-quote whole string
2092 # Auto-quote whole string
2093 newcmd = '%s("%s")' % (iFun,theRest)
2093 newcmd = '%s("%s")' % (iFun,theRest)
2094 elif pre == self.ESC_PAREN:
2094 elif pre == self.ESC_PAREN:
2095 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2095 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2096 else:
2096 else:
2097 # Auto-paren.
2097 # Auto-paren.
2098 # We only apply it to argument-less calls if the autocall
2098 # We only apply it to argument-less calls if the autocall
2099 # parameter is set to 2. We only need to check that autocall is <
2099 # parameter is set to 2. We only need to check that autocall is <
2100 # 2, since this function isn't called unless it's at least 1.
2100 # 2, since this function isn't called unless it's at least 1.
2101 if not theRest and (self.rc.autocall < 2):
2101 if not theRest and (self.rc.autocall < 2):
2102 newcmd = '%s %s' % (iFun,theRest)
2102 newcmd = '%s %s' % (iFun,theRest)
2103 auto_rewrite = False
2103 auto_rewrite = False
2104 else:
2104 else:
2105 if theRest.startswith('['):
2105 if theRest.startswith('['):
2106 if hasattr(obj,'__getitem__'):
2106 if hasattr(obj,'__getitem__'):
2107 # Don't autocall in this case: item access for an object
2107 # Don't autocall in this case: item access for an object
2108 # which is BOTH callable and implements __getitem__.
2108 # which is BOTH callable and implements __getitem__.
2109 newcmd = '%s %s' % (iFun,theRest)
2109 newcmd = '%s %s' % (iFun,theRest)
2110 auto_rewrite = False
2110 auto_rewrite = False
2111 else:
2111 else:
2112 # if the object doesn't support [] access, go ahead and
2112 # if the object doesn't support [] access, go ahead and
2113 # autocall
2113 # autocall
2114 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2114 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2115 elif theRest.endswith(';'):
2115 elif theRest.endswith(';'):
2116 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2116 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2117 else:
2117 else:
2118 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2118 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2119
2119
2120 if auto_rewrite:
2120 if auto_rewrite:
2121 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2121 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2122 # log what is now valid Python, not the actual user input (without the
2122 # log what is now valid Python, not the actual user input (without the
2123 # final newline)
2123 # final newline)
2124 self.log(line,newcmd,continue_prompt)
2124 self.log(line,newcmd,continue_prompt)
2125 return newcmd
2125 return newcmd
2126
2126
2127 def handle_help(self, line, continue_prompt=None,
2127 def handle_help(self, line, continue_prompt=None,
2128 pre=None,iFun=None,theRest=None):
2128 pre=None,iFun=None,theRest=None):
2129 """Try to get some help for the object.
2129 """Try to get some help for the object.
2130
2130
2131 obj? or ?obj -> basic information.
2131 obj? or ?obj -> basic information.
2132 obj?? or ??obj -> more details.
2132 obj?? or ??obj -> more details.
2133 """
2133 """
2134
2134
2135 # We need to make sure that we don't process lines which would be
2135 # We need to make sure that we don't process lines which would be
2136 # otherwise valid python, such as "x=1 # what?"
2136 # otherwise valid python, such as "x=1 # what?"
2137 try:
2137 try:
2138 codeop.compile_command(line)
2138 codeop.compile_command(line)
2139 except SyntaxError:
2139 except SyntaxError:
2140 # We should only handle as help stuff which is NOT valid syntax
2140 # We should only handle as help stuff which is NOT valid syntax
2141 if line[0]==self.ESC_HELP:
2141 if line[0]==self.ESC_HELP:
2142 line = line[1:]
2142 line = line[1:]
2143 elif line[-1]==self.ESC_HELP:
2143 elif line[-1]==self.ESC_HELP:
2144 line = line[:-1]
2144 line = line[:-1]
2145 self.log(line,'#?'+line,continue_prompt)
2145 self.log(line,'#?'+line,continue_prompt)
2146 if line:
2146 if line:
2147 self.magic_pinfo(line)
2147 self.magic_pinfo(line)
2148 else:
2148 else:
2149 page(self.usage,screen_lines=self.rc.screen_length)
2149 page(self.usage,screen_lines=self.rc.screen_length)
2150 return '' # Empty string is needed here!
2150 return '' # Empty string is needed here!
2151 except:
2151 except:
2152 # Pass any other exceptions through to the normal handler
2152 # Pass any other exceptions through to the normal handler
2153 return self.handle_normal(line,continue_prompt)
2153 return self.handle_normal(line,continue_prompt)
2154 else:
2154 else:
2155 # If the code compiles ok, we should handle it normally
2155 # If the code compiles ok, we should handle it normally
2156 return self.handle_normal(line,continue_prompt)
2156 return self.handle_normal(line,continue_prompt)
2157
2157
2158 def getapi(self):
2158 def getapi(self):
2159 """ Get an IPApi object for this shell instance
2159 """ Get an IPApi object for this shell instance
2160
2160
2161 Getting an IPApi object is always preferable to accessing the shell
2161 Getting an IPApi object is always preferable to accessing the shell
2162 directly, but this holds true especially for extensions.
2162 directly, but this holds true especially for extensions.
2163
2163
2164 It should always be possible to implement an extension with IPApi
2164 It should always be possible to implement an extension with IPApi
2165 alone. If not, contact maintainer to request an addition.
2165 alone. If not, contact maintainer to request an addition.
2166
2166
2167 """
2167 """
2168 return self.api
2168 return self.api
2169
2169
2170 def handle_emacs(self,line,continue_prompt=None,
2170 def handle_emacs(self,line,continue_prompt=None,
2171 pre=None,iFun=None,theRest=None):
2171 pre=None,iFun=None,theRest=None):
2172 """Handle input lines marked by python-mode."""
2172 """Handle input lines marked by python-mode."""
2173
2173
2174 # Currently, nothing is done. Later more functionality can be added
2174 # Currently, nothing is done. Later more functionality can be added
2175 # here if needed.
2175 # here if needed.
2176
2176
2177 # The input cache shouldn't be updated
2177 # The input cache shouldn't be updated
2178
2178
2179 return line
2179 return line
2180
2180
2181 def mktempfile(self,data=None):
2181 def mktempfile(self,data=None):
2182 """Make a new tempfile and return its filename.
2182 """Make a new tempfile and return its filename.
2183
2183
2184 This makes a call to tempfile.mktemp, but it registers the created
2184 This makes a call to tempfile.mktemp, but it registers the created
2185 filename internally so ipython cleans it up at exit time.
2185 filename internally so ipython cleans it up at exit time.
2186
2186
2187 Optional inputs:
2187 Optional inputs:
2188
2188
2189 - data(None): if data is given, it gets written out to the temp file
2189 - data(None): if data is given, it gets written out to the temp file
2190 immediately, and the file is closed again."""
2190 immediately, and the file is closed again."""
2191
2191
2192 filename = tempfile.mktemp('.py','ipython_edit_')
2192 filename = tempfile.mktemp('.py','ipython_edit_')
2193 self.tempfiles.append(filename)
2193 self.tempfiles.append(filename)
2194
2194
2195 if data:
2195 if data:
2196 tmp_file = open(filename,'w')
2196 tmp_file = open(filename,'w')
2197 tmp_file.write(data)
2197 tmp_file.write(data)
2198 tmp_file.close()
2198 tmp_file.close()
2199 return filename
2199 return filename
2200
2200
2201 def write(self,data):
2201 def write(self,data):
2202 """Write a string to the default output"""
2202 """Write a string to the default output"""
2203 Term.cout.write(data)
2203 Term.cout.write(data)
2204
2204
2205 def write_err(self,data):
2205 def write_err(self,data):
2206 """Write a string to the default error output"""
2206 """Write a string to the default error output"""
2207 Term.cerr.write(data)
2207 Term.cerr.write(data)
2208
2208
2209 def exit(self):
2209 def exit(self):
2210 """Handle interactive exit.
2210 """Handle interactive exit.
2211
2211
2212 This method sets the exit_now attribute."""
2212 This method sets the exit_now attribute."""
2213
2213
2214 if self.rc.confirm_exit:
2214 if self.rc.confirm_exit:
2215 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2215 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2216 self.exit_now = True
2216 self.exit_now = True
2217 else:
2217 else:
2218 self.exit_now = True
2218 self.exit_now = True
2219 return self.exit_now
2219 return self.exit_now
2220
2220
2221 def safe_execfile(self,fname,*where,**kw):
2221 def safe_execfile(self,fname,*where,**kw):
2222 fname = os.path.expanduser(fname)
2222 fname = os.path.expanduser(fname)
2223
2223
2224 # find things also in current directory
2224 # find things also in current directory
2225 dname = os.path.dirname(fname)
2225 dname = os.path.dirname(fname)
2226 if not sys.path.count(dname):
2226 if not sys.path.count(dname):
2227 sys.path.append(dname)
2227 sys.path.append(dname)
2228
2228
2229 try:
2229 try:
2230 xfile = open(fname)
2230 xfile = open(fname)
2231 except:
2231 except:
2232 print >> Term.cerr, \
2232 print >> Term.cerr, \
2233 'Could not open file <%s> for safe execution.' % fname
2233 'Could not open file <%s> for safe execution.' % fname
2234 return None
2234 return None
2235
2235
2236 kw.setdefault('islog',0)
2236 kw.setdefault('islog',0)
2237 kw.setdefault('quiet',1)
2237 kw.setdefault('quiet',1)
2238 kw.setdefault('exit_ignore',0)
2238 kw.setdefault('exit_ignore',0)
2239 first = xfile.readline()
2239 first = xfile.readline()
2240 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2240 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2241 xfile.close()
2241 xfile.close()
2242 # line by line execution
2242 # line by line execution
2243 if first.startswith(loghead) or kw['islog']:
2243 if first.startswith(loghead) or kw['islog']:
2244 print 'Loading log file <%s> one line at a time...' % fname
2244 print 'Loading log file <%s> one line at a time...' % fname
2245 if kw['quiet']:
2245 if kw['quiet']:
2246 stdout_save = sys.stdout
2246 stdout_save = sys.stdout
2247 sys.stdout = StringIO.StringIO()
2247 sys.stdout = StringIO.StringIO()
2248 try:
2248 try:
2249 globs,locs = where[0:2]
2249 globs,locs = where[0:2]
2250 except:
2250 except:
2251 try:
2251 try:
2252 globs = locs = where[0]
2252 globs = locs = where[0]
2253 except:
2253 except:
2254 globs = locs = globals()
2254 globs = locs = globals()
2255 badblocks = []
2255 badblocks = []
2256
2256
2257 # we also need to identify indented blocks of code when replaying
2257 # we also need to identify indented blocks of code when replaying
2258 # logs and put them together before passing them to an exec
2258 # logs and put them together before passing them to an exec
2259 # statement. This takes a bit of regexp and look-ahead work in the
2259 # statement. This takes a bit of regexp and look-ahead work in the
2260 # file. It's easiest if we swallow the whole thing in memory
2260 # file. It's easiest if we swallow the whole thing in memory
2261 # first, and manually walk through the lines list moving the
2261 # first, and manually walk through the lines list moving the
2262 # counter ourselves.
2262 # counter ourselves.
2263 indent_re = re.compile('\s+\S')
2263 indent_re = re.compile('\s+\S')
2264 xfile = open(fname)
2264 xfile = open(fname)
2265 filelines = xfile.readlines()
2265 filelines = xfile.readlines()
2266 xfile.close()
2266 xfile.close()
2267 nlines = len(filelines)
2267 nlines = len(filelines)
2268 lnum = 0
2268 lnum = 0
2269 while lnum < nlines:
2269 while lnum < nlines:
2270 line = filelines[lnum]
2270 line = filelines[lnum]
2271 lnum += 1
2271 lnum += 1
2272 # don't re-insert logger status info into cache
2272 # don't re-insert logger status info into cache
2273 if line.startswith('#log#'):
2273 if line.startswith('#log#'):
2274 continue
2274 continue
2275 else:
2275 else:
2276 # build a block of code (maybe a single line) for execution
2276 # build a block of code (maybe a single line) for execution
2277 block = line
2277 block = line
2278 try:
2278 try:
2279 next = filelines[lnum] # lnum has already incremented
2279 next = filelines[lnum] # lnum has already incremented
2280 except:
2280 except:
2281 next = None
2281 next = None
2282 while next and indent_re.match(next):
2282 while next and indent_re.match(next):
2283 block += next
2283 block += next
2284 lnum += 1
2284 lnum += 1
2285 try:
2285 try:
2286 next = filelines[lnum]
2286 next = filelines[lnum]
2287 except:
2287 except:
2288 next = None
2288 next = None
2289 # now execute the block of one or more lines
2289 # now execute the block of one or more lines
2290 try:
2290 try:
2291 exec block in globs,locs
2291 exec block in globs,locs
2292 except SystemExit:
2292 except SystemExit:
2293 pass
2293 pass
2294 except:
2294 except:
2295 badblocks.append(block.rstrip())
2295 badblocks.append(block.rstrip())
2296 if kw['quiet']: # restore stdout
2296 if kw['quiet']: # restore stdout
2297 sys.stdout.close()
2297 sys.stdout.close()
2298 sys.stdout = stdout_save
2298 sys.stdout = stdout_save
2299 print 'Finished replaying log file <%s>' % fname
2299 print 'Finished replaying log file <%s>' % fname
2300 if badblocks:
2300 if badblocks:
2301 print >> sys.stderr, ('\nThe following lines/blocks in file '
2301 print >> sys.stderr, ('\nThe following lines/blocks in file '
2302 '<%s> reported errors:' % fname)
2302 '<%s> reported errors:' % fname)
2303
2303
2304 for badline in badblocks:
2304 for badline in badblocks:
2305 print >> sys.stderr, badline
2305 print >> sys.stderr, badline
2306 else: # regular file execution
2306 else: # regular file execution
2307 try:
2307 try:
2308 execfile(fname,*where)
2308 execfile(fname,*where)
2309 except SyntaxError:
2309 except SyntaxError:
2310 self.showsyntaxerror()
2310 self.showsyntaxerror()
2311 warn('Failure executing file: <%s>' % fname)
2311 warn('Failure executing file: <%s>' % fname)
2312 except SystemExit,status:
2312 except SystemExit,status:
2313 if not kw['exit_ignore']:
2313 if not kw['exit_ignore']:
2314 self.showtraceback()
2314 self.showtraceback()
2315 warn('Failure executing file: <%s>' % fname)
2315 warn('Failure executing file: <%s>' % fname)
2316 except:
2316 except:
2317 self.showtraceback()
2317 self.showtraceback()
2318 warn('Failure executing file: <%s>' % fname)
2318 warn('Failure executing file: <%s>' % fname)
2319
2319
2320 #************************* end of file <iplib.py> *****************************
2320 #************************* end of file <iplib.py> *****************************
@@ -1,5531 +1,5538 b''
1 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
4 the original fix was incomplete. Patch submitted by W. Maier.
5
1 2006-06-07 Ville Vainio <vivainio@gmail.com>
6 2006-06-07 Ville Vainio <vivainio@gmail.com>
2
7
3 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
8 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
4 Confirmation prompts can be supressed by 'quiet' option.
9 Confirmation prompts can be supressed by 'quiet' option.
5 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
10 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
6
11
12 2006-06-06 *** Released version 0.7.2
13
7 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
14 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
8
15
9 * IPython/Release.py (version): Made 0.7.2 final for release.
16 * IPython/Release.py (version): Made 0.7.2 final for release.
10 Repo tagged and release cut.
17 Repo tagged and release cut.
11
18
12 2006-06-05 Ville Vainio <vivainio@gmail.com>
19 2006-06-05 Ville Vainio <vivainio@gmail.com>
13
20
14 * Magic.py (magic_rehashx): Honor no_alias list earlier in
21 * Magic.py (magic_rehashx): Honor no_alias list earlier in
15 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
22 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
16
23
17 * upgrade_dir.py: try import 'path' module a bit harder
24 * upgrade_dir.py: try import 'path' module a bit harder
18 (for %upgrade)
25 (for %upgrade)
19
26
20 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
27 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
21
28
22 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
29 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
23 instead of looping 20 times.
30 instead of looping 20 times.
24
31
25 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
32 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
26 correctly at initialization time. Bug reported by Krishna Mohan
33 correctly at initialization time. Bug reported by Krishna Mohan
27 Gundu <gkmohan-AT-gmail.com> on the user list.
34 Gundu <gkmohan-AT-gmail.com> on the user list.
28
35
29 * IPython/Release.py (version): Mark 0.7.2 version to start
36 * IPython/Release.py (version): Mark 0.7.2 version to start
30 testing for release on 06/06.
37 testing for release on 06/06.
31
38
32 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
39 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
33
40
34 * scripts/irunner: thin script interface so users don't have to
41 * scripts/irunner: thin script interface so users don't have to
35 find the module and call it as an executable, since modules rarely
42 find the module and call it as an executable, since modules rarely
36 live in people's PATH.
43 live in people's PATH.
37
44
38 * IPython/irunner.py (InteractiveRunner.__init__): added
45 * IPython/irunner.py (InteractiveRunner.__init__): added
39 delaybeforesend attribute to control delays with newer versions of
46 delaybeforesend attribute to control delays with newer versions of
40 pexpect. Thanks to detailed help from pexpect's author, Noah
47 pexpect. Thanks to detailed help from pexpect's author, Noah
41 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
48 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
42 correctly (it works in NoColor mode).
49 correctly (it works in NoColor mode).
43
50
44 * IPython/iplib.py (handle_normal): fix nasty crash reported on
51 * IPython/iplib.py (handle_normal): fix nasty crash reported on
45 SAGE list, from improper log() calls.
52 SAGE list, from improper log() calls.
46
53
47 2006-05-31 Ville Vainio <vivainio@gmail.com>
54 2006-05-31 Ville Vainio <vivainio@gmail.com>
48
55
49 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
56 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
50 with args in parens to work correctly with dirs that have spaces.
57 with args in parens to work correctly with dirs that have spaces.
51
58
52 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
59 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
53
60
54 * IPython/Logger.py (Logger.logstart): add option to log raw input
61 * IPython/Logger.py (Logger.logstart): add option to log raw input
55 instead of the processed one. A -r flag was added to the
62 instead of the processed one. A -r flag was added to the
56 %logstart magic used for controlling logging.
63 %logstart magic used for controlling logging.
57
64
58 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
65 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
59
66
60 * IPython/iplib.py (InteractiveShell.__init__): add check for the
67 * IPython/iplib.py (InteractiveShell.__init__): add check for the
61 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
68 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
62 recognize the option. After a bug report by Will Maier. This
69 recognize the option. After a bug report by Will Maier. This
63 closes #64 (will do it after confirmation from W. Maier).
70 closes #64 (will do it after confirmation from W. Maier).
64
71
65 * IPython/irunner.py: New module to run scripts as if manually
72 * IPython/irunner.py: New module to run scripts as if manually
66 typed into an interactive environment, based on pexpect. After a
73 typed into an interactive environment, based on pexpect. After a
67 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
74 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
68 ipython-user list. Simple unittests in the tests/ directory.
75 ipython-user list. Simple unittests in the tests/ directory.
69
76
70 * tools/release: add Will Maier, OpenBSD port maintainer, to
77 * tools/release: add Will Maier, OpenBSD port maintainer, to
71 recepients list. We are now officially part of the OpenBSD ports:
78 recepients list. We are now officially part of the OpenBSD ports:
72 http://www.openbsd.org/ports.html ! Many thanks to Will for the
79 http://www.openbsd.org/ports.html ! Many thanks to Will for the
73 work.
80 work.
74
81
75 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
82 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
76
83
77 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
84 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
78 so that it doesn't break tkinter apps.
85 so that it doesn't break tkinter apps.
79
86
80 * IPython/iplib.py (_prefilter): fix bug where aliases would
87 * IPython/iplib.py (_prefilter): fix bug where aliases would
81 shadow variables when autocall was fully off. Reported by SAGE
88 shadow variables when autocall was fully off. Reported by SAGE
82 author William Stein.
89 author William Stein.
83
90
84 * IPython/OInspect.py (Inspector.__init__): add a flag to control
91 * IPython/OInspect.py (Inspector.__init__): add a flag to control
85 at what detail level strings are computed when foo? is requested.
92 at what detail level strings are computed when foo? is requested.
86 This allows users to ask for example that the string form of an
93 This allows users to ask for example that the string form of an
87 object is only computed when foo?? is called, or even never, by
94 object is only computed when foo?? is called, or even never, by
88 setting the object_info_string_level >= 2 in the configuration
95 setting the object_info_string_level >= 2 in the configuration
89 file. This new option has been added and documented. After a
96 file. This new option has been added and documented. After a
90 request by SAGE to be able to control the printing of very large
97 request by SAGE to be able to control the printing of very large
91 objects more easily.
98 objects more easily.
92
99
93 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
100 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
94
101
95 * IPython/ipmaker.py (make_IPython): remove the ipython call path
102 * IPython/ipmaker.py (make_IPython): remove the ipython call path
96 from sys.argv, to be 100% consistent with how Python itself works
103 from sys.argv, to be 100% consistent with how Python itself works
97 (as seen for example with python -i file.py). After a bug report
104 (as seen for example with python -i file.py). After a bug report
98 by Jeffrey Collins.
105 by Jeffrey Collins.
99
106
100 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
107 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
101 nasty bug which was preventing custom namespaces with -pylab,
108 nasty bug which was preventing custom namespaces with -pylab,
102 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
109 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
103 compatibility (long gone from mpl).
110 compatibility (long gone from mpl).
104
111
105 * IPython/ipapi.py (make_session): name change: create->make. We
112 * IPython/ipapi.py (make_session): name change: create->make. We
106 use make in other places (ipmaker,...), it's shorter and easier to
113 use make in other places (ipmaker,...), it's shorter and easier to
107 type and say, etc. I'm trying to clean things before 0.7.2 so
114 type and say, etc. I'm trying to clean things before 0.7.2 so
108 that I can keep things stable wrt to ipapi in the chainsaw branch.
115 that I can keep things stable wrt to ipapi in the chainsaw branch.
109
116
110 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
117 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
111 python-mode recognizes our debugger mode. Add support for
118 python-mode recognizes our debugger mode. Add support for
112 autoindent inside (X)emacs. After a patch sent in by Jin Liu
119 autoindent inside (X)emacs. After a patch sent in by Jin Liu
113 <m.liu.jin-AT-gmail.com> originally written by
120 <m.liu.jin-AT-gmail.com> originally written by
114 doxgen-AT-newsmth.net (with minor modifications for xemacs
121 doxgen-AT-newsmth.net (with minor modifications for xemacs
115 compatibility)
122 compatibility)
116
123
117 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
124 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
118 tracebacks when walking the stack so that the stack tracking system
125 tracebacks when walking the stack so that the stack tracking system
119 in emacs' python-mode can identify the frames correctly.
126 in emacs' python-mode can identify the frames correctly.
120
127
121 * IPython/ipmaker.py (make_IPython): make the internal (and
128 * IPython/ipmaker.py (make_IPython): make the internal (and
122 default config) autoedit_syntax value false by default. Too many
129 default config) autoedit_syntax value false by default. Too many
123 users have complained to me (both on and off-list) about problems
130 users have complained to me (both on and off-list) about problems
124 with this option being on by default, so I'm making it default to
131 with this option being on by default, so I'm making it default to
125 off. It can still be enabled by anyone via the usual mechanisms.
132 off. It can still be enabled by anyone via the usual mechanisms.
126
133
127 * IPython/completer.py (Completer.attr_matches): add support for
134 * IPython/completer.py (Completer.attr_matches): add support for
128 PyCrust-style _getAttributeNames magic method. Patch contributed
135 PyCrust-style _getAttributeNames magic method. Patch contributed
129 by <mscott-AT-goldenspud.com>. Closes #50.
136 by <mscott-AT-goldenspud.com>. Closes #50.
130
137
131 * IPython/iplib.py (InteractiveShell.__init__): remove the
138 * IPython/iplib.py (InteractiveShell.__init__): remove the
132 deletion of exit/quit from __builtin__, which can break
139 deletion of exit/quit from __builtin__, which can break
133 third-party tools like the Zope debugging console. The
140 third-party tools like the Zope debugging console. The
134 %exit/%quit magics remain. In general, it's probably a good idea
141 %exit/%quit magics remain. In general, it's probably a good idea
135 not to delete anything from __builtin__, since we never know what
142 not to delete anything from __builtin__, since we never know what
136 that will break. In any case, python now (for 2.5) will support
143 that will break. In any case, python now (for 2.5) will support
137 'real' exit/quit, so this issue is moot. Closes #55.
144 'real' exit/quit, so this issue is moot. Closes #55.
138
145
139 * IPython/genutils.py (with_obj): rename the 'with' function to
146 * IPython/genutils.py (with_obj): rename the 'with' function to
140 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
147 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
141 becomes a language keyword. Closes #53.
148 becomes a language keyword. Closes #53.
142
149
143 * IPython/FakeModule.py (FakeModule.__init__): add a proper
150 * IPython/FakeModule.py (FakeModule.__init__): add a proper
144 __file__ attribute to this so it fools more things into thinking
151 __file__ attribute to this so it fools more things into thinking
145 it is a real module. Closes #59.
152 it is a real module. Closes #59.
146
153
147 * IPython/Magic.py (magic_edit): add -n option to open the editor
154 * IPython/Magic.py (magic_edit): add -n option to open the editor
148 at a specific line number. After a patch by Stefan van der Walt.
155 at a specific line number. After a patch by Stefan van der Walt.
149
156
150 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
157 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
151
158
152 * IPython/iplib.py (edit_syntax_error): fix crash when for some
159 * IPython/iplib.py (edit_syntax_error): fix crash when for some
153 reason the file could not be opened. After automatic crash
160 reason the file could not be opened. After automatic crash
154 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
161 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
155 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
162 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
156 (_should_recompile): Don't fire editor if using %bg, since there
163 (_should_recompile): Don't fire editor if using %bg, since there
157 is no file in the first place. From the same report as above.
164 is no file in the first place. From the same report as above.
158 (raw_input): protect against faulty third-party prefilters. After
165 (raw_input): protect against faulty third-party prefilters. After
159 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
166 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
160 while running under SAGE.
167 while running under SAGE.
161
168
162 2006-05-23 Ville Vainio <vivainio@gmail.com>
169 2006-05-23 Ville Vainio <vivainio@gmail.com>
163
170
164 * ipapi.py: Stripped down ip.to_user_ns() to work only as
171 * ipapi.py: Stripped down ip.to_user_ns() to work only as
165 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
172 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
166 now returns None (again), unless dummy is specifically allowed by
173 now returns None (again), unless dummy is specifically allowed by
167 ipapi.get(allow_dummy=True).
174 ipapi.get(allow_dummy=True).
168
175
169 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
176 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
170
177
171 * IPython: remove all 2.2-compatibility objects and hacks from
178 * IPython: remove all 2.2-compatibility objects and hacks from
172 everywhere, since we only support 2.3 at this point. Docs
179 everywhere, since we only support 2.3 at this point. Docs
173 updated.
180 updated.
174
181
175 * IPython/ipapi.py (IPApi.__init__): Clean up of all getters.
182 * IPython/ipapi.py (IPApi.__init__): Clean up of all getters.
176 Anything requiring extra validation can be turned into a Python
183 Anything requiring extra validation can be turned into a Python
177 property in the future. I used a property for the db one b/c
184 property in the future. I used a property for the db one b/c
178 there was a nasty circularity problem with the initialization
185 there was a nasty circularity problem with the initialization
179 order, which right now I don't have time to clean up.
186 order, which right now I don't have time to clean up.
180
187
181 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
188 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
182 another locking bug reported by Jorgen. I'm not 100% sure though,
189 another locking bug reported by Jorgen. I'm not 100% sure though,
183 so more testing is needed...
190 so more testing is needed...
184
191
185 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
192 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
186
193
187 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
194 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
188 local variables from any routine in user code (typically executed
195 local variables from any routine in user code (typically executed
189 with %run) directly into the interactive namespace. Very useful
196 with %run) directly into the interactive namespace. Very useful
190 when doing complex debugging.
197 when doing complex debugging.
191 (IPythonNotRunning): Changed the default None object to a dummy
198 (IPythonNotRunning): Changed the default None object to a dummy
192 whose attributes can be queried as well as called without
199 whose attributes can be queried as well as called without
193 exploding, to ease writing code which works transparently both in
200 exploding, to ease writing code which works transparently both in
194 and out of ipython and uses some of this API.
201 and out of ipython and uses some of this API.
195
202
196 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
203 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
197
204
198 * IPython/hooks.py (result_display): Fix the fact that our display
205 * IPython/hooks.py (result_display): Fix the fact that our display
199 hook was using str() instead of repr(), as the default python
206 hook was using str() instead of repr(), as the default python
200 console does. This had gone unnoticed b/c it only happened if
207 console does. This had gone unnoticed b/c it only happened if
201 %Pprint was off, but the inconsistency was there.
208 %Pprint was off, but the inconsistency was there.
202
209
203 2006-05-15 Ville Vainio <vivainio@gmail.com>
210 2006-05-15 Ville Vainio <vivainio@gmail.com>
204
211
205 * Oinspect.py: Only show docstring for nonexisting/binary files
212 * Oinspect.py: Only show docstring for nonexisting/binary files
206 when doing object??, closing ticket #62
213 when doing object??, closing ticket #62
207
214
208 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
215 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
209
216
210 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
217 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
211 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
218 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
212 was being released in a routine which hadn't checked if it had
219 was being released in a routine which hadn't checked if it had
213 been the one to acquire it.
220 been the one to acquire it.
214
221
215 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
222 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
216
223
217 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
224 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
218
225
219 2006-04-11 Ville Vainio <vivainio@gmail.com>
226 2006-04-11 Ville Vainio <vivainio@gmail.com>
220
227
221 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
228 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
222 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
229 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
223 prefilters, allowing stuff like magics and aliases in the file.
230 prefilters, allowing stuff like magics and aliases in the file.
224
231
225 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
232 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
226 added. Supported now are "%clear in" and "%clear out" (clear input and
233 added. Supported now are "%clear in" and "%clear out" (clear input and
227 output history, respectively). Also fixed CachedOutput.flush to
234 output history, respectively). Also fixed CachedOutput.flush to
228 properly flush the output cache.
235 properly flush the output cache.
229
236
230 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
237 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
231 half-success (and fail explicitly).
238 half-success (and fail explicitly).
232
239
233 2006-03-28 Ville Vainio <vivainio@gmail.com>
240 2006-03-28 Ville Vainio <vivainio@gmail.com>
234
241
235 * iplib.py: Fix quoting of aliases so that only argless ones
242 * iplib.py: Fix quoting of aliases so that only argless ones
236 are quoted
243 are quoted
237
244
238 2006-03-28 Ville Vainio <vivainio@gmail.com>
245 2006-03-28 Ville Vainio <vivainio@gmail.com>
239
246
240 * iplib.py: Quote aliases with spaces in the name.
247 * iplib.py: Quote aliases with spaces in the name.
241 "c:\program files\blah\bin" is now legal alias target.
248 "c:\program files\blah\bin" is now legal alias target.
242
249
243 * ext_rehashdir.py: Space no longer allowed as arg
250 * ext_rehashdir.py: Space no longer allowed as arg
244 separator, since space is legal in path names.
251 separator, since space is legal in path names.
245
252
246 2006-03-16 Ville Vainio <vivainio@gmail.com>
253 2006-03-16 Ville Vainio <vivainio@gmail.com>
247
254
248 * upgrade_dir.py: Take path.py from Extensions, correcting
255 * upgrade_dir.py: Take path.py from Extensions, correcting
249 %upgrade magic
256 %upgrade magic
250
257
251 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
258 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
252
259
253 * hooks.py: Only enclose editor binary in quotes if legal and
260 * hooks.py: Only enclose editor binary in quotes if legal and
254 necessary (space in the name, and is an existing file). Fixes a bug
261 necessary (space in the name, and is an existing file). Fixes a bug
255 reported by Zachary Pincus.
262 reported by Zachary Pincus.
256
263
257 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
264 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
258
265
259 * Manual: thanks to a tip on proper color handling for Emacs, by
266 * Manual: thanks to a tip on proper color handling for Emacs, by
260 Eric J Haywiser <ejh1-AT-MIT.EDU>.
267 Eric J Haywiser <ejh1-AT-MIT.EDU>.
261
268
262 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
269 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
263 by applying the provided patch. Thanks to Liu Jin
270 by applying the provided patch. Thanks to Liu Jin
264 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
271 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
265 XEmacs/Linux, I'm trusting the submitter that it actually helps
272 XEmacs/Linux, I'm trusting the submitter that it actually helps
266 under win32/GNU Emacs. Will revisit if any problems are reported.
273 under win32/GNU Emacs. Will revisit if any problems are reported.
267
274
268 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
275 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
269
276
270 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
277 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
271 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
278 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
272
279
273 2006-03-12 Ville Vainio <vivainio@gmail.com>
280 2006-03-12 Ville Vainio <vivainio@gmail.com>
274
281
275 * Magic.py (magic_timeit): Added %timeit magic, contributed by
282 * Magic.py (magic_timeit): Added %timeit magic, contributed by
276 Torsten Marek.
283 Torsten Marek.
277
284
278 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
285 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
279
286
280 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
287 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
281 line ranges works again.
288 line ranges works again.
282
289
283 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
290 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
284
291
285 * IPython/iplib.py (showtraceback): add back sys.last_traceback
292 * IPython/iplib.py (showtraceback): add back sys.last_traceback
286 and friends, after a discussion with Zach Pincus on ipython-user.
293 and friends, after a discussion with Zach Pincus on ipython-user.
287 I'm not 100% sure, but after thinking aobut it quite a bit, it may
294 I'm not 100% sure, but after thinking aobut it quite a bit, it may
288 be OK. Testing with the multithreaded shells didn't reveal any
295 be OK. Testing with the multithreaded shells didn't reveal any
289 problems, but let's keep an eye out.
296 problems, but let's keep an eye out.
290
297
291 In the process, I fixed a few things which were calling
298 In the process, I fixed a few things which were calling
292 self.InteractiveTB() directly (like safe_execfile), which is a
299 self.InteractiveTB() directly (like safe_execfile), which is a
293 mistake: ALL exception reporting should be done by calling
300 mistake: ALL exception reporting should be done by calling
294 self.showtraceback(), which handles state and tab-completion and
301 self.showtraceback(), which handles state and tab-completion and
295 more.
302 more.
296
303
297 2006-03-01 Ville Vainio <vivainio@gmail.com>
304 2006-03-01 Ville Vainio <vivainio@gmail.com>
298
305
299 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
306 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
300 To use, do "from ipipe import *".
307 To use, do "from ipipe import *".
301
308
302 2006-02-24 Ville Vainio <vivainio@gmail.com>
309 2006-02-24 Ville Vainio <vivainio@gmail.com>
303
310
304 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
311 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
305 "cleanly" and safely than the older upgrade mechanism.
312 "cleanly" and safely than the older upgrade mechanism.
306
313
307 2006-02-21 Ville Vainio <vivainio@gmail.com>
314 2006-02-21 Ville Vainio <vivainio@gmail.com>
308
315
309 * Magic.py: %save works again.
316 * Magic.py: %save works again.
310
317
311 2006-02-15 Ville Vainio <vivainio@gmail.com>
318 2006-02-15 Ville Vainio <vivainio@gmail.com>
312
319
313 * Magic.py: %Pprint works again
320 * Magic.py: %Pprint works again
314
321
315 * Extensions/ipy_sane_defaults.py: Provide everything provided
322 * Extensions/ipy_sane_defaults.py: Provide everything provided
316 in default ipythonrc, to make it possible to have a completely empty
323 in default ipythonrc, to make it possible to have a completely empty
317 ipythonrc (and thus completely rc-file free configuration)
324 ipythonrc (and thus completely rc-file free configuration)
318
325
319
326
320 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
327 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
321
328
322 * IPython/hooks.py (editor): quote the call to the editor command,
329 * IPython/hooks.py (editor): quote the call to the editor command,
323 to allow commands with spaces in them. Problem noted by watching
330 to allow commands with spaces in them. Problem noted by watching
324 Ian Oswald's video about textpad under win32 at
331 Ian Oswald's video about textpad under win32 at
325 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
332 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
326
333
327 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
334 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
328 describing magics (we haven't used @ for a loong time).
335 describing magics (we haven't used @ for a loong time).
329
336
330 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
337 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
331 contributed by marienz to close
338 contributed by marienz to close
332 http://www.scipy.net/roundup/ipython/issue53.
339 http://www.scipy.net/roundup/ipython/issue53.
333
340
334 2006-02-10 Ville Vainio <vivainio@gmail.com>
341 2006-02-10 Ville Vainio <vivainio@gmail.com>
335
342
336 * genutils.py: getoutput now works in win32 too
343 * genutils.py: getoutput now works in win32 too
337
344
338 * completer.py: alias and magic completion only invoked
345 * completer.py: alias and magic completion only invoked
339 at the first "item" in the line, to avoid "cd %store"
346 at the first "item" in the line, to avoid "cd %store"
340 nonsense.
347 nonsense.
341
348
342 2006-02-09 Ville Vainio <vivainio@gmail.com>
349 2006-02-09 Ville Vainio <vivainio@gmail.com>
343
350
344 * test/*: Added a unit testing framework (finally).
351 * test/*: Added a unit testing framework (finally).
345 '%run runtests.py' to run test_*.
352 '%run runtests.py' to run test_*.
346
353
347 * ipapi.py: Exposed runlines and set_custom_exc
354 * ipapi.py: Exposed runlines and set_custom_exc
348
355
349 2006-02-07 Ville Vainio <vivainio@gmail.com>
356 2006-02-07 Ville Vainio <vivainio@gmail.com>
350
357
351 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
358 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
352 instead use "f(1 2)" as before.
359 instead use "f(1 2)" as before.
353
360
354 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
361 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
355
362
356 * IPython/demo.py (IPythonDemo): Add new classes to the demo
363 * IPython/demo.py (IPythonDemo): Add new classes to the demo
357 facilities, for demos processed by the IPython input filter
364 facilities, for demos processed by the IPython input filter
358 (IPythonDemo), and for running a script one-line-at-a-time as a
365 (IPythonDemo), and for running a script one-line-at-a-time as a
359 demo, both for pure Python (LineDemo) and for IPython-processed
366 demo, both for pure Python (LineDemo) and for IPython-processed
360 input (IPythonLineDemo). After a request by Dave Kohel, from the
367 input (IPythonLineDemo). After a request by Dave Kohel, from the
361 SAGE team.
368 SAGE team.
362 (Demo.edit): added and edit() method to the demo objects, to edit
369 (Demo.edit): added and edit() method to the demo objects, to edit
363 the in-memory copy of the last executed block.
370 the in-memory copy of the last executed block.
364
371
365 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
372 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
366 processing to %edit, %macro and %save. These commands can now be
373 processing to %edit, %macro and %save. These commands can now be
367 invoked on the unprocessed input as it was typed by the user
374 invoked on the unprocessed input as it was typed by the user
368 (without any prefilters applied). After requests by the SAGE team
375 (without any prefilters applied). After requests by the SAGE team
369 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
376 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
370
377
371 2006-02-01 Ville Vainio <vivainio@gmail.com>
378 2006-02-01 Ville Vainio <vivainio@gmail.com>
372
379
373 * setup.py, eggsetup.py: easy_install ipython==dev works
380 * setup.py, eggsetup.py: easy_install ipython==dev works
374 correctly now (on Linux)
381 correctly now (on Linux)
375
382
376 * ipy_user_conf,ipmaker: user config changes, removed spurious
383 * ipy_user_conf,ipmaker: user config changes, removed spurious
377 warnings
384 warnings
378
385
379 * iplib: if rc.banner is string, use it as is.
386 * iplib: if rc.banner is string, use it as is.
380
387
381 * Magic: %pycat accepts a string argument and pages it's contents.
388 * Magic: %pycat accepts a string argument and pages it's contents.
382
389
383
390
384 2006-01-30 Ville Vainio <vivainio@gmail.com>
391 2006-01-30 Ville Vainio <vivainio@gmail.com>
385
392
386 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
393 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
387 Now %store and bookmarks work through PickleShare, meaning that
394 Now %store and bookmarks work through PickleShare, meaning that
388 concurrent access is possible and all ipython sessions see the
395 concurrent access is possible and all ipython sessions see the
389 same database situation all the time, instead of snapshot of
396 same database situation all the time, instead of snapshot of
390 the situation when the session was started. Hence, %bookmark
397 the situation when the session was started. Hence, %bookmark
391 results are immediately accessible from othes sessions. The database
398 results are immediately accessible from othes sessions. The database
392 is also available for use by user extensions. See:
399 is also available for use by user extensions. See:
393 http://www.python.org/pypi/pickleshare
400 http://www.python.org/pypi/pickleshare
394
401
395 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
402 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
396
403
397 * aliases can now be %store'd
404 * aliases can now be %store'd
398
405
399 * path.py move to Extensions so that pickleshare does not need
406 * path.py move to Extensions so that pickleshare does not need
400 IPython-specific import. Extensions added to pythonpath right
407 IPython-specific import. Extensions added to pythonpath right
401 at __init__.
408 at __init__.
402
409
403 * iplib.py: ipalias deprecated/redundant; aliases are converted and
410 * iplib.py: ipalias deprecated/redundant; aliases are converted and
404 called with _ip.system and the pre-transformed command string.
411 called with _ip.system and the pre-transformed command string.
405
412
406 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
413 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
407
414
408 * IPython/iplib.py (interact): Fix that we were not catching
415 * IPython/iplib.py (interact): Fix that we were not catching
409 KeyboardInterrupt exceptions properly. I'm not quite sure why the
416 KeyboardInterrupt exceptions properly. I'm not quite sure why the
410 logic here had to change, but it's fixed now.
417 logic here had to change, but it's fixed now.
411
418
412 2006-01-29 Ville Vainio <vivainio@gmail.com>
419 2006-01-29 Ville Vainio <vivainio@gmail.com>
413
420
414 * iplib.py: Try to import pyreadline on Windows.
421 * iplib.py: Try to import pyreadline on Windows.
415
422
416 2006-01-27 Ville Vainio <vivainio@gmail.com>
423 2006-01-27 Ville Vainio <vivainio@gmail.com>
417
424
418 * iplib.py: Expose ipapi as _ip in builtin namespace.
425 * iplib.py: Expose ipapi as _ip in builtin namespace.
419 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
426 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
420 and ip_set_hook (-> _ip.set_hook) redundant. % and !
427 and ip_set_hook (-> _ip.set_hook) redundant. % and !
421 syntax now produce _ip.* variant of the commands.
428 syntax now produce _ip.* variant of the commands.
422
429
423 * "_ip.options().autoedit_syntax = 2" automatically throws
430 * "_ip.options().autoedit_syntax = 2" automatically throws
424 user to editor for syntax error correction without prompting.
431 user to editor for syntax error correction without prompting.
425
432
426 2006-01-27 Ville Vainio <vivainio@gmail.com>
433 2006-01-27 Ville Vainio <vivainio@gmail.com>
427
434
428 * ipmaker.py: Give "realistic" sys.argv for scripts (without
435 * ipmaker.py: Give "realistic" sys.argv for scripts (without
429 'ipython' at argv[0]) executed through command line.
436 'ipython' at argv[0]) executed through command line.
430 NOTE: this DEPRECATES calling ipython with multiple scripts
437 NOTE: this DEPRECATES calling ipython with multiple scripts
431 ("ipython a.py b.py c.py")
438 ("ipython a.py b.py c.py")
432
439
433 * iplib.py, hooks.py: Added configurable input prefilter,
440 * iplib.py, hooks.py: Added configurable input prefilter,
434 named 'input_prefilter'. See ext_rescapture.py for example
441 named 'input_prefilter'. See ext_rescapture.py for example
435 usage.
442 usage.
436
443
437 * ext_rescapture.py, Magic.py: Better system command output capture
444 * ext_rescapture.py, Magic.py: Better system command output capture
438 through 'var = !ls' (deprecates user-visible %sc). Same notation
445 through 'var = !ls' (deprecates user-visible %sc). Same notation
439 applies for magics, 'var = %alias' assigns alias list to var.
446 applies for magics, 'var = %alias' assigns alias list to var.
440
447
441 * ipapi.py: added meta() for accessing extension-usable data store.
448 * ipapi.py: added meta() for accessing extension-usable data store.
442
449
443 * iplib.py: added InteractiveShell.getapi(). New magics should be
450 * iplib.py: added InteractiveShell.getapi(). New magics should be
444 written doing self.getapi() instead of using the shell directly.
451 written doing self.getapi() instead of using the shell directly.
445
452
446 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
453 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
447 %store foo >> ~/myfoo.txt to store variables to files (in clean
454 %store foo >> ~/myfoo.txt to store variables to files (in clean
448 textual form, not a restorable pickle).
455 textual form, not a restorable pickle).
449
456
450 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
457 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
451
458
452 * usage.py, Magic.py: added %quickref
459 * usage.py, Magic.py: added %quickref
453
460
454 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
461 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
455
462
456 * GetoptErrors when invoking magics etc. with wrong args
463 * GetoptErrors when invoking magics etc. with wrong args
457 are now more helpful:
464 are now more helpful:
458 GetoptError: option -l not recognized (allowed: "qb" )
465 GetoptError: option -l not recognized (allowed: "qb" )
459
466
460 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
467 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
461
468
462 * IPython/demo.py (Demo.show): Flush stdout after each block, so
469 * IPython/demo.py (Demo.show): Flush stdout after each block, so
463 computationally intensive blocks don't appear to stall the demo.
470 computationally intensive blocks don't appear to stall the demo.
464
471
465 2006-01-24 Ville Vainio <vivainio@gmail.com>
472 2006-01-24 Ville Vainio <vivainio@gmail.com>
466
473
467 * iplib.py, hooks.py: 'result_display' hook can return a non-None
474 * iplib.py, hooks.py: 'result_display' hook can return a non-None
468 value to manipulate resulting history entry.
475 value to manipulate resulting history entry.
469
476
470 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
477 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
471 to instance methods of IPApi class, to make extending an embedded
478 to instance methods of IPApi class, to make extending an embedded
472 IPython feasible. See ext_rehashdir.py for example usage.
479 IPython feasible. See ext_rehashdir.py for example usage.
473
480
474 * Merged 1071-1076 from banches/0.7.1
481 * Merged 1071-1076 from banches/0.7.1
475
482
476
483
477 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
484 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
478
485
479 * tools/release (daystamp): Fix build tools to use the new
486 * tools/release (daystamp): Fix build tools to use the new
480 eggsetup.py script to build lightweight eggs.
487 eggsetup.py script to build lightweight eggs.
481
488
482 * Applied changesets 1062 and 1064 before 0.7.1 release.
489 * Applied changesets 1062 and 1064 before 0.7.1 release.
483
490
484 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
491 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
485 see the raw input history (without conversions like %ls ->
492 see the raw input history (without conversions like %ls ->
486 ipmagic("ls")). After a request from W. Stein, SAGE
493 ipmagic("ls")). After a request from W. Stein, SAGE
487 (http://modular.ucsd.edu/sage) developer. This information is
494 (http://modular.ucsd.edu/sage) developer. This information is
488 stored in the input_hist_raw attribute of the IPython instance, so
495 stored in the input_hist_raw attribute of the IPython instance, so
489 developers can access it if needed (it's an InputList instance).
496 developers can access it if needed (it's an InputList instance).
490
497
491 * Versionstring = 0.7.2.svn
498 * Versionstring = 0.7.2.svn
492
499
493 * eggsetup.py: A separate script for constructing eggs, creates
500 * eggsetup.py: A separate script for constructing eggs, creates
494 proper launch scripts even on Windows (an .exe file in
501 proper launch scripts even on Windows (an .exe file in
495 \python24\scripts).
502 \python24\scripts).
496
503
497 * ipapi.py: launch_new_instance, launch entry point needed for the
504 * ipapi.py: launch_new_instance, launch entry point needed for the
498 egg.
505 egg.
499
506
500 2006-01-23 Ville Vainio <vivainio@gmail.com>
507 2006-01-23 Ville Vainio <vivainio@gmail.com>
501
508
502 * Added %cpaste magic for pasting python code
509 * Added %cpaste magic for pasting python code
503
510
504 2006-01-22 Ville Vainio <vivainio@gmail.com>
511 2006-01-22 Ville Vainio <vivainio@gmail.com>
505
512
506 * Merge from branches/0.7.1 into trunk, revs 1052-1057
513 * Merge from branches/0.7.1 into trunk, revs 1052-1057
507
514
508 * Versionstring = 0.7.2.svn
515 * Versionstring = 0.7.2.svn
509
516
510 * eggsetup.py: A separate script for constructing eggs, creates
517 * eggsetup.py: A separate script for constructing eggs, creates
511 proper launch scripts even on Windows (an .exe file in
518 proper launch scripts even on Windows (an .exe file in
512 \python24\scripts).
519 \python24\scripts).
513
520
514 * ipapi.py: launch_new_instance, launch entry point needed for the
521 * ipapi.py: launch_new_instance, launch entry point needed for the
515 egg.
522 egg.
516
523
517 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
524 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
518
525
519 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
526 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
520 %pfile foo would print the file for foo even if it was a binary.
527 %pfile foo would print the file for foo even if it was a binary.
521 Now, extensions '.so' and '.dll' are skipped.
528 Now, extensions '.so' and '.dll' are skipped.
522
529
523 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
530 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
524 bug, where macros would fail in all threaded modes. I'm not 100%
531 bug, where macros would fail in all threaded modes. I'm not 100%
525 sure, so I'm going to put out an rc instead of making a release
532 sure, so I'm going to put out an rc instead of making a release
526 today, and wait for feedback for at least a few days.
533 today, and wait for feedback for at least a few days.
527
534
528 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
535 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
529 it...) the handling of pasting external code with autoindent on.
536 it...) the handling of pasting external code with autoindent on.
530 To get out of a multiline input, the rule will appear for most
537 To get out of a multiline input, the rule will appear for most
531 users unchanged: two blank lines or change the indent level
538 users unchanged: two blank lines or change the indent level
532 proposed by IPython. But there is a twist now: you can
539 proposed by IPython. But there is a twist now: you can
533 add/subtract only *one or two spaces*. If you add/subtract three
540 add/subtract only *one or two spaces*. If you add/subtract three
534 or more (unless you completely delete the line), IPython will
541 or more (unless you completely delete the line), IPython will
535 accept that line, and you'll need to enter a second one of pure
542 accept that line, and you'll need to enter a second one of pure
536 whitespace. I know it sounds complicated, but I can't find a
543 whitespace. I know it sounds complicated, but I can't find a
537 different solution that covers all the cases, with the right
544 different solution that covers all the cases, with the right
538 heuristics. Hopefully in actual use, nobody will really notice
545 heuristics. Hopefully in actual use, nobody will really notice
539 all these strange rules and things will 'just work'.
546 all these strange rules and things will 'just work'.
540
547
541 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
548 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
542
549
543 * IPython/iplib.py (interact): catch exceptions which can be
550 * IPython/iplib.py (interact): catch exceptions which can be
544 triggered asynchronously by signal handlers. Thanks to an
551 triggered asynchronously by signal handlers. Thanks to an
545 automatic crash report, submitted by Colin Kingsley
552 automatic crash report, submitted by Colin Kingsley
546 <tercel-AT-gentoo.org>.
553 <tercel-AT-gentoo.org>.
547
554
548 2006-01-20 Ville Vainio <vivainio@gmail.com>
555 2006-01-20 Ville Vainio <vivainio@gmail.com>
549
556
550 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
557 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
551 (%rehashdir, very useful, try it out) of how to extend ipython
558 (%rehashdir, very useful, try it out) of how to extend ipython
552 with new magics. Also added Extensions dir to pythonpath to make
559 with new magics. Also added Extensions dir to pythonpath to make
553 importing extensions easy.
560 importing extensions easy.
554
561
555 * %store now complains when trying to store interactively declared
562 * %store now complains when trying to store interactively declared
556 classes / instances of those classes.
563 classes / instances of those classes.
557
564
558 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
565 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
559 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
566 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
560 if they exist, and ipy_user_conf.py with some defaults is created for
567 if they exist, and ipy_user_conf.py with some defaults is created for
561 the user.
568 the user.
562
569
563 * Startup rehashing done by the config file, not InterpreterExec.
570 * Startup rehashing done by the config file, not InterpreterExec.
564 This means system commands are available even without selecting the
571 This means system commands are available even without selecting the
565 pysh profile. It's the sensible default after all.
572 pysh profile. It's the sensible default after all.
566
573
567 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
574 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
568
575
569 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
576 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
570 multiline code with autoindent on working. But I am really not
577 multiline code with autoindent on working. But I am really not
571 sure, so this needs more testing. Will commit a debug-enabled
578 sure, so this needs more testing. Will commit a debug-enabled
572 version for now, while I test it some more, so that Ville and
579 version for now, while I test it some more, so that Ville and
573 others may also catch any problems. Also made
580 others may also catch any problems. Also made
574 self.indent_current_str() a method, to ensure that there's no
581 self.indent_current_str() a method, to ensure that there's no
575 chance of the indent space count and the corresponding string
582 chance of the indent space count and the corresponding string
576 falling out of sync. All code needing the string should just call
583 falling out of sync. All code needing the string should just call
577 the method.
584 the method.
578
585
579 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
586 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
580
587
581 * IPython/Magic.py (magic_edit): fix check for when users don't
588 * IPython/Magic.py (magic_edit): fix check for when users don't
582 save their output files, the try/except was in the wrong section.
589 save their output files, the try/except was in the wrong section.
583
590
584 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
591 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
585
592
586 * IPython/Magic.py (magic_run): fix __file__ global missing from
593 * IPython/Magic.py (magic_run): fix __file__ global missing from
587 script's namespace when executed via %run. After a report by
594 script's namespace when executed via %run. After a report by
588 Vivian.
595 Vivian.
589
596
590 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
597 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
591 when using python 2.4. The parent constructor changed in 2.4, and
598 when using python 2.4. The parent constructor changed in 2.4, and
592 we need to track it directly (we can't call it, as it messes up
599 we need to track it directly (we can't call it, as it messes up
593 readline and tab-completion inside our pdb would stop working).
600 readline and tab-completion inside our pdb would stop working).
594 After a bug report by R. Bernstein <rocky-AT-panix.com>.
601 After a bug report by R. Bernstein <rocky-AT-panix.com>.
595
602
596 2006-01-16 Ville Vainio <vivainio@gmail.com>
603 2006-01-16 Ville Vainio <vivainio@gmail.com>
597
604
598 * Ipython/magic.py:Reverted back to old %edit functionality
605 * Ipython/magic.py:Reverted back to old %edit functionality
599 that returns file contents on exit.
606 that returns file contents on exit.
600
607
601 * IPython/path.py: Added Jason Orendorff's "path" module to
608 * IPython/path.py: Added Jason Orendorff's "path" module to
602 IPython tree, http://www.jorendorff.com/articles/python/path/.
609 IPython tree, http://www.jorendorff.com/articles/python/path/.
603 You can get path objects conveniently through %sc, and !!, e.g.:
610 You can get path objects conveniently through %sc, and !!, e.g.:
604 sc files=ls
611 sc files=ls
605 for p in files.paths: # or files.p
612 for p in files.paths: # or files.p
606 print p,p.mtime
613 print p,p.mtime
607
614
608 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
615 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
609 now work again without considering the exclusion regexp -
616 now work again without considering the exclusion regexp -
610 hence, things like ',foo my/path' turn to 'foo("my/path")'
617 hence, things like ',foo my/path' turn to 'foo("my/path")'
611 instead of syntax error.
618 instead of syntax error.
612
619
613
620
614 2006-01-14 Ville Vainio <vivainio@gmail.com>
621 2006-01-14 Ville Vainio <vivainio@gmail.com>
615
622
616 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
623 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
617 ipapi decorators for python 2.4 users, options() provides access to rc
624 ipapi decorators for python 2.4 users, options() provides access to rc
618 data.
625 data.
619
626
620 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
627 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
621 as path separators (even on Linux ;-). Space character after
628 as path separators (even on Linux ;-). Space character after
622 backslash (as yielded by tab completer) is still space;
629 backslash (as yielded by tab completer) is still space;
623 "%cd long\ name" works as expected.
630 "%cd long\ name" works as expected.
624
631
625 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
632 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
626 as "chain of command", with priority. API stays the same,
633 as "chain of command", with priority. API stays the same,
627 TryNext exception raised by a hook function signals that
634 TryNext exception raised by a hook function signals that
628 current hook failed and next hook should try handling it, as
635 current hook failed and next hook should try handling it, as
629 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
636 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
630 requested configurable display hook, which is now implemented.
637 requested configurable display hook, which is now implemented.
631
638
632 2006-01-13 Ville Vainio <vivainio@gmail.com>
639 2006-01-13 Ville Vainio <vivainio@gmail.com>
633
640
634 * IPython/platutils*.py: platform specific utility functions,
641 * IPython/platutils*.py: platform specific utility functions,
635 so far only set_term_title is implemented (change terminal
642 so far only set_term_title is implemented (change terminal
636 label in windowing systems). %cd now changes the title to
643 label in windowing systems). %cd now changes the title to
637 current dir.
644 current dir.
638
645
639 * IPython/Release.py: Added myself to "authors" list,
646 * IPython/Release.py: Added myself to "authors" list,
640 had to create new files.
647 had to create new files.
641
648
642 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
649 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
643 shell escape; not a known bug but had potential to be one in the
650 shell escape; not a known bug but had potential to be one in the
644 future.
651 future.
645
652
646 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
653 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
647 extension API for IPython! See the module for usage example. Fix
654 extension API for IPython! See the module for usage example. Fix
648 OInspect for docstring-less magic functions.
655 OInspect for docstring-less magic functions.
649
656
650
657
651 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
658 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
652
659
653 * IPython/iplib.py (raw_input): temporarily deactivate all
660 * IPython/iplib.py (raw_input): temporarily deactivate all
654 attempts at allowing pasting of code with autoindent on. It
661 attempts at allowing pasting of code with autoindent on. It
655 introduced bugs (reported by Prabhu) and I can't seem to find a
662 introduced bugs (reported by Prabhu) and I can't seem to find a
656 robust combination which works in all cases. Will have to revisit
663 robust combination which works in all cases. Will have to revisit
657 later.
664 later.
658
665
659 * IPython/genutils.py: remove isspace() function. We've dropped
666 * IPython/genutils.py: remove isspace() function. We've dropped
660 2.2 compatibility, so it's OK to use the string method.
667 2.2 compatibility, so it's OK to use the string method.
661
668
662 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
669 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
663
670
664 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
671 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
665 matching what NOT to autocall on, to include all python binary
672 matching what NOT to autocall on, to include all python binary
666 operators (including things like 'and', 'or', 'is' and 'in').
673 operators (including things like 'and', 'or', 'is' and 'in').
667 Prompted by a bug report on 'foo & bar', but I realized we had
674 Prompted by a bug report on 'foo & bar', but I realized we had
668 many more potential bug cases with other operators. The regexp is
675 many more potential bug cases with other operators. The regexp is
669 self.re_exclude_auto, it's fairly commented.
676 self.re_exclude_auto, it's fairly commented.
670
677
671 2006-01-12 Ville Vainio <vivainio@gmail.com>
678 2006-01-12 Ville Vainio <vivainio@gmail.com>
672
679
673 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
680 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
674 Prettified and hardened string/backslash quoting with ipsystem(),
681 Prettified and hardened string/backslash quoting with ipsystem(),
675 ipalias() and ipmagic(). Now even \ characters are passed to
682 ipalias() and ipmagic(). Now even \ characters are passed to
676 %magics, !shell escapes and aliases exactly as they are in the
683 %magics, !shell escapes and aliases exactly as they are in the
677 ipython command line. Should improve backslash experience,
684 ipython command line. Should improve backslash experience,
678 particularly in Windows (path delimiter for some commands that
685 particularly in Windows (path delimiter for some commands that
679 won't understand '/'), but Unix benefits as well (regexps). %cd
686 won't understand '/'), but Unix benefits as well (regexps). %cd
680 magic still doesn't support backslash path delimiters, though. Also
687 magic still doesn't support backslash path delimiters, though. Also
681 deleted all pretense of supporting multiline command strings in
688 deleted all pretense of supporting multiline command strings in
682 !system or %magic commands. Thanks to Jerry McRae for suggestions.
689 !system or %magic commands. Thanks to Jerry McRae for suggestions.
683
690
684 * doc/build_doc_instructions.txt added. Documentation on how to
691 * doc/build_doc_instructions.txt added. Documentation on how to
685 use doc/update_manual.py, added yesterday. Both files contributed
692 use doc/update_manual.py, added yesterday. Both files contributed
686 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
693 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
687 doc/*.sh for deprecation at a later date.
694 doc/*.sh for deprecation at a later date.
688
695
689 * /ipython.py Added ipython.py to root directory for
696 * /ipython.py Added ipython.py to root directory for
690 zero-installation (tar xzvf ipython.tgz; cd ipython; python
697 zero-installation (tar xzvf ipython.tgz; cd ipython; python
691 ipython.py) and development convenience (no need to kee doing
698 ipython.py) and development convenience (no need to kee doing
692 "setup.py install" between changes).
699 "setup.py install" between changes).
693
700
694 * Made ! and !! shell escapes work (again) in multiline expressions:
701 * Made ! and !! shell escapes work (again) in multiline expressions:
695 if 1:
702 if 1:
696 !ls
703 !ls
697 !!ls
704 !!ls
698
705
699 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
706 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
700
707
701 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
708 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
702 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
709 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
703 module in case-insensitive installation. Was causing crashes
710 module in case-insensitive installation. Was causing crashes
704 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
711 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
705
712
706 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
713 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
707 <marienz-AT-gentoo.org>, closes
714 <marienz-AT-gentoo.org>, closes
708 http://www.scipy.net/roundup/ipython/issue51.
715 http://www.scipy.net/roundup/ipython/issue51.
709
716
710 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
717 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
711
718
712 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
719 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
713 problem of excessive CPU usage under *nix and keyboard lag under
720 problem of excessive CPU usage under *nix and keyboard lag under
714 win32.
721 win32.
715
722
716 2006-01-10 *** Released version 0.7.0
723 2006-01-10 *** Released version 0.7.0
717
724
718 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
725 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
719
726
720 * IPython/Release.py (revision): tag version number to 0.7.0,
727 * IPython/Release.py (revision): tag version number to 0.7.0,
721 ready for release.
728 ready for release.
722
729
723 * IPython/Magic.py (magic_edit): Add print statement to %edit so
730 * IPython/Magic.py (magic_edit): Add print statement to %edit so
724 it informs the user of the name of the temp. file used. This can
731 it informs the user of the name of the temp. file used. This can
725 help if you decide later to reuse that same file, so you know
732 help if you decide later to reuse that same file, so you know
726 where to copy the info from.
733 where to copy the info from.
727
734
728 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
735 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
729
736
730 * setup_bdist_egg.py: little script to build an egg. Added
737 * setup_bdist_egg.py: little script to build an egg. Added
731 support in the release tools as well.
738 support in the release tools as well.
732
739
733 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
740 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
734
741
735 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
742 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
736 version selection (new -wxversion command line and ipythonrc
743 version selection (new -wxversion command line and ipythonrc
737 parameter). Patch contributed by Arnd Baecker
744 parameter). Patch contributed by Arnd Baecker
738 <arnd.baecker-AT-web.de>.
745 <arnd.baecker-AT-web.de>.
739
746
740 * IPython/iplib.py (embed_mainloop): fix tab-completion in
747 * IPython/iplib.py (embed_mainloop): fix tab-completion in
741 embedded instances, for variables defined at the interactive
748 embedded instances, for variables defined at the interactive
742 prompt of the embedded ipython. Reported by Arnd.
749 prompt of the embedded ipython. Reported by Arnd.
743
750
744 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
751 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
745 it can be used as a (stateful) toggle, or with a direct parameter.
752 it can be used as a (stateful) toggle, or with a direct parameter.
746
753
747 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
754 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
748 could be triggered in certain cases and cause the traceback
755 could be triggered in certain cases and cause the traceback
749 printer not to work.
756 printer not to work.
750
757
751 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
758 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
752
759
753 * IPython/iplib.py (_should_recompile): Small fix, closes
760 * IPython/iplib.py (_should_recompile): Small fix, closes
754 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
761 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
755
762
756 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
763 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
757
764
758 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
765 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
759 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
766 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
760 Moad for help with tracking it down.
767 Moad for help with tracking it down.
761
768
762 * IPython/iplib.py (handle_auto): fix autocall handling for
769 * IPython/iplib.py (handle_auto): fix autocall handling for
763 objects which support BOTH __getitem__ and __call__ (so that f [x]
770 objects which support BOTH __getitem__ and __call__ (so that f [x]
764 is left alone, instead of becoming f([x]) automatically).
771 is left alone, instead of becoming f([x]) automatically).
765
772
766 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
773 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
767 Ville's patch.
774 Ville's patch.
768
775
769 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
776 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
770
777
771 * IPython/iplib.py (handle_auto): changed autocall semantics to
778 * IPython/iplib.py (handle_auto): changed autocall semantics to
772 include 'smart' mode, where the autocall transformation is NOT
779 include 'smart' mode, where the autocall transformation is NOT
773 applied if there are no arguments on the line. This allows you to
780 applied if there are no arguments on the line. This allows you to
774 just type 'foo' if foo is a callable to see its internal form,
781 just type 'foo' if foo is a callable to see its internal form,
775 instead of having it called with no arguments (typically a
782 instead of having it called with no arguments (typically a
776 mistake). The old 'full' autocall still exists: for that, you
783 mistake). The old 'full' autocall still exists: for that, you
777 need to set the 'autocall' parameter to 2 in your ipythonrc file.
784 need to set the 'autocall' parameter to 2 in your ipythonrc file.
778
785
779 * IPython/completer.py (Completer.attr_matches): add
786 * IPython/completer.py (Completer.attr_matches): add
780 tab-completion support for Enthoughts' traits. After a report by
787 tab-completion support for Enthoughts' traits. After a report by
781 Arnd and a patch by Prabhu.
788 Arnd and a patch by Prabhu.
782
789
783 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
790 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
784
791
785 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
792 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
786 Schmolck's patch to fix inspect.getinnerframes().
793 Schmolck's patch to fix inspect.getinnerframes().
787
794
788 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
795 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
789 for embedded instances, regarding handling of namespaces and items
796 for embedded instances, regarding handling of namespaces and items
790 added to the __builtin__ one. Multiple embedded instances and
797 added to the __builtin__ one. Multiple embedded instances and
791 recursive embeddings should work better now (though I'm not sure
798 recursive embeddings should work better now (though I'm not sure
792 I've got all the corner cases fixed, that code is a bit of a brain
799 I've got all the corner cases fixed, that code is a bit of a brain
793 twister).
800 twister).
794
801
795 * IPython/Magic.py (magic_edit): added support to edit in-memory
802 * IPython/Magic.py (magic_edit): added support to edit in-memory
796 macros (automatically creates the necessary temp files). %edit
803 macros (automatically creates the necessary temp files). %edit
797 also doesn't return the file contents anymore, it's just noise.
804 also doesn't return the file contents anymore, it's just noise.
798
805
799 * IPython/completer.py (Completer.attr_matches): revert change to
806 * IPython/completer.py (Completer.attr_matches): revert change to
800 complete only on attributes listed in __all__. I realized it
807 complete only on attributes listed in __all__. I realized it
801 cripples the tab-completion system as a tool for exploring the
808 cripples the tab-completion system as a tool for exploring the
802 internals of unknown libraries (it renders any non-__all__
809 internals of unknown libraries (it renders any non-__all__
803 attribute off-limits). I got bit by this when trying to see
810 attribute off-limits). I got bit by this when trying to see
804 something inside the dis module.
811 something inside the dis module.
805
812
806 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
813 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
807
814
808 * IPython/iplib.py (InteractiveShell.__init__): add .meta
815 * IPython/iplib.py (InteractiveShell.__init__): add .meta
809 namespace for users and extension writers to hold data in. This
816 namespace for users and extension writers to hold data in. This
810 follows the discussion in
817 follows the discussion in
811 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
818 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
812
819
813 * IPython/completer.py (IPCompleter.complete): small patch to help
820 * IPython/completer.py (IPCompleter.complete): small patch to help
814 tab-completion under Emacs, after a suggestion by John Barnard
821 tab-completion under Emacs, after a suggestion by John Barnard
815 <barnarj-AT-ccf.org>.
822 <barnarj-AT-ccf.org>.
816
823
817 * IPython/Magic.py (Magic.extract_input_slices): added support for
824 * IPython/Magic.py (Magic.extract_input_slices): added support for
818 the slice notation in magics to use N-M to represent numbers N...M
825 the slice notation in magics to use N-M to represent numbers N...M
819 (closed endpoints). This is used by %macro and %save.
826 (closed endpoints). This is used by %macro and %save.
820
827
821 * IPython/completer.py (Completer.attr_matches): for modules which
828 * IPython/completer.py (Completer.attr_matches): for modules which
822 define __all__, complete only on those. After a patch by Jeffrey
829 define __all__, complete only on those. After a patch by Jeffrey
823 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
830 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
824 speed up this routine.
831 speed up this routine.
825
832
826 * IPython/Logger.py (Logger.log): fix a history handling bug. I
833 * IPython/Logger.py (Logger.log): fix a history handling bug. I
827 don't know if this is the end of it, but the behavior now is
834 don't know if this is the end of it, but the behavior now is
828 certainly much more correct. Note that coupled with macros,
835 certainly much more correct. Note that coupled with macros,
829 slightly surprising (at first) behavior may occur: a macro will in
836 slightly surprising (at first) behavior may occur: a macro will in
830 general expand to multiple lines of input, so upon exiting, the
837 general expand to multiple lines of input, so upon exiting, the
831 in/out counters will both be bumped by the corresponding amount
838 in/out counters will both be bumped by the corresponding amount
832 (as if the macro's contents had been typed interactively). Typing
839 (as if the macro's contents had been typed interactively). Typing
833 %hist will reveal the intermediate (silently processed) lines.
840 %hist will reveal the intermediate (silently processed) lines.
834
841
835 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
842 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
836 pickle to fail (%run was overwriting __main__ and not restoring
843 pickle to fail (%run was overwriting __main__ and not restoring
837 it, but pickle relies on __main__ to operate).
844 it, but pickle relies on __main__ to operate).
838
845
839 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
846 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
840 using properties, but forgot to make the main InteractiveShell
847 using properties, but forgot to make the main InteractiveShell
841 class a new-style class. Properties fail silently, and
848 class a new-style class. Properties fail silently, and
842 misteriously, with old-style class (getters work, but
849 misteriously, with old-style class (getters work, but
843 setters don't do anything).
850 setters don't do anything).
844
851
845 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
852 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
846
853
847 * IPython/Magic.py (magic_history): fix history reporting bug (I
854 * IPython/Magic.py (magic_history): fix history reporting bug (I
848 know some nasties are still there, I just can't seem to find a
855 know some nasties are still there, I just can't seem to find a
849 reproducible test case to track them down; the input history is
856 reproducible test case to track them down; the input history is
850 falling out of sync...)
857 falling out of sync...)
851
858
852 * IPython/iplib.py (handle_shell_escape): fix bug where both
859 * IPython/iplib.py (handle_shell_escape): fix bug where both
853 aliases and system accesses where broken for indented code (such
860 aliases and system accesses where broken for indented code (such
854 as loops).
861 as loops).
855
862
856 * IPython/genutils.py (shell): fix small but critical bug for
863 * IPython/genutils.py (shell): fix small but critical bug for
857 win32 system access.
864 win32 system access.
858
865
859 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
866 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
860
867
861 * IPython/iplib.py (showtraceback): remove use of the
868 * IPython/iplib.py (showtraceback): remove use of the
862 sys.last_{type/value/traceback} structures, which are non
869 sys.last_{type/value/traceback} structures, which are non
863 thread-safe.
870 thread-safe.
864 (_prefilter): change control flow to ensure that we NEVER
871 (_prefilter): change control flow to ensure that we NEVER
865 introspect objects when autocall is off. This will guarantee that
872 introspect objects when autocall is off. This will guarantee that
866 having an input line of the form 'x.y', where access to attribute
873 having an input line of the form 'x.y', where access to attribute
867 'y' has side effects, doesn't trigger the side effect TWICE. It
874 'y' has side effects, doesn't trigger the side effect TWICE. It
868 is important to note that, with autocall on, these side effects
875 is important to note that, with autocall on, these side effects
869 can still happen.
876 can still happen.
870 (ipsystem): new builtin, to complete the ip{magic/alias/system}
877 (ipsystem): new builtin, to complete the ip{magic/alias/system}
871 trio. IPython offers these three kinds of special calls which are
878 trio. IPython offers these three kinds of special calls which are
872 not python code, and it's a good thing to have their call method
879 not python code, and it's a good thing to have their call method
873 be accessible as pure python functions (not just special syntax at
880 be accessible as pure python functions (not just special syntax at
874 the command line). It gives us a better internal implementation
881 the command line). It gives us a better internal implementation
875 structure, as well as exposing these for user scripting more
882 structure, as well as exposing these for user scripting more
876 cleanly.
883 cleanly.
877
884
878 * IPython/macro.py (Macro.__init__): moved macros to a standalone
885 * IPython/macro.py (Macro.__init__): moved macros to a standalone
879 file. Now that they'll be more likely to be used with the
886 file. Now that they'll be more likely to be used with the
880 persistance system (%store), I want to make sure their module path
887 persistance system (%store), I want to make sure their module path
881 doesn't change in the future, so that we don't break things for
888 doesn't change in the future, so that we don't break things for
882 users' persisted data.
889 users' persisted data.
883
890
884 * IPython/iplib.py (autoindent_update): move indentation
891 * IPython/iplib.py (autoindent_update): move indentation
885 management into the _text_ processing loop, not the keyboard
892 management into the _text_ processing loop, not the keyboard
886 interactive one. This is necessary to correctly process non-typed
893 interactive one. This is necessary to correctly process non-typed
887 multiline input (such as macros).
894 multiline input (such as macros).
888
895
889 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
896 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
890 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
897 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
891 which was producing problems in the resulting manual.
898 which was producing problems in the resulting manual.
892 (magic_whos): improve reporting of instances (show their class,
899 (magic_whos): improve reporting of instances (show their class,
893 instead of simply printing 'instance' which isn't terribly
900 instead of simply printing 'instance' which isn't terribly
894 informative).
901 informative).
895
902
896 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
903 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
897 (minor mods) to support network shares under win32.
904 (minor mods) to support network shares under win32.
898
905
899 * IPython/winconsole.py (get_console_size): add new winconsole
906 * IPython/winconsole.py (get_console_size): add new winconsole
900 module and fixes to page_dumb() to improve its behavior under
907 module and fixes to page_dumb() to improve its behavior under
901 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
908 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
902
909
903 * IPython/Magic.py (Macro): simplified Macro class to just
910 * IPython/Magic.py (Macro): simplified Macro class to just
904 subclass list. We've had only 2.2 compatibility for a very long
911 subclass list. We've had only 2.2 compatibility for a very long
905 time, yet I was still avoiding subclassing the builtin types. No
912 time, yet I was still avoiding subclassing the builtin types. No
906 more (I'm also starting to use properties, though I won't shift to
913 more (I'm also starting to use properties, though I won't shift to
907 2.3-specific features quite yet).
914 2.3-specific features quite yet).
908 (magic_store): added Ville's patch for lightweight variable
915 (magic_store): added Ville's patch for lightweight variable
909 persistence, after a request on the user list by Matt Wilkie
916 persistence, after a request on the user list by Matt Wilkie
910 <maphew-AT-gmail.com>. The new %store magic's docstring has full
917 <maphew-AT-gmail.com>. The new %store magic's docstring has full
911 details.
918 details.
912
919
913 * IPython/iplib.py (InteractiveShell.post_config_initialization):
920 * IPython/iplib.py (InteractiveShell.post_config_initialization):
914 changed the default logfile name from 'ipython.log' to
921 changed the default logfile name from 'ipython.log' to
915 'ipython_log.py'. These logs are real python files, and now that
922 'ipython_log.py'. These logs are real python files, and now that
916 we have much better multiline support, people are more likely to
923 we have much better multiline support, people are more likely to
917 want to use them as such. Might as well name them correctly.
924 want to use them as such. Might as well name them correctly.
918
925
919 * IPython/Magic.py: substantial cleanup. While we can't stop
926 * IPython/Magic.py: substantial cleanup. While we can't stop
920 using magics as mixins, due to the existing customizations 'out
927 using magics as mixins, due to the existing customizations 'out
921 there' which rely on the mixin naming conventions, at least I
928 there' which rely on the mixin naming conventions, at least I
922 cleaned out all cross-class name usage. So once we are OK with
929 cleaned out all cross-class name usage. So once we are OK with
923 breaking compatibility, the two systems can be separated.
930 breaking compatibility, the two systems can be separated.
924
931
925 * IPython/Logger.py: major cleanup. This one is NOT a mixin
932 * IPython/Logger.py: major cleanup. This one is NOT a mixin
926 anymore, and the class is a fair bit less hideous as well. New
933 anymore, and the class is a fair bit less hideous as well. New
927 features were also introduced: timestamping of input, and logging
934 features were also introduced: timestamping of input, and logging
928 of output results. These are user-visible with the -t and -o
935 of output results. These are user-visible with the -t and -o
929 options to %logstart. Closes
936 options to %logstart. Closes
930 http://www.scipy.net/roundup/ipython/issue11 and a request by
937 http://www.scipy.net/roundup/ipython/issue11 and a request by
931 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
938 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
932
939
933 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
940 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
934
941
935 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
942 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
936 better hadnle backslashes in paths. See the thread 'More Windows
943 better hadnle backslashes in paths. See the thread 'More Windows
937 questions part 2 - \/ characters revisited' on the iypthon user
944 questions part 2 - \/ characters revisited' on the iypthon user
938 list:
945 list:
939 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
946 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
940
947
941 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
948 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
942
949
943 (InteractiveShell.__init__): change threaded shells to not use the
950 (InteractiveShell.__init__): change threaded shells to not use the
944 ipython crash handler. This was causing more problems than not,
951 ipython crash handler. This was causing more problems than not,
945 as exceptions in the main thread (GUI code, typically) would
952 as exceptions in the main thread (GUI code, typically) would
946 always show up as a 'crash', when they really weren't.
953 always show up as a 'crash', when they really weren't.
947
954
948 The colors and exception mode commands (%colors/%xmode) have been
955 The colors and exception mode commands (%colors/%xmode) have been
949 synchronized to also take this into account, so users can get
956 synchronized to also take this into account, so users can get
950 verbose exceptions for their threaded code as well. I also added
957 verbose exceptions for their threaded code as well. I also added
951 support for activating pdb inside this exception handler as well,
958 support for activating pdb inside this exception handler as well,
952 so now GUI authors can use IPython's enhanced pdb at runtime.
959 so now GUI authors can use IPython's enhanced pdb at runtime.
953
960
954 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
961 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
955 true by default, and add it to the shipped ipythonrc file. Since
962 true by default, and add it to the shipped ipythonrc file. Since
956 this asks the user before proceeding, I think it's OK to make it
963 this asks the user before proceeding, I think it's OK to make it
957 true by default.
964 true by default.
958
965
959 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
966 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
960 of the previous special-casing of input in the eval loop. I think
967 of the previous special-casing of input in the eval loop. I think
961 this is cleaner, as they really are commands and shouldn't have
968 this is cleaner, as they really are commands and shouldn't have
962 a special role in the middle of the core code.
969 a special role in the middle of the core code.
963
970
964 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
971 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
965
972
966 * IPython/iplib.py (edit_syntax_error): added support for
973 * IPython/iplib.py (edit_syntax_error): added support for
967 automatically reopening the editor if the file had a syntax error
974 automatically reopening the editor if the file had a syntax error
968 in it. Thanks to scottt who provided the patch at:
975 in it. Thanks to scottt who provided the patch at:
969 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
976 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
970 version committed).
977 version committed).
971
978
972 * IPython/iplib.py (handle_normal): add suport for multi-line
979 * IPython/iplib.py (handle_normal): add suport for multi-line
973 input with emtpy lines. This fixes
980 input with emtpy lines. This fixes
974 http://www.scipy.net/roundup/ipython/issue43 and a similar
981 http://www.scipy.net/roundup/ipython/issue43 and a similar
975 discussion on the user list.
982 discussion on the user list.
976
983
977 WARNING: a behavior change is necessarily introduced to support
984 WARNING: a behavior change is necessarily introduced to support
978 blank lines: now a single blank line with whitespace does NOT
985 blank lines: now a single blank line with whitespace does NOT
979 break the input loop, which means that when autoindent is on, by
986 break the input loop, which means that when autoindent is on, by
980 default hitting return on the next (indented) line does NOT exit.
987 default hitting return on the next (indented) line does NOT exit.
981
988
982 Instead, to exit a multiline input you can either have:
989 Instead, to exit a multiline input you can either have:
983
990
984 - TWO whitespace lines (just hit return again), or
991 - TWO whitespace lines (just hit return again), or
985 - a single whitespace line of a different length than provided
992 - a single whitespace line of a different length than provided
986 by the autoindent (add or remove a space).
993 by the autoindent (add or remove a space).
987
994
988 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
995 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
989 module to better organize all readline-related functionality.
996 module to better organize all readline-related functionality.
990 I've deleted FlexCompleter and put all completion clases here.
997 I've deleted FlexCompleter and put all completion clases here.
991
998
992 * IPython/iplib.py (raw_input): improve indentation management.
999 * IPython/iplib.py (raw_input): improve indentation management.
993 It is now possible to paste indented code with autoindent on, and
1000 It is now possible to paste indented code with autoindent on, and
994 the code is interpreted correctly (though it still looks bad on
1001 the code is interpreted correctly (though it still looks bad on
995 screen, due to the line-oriented nature of ipython).
1002 screen, due to the line-oriented nature of ipython).
996 (MagicCompleter.complete): change behavior so that a TAB key on an
1003 (MagicCompleter.complete): change behavior so that a TAB key on an
997 otherwise empty line actually inserts a tab, instead of completing
1004 otherwise empty line actually inserts a tab, instead of completing
998 on the entire global namespace. This makes it easier to use the
1005 on the entire global namespace. This makes it easier to use the
999 TAB key for indentation. After a request by Hans Meine
1006 TAB key for indentation. After a request by Hans Meine
1000 <hans_meine-AT-gmx.net>
1007 <hans_meine-AT-gmx.net>
1001 (_prefilter): add support so that typing plain 'exit' or 'quit'
1008 (_prefilter): add support so that typing plain 'exit' or 'quit'
1002 does a sensible thing. Originally I tried to deviate as little as
1009 does a sensible thing. Originally I tried to deviate as little as
1003 possible from the default python behavior, but even that one may
1010 possible from the default python behavior, but even that one may
1004 change in this direction (thread on python-dev to that effect).
1011 change in this direction (thread on python-dev to that effect).
1005 Regardless, ipython should do the right thing even if CPython's
1012 Regardless, ipython should do the right thing even if CPython's
1006 '>>>' prompt doesn't.
1013 '>>>' prompt doesn't.
1007 (InteractiveShell): removed subclassing code.InteractiveConsole
1014 (InteractiveShell): removed subclassing code.InteractiveConsole
1008 class. By now we'd overridden just about all of its methods: I've
1015 class. By now we'd overridden just about all of its methods: I've
1009 copied the remaining two over, and now ipython is a standalone
1016 copied the remaining two over, and now ipython is a standalone
1010 class. This will provide a clearer picture for the chainsaw
1017 class. This will provide a clearer picture for the chainsaw
1011 branch refactoring.
1018 branch refactoring.
1012
1019
1013 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1020 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1014
1021
1015 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1022 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1016 failures for objects which break when dir() is called on them.
1023 failures for objects which break when dir() is called on them.
1017
1024
1018 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1025 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1019 distinct local and global namespaces in the completer API. This
1026 distinct local and global namespaces in the completer API. This
1020 change allows us top properly handle completion with distinct
1027 change allows us top properly handle completion with distinct
1021 scopes, including in embedded instances (this had never really
1028 scopes, including in embedded instances (this had never really
1022 worked correctly).
1029 worked correctly).
1023
1030
1024 Note: this introduces a change in the constructor for
1031 Note: this introduces a change in the constructor for
1025 MagicCompleter, as a new global_namespace parameter is now the
1032 MagicCompleter, as a new global_namespace parameter is now the
1026 second argument (the others were bumped one position).
1033 second argument (the others were bumped one position).
1027
1034
1028 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1035 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1029
1036
1030 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1037 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1031 embedded instances (which can be done now thanks to Vivian's
1038 embedded instances (which can be done now thanks to Vivian's
1032 frame-handling fixes for pdb).
1039 frame-handling fixes for pdb).
1033 (InteractiveShell.__init__): Fix namespace handling problem in
1040 (InteractiveShell.__init__): Fix namespace handling problem in
1034 embedded instances. We were overwriting __main__ unconditionally,
1041 embedded instances. We were overwriting __main__ unconditionally,
1035 and this should only be done for 'full' (non-embedded) IPython;
1042 and this should only be done for 'full' (non-embedded) IPython;
1036 embedded instances must respect the caller's __main__. Thanks to
1043 embedded instances must respect the caller's __main__. Thanks to
1037 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1044 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1038
1045
1039 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1046 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1040
1047
1041 * setup.py: added download_url to setup(). This registers the
1048 * setup.py: added download_url to setup(). This registers the
1042 download address at PyPI, which is not only useful to humans
1049 download address at PyPI, which is not only useful to humans
1043 browsing the site, but is also picked up by setuptools (the Eggs
1050 browsing the site, but is also picked up by setuptools (the Eggs
1044 machinery). Thanks to Ville and R. Kern for the info/discussion
1051 machinery). Thanks to Ville and R. Kern for the info/discussion
1045 on this.
1052 on this.
1046
1053
1047 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1054 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1048
1055
1049 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1056 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1050 This brings a lot of nice functionality to the pdb mode, which now
1057 This brings a lot of nice functionality to the pdb mode, which now
1051 has tab-completion, syntax highlighting, and better stack handling
1058 has tab-completion, syntax highlighting, and better stack handling
1052 than before. Many thanks to Vivian De Smedt
1059 than before. Many thanks to Vivian De Smedt
1053 <vivian-AT-vdesmedt.com> for the original patches.
1060 <vivian-AT-vdesmedt.com> for the original patches.
1054
1061
1055 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1062 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1056
1063
1057 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1064 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1058 sequence to consistently accept the banner argument. The
1065 sequence to consistently accept the banner argument. The
1059 inconsistency was tripping SAGE, thanks to Gary Zablackis
1066 inconsistency was tripping SAGE, thanks to Gary Zablackis
1060 <gzabl-AT-yahoo.com> for the report.
1067 <gzabl-AT-yahoo.com> for the report.
1061
1068
1062 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1069 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1063
1070
1064 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1071 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1065 Fix bug where a naked 'alias' call in the ipythonrc file would
1072 Fix bug where a naked 'alias' call in the ipythonrc file would
1066 cause a crash. Bug reported by Jorgen Stenarson.
1073 cause a crash. Bug reported by Jorgen Stenarson.
1067
1074
1068 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1075 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1069
1076
1070 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1077 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1071 startup time.
1078 startup time.
1072
1079
1073 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1080 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1074 instances had introduced a bug with globals in normal code. Now
1081 instances had introduced a bug with globals in normal code. Now
1075 it's working in all cases.
1082 it's working in all cases.
1076
1083
1077 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1084 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1078 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1085 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1079 has been introduced to set the default case sensitivity of the
1086 has been introduced to set the default case sensitivity of the
1080 searches. Users can still select either mode at runtime on a
1087 searches. Users can still select either mode at runtime on a
1081 per-search basis.
1088 per-search basis.
1082
1089
1083 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1090 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1084
1091
1085 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1092 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1086 attributes in wildcard searches for subclasses. Modified version
1093 attributes in wildcard searches for subclasses. Modified version
1087 of a patch by Jorgen.
1094 of a patch by Jorgen.
1088
1095
1089 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1096 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1090
1097
1091 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1098 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1092 embedded instances. I added a user_global_ns attribute to the
1099 embedded instances. I added a user_global_ns attribute to the
1093 InteractiveShell class to handle this.
1100 InteractiveShell class to handle this.
1094
1101
1095 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1102 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1096
1103
1097 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1104 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1098 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1105 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1099 (reported under win32, but may happen also in other platforms).
1106 (reported under win32, but may happen also in other platforms).
1100 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1107 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1101
1108
1102 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1109 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1103
1110
1104 * IPython/Magic.py (magic_psearch): new support for wildcard
1111 * IPython/Magic.py (magic_psearch): new support for wildcard
1105 patterns. Now, typing ?a*b will list all names which begin with a
1112 patterns. Now, typing ?a*b will list all names which begin with a
1106 and end in b, for example. The %psearch magic has full
1113 and end in b, for example. The %psearch magic has full
1107 docstrings. Many thanks to JΓΆrgen Stenarson
1114 docstrings. Many thanks to JΓΆrgen Stenarson
1108 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1115 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1109 implementing this functionality.
1116 implementing this functionality.
1110
1117
1111 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1118 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1112
1119
1113 * Manual: fixed long-standing annoyance of double-dashes (as in
1120 * Manual: fixed long-standing annoyance of double-dashes (as in
1114 --prefix=~, for example) being stripped in the HTML version. This
1121 --prefix=~, for example) being stripped in the HTML version. This
1115 is a latex2html bug, but a workaround was provided. Many thanks
1122 is a latex2html bug, but a workaround was provided. Many thanks
1116 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1123 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1117 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1124 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1118 rolling. This seemingly small issue had tripped a number of users
1125 rolling. This seemingly small issue had tripped a number of users
1119 when first installing, so I'm glad to see it gone.
1126 when first installing, so I'm glad to see it gone.
1120
1127
1121 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1128 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1122
1129
1123 * IPython/Extensions/numeric_formats.py: fix missing import,
1130 * IPython/Extensions/numeric_formats.py: fix missing import,
1124 reported by Stephen Walton.
1131 reported by Stephen Walton.
1125
1132
1126 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1133 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1127
1134
1128 * IPython/demo.py: finish demo module, fully documented now.
1135 * IPython/demo.py: finish demo module, fully documented now.
1129
1136
1130 * IPython/genutils.py (file_read): simple little utility to read a
1137 * IPython/genutils.py (file_read): simple little utility to read a
1131 file and ensure it's closed afterwards.
1138 file and ensure it's closed afterwards.
1132
1139
1133 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1140 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1134
1141
1135 * IPython/demo.py (Demo.__init__): added support for individually
1142 * IPython/demo.py (Demo.__init__): added support for individually
1136 tagging blocks for automatic execution.
1143 tagging blocks for automatic execution.
1137
1144
1138 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1145 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1139 syntax-highlighted python sources, requested by John.
1146 syntax-highlighted python sources, requested by John.
1140
1147
1141 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1148 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1142
1149
1143 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1150 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1144 finishing.
1151 finishing.
1145
1152
1146 * IPython/genutils.py (shlex_split): moved from Magic to here,
1153 * IPython/genutils.py (shlex_split): moved from Magic to here,
1147 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1154 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1148
1155
1149 * IPython/demo.py (Demo.__init__): added support for silent
1156 * IPython/demo.py (Demo.__init__): added support for silent
1150 blocks, improved marks as regexps, docstrings written.
1157 blocks, improved marks as regexps, docstrings written.
1151 (Demo.__init__): better docstring, added support for sys.argv.
1158 (Demo.__init__): better docstring, added support for sys.argv.
1152
1159
1153 * IPython/genutils.py (marquee): little utility used by the demo
1160 * IPython/genutils.py (marquee): little utility used by the demo
1154 code, handy in general.
1161 code, handy in general.
1155
1162
1156 * IPython/demo.py (Demo.__init__): new class for interactive
1163 * IPython/demo.py (Demo.__init__): new class for interactive
1157 demos. Not documented yet, I just wrote it in a hurry for
1164 demos. Not documented yet, I just wrote it in a hurry for
1158 scipy'05. Will docstring later.
1165 scipy'05. Will docstring later.
1159
1166
1160 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1167 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1161
1168
1162 * IPython/Shell.py (sigint_handler): Drastic simplification which
1169 * IPython/Shell.py (sigint_handler): Drastic simplification which
1163 also seems to make Ctrl-C work correctly across threads! This is
1170 also seems to make Ctrl-C work correctly across threads! This is
1164 so simple, that I can't beleive I'd missed it before. Needs more
1171 so simple, that I can't beleive I'd missed it before. Needs more
1165 testing, though.
1172 testing, though.
1166 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1173 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1167 like this before...
1174 like this before...
1168
1175
1169 * IPython/genutils.py (get_home_dir): add protection against
1176 * IPython/genutils.py (get_home_dir): add protection against
1170 non-dirs in win32 registry.
1177 non-dirs in win32 registry.
1171
1178
1172 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1179 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1173 bug where dict was mutated while iterating (pysh crash).
1180 bug where dict was mutated while iterating (pysh crash).
1174
1181
1175 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1182 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1176
1183
1177 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1184 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1178 spurious newlines added by this routine. After a report by
1185 spurious newlines added by this routine. After a report by
1179 F. Mantegazza.
1186 F. Mantegazza.
1180
1187
1181 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1188 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1182
1189
1183 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1190 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1184 calls. These were a leftover from the GTK 1.x days, and can cause
1191 calls. These were a leftover from the GTK 1.x days, and can cause
1185 problems in certain cases (after a report by John Hunter).
1192 problems in certain cases (after a report by John Hunter).
1186
1193
1187 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1194 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1188 os.getcwd() fails at init time. Thanks to patch from David Remahl
1195 os.getcwd() fails at init time. Thanks to patch from David Remahl
1189 <chmod007-AT-mac.com>.
1196 <chmod007-AT-mac.com>.
1190 (InteractiveShell.__init__): prevent certain special magics from
1197 (InteractiveShell.__init__): prevent certain special magics from
1191 being shadowed by aliases. Closes
1198 being shadowed by aliases. Closes
1192 http://www.scipy.net/roundup/ipython/issue41.
1199 http://www.scipy.net/roundup/ipython/issue41.
1193
1200
1194 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1201 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1195
1202
1196 * IPython/iplib.py (InteractiveShell.complete): Added new
1203 * IPython/iplib.py (InteractiveShell.complete): Added new
1197 top-level completion method to expose the completion mechanism
1204 top-level completion method to expose the completion mechanism
1198 beyond readline-based environments.
1205 beyond readline-based environments.
1199
1206
1200 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1207 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1201
1208
1202 * tools/ipsvnc (svnversion): fix svnversion capture.
1209 * tools/ipsvnc (svnversion): fix svnversion capture.
1203
1210
1204 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1211 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1205 attribute to self, which was missing. Before, it was set by a
1212 attribute to self, which was missing. Before, it was set by a
1206 routine which in certain cases wasn't being called, so the
1213 routine which in certain cases wasn't being called, so the
1207 instance could end up missing the attribute. This caused a crash.
1214 instance could end up missing the attribute. This caused a crash.
1208 Closes http://www.scipy.net/roundup/ipython/issue40.
1215 Closes http://www.scipy.net/roundup/ipython/issue40.
1209
1216
1210 2005-08-16 Fernando Perez <fperez@colorado.edu>
1217 2005-08-16 Fernando Perez <fperez@colorado.edu>
1211
1218
1212 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1219 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1213 contains non-string attribute. Closes
1220 contains non-string attribute. Closes
1214 http://www.scipy.net/roundup/ipython/issue38.
1221 http://www.scipy.net/roundup/ipython/issue38.
1215
1222
1216 2005-08-14 Fernando Perez <fperez@colorado.edu>
1223 2005-08-14 Fernando Perez <fperez@colorado.edu>
1217
1224
1218 * tools/ipsvnc: Minor improvements, to add changeset info.
1225 * tools/ipsvnc: Minor improvements, to add changeset info.
1219
1226
1220 2005-08-12 Fernando Perez <fperez@colorado.edu>
1227 2005-08-12 Fernando Perez <fperez@colorado.edu>
1221
1228
1222 * IPython/iplib.py (runsource): remove self.code_to_run_src
1229 * IPython/iplib.py (runsource): remove self.code_to_run_src
1223 attribute. I realized this is nothing more than
1230 attribute. I realized this is nothing more than
1224 '\n'.join(self.buffer), and having the same data in two different
1231 '\n'.join(self.buffer), and having the same data in two different
1225 places is just asking for synchronization bugs. This may impact
1232 places is just asking for synchronization bugs. This may impact
1226 people who have custom exception handlers, so I need to warn
1233 people who have custom exception handlers, so I need to warn
1227 ipython-dev about it (F. Mantegazza may use them).
1234 ipython-dev about it (F. Mantegazza may use them).
1228
1235
1229 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1236 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1230
1237
1231 * IPython/genutils.py: fix 2.2 compatibility (generators)
1238 * IPython/genutils.py: fix 2.2 compatibility (generators)
1232
1239
1233 2005-07-18 Fernando Perez <fperez@colorado.edu>
1240 2005-07-18 Fernando Perez <fperez@colorado.edu>
1234
1241
1235 * IPython/genutils.py (get_home_dir): fix to help users with
1242 * IPython/genutils.py (get_home_dir): fix to help users with
1236 invalid $HOME under win32.
1243 invalid $HOME under win32.
1237
1244
1238 2005-07-17 Fernando Perez <fperez@colorado.edu>
1245 2005-07-17 Fernando Perez <fperez@colorado.edu>
1239
1246
1240 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1247 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1241 some old hacks and clean up a bit other routines; code should be
1248 some old hacks and clean up a bit other routines; code should be
1242 simpler and a bit faster.
1249 simpler and a bit faster.
1243
1250
1244 * IPython/iplib.py (interact): removed some last-resort attempts
1251 * IPython/iplib.py (interact): removed some last-resort attempts
1245 to survive broken stdout/stderr. That code was only making it
1252 to survive broken stdout/stderr. That code was only making it
1246 harder to abstract out the i/o (necessary for gui integration),
1253 harder to abstract out the i/o (necessary for gui integration),
1247 and the crashes it could prevent were extremely rare in practice
1254 and the crashes it could prevent were extremely rare in practice
1248 (besides being fully user-induced in a pretty violent manner).
1255 (besides being fully user-induced in a pretty violent manner).
1249
1256
1250 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1257 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1251 Nothing major yet, but the code is simpler to read; this should
1258 Nothing major yet, but the code is simpler to read; this should
1252 make it easier to do more serious modifications in the future.
1259 make it easier to do more serious modifications in the future.
1253
1260
1254 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1261 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1255 which broke in .15 (thanks to a report by Ville).
1262 which broke in .15 (thanks to a report by Ville).
1256
1263
1257 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1264 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1258 be quite correct, I know next to nothing about unicode). This
1265 be quite correct, I know next to nothing about unicode). This
1259 will allow unicode strings to be used in prompts, amongst other
1266 will allow unicode strings to be used in prompts, amongst other
1260 cases. It also will prevent ipython from crashing when unicode
1267 cases. It also will prevent ipython from crashing when unicode
1261 shows up unexpectedly in many places. If ascii encoding fails, we
1268 shows up unexpectedly in many places. If ascii encoding fails, we
1262 assume utf_8. Currently the encoding is not a user-visible
1269 assume utf_8. Currently the encoding is not a user-visible
1263 setting, though it could be made so if there is demand for it.
1270 setting, though it could be made so if there is demand for it.
1264
1271
1265 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1272 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1266
1273
1267 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1274 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1268
1275
1269 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1276 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1270
1277
1271 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1278 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1272 code can work transparently for 2.2/2.3.
1279 code can work transparently for 2.2/2.3.
1273
1280
1274 2005-07-16 Fernando Perez <fperez@colorado.edu>
1281 2005-07-16 Fernando Perez <fperez@colorado.edu>
1275
1282
1276 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1283 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1277 out of the color scheme table used for coloring exception
1284 out of the color scheme table used for coloring exception
1278 tracebacks. This allows user code to add new schemes at runtime.
1285 tracebacks. This allows user code to add new schemes at runtime.
1279 This is a minimally modified version of the patch at
1286 This is a minimally modified version of the patch at
1280 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1287 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1281 for the contribution.
1288 for the contribution.
1282
1289
1283 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1290 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1284 slightly modified version of the patch in
1291 slightly modified version of the patch in
1285 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1292 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1286 to remove the previous try/except solution (which was costlier).
1293 to remove the previous try/except solution (which was costlier).
1287 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1294 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1288
1295
1289 2005-06-08 Fernando Perez <fperez@colorado.edu>
1296 2005-06-08 Fernando Perez <fperez@colorado.edu>
1290
1297
1291 * IPython/iplib.py (write/write_err): Add methods to abstract all
1298 * IPython/iplib.py (write/write_err): Add methods to abstract all
1292 I/O a bit more.
1299 I/O a bit more.
1293
1300
1294 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1301 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1295 warning, reported by Aric Hagberg, fix by JD Hunter.
1302 warning, reported by Aric Hagberg, fix by JD Hunter.
1296
1303
1297 2005-06-02 *** Released version 0.6.15
1304 2005-06-02 *** Released version 0.6.15
1298
1305
1299 2005-06-01 Fernando Perez <fperez@colorado.edu>
1306 2005-06-01 Fernando Perez <fperez@colorado.edu>
1300
1307
1301 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1308 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1302 tab-completion of filenames within open-quoted strings. Note that
1309 tab-completion of filenames within open-quoted strings. Note that
1303 this requires that in ~/.ipython/ipythonrc, users change the
1310 this requires that in ~/.ipython/ipythonrc, users change the
1304 readline delimiters configuration to read:
1311 readline delimiters configuration to read:
1305
1312
1306 readline_remove_delims -/~
1313 readline_remove_delims -/~
1307
1314
1308
1315
1309 2005-05-31 *** Released version 0.6.14
1316 2005-05-31 *** Released version 0.6.14
1310
1317
1311 2005-05-29 Fernando Perez <fperez@colorado.edu>
1318 2005-05-29 Fernando Perez <fperez@colorado.edu>
1312
1319
1313 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1320 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1314 with files not on the filesystem. Reported by Eliyahu Sandler
1321 with files not on the filesystem. Reported by Eliyahu Sandler
1315 <eli@gondolin.net>
1322 <eli@gondolin.net>
1316
1323
1317 2005-05-22 Fernando Perez <fperez@colorado.edu>
1324 2005-05-22 Fernando Perez <fperez@colorado.edu>
1318
1325
1319 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1326 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1320 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1327 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1321
1328
1322 2005-05-19 Fernando Perez <fperez@colorado.edu>
1329 2005-05-19 Fernando Perez <fperez@colorado.edu>
1323
1330
1324 * IPython/iplib.py (safe_execfile): close a file which could be
1331 * IPython/iplib.py (safe_execfile): close a file which could be
1325 left open (causing problems in win32, which locks open files).
1332 left open (causing problems in win32, which locks open files).
1326 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1333 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1327
1334
1328 2005-05-18 Fernando Perez <fperez@colorado.edu>
1335 2005-05-18 Fernando Perez <fperez@colorado.edu>
1329
1336
1330 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1337 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1331 keyword arguments correctly to safe_execfile().
1338 keyword arguments correctly to safe_execfile().
1332
1339
1333 2005-05-13 Fernando Perez <fperez@colorado.edu>
1340 2005-05-13 Fernando Perez <fperez@colorado.edu>
1334
1341
1335 * ipython.1: Added info about Qt to manpage, and threads warning
1342 * ipython.1: Added info about Qt to manpage, and threads warning
1336 to usage page (invoked with --help).
1343 to usage page (invoked with --help).
1337
1344
1338 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1345 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1339 new matcher (it goes at the end of the priority list) to do
1346 new matcher (it goes at the end of the priority list) to do
1340 tab-completion on named function arguments. Submitted by George
1347 tab-completion on named function arguments. Submitted by George
1341 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1348 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1342 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1349 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1343 for more details.
1350 for more details.
1344
1351
1345 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1352 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1346 SystemExit exceptions in the script being run. Thanks to a report
1353 SystemExit exceptions in the script being run. Thanks to a report
1347 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1354 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1348 producing very annoying behavior when running unit tests.
1355 producing very annoying behavior when running unit tests.
1349
1356
1350 2005-05-12 Fernando Perez <fperez@colorado.edu>
1357 2005-05-12 Fernando Perez <fperez@colorado.edu>
1351
1358
1352 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1359 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1353 which I'd broken (again) due to a changed regexp. In the process,
1360 which I'd broken (again) due to a changed regexp. In the process,
1354 added ';' as an escape to auto-quote the whole line without
1361 added ';' as an escape to auto-quote the whole line without
1355 splitting its arguments. Thanks to a report by Jerry McRae
1362 splitting its arguments. Thanks to a report by Jerry McRae
1356 <qrs0xyc02-AT-sneakemail.com>.
1363 <qrs0xyc02-AT-sneakemail.com>.
1357
1364
1358 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1365 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1359 possible crashes caused by a TokenError. Reported by Ed Schofield
1366 possible crashes caused by a TokenError. Reported by Ed Schofield
1360 <schofield-AT-ftw.at>.
1367 <schofield-AT-ftw.at>.
1361
1368
1362 2005-05-06 Fernando Perez <fperez@colorado.edu>
1369 2005-05-06 Fernando Perez <fperez@colorado.edu>
1363
1370
1364 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1371 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1365
1372
1366 2005-04-29 Fernando Perez <fperez@colorado.edu>
1373 2005-04-29 Fernando Perez <fperez@colorado.edu>
1367
1374
1368 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1375 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1369 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1376 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1370 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1377 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1371 which provides support for Qt interactive usage (similar to the
1378 which provides support for Qt interactive usage (similar to the
1372 existing one for WX and GTK). This had been often requested.
1379 existing one for WX and GTK). This had been often requested.
1373
1380
1374 2005-04-14 *** Released version 0.6.13
1381 2005-04-14 *** Released version 0.6.13
1375
1382
1376 2005-04-08 Fernando Perez <fperez@colorado.edu>
1383 2005-04-08 Fernando Perez <fperez@colorado.edu>
1377
1384
1378 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1385 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1379 from _ofind, which gets called on almost every input line. Now,
1386 from _ofind, which gets called on almost every input line. Now,
1380 we only try to get docstrings if they are actually going to be
1387 we only try to get docstrings if they are actually going to be
1381 used (the overhead of fetching unnecessary docstrings can be
1388 used (the overhead of fetching unnecessary docstrings can be
1382 noticeable for certain objects, such as Pyro proxies).
1389 noticeable for certain objects, such as Pyro proxies).
1383
1390
1384 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1391 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1385 for completers. For some reason I had been passing them the state
1392 for completers. For some reason I had been passing them the state
1386 variable, which completers never actually need, and was in
1393 variable, which completers never actually need, and was in
1387 conflict with the rlcompleter API. Custom completers ONLY need to
1394 conflict with the rlcompleter API. Custom completers ONLY need to
1388 take the text parameter.
1395 take the text parameter.
1389
1396
1390 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1397 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1391 work correctly in pysh. I've also moved all the logic which used
1398 work correctly in pysh. I've also moved all the logic which used
1392 to be in pysh.py here, which will prevent problems with future
1399 to be in pysh.py here, which will prevent problems with future
1393 upgrades. However, this time I must warn users to update their
1400 upgrades. However, this time I must warn users to update their
1394 pysh profile to include the line
1401 pysh profile to include the line
1395
1402
1396 import_all IPython.Extensions.InterpreterExec
1403 import_all IPython.Extensions.InterpreterExec
1397
1404
1398 because otherwise things won't work for them. They MUST also
1405 because otherwise things won't work for them. They MUST also
1399 delete pysh.py and the line
1406 delete pysh.py and the line
1400
1407
1401 execfile pysh.py
1408 execfile pysh.py
1402
1409
1403 from their ipythonrc-pysh.
1410 from their ipythonrc-pysh.
1404
1411
1405 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1412 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1406 robust in the face of objects whose dir() returns non-strings
1413 robust in the face of objects whose dir() returns non-strings
1407 (which it shouldn't, but some broken libs like ITK do). Thanks to
1414 (which it shouldn't, but some broken libs like ITK do). Thanks to
1408 a patch by John Hunter (implemented differently, though). Also
1415 a patch by John Hunter (implemented differently, though). Also
1409 minor improvements by using .extend instead of + on lists.
1416 minor improvements by using .extend instead of + on lists.
1410
1417
1411 * pysh.py:
1418 * pysh.py:
1412
1419
1413 2005-04-06 Fernando Perez <fperez@colorado.edu>
1420 2005-04-06 Fernando Perez <fperez@colorado.edu>
1414
1421
1415 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1422 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1416 by default, so that all users benefit from it. Those who don't
1423 by default, so that all users benefit from it. Those who don't
1417 want it can still turn it off.
1424 want it can still turn it off.
1418
1425
1419 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1426 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1420 config file, I'd forgotten about this, so users were getting it
1427 config file, I'd forgotten about this, so users were getting it
1421 off by default.
1428 off by default.
1422
1429
1423 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1430 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1424 consistency. Now magics can be called in multiline statements,
1431 consistency. Now magics can be called in multiline statements,
1425 and python variables can be expanded in magic calls via $var.
1432 and python variables can be expanded in magic calls via $var.
1426 This makes the magic system behave just like aliases or !system
1433 This makes the magic system behave just like aliases or !system
1427 calls.
1434 calls.
1428
1435
1429 2005-03-28 Fernando Perez <fperez@colorado.edu>
1436 2005-03-28 Fernando Perez <fperez@colorado.edu>
1430
1437
1431 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1438 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1432 expensive string additions for building command. Add support for
1439 expensive string additions for building command. Add support for
1433 trailing ';' when autocall is used.
1440 trailing ';' when autocall is used.
1434
1441
1435 2005-03-26 Fernando Perez <fperez@colorado.edu>
1442 2005-03-26 Fernando Perez <fperez@colorado.edu>
1436
1443
1437 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1444 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1438 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1445 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1439 ipython.el robust against prompts with any number of spaces
1446 ipython.el robust against prompts with any number of spaces
1440 (including 0) after the ':' character.
1447 (including 0) after the ':' character.
1441
1448
1442 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1449 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1443 continuation prompt, which misled users to think the line was
1450 continuation prompt, which misled users to think the line was
1444 already indented. Closes debian Bug#300847, reported to me by
1451 already indented. Closes debian Bug#300847, reported to me by
1445 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1452 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1446
1453
1447 2005-03-23 Fernando Perez <fperez@colorado.edu>
1454 2005-03-23 Fernando Perez <fperez@colorado.edu>
1448
1455
1449 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1456 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1450 properly aligned if they have embedded newlines.
1457 properly aligned if they have embedded newlines.
1451
1458
1452 * IPython/iplib.py (runlines): Add a public method to expose
1459 * IPython/iplib.py (runlines): Add a public method to expose
1453 IPython's code execution machinery, so that users can run strings
1460 IPython's code execution machinery, so that users can run strings
1454 as if they had been typed at the prompt interactively.
1461 as if they had been typed at the prompt interactively.
1455 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1462 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1456 methods which can call the system shell, but with python variable
1463 methods which can call the system shell, but with python variable
1457 expansion. The three such methods are: __IPYTHON__.system,
1464 expansion. The three such methods are: __IPYTHON__.system,
1458 .getoutput and .getoutputerror. These need to be documented in a
1465 .getoutput and .getoutputerror. These need to be documented in a
1459 'public API' section (to be written) of the manual.
1466 'public API' section (to be written) of the manual.
1460
1467
1461 2005-03-20 Fernando Perez <fperez@colorado.edu>
1468 2005-03-20 Fernando Perez <fperez@colorado.edu>
1462
1469
1463 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1470 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1464 for custom exception handling. This is quite powerful, and it
1471 for custom exception handling. This is quite powerful, and it
1465 allows for user-installable exception handlers which can trap
1472 allows for user-installable exception handlers which can trap
1466 custom exceptions at runtime and treat them separately from
1473 custom exceptions at runtime and treat them separately from
1467 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1474 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1468 Mantegazza <mantegazza-AT-ill.fr>.
1475 Mantegazza <mantegazza-AT-ill.fr>.
1469 (InteractiveShell.set_custom_completer): public API function to
1476 (InteractiveShell.set_custom_completer): public API function to
1470 add new completers at runtime.
1477 add new completers at runtime.
1471
1478
1472 2005-03-19 Fernando Perez <fperez@colorado.edu>
1479 2005-03-19 Fernando Perez <fperez@colorado.edu>
1473
1480
1474 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1481 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1475 allow objects which provide their docstrings via non-standard
1482 allow objects which provide their docstrings via non-standard
1476 mechanisms (like Pyro proxies) to still be inspected by ipython's
1483 mechanisms (like Pyro proxies) to still be inspected by ipython's
1477 ? system.
1484 ? system.
1478
1485
1479 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1486 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1480 automatic capture system. I tried quite hard to make it work
1487 automatic capture system. I tried quite hard to make it work
1481 reliably, and simply failed. I tried many combinations with the
1488 reliably, and simply failed. I tried many combinations with the
1482 subprocess module, but eventually nothing worked in all needed
1489 subprocess module, but eventually nothing worked in all needed
1483 cases (not blocking stdin for the child, duplicating stdout
1490 cases (not blocking stdin for the child, duplicating stdout
1484 without blocking, etc). The new %sc/%sx still do capture to these
1491 without blocking, etc). The new %sc/%sx still do capture to these
1485 magical list/string objects which make shell use much more
1492 magical list/string objects which make shell use much more
1486 conveninent, so not all is lost.
1493 conveninent, so not all is lost.
1487
1494
1488 XXX - FIX MANUAL for the change above!
1495 XXX - FIX MANUAL for the change above!
1489
1496
1490 (runsource): I copied code.py's runsource() into ipython to modify
1497 (runsource): I copied code.py's runsource() into ipython to modify
1491 it a bit. Now the code object and source to be executed are
1498 it a bit. Now the code object and source to be executed are
1492 stored in ipython. This makes this info accessible to third-party
1499 stored in ipython. This makes this info accessible to third-party
1493 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1500 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1494 Mantegazza <mantegazza-AT-ill.fr>.
1501 Mantegazza <mantegazza-AT-ill.fr>.
1495
1502
1496 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1503 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1497 history-search via readline (like C-p/C-n). I'd wanted this for a
1504 history-search via readline (like C-p/C-n). I'd wanted this for a
1498 long time, but only recently found out how to do it. For users
1505 long time, but only recently found out how to do it. For users
1499 who already have their ipythonrc files made and want this, just
1506 who already have their ipythonrc files made and want this, just
1500 add:
1507 add:
1501
1508
1502 readline_parse_and_bind "\e[A": history-search-backward
1509 readline_parse_and_bind "\e[A": history-search-backward
1503 readline_parse_and_bind "\e[B": history-search-forward
1510 readline_parse_and_bind "\e[B": history-search-forward
1504
1511
1505 2005-03-18 Fernando Perez <fperez@colorado.edu>
1512 2005-03-18 Fernando Perez <fperez@colorado.edu>
1506
1513
1507 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1514 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1508 LSString and SList classes which allow transparent conversions
1515 LSString and SList classes which allow transparent conversions
1509 between list mode and whitespace-separated string.
1516 between list mode and whitespace-separated string.
1510 (magic_r): Fix recursion problem in %r.
1517 (magic_r): Fix recursion problem in %r.
1511
1518
1512 * IPython/genutils.py (LSString): New class to be used for
1519 * IPython/genutils.py (LSString): New class to be used for
1513 automatic storage of the results of all alias/system calls in _o
1520 automatic storage of the results of all alias/system calls in _o
1514 and _e (stdout/err). These provide a .l/.list attribute which
1521 and _e (stdout/err). These provide a .l/.list attribute which
1515 does automatic splitting on newlines. This means that for most
1522 does automatic splitting on newlines. This means that for most
1516 uses, you'll never need to do capturing of output with %sc/%sx
1523 uses, you'll never need to do capturing of output with %sc/%sx
1517 anymore, since ipython keeps this always done for you. Note that
1524 anymore, since ipython keeps this always done for you. Note that
1518 only the LAST results are stored, the _o/e variables are
1525 only the LAST results are stored, the _o/e variables are
1519 overwritten on each call. If you need to save their contents
1526 overwritten on each call. If you need to save their contents
1520 further, simply bind them to any other name.
1527 further, simply bind them to any other name.
1521
1528
1522 2005-03-17 Fernando Perez <fperez@colorado.edu>
1529 2005-03-17 Fernando Perez <fperez@colorado.edu>
1523
1530
1524 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1531 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1525 prompt namespace handling.
1532 prompt namespace handling.
1526
1533
1527 2005-03-16 Fernando Perez <fperez@colorado.edu>
1534 2005-03-16 Fernando Perez <fperez@colorado.edu>
1528
1535
1529 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1536 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1530 classic prompts to be '>>> ' (final space was missing, and it
1537 classic prompts to be '>>> ' (final space was missing, and it
1531 trips the emacs python mode).
1538 trips the emacs python mode).
1532 (BasePrompt.__str__): Added safe support for dynamic prompt
1539 (BasePrompt.__str__): Added safe support for dynamic prompt
1533 strings. Now you can set your prompt string to be '$x', and the
1540 strings. Now you can set your prompt string to be '$x', and the
1534 value of x will be printed from your interactive namespace. The
1541 value of x will be printed from your interactive namespace. The
1535 interpolation syntax includes the full Itpl support, so
1542 interpolation syntax includes the full Itpl support, so
1536 ${foo()+x+bar()} is a valid prompt string now, and the function
1543 ${foo()+x+bar()} is a valid prompt string now, and the function
1537 calls will be made at runtime.
1544 calls will be made at runtime.
1538
1545
1539 2005-03-15 Fernando Perez <fperez@colorado.edu>
1546 2005-03-15 Fernando Perez <fperez@colorado.edu>
1540
1547
1541 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1548 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1542 avoid name clashes in pylab. %hist still works, it just forwards
1549 avoid name clashes in pylab. %hist still works, it just forwards
1543 the call to %history.
1550 the call to %history.
1544
1551
1545 2005-03-02 *** Released version 0.6.12
1552 2005-03-02 *** Released version 0.6.12
1546
1553
1547 2005-03-02 Fernando Perez <fperez@colorado.edu>
1554 2005-03-02 Fernando Perez <fperez@colorado.edu>
1548
1555
1549 * IPython/iplib.py (handle_magic): log magic calls properly as
1556 * IPython/iplib.py (handle_magic): log magic calls properly as
1550 ipmagic() function calls.
1557 ipmagic() function calls.
1551
1558
1552 * IPython/Magic.py (magic_time): Improved %time to support
1559 * IPython/Magic.py (magic_time): Improved %time to support
1553 statements and provide wall-clock as well as CPU time.
1560 statements and provide wall-clock as well as CPU time.
1554
1561
1555 2005-02-27 Fernando Perez <fperez@colorado.edu>
1562 2005-02-27 Fernando Perez <fperez@colorado.edu>
1556
1563
1557 * IPython/hooks.py: New hooks module, to expose user-modifiable
1564 * IPython/hooks.py: New hooks module, to expose user-modifiable
1558 IPython functionality in a clean manner. For now only the editor
1565 IPython functionality in a clean manner. For now only the editor
1559 hook is actually written, and other thigns which I intend to turn
1566 hook is actually written, and other thigns which I intend to turn
1560 into proper hooks aren't yet there. The display and prefilter
1567 into proper hooks aren't yet there. The display and prefilter
1561 stuff, for example, should be hooks. But at least now the
1568 stuff, for example, should be hooks. But at least now the
1562 framework is in place, and the rest can be moved here with more
1569 framework is in place, and the rest can be moved here with more
1563 time later. IPython had had a .hooks variable for a long time for
1570 time later. IPython had had a .hooks variable for a long time for
1564 this purpose, but I'd never actually used it for anything.
1571 this purpose, but I'd never actually used it for anything.
1565
1572
1566 2005-02-26 Fernando Perez <fperez@colorado.edu>
1573 2005-02-26 Fernando Perez <fperez@colorado.edu>
1567
1574
1568 * IPython/ipmaker.py (make_IPython): make the default ipython
1575 * IPython/ipmaker.py (make_IPython): make the default ipython
1569 directory be called _ipython under win32, to follow more the
1576 directory be called _ipython under win32, to follow more the
1570 naming peculiarities of that platform (where buggy software like
1577 naming peculiarities of that platform (where buggy software like
1571 Visual Sourcesafe breaks with .named directories). Reported by
1578 Visual Sourcesafe breaks with .named directories). Reported by
1572 Ville Vainio.
1579 Ville Vainio.
1573
1580
1574 2005-02-23 Fernando Perez <fperez@colorado.edu>
1581 2005-02-23 Fernando Perez <fperez@colorado.edu>
1575
1582
1576 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1583 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1577 auto_aliases for win32 which were causing problems. Users can
1584 auto_aliases for win32 which were causing problems. Users can
1578 define the ones they personally like.
1585 define the ones they personally like.
1579
1586
1580 2005-02-21 Fernando Perez <fperez@colorado.edu>
1587 2005-02-21 Fernando Perez <fperez@colorado.edu>
1581
1588
1582 * IPython/Magic.py (magic_time): new magic to time execution of
1589 * IPython/Magic.py (magic_time): new magic to time execution of
1583 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1590 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1584
1591
1585 2005-02-19 Fernando Perez <fperez@colorado.edu>
1592 2005-02-19 Fernando Perez <fperez@colorado.edu>
1586
1593
1587 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1594 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1588 into keys (for prompts, for example).
1595 into keys (for prompts, for example).
1589
1596
1590 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1597 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1591 prompts in case users want them. This introduces a small behavior
1598 prompts in case users want them. This introduces a small behavior
1592 change: ipython does not automatically add a space to all prompts
1599 change: ipython does not automatically add a space to all prompts
1593 anymore. To get the old prompts with a space, users should add it
1600 anymore. To get the old prompts with a space, users should add it
1594 manually to their ipythonrc file, so for example prompt_in1 should
1601 manually to their ipythonrc file, so for example prompt_in1 should
1595 now read 'In [\#]: ' instead of 'In [\#]:'.
1602 now read 'In [\#]: ' instead of 'In [\#]:'.
1596 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1603 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1597 file) to control left-padding of secondary prompts.
1604 file) to control left-padding of secondary prompts.
1598
1605
1599 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1606 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1600 the profiler can't be imported. Fix for Debian, which removed
1607 the profiler can't be imported. Fix for Debian, which removed
1601 profile.py because of License issues. I applied a slightly
1608 profile.py because of License issues. I applied a slightly
1602 modified version of the original Debian patch at
1609 modified version of the original Debian patch at
1603 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1610 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1604
1611
1605 2005-02-17 Fernando Perez <fperez@colorado.edu>
1612 2005-02-17 Fernando Perez <fperez@colorado.edu>
1606
1613
1607 * IPython/genutils.py (native_line_ends): Fix bug which would
1614 * IPython/genutils.py (native_line_ends): Fix bug which would
1608 cause improper line-ends under win32 b/c I was not opening files
1615 cause improper line-ends under win32 b/c I was not opening files
1609 in binary mode. Bug report and fix thanks to Ville.
1616 in binary mode. Bug report and fix thanks to Ville.
1610
1617
1611 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1618 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1612 trying to catch spurious foo[1] autocalls. My fix actually broke
1619 trying to catch spurious foo[1] autocalls. My fix actually broke
1613 ',/' autoquote/call with explicit escape (bad regexp).
1620 ',/' autoquote/call with explicit escape (bad regexp).
1614
1621
1615 2005-02-15 *** Released version 0.6.11
1622 2005-02-15 *** Released version 0.6.11
1616
1623
1617 2005-02-14 Fernando Perez <fperez@colorado.edu>
1624 2005-02-14 Fernando Perez <fperez@colorado.edu>
1618
1625
1619 * IPython/background_jobs.py: New background job management
1626 * IPython/background_jobs.py: New background job management
1620 subsystem. This is implemented via a new set of classes, and
1627 subsystem. This is implemented via a new set of classes, and
1621 IPython now provides a builtin 'jobs' object for background job
1628 IPython now provides a builtin 'jobs' object for background job
1622 execution. A convenience %bg magic serves as a lightweight
1629 execution. A convenience %bg magic serves as a lightweight
1623 frontend for starting the more common type of calls. This was
1630 frontend for starting the more common type of calls. This was
1624 inspired by discussions with B. Granger and the BackgroundCommand
1631 inspired by discussions with B. Granger and the BackgroundCommand
1625 class described in the book Python Scripting for Computational
1632 class described in the book Python Scripting for Computational
1626 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1633 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1627 (although ultimately no code from this text was used, as IPython's
1634 (although ultimately no code from this text was used, as IPython's
1628 system is a separate implementation).
1635 system is a separate implementation).
1629
1636
1630 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1637 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1631 to control the completion of single/double underscore names
1638 to control the completion of single/double underscore names
1632 separately. As documented in the example ipytonrc file, the
1639 separately. As documented in the example ipytonrc file, the
1633 readline_omit__names variable can now be set to 2, to omit even
1640 readline_omit__names variable can now be set to 2, to omit even
1634 single underscore names. Thanks to a patch by Brian Wong
1641 single underscore names. Thanks to a patch by Brian Wong
1635 <BrianWong-AT-AirgoNetworks.Com>.
1642 <BrianWong-AT-AirgoNetworks.Com>.
1636 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1643 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1637 be autocalled as foo([1]) if foo were callable. A problem for
1644 be autocalled as foo([1]) if foo were callable. A problem for
1638 things which are both callable and implement __getitem__.
1645 things which are both callable and implement __getitem__.
1639 (init_readline): Fix autoindentation for win32. Thanks to a patch
1646 (init_readline): Fix autoindentation for win32. Thanks to a patch
1640 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1647 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1641
1648
1642 2005-02-12 Fernando Perez <fperez@colorado.edu>
1649 2005-02-12 Fernando Perez <fperez@colorado.edu>
1643
1650
1644 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1651 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1645 which I had written long ago to sort out user error messages which
1652 which I had written long ago to sort out user error messages which
1646 may occur during startup. This seemed like a good idea initially,
1653 may occur during startup. This seemed like a good idea initially,
1647 but it has proven a disaster in retrospect. I don't want to
1654 but it has proven a disaster in retrospect. I don't want to
1648 change much code for now, so my fix is to set the internal 'debug'
1655 change much code for now, so my fix is to set the internal 'debug'
1649 flag to true everywhere, whose only job was precisely to control
1656 flag to true everywhere, whose only job was precisely to control
1650 this subsystem. This closes issue 28 (as well as avoiding all
1657 this subsystem. This closes issue 28 (as well as avoiding all
1651 sorts of strange hangups which occur from time to time).
1658 sorts of strange hangups which occur from time to time).
1652
1659
1653 2005-02-07 Fernando Perez <fperez@colorado.edu>
1660 2005-02-07 Fernando Perez <fperez@colorado.edu>
1654
1661
1655 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1662 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1656 previous call produced a syntax error.
1663 previous call produced a syntax error.
1657
1664
1658 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1665 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1659 classes without constructor.
1666 classes without constructor.
1660
1667
1661 2005-02-06 Fernando Perez <fperez@colorado.edu>
1668 2005-02-06 Fernando Perez <fperez@colorado.edu>
1662
1669
1663 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1670 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1664 completions with the results of each matcher, so we return results
1671 completions with the results of each matcher, so we return results
1665 to the user from all namespaces. This breaks with ipython
1672 to the user from all namespaces. This breaks with ipython
1666 tradition, but I think it's a nicer behavior. Now you get all
1673 tradition, but I think it's a nicer behavior. Now you get all
1667 possible completions listed, from all possible namespaces (python,
1674 possible completions listed, from all possible namespaces (python,
1668 filesystem, magics...) After a request by John Hunter
1675 filesystem, magics...) After a request by John Hunter
1669 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1676 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1670
1677
1671 2005-02-05 Fernando Perez <fperez@colorado.edu>
1678 2005-02-05 Fernando Perez <fperez@colorado.edu>
1672
1679
1673 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1680 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1674 the call had quote characters in it (the quotes were stripped).
1681 the call had quote characters in it (the quotes were stripped).
1675
1682
1676 2005-01-31 Fernando Perez <fperez@colorado.edu>
1683 2005-01-31 Fernando Perez <fperez@colorado.edu>
1677
1684
1678 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1685 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1679 Itpl.itpl() to make the code more robust against psyco
1686 Itpl.itpl() to make the code more robust against psyco
1680 optimizations.
1687 optimizations.
1681
1688
1682 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1689 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1683 of causing an exception. Quicker, cleaner.
1690 of causing an exception. Quicker, cleaner.
1684
1691
1685 2005-01-28 Fernando Perez <fperez@colorado.edu>
1692 2005-01-28 Fernando Perez <fperez@colorado.edu>
1686
1693
1687 * scripts/ipython_win_post_install.py (install): hardcode
1694 * scripts/ipython_win_post_install.py (install): hardcode
1688 sys.prefix+'python.exe' as the executable path. It turns out that
1695 sys.prefix+'python.exe' as the executable path. It turns out that
1689 during the post-installation run, sys.executable resolves to the
1696 during the post-installation run, sys.executable resolves to the
1690 name of the binary installer! I should report this as a distutils
1697 name of the binary installer! I should report this as a distutils
1691 bug, I think. I updated the .10 release with this tiny fix, to
1698 bug, I think. I updated the .10 release with this tiny fix, to
1692 avoid annoying the lists further.
1699 avoid annoying the lists further.
1693
1700
1694 2005-01-27 *** Released version 0.6.10
1701 2005-01-27 *** Released version 0.6.10
1695
1702
1696 2005-01-27 Fernando Perez <fperez@colorado.edu>
1703 2005-01-27 Fernando Perez <fperez@colorado.edu>
1697
1704
1698 * IPython/numutils.py (norm): Added 'inf' as optional name for
1705 * IPython/numutils.py (norm): Added 'inf' as optional name for
1699 L-infinity norm, included references to mathworld.com for vector
1706 L-infinity norm, included references to mathworld.com for vector
1700 norm definitions.
1707 norm definitions.
1701 (amin/amax): added amin/amax for array min/max. Similar to what
1708 (amin/amax): added amin/amax for array min/max. Similar to what
1702 pylab ships with after the recent reorganization of names.
1709 pylab ships with after the recent reorganization of names.
1703 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1710 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1704
1711
1705 * ipython.el: committed Alex's recent fixes and improvements.
1712 * ipython.el: committed Alex's recent fixes and improvements.
1706 Tested with python-mode from CVS, and it looks excellent. Since
1713 Tested with python-mode from CVS, and it looks excellent. Since
1707 python-mode hasn't released anything in a while, I'm temporarily
1714 python-mode hasn't released anything in a while, I'm temporarily
1708 putting a copy of today's CVS (v 4.70) of python-mode in:
1715 putting a copy of today's CVS (v 4.70) of python-mode in:
1709 http://ipython.scipy.org/tmp/python-mode.el
1716 http://ipython.scipy.org/tmp/python-mode.el
1710
1717
1711 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1718 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1712 sys.executable for the executable name, instead of assuming it's
1719 sys.executable for the executable name, instead of assuming it's
1713 called 'python.exe' (the post-installer would have produced broken
1720 called 'python.exe' (the post-installer would have produced broken
1714 setups on systems with a differently named python binary).
1721 setups on systems with a differently named python binary).
1715
1722
1716 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1723 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1717 references to os.linesep, to make the code more
1724 references to os.linesep, to make the code more
1718 platform-independent. This is also part of the win32 coloring
1725 platform-independent. This is also part of the win32 coloring
1719 fixes.
1726 fixes.
1720
1727
1721 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1728 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1722 lines, which actually cause coloring bugs because the length of
1729 lines, which actually cause coloring bugs because the length of
1723 the line is very difficult to correctly compute with embedded
1730 the line is very difficult to correctly compute with embedded
1724 escapes. This was the source of all the coloring problems under
1731 escapes. This was the source of all the coloring problems under
1725 Win32. I think that _finally_, Win32 users have a properly
1732 Win32. I think that _finally_, Win32 users have a properly
1726 working ipython in all respects. This would never have happened
1733 working ipython in all respects. This would never have happened
1727 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1734 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1728
1735
1729 2005-01-26 *** Released version 0.6.9
1736 2005-01-26 *** Released version 0.6.9
1730
1737
1731 2005-01-25 Fernando Perez <fperez@colorado.edu>
1738 2005-01-25 Fernando Perez <fperez@colorado.edu>
1732
1739
1733 * setup.py: finally, we have a true Windows installer, thanks to
1740 * setup.py: finally, we have a true Windows installer, thanks to
1734 the excellent work of Viktor Ransmayr
1741 the excellent work of Viktor Ransmayr
1735 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1742 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1736 Windows users. The setup routine is quite a bit cleaner thanks to
1743 Windows users. The setup routine is quite a bit cleaner thanks to
1737 this, and the post-install script uses the proper functions to
1744 this, and the post-install script uses the proper functions to
1738 allow a clean de-installation using the standard Windows Control
1745 allow a clean de-installation using the standard Windows Control
1739 Panel.
1746 Panel.
1740
1747
1741 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1748 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1742 environment variable under all OSes (including win32) if
1749 environment variable under all OSes (including win32) if
1743 available. This will give consistency to win32 users who have set
1750 available. This will give consistency to win32 users who have set
1744 this variable for any reason. If os.environ['HOME'] fails, the
1751 this variable for any reason. If os.environ['HOME'] fails, the
1745 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1752 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1746
1753
1747 2005-01-24 Fernando Perez <fperez@colorado.edu>
1754 2005-01-24 Fernando Perez <fperez@colorado.edu>
1748
1755
1749 * IPython/numutils.py (empty_like): add empty_like(), similar to
1756 * IPython/numutils.py (empty_like): add empty_like(), similar to
1750 zeros_like() but taking advantage of the new empty() Numeric routine.
1757 zeros_like() but taking advantage of the new empty() Numeric routine.
1751
1758
1752 2005-01-23 *** Released version 0.6.8
1759 2005-01-23 *** Released version 0.6.8
1753
1760
1754 2005-01-22 Fernando Perez <fperez@colorado.edu>
1761 2005-01-22 Fernando Perez <fperez@colorado.edu>
1755
1762
1756 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1763 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1757 automatic show() calls. After discussing things with JDH, it
1764 automatic show() calls. After discussing things with JDH, it
1758 turns out there are too many corner cases where this can go wrong.
1765 turns out there are too many corner cases where this can go wrong.
1759 It's best not to try to be 'too smart', and simply have ipython
1766 It's best not to try to be 'too smart', and simply have ipython
1760 reproduce as much as possible the default behavior of a normal
1767 reproduce as much as possible the default behavior of a normal
1761 python shell.
1768 python shell.
1762
1769
1763 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1770 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1764 line-splitting regexp and _prefilter() to avoid calling getattr()
1771 line-splitting regexp and _prefilter() to avoid calling getattr()
1765 on assignments. This closes
1772 on assignments. This closes
1766 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1773 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1767 readline uses getattr(), so a simple <TAB> keypress is still
1774 readline uses getattr(), so a simple <TAB> keypress is still
1768 enough to trigger getattr() calls on an object.
1775 enough to trigger getattr() calls on an object.
1769
1776
1770 2005-01-21 Fernando Perez <fperez@colorado.edu>
1777 2005-01-21 Fernando Perez <fperez@colorado.edu>
1771
1778
1772 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1779 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1773 docstring under pylab so it doesn't mask the original.
1780 docstring under pylab so it doesn't mask the original.
1774
1781
1775 2005-01-21 *** Released version 0.6.7
1782 2005-01-21 *** Released version 0.6.7
1776
1783
1777 2005-01-21 Fernando Perez <fperez@colorado.edu>
1784 2005-01-21 Fernando Perez <fperez@colorado.edu>
1778
1785
1779 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1786 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1780 signal handling for win32 users in multithreaded mode.
1787 signal handling for win32 users in multithreaded mode.
1781
1788
1782 2005-01-17 Fernando Perez <fperez@colorado.edu>
1789 2005-01-17 Fernando Perez <fperez@colorado.edu>
1783
1790
1784 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1791 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1785 instances with no __init__. After a crash report by Norbert Nemec
1792 instances with no __init__. After a crash report by Norbert Nemec
1786 <Norbert-AT-nemec-online.de>.
1793 <Norbert-AT-nemec-online.de>.
1787
1794
1788 2005-01-14 Fernando Perez <fperez@colorado.edu>
1795 2005-01-14 Fernando Perez <fperez@colorado.edu>
1789
1796
1790 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1797 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1791 names for verbose exceptions, when multiple dotted names and the
1798 names for verbose exceptions, when multiple dotted names and the
1792 'parent' object were present on the same line.
1799 'parent' object were present on the same line.
1793
1800
1794 2005-01-11 Fernando Perez <fperez@colorado.edu>
1801 2005-01-11 Fernando Perez <fperez@colorado.edu>
1795
1802
1796 * IPython/genutils.py (flag_calls): new utility to trap and flag
1803 * IPython/genutils.py (flag_calls): new utility to trap and flag
1797 calls in functions. I need it to clean up matplotlib support.
1804 calls in functions. I need it to clean up matplotlib support.
1798 Also removed some deprecated code in genutils.
1805 Also removed some deprecated code in genutils.
1799
1806
1800 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1807 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1801 that matplotlib scripts called with %run, which don't call show()
1808 that matplotlib scripts called with %run, which don't call show()
1802 themselves, still have their plotting windows open.
1809 themselves, still have their plotting windows open.
1803
1810
1804 2005-01-05 Fernando Perez <fperez@colorado.edu>
1811 2005-01-05 Fernando Perez <fperez@colorado.edu>
1805
1812
1806 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1813 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1807 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1814 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1808
1815
1809 2004-12-19 Fernando Perez <fperez@colorado.edu>
1816 2004-12-19 Fernando Perez <fperez@colorado.edu>
1810
1817
1811 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1818 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1812 parent_runcode, which was an eyesore. The same result can be
1819 parent_runcode, which was an eyesore. The same result can be
1813 obtained with Python's regular superclass mechanisms.
1820 obtained with Python's regular superclass mechanisms.
1814
1821
1815 2004-12-17 Fernando Perez <fperez@colorado.edu>
1822 2004-12-17 Fernando Perez <fperez@colorado.edu>
1816
1823
1817 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1824 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1818 reported by Prabhu.
1825 reported by Prabhu.
1819 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1826 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1820 sys.stderr) instead of explicitly calling sys.stderr. This helps
1827 sys.stderr) instead of explicitly calling sys.stderr. This helps
1821 maintain our I/O abstractions clean, for future GUI embeddings.
1828 maintain our I/O abstractions clean, for future GUI embeddings.
1822
1829
1823 * IPython/genutils.py (info): added new utility for sys.stderr
1830 * IPython/genutils.py (info): added new utility for sys.stderr
1824 unified info message handling (thin wrapper around warn()).
1831 unified info message handling (thin wrapper around warn()).
1825
1832
1826 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1833 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1827 composite (dotted) names on verbose exceptions.
1834 composite (dotted) names on verbose exceptions.
1828 (VerboseTB.nullrepr): harden against another kind of errors which
1835 (VerboseTB.nullrepr): harden against another kind of errors which
1829 Python's inspect module can trigger, and which were crashing
1836 Python's inspect module can trigger, and which were crashing
1830 IPython. Thanks to a report by Marco Lombardi
1837 IPython. Thanks to a report by Marco Lombardi
1831 <mlombard-AT-ma010192.hq.eso.org>.
1838 <mlombard-AT-ma010192.hq.eso.org>.
1832
1839
1833 2004-12-13 *** Released version 0.6.6
1840 2004-12-13 *** Released version 0.6.6
1834
1841
1835 2004-12-12 Fernando Perez <fperez@colorado.edu>
1842 2004-12-12 Fernando Perez <fperez@colorado.edu>
1836
1843
1837 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1844 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1838 generated by pygtk upon initialization if it was built without
1845 generated by pygtk upon initialization if it was built without
1839 threads (for matplotlib users). After a crash reported by
1846 threads (for matplotlib users). After a crash reported by
1840 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1847 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1841
1848
1842 * IPython/ipmaker.py (make_IPython): fix small bug in the
1849 * IPython/ipmaker.py (make_IPython): fix small bug in the
1843 import_some parameter for multiple imports.
1850 import_some parameter for multiple imports.
1844
1851
1845 * IPython/iplib.py (ipmagic): simplified the interface of
1852 * IPython/iplib.py (ipmagic): simplified the interface of
1846 ipmagic() to take a single string argument, just as it would be
1853 ipmagic() to take a single string argument, just as it would be
1847 typed at the IPython cmd line.
1854 typed at the IPython cmd line.
1848 (ipalias): Added new ipalias() with an interface identical to
1855 (ipalias): Added new ipalias() with an interface identical to
1849 ipmagic(). This completes exposing a pure python interface to the
1856 ipmagic(). This completes exposing a pure python interface to the
1850 alias and magic system, which can be used in loops or more complex
1857 alias and magic system, which can be used in loops or more complex
1851 code where IPython's automatic line mangling is not active.
1858 code where IPython's automatic line mangling is not active.
1852
1859
1853 * IPython/genutils.py (timing): changed interface of timing to
1860 * IPython/genutils.py (timing): changed interface of timing to
1854 simply run code once, which is the most common case. timings()
1861 simply run code once, which is the most common case. timings()
1855 remains unchanged, for the cases where you want multiple runs.
1862 remains unchanged, for the cases where you want multiple runs.
1856
1863
1857 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1864 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1858 bug where Python2.2 crashes with exec'ing code which does not end
1865 bug where Python2.2 crashes with exec'ing code which does not end
1859 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1866 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1860 before.
1867 before.
1861
1868
1862 2004-12-10 Fernando Perez <fperez@colorado.edu>
1869 2004-12-10 Fernando Perez <fperez@colorado.edu>
1863
1870
1864 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1871 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1865 -t to -T, to accomodate the new -t flag in %run (the %run and
1872 -t to -T, to accomodate the new -t flag in %run (the %run and
1866 %prun options are kind of intermixed, and it's not easy to change
1873 %prun options are kind of intermixed, and it's not easy to change
1867 this with the limitations of python's getopt).
1874 this with the limitations of python's getopt).
1868
1875
1869 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1876 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1870 the execution of scripts. It's not as fine-tuned as timeit.py,
1877 the execution of scripts. It's not as fine-tuned as timeit.py,
1871 but it works from inside ipython (and under 2.2, which lacks
1878 but it works from inside ipython (and under 2.2, which lacks
1872 timeit.py). Optionally a number of runs > 1 can be given for
1879 timeit.py). Optionally a number of runs > 1 can be given for
1873 timing very short-running code.
1880 timing very short-running code.
1874
1881
1875 * IPython/genutils.py (uniq_stable): new routine which returns a
1882 * IPython/genutils.py (uniq_stable): new routine which returns a
1876 list of unique elements in any iterable, but in stable order of
1883 list of unique elements in any iterable, but in stable order of
1877 appearance. I needed this for the ultraTB fixes, and it's a handy
1884 appearance. I needed this for the ultraTB fixes, and it's a handy
1878 utility.
1885 utility.
1879
1886
1880 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1887 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1881 dotted names in Verbose exceptions. This had been broken since
1888 dotted names in Verbose exceptions. This had been broken since
1882 the very start, now x.y will properly be printed in a Verbose
1889 the very start, now x.y will properly be printed in a Verbose
1883 traceback, instead of x being shown and y appearing always as an
1890 traceback, instead of x being shown and y appearing always as an
1884 'undefined global'. Getting this to work was a bit tricky,
1891 'undefined global'. Getting this to work was a bit tricky,
1885 because by default python tokenizers are stateless. Saved by
1892 because by default python tokenizers are stateless. Saved by
1886 python's ability to easily add a bit of state to an arbitrary
1893 python's ability to easily add a bit of state to an arbitrary
1887 function (without needing to build a full-blown callable object).
1894 function (without needing to build a full-blown callable object).
1888
1895
1889 Also big cleanup of this code, which had horrendous runtime
1896 Also big cleanup of this code, which had horrendous runtime
1890 lookups of zillions of attributes for colorization. Moved all
1897 lookups of zillions of attributes for colorization. Moved all
1891 this code into a few templates, which make it cleaner and quicker.
1898 this code into a few templates, which make it cleaner and quicker.
1892
1899
1893 Printout quality was also improved for Verbose exceptions: one
1900 Printout quality was also improved for Verbose exceptions: one
1894 variable per line, and memory addresses are printed (this can be
1901 variable per line, and memory addresses are printed (this can be
1895 quite handy in nasty debugging situations, which is what Verbose
1902 quite handy in nasty debugging situations, which is what Verbose
1896 is for).
1903 is for).
1897
1904
1898 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1905 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1899 the command line as scripts to be loaded by embedded instances.
1906 the command line as scripts to be loaded by embedded instances.
1900 Doing so has the potential for an infinite recursion if there are
1907 Doing so has the potential for an infinite recursion if there are
1901 exceptions thrown in the process. This fixes a strange crash
1908 exceptions thrown in the process. This fixes a strange crash
1902 reported by Philippe MULLER <muller-AT-irit.fr>.
1909 reported by Philippe MULLER <muller-AT-irit.fr>.
1903
1910
1904 2004-12-09 Fernando Perez <fperez@colorado.edu>
1911 2004-12-09 Fernando Perez <fperez@colorado.edu>
1905
1912
1906 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1913 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1907 to reflect new names in matplotlib, which now expose the
1914 to reflect new names in matplotlib, which now expose the
1908 matlab-compatible interface via a pylab module instead of the
1915 matlab-compatible interface via a pylab module instead of the
1909 'matlab' name. The new code is backwards compatible, so users of
1916 'matlab' name. The new code is backwards compatible, so users of
1910 all matplotlib versions are OK. Patch by J. Hunter.
1917 all matplotlib versions are OK. Patch by J. Hunter.
1911
1918
1912 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1919 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1913 of __init__ docstrings for instances (class docstrings are already
1920 of __init__ docstrings for instances (class docstrings are already
1914 automatically printed). Instances with customized docstrings
1921 automatically printed). Instances with customized docstrings
1915 (indep. of the class) are also recognized and all 3 separate
1922 (indep. of the class) are also recognized and all 3 separate
1916 docstrings are printed (instance, class, constructor). After some
1923 docstrings are printed (instance, class, constructor). After some
1917 comments/suggestions by J. Hunter.
1924 comments/suggestions by J. Hunter.
1918
1925
1919 2004-12-05 Fernando Perez <fperez@colorado.edu>
1926 2004-12-05 Fernando Perez <fperez@colorado.edu>
1920
1927
1921 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1928 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1922 warnings when tab-completion fails and triggers an exception.
1929 warnings when tab-completion fails and triggers an exception.
1923
1930
1924 2004-12-03 Fernando Perez <fperez@colorado.edu>
1931 2004-12-03 Fernando Perez <fperez@colorado.edu>
1925
1932
1926 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1933 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1927 be triggered when using 'run -p'. An incorrect option flag was
1934 be triggered when using 'run -p'. An incorrect option flag was
1928 being set ('d' instead of 'D').
1935 being set ('d' instead of 'D').
1929 (manpage): fix missing escaped \- sign.
1936 (manpage): fix missing escaped \- sign.
1930
1937
1931 2004-11-30 *** Released version 0.6.5
1938 2004-11-30 *** Released version 0.6.5
1932
1939
1933 2004-11-30 Fernando Perez <fperez@colorado.edu>
1940 2004-11-30 Fernando Perez <fperez@colorado.edu>
1934
1941
1935 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1942 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1936 setting with -d option.
1943 setting with -d option.
1937
1944
1938 * setup.py (docfiles): Fix problem where the doc glob I was using
1945 * setup.py (docfiles): Fix problem where the doc glob I was using
1939 was COMPLETELY BROKEN. It was giving the right files by pure
1946 was COMPLETELY BROKEN. It was giving the right files by pure
1940 accident, but failed once I tried to include ipython.el. Note:
1947 accident, but failed once I tried to include ipython.el. Note:
1941 glob() does NOT allow you to do exclusion on multiple endings!
1948 glob() does NOT allow you to do exclusion on multiple endings!
1942
1949
1943 2004-11-29 Fernando Perez <fperez@colorado.edu>
1950 2004-11-29 Fernando Perez <fperez@colorado.edu>
1944
1951
1945 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1952 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1946 the manpage as the source. Better formatting & consistency.
1953 the manpage as the source. Better formatting & consistency.
1947
1954
1948 * IPython/Magic.py (magic_run): Added new -d option, to run
1955 * IPython/Magic.py (magic_run): Added new -d option, to run
1949 scripts under the control of the python pdb debugger. Note that
1956 scripts under the control of the python pdb debugger. Note that
1950 this required changing the %prun option -d to -D, to avoid a clash
1957 this required changing the %prun option -d to -D, to avoid a clash
1951 (since %run must pass options to %prun, and getopt is too dumb to
1958 (since %run must pass options to %prun, and getopt is too dumb to
1952 handle options with string values with embedded spaces). Thanks
1959 handle options with string values with embedded spaces). Thanks
1953 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1960 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1954 (magic_who_ls): added type matching to %who and %whos, so that one
1961 (magic_who_ls): added type matching to %who and %whos, so that one
1955 can filter their output to only include variables of certain
1962 can filter their output to only include variables of certain
1956 types. Another suggestion by Matthew.
1963 types. Another suggestion by Matthew.
1957 (magic_whos): Added memory summaries in kb and Mb for arrays.
1964 (magic_whos): Added memory summaries in kb and Mb for arrays.
1958 (magic_who): Improve formatting (break lines every 9 vars).
1965 (magic_who): Improve formatting (break lines every 9 vars).
1959
1966
1960 2004-11-28 Fernando Perez <fperez@colorado.edu>
1967 2004-11-28 Fernando Perez <fperez@colorado.edu>
1961
1968
1962 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1969 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1963 cache when empty lines were present.
1970 cache when empty lines were present.
1964
1971
1965 2004-11-24 Fernando Perez <fperez@colorado.edu>
1972 2004-11-24 Fernando Perez <fperez@colorado.edu>
1966
1973
1967 * IPython/usage.py (__doc__): document the re-activated threading
1974 * IPython/usage.py (__doc__): document the re-activated threading
1968 options for WX and GTK.
1975 options for WX and GTK.
1969
1976
1970 2004-11-23 Fernando Perez <fperez@colorado.edu>
1977 2004-11-23 Fernando Perez <fperez@colorado.edu>
1971
1978
1972 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1979 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1973 the -wthread and -gthread options, along with a new -tk one to try
1980 the -wthread and -gthread options, along with a new -tk one to try
1974 and coordinate Tk threading with wx/gtk. The tk support is very
1981 and coordinate Tk threading with wx/gtk. The tk support is very
1975 platform dependent, since it seems to require Tcl and Tk to be
1982 platform dependent, since it seems to require Tcl and Tk to be
1976 built with threads (Fedora1/2 appears NOT to have it, but in
1983 built with threads (Fedora1/2 appears NOT to have it, but in
1977 Prabhu's Debian boxes it works OK). But even with some Tk
1984 Prabhu's Debian boxes it works OK). But even with some Tk
1978 limitations, this is a great improvement.
1985 limitations, this is a great improvement.
1979
1986
1980 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1987 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1981 info in user prompts. Patch by Prabhu.
1988 info in user prompts. Patch by Prabhu.
1982
1989
1983 2004-11-18 Fernando Perez <fperez@colorado.edu>
1990 2004-11-18 Fernando Perez <fperez@colorado.edu>
1984
1991
1985 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1992 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1986 EOFErrors and bail, to avoid infinite loops if a non-terminating
1993 EOFErrors and bail, to avoid infinite loops if a non-terminating
1987 file is fed into ipython. Patch submitted in issue 19 by user,
1994 file is fed into ipython. Patch submitted in issue 19 by user,
1988 many thanks.
1995 many thanks.
1989
1996
1990 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1997 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1991 autoquote/parens in continuation prompts, which can cause lots of
1998 autoquote/parens in continuation prompts, which can cause lots of
1992 problems. Closes roundup issue 20.
1999 problems. Closes roundup issue 20.
1993
2000
1994 2004-11-17 Fernando Perez <fperez@colorado.edu>
2001 2004-11-17 Fernando Perez <fperez@colorado.edu>
1995
2002
1996 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2003 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1997 reported as debian bug #280505. I'm not sure my local changelog
2004 reported as debian bug #280505. I'm not sure my local changelog
1998 entry has the proper debian format (Jack?).
2005 entry has the proper debian format (Jack?).
1999
2006
2000 2004-11-08 *** Released version 0.6.4
2007 2004-11-08 *** Released version 0.6.4
2001
2008
2002 2004-11-08 Fernando Perez <fperez@colorado.edu>
2009 2004-11-08 Fernando Perez <fperez@colorado.edu>
2003
2010
2004 * IPython/iplib.py (init_readline): Fix exit message for Windows
2011 * IPython/iplib.py (init_readline): Fix exit message for Windows
2005 when readline is active. Thanks to a report by Eric Jones
2012 when readline is active. Thanks to a report by Eric Jones
2006 <eric-AT-enthought.com>.
2013 <eric-AT-enthought.com>.
2007
2014
2008 2004-11-07 Fernando Perez <fperez@colorado.edu>
2015 2004-11-07 Fernando Perez <fperez@colorado.edu>
2009
2016
2010 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2017 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2011 sometimes seen by win2k/cygwin users.
2018 sometimes seen by win2k/cygwin users.
2012
2019
2013 2004-11-06 Fernando Perez <fperez@colorado.edu>
2020 2004-11-06 Fernando Perez <fperez@colorado.edu>
2014
2021
2015 * IPython/iplib.py (interact): Change the handling of %Exit from
2022 * IPython/iplib.py (interact): Change the handling of %Exit from
2016 trying to propagate a SystemExit to an internal ipython flag.
2023 trying to propagate a SystemExit to an internal ipython flag.
2017 This is less elegant than using Python's exception mechanism, but
2024 This is less elegant than using Python's exception mechanism, but
2018 I can't get that to work reliably with threads, so under -pylab
2025 I can't get that to work reliably with threads, so under -pylab
2019 %Exit was hanging IPython. Cross-thread exception handling is
2026 %Exit was hanging IPython. Cross-thread exception handling is
2020 really a bitch. Thaks to a bug report by Stephen Walton
2027 really a bitch. Thaks to a bug report by Stephen Walton
2021 <stephen.walton-AT-csun.edu>.
2028 <stephen.walton-AT-csun.edu>.
2022
2029
2023 2004-11-04 Fernando Perez <fperez@colorado.edu>
2030 2004-11-04 Fernando Perez <fperez@colorado.edu>
2024
2031
2025 * IPython/iplib.py (raw_input_original): store a pointer to the
2032 * IPython/iplib.py (raw_input_original): store a pointer to the
2026 true raw_input to harden against code which can modify it
2033 true raw_input to harden against code which can modify it
2027 (wx.py.PyShell does this and would otherwise crash ipython).
2034 (wx.py.PyShell does this and would otherwise crash ipython).
2028 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2035 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2029
2036
2030 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2037 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2031 Ctrl-C problem, which does not mess up the input line.
2038 Ctrl-C problem, which does not mess up the input line.
2032
2039
2033 2004-11-03 Fernando Perez <fperez@colorado.edu>
2040 2004-11-03 Fernando Perez <fperez@colorado.edu>
2034
2041
2035 * IPython/Release.py: Changed licensing to BSD, in all files.
2042 * IPython/Release.py: Changed licensing to BSD, in all files.
2036 (name): lowercase name for tarball/RPM release.
2043 (name): lowercase name for tarball/RPM release.
2037
2044
2038 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2045 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2039 use throughout ipython.
2046 use throughout ipython.
2040
2047
2041 * IPython/Magic.py (Magic._ofind): Switch to using the new
2048 * IPython/Magic.py (Magic._ofind): Switch to using the new
2042 OInspect.getdoc() function.
2049 OInspect.getdoc() function.
2043
2050
2044 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2051 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2045 of the line currently being canceled via Ctrl-C. It's extremely
2052 of the line currently being canceled via Ctrl-C. It's extremely
2046 ugly, but I don't know how to do it better (the problem is one of
2053 ugly, but I don't know how to do it better (the problem is one of
2047 handling cross-thread exceptions).
2054 handling cross-thread exceptions).
2048
2055
2049 2004-10-28 Fernando Perez <fperez@colorado.edu>
2056 2004-10-28 Fernando Perez <fperez@colorado.edu>
2050
2057
2051 * IPython/Shell.py (signal_handler): add signal handlers to trap
2058 * IPython/Shell.py (signal_handler): add signal handlers to trap
2052 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2059 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2053 report by Francesc Alted.
2060 report by Francesc Alted.
2054
2061
2055 2004-10-21 Fernando Perez <fperez@colorado.edu>
2062 2004-10-21 Fernando Perez <fperez@colorado.edu>
2056
2063
2057 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2064 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2058 to % for pysh syntax extensions.
2065 to % for pysh syntax extensions.
2059
2066
2060 2004-10-09 Fernando Perez <fperez@colorado.edu>
2067 2004-10-09 Fernando Perez <fperez@colorado.edu>
2061
2068
2062 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2069 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2063 arrays to print a more useful summary, without calling str(arr).
2070 arrays to print a more useful summary, without calling str(arr).
2064 This avoids the problem of extremely lengthy computations which
2071 This avoids the problem of extremely lengthy computations which
2065 occur if arr is large, and appear to the user as a system lockup
2072 occur if arr is large, and appear to the user as a system lockup
2066 with 100% cpu activity. After a suggestion by Kristian Sandberg
2073 with 100% cpu activity. After a suggestion by Kristian Sandberg
2067 <Kristian.Sandberg@colorado.edu>.
2074 <Kristian.Sandberg@colorado.edu>.
2068 (Magic.__init__): fix bug in global magic escapes not being
2075 (Magic.__init__): fix bug in global magic escapes not being
2069 correctly set.
2076 correctly set.
2070
2077
2071 2004-10-08 Fernando Perez <fperez@colorado.edu>
2078 2004-10-08 Fernando Perez <fperez@colorado.edu>
2072
2079
2073 * IPython/Magic.py (__license__): change to absolute imports of
2080 * IPython/Magic.py (__license__): change to absolute imports of
2074 ipython's own internal packages, to start adapting to the absolute
2081 ipython's own internal packages, to start adapting to the absolute
2075 import requirement of PEP-328.
2082 import requirement of PEP-328.
2076
2083
2077 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2084 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2078 files, and standardize author/license marks through the Release
2085 files, and standardize author/license marks through the Release
2079 module instead of having per/file stuff (except for files with
2086 module instead of having per/file stuff (except for files with
2080 particular licenses, like the MIT/PSF-licensed codes).
2087 particular licenses, like the MIT/PSF-licensed codes).
2081
2088
2082 * IPython/Debugger.py: remove dead code for python 2.1
2089 * IPython/Debugger.py: remove dead code for python 2.1
2083
2090
2084 2004-10-04 Fernando Perez <fperez@colorado.edu>
2091 2004-10-04 Fernando Perez <fperez@colorado.edu>
2085
2092
2086 * IPython/iplib.py (ipmagic): New function for accessing magics
2093 * IPython/iplib.py (ipmagic): New function for accessing magics
2087 via a normal python function call.
2094 via a normal python function call.
2088
2095
2089 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2096 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2090 from '@' to '%', to accomodate the new @decorator syntax of python
2097 from '@' to '%', to accomodate the new @decorator syntax of python
2091 2.4.
2098 2.4.
2092
2099
2093 2004-09-29 Fernando Perez <fperez@colorado.edu>
2100 2004-09-29 Fernando Perez <fperez@colorado.edu>
2094
2101
2095 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2102 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2096 matplotlib.use to prevent running scripts which try to switch
2103 matplotlib.use to prevent running scripts which try to switch
2097 interactive backends from within ipython. This will just crash
2104 interactive backends from within ipython. This will just crash
2098 the python interpreter, so we can't allow it (but a detailed error
2105 the python interpreter, so we can't allow it (but a detailed error
2099 is given to the user).
2106 is given to the user).
2100
2107
2101 2004-09-28 Fernando Perez <fperez@colorado.edu>
2108 2004-09-28 Fernando Perez <fperez@colorado.edu>
2102
2109
2103 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2110 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2104 matplotlib-related fixes so that using @run with non-matplotlib
2111 matplotlib-related fixes so that using @run with non-matplotlib
2105 scripts doesn't pop up spurious plot windows. This requires
2112 scripts doesn't pop up spurious plot windows. This requires
2106 matplotlib >= 0.63, where I had to make some changes as well.
2113 matplotlib >= 0.63, where I had to make some changes as well.
2107
2114
2108 * IPython/ipmaker.py (make_IPython): update version requirement to
2115 * IPython/ipmaker.py (make_IPython): update version requirement to
2109 python 2.2.
2116 python 2.2.
2110
2117
2111 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2118 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2112 banner arg for embedded customization.
2119 banner arg for embedded customization.
2113
2120
2114 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2121 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2115 explicit uses of __IP as the IPython's instance name. Now things
2122 explicit uses of __IP as the IPython's instance name. Now things
2116 are properly handled via the shell.name value. The actual code
2123 are properly handled via the shell.name value. The actual code
2117 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2124 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2118 is much better than before. I'll clean things completely when the
2125 is much better than before. I'll clean things completely when the
2119 magic stuff gets a real overhaul.
2126 magic stuff gets a real overhaul.
2120
2127
2121 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2128 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2122 minor changes to debian dir.
2129 minor changes to debian dir.
2123
2130
2124 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2131 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2125 pointer to the shell itself in the interactive namespace even when
2132 pointer to the shell itself in the interactive namespace even when
2126 a user-supplied dict is provided. This is needed for embedding
2133 a user-supplied dict is provided. This is needed for embedding
2127 purposes (found by tests with Michel Sanner).
2134 purposes (found by tests with Michel Sanner).
2128
2135
2129 2004-09-27 Fernando Perez <fperez@colorado.edu>
2136 2004-09-27 Fernando Perez <fperez@colorado.edu>
2130
2137
2131 * IPython/UserConfig/ipythonrc: remove []{} from
2138 * IPython/UserConfig/ipythonrc: remove []{} from
2132 readline_remove_delims, so that things like [modname.<TAB> do
2139 readline_remove_delims, so that things like [modname.<TAB> do
2133 proper completion. This disables [].TAB, but that's a less common
2140 proper completion. This disables [].TAB, but that's a less common
2134 case than module names in list comprehensions, for example.
2141 case than module names in list comprehensions, for example.
2135 Thanks to a report by Andrea Riciputi.
2142 Thanks to a report by Andrea Riciputi.
2136
2143
2137 2004-09-09 Fernando Perez <fperez@colorado.edu>
2144 2004-09-09 Fernando Perez <fperez@colorado.edu>
2138
2145
2139 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2146 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2140 blocking problems in win32 and osx. Fix by John.
2147 blocking problems in win32 and osx. Fix by John.
2141
2148
2142 2004-09-08 Fernando Perez <fperez@colorado.edu>
2149 2004-09-08 Fernando Perez <fperez@colorado.edu>
2143
2150
2144 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2151 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2145 for Win32 and OSX. Fix by John Hunter.
2152 for Win32 and OSX. Fix by John Hunter.
2146
2153
2147 2004-08-30 *** Released version 0.6.3
2154 2004-08-30 *** Released version 0.6.3
2148
2155
2149 2004-08-30 Fernando Perez <fperez@colorado.edu>
2156 2004-08-30 Fernando Perez <fperez@colorado.edu>
2150
2157
2151 * setup.py (isfile): Add manpages to list of dependent files to be
2158 * setup.py (isfile): Add manpages to list of dependent files to be
2152 updated.
2159 updated.
2153
2160
2154 2004-08-27 Fernando Perez <fperez@colorado.edu>
2161 2004-08-27 Fernando Perez <fperez@colorado.edu>
2155
2162
2156 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2163 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2157 for now. They don't really work with standalone WX/GTK code
2164 for now. They don't really work with standalone WX/GTK code
2158 (though matplotlib IS working fine with both of those backends).
2165 (though matplotlib IS working fine with both of those backends).
2159 This will neeed much more testing. I disabled most things with
2166 This will neeed much more testing. I disabled most things with
2160 comments, so turning it back on later should be pretty easy.
2167 comments, so turning it back on later should be pretty easy.
2161
2168
2162 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2169 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2163 autocalling of expressions like r'foo', by modifying the line
2170 autocalling of expressions like r'foo', by modifying the line
2164 split regexp. Closes
2171 split regexp. Closes
2165 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2172 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2166 Riley <ipythonbugs-AT-sabi.net>.
2173 Riley <ipythonbugs-AT-sabi.net>.
2167 (InteractiveShell.mainloop): honor --nobanner with banner
2174 (InteractiveShell.mainloop): honor --nobanner with banner
2168 extensions.
2175 extensions.
2169
2176
2170 * IPython/Shell.py: Significant refactoring of all classes, so
2177 * IPython/Shell.py: Significant refactoring of all classes, so
2171 that we can really support ALL matplotlib backends and threading
2178 that we can really support ALL matplotlib backends and threading
2172 models (John spotted a bug with Tk which required this). Now we
2179 models (John spotted a bug with Tk which required this). Now we
2173 should support single-threaded, WX-threads and GTK-threads, both
2180 should support single-threaded, WX-threads and GTK-threads, both
2174 for generic code and for matplotlib.
2181 for generic code and for matplotlib.
2175
2182
2176 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2183 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2177 -pylab, to simplify things for users. Will also remove the pylab
2184 -pylab, to simplify things for users. Will also remove the pylab
2178 profile, since now all of matplotlib configuration is directly
2185 profile, since now all of matplotlib configuration is directly
2179 handled here. This also reduces startup time.
2186 handled here. This also reduces startup time.
2180
2187
2181 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2188 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2182 shell wasn't being correctly called. Also in IPShellWX.
2189 shell wasn't being correctly called. Also in IPShellWX.
2183
2190
2184 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2191 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2185 fine-tune banner.
2192 fine-tune banner.
2186
2193
2187 * IPython/numutils.py (spike): Deprecate these spike functions,
2194 * IPython/numutils.py (spike): Deprecate these spike functions,
2188 delete (long deprecated) gnuplot_exec handler.
2195 delete (long deprecated) gnuplot_exec handler.
2189
2196
2190 2004-08-26 Fernando Perez <fperez@colorado.edu>
2197 2004-08-26 Fernando Perez <fperez@colorado.edu>
2191
2198
2192 * ipython.1: Update for threading options, plus some others which
2199 * ipython.1: Update for threading options, plus some others which
2193 were missing.
2200 were missing.
2194
2201
2195 * IPython/ipmaker.py (__call__): Added -wthread option for
2202 * IPython/ipmaker.py (__call__): Added -wthread option for
2196 wxpython thread handling. Make sure threading options are only
2203 wxpython thread handling. Make sure threading options are only
2197 valid at the command line.
2204 valid at the command line.
2198
2205
2199 * scripts/ipython: moved shell selection into a factory function
2206 * scripts/ipython: moved shell selection into a factory function
2200 in Shell.py, to keep the starter script to a minimum.
2207 in Shell.py, to keep the starter script to a minimum.
2201
2208
2202 2004-08-25 Fernando Perez <fperez@colorado.edu>
2209 2004-08-25 Fernando Perez <fperez@colorado.edu>
2203
2210
2204 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2211 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2205 John. Along with some recent changes he made to matplotlib, the
2212 John. Along with some recent changes he made to matplotlib, the
2206 next versions of both systems should work very well together.
2213 next versions of both systems should work very well together.
2207
2214
2208 2004-08-24 Fernando Perez <fperez@colorado.edu>
2215 2004-08-24 Fernando Perez <fperez@colorado.edu>
2209
2216
2210 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2217 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2211 tried to switch the profiling to using hotshot, but I'm getting
2218 tried to switch the profiling to using hotshot, but I'm getting
2212 strange errors from prof.runctx() there. I may be misreading the
2219 strange errors from prof.runctx() there. I may be misreading the
2213 docs, but it looks weird. For now the profiling code will
2220 docs, but it looks weird. For now the profiling code will
2214 continue to use the standard profiler.
2221 continue to use the standard profiler.
2215
2222
2216 2004-08-23 Fernando Perez <fperez@colorado.edu>
2223 2004-08-23 Fernando Perez <fperez@colorado.edu>
2217
2224
2218 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2225 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2219 threaded shell, by John Hunter. It's not quite ready yet, but
2226 threaded shell, by John Hunter. It's not quite ready yet, but
2220 close.
2227 close.
2221
2228
2222 2004-08-22 Fernando Perez <fperez@colorado.edu>
2229 2004-08-22 Fernando Perez <fperez@colorado.edu>
2223
2230
2224 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2231 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2225 in Magic and ultraTB.
2232 in Magic and ultraTB.
2226
2233
2227 * ipython.1: document threading options in manpage.
2234 * ipython.1: document threading options in manpage.
2228
2235
2229 * scripts/ipython: Changed name of -thread option to -gthread,
2236 * scripts/ipython: Changed name of -thread option to -gthread,
2230 since this is GTK specific. I want to leave the door open for a
2237 since this is GTK specific. I want to leave the door open for a
2231 -wthread option for WX, which will most likely be necessary. This
2238 -wthread option for WX, which will most likely be necessary. This
2232 change affects usage and ipmaker as well.
2239 change affects usage and ipmaker as well.
2233
2240
2234 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2241 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2235 handle the matplotlib shell issues. Code by John Hunter
2242 handle the matplotlib shell issues. Code by John Hunter
2236 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2243 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2237 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2244 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2238 broken (and disabled for end users) for now, but it puts the
2245 broken (and disabled for end users) for now, but it puts the
2239 infrastructure in place.
2246 infrastructure in place.
2240
2247
2241 2004-08-21 Fernando Perez <fperez@colorado.edu>
2248 2004-08-21 Fernando Perez <fperez@colorado.edu>
2242
2249
2243 * ipythonrc-pylab: Add matplotlib support.
2250 * ipythonrc-pylab: Add matplotlib support.
2244
2251
2245 * matplotlib_config.py: new files for matplotlib support, part of
2252 * matplotlib_config.py: new files for matplotlib support, part of
2246 the pylab profile.
2253 the pylab profile.
2247
2254
2248 * IPython/usage.py (__doc__): documented the threading options.
2255 * IPython/usage.py (__doc__): documented the threading options.
2249
2256
2250 2004-08-20 Fernando Perez <fperez@colorado.edu>
2257 2004-08-20 Fernando Perez <fperez@colorado.edu>
2251
2258
2252 * ipython: Modified the main calling routine to handle the -thread
2259 * ipython: Modified the main calling routine to handle the -thread
2253 and -mpthread options. This needs to be done as a top-level hack,
2260 and -mpthread options. This needs to be done as a top-level hack,
2254 because it determines which class to instantiate for IPython
2261 because it determines which class to instantiate for IPython
2255 itself.
2262 itself.
2256
2263
2257 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2264 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2258 classes to support multithreaded GTK operation without blocking,
2265 classes to support multithreaded GTK operation without blocking,
2259 and matplotlib with all backends. This is a lot of still very
2266 and matplotlib with all backends. This is a lot of still very
2260 experimental code, and threads are tricky. So it may still have a
2267 experimental code, and threads are tricky. So it may still have a
2261 few rough edges... This code owes a lot to
2268 few rough edges... This code owes a lot to
2262 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2269 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2263 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2270 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2264 to John Hunter for all the matplotlib work.
2271 to John Hunter for all the matplotlib work.
2265
2272
2266 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2273 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2267 options for gtk thread and matplotlib support.
2274 options for gtk thread and matplotlib support.
2268
2275
2269 2004-08-16 Fernando Perez <fperez@colorado.edu>
2276 2004-08-16 Fernando Perez <fperez@colorado.edu>
2270
2277
2271 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2278 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2272 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2279 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2273 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2280 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2274
2281
2275 2004-08-11 Fernando Perez <fperez@colorado.edu>
2282 2004-08-11 Fernando Perez <fperez@colorado.edu>
2276
2283
2277 * setup.py (isfile): Fix build so documentation gets updated for
2284 * setup.py (isfile): Fix build so documentation gets updated for
2278 rpms (it was only done for .tgz builds).
2285 rpms (it was only done for .tgz builds).
2279
2286
2280 2004-08-10 Fernando Perez <fperez@colorado.edu>
2287 2004-08-10 Fernando Perez <fperez@colorado.edu>
2281
2288
2282 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2289 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2283
2290
2284 * iplib.py : Silence syntax error exceptions in tab-completion.
2291 * iplib.py : Silence syntax error exceptions in tab-completion.
2285
2292
2286 2004-08-05 Fernando Perez <fperez@colorado.edu>
2293 2004-08-05 Fernando Perez <fperez@colorado.edu>
2287
2294
2288 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2295 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2289 'color off' mark for continuation prompts. This was causing long
2296 'color off' mark for continuation prompts. This was causing long
2290 continuation lines to mis-wrap.
2297 continuation lines to mis-wrap.
2291
2298
2292 2004-08-01 Fernando Perez <fperez@colorado.edu>
2299 2004-08-01 Fernando Perez <fperez@colorado.edu>
2293
2300
2294 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2301 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2295 for building ipython to be a parameter. All this is necessary
2302 for building ipython to be a parameter. All this is necessary
2296 right now to have a multithreaded version, but this insane
2303 right now to have a multithreaded version, but this insane
2297 non-design will be cleaned up soon. For now, it's a hack that
2304 non-design will be cleaned up soon. For now, it's a hack that
2298 works.
2305 works.
2299
2306
2300 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2307 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2301 args in various places. No bugs so far, but it's a dangerous
2308 args in various places. No bugs so far, but it's a dangerous
2302 practice.
2309 practice.
2303
2310
2304 2004-07-31 Fernando Perez <fperez@colorado.edu>
2311 2004-07-31 Fernando Perez <fperez@colorado.edu>
2305
2312
2306 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2313 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2307 fix completion of files with dots in their names under most
2314 fix completion of files with dots in their names under most
2308 profiles (pysh was OK because the completion order is different).
2315 profiles (pysh was OK because the completion order is different).
2309
2316
2310 2004-07-27 Fernando Perez <fperez@colorado.edu>
2317 2004-07-27 Fernando Perez <fperez@colorado.edu>
2311
2318
2312 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2319 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2313 keywords manually, b/c the one in keyword.py was removed in python
2320 keywords manually, b/c the one in keyword.py was removed in python
2314 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2321 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2315 This is NOT a bug under python 2.3 and earlier.
2322 This is NOT a bug under python 2.3 and earlier.
2316
2323
2317 2004-07-26 Fernando Perez <fperez@colorado.edu>
2324 2004-07-26 Fernando Perez <fperez@colorado.edu>
2318
2325
2319 * IPython/ultraTB.py (VerboseTB.text): Add another
2326 * IPython/ultraTB.py (VerboseTB.text): Add another
2320 linecache.checkcache() call to try to prevent inspect.py from
2327 linecache.checkcache() call to try to prevent inspect.py from
2321 crashing under python 2.3. I think this fixes
2328 crashing under python 2.3. I think this fixes
2322 http://www.scipy.net/roundup/ipython/issue17.
2329 http://www.scipy.net/roundup/ipython/issue17.
2323
2330
2324 2004-07-26 *** Released version 0.6.2
2331 2004-07-26 *** Released version 0.6.2
2325
2332
2326 2004-07-26 Fernando Perez <fperez@colorado.edu>
2333 2004-07-26 Fernando Perez <fperez@colorado.edu>
2327
2334
2328 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2335 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2329 fail for any number.
2336 fail for any number.
2330 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2337 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2331 empty bookmarks.
2338 empty bookmarks.
2332
2339
2333 2004-07-26 *** Released version 0.6.1
2340 2004-07-26 *** Released version 0.6.1
2334
2341
2335 2004-07-26 Fernando Perez <fperez@colorado.edu>
2342 2004-07-26 Fernando Perez <fperez@colorado.edu>
2336
2343
2337 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2344 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2338
2345
2339 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2346 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2340 escaping '()[]{}' in filenames.
2347 escaping '()[]{}' in filenames.
2341
2348
2342 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2349 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2343 Python 2.2 users who lack a proper shlex.split.
2350 Python 2.2 users who lack a proper shlex.split.
2344
2351
2345 2004-07-19 Fernando Perez <fperez@colorado.edu>
2352 2004-07-19 Fernando Perez <fperez@colorado.edu>
2346
2353
2347 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2354 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2348 for reading readline's init file. I follow the normal chain:
2355 for reading readline's init file. I follow the normal chain:
2349 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2356 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2350 report by Mike Heeter. This closes
2357 report by Mike Heeter. This closes
2351 http://www.scipy.net/roundup/ipython/issue16.
2358 http://www.scipy.net/roundup/ipython/issue16.
2352
2359
2353 2004-07-18 Fernando Perez <fperez@colorado.edu>
2360 2004-07-18 Fernando Perez <fperez@colorado.edu>
2354
2361
2355 * IPython/iplib.py (__init__): Add better handling of '\' under
2362 * IPython/iplib.py (__init__): Add better handling of '\' under
2356 Win32 for filenames. After a patch by Ville.
2363 Win32 for filenames. After a patch by Ville.
2357
2364
2358 2004-07-17 Fernando Perez <fperez@colorado.edu>
2365 2004-07-17 Fernando Perez <fperez@colorado.edu>
2359
2366
2360 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2367 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2361 autocalling would be triggered for 'foo is bar' if foo is
2368 autocalling would be triggered for 'foo is bar' if foo is
2362 callable. I also cleaned up the autocall detection code to use a
2369 callable. I also cleaned up the autocall detection code to use a
2363 regexp, which is faster. Bug reported by Alexander Schmolck.
2370 regexp, which is faster. Bug reported by Alexander Schmolck.
2364
2371
2365 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2372 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2366 '?' in them would confuse the help system. Reported by Alex
2373 '?' in them would confuse the help system. Reported by Alex
2367 Schmolck.
2374 Schmolck.
2368
2375
2369 2004-07-16 Fernando Perez <fperez@colorado.edu>
2376 2004-07-16 Fernando Perez <fperez@colorado.edu>
2370
2377
2371 * IPython/GnuplotInteractive.py (__all__): added plot2.
2378 * IPython/GnuplotInteractive.py (__all__): added plot2.
2372
2379
2373 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2380 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2374 plotting dictionaries, lists or tuples of 1d arrays.
2381 plotting dictionaries, lists or tuples of 1d arrays.
2375
2382
2376 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2383 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2377 optimizations.
2384 optimizations.
2378
2385
2379 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2386 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2380 the information which was there from Janko's original IPP code:
2387 the information which was there from Janko's original IPP code:
2381
2388
2382 03.05.99 20:53 porto.ifm.uni-kiel.de
2389 03.05.99 20:53 porto.ifm.uni-kiel.de
2383 --Started changelog.
2390 --Started changelog.
2384 --make clear do what it say it does
2391 --make clear do what it say it does
2385 --added pretty output of lines from inputcache
2392 --added pretty output of lines from inputcache
2386 --Made Logger a mixin class, simplifies handling of switches
2393 --Made Logger a mixin class, simplifies handling of switches
2387 --Added own completer class. .string<TAB> expands to last history
2394 --Added own completer class. .string<TAB> expands to last history
2388 line which starts with string. The new expansion is also present
2395 line which starts with string. The new expansion is also present
2389 with Ctrl-r from the readline library. But this shows, who this
2396 with Ctrl-r from the readline library. But this shows, who this
2390 can be done for other cases.
2397 can be done for other cases.
2391 --Added convention that all shell functions should accept a
2398 --Added convention that all shell functions should accept a
2392 parameter_string This opens the door for different behaviour for
2399 parameter_string This opens the door for different behaviour for
2393 each function. @cd is a good example of this.
2400 each function. @cd is a good example of this.
2394
2401
2395 04.05.99 12:12 porto.ifm.uni-kiel.de
2402 04.05.99 12:12 porto.ifm.uni-kiel.de
2396 --added logfile rotation
2403 --added logfile rotation
2397 --added new mainloop method which freezes first the namespace
2404 --added new mainloop method which freezes first the namespace
2398
2405
2399 07.05.99 21:24 porto.ifm.uni-kiel.de
2406 07.05.99 21:24 porto.ifm.uni-kiel.de
2400 --added the docreader classes. Now there is a help system.
2407 --added the docreader classes. Now there is a help system.
2401 -This is only a first try. Currently it's not easy to put new
2408 -This is only a first try. Currently it's not easy to put new
2402 stuff in the indices. But this is the way to go. Info would be
2409 stuff in the indices. But this is the way to go. Info would be
2403 better, but HTML is every where and not everybody has an info
2410 better, but HTML is every where and not everybody has an info
2404 system installed and it's not so easy to change html-docs to info.
2411 system installed and it's not so easy to change html-docs to info.
2405 --added global logfile option
2412 --added global logfile option
2406 --there is now a hook for object inspection method pinfo needs to
2413 --there is now a hook for object inspection method pinfo needs to
2407 be provided for this. Can be reached by two '??'.
2414 be provided for this. Can be reached by two '??'.
2408
2415
2409 08.05.99 20:51 porto.ifm.uni-kiel.de
2416 08.05.99 20:51 porto.ifm.uni-kiel.de
2410 --added a README
2417 --added a README
2411 --bug in rc file. Something has changed so functions in the rc
2418 --bug in rc file. Something has changed so functions in the rc
2412 file need to reference the shell and not self. Not clear if it's a
2419 file need to reference the shell and not self. Not clear if it's a
2413 bug or feature.
2420 bug or feature.
2414 --changed rc file for new behavior
2421 --changed rc file for new behavior
2415
2422
2416 2004-07-15 Fernando Perez <fperez@colorado.edu>
2423 2004-07-15 Fernando Perez <fperez@colorado.edu>
2417
2424
2418 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2425 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2419 cache was falling out of sync in bizarre manners when multi-line
2426 cache was falling out of sync in bizarre manners when multi-line
2420 input was present. Minor optimizations and cleanup.
2427 input was present. Minor optimizations and cleanup.
2421
2428
2422 (Logger): Remove old Changelog info for cleanup. This is the
2429 (Logger): Remove old Changelog info for cleanup. This is the
2423 information which was there from Janko's original code:
2430 information which was there from Janko's original code:
2424
2431
2425 Changes to Logger: - made the default log filename a parameter
2432 Changes to Logger: - made the default log filename a parameter
2426
2433
2427 - put a check for lines beginning with !@? in log(). Needed
2434 - put a check for lines beginning with !@? in log(). Needed
2428 (even if the handlers properly log their lines) for mid-session
2435 (even if the handlers properly log their lines) for mid-session
2429 logging activation to work properly. Without this, lines logged
2436 logging activation to work properly. Without this, lines logged
2430 in mid session, which get read from the cache, would end up
2437 in mid session, which get read from the cache, would end up
2431 'bare' (with !@? in the open) in the log. Now they are caught
2438 'bare' (with !@? in the open) in the log. Now they are caught
2432 and prepended with a #.
2439 and prepended with a #.
2433
2440
2434 * IPython/iplib.py (InteractiveShell.init_readline): added check
2441 * IPython/iplib.py (InteractiveShell.init_readline): added check
2435 in case MagicCompleter fails to be defined, so we don't crash.
2442 in case MagicCompleter fails to be defined, so we don't crash.
2436
2443
2437 2004-07-13 Fernando Perez <fperez@colorado.edu>
2444 2004-07-13 Fernando Perez <fperez@colorado.edu>
2438
2445
2439 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2446 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2440 of EPS if the requested filename ends in '.eps'.
2447 of EPS if the requested filename ends in '.eps'.
2441
2448
2442 2004-07-04 Fernando Perez <fperez@colorado.edu>
2449 2004-07-04 Fernando Perez <fperez@colorado.edu>
2443
2450
2444 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2451 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2445 escaping of quotes when calling the shell.
2452 escaping of quotes when calling the shell.
2446
2453
2447 2004-07-02 Fernando Perez <fperez@colorado.edu>
2454 2004-07-02 Fernando Perez <fperez@colorado.edu>
2448
2455
2449 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2456 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2450 gettext not working because we were clobbering '_'. Fixes
2457 gettext not working because we were clobbering '_'. Fixes
2451 http://www.scipy.net/roundup/ipython/issue6.
2458 http://www.scipy.net/roundup/ipython/issue6.
2452
2459
2453 2004-07-01 Fernando Perez <fperez@colorado.edu>
2460 2004-07-01 Fernando Perez <fperez@colorado.edu>
2454
2461
2455 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2462 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2456 into @cd. Patch by Ville.
2463 into @cd. Patch by Ville.
2457
2464
2458 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2465 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2459 new function to store things after ipmaker runs. Patch by Ville.
2466 new function to store things after ipmaker runs. Patch by Ville.
2460 Eventually this will go away once ipmaker is removed and the class
2467 Eventually this will go away once ipmaker is removed and the class
2461 gets cleaned up, but for now it's ok. Key functionality here is
2468 gets cleaned up, but for now it's ok. Key functionality here is
2462 the addition of the persistent storage mechanism, a dict for
2469 the addition of the persistent storage mechanism, a dict for
2463 keeping data across sessions (for now just bookmarks, but more can
2470 keeping data across sessions (for now just bookmarks, but more can
2464 be implemented later).
2471 be implemented later).
2465
2472
2466 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2473 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2467 persistent across sections. Patch by Ville, I modified it
2474 persistent across sections. Patch by Ville, I modified it
2468 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2475 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2469 added a '-l' option to list all bookmarks.
2476 added a '-l' option to list all bookmarks.
2470
2477
2471 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2478 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2472 center for cleanup. Registered with atexit.register(). I moved
2479 center for cleanup. Registered with atexit.register(). I moved
2473 here the old exit_cleanup(). After a patch by Ville.
2480 here the old exit_cleanup(). After a patch by Ville.
2474
2481
2475 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2482 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2476 characters in the hacked shlex_split for python 2.2.
2483 characters in the hacked shlex_split for python 2.2.
2477
2484
2478 * IPython/iplib.py (file_matches): more fixes to filenames with
2485 * IPython/iplib.py (file_matches): more fixes to filenames with
2479 whitespace in them. It's not perfect, but limitations in python's
2486 whitespace in them. It's not perfect, but limitations in python's
2480 readline make it impossible to go further.
2487 readline make it impossible to go further.
2481
2488
2482 2004-06-29 Fernando Perez <fperez@colorado.edu>
2489 2004-06-29 Fernando Perez <fperez@colorado.edu>
2483
2490
2484 * IPython/iplib.py (file_matches): escape whitespace correctly in
2491 * IPython/iplib.py (file_matches): escape whitespace correctly in
2485 filename completions. Bug reported by Ville.
2492 filename completions. Bug reported by Ville.
2486
2493
2487 2004-06-28 Fernando Perez <fperez@colorado.edu>
2494 2004-06-28 Fernando Perez <fperez@colorado.edu>
2488
2495
2489 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2496 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2490 the history file will be called 'history-PROFNAME' (or just
2497 the history file will be called 'history-PROFNAME' (or just
2491 'history' if no profile is loaded). I was getting annoyed at
2498 'history' if no profile is loaded). I was getting annoyed at
2492 getting my Numerical work history clobbered by pysh sessions.
2499 getting my Numerical work history clobbered by pysh sessions.
2493
2500
2494 * IPython/iplib.py (InteractiveShell.__init__): Internal
2501 * IPython/iplib.py (InteractiveShell.__init__): Internal
2495 getoutputerror() function so that we can honor the system_verbose
2502 getoutputerror() function so that we can honor the system_verbose
2496 flag for _all_ system calls. I also added escaping of #
2503 flag for _all_ system calls. I also added escaping of #
2497 characters here to avoid confusing Itpl.
2504 characters here to avoid confusing Itpl.
2498
2505
2499 * IPython/Magic.py (shlex_split): removed call to shell in
2506 * IPython/Magic.py (shlex_split): removed call to shell in
2500 parse_options and replaced it with shlex.split(). The annoying
2507 parse_options and replaced it with shlex.split(). The annoying
2501 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2508 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2502 to backport it from 2.3, with several frail hacks (the shlex
2509 to backport it from 2.3, with several frail hacks (the shlex
2503 module is rather limited in 2.2). Thanks to a suggestion by Ville
2510 module is rather limited in 2.2). Thanks to a suggestion by Ville
2504 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2511 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2505 problem.
2512 problem.
2506
2513
2507 (Magic.magic_system_verbose): new toggle to print the actual
2514 (Magic.magic_system_verbose): new toggle to print the actual
2508 system calls made by ipython. Mainly for debugging purposes.
2515 system calls made by ipython. Mainly for debugging purposes.
2509
2516
2510 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2517 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2511 doesn't support persistence. Reported (and fix suggested) by
2518 doesn't support persistence. Reported (and fix suggested) by
2512 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2519 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2513
2520
2514 2004-06-26 Fernando Perez <fperez@colorado.edu>
2521 2004-06-26 Fernando Perez <fperez@colorado.edu>
2515
2522
2516 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2523 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2517 continue prompts.
2524 continue prompts.
2518
2525
2519 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2526 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2520 function (basically a big docstring) and a few more things here to
2527 function (basically a big docstring) and a few more things here to
2521 speedup startup. pysh.py is now very lightweight. We want because
2528 speedup startup. pysh.py is now very lightweight. We want because
2522 it gets execfile'd, while InterpreterExec gets imported, so
2529 it gets execfile'd, while InterpreterExec gets imported, so
2523 byte-compilation saves time.
2530 byte-compilation saves time.
2524
2531
2525 2004-06-25 Fernando Perez <fperez@colorado.edu>
2532 2004-06-25 Fernando Perez <fperez@colorado.edu>
2526
2533
2527 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2534 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2528 -NUM', which was recently broken.
2535 -NUM', which was recently broken.
2529
2536
2530 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2537 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2531 in multi-line input (but not !!, which doesn't make sense there).
2538 in multi-line input (but not !!, which doesn't make sense there).
2532
2539
2533 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2540 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2534 It's just too useful, and people can turn it off in the less
2541 It's just too useful, and people can turn it off in the less
2535 common cases where it's a problem.
2542 common cases where it's a problem.
2536
2543
2537 2004-06-24 Fernando Perez <fperez@colorado.edu>
2544 2004-06-24 Fernando Perez <fperez@colorado.edu>
2538
2545
2539 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2546 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2540 special syntaxes (like alias calling) is now allied in multi-line
2547 special syntaxes (like alias calling) is now allied in multi-line
2541 input. This is still _very_ experimental, but it's necessary for
2548 input. This is still _very_ experimental, but it's necessary for
2542 efficient shell usage combining python looping syntax with system
2549 efficient shell usage combining python looping syntax with system
2543 calls. For now it's restricted to aliases, I don't think it
2550 calls. For now it's restricted to aliases, I don't think it
2544 really even makes sense to have this for magics.
2551 really even makes sense to have this for magics.
2545
2552
2546 2004-06-23 Fernando Perez <fperez@colorado.edu>
2553 2004-06-23 Fernando Perez <fperez@colorado.edu>
2547
2554
2548 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2555 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2549 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2556 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2550
2557
2551 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2558 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2552 extensions under Windows (after code sent by Gary Bishop). The
2559 extensions under Windows (after code sent by Gary Bishop). The
2553 extensions considered 'executable' are stored in IPython's rc
2560 extensions considered 'executable' are stored in IPython's rc
2554 structure as win_exec_ext.
2561 structure as win_exec_ext.
2555
2562
2556 * IPython/genutils.py (shell): new function, like system() but
2563 * IPython/genutils.py (shell): new function, like system() but
2557 without return value. Very useful for interactive shell work.
2564 without return value. Very useful for interactive shell work.
2558
2565
2559 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2566 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2560 delete aliases.
2567 delete aliases.
2561
2568
2562 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2569 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2563 sure that the alias table doesn't contain python keywords.
2570 sure that the alias table doesn't contain python keywords.
2564
2571
2565 2004-06-21 Fernando Perez <fperez@colorado.edu>
2572 2004-06-21 Fernando Perez <fperez@colorado.edu>
2566
2573
2567 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2574 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2568 non-existent items are found in $PATH. Reported by Thorsten.
2575 non-existent items are found in $PATH. Reported by Thorsten.
2569
2576
2570 2004-06-20 Fernando Perez <fperez@colorado.edu>
2577 2004-06-20 Fernando Perez <fperez@colorado.edu>
2571
2578
2572 * IPython/iplib.py (complete): modified the completer so that the
2579 * IPython/iplib.py (complete): modified the completer so that the
2573 order of priorities can be easily changed at runtime.
2580 order of priorities can be easily changed at runtime.
2574
2581
2575 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2582 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2576 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2583 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2577
2584
2578 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2585 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2579 expand Python variables prepended with $ in all system calls. The
2586 expand Python variables prepended with $ in all system calls. The
2580 same was done to InteractiveShell.handle_shell_escape. Now all
2587 same was done to InteractiveShell.handle_shell_escape. Now all
2581 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2588 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2582 expansion of python variables and expressions according to the
2589 expansion of python variables and expressions according to the
2583 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2590 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2584
2591
2585 Though PEP-215 has been rejected, a similar (but simpler) one
2592 Though PEP-215 has been rejected, a similar (but simpler) one
2586 seems like it will go into Python 2.4, PEP-292 -
2593 seems like it will go into Python 2.4, PEP-292 -
2587 http://www.python.org/peps/pep-0292.html.
2594 http://www.python.org/peps/pep-0292.html.
2588
2595
2589 I'll keep the full syntax of PEP-215, since IPython has since the
2596 I'll keep the full syntax of PEP-215, since IPython has since the
2590 start used Ka-Ping Yee's reference implementation discussed there
2597 start used Ka-Ping Yee's reference implementation discussed there
2591 (Itpl), and I actually like the powerful semantics it offers.
2598 (Itpl), and I actually like the powerful semantics it offers.
2592
2599
2593 In order to access normal shell variables, the $ has to be escaped
2600 In order to access normal shell variables, the $ has to be escaped
2594 via an extra $. For example:
2601 via an extra $. For example:
2595
2602
2596 In [7]: PATH='a python variable'
2603 In [7]: PATH='a python variable'
2597
2604
2598 In [8]: !echo $PATH
2605 In [8]: !echo $PATH
2599 a python variable
2606 a python variable
2600
2607
2601 In [9]: !echo $$PATH
2608 In [9]: !echo $$PATH
2602 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2609 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2603
2610
2604 (Magic.parse_options): escape $ so the shell doesn't evaluate
2611 (Magic.parse_options): escape $ so the shell doesn't evaluate
2605 things prematurely.
2612 things prematurely.
2606
2613
2607 * IPython/iplib.py (InteractiveShell.call_alias): added the
2614 * IPython/iplib.py (InteractiveShell.call_alias): added the
2608 ability for aliases to expand python variables via $.
2615 ability for aliases to expand python variables via $.
2609
2616
2610 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2617 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2611 system, now there's a @rehash/@rehashx pair of magics. These work
2618 system, now there's a @rehash/@rehashx pair of magics. These work
2612 like the csh rehash command, and can be invoked at any time. They
2619 like the csh rehash command, and can be invoked at any time. They
2613 build a table of aliases to everything in the user's $PATH
2620 build a table of aliases to everything in the user's $PATH
2614 (@rehash uses everything, @rehashx is slower but only adds
2621 (@rehash uses everything, @rehashx is slower but only adds
2615 executable files). With this, the pysh.py-based shell profile can
2622 executable files). With this, the pysh.py-based shell profile can
2616 now simply call rehash upon startup, and full access to all
2623 now simply call rehash upon startup, and full access to all
2617 programs in the user's path is obtained.
2624 programs in the user's path is obtained.
2618
2625
2619 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2626 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2620 functionality is now fully in place. I removed the old dynamic
2627 functionality is now fully in place. I removed the old dynamic
2621 code generation based approach, in favor of a much lighter one
2628 code generation based approach, in favor of a much lighter one
2622 based on a simple dict. The advantage is that this allows me to
2629 based on a simple dict. The advantage is that this allows me to
2623 now have thousands of aliases with negligible cost (unthinkable
2630 now have thousands of aliases with negligible cost (unthinkable
2624 with the old system).
2631 with the old system).
2625
2632
2626 2004-06-19 Fernando Perez <fperez@colorado.edu>
2633 2004-06-19 Fernando Perez <fperez@colorado.edu>
2627
2634
2628 * IPython/iplib.py (__init__): extended MagicCompleter class to
2635 * IPython/iplib.py (__init__): extended MagicCompleter class to
2629 also complete (last in priority) on user aliases.
2636 also complete (last in priority) on user aliases.
2630
2637
2631 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2638 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2632 call to eval.
2639 call to eval.
2633 (ItplNS.__init__): Added a new class which functions like Itpl,
2640 (ItplNS.__init__): Added a new class which functions like Itpl,
2634 but allows configuring the namespace for the evaluation to occur
2641 but allows configuring the namespace for the evaluation to occur
2635 in.
2642 in.
2636
2643
2637 2004-06-18 Fernando Perez <fperez@colorado.edu>
2644 2004-06-18 Fernando Perez <fperez@colorado.edu>
2638
2645
2639 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2646 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2640 better message when 'exit' or 'quit' are typed (a common newbie
2647 better message when 'exit' or 'quit' are typed (a common newbie
2641 confusion).
2648 confusion).
2642
2649
2643 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2650 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2644 check for Windows users.
2651 check for Windows users.
2645
2652
2646 * IPython/iplib.py (InteractiveShell.user_setup): removed
2653 * IPython/iplib.py (InteractiveShell.user_setup): removed
2647 disabling of colors for Windows. I'll test at runtime and issue a
2654 disabling of colors for Windows. I'll test at runtime and issue a
2648 warning if Gary's readline isn't found, as to nudge users to
2655 warning if Gary's readline isn't found, as to nudge users to
2649 download it.
2656 download it.
2650
2657
2651 2004-06-16 Fernando Perez <fperez@colorado.edu>
2658 2004-06-16 Fernando Perez <fperez@colorado.edu>
2652
2659
2653 * IPython/genutils.py (Stream.__init__): changed to print errors
2660 * IPython/genutils.py (Stream.__init__): changed to print errors
2654 to sys.stderr. I had a circular dependency here. Now it's
2661 to sys.stderr. I had a circular dependency here. Now it's
2655 possible to run ipython as IDLE's shell (consider this pre-alpha,
2662 possible to run ipython as IDLE's shell (consider this pre-alpha,
2656 since true stdout things end up in the starting terminal instead
2663 since true stdout things end up in the starting terminal instead
2657 of IDLE's out).
2664 of IDLE's out).
2658
2665
2659 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2666 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2660 users who haven't # updated their prompt_in2 definitions. Remove
2667 users who haven't # updated their prompt_in2 definitions. Remove
2661 eventually.
2668 eventually.
2662 (multiple_replace): added credit to original ASPN recipe.
2669 (multiple_replace): added credit to original ASPN recipe.
2663
2670
2664 2004-06-15 Fernando Perez <fperez@colorado.edu>
2671 2004-06-15 Fernando Perez <fperez@colorado.edu>
2665
2672
2666 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2673 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2667 list of auto-defined aliases.
2674 list of auto-defined aliases.
2668
2675
2669 2004-06-13 Fernando Perez <fperez@colorado.edu>
2676 2004-06-13 Fernando Perez <fperez@colorado.edu>
2670
2677
2671 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2678 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2672 install was really requested (so setup.py can be used for other
2679 install was really requested (so setup.py can be used for other
2673 things under Windows).
2680 things under Windows).
2674
2681
2675 2004-06-10 Fernando Perez <fperez@colorado.edu>
2682 2004-06-10 Fernando Perez <fperez@colorado.edu>
2676
2683
2677 * IPython/Logger.py (Logger.create_log): Manually remove any old
2684 * IPython/Logger.py (Logger.create_log): Manually remove any old
2678 backup, since os.remove may fail under Windows. Fixes bug
2685 backup, since os.remove may fail under Windows. Fixes bug
2679 reported by Thorsten.
2686 reported by Thorsten.
2680
2687
2681 2004-06-09 Fernando Perez <fperez@colorado.edu>
2688 2004-06-09 Fernando Perez <fperez@colorado.edu>
2682
2689
2683 * examples/example-embed.py: fixed all references to %n (replaced
2690 * examples/example-embed.py: fixed all references to %n (replaced
2684 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2691 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2685 for all examples and the manual as well.
2692 for all examples and the manual as well.
2686
2693
2687 2004-06-08 Fernando Perez <fperez@colorado.edu>
2694 2004-06-08 Fernando Perez <fperez@colorado.edu>
2688
2695
2689 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2696 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2690 alignment and color management. All 3 prompt subsystems now
2697 alignment and color management. All 3 prompt subsystems now
2691 inherit from BasePrompt.
2698 inherit from BasePrompt.
2692
2699
2693 * tools/release: updates for windows installer build and tag rpms
2700 * tools/release: updates for windows installer build and tag rpms
2694 with python version (since paths are fixed).
2701 with python version (since paths are fixed).
2695
2702
2696 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2703 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2697 which will become eventually obsolete. Also fixed the default
2704 which will become eventually obsolete. Also fixed the default
2698 prompt_in2 to use \D, so at least new users start with the correct
2705 prompt_in2 to use \D, so at least new users start with the correct
2699 defaults.
2706 defaults.
2700 WARNING: Users with existing ipythonrc files will need to apply
2707 WARNING: Users with existing ipythonrc files will need to apply
2701 this fix manually!
2708 this fix manually!
2702
2709
2703 * setup.py: make windows installer (.exe). This is finally the
2710 * setup.py: make windows installer (.exe). This is finally the
2704 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2711 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2705 which I hadn't included because it required Python 2.3 (or recent
2712 which I hadn't included because it required Python 2.3 (or recent
2706 distutils).
2713 distutils).
2707
2714
2708 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2715 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2709 usage of new '\D' escape.
2716 usage of new '\D' escape.
2710
2717
2711 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2718 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2712 lacks os.getuid())
2719 lacks os.getuid())
2713 (CachedOutput.set_colors): Added the ability to turn coloring
2720 (CachedOutput.set_colors): Added the ability to turn coloring
2714 on/off with @colors even for manually defined prompt colors. It
2721 on/off with @colors even for manually defined prompt colors. It
2715 uses a nasty global, but it works safely and via the generic color
2722 uses a nasty global, but it works safely and via the generic color
2716 handling mechanism.
2723 handling mechanism.
2717 (Prompt2.__init__): Introduced new escape '\D' for continuation
2724 (Prompt2.__init__): Introduced new escape '\D' for continuation
2718 prompts. It represents the counter ('\#') as dots.
2725 prompts. It represents the counter ('\#') as dots.
2719 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2726 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2720 need to update their ipythonrc files and replace '%n' with '\D' in
2727 need to update their ipythonrc files and replace '%n' with '\D' in
2721 their prompt_in2 settings everywhere. Sorry, but there's
2728 their prompt_in2 settings everywhere. Sorry, but there's
2722 otherwise no clean way to get all prompts to properly align. The
2729 otherwise no clean way to get all prompts to properly align. The
2723 ipythonrc shipped with IPython has been updated.
2730 ipythonrc shipped with IPython has been updated.
2724
2731
2725 2004-06-07 Fernando Perez <fperez@colorado.edu>
2732 2004-06-07 Fernando Perez <fperez@colorado.edu>
2726
2733
2727 * setup.py (isfile): Pass local_icons option to latex2html, so the
2734 * setup.py (isfile): Pass local_icons option to latex2html, so the
2728 resulting HTML file is self-contained. Thanks to
2735 resulting HTML file is self-contained. Thanks to
2729 dryice-AT-liu.com.cn for the tip.
2736 dryice-AT-liu.com.cn for the tip.
2730
2737
2731 * pysh.py: I created a new profile 'shell', which implements a
2738 * pysh.py: I created a new profile 'shell', which implements a
2732 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2739 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2733 system shell, nor will it become one anytime soon. It's mainly
2740 system shell, nor will it become one anytime soon. It's mainly
2734 meant to illustrate the use of the new flexible bash-like prompts.
2741 meant to illustrate the use of the new flexible bash-like prompts.
2735 I guess it could be used by hardy souls for true shell management,
2742 I guess it could be used by hardy souls for true shell management,
2736 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2743 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2737 profile. This uses the InterpreterExec extension provided by
2744 profile. This uses the InterpreterExec extension provided by
2738 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2745 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2739
2746
2740 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2747 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2741 auto-align itself with the length of the previous input prompt
2748 auto-align itself with the length of the previous input prompt
2742 (taking into account the invisible color escapes).
2749 (taking into account the invisible color escapes).
2743 (CachedOutput.__init__): Large restructuring of this class. Now
2750 (CachedOutput.__init__): Large restructuring of this class. Now
2744 all three prompts (primary1, primary2, output) are proper objects,
2751 all three prompts (primary1, primary2, output) are proper objects,
2745 managed by the 'parent' CachedOutput class. The code is still a
2752 managed by the 'parent' CachedOutput class. The code is still a
2746 bit hackish (all prompts share state via a pointer to the cache),
2753 bit hackish (all prompts share state via a pointer to the cache),
2747 but it's overall far cleaner than before.
2754 but it's overall far cleaner than before.
2748
2755
2749 * IPython/genutils.py (getoutputerror): modified to add verbose,
2756 * IPython/genutils.py (getoutputerror): modified to add verbose,
2750 debug and header options. This makes the interface of all getout*
2757 debug and header options. This makes the interface of all getout*
2751 functions uniform.
2758 functions uniform.
2752 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2759 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2753
2760
2754 * IPython/Magic.py (Magic.default_option): added a function to
2761 * IPython/Magic.py (Magic.default_option): added a function to
2755 allow registering default options for any magic command. This
2762 allow registering default options for any magic command. This
2756 makes it easy to have profiles which customize the magics globally
2763 makes it easy to have profiles which customize the magics globally
2757 for a certain use. The values set through this function are
2764 for a certain use. The values set through this function are
2758 picked up by the parse_options() method, which all magics should
2765 picked up by the parse_options() method, which all magics should
2759 use to parse their options.
2766 use to parse their options.
2760
2767
2761 * IPython/genutils.py (warn): modified the warnings framework to
2768 * IPython/genutils.py (warn): modified the warnings framework to
2762 use the Term I/O class. I'm trying to slowly unify all of
2769 use the Term I/O class. I'm trying to slowly unify all of
2763 IPython's I/O operations to pass through Term.
2770 IPython's I/O operations to pass through Term.
2764
2771
2765 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2772 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2766 the secondary prompt to correctly match the length of the primary
2773 the secondary prompt to correctly match the length of the primary
2767 one for any prompt. Now multi-line code will properly line up
2774 one for any prompt. Now multi-line code will properly line up
2768 even for path dependent prompts, such as the new ones available
2775 even for path dependent prompts, such as the new ones available
2769 via the prompt_specials.
2776 via the prompt_specials.
2770
2777
2771 2004-06-06 Fernando Perez <fperez@colorado.edu>
2778 2004-06-06 Fernando Perez <fperez@colorado.edu>
2772
2779
2773 * IPython/Prompts.py (prompt_specials): Added the ability to have
2780 * IPython/Prompts.py (prompt_specials): Added the ability to have
2774 bash-like special sequences in the prompts, which get
2781 bash-like special sequences in the prompts, which get
2775 automatically expanded. Things like hostname, current working
2782 automatically expanded. Things like hostname, current working
2776 directory and username are implemented already, but it's easy to
2783 directory and username are implemented already, but it's easy to
2777 add more in the future. Thanks to a patch by W.J. van der Laan
2784 add more in the future. Thanks to a patch by W.J. van der Laan
2778 <gnufnork-AT-hetdigitalegat.nl>
2785 <gnufnork-AT-hetdigitalegat.nl>
2779 (prompt_specials): Added color support for prompt strings, so
2786 (prompt_specials): Added color support for prompt strings, so
2780 users can define arbitrary color setups for their prompts.
2787 users can define arbitrary color setups for their prompts.
2781
2788
2782 2004-06-05 Fernando Perez <fperez@colorado.edu>
2789 2004-06-05 Fernando Perez <fperez@colorado.edu>
2783
2790
2784 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2791 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2785 code to load Gary Bishop's readline and configure it
2792 code to load Gary Bishop's readline and configure it
2786 automatically. Thanks to Gary for help on this.
2793 automatically. Thanks to Gary for help on this.
2787
2794
2788 2004-06-01 Fernando Perez <fperez@colorado.edu>
2795 2004-06-01 Fernando Perez <fperez@colorado.edu>
2789
2796
2790 * IPython/Logger.py (Logger.create_log): fix bug for logging
2797 * IPython/Logger.py (Logger.create_log): fix bug for logging
2791 with no filename (previous fix was incomplete).
2798 with no filename (previous fix was incomplete).
2792
2799
2793 2004-05-25 Fernando Perez <fperez@colorado.edu>
2800 2004-05-25 Fernando Perez <fperez@colorado.edu>
2794
2801
2795 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2802 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2796 parens would get passed to the shell.
2803 parens would get passed to the shell.
2797
2804
2798 2004-05-20 Fernando Perez <fperez@colorado.edu>
2805 2004-05-20 Fernando Perez <fperez@colorado.edu>
2799
2806
2800 * IPython/Magic.py (Magic.magic_prun): changed default profile
2807 * IPython/Magic.py (Magic.magic_prun): changed default profile
2801 sort order to 'time' (the more common profiling need).
2808 sort order to 'time' (the more common profiling need).
2802
2809
2803 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2810 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2804 so that source code shown is guaranteed in sync with the file on
2811 so that source code shown is guaranteed in sync with the file on
2805 disk (also changed in psource). Similar fix to the one for
2812 disk (also changed in psource). Similar fix to the one for
2806 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2813 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2807 <yann.ledu-AT-noos.fr>.
2814 <yann.ledu-AT-noos.fr>.
2808
2815
2809 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2816 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2810 with a single option would not be correctly parsed. Closes
2817 with a single option would not be correctly parsed. Closes
2811 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2818 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2812 introduced in 0.6.0 (on 2004-05-06).
2819 introduced in 0.6.0 (on 2004-05-06).
2813
2820
2814 2004-05-13 *** Released version 0.6.0
2821 2004-05-13 *** Released version 0.6.0
2815
2822
2816 2004-05-13 Fernando Perez <fperez@colorado.edu>
2823 2004-05-13 Fernando Perez <fperez@colorado.edu>
2817
2824
2818 * debian/: Added debian/ directory to CVS, so that debian support
2825 * debian/: Added debian/ directory to CVS, so that debian support
2819 is publicly accessible. The debian package is maintained by Jack
2826 is publicly accessible. The debian package is maintained by Jack
2820 Moffit <jack-AT-xiph.org>.
2827 Moffit <jack-AT-xiph.org>.
2821
2828
2822 * Documentation: included the notes about an ipython-based system
2829 * Documentation: included the notes about an ipython-based system
2823 shell (the hypothetical 'pysh') into the new_design.pdf document,
2830 shell (the hypothetical 'pysh') into the new_design.pdf document,
2824 so that these ideas get distributed to users along with the
2831 so that these ideas get distributed to users along with the
2825 official documentation.
2832 official documentation.
2826
2833
2827 2004-05-10 Fernando Perez <fperez@colorado.edu>
2834 2004-05-10 Fernando Perez <fperez@colorado.edu>
2828
2835
2829 * IPython/Logger.py (Logger.create_log): fix recently introduced
2836 * IPython/Logger.py (Logger.create_log): fix recently introduced
2830 bug (misindented line) where logstart would fail when not given an
2837 bug (misindented line) where logstart would fail when not given an
2831 explicit filename.
2838 explicit filename.
2832
2839
2833 2004-05-09 Fernando Perez <fperez@colorado.edu>
2840 2004-05-09 Fernando Perez <fperez@colorado.edu>
2834
2841
2835 * IPython/Magic.py (Magic.parse_options): skip system call when
2842 * IPython/Magic.py (Magic.parse_options): skip system call when
2836 there are no options to look for. Faster, cleaner for the common
2843 there are no options to look for. Faster, cleaner for the common
2837 case.
2844 case.
2838
2845
2839 * Documentation: many updates to the manual: describing Windows
2846 * Documentation: many updates to the manual: describing Windows
2840 support better, Gnuplot updates, credits, misc small stuff. Also
2847 support better, Gnuplot updates, credits, misc small stuff. Also
2841 updated the new_design doc a bit.
2848 updated the new_design doc a bit.
2842
2849
2843 2004-05-06 *** Released version 0.6.0.rc1
2850 2004-05-06 *** Released version 0.6.0.rc1
2844
2851
2845 2004-05-06 Fernando Perez <fperez@colorado.edu>
2852 2004-05-06 Fernando Perez <fperez@colorado.edu>
2846
2853
2847 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2854 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2848 operations to use the vastly more efficient list/''.join() method.
2855 operations to use the vastly more efficient list/''.join() method.
2849 (FormattedTB.text): Fix
2856 (FormattedTB.text): Fix
2850 http://www.scipy.net/roundup/ipython/issue12 - exception source
2857 http://www.scipy.net/roundup/ipython/issue12 - exception source
2851 extract not updated after reload. Thanks to Mike Salib
2858 extract not updated after reload. Thanks to Mike Salib
2852 <msalib-AT-mit.edu> for pinning the source of the problem.
2859 <msalib-AT-mit.edu> for pinning the source of the problem.
2853 Fortunately, the solution works inside ipython and doesn't require
2860 Fortunately, the solution works inside ipython and doesn't require
2854 any changes to python proper.
2861 any changes to python proper.
2855
2862
2856 * IPython/Magic.py (Magic.parse_options): Improved to process the
2863 * IPython/Magic.py (Magic.parse_options): Improved to process the
2857 argument list as a true shell would (by actually using the
2864 argument list as a true shell would (by actually using the
2858 underlying system shell). This way, all @magics automatically get
2865 underlying system shell). This way, all @magics automatically get
2859 shell expansion for variables. Thanks to a comment by Alex
2866 shell expansion for variables. Thanks to a comment by Alex
2860 Schmolck.
2867 Schmolck.
2861
2868
2862 2004-04-04 Fernando Perez <fperez@colorado.edu>
2869 2004-04-04 Fernando Perez <fperez@colorado.edu>
2863
2870
2864 * IPython/iplib.py (InteractiveShell.interact): Added a special
2871 * IPython/iplib.py (InteractiveShell.interact): Added a special
2865 trap for a debugger quit exception, which is basically impossible
2872 trap for a debugger quit exception, which is basically impossible
2866 to handle by normal mechanisms, given what pdb does to the stack.
2873 to handle by normal mechanisms, given what pdb does to the stack.
2867 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2874 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2868
2875
2869 2004-04-03 Fernando Perez <fperez@colorado.edu>
2876 2004-04-03 Fernando Perez <fperez@colorado.edu>
2870
2877
2871 * IPython/genutils.py (Term): Standardized the names of the Term
2878 * IPython/genutils.py (Term): Standardized the names of the Term
2872 class streams to cin/cout/cerr, following C++ naming conventions
2879 class streams to cin/cout/cerr, following C++ naming conventions
2873 (I can't use in/out/err because 'in' is not a valid attribute
2880 (I can't use in/out/err because 'in' is not a valid attribute
2874 name).
2881 name).
2875
2882
2876 * IPython/iplib.py (InteractiveShell.interact): don't increment
2883 * IPython/iplib.py (InteractiveShell.interact): don't increment
2877 the prompt if there's no user input. By Daniel 'Dang' Griffith
2884 the prompt if there's no user input. By Daniel 'Dang' Griffith
2878 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2885 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2879 Francois Pinard.
2886 Francois Pinard.
2880
2887
2881 2004-04-02 Fernando Perez <fperez@colorado.edu>
2888 2004-04-02 Fernando Perez <fperez@colorado.edu>
2882
2889
2883 * IPython/genutils.py (Stream.__init__): Modified to survive at
2890 * IPython/genutils.py (Stream.__init__): Modified to survive at
2884 least importing in contexts where stdin/out/err aren't true file
2891 least importing in contexts where stdin/out/err aren't true file
2885 objects, such as PyCrust (they lack fileno() and mode). However,
2892 objects, such as PyCrust (they lack fileno() and mode). However,
2886 the recovery facilities which rely on these things existing will
2893 the recovery facilities which rely on these things existing will
2887 not work.
2894 not work.
2888
2895
2889 2004-04-01 Fernando Perez <fperez@colorado.edu>
2896 2004-04-01 Fernando Perez <fperez@colorado.edu>
2890
2897
2891 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2898 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2892 use the new getoutputerror() function, so it properly
2899 use the new getoutputerror() function, so it properly
2893 distinguishes stdout/err.
2900 distinguishes stdout/err.
2894
2901
2895 * IPython/genutils.py (getoutputerror): added a function to
2902 * IPython/genutils.py (getoutputerror): added a function to
2896 capture separately the standard output and error of a command.
2903 capture separately the standard output and error of a command.
2897 After a comment from dang on the mailing lists. This code is
2904 After a comment from dang on the mailing lists. This code is
2898 basically a modified version of commands.getstatusoutput(), from
2905 basically a modified version of commands.getstatusoutput(), from
2899 the standard library.
2906 the standard library.
2900
2907
2901 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2908 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2902 '!!' as a special syntax (shorthand) to access @sx.
2909 '!!' as a special syntax (shorthand) to access @sx.
2903
2910
2904 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2911 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2905 command and return its output as a list split on '\n'.
2912 command and return its output as a list split on '\n'.
2906
2913
2907 2004-03-31 Fernando Perez <fperez@colorado.edu>
2914 2004-03-31 Fernando Perez <fperez@colorado.edu>
2908
2915
2909 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2916 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2910 method to dictionaries used as FakeModule instances if they lack
2917 method to dictionaries used as FakeModule instances if they lack
2911 it. At least pydoc in python2.3 breaks for runtime-defined
2918 it. At least pydoc in python2.3 breaks for runtime-defined
2912 functions without this hack. At some point I need to _really_
2919 functions without this hack. At some point I need to _really_
2913 understand what FakeModule is doing, because it's a gross hack.
2920 understand what FakeModule is doing, because it's a gross hack.
2914 But it solves Arnd's problem for now...
2921 But it solves Arnd's problem for now...
2915
2922
2916 2004-02-27 Fernando Perez <fperez@colorado.edu>
2923 2004-02-27 Fernando Perez <fperez@colorado.edu>
2917
2924
2918 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2925 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2919 mode would behave erratically. Also increased the number of
2926 mode would behave erratically. Also increased the number of
2920 possible logs in rotate mod to 999. Thanks to Rod Holland
2927 possible logs in rotate mod to 999. Thanks to Rod Holland
2921 <rhh@StructureLABS.com> for the report and fixes.
2928 <rhh@StructureLABS.com> for the report and fixes.
2922
2929
2923 2004-02-26 Fernando Perez <fperez@colorado.edu>
2930 2004-02-26 Fernando Perez <fperez@colorado.edu>
2924
2931
2925 * IPython/genutils.py (page): Check that the curses module really
2932 * IPython/genutils.py (page): Check that the curses module really
2926 has the initscr attribute before trying to use it. For some
2933 has the initscr attribute before trying to use it. For some
2927 reason, the Solaris curses module is missing this. I think this
2934 reason, the Solaris curses module is missing this. I think this
2928 should be considered a Solaris python bug, but I'm not sure.
2935 should be considered a Solaris python bug, but I'm not sure.
2929
2936
2930 2004-01-17 Fernando Perez <fperez@colorado.edu>
2937 2004-01-17 Fernando Perez <fperez@colorado.edu>
2931
2938
2932 * IPython/genutils.py (Stream.__init__): Changes to try to make
2939 * IPython/genutils.py (Stream.__init__): Changes to try to make
2933 ipython robust against stdin/out/err being closed by the user.
2940 ipython robust against stdin/out/err being closed by the user.
2934 This is 'user error' (and blocks a normal python session, at least
2941 This is 'user error' (and blocks a normal python session, at least
2935 the stdout case). However, Ipython should be able to survive such
2942 the stdout case). However, Ipython should be able to survive such
2936 instances of abuse as gracefully as possible. To simplify the
2943 instances of abuse as gracefully as possible. To simplify the
2937 coding and maintain compatibility with Gary Bishop's Term
2944 coding and maintain compatibility with Gary Bishop's Term
2938 contributions, I've made use of classmethods for this. I think
2945 contributions, I've made use of classmethods for this. I think
2939 this introduces a dependency on python 2.2.
2946 this introduces a dependency on python 2.2.
2940
2947
2941 2004-01-13 Fernando Perez <fperez@colorado.edu>
2948 2004-01-13 Fernando Perez <fperez@colorado.edu>
2942
2949
2943 * IPython/numutils.py (exp_safe): simplified the code a bit and
2950 * IPython/numutils.py (exp_safe): simplified the code a bit and
2944 removed the need for importing the kinds module altogether.
2951 removed the need for importing the kinds module altogether.
2945
2952
2946 2004-01-06 Fernando Perez <fperez@colorado.edu>
2953 2004-01-06 Fernando Perez <fperez@colorado.edu>
2947
2954
2948 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2955 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2949 a magic function instead, after some community feedback. No
2956 a magic function instead, after some community feedback. No
2950 special syntax will exist for it, but its name is deliberately
2957 special syntax will exist for it, but its name is deliberately
2951 very short.
2958 very short.
2952
2959
2953 2003-12-20 Fernando Perez <fperez@colorado.edu>
2960 2003-12-20 Fernando Perez <fperez@colorado.edu>
2954
2961
2955 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2962 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2956 new functionality, to automagically assign the result of a shell
2963 new functionality, to automagically assign the result of a shell
2957 command to a variable. I'll solicit some community feedback on
2964 command to a variable. I'll solicit some community feedback on
2958 this before making it permanent.
2965 this before making it permanent.
2959
2966
2960 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2967 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2961 requested about callables for which inspect couldn't obtain a
2968 requested about callables for which inspect couldn't obtain a
2962 proper argspec. Thanks to a crash report sent by Etienne
2969 proper argspec. Thanks to a crash report sent by Etienne
2963 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2970 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2964
2971
2965 2003-12-09 Fernando Perez <fperez@colorado.edu>
2972 2003-12-09 Fernando Perez <fperez@colorado.edu>
2966
2973
2967 * IPython/genutils.py (page): patch for the pager to work across
2974 * IPython/genutils.py (page): patch for the pager to work across
2968 various versions of Windows. By Gary Bishop.
2975 various versions of Windows. By Gary Bishop.
2969
2976
2970 2003-12-04 Fernando Perez <fperez@colorado.edu>
2977 2003-12-04 Fernando Perez <fperez@colorado.edu>
2971
2978
2972 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2979 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2973 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2980 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2974 While I tested this and it looks ok, there may still be corner
2981 While I tested this and it looks ok, there may still be corner
2975 cases I've missed.
2982 cases I've missed.
2976
2983
2977 2003-12-01 Fernando Perez <fperez@colorado.edu>
2984 2003-12-01 Fernando Perez <fperez@colorado.edu>
2978
2985
2979 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2986 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2980 where a line like 'p,q=1,2' would fail because the automagic
2987 where a line like 'p,q=1,2' would fail because the automagic
2981 system would be triggered for @p.
2988 system would be triggered for @p.
2982
2989
2983 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2990 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2984 cleanups, code unmodified.
2991 cleanups, code unmodified.
2985
2992
2986 * IPython/genutils.py (Term): added a class for IPython to handle
2993 * IPython/genutils.py (Term): added a class for IPython to handle
2987 output. In most cases it will just be a proxy for stdout/err, but
2994 output. In most cases it will just be a proxy for stdout/err, but
2988 having this allows modifications to be made for some platforms,
2995 having this allows modifications to be made for some platforms,
2989 such as handling color escapes under Windows. All of this code
2996 such as handling color escapes under Windows. All of this code
2990 was contributed by Gary Bishop, with minor modifications by me.
2997 was contributed by Gary Bishop, with minor modifications by me.
2991 The actual changes affect many files.
2998 The actual changes affect many files.
2992
2999
2993 2003-11-30 Fernando Perez <fperez@colorado.edu>
3000 2003-11-30 Fernando Perez <fperez@colorado.edu>
2994
3001
2995 * IPython/iplib.py (file_matches): new completion code, courtesy
3002 * IPython/iplib.py (file_matches): new completion code, courtesy
2996 of Jeff Collins. This enables filename completion again under
3003 of Jeff Collins. This enables filename completion again under
2997 python 2.3, which disabled it at the C level.
3004 python 2.3, which disabled it at the C level.
2998
3005
2999 2003-11-11 Fernando Perez <fperez@colorado.edu>
3006 2003-11-11 Fernando Perez <fperez@colorado.edu>
3000
3007
3001 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3008 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3002 for Numeric.array(map(...)), but often convenient.
3009 for Numeric.array(map(...)), but often convenient.
3003
3010
3004 2003-11-05 Fernando Perez <fperez@colorado.edu>
3011 2003-11-05 Fernando Perez <fperez@colorado.edu>
3005
3012
3006 * IPython/numutils.py (frange): Changed a call from int() to
3013 * IPython/numutils.py (frange): Changed a call from int() to
3007 int(round()) to prevent a problem reported with arange() in the
3014 int(round()) to prevent a problem reported with arange() in the
3008 numpy list.
3015 numpy list.
3009
3016
3010 2003-10-06 Fernando Perez <fperez@colorado.edu>
3017 2003-10-06 Fernando Perez <fperez@colorado.edu>
3011
3018
3012 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3019 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3013 prevent crashes if sys lacks an argv attribute (it happens with
3020 prevent crashes if sys lacks an argv attribute (it happens with
3014 embedded interpreters which build a bare-bones sys module).
3021 embedded interpreters which build a bare-bones sys module).
3015 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3022 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3016
3023
3017 2003-09-24 Fernando Perez <fperez@colorado.edu>
3024 2003-09-24 Fernando Perez <fperez@colorado.edu>
3018
3025
3019 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3026 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3020 to protect against poorly written user objects where __getattr__
3027 to protect against poorly written user objects where __getattr__
3021 raises exceptions other than AttributeError. Thanks to a bug
3028 raises exceptions other than AttributeError. Thanks to a bug
3022 report by Oliver Sander <osander-AT-gmx.de>.
3029 report by Oliver Sander <osander-AT-gmx.de>.
3023
3030
3024 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3031 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3025 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3032 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3026
3033
3027 2003-09-09 Fernando Perez <fperez@colorado.edu>
3034 2003-09-09 Fernando Perez <fperez@colorado.edu>
3028
3035
3029 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3036 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3030 unpacking a list whith a callable as first element would
3037 unpacking a list whith a callable as first element would
3031 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3038 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3032 Collins.
3039 Collins.
3033
3040
3034 2003-08-25 *** Released version 0.5.0
3041 2003-08-25 *** Released version 0.5.0
3035
3042
3036 2003-08-22 Fernando Perez <fperez@colorado.edu>
3043 2003-08-22 Fernando Perez <fperez@colorado.edu>
3037
3044
3038 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3045 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3039 improperly defined user exceptions. Thanks to feedback from Mark
3046 improperly defined user exceptions. Thanks to feedback from Mark
3040 Russell <mrussell-AT-verio.net>.
3047 Russell <mrussell-AT-verio.net>.
3041
3048
3042 2003-08-20 Fernando Perez <fperez@colorado.edu>
3049 2003-08-20 Fernando Perez <fperez@colorado.edu>
3043
3050
3044 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3051 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3045 printing so that it would print multi-line string forms starting
3052 printing so that it would print multi-line string forms starting
3046 with a new line. This way the formatting is better respected for
3053 with a new line. This way the formatting is better respected for
3047 objects which work hard to make nice string forms.
3054 objects which work hard to make nice string forms.
3048
3055
3049 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3056 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3050 autocall would overtake data access for objects with both
3057 autocall would overtake data access for objects with both
3051 __getitem__ and __call__.
3058 __getitem__ and __call__.
3052
3059
3053 2003-08-19 *** Released version 0.5.0-rc1
3060 2003-08-19 *** Released version 0.5.0-rc1
3054
3061
3055 2003-08-19 Fernando Perez <fperez@colorado.edu>
3062 2003-08-19 Fernando Perez <fperez@colorado.edu>
3056
3063
3057 * IPython/deep_reload.py (load_tail): single tiny change here
3064 * IPython/deep_reload.py (load_tail): single tiny change here
3058 seems to fix the long-standing bug of dreload() failing to work
3065 seems to fix the long-standing bug of dreload() failing to work
3059 for dotted names. But this module is pretty tricky, so I may have
3066 for dotted names. But this module is pretty tricky, so I may have
3060 missed some subtlety. Needs more testing!.
3067 missed some subtlety. Needs more testing!.
3061
3068
3062 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3069 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3063 exceptions which have badly implemented __str__ methods.
3070 exceptions which have badly implemented __str__ methods.
3064 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3071 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3065 which I've been getting reports about from Python 2.3 users. I
3072 which I've been getting reports about from Python 2.3 users. I
3066 wish I had a simple test case to reproduce the problem, so I could
3073 wish I had a simple test case to reproduce the problem, so I could
3067 either write a cleaner workaround or file a bug report if
3074 either write a cleaner workaround or file a bug report if
3068 necessary.
3075 necessary.
3069
3076
3070 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3077 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3071 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3078 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3072 a bug report by Tjabo Kloppenburg.
3079 a bug report by Tjabo Kloppenburg.
3073
3080
3074 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3081 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3075 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3082 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3076 seems rather unstable. Thanks to a bug report by Tjabo
3083 seems rather unstable. Thanks to a bug report by Tjabo
3077 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3084 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3078
3085
3079 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3086 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3080 this out soon because of the critical fixes in the inner loop for
3087 this out soon because of the critical fixes in the inner loop for
3081 generators.
3088 generators.
3082
3089
3083 * IPython/Magic.py (Magic.getargspec): removed. This (and
3090 * IPython/Magic.py (Magic.getargspec): removed. This (and
3084 _get_def) have been obsoleted by OInspect for a long time, I
3091 _get_def) have been obsoleted by OInspect for a long time, I
3085 hadn't noticed that they were dead code.
3092 hadn't noticed that they were dead code.
3086 (Magic._ofind): restored _ofind functionality for a few literals
3093 (Magic._ofind): restored _ofind functionality for a few literals
3087 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3094 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3088 for things like "hello".capitalize?, since that would require a
3095 for things like "hello".capitalize?, since that would require a
3089 potentially dangerous eval() again.
3096 potentially dangerous eval() again.
3090
3097
3091 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3098 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3092 logic a bit more to clean up the escapes handling and minimize the
3099 logic a bit more to clean up the escapes handling and minimize the
3093 use of _ofind to only necessary cases. The interactive 'feel' of
3100 use of _ofind to only necessary cases. The interactive 'feel' of
3094 IPython should have improved quite a bit with the changes in
3101 IPython should have improved quite a bit with the changes in
3095 _prefilter and _ofind (besides being far safer than before).
3102 _prefilter and _ofind (besides being far safer than before).
3096
3103
3097 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3104 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3098 obscure, never reported). Edit would fail to find the object to
3105 obscure, never reported). Edit would fail to find the object to
3099 edit under some circumstances.
3106 edit under some circumstances.
3100 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3107 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3101 which were causing double-calling of generators. Those eval calls
3108 which were causing double-calling of generators. Those eval calls
3102 were _very_ dangerous, since code with side effects could be
3109 were _very_ dangerous, since code with side effects could be
3103 triggered. As they say, 'eval is evil'... These were the
3110 triggered. As they say, 'eval is evil'... These were the
3104 nastiest evals in IPython. Besides, _ofind is now far simpler,
3111 nastiest evals in IPython. Besides, _ofind is now far simpler,
3105 and it should also be quite a bit faster. Its use of inspect is
3112 and it should also be quite a bit faster. Its use of inspect is
3106 also safer, so perhaps some of the inspect-related crashes I've
3113 also safer, so perhaps some of the inspect-related crashes I've
3107 seen lately with Python 2.3 might be taken care of. That will
3114 seen lately with Python 2.3 might be taken care of. That will
3108 need more testing.
3115 need more testing.
3109
3116
3110 2003-08-17 Fernando Perez <fperez@colorado.edu>
3117 2003-08-17 Fernando Perez <fperez@colorado.edu>
3111
3118
3112 * IPython/iplib.py (InteractiveShell._prefilter): significant
3119 * IPython/iplib.py (InteractiveShell._prefilter): significant
3113 simplifications to the logic for handling user escapes. Faster
3120 simplifications to the logic for handling user escapes. Faster
3114 and simpler code.
3121 and simpler code.
3115
3122
3116 2003-08-14 Fernando Perez <fperez@colorado.edu>
3123 2003-08-14 Fernando Perez <fperez@colorado.edu>
3117
3124
3118 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3125 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3119 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3126 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3120 but it should be quite a bit faster. And the recursive version
3127 but it should be quite a bit faster. And the recursive version
3121 generated O(log N) intermediate storage for all rank>1 arrays,
3128 generated O(log N) intermediate storage for all rank>1 arrays,
3122 even if they were contiguous.
3129 even if they were contiguous.
3123 (l1norm): Added this function.
3130 (l1norm): Added this function.
3124 (norm): Added this function for arbitrary norms (including
3131 (norm): Added this function for arbitrary norms (including
3125 l-infinity). l1 and l2 are still special cases for convenience
3132 l-infinity). l1 and l2 are still special cases for convenience
3126 and speed.
3133 and speed.
3127
3134
3128 2003-08-03 Fernando Perez <fperez@colorado.edu>
3135 2003-08-03 Fernando Perez <fperez@colorado.edu>
3129
3136
3130 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3137 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3131 exceptions, which now raise PendingDeprecationWarnings in Python
3138 exceptions, which now raise PendingDeprecationWarnings in Python
3132 2.3. There were some in Magic and some in Gnuplot2.
3139 2.3. There were some in Magic and some in Gnuplot2.
3133
3140
3134 2003-06-30 Fernando Perez <fperez@colorado.edu>
3141 2003-06-30 Fernando Perez <fperez@colorado.edu>
3135
3142
3136 * IPython/genutils.py (page): modified to call curses only for
3143 * IPython/genutils.py (page): modified to call curses only for
3137 terminals where TERM=='xterm'. After problems under many other
3144 terminals where TERM=='xterm'. After problems under many other
3138 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3145 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3139
3146
3140 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3147 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3141 would be triggered when readline was absent. This was just an old
3148 would be triggered when readline was absent. This was just an old
3142 debugging statement I'd forgotten to take out.
3149 debugging statement I'd forgotten to take out.
3143
3150
3144 2003-06-20 Fernando Perez <fperez@colorado.edu>
3151 2003-06-20 Fernando Perez <fperez@colorado.edu>
3145
3152
3146 * IPython/genutils.py (clock): modified to return only user time
3153 * IPython/genutils.py (clock): modified to return only user time
3147 (not counting system time), after a discussion on scipy. While
3154 (not counting system time), after a discussion on scipy. While
3148 system time may be a useful quantity occasionally, it may much
3155 system time may be a useful quantity occasionally, it may much
3149 more easily be skewed by occasional swapping or other similar
3156 more easily be skewed by occasional swapping or other similar
3150 activity.
3157 activity.
3151
3158
3152 2003-06-05 Fernando Perez <fperez@colorado.edu>
3159 2003-06-05 Fernando Perez <fperez@colorado.edu>
3153
3160
3154 * IPython/numutils.py (identity): new function, for building
3161 * IPython/numutils.py (identity): new function, for building
3155 arbitrary rank Kronecker deltas (mostly backwards compatible with
3162 arbitrary rank Kronecker deltas (mostly backwards compatible with
3156 Numeric.identity)
3163 Numeric.identity)
3157
3164
3158 2003-06-03 Fernando Perez <fperez@colorado.edu>
3165 2003-06-03 Fernando Perez <fperez@colorado.edu>
3159
3166
3160 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3167 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3161 arguments passed to magics with spaces, to allow trailing '\' to
3168 arguments passed to magics with spaces, to allow trailing '\' to
3162 work normally (mainly for Windows users).
3169 work normally (mainly for Windows users).
3163
3170
3164 2003-05-29 Fernando Perez <fperez@colorado.edu>
3171 2003-05-29 Fernando Perez <fperez@colorado.edu>
3165
3172
3166 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3173 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3167 instead of pydoc.help. This fixes a bizarre behavior where
3174 instead of pydoc.help. This fixes a bizarre behavior where
3168 printing '%s' % locals() would trigger the help system. Now
3175 printing '%s' % locals() would trigger the help system. Now
3169 ipython behaves like normal python does.
3176 ipython behaves like normal python does.
3170
3177
3171 Note that if one does 'from pydoc import help', the bizarre
3178 Note that if one does 'from pydoc import help', the bizarre
3172 behavior returns, but this will also happen in normal python, so
3179 behavior returns, but this will also happen in normal python, so
3173 it's not an ipython bug anymore (it has to do with how pydoc.help
3180 it's not an ipython bug anymore (it has to do with how pydoc.help
3174 is implemented).
3181 is implemented).
3175
3182
3176 2003-05-22 Fernando Perez <fperez@colorado.edu>
3183 2003-05-22 Fernando Perez <fperez@colorado.edu>
3177
3184
3178 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3185 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3179 return [] instead of None when nothing matches, also match to end
3186 return [] instead of None when nothing matches, also match to end
3180 of line. Patch by Gary Bishop.
3187 of line. Patch by Gary Bishop.
3181
3188
3182 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3189 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3183 protection as before, for files passed on the command line. This
3190 protection as before, for files passed on the command line. This
3184 prevents the CrashHandler from kicking in if user files call into
3191 prevents the CrashHandler from kicking in if user files call into
3185 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3192 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3186 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3193 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3187
3194
3188 2003-05-20 *** Released version 0.4.0
3195 2003-05-20 *** Released version 0.4.0
3189
3196
3190 2003-05-20 Fernando Perez <fperez@colorado.edu>
3197 2003-05-20 Fernando Perez <fperez@colorado.edu>
3191
3198
3192 * setup.py: added support for manpages. It's a bit hackish b/c of
3199 * setup.py: added support for manpages. It's a bit hackish b/c of
3193 a bug in the way the bdist_rpm distutils target handles gzipped
3200 a bug in the way the bdist_rpm distutils target handles gzipped
3194 manpages, but it works. After a patch by Jack.
3201 manpages, but it works. After a patch by Jack.
3195
3202
3196 2003-05-19 Fernando Perez <fperez@colorado.edu>
3203 2003-05-19 Fernando Perez <fperez@colorado.edu>
3197
3204
3198 * IPython/numutils.py: added a mockup of the kinds module, since
3205 * IPython/numutils.py: added a mockup of the kinds module, since
3199 it was recently removed from Numeric. This way, numutils will
3206 it was recently removed from Numeric. This way, numutils will
3200 work for all users even if they are missing kinds.
3207 work for all users even if they are missing kinds.
3201
3208
3202 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3209 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3203 failure, which can occur with SWIG-wrapped extensions. After a
3210 failure, which can occur with SWIG-wrapped extensions. After a
3204 crash report from Prabhu.
3211 crash report from Prabhu.
3205
3212
3206 2003-05-16 Fernando Perez <fperez@colorado.edu>
3213 2003-05-16 Fernando Perez <fperez@colorado.edu>
3207
3214
3208 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3215 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3209 protect ipython from user code which may call directly
3216 protect ipython from user code which may call directly
3210 sys.excepthook (this looks like an ipython crash to the user, even
3217 sys.excepthook (this looks like an ipython crash to the user, even
3211 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3218 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3212 This is especially important to help users of WxWindows, but may
3219 This is especially important to help users of WxWindows, but may
3213 also be useful in other cases.
3220 also be useful in other cases.
3214
3221
3215 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3222 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3216 an optional tb_offset to be specified, and to preserve exception
3223 an optional tb_offset to be specified, and to preserve exception
3217 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3224 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3218
3225
3219 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3226 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3220
3227
3221 2003-05-15 Fernando Perez <fperez@colorado.edu>
3228 2003-05-15 Fernando Perez <fperez@colorado.edu>
3222
3229
3223 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3230 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3224 installing for a new user under Windows.
3231 installing for a new user under Windows.
3225
3232
3226 2003-05-12 Fernando Perez <fperez@colorado.edu>
3233 2003-05-12 Fernando Perez <fperez@colorado.edu>
3227
3234
3228 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3235 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3229 handler for Emacs comint-based lines. Currently it doesn't do
3236 handler for Emacs comint-based lines. Currently it doesn't do
3230 much (but importantly, it doesn't update the history cache). In
3237 much (but importantly, it doesn't update the history cache). In
3231 the future it may be expanded if Alex needs more functionality
3238 the future it may be expanded if Alex needs more functionality
3232 there.
3239 there.
3233
3240
3234 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3241 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3235 info to crash reports.
3242 info to crash reports.
3236
3243
3237 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3244 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3238 just like Python's -c. Also fixed crash with invalid -color
3245 just like Python's -c. Also fixed crash with invalid -color
3239 option value at startup. Thanks to Will French
3246 option value at startup. Thanks to Will French
3240 <wfrench-AT-bestweb.net> for the bug report.
3247 <wfrench-AT-bestweb.net> for the bug report.
3241
3248
3242 2003-05-09 Fernando Perez <fperez@colorado.edu>
3249 2003-05-09 Fernando Perez <fperez@colorado.edu>
3243
3250
3244 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3251 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3245 to EvalDict (it's a mapping, after all) and simplified its code
3252 to EvalDict (it's a mapping, after all) and simplified its code
3246 quite a bit, after a nice discussion on c.l.py where Gustavo
3253 quite a bit, after a nice discussion on c.l.py where Gustavo
3247 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3254 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3248
3255
3249 2003-04-30 Fernando Perez <fperez@colorado.edu>
3256 2003-04-30 Fernando Perez <fperez@colorado.edu>
3250
3257
3251 * IPython/genutils.py (timings_out): modified it to reduce its
3258 * IPython/genutils.py (timings_out): modified it to reduce its
3252 overhead in the common reps==1 case.
3259 overhead in the common reps==1 case.
3253
3260
3254 2003-04-29 Fernando Perez <fperez@colorado.edu>
3261 2003-04-29 Fernando Perez <fperez@colorado.edu>
3255
3262
3256 * IPython/genutils.py (timings_out): Modified to use the resource
3263 * IPython/genutils.py (timings_out): Modified to use the resource
3257 module, which avoids the wraparound problems of time.clock().
3264 module, which avoids the wraparound problems of time.clock().
3258
3265
3259 2003-04-17 *** Released version 0.2.15pre4
3266 2003-04-17 *** Released version 0.2.15pre4
3260
3267
3261 2003-04-17 Fernando Perez <fperez@colorado.edu>
3268 2003-04-17 Fernando Perez <fperez@colorado.edu>
3262
3269
3263 * setup.py (scriptfiles): Split windows-specific stuff over to a
3270 * setup.py (scriptfiles): Split windows-specific stuff over to a
3264 separate file, in an attempt to have a Windows GUI installer.
3271 separate file, in an attempt to have a Windows GUI installer.
3265 That didn't work, but part of the groundwork is done.
3272 That didn't work, but part of the groundwork is done.
3266
3273
3267 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3274 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3268 indent/unindent with 4 spaces. Particularly useful in combination
3275 indent/unindent with 4 spaces. Particularly useful in combination
3269 with the new auto-indent option.
3276 with the new auto-indent option.
3270
3277
3271 2003-04-16 Fernando Perez <fperez@colorado.edu>
3278 2003-04-16 Fernando Perez <fperez@colorado.edu>
3272
3279
3273 * IPython/Magic.py: various replacements of self.rc for
3280 * IPython/Magic.py: various replacements of self.rc for
3274 self.shell.rc. A lot more remains to be done to fully disentangle
3281 self.shell.rc. A lot more remains to be done to fully disentangle
3275 this class from the main Shell class.
3282 this class from the main Shell class.
3276
3283
3277 * IPython/GnuplotRuntime.py: added checks for mouse support so
3284 * IPython/GnuplotRuntime.py: added checks for mouse support so
3278 that we don't try to enable it if the current gnuplot doesn't
3285 that we don't try to enable it if the current gnuplot doesn't
3279 really support it. Also added checks so that we don't try to
3286 really support it. Also added checks so that we don't try to
3280 enable persist under Windows (where Gnuplot doesn't recognize the
3287 enable persist under Windows (where Gnuplot doesn't recognize the
3281 option).
3288 option).
3282
3289
3283 * IPython/iplib.py (InteractiveShell.interact): Added optional
3290 * IPython/iplib.py (InteractiveShell.interact): Added optional
3284 auto-indenting code, after a patch by King C. Shu
3291 auto-indenting code, after a patch by King C. Shu
3285 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3292 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3286 get along well with pasting indented code. If I ever figure out
3293 get along well with pasting indented code. If I ever figure out
3287 how to make that part go well, it will become on by default.
3294 how to make that part go well, it will become on by default.
3288
3295
3289 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3296 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3290 crash ipython if there was an unmatched '%' in the user's prompt
3297 crash ipython if there was an unmatched '%' in the user's prompt
3291 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3298 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3292
3299
3293 * IPython/iplib.py (InteractiveShell.interact): removed the
3300 * IPython/iplib.py (InteractiveShell.interact): removed the
3294 ability to ask the user whether he wants to crash or not at the
3301 ability to ask the user whether he wants to crash or not at the
3295 'last line' exception handler. Calling functions at that point
3302 'last line' exception handler. Calling functions at that point
3296 changes the stack, and the error reports would have incorrect
3303 changes the stack, and the error reports would have incorrect
3297 tracebacks.
3304 tracebacks.
3298
3305
3299 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3306 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3300 pass through a peger a pretty-printed form of any object. After a
3307 pass through a peger a pretty-printed form of any object. After a
3301 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3308 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3302
3309
3303 2003-04-14 Fernando Perez <fperez@colorado.edu>
3310 2003-04-14 Fernando Perez <fperez@colorado.edu>
3304
3311
3305 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3312 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3306 all files in ~ would be modified at first install (instead of
3313 all files in ~ would be modified at first install (instead of
3307 ~/.ipython). This could be potentially disastrous, as the
3314 ~/.ipython). This could be potentially disastrous, as the
3308 modification (make line-endings native) could damage binary files.
3315 modification (make line-endings native) could damage binary files.
3309
3316
3310 2003-04-10 Fernando Perez <fperez@colorado.edu>
3317 2003-04-10 Fernando Perez <fperez@colorado.edu>
3311
3318
3312 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3319 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3313 handle only lines which are invalid python. This now means that
3320 handle only lines which are invalid python. This now means that
3314 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3321 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3315 for the bug report.
3322 for the bug report.
3316
3323
3317 2003-04-01 Fernando Perez <fperez@colorado.edu>
3324 2003-04-01 Fernando Perez <fperez@colorado.edu>
3318
3325
3319 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3326 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3320 where failing to set sys.last_traceback would crash pdb.pm().
3327 where failing to set sys.last_traceback would crash pdb.pm().
3321 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3328 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3322 report.
3329 report.
3323
3330
3324 2003-03-25 Fernando Perez <fperez@colorado.edu>
3331 2003-03-25 Fernando Perez <fperez@colorado.edu>
3325
3332
3326 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3333 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3327 before printing it (it had a lot of spurious blank lines at the
3334 before printing it (it had a lot of spurious blank lines at the
3328 end).
3335 end).
3329
3336
3330 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3337 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3331 output would be sent 21 times! Obviously people don't use this
3338 output would be sent 21 times! Obviously people don't use this
3332 too often, or I would have heard about it.
3339 too often, or I would have heard about it.
3333
3340
3334 2003-03-24 Fernando Perez <fperez@colorado.edu>
3341 2003-03-24 Fernando Perez <fperez@colorado.edu>
3335
3342
3336 * setup.py (scriptfiles): renamed the data_files parameter from
3343 * setup.py (scriptfiles): renamed the data_files parameter from
3337 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3344 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3338 for the patch.
3345 for the patch.
3339
3346
3340 2003-03-20 Fernando Perez <fperez@colorado.edu>
3347 2003-03-20 Fernando Perez <fperez@colorado.edu>
3341
3348
3342 * IPython/genutils.py (error): added error() and fatal()
3349 * IPython/genutils.py (error): added error() and fatal()
3343 functions.
3350 functions.
3344
3351
3345 2003-03-18 *** Released version 0.2.15pre3
3352 2003-03-18 *** Released version 0.2.15pre3
3346
3353
3347 2003-03-18 Fernando Perez <fperez@colorado.edu>
3354 2003-03-18 Fernando Perez <fperez@colorado.edu>
3348
3355
3349 * setupext/install_data_ext.py
3356 * setupext/install_data_ext.py
3350 (install_data_ext.initialize_options): Class contributed by Jack
3357 (install_data_ext.initialize_options): Class contributed by Jack
3351 Moffit for fixing the old distutils hack. He is sending this to
3358 Moffit for fixing the old distutils hack. He is sending this to
3352 the distutils folks so in the future we may not need it as a
3359 the distutils folks so in the future we may not need it as a
3353 private fix.
3360 private fix.
3354
3361
3355 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3362 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3356 changes for Debian packaging. See his patch for full details.
3363 changes for Debian packaging. See his patch for full details.
3357 The old distutils hack of making the ipythonrc* files carry a
3364 The old distutils hack of making the ipythonrc* files carry a
3358 bogus .py extension is gone, at last. Examples were moved to a
3365 bogus .py extension is gone, at last. Examples were moved to a
3359 separate subdir under doc/, and the separate executable scripts
3366 separate subdir under doc/, and the separate executable scripts
3360 now live in their own directory. Overall a great cleanup. The
3367 now live in their own directory. Overall a great cleanup. The
3361 manual was updated to use the new files, and setup.py has been
3368 manual was updated to use the new files, and setup.py has been
3362 fixed for this setup.
3369 fixed for this setup.
3363
3370
3364 * IPython/PyColorize.py (Parser.usage): made non-executable and
3371 * IPython/PyColorize.py (Parser.usage): made non-executable and
3365 created a pycolor wrapper around it to be included as a script.
3372 created a pycolor wrapper around it to be included as a script.
3366
3373
3367 2003-03-12 *** Released version 0.2.15pre2
3374 2003-03-12 *** Released version 0.2.15pre2
3368
3375
3369 2003-03-12 Fernando Perez <fperez@colorado.edu>
3376 2003-03-12 Fernando Perez <fperez@colorado.edu>
3370
3377
3371 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3378 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3372 long-standing problem with garbage characters in some terminals.
3379 long-standing problem with garbage characters in some terminals.
3373 The issue was really that the \001 and \002 escapes must _only_ be
3380 The issue was really that the \001 and \002 escapes must _only_ be
3374 passed to input prompts (which call readline), but _never_ to
3381 passed to input prompts (which call readline), but _never_ to
3375 normal text to be printed on screen. I changed ColorANSI to have
3382 normal text to be printed on screen. I changed ColorANSI to have
3376 two classes: TermColors and InputTermColors, each with the
3383 two classes: TermColors and InputTermColors, each with the
3377 appropriate escapes for input prompts or normal text. The code in
3384 appropriate escapes for input prompts or normal text. The code in
3378 Prompts.py got slightly more complicated, but this very old and
3385 Prompts.py got slightly more complicated, but this very old and
3379 annoying bug is finally fixed.
3386 annoying bug is finally fixed.
3380
3387
3381 All the credit for nailing down the real origin of this problem
3388 All the credit for nailing down the real origin of this problem
3382 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3389 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3383 *Many* thanks to him for spending quite a bit of effort on this.
3390 *Many* thanks to him for spending quite a bit of effort on this.
3384
3391
3385 2003-03-05 *** Released version 0.2.15pre1
3392 2003-03-05 *** Released version 0.2.15pre1
3386
3393
3387 2003-03-03 Fernando Perez <fperez@colorado.edu>
3394 2003-03-03 Fernando Perez <fperez@colorado.edu>
3388
3395
3389 * IPython/FakeModule.py: Moved the former _FakeModule to a
3396 * IPython/FakeModule.py: Moved the former _FakeModule to a
3390 separate file, because it's also needed by Magic (to fix a similar
3397 separate file, because it's also needed by Magic (to fix a similar
3391 pickle-related issue in @run).
3398 pickle-related issue in @run).
3392
3399
3393 2003-03-02 Fernando Perez <fperez@colorado.edu>
3400 2003-03-02 Fernando Perez <fperez@colorado.edu>
3394
3401
3395 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3402 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3396 the autocall option at runtime.
3403 the autocall option at runtime.
3397 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3404 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3398 across Magic.py to start separating Magic from InteractiveShell.
3405 across Magic.py to start separating Magic from InteractiveShell.
3399 (Magic._ofind): Fixed to return proper namespace for dotted
3406 (Magic._ofind): Fixed to return proper namespace for dotted
3400 names. Before, a dotted name would always return 'not currently
3407 names. Before, a dotted name would always return 'not currently
3401 defined', because it would find the 'parent'. s.x would be found,
3408 defined', because it would find the 'parent'. s.x would be found,
3402 but since 'x' isn't defined by itself, it would get confused.
3409 but since 'x' isn't defined by itself, it would get confused.
3403 (Magic.magic_run): Fixed pickling problems reported by Ralf
3410 (Magic.magic_run): Fixed pickling problems reported by Ralf
3404 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3411 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3405 that I'd used when Mike Heeter reported similar issues at the
3412 that I'd used when Mike Heeter reported similar issues at the
3406 top-level, but now for @run. It boils down to injecting the
3413 top-level, but now for @run. It boils down to injecting the
3407 namespace where code is being executed with something that looks
3414 namespace where code is being executed with something that looks
3408 enough like a module to fool pickle.dump(). Since a pickle stores
3415 enough like a module to fool pickle.dump(). Since a pickle stores
3409 a named reference to the importing module, we need this for
3416 a named reference to the importing module, we need this for
3410 pickles to save something sensible.
3417 pickles to save something sensible.
3411
3418
3412 * IPython/ipmaker.py (make_IPython): added an autocall option.
3419 * IPython/ipmaker.py (make_IPython): added an autocall option.
3413
3420
3414 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3421 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3415 the auto-eval code. Now autocalling is an option, and the code is
3422 the auto-eval code. Now autocalling is an option, and the code is
3416 also vastly safer. There is no more eval() involved at all.
3423 also vastly safer. There is no more eval() involved at all.
3417
3424
3418 2003-03-01 Fernando Perez <fperez@colorado.edu>
3425 2003-03-01 Fernando Perez <fperez@colorado.edu>
3419
3426
3420 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3427 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3421 dict with named keys instead of a tuple.
3428 dict with named keys instead of a tuple.
3422
3429
3423 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3430 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3424
3431
3425 * setup.py (make_shortcut): Fixed message about directories
3432 * setup.py (make_shortcut): Fixed message about directories
3426 created during Windows installation (the directories were ok, just
3433 created during Windows installation (the directories were ok, just
3427 the printed message was misleading). Thanks to Chris Liechti
3434 the printed message was misleading). Thanks to Chris Liechti
3428 <cliechti-AT-gmx.net> for the heads up.
3435 <cliechti-AT-gmx.net> for the heads up.
3429
3436
3430 2003-02-21 Fernando Perez <fperez@colorado.edu>
3437 2003-02-21 Fernando Perez <fperez@colorado.edu>
3431
3438
3432 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3439 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3433 of ValueError exception when checking for auto-execution. This
3440 of ValueError exception when checking for auto-execution. This
3434 one is raised by things like Numeric arrays arr.flat when the
3441 one is raised by things like Numeric arrays arr.flat when the
3435 array is non-contiguous.
3442 array is non-contiguous.
3436
3443
3437 2003-01-31 Fernando Perez <fperez@colorado.edu>
3444 2003-01-31 Fernando Perez <fperez@colorado.edu>
3438
3445
3439 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3446 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3440 not return any value at all (even though the command would get
3447 not return any value at all (even though the command would get
3441 executed).
3448 executed).
3442 (xsys): Flush stdout right after printing the command to ensure
3449 (xsys): Flush stdout right after printing the command to ensure
3443 proper ordering of commands and command output in the total
3450 proper ordering of commands and command output in the total
3444 output.
3451 output.
3445 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3452 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3446 system/getoutput as defaults. The old ones are kept for
3453 system/getoutput as defaults. The old ones are kept for
3447 compatibility reasons, so no code which uses this library needs
3454 compatibility reasons, so no code which uses this library needs
3448 changing.
3455 changing.
3449
3456
3450 2003-01-27 *** Released version 0.2.14
3457 2003-01-27 *** Released version 0.2.14
3451
3458
3452 2003-01-25 Fernando Perez <fperez@colorado.edu>
3459 2003-01-25 Fernando Perez <fperez@colorado.edu>
3453
3460
3454 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3461 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3455 functions defined in previous edit sessions could not be re-edited
3462 functions defined in previous edit sessions could not be re-edited
3456 (because the temp files were immediately removed). Now temp files
3463 (because the temp files were immediately removed). Now temp files
3457 are removed only at IPython's exit.
3464 are removed only at IPython's exit.
3458 (Magic.magic_run): Improved @run to perform shell-like expansions
3465 (Magic.magic_run): Improved @run to perform shell-like expansions
3459 on its arguments (~users and $VARS). With this, @run becomes more
3466 on its arguments (~users and $VARS). With this, @run becomes more
3460 like a normal command-line.
3467 like a normal command-line.
3461
3468
3462 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3469 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3463 bugs related to embedding and cleaned up that code. A fairly
3470 bugs related to embedding and cleaned up that code. A fairly
3464 important one was the impossibility to access the global namespace
3471 important one was the impossibility to access the global namespace
3465 through the embedded IPython (only local variables were visible).
3472 through the embedded IPython (only local variables were visible).
3466
3473
3467 2003-01-14 Fernando Perez <fperez@colorado.edu>
3474 2003-01-14 Fernando Perez <fperez@colorado.edu>
3468
3475
3469 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3476 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3470 auto-calling to be a bit more conservative. Now it doesn't get
3477 auto-calling to be a bit more conservative. Now it doesn't get
3471 triggered if any of '!=()<>' are in the rest of the input line, to
3478 triggered if any of '!=()<>' are in the rest of the input line, to
3472 allow comparing callables. Thanks to Alex for the heads up.
3479 allow comparing callables. Thanks to Alex for the heads up.
3473
3480
3474 2003-01-07 Fernando Perez <fperez@colorado.edu>
3481 2003-01-07 Fernando Perez <fperez@colorado.edu>
3475
3482
3476 * IPython/genutils.py (page): fixed estimation of the number of
3483 * IPython/genutils.py (page): fixed estimation of the number of
3477 lines in a string to be paged to simply count newlines. This
3484 lines in a string to be paged to simply count newlines. This
3478 prevents over-guessing due to embedded escape sequences. A better
3485 prevents over-guessing due to embedded escape sequences. A better
3479 long-term solution would involve stripping out the control chars
3486 long-term solution would involve stripping out the control chars
3480 for the count, but it's potentially so expensive I just don't
3487 for the count, but it's potentially so expensive I just don't
3481 think it's worth doing.
3488 think it's worth doing.
3482
3489
3483 2002-12-19 *** Released version 0.2.14pre50
3490 2002-12-19 *** Released version 0.2.14pre50
3484
3491
3485 2002-12-19 Fernando Perez <fperez@colorado.edu>
3492 2002-12-19 Fernando Perez <fperez@colorado.edu>
3486
3493
3487 * tools/release (version): Changed release scripts to inform
3494 * tools/release (version): Changed release scripts to inform
3488 Andrea and build a NEWS file with a list of recent changes.
3495 Andrea and build a NEWS file with a list of recent changes.
3489
3496
3490 * IPython/ColorANSI.py (__all__): changed terminal detection
3497 * IPython/ColorANSI.py (__all__): changed terminal detection
3491 code. Seems to work better for xterms without breaking
3498 code. Seems to work better for xterms without breaking
3492 konsole. Will need more testing to determine if WinXP and Mac OSX
3499 konsole. Will need more testing to determine if WinXP and Mac OSX
3493 also work ok.
3500 also work ok.
3494
3501
3495 2002-12-18 *** Released version 0.2.14pre49
3502 2002-12-18 *** Released version 0.2.14pre49
3496
3503
3497 2002-12-18 Fernando Perez <fperez@colorado.edu>
3504 2002-12-18 Fernando Perez <fperez@colorado.edu>
3498
3505
3499 * Docs: added new info about Mac OSX, from Andrea.
3506 * Docs: added new info about Mac OSX, from Andrea.
3500
3507
3501 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3508 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3502 allow direct plotting of python strings whose format is the same
3509 allow direct plotting of python strings whose format is the same
3503 of gnuplot data files.
3510 of gnuplot data files.
3504
3511
3505 2002-12-16 Fernando Perez <fperez@colorado.edu>
3512 2002-12-16 Fernando Perez <fperez@colorado.edu>
3506
3513
3507 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3514 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3508 value of exit question to be acknowledged.
3515 value of exit question to be acknowledged.
3509
3516
3510 2002-12-03 Fernando Perez <fperez@colorado.edu>
3517 2002-12-03 Fernando Perez <fperez@colorado.edu>
3511
3518
3512 * IPython/ipmaker.py: removed generators, which had been added
3519 * IPython/ipmaker.py: removed generators, which had been added
3513 by mistake in an earlier debugging run. This was causing trouble
3520 by mistake in an earlier debugging run. This was causing trouble
3514 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3521 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3515 for pointing this out.
3522 for pointing this out.
3516
3523
3517 2002-11-17 Fernando Perez <fperez@colorado.edu>
3524 2002-11-17 Fernando Perez <fperez@colorado.edu>
3518
3525
3519 * Manual: updated the Gnuplot section.
3526 * Manual: updated the Gnuplot section.
3520
3527
3521 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3528 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3522 a much better split of what goes in Runtime and what goes in
3529 a much better split of what goes in Runtime and what goes in
3523 Interactive.
3530 Interactive.
3524
3531
3525 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3532 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3526 being imported from iplib.
3533 being imported from iplib.
3527
3534
3528 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3535 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3529 for command-passing. Now the global Gnuplot instance is called
3536 for command-passing. Now the global Gnuplot instance is called
3530 'gp' instead of 'g', which was really a far too fragile and
3537 'gp' instead of 'g', which was really a far too fragile and
3531 common name.
3538 common name.
3532
3539
3533 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3540 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3534 bounding boxes generated by Gnuplot for square plots.
3541 bounding boxes generated by Gnuplot for square plots.
3535
3542
3536 * IPython/genutils.py (popkey): new function added. I should
3543 * IPython/genutils.py (popkey): new function added. I should
3537 suggest this on c.l.py as a dict method, it seems useful.
3544 suggest this on c.l.py as a dict method, it seems useful.
3538
3545
3539 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3546 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3540 to transparently handle PostScript generation. MUCH better than
3547 to transparently handle PostScript generation. MUCH better than
3541 the previous plot_eps/replot_eps (which I removed now). The code
3548 the previous plot_eps/replot_eps (which I removed now). The code
3542 is also fairly clean and well documented now (including
3549 is also fairly clean and well documented now (including
3543 docstrings).
3550 docstrings).
3544
3551
3545 2002-11-13 Fernando Perez <fperez@colorado.edu>
3552 2002-11-13 Fernando Perez <fperez@colorado.edu>
3546
3553
3547 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3554 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3548 (inconsistent with options).
3555 (inconsistent with options).
3549
3556
3550 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3557 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3551 manually disabled, I don't know why. Fixed it.
3558 manually disabled, I don't know why. Fixed it.
3552 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3559 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3553 eps output.
3560 eps output.
3554
3561
3555 2002-11-12 Fernando Perez <fperez@colorado.edu>
3562 2002-11-12 Fernando Perez <fperez@colorado.edu>
3556
3563
3557 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3564 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3558 don't propagate up to caller. Fixes crash reported by François
3565 don't propagate up to caller. Fixes crash reported by François
3559 Pinard.
3566 Pinard.
3560
3567
3561 2002-11-09 Fernando Perez <fperez@colorado.edu>
3568 2002-11-09 Fernando Perez <fperez@colorado.edu>
3562
3569
3563 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3570 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3564 history file for new users.
3571 history file for new users.
3565 (make_IPython): fixed bug where initial install would leave the
3572 (make_IPython): fixed bug where initial install would leave the
3566 user running in the .ipython dir.
3573 user running in the .ipython dir.
3567 (make_IPython): fixed bug where config dir .ipython would be
3574 (make_IPython): fixed bug where config dir .ipython would be
3568 created regardless of the given -ipythondir option. Thanks to Cory
3575 created regardless of the given -ipythondir option. Thanks to Cory
3569 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3576 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3570
3577
3571 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3578 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3572 type confirmations. Will need to use it in all of IPython's code
3579 type confirmations. Will need to use it in all of IPython's code
3573 consistently.
3580 consistently.
3574
3581
3575 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3582 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3576 context to print 31 lines instead of the default 5. This will make
3583 context to print 31 lines instead of the default 5. This will make
3577 the crash reports extremely detailed in case the problem is in
3584 the crash reports extremely detailed in case the problem is in
3578 libraries I don't have access to.
3585 libraries I don't have access to.
3579
3586
3580 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3587 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3581 line of defense' code to still crash, but giving users fair
3588 line of defense' code to still crash, but giving users fair
3582 warning. I don't want internal errors to go unreported: if there's
3589 warning. I don't want internal errors to go unreported: if there's
3583 an internal problem, IPython should crash and generate a full
3590 an internal problem, IPython should crash and generate a full
3584 report.
3591 report.
3585
3592
3586 2002-11-08 Fernando Perez <fperez@colorado.edu>
3593 2002-11-08 Fernando Perez <fperez@colorado.edu>
3587
3594
3588 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3595 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3589 otherwise uncaught exceptions which can appear if people set
3596 otherwise uncaught exceptions which can appear if people set
3590 sys.stdout to something badly broken. Thanks to a crash report
3597 sys.stdout to something badly broken. Thanks to a crash report
3591 from henni-AT-mail.brainbot.com.
3598 from henni-AT-mail.brainbot.com.
3592
3599
3593 2002-11-04 Fernando Perez <fperez@colorado.edu>
3600 2002-11-04 Fernando Perez <fperez@colorado.edu>
3594
3601
3595 * IPython/iplib.py (InteractiveShell.interact): added
3602 * IPython/iplib.py (InteractiveShell.interact): added
3596 __IPYTHON__active to the builtins. It's a flag which goes on when
3603 __IPYTHON__active to the builtins. It's a flag which goes on when
3597 the interaction starts and goes off again when it stops. This
3604 the interaction starts and goes off again when it stops. This
3598 allows embedding code to detect being inside IPython. Before this
3605 allows embedding code to detect being inside IPython. Before this
3599 was done via __IPYTHON__, but that only shows that an IPython
3606 was done via __IPYTHON__, but that only shows that an IPython
3600 instance has been created.
3607 instance has been created.
3601
3608
3602 * IPython/Magic.py (Magic.magic_env): I realized that in a
3609 * IPython/Magic.py (Magic.magic_env): I realized that in a
3603 UserDict, instance.data holds the data as a normal dict. So I
3610 UserDict, instance.data holds the data as a normal dict. So I
3604 modified @env to return os.environ.data instead of rebuilding a
3611 modified @env to return os.environ.data instead of rebuilding a
3605 dict by hand.
3612 dict by hand.
3606
3613
3607 2002-11-02 Fernando Perez <fperez@colorado.edu>
3614 2002-11-02 Fernando Perez <fperez@colorado.edu>
3608
3615
3609 * IPython/genutils.py (warn): changed so that level 1 prints no
3616 * IPython/genutils.py (warn): changed so that level 1 prints no
3610 header. Level 2 is now the default (with 'WARNING' header, as
3617 header. Level 2 is now the default (with 'WARNING' header, as
3611 before). I think I tracked all places where changes were needed in
3618 before). I think I tracked all places where changes were needed in
3612 IPython, but outside code using the old level numbering may have
3619 IPython, but outside code using the old level numbering may have
3613 broken.
3620 broken.
3614
3621
3615 * IPython/iplib.py (InteractiveShell.runcode): added this to
3622 * IPython/iplib.py (InteractiveShell.runcode): added this to
3616 handle the tracebacks in SystemExit traps correctly. The previous
3623 handle the tracebacks in SystemExit traps correctly. The previous
3617 code (through interact) was printing more of the stack than
3624 code (through interact) was printing more of the stack than
3618 necessary, showing IPython internal code to the user.
3625 necessary, showing IPython internal code to the user.
3619
3626
3620 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3627 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3621 default. Now that the default at the confirmation prompt is yes,
3628 default. Now that the default at the confirmation prompt is yes,
3622 it's not so intrusive. François' argument that ipython sessions
3629 it's not so intrusive. François' argument that ipython sessions
3623 tend to be complex enough not to lose them from an accidental C-d,
3630 tend to be complex enough not to lose them from an accidental C-d,
3624 is a valid one.
3631 is a valid one.
3625
3632
3626 * IPython/iplib.py (InteractiveShell.interact): added a
3633 * IPython/iplib.py (InteractiveShell.interact): added a
3627 showtraceback() call to the SystemExit trap, and modified the exit
3634 showtraceback() call to the SystemExit trap, and modified the exit
3628 confirmation to have yes as the default.
3635 confirmation to have yes as the default.
3629
3636
3630 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3637 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3631 this file. It's been gone from the code for a long time, this was
3638 this file. It's been gone from the code for a long time, this was
3632 simply leftover junk.
3639 simply leftover junk.
3633
3640
3634 2002-11-01 Fernando Perez <fperez@colorado.edu>
3641 2002-11-01 Fernando Perez <fperez@colorado.edu>
3635
3642
3636 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3643 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3637 added. If set, IPython now traps EOF and asks for
3644 added. If set, IPython now traps EOF and asks for
3638 confirmation. After a request by François Pinard.
3645 confirmation. After a request by François Pinard.
3639
3646
3640 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3647 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3641 of @abort, and with a new (better) mechanism for handling the
3648 of @abort, and with a new (better) mechanism for handling the
3642 exceptions.
3649 exceptions.
3643
3650
3644 2002-10-27 Fernando Perez <fperez@colorado.edu>
3651 2002-10-27 Fernando Perez <fperez@colorado.edu>
3645
3652
3646 * IPython/usage.py (__doc__): updated the --help information and
3653 * IPython/usage.py (__doc__): updated the --help information and
3647 the ipythonrc file to indicate that -log generates
3654 the ipythonrc file to indicate that -log generates
3648 ./ipython.log. Also fixed the corresponding info in @logstart.
3655 ./ipython.log. Also fixed the corresponding info in @logstart.
3649 This and several other fixes in the manuals thanks to reports by
3656 This and several other fixes in the manuals thanks to reports by
3650 François Pinard <pinard-AT-iro.umontreal.ca>.
3657 François Pinard <pinard-AT-iro.umontreal.ca>.
3651
3658
3652 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3659 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3653 refer to @logstart (instead of @log, which doesn't exist).
3660 refer to @logstart (instead of @log, which doesn't exist).
3654
3661
3655 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3662 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3656 AttributeError crash. Thanks to Christopher Armstrong
3663 AttributeError crash. Thanks to Christopher Armstrong
3657 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3664 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3658 introduced recently (in 0.2.14pre37) with the fix to the eval
3665 introduced recently (in 0.2.14pre37) with the fix to the eval
3659 problem mentioned below.
3666 problem mentioned below.
3660
3667
3661 2002-10-17 Fernando Perez <fperez@colorado.edu>
3668 2002-10-17 Fernando Perez <fperez@colorado.edu>
3662
3669
3663 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3670 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3664 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3671 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3665
3672
3666 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3673 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3667 this function to fix a problem reported by Alex Schmolck. He saw
3674 this function to fix a problem reported by Alex Schmolck. He saw
3668 it with list comprehensions and generators, which were getting
3675 it with list comprehensions and generators, which were getting
3669 called twice. The real problem was an 'eval' call in testing for
3676 called twice. The real problem was an 'eval' call in testing for
3670 automagic which was evaluating the input line silently.
3677 automagic which was evaluating the input line silently.
3671
3678
3672 This is a potentially very nasty bug, if the input has side
3679 This is a potentially very nasty bug, if the input has side
3673 effects which must not be repeated. The code is much cleaner now,
3680 effects which must not be repeated. The code is much cleaner now,
3674 without any blanket 'except' left and with a regexp test for
3681 without any blanket 'except' left and with a regexp test for
3675 actual function names.
3682 actual function names.
3676
3683
3677 But an eval remains, which I'm not fully comfortable with. I just
3684 But an eval remains, which I'm not fully comfortable with. I just
3678 don't know how to find out if an expression could be a callable in
3685 don't know how to find out if an expression could be a callable in
3679 the user's namespace without doing an eval on the string. However
3686 the user's namespace without doing an eval on the string. However
3680 that string is now much more strictly checked so that no code
3687 that string is now much more strictly checked so that no code
3681 slips by, so the eval should only happen for things that can
3688 slips by, so the eval should only happen for things that can
3682 really be only function/method names.
3689 really be only function/method names.
3683
3690
3684 2002-10-15 Fernando Perez <fperez@colorado.edu>
3691 2002-10-15 Fernando Perez <fperez@colorado.edu>
3685
3692
3686 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3693 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3687 OSX information to main manual, removed README_Mac_OSX file from
3694 OSX information to main manual, removed README_Mac_OSX file from
3688 distribution. Also updated credits for recent additions.
3695 distribution. Also updated credits for recent additions.
3689
3696
3690 2002-10-10 Fernando Perez <fperez@colorado.edu>
3697 2002-10-10 Fernando Perez <fperez@colorado.edu>
3691
3698
3692 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3699 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3693 terminal-related issues. Many thanks to Andrea Riciputi
3700 terminal-related issues. Many thanks to Andrea Riciputi
3694 <andrea.riciputi-AT-libero.it> for writing it.
3701 <andrea.riciputi-AT-libero.it> for writing it.
3695
3702
3696 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3703 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3697 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3704 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3698
3705
3699 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3706 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3700 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3707 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3701 <syver-en-AT-online.no> who both submitted patches for this problem.
3708 <syver-en-AT-online.no> who both submitted patches for this problem.
3702
3709
3703 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3710 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3704 global embedding to make sure that things don't overwrite user
3711 global embedding to make sure that things don't overwrite user
3705 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3712 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3706
3713
3707 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3714 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3708 compatibility. Thanks to Hayden Callow
3715 compatibility. Thanks to Hayden Callow
3709 <h.callow-AT-elec.canterbury.ac.nz>
3716 <h.callow-AT-elec.canterbury.ac.nz>
3710
3717
3711 2002-10-04 Fernando Perez <fperez@colorado.edu>
3718 2002-10-04 Fernando Perez <fperez@colorado.edu>
3712
3719
3713 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3720 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3714 Gnuplot.File objects.
3721 Gnuplot.File objects.
3715
3722
3716 2002-07-23 Fernando Perez <fperez@colorado.edu>
3723 2002-07-23 Fernando Perez <fperez@colorado.edu>
3717
3724
3718 * IPython/genutils.py (timing): Added timings() and timing() for
3725 * IPython/genutils.py (timing): Added timings() and timing() for
3719 quick access to the most commonly needed data, the execution
3726 quick access to the most commonly needed data, the execution
3720 times. Old timing() renamed to timings_out().
3727 times. Old timing() renamed to timings_out().
3721
3728
3722 2002-07-18 Fernando Perez <fperez@colorado.edu>
3729 2002-07-18 Fernando Perez <fperez@colorado.edu>
3723
3730
3724 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3731 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3725 bug with nested instances disrupting the parent's tab completion.
3732 bug with nested instances disrupting the parent's tab completion.
3726
3733
3727 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3734 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3728 all_completions code to begin the emacs integration.
3735 all_completions code to begin the emacs integration.
3729
3736
3730 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3737 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3731 argument to allow titling individual arrays when plotting.
3738 argument to allow titling individual arrays when plotting.
3732
3739
3733 2002-07-15 Fernando Perez <fperez@colorado.edu>
3740 2002-07-15 Fernando Perez <fperez@colorado.edu>
3734
3741
3735 * setup.py (make_shortcut): changed to retrieve the value of
3742 * setup.py (make_shortcut): changed to retrieve the value of
3736 'Program Files' directory from the registry (this value changes in
3743 'Program Files' directory from the registry (this value changes in
3737 non-english versions of Windows). Thanks to Thomas Fanslau
3744 non-english versions of Windows). Thanks to Thomas Fanslau
3738 <tfanslau-AT-gmx.de> for the report.
3745 <tfanslau-AT-gmx.de> for the report.
3739
3746
3740 2002-07-10 Fernando Perez <fperez@colorado.edu>
3747 2002-07-10 Fernando Perez <fperez@colorado.edu>
3741
3748
3742 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3749 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3743 a bug in pdb, which crashes if a line with only whitespace is
3750 a bug in pdb, which crashes if a line with only whitespace is
3744 entered. Bug report submitted to sourceforge.
3751 entered. Bug report submitted to sourceforge.
3745
3752
3746 2002-07-09 Fernando Perez <fperez@colorado.edu>
3753 2002-07-09 Fernando Perez <fperez@colorado.edu>
3747
3754
3748 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3755 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3749 reporting exceptions (it's a bug in inspect.py, I just set a
3756 reporting exceptions (it's a bug in inspect.py, I just set a
3750 workaround).
3757 workaround).
3751
3758
3752 2002-07-08 Fernando Perez <fperez@colorado.edu>
3759 2002-07-08 Fernando Perez <fperez@colorado.edu>
3753
3760
3754 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3761 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3755 __IPYTHON__ in __builtins__ to show up in user_ns.
3762 __IPYTHON__ in __builtins__ to show up in user_ns.
3756
3763
3757 2002-07-03 Fernando Perez <fperez@colorado.edu>
3764 2002-07-03 Fernando Perez <fperez@colorado.edu>
3758
3765
3759 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3766 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3760 name from @gp_set_instance to @gp_set_default.
3767 name from @gp_set_instance to @gp_set_default.
3761
3768
3762 * IPython/ipmaker.py (make_IPython): default editor value set to
3769 * IPython/ipmaker.py (make_IPython): default editor value set to
3763 '0' (a string), to match the rc file. Otherwise will crash when
3770 '0' (a string), to match the rc file. Otherwise will crash when
3764 .strip() is called on it.
3771 .strip() is called on it.
3765
3772
3766
3773
3767 2002-06-28 Fernando Perez <fperez@colorado.edu>
3774 2002-06-28 Fernando Perez <fperez@colorado.edu>
3768
3775
3769 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3776 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3770 of files in current directory when a file is executed via
3777 of files in current directory when a file is executed via
3771 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3778 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3772
3779
3773 * setup.py (manfiles): fix for rpm builds, submitted by RA
3780 * setup.py (manfiles): fix for rpm builds, submitted by RA
3774 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3781 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3775
3782
3776 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3783 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3777 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3784 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3778 string!). A. Schmolck caught this one.
3785 string!). A. Schmolck caught this one.
3779
3786
3780 2002-06-27 Fernando Perez <fperez@colorado.edu>
3787 2002-06-27 Fernando Perez <fperez@colorado.edu>
3781
3788
3782 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3789 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3783 defined files at the cmd line. __name__ wasn't being set to
3790 defined files at the cmd line. __name__ wasn't being set to
3784 __main__.
3791 __main__.
3785
3792
3786 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3793 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3787 regular lists and tuples besides Numeric arrays.
3794 regular lists and tuples besides Numeric arrays.
3788
3795
3789 * IPython/Prompts.py (CachedOutput.__call__): Added output
3796 * IPython/Prompts.py (CachedOutput.__call__): Added output
3790 supression for input ending with ';'. Similar to Mathematica and
3797 supression for input ending with ';'. Similar to Mathematica and
3791 Matlab. The _* vars and Out[] list are still updated, just like
3798 Matlab. The _* vars and Out[] list are still updated, just like
3792 Mathematica behaves.
3799 Mathematica behaves.
3793
3800
3794 2002-06-25 Fernando Perez <fperez@colorado.edu>
3801 2002-06-25 Fernando Perez <fperez@colorado.edu>
3795
3802
3796 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3803 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3797 .ini extensions for profiels under Windows.
3804 .ini extensions for profiels under Windows.
3798
3805
3799 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3806 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3800 string form. Fix contributed by Alexander Schmolck
3807 string form. Fix contributed by Alexander Schmolck
3801 <a.schmolck-AT-gmx.net>
3808 <a.schmolck-AT-gmx.net>
3802
3809
3803 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3810 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3804 pre-configured Gnuplot instance.
3811 pre-configured Gnuplot instance.
3805
3812
3806 2002-06-21 Fernando Perez <fperez@colorado.edu>
3813 2002-06-21 Fernando Perez <fperez@colorado.edu>
3807
3814
3808 * IPython/numutils.py (exp_safe): new function, works around the
3815 * IPython/numutils.py (exp_safe): new function, works around the
3809 underflow problems in Numeric.
3816 underflow problems in Numeric.
3810 (log2): New fn. Safe log in base 2: returns exact integer answer
3817 (log2): New fn. Safe log in base 2: returns exact integer answer
3811 for exact integer powers of 2.
3818 for exact integer powers of 2.
3812
3819
3813 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3820 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3814 properly.
3821 properly.
3815
3822
3816 2002-06-20 Fernando Perez <fperez@colorado.edu>
3823 2002-06-20 Fernando Perez <fperez@colorado.edu>
3817
3824
3818 * IPython/genutils.py (timing): new function like
3825 * IPython/genutils.py (timing): new function like
3819 Mathematica's. Similar to time_test, but returns more info.
3826 Mathematica's. Similar to time_test, but returns more info.
3820
3827
3821 2002-06-18 Fernando Perez <fperez@colorado.edu>
3828 2002-06-18 Fernando Perez <fperez@colorado.edu>
3822
3829
3823 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3830 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3824 according to Mike Heeter's suggestions.
3831 according to Mike Heeter's suggestions.
3825
3832
3826 2002-06-16 Fernando Perez <fperez@colorado.edu>
3833 2002-06-16 Fernando Perez <fperez@colorado.edu>
3827
3834
3828 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3835 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3829 system. GnuplotMagic is gone as a user-directory option. New files
3836 system. GnuplotMagic is gone as a user-directory option. New files
3830 make it easier to use all the gnuplot stuff both from external
3837 make it easier to use all the gnuplot stuff both from external
3831 programs as well as from IPython. Had to rewrite part of
3838 programs as well as from IPython. Had to rewrite part of
3832 hardcopy() b/c of a strange bug: often the ps files simply don't
3839 hardcopy() b/c of a strange bug: often the ps files simply don't
3833 get created, and require a repeat of the command (often several
3840 get created, and require a repeat of the command (often several
3834 times).
3841 times).
3835
3842
3836 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3843 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3837 resolve output channel at call time, so that if sys.stderr has
3844 resolve output channel at call time, so that if sys.stderr has
3838 been redirected by user this gets honored.
3845 been redirected by user this gets honored.
3839
3846
3840 2002-06-13 Fernando Perez <fperez@colorado.edu>
3847 2002-06-13 Fernando Perez <fperez@colorado.edu>
3841
3848
3842 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3849 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3843 IPShell. Kept a copy with the old names to avoid breaking people's
3850 IPShell. Kept a copy with the old names to avoid breaking people's
3844 embedded code.
3851 embedded code.
3845
3852
3846 * IPython/ipython: simplified it to the bare minimum after
3853 * IPython/ipython: simplified it to the bare minimum after
3847 Holger's suggestions. Added info about how to use it in
3854 Holger's suggestions. Added info about how to use it in
3848 PYTHONSTARTUP.
3855 PYTHONSTARTUP.
3849
3856
3850 * IPython/Shell.py (IPythonShell): changed the options passing
3857 * IPython/Shell.py (IPythonShell): changed the options passing
3851 from a string with funky %s replacements to a straight list. Maybe
3858 from a string with funky %s replacements to a straight list. Maybe
3852 a bit more typing, but it follows sys.argv conventions, so there's
3859 a bit more typing, but it follows sys.argv conventions, so there's
3853 less special-casing to remember.
3860 less special-casing to remember.
3854
3861
3855 2002-06-12 Fernando Perez <fperez@colorado.edu>
3862 2002-06-12 Fernando Perez <fperez@colorado.edu>
3856
3863
3857 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3864 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3858 command. Thanks to a suggestion by Mike Heeter.
3865 command. Thanks to a suggestion by Mike Heeter.
3859 (Magic.magic_pfile): added behavior to look at filenames if given
3866 (Magic.magic_pfile): added behavior to look at filenames if given
3860 arg is not a defined object.
3867 arg is not a defined object.
3861 (Magic.magic_save): New @save function to save code snippets. Also
3868 (Magic.magic_save): New @save function to save code snippets. Also
3862 a Mike Heeter idea.
3869 a Mike Heeter idea.
3863
3870
3864 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3871 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3865 plot() and replot(). Much more convenient now, especially for
3872 plot() and replot(). Much more convenient now, especially for
3866 interactive use.
3873 interactive use.
3867
3874
3868 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3875 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3869 filenames.
3876 filenames.
3870
3877
3871 2002-06-02 Fernando Perez <fperez@colorado.edu>
3878 2002-06-02 Fernando Perez <fperez@colorado.edu>
3872
3879
3873 * IPython/Struct.py (Struct.__init__): modified to admit
3880 * IPython/Struct.py (Struct.__init__): modified to admit
3874 initialization via another struct.
3881 initialization via another struct.
3875
3882
3876 * IPython/genutils.py (SystemExec.__init__): New stateful
3883 * IPython/genutils.py (SystemExec.__init__): New stateful
3877 interface to xsys and bq. Useful for writing system scripts.
3884 interface to xsys and bq. Useful for writing system scripts.
3878
3885
3879 2002-05-30 Fernando Perez <fperez@colorado.edu>
3886 2002-05-30 Fernando Perez <fperez@colorado.edu>
3880
3887
3881 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3888 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3882 documents. This will make the user download smaller (it's getting
3889 documents. This will make the user download smaller (it's getting
3883 too big).
3890 too big).
3884
3891
3885 2002-05-29 Fernando Perez <fperez@colorado.edu>
3892 2002-05-29 Fernando Perez <fperez@colorado.edu>
3886
3893
3887 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3894 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3888 fix problems with shelve and pickle. Seems to work, but I don't
3895 fix problems with shelve and pickle. Seems to work, but I don't
3889 know if corner cases break it. Thanks to Mike Heeter
3896 know if corner cases break it. Thanks to Mike Heeter
3890 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3897 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3891
3898
3892 2002-05-24 Fernando Perez <fperez@colorado.edu>
3899 2002-05-24 Fernando Perez <fperez@colorado.edu>
3893
3900
3894 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3901 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3895 macros having broken.
3902 macros having broken.
3896
3903
3897 2002-05-21 Fernando Perez <fperez@colorado.edu>
3904 2002-05-21 Fernando Perez <fperez@colorado.edu>
3898
3905
3899 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3906 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3900 introduced logging bug: all history before logging started was
3907 introduced logging bug: all history before logging started was
3901 being written one character per line! This came from the redesign
3908 being written one character per line! This came from the redesign
3902 of the input history as a special list which slices to strings,
3909 of the input history as a special list which slices to strings,
3903 not to lists.
3910 not to lists.
3904
3911
3905 2002-05-20 Fernando Perez <fperez@colorado.edu>
3912 2002-05-20 Fernando Perez <fperez@colorado.edu>
3906
3913
3907 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3914 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3908 be an attribute of all classes in this module. The design of these
3915 be an attribute of all classes in this module. The design of these
3909 classes needs some serious overhauling.
3916 classes needs some serious overhauling.
3910
3917
3911 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3918 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3912 which was ignoring '_' in option names.
3919 which was ignoring '_' in option names.
3913
3920
3914 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3921 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3915 'Verbose_novars' to 'Context' and made it the new default. It's a
3922 'Verbose_novars' to 'Context' and made it the new default. It's a
3916 bit more readable and also safer than verbose.
3923 bit more readable and also safer than verbose.
3917
3924
3918 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3925 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3919 triple-quoted strings.
3926 triple-quoted strings.
3920
3927
3921 * IPython/OInspect.py (__all__): new module exposing the object
3928 * IPython/OInspect.py (__all__): new module exposing the object
3922 introspection facilities. Now the corresponding magics are dummy
3929 introspection facilities. Now the corresponding magics are dummy
3923 wrappers around this. Having this module will make it much easier
3930 wrappers around this. Having this module will make it much easier
3924 to put these functions into our modified pdb.
3931 to put these functions into our modified pdb.
3925 This new object inspector system uses the new colorizing module,
3932 This new object inspector system uses the new colorizing module,
3926 so source code and other things are nicely syntax highlighted.
3933 so source code and other things are nicely syntax highlighted.
3927
3934
3928 2002-05-18 Fernando Perez <fperez@colorado.edu>
3935 2002-05-18 Fernando Perez <fperez@colorado.edu>
3929
3936
3930 * IPython/ColorANSI.py: Split the coloring tools into a separate
3937 * IPython/ColorANSI.py: Split the coloring tools into a separate
3931 module so I can use them in other code easier (they were part of
3938 module so I can use them in other code easier (they were part of
3932 ultraTB).
3939 ultraTB).
3933
3940
3934 2002-05-17 Fernando Perez <fperez@colorado.edu>
3941 2002-05-17 Fernando Perez <fperez@colorado.edu>
3935
3942
3936 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3943 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3937 fixed it to set the global 'g' also to the called instance, as
3944 fixed it to set the global 'g' also to the called instance, as
3938 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3945 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3939 user's 'g' variables).
3946 user's 'g' variables).
3940
3947
3941 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3948 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3942 global variables (aliases to _ih,_oh) so that users which expect
3949 global variables (aliases to _ih,_oh) so that users which expect
3943 In[5] or Out[7] to work aren't unpleasantly surprised.
3950 In[5] or Out[7] to work aren't unpleasantly surprised.
3944 (InputList.__getslice__): new class to allow executing slices of
3951 (InputList.__getslice__): new class to allow executing slices of
3945 input history directly. Very simple class, complements the use of
3952 input history directly. Very simple class, complements the use of
3946 macros.
3953 macros.
3947
3954
3948 2002-05-16 Fernando Perez <fperez@colorado.edu>
3955 2002-05-16 Fernando Perez <fperez@colorado.edu>
3949
3956
3950 * setup.py (docdirbase): make doc directory be just doc/IPython
3957 * setup.py (docdirbase): make doc directory be just doc/IPython
3951 without version numbers, it will reduce clutter for users.
3958 without version numbers, it will reduce clutter for users.
3952
3959
3953 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3960 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3954 execfile call to prevent possible memory leak. See for details:
3961 execfile call to prevent possible memory leak. See for details:
3955 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3962 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3956
3963
3957 2002-05-15 Fernando Perez <fperez@colorado.edu>
3964 2002-05-15 Fernando Perez <fperez@colorado.edu>
3958
3965
3959 * IPython/Magic.py (Magic.magic_psource): made the object
3966 * IPython/Magic.py (Magic.magic_psource): made the object
3960 introspection names be more standard: pdoc, pdef, pfile and
3967 introspection names be more standard: pdoc, pdef, pfile and
3961 psource. They all print/page their output, and it makes
3968 psource. They all print/page their output, and it makes
3962 remembering them easier. Kept old names for compatibility as
3969 remembering them easier. Kept old names for compatibility as
3963 aliases.
3970 aliases.
3964
3971
3965 2002-05-14 Fernando Perez <fperez@colorado.edu>
3972 2002-05-14 Fernando Perez <fperez@colorado.edu>
3966
3973
3967 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3974 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3968 what the mouse problem was. The trick is to use gnuplot with temp
3975 what the mouse problem was. The trick is to use gnuplot with temp
3969 files and NOT with pipes (for data communication), because having
3976 files and NOT with pipes (for data communication), because having
3970 both pipes and the mouse on is bad news.
3977 both pipes and the mouse on is bad news.
3971
3978
3972 2002-05-13 Fernando Perez <fperez@colorado.edu>
3979 2002-05-13 Fernando Perez <fperez@colorado.edu>
3973
3980
3974 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3981 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3975 bug. Information would be reported about builtins even when
3982 bug. Information would be reported about builtins even when
3976 user-defined functions overrode them.
3983 user-defined functions overrode them.
3977
3984
3978 2002-05-11 Fernando Perez <fperez@colorado.edu>
3985 2002-05-11 Fernando Perez <fperez@colorado.edu>
3979
3986
3980 * IPython/__init__.py (__all__): removed FlexCompleter from
3987 * IPython/__init__.py (__all__): removed FlexCompleter from
3981 __all__ so that things don't fail in platforms without readline.
3988 __all__ so that things don't fail in platforms without readline.
3982
3989
3983 2002-05-10 Fernando Perez <fperez@colorado.edu>
3990 2002-05-10 Fernando Perez <fperez@colorado.edu>
3984
3991
3985 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3992 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3986 it requires Numeric, effectively making Numeric a dependency for
3993 it requires Numeric, effectively making Numeric a dependency for
3987 IPython.
3994 IPython.
3988
3995
3989 * Released 0.2.13
3996 * Released 0.2.13
3990
3997
3991 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3998 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3992 profiler interface. Now all the major options from the profiler
3999 profiler interface. Now all the major options from the profiler
3993 module are directly supported in IPython, both for single
4000 module are directly supported in IPython, both for single
3994 expressions (@prun) and for full programs (@run -p).
4001 expressions (@prun) and for full programs (@run -p).
3995
4002
3996 2002-05-09 Fernando Perez <fperez@colorado.edu>
4003 2002-05-09 Fernando Perez <fperez@colorado.edu>
3997
4004
3998 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4005 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3999 magic properly formatted for screen.
4006 magic properly formatted for screen.
4000
4007
4001 * setup.py (make_shortcut): Changed things to put pdf version in
4008 * setup.py (make_shortcut): Changed things to put pdf version in
4002 doc/ instead of doc/manual (had to change lyxport a bit).
4009 doc/ instead of doc/manual (had to change lyxport a bit).
4003
4010
4004 * IPython/Magic.py (Profile.string_stats): made profile runs go
4011 * IPython/Magic.py (Profile.string_stats): made profile runs go
4005 through pager (they are long and a pager allows searching, saving,
4012 through pager (they are long and a pager allows searching, saving,
4006 etc.)
4013 etc.)
4007
4014
4008 2002-05-08 Fernando Perez <fperez@colorado.edu>
4015 2002-05-08 Fernando Perez <fperez@colorado.edu>
4009
4016
4010 * Released 0.2.12
4017 * Released 0.2.12
4011
4018
4012 2002-05-06 Fernando Perez <fperez@colorado.edu>
4019 2002-05-06 Fernando Perez <fperez@colorado.edu>
4013
4020
4014 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4021 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4015 introduced); 'hist n1 n2' was broken.
4022 introduced); 'hist n1 n2' was broken.
4016 (Magic.magic_pdb): added optional on/off arguments to @pdb
4023 (Magic.magic_pdb): added optional on/off arguments to @pdb
4017 (Magic.magic_run): added option -i to @run, which executes code in
4024 (Magic.magic_run): added option -i to @run, which executes code in
4018 the IPython namespace instead of a clean one. Also added @irun as
4025 the IPython namespace instead of a clean one. Also added @irun as
4019 an alias to @run -i.
4026 an alias to @run -i.
4020
4027
4021 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4028 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4022 fixed (it didn't really do anything, the namespaces were wrong).
4029 fixed (it didn't really do anything, the namespaces were wrong).
4023
4030
4024 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4031 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4025
4032
4026 * IPython/__init__.py (__all__): Fixed package namespace, now
4033 * IPython/__init__.py (__all__): Fixed package namespace, now
4027 'import IPython' does give access to IPython.<all> as
4034 'import IPython' does give access to IPython.<all> as
4028 expected. Also renamed __release__ to Release.
4035 expected. Also renamed __release__ to Release.
4029
4036
4030 * IPython/Debugger.py (__license__): created new Pdb class which
4037 * IPython/Debugger.py (__license__): created new Pdb class which
4031 functions like a drop-in for the normal pdb.Pdb but does NOT
4038 functions like a drop-in for the normal pdb.Pdb but does NOT
4032 import readline by default. This way it doesn't muck up IPython's
4039 import readline by default. This way it doesn't muck up IPython's
4033 readline handling, and now tab-completion finally works in the
4040 readline handling, and now tab-completion finally works in the
4034 debugger -- sort of. It completes things globally visible, but the
4041 debugger -- sort of. It completes things globally visible, but the
4035 completer doesn't track the stack as pdb walks it. That's a bit
4042 completer doesn't track the stack as pdb walks it. That's a bit
4036 tricky, and I'll have to implement it later.
4043 tricky, and I'll have to implement it later.
4037
4044
4038 2002-05-05 Fernando Perez <fperez@colorado.edu>
4045 2002-05-05 Fernando Perez <fperez@colorado.edu>
4039
4046
4040 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4047 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4041 magic docstrings when printed via ? (explicit \'s were being
4048 magic docstrings when printed via ? (explicit \'s were being
4042 printed).
4049 printed).
4043
4050
4044 * IPython/ipmaker.py (make_IPython): fixed namespace
4051 * IPython/ipmaker.py (make_IPython): fixed namespace
4045 identification bug. Now variables loaded via logs or command-line
4052 identification bug. Now variables loaded via logs or command-line
4046 files are recognized in the interactive namespace by @who.
4053 files are recognized in the interactive namespace by @who.
4047
4054
4048 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4055 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4049 log replay system stemming from the string form of Structs.
4056 log replay system stemming from the string form of Structs.
4050
4057
4051 * IPython/Magic.py (Macro.__init__): improved macros to properly
4058 * IPython/Magic.py (Macro.__init__): improved macros to properly
4052 handle magic commands in them.
4059 handle magic commands in them.
4053 (Magic.magic_logstart): usernames are now expanded so 'logstart
4060 (Magic.magic_logstart): usernames are now expanded so 'logstart
4054 ~/mylog' now works.
4061 ~/mylog' now works.
4055
4062
4056 * IPython/iplib.py (complete): fixed bug where paths starting with
4063 * IPython/iplib.py (complete): fixed bug where paths starting with
4057 '/' would be completed as magic names.
4064 '/' would be completed as magic names.
4058
4065
4059 2002-05-04 Fernando Perez <fperez@colorado.edu>
4066 2002-05-04 Fernando Perez <fperez@colorado.edu>
4060
4067
4061 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4068 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4062 allow running full programs under the profiler's control.
4069 allow running full programs under the profiler's control.
4063
4070
4064 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4071 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4065 mode to report exceptions verbosely but without formatting
4072 mode to report exceptions verbosely but without formatting
4066 variables. This addresses the issue of ipython 'freezing' (it's
4073 variables. This addresses the issue of ipython 'freezing' (it's
4067 not frozen, but caught in an expensive formatting loop) when huge
4074 not frozen, but caught in an expensive formatting loop) when huge
4068 variables are in the context of an exception.
4075 variables are in the context of an exception.
4069 (VerboseTB.text): Added '--->' markers at line where exception was
4076 (VerboseTB.text): Added '--->' markers at line where exception was
4070 triggered. Much clearer to read, especially in NoColor modes.
4077 triggered. Much clearer to read, especially in NoColor modes.
4071
4078
4072 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4079 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4073 implemented in reverse when changing to the new parse_options().
4080 implemented in reverse when changing to the new parse_options().
4074
4081
4075 2002-05-03 Fernando Perez <fperez@colorado.edu>
4082 2002-05-03 Fernando Perez <fperez@colorado.edu>
4076
4083
4077 * IPython/Magic.py (Magic.parse_options): new function so that
4084 * IPython/Magic.py (Magic.parse_options): new function so that
4078 magics can parse options easier.
4085 magics can parse options easier.
4079 (Magic.magic_prun): new function similar to profile.run(),
4086 (Magic.magic_prun): new function similar to profile.run(),
4080 suggested by Chris Hart.
4087 suggested by Chris Hart.
4081 (Magic.magic_cd): fixed behavior so that it only changes if
4088 (Magic.magic_cd): fixed behavior so that it only changes if
4082 directory actually is in history.
4089 directory actually is in history.
4083
4090
4084 * IPython/usage.py (__doc__): added information about potential
4091 * IPython/usage.py (__doc__): added information about potential
4085 slowness of Verbose exception mode when there are huge data
4092 slowness of Verbose exception mode when there are huge data
4086 structures to be formatted (thanks to Archie Paulson).
4093 structures to be formatted (thanks to Archie Paulson).
4087
4094
4088 * IPython/ipmaker.py (make_IPython): Changed default logging
4095 * IPython/ipmaker.py (make_IPython): Changed default logging
4089 (when simply called with -log) to use curr_dir/ipython.log in
4096 (when simply called with -log) to use curr_dir/ipython.log in
4090 rotate mode. Fixed crash which was occuring with -log before
4097 rotate mode. Fixed crash which was occuring with -log before
4091 (thanks to Jim Boyle).
4098 (thanks to Jim Boyle).
4092
4099
4093 2002-05-01 Fernando Perez <fperez@colorado.edu>
4100 2002-05-01 Fernando Perez <fperez@colorado.edu>
4094
4101
4095 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4102 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4096 was nasty -- though somewhat of a corner case).
4103 was nasty -- though somewhat of a corner case).
4097
4104
4098 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4105 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4099 text (was a bug).
4106 text (was a bug).
4100
4107
4101 2002-04-30 Fernando Perez <fperez@colorado.edu>
4108 2002-04-30 Fernando Perez <fperez@colorado.edu>
4102
4109
4103 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4110 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4104 a print after ^D or ^C from the user so that the In[] prompt
4111 a print after ^D or ^C from the user so that the In[] prompt
4105 doesn't over-run the gnuplot one.
4112 doesn't over-run the gnuplot one.
4106
4113
4107 2002-04-29 Fernando Perez <fperez@colorado.edu>
4114 2002-04-29 Fernando Perez <fperez@colorado.edu>
4108
4115
4109 * Released 0.2.10
4116 * Released 0.2.10
4110
4117
4111 * IPython/__release__.py (version): get date dynamically.
4118 * IPython/__release__.py (version): get date dynamically.
4112
4119
4113 * Misc. documentation updates thanks to Arnd's comments. Also ran
4120 * Misc. documentation updates thanks to Arnd's comments. Also ran
4114 a full spellcheck on the manual (hadn't been done in a while).
4121 a full spellcheck on the manual (hadn't been done in a while).
4115
4122
4116 2002-04-27 Fernando Perez <fperez@colorado.edu>
4123 2002-04-27 Fernando Perez <fperez@colorado.edu>
4117
4124
4118 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4125 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4119 starting a log in mid-session would reset the input history list.
4126 starting a log in mid-session would reset the input history list.
4120
4127
4121 2002-04-26 Fernando Perez <fperez@colorado.edu>
4128 2002-04-26 Fernando Perez <fperez@colorado.edu>
4122
4129
4123 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4130 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4124 all files were being included in an update. Now anything in
4131 all files were being included in an update. Now anything in
4125 UserConfig that matches [A-Za-z]*.py will go (this excludes
4132 UserConfig that matches [A-Za-z]*.py will go (this excludes
4126 __init__.py)
4133 __init__.py)
4127
4134
4128 2002-04-25 Fernando Perez <fperez@colorado.edu>
4135 2002-04-25 Fernando Perez <fperez@colorado.edu>
4129
4136
4130 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4137 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4131 to __builtins__ so that any form of embedded or imported code can
4138 to __builtins__ so that any form of embedded or imported code can
4132 test for being inside IPython.
4139 test for being inside IPython.
4133
4140
4134 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4141 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4135 changed to GnuplotMagic because it's now an importable module,
4142 changed to GnuplotMagic because it's now an importable module,
4136 this makes the name follow that of the standard Gnuplot module.
4143 this makes the name follow that of the standard Gnuplot module.
4137 GnuplotMagic can now be loaded at any time in mid-session.
4144 GnuplotMagic can now be loaded at any time in mid-session.
4138
4145
4139 2002-04-24 Fernando Perez <fperez@colorado.edu>
4146 2002-04-24 Fernando Perez <fperez@colorado.edu>
4140
4147
4141 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4148 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4142 the globals (IPython has its own namespace) and the
4149 the globals (IPython has its own namespace) and the
4143 PhysicalQuantity stuff is much better anyway.
4150 PhysicalQuantity stuff is much better anyway.
4144
4151
4145 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4152 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4146 embedding example to standard user directory for
4153 embedding example to standard user directory for
4147 distribution. Also put it in the manual.
4154 distribution. Also put it in the manual.
4148
4155
4149 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4156 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4150 instance as first argument (so it doesn't rely on some obscure
4157 instance as first argument (so it doesn't rely on some obscure
4151 hidden global).
4158 hidden global).
4152
4159
4153 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4160 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4154 delimiters. While it prevents ().TAB from working, it allows
4161 delimiters. While it prevents ().TAB from working, it allows
4155 completions in open (... expressions. This is by far a more common
4162 completions in open (... expressions. This is by far a more common
4156 case.
4163 case.
4157
4164
4158 2002-04-23 Fernando Perez <fperez@colorado.edu>
4165 2002-04-23 Fernando Perez <fperez@colorado.edu>
4159
4166
4160 * IPython/Extensions/InterpreterPasteInput.py: new
4167 * IPython/Extensions/InterpreterPasteInput.py: new
4161 syntax-processing module for pasting lines with >>> or ... at the
4168 syntax-processing module for pasting lines with >>> or ... at the
4162 start.
4169 start.
4163
4170
4164 * IPython/Extensions/PhysicalQ_Interactive.py
4171 * IPython/Extensions/PhysicalQ_Interactive.py
4165 (PhysicalQuantityInteractive.__int__): fixed to work with either
4172 (PhysicalQuantityInteractive.__int__): fixed to work with either
4166 Numeric or math.
4173 Numeric or math.
4167
4174
4168 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4175 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4169 provided profiles. Now we have:
4176 provided profiles. Now we have:
4170 -math -> math module as * and cmath with its own namespace.
4177 -math -> math module as * and cmath with its own namespace.
4171 -numeric -> Numeric as *, plus gnuplot & grace
4178 -numeric -> Numeric as *, plus gnuplot & grace
4172 -physics -> same as before
4179 -physics -> same as before
4173
4180
4174 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4181 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4175 user-defined magics wouldn't be found by @magic if they were
4182 user-defined magics wouldn't be found by @magic if they were
4176 defined as class methods. Also cleaned up the namespace search
4183 defined as class methods. Also cleaned up the namespace search
4177 logic and the string building (to use %s instead of many repeated
4184 logic and the string building (to use %s instead of many repeated
4178 string adds).
4185 string adds).
4179
4186
4180 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4187 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4181 of user-defined magics to operate with class methods (cleaner, in
4188 of user-defined magics to operate with class methods (cleaner, in
4182 line with the gnuplot code).
4189 line with the gnuplot code).
4183
4190
4184 2002-04-22 Fernando Perez <fperez@colorado.edu>
4191 2002-04-22 Fernando Perez <fperez@colorado.edu>
4185
4192
4186 * setup.py: updated dependency list so that manual is updated when
4193 * setup.py: updated dependency list so that manual is updated when
4187 all included files change.
4194 all included files change.
4188
4195
4189 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4196 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4190 the delimiter removal option (the fix is ugly right now).
4197 the delimiter removal option (the fix is ugly right now).
4191
4198
4192 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4199 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4193 all of the math profile (quicker loading, no conflict between
4200 all of the math profile (quicker loading, no conflict between
4194 g-9.8 and g-gnuplot).
4201 g-9.8 and g-gnuplot).
4195
4202
4196 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4203 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4197 name of post-mortem files to IPython_crash_report.txt.
4204 name of post-mortem files to IPython_crash_report.txt.
4198
4205
4199 * Cleanup/update of the docs. Added all the new readline info and
4206 * Cleanup/update of the docs. Added all the new readline info and
4200 formatted all lists as 'real lists'.
4207 formatted all lists as 'real lists'.
4201
4208
4202 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4209 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4203 tab-completion options, since the full readline parse_and_bind is
4210 tab-completion options, since the full readline parse_and_bind is
4204 now accessible.
4211 now accessible.
4205
4212
4206 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4213 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4207 handling of readline options. Now users can specify any string to
4214 handling of readline options. Now users can specify any string to
4208 be passed to parse_and_bind(), as well as the delimiters to be
4215 be passed to parse_and_bind(), as well as the delimiters to be
4209 removed.
4216 removed.
4210 (InteractiveShell.__init__): Added __name__ to the global
4217 (InteractiveShell.__init__): Added __name__ to the global
4211 namespace so that things like Itpl which rely on its existence
4218 namespace so that things like Itpl which rely on its existence
4212 don't crash.
4219 don't crash.
4213 (InteractiveShell._prefilter): Defined the default with a _ so
4220 (InteractiveShell._prefilter): Defined the default with a _ so
4214 that prefilter() is easier to override, while the default one
4221 that prefilter() is easier to override, while the default one
4215 remains available.
4222 remains available.
4216
4223
4217 2002-04-18 Fernando Perez <fperez@colorado.edu>
4224 2002-04-18 Fernando Perez <fperez@colorado.edu>
4218
4225
4219 * Added information about pdb in the docs.
4226 * Added information about pdb in the docs.
4220
4227
4221 2002-04-17 Fernando Perez <fperez@colorado.edu>
4228 2002-04-17 Fernando Perez <fperez@colorado.edu>
4222
4229
4223 * IPython/ipmaker.py (make_IPython): added rc_override option to
4230 * IPython/ipmaker.py (make_IPython): added rc_override option to
4224 allow passing config options at creation time which may override
4231 allow passing config options at creation time which may override
4225 anything set in the config files or command line. This is
4232 anything set in the config files or command line. This is
4226 particularly useful for configuring embedded instances.
4233 particularly useful for configuring embedded instances.
4227
4234
4228 2002-04-15 Fernando Perez <fperez@colorado.edu>
4235 2002-04-15 Fernando Perez <fperez@colorado.edu>
4229
4236
4230 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4237 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4231 crash embedded instances because of the input cache falling out of
4238 crash embedded instances because of the input cache falling out of
4232 sync with the output counter.
4239 sync with the output counter.
4233
4240
4234 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4241 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4235 mode which calls pdb after an uncaught exception in IPython itself.
4242 mode which calls pdb after an uncaught exception in IPython itself.
4236
4243
4237 2002-04-14 Fernando Perez <fperez@colorado.edu>
4244 2002-04-14 Fernando Perez <fperez@colorado.edu>
4238
4245
4239 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4246 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4240 readline, fix it back after each call.
4247 readline, fix it back after each call.
4241
4248
4242 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4249 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4243 method to force all access via __call__(), which guarantees that
4250 method to force all access via __call__(), which guarantees that
4244 traceback references are properly deleted.
4251 traceback references are properly deleted.
4245
4252
4246 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4253 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4247 improve printing when pprint is in use.
4254 improve printing when pprint is in use.
4248
4255
4249 2002-04-13 Fernando Perez <fperez@colorado.edu>
4256 2002-04-13 Fernando Perez <fperez@colorado.edu>
4250
4257
4251 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4258 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4252 exceptions aren't caught anymore. If the user triggers one, he
4259 exceptions aren't caught anymore. If the user triggers one, he
4253 should know why he's doing it and it should go all the way up,
4260 should know why he's doing it and it should go all the way up,
4254 just like any other exception. So now @abort will fully kill the
4261 just like any other exception. So now @abort will fully kill the
4255 embedded interpreter and the embedding code (unless that happens
4262 embedded interpreter and the embedding code (unless that happens
4256 to catch SystemExit).
4263 to catch SystemExit).
4257
4264
4258 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4265 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4259 and a debugger() method to invoke the interactive pdb debugger
4266 and a debugger() method to invoke the interactive pdb debugger
4260 after printing exception information. Also added the corresponding
4267 after printing exception information. Also added the corresponding
4261 -pdb option and @pdb magic to control this feature, and updated
4268 -pdb option and @pdb magic to control this feature, and updated
4262 the docs. After a suggestion from Christopher Hart
4269 the docs. After a suggestion from Christopher Hart
4263 (hart-AT-caltech.edu).
4270 (hart-AT-caltech.edu).
4264
4271
4265 2002-04-12 Fernando Perez <fperez@colorado.edu>
4272 2002-04-12 Fernando Perez <fperez@colorado.edu>
4266
4273
4267 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4274 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4268 the exception handlers defined by the user (not the CrashHandler)
4275 the exception handlers defined by the user (not the CrashHandler)
4269 so that user exceptions don't trigger an ipython bug report.
4276 so that user exceptions don't trigger an ipython bug report.
4270
4277
4271 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4278 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4272 configurable (it should have always been so).
4279 configurable (it should have always been so).
4273
4280
4274 2002-03-26 Fernando Perez <fperez@colorado.edu>
4281 2002-03-26 Fernando Perez <fperez@colorado.edu>
4275
4282
4276 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4283 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4277 and there to fix embedding namespace issues. This should all be
4284 and there to fix embedding namespace issues. This should all be
4278 done in a more elegant way.
4285 done in a more elegant way.
4279
4286
4280 2002-03-25 Fernando Perez <fperez@colorado.edu>
4287 2002-03-25 Fernando Perez <fperez@colorado.edu>
4281
4288
4282 * IPython/genutils.py (get_home_dir): Try to make it work under
4289 * IPython/genutils.py (get_home_dir): Try to make it work under
4283 win9x also.
4290 win9x also.
4284
4291
4285 2002-03-20 Fernando Perez <fperez@colorado.edu>
4292 2002-03-20 Fernando Perez <fperez@colorado.edu>
4286
4293
4287 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4294 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4288 sys.displayhook untouched upon __init__.
4295 sys.displayhook untouched upon __init__.
4289
4296
4290 2002-03-19 Fernando Perez <fperez@colorado.edu>
4297 2002-03-19 Fernando Perez <fperez@colorado.edu>
4291
4298
4292 * Released 0.2.9 (for embedding bug, basically).
4299 * Released 0.2.9 (for embedding bug, basically).
4293
4300
4294 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4301 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4295 exceptions so that enclosing shell's state can be restored.
4302 exceptions so that enclosing shell's state can be restored.
4296
4303
4297 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4304 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4298 naming conventions in the .ipython/ dir.
4305 naming conventions in the .ipython/ dir.
4299
4306
4300 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4307 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4301 from delimiters list so filenames with - in them get expanded.
4308 from delimiters list so filenames with - in them get expanded.
4302
4309
4303 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4310 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4304 sys.displayhook not being properly restored after an embedded call.
4311 sys.displayhook not being properly restored after an embedded call.
4305
4312
4306 2002-03-18 Fernando Perez <fperez@colorado.edu>
4313 2002-03-18 Fernando Perez <fperez@colorado.edu>
4307
4314
4308 * Released 0.2.8
4315 * Released 0.2.8
4309
4316
4310 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4317 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4311 some files weren't being included in a -upgrade.
4318 some files weren't being included in a -upgrade.
4312 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4319 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4313 on' so that the first tab completes.
4320 on' so that the first tab completes.
4314 (InteractiveShell.handle_magic): fixed bug with spaces around
4321 (InteractiveShell.handle_magic): fixed bug with spaces around
4315 quotes breaking many magic commands.
4322 quotes breaking many magic commands.
4316
4323
4317 * setup.py: added note about ignoring the syntax error messages at
4324 * setup.py: added note about ignoring the syntax error messages at
4318 installation.
4325 installation.
4319
4326
4320 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4327 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4321 streamlining the gnuplot interface, now there's only one magic @gp.
4328 streamlining the gnuplot interface, now there's only one magic @gp.
4322
4329
4323 2002-03-17 Fernando Perez <fperez@colorado.edu>
4330 2002-03-17 Fernando Perez <fperez@colorado.edu>
4324
4331
4325 * IPython/UserConfig/magic_gnuplot.py: new name for the
4332 * IPython/UserConfig/magic_gnuplot.py: new name for the
4326 example-magic_pm.py file. Much enhanced system, now with a shell
4333 example-magic_pm.py file. Much enhanced system, now with a shell
4327 for communicating directly with gnuplot, one command at a time.
4334 for communicating directly with gnuplot, one command at a time.
4328
4335
4329 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4336 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4330 setting __name__=='__main__'.
4337 setting __name__=='__main__'.
4331
4338
4332 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4339 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4333 mini-shell for accessing gnuplot from inside ipython. Should
4340 mini-shell for accessing gnuplot from inside ipython. Should
4334 extend it later for grace access too. Inspired by Arnd's
4341 extend it later for grace access too. Inspired by Arnd's
4335 suggestion.
4342 suggestion.
4336
4343
4337 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4344 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4338 calling magic functions with () in their arguments. Thanks to Arnd
4345 calling magic functions with () in their arguments. Thanks to Arnd
4339 Baecker for pointing this to me.
4346 Baecker for pointing this to me.
4340
4347
4341 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4348 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4342 infinitely for integer or complex arrays (only worked with floats).
4349 infinitely for integer or complex arrays (only worked with floats).
4343
4350
4344 2002-03-16 Fernando Perez <fperez@colorado.edu>
4351 2002-03-16 Fernando Perez <fperez@colorado.edu>
4345
4352
4346 * setup.py: Merged setup and setup_windows into a single script
4353 * setup.py: Merged setup and setup_windows into a single script
4347 which properly handles things for windows users.
4354 which properly handles things for windows users.
4348
4355
4349 2002-03-15 Fernando Perez <fperez@colorado.edu>
4356 2002-03-15 Fernando Perez <fperez@colorado.edu>
4350
4357
4351 * Big change to the manual: now the magics are all automatically
4358 * Big change to the manual: now the magics are all automatically
4352 documented. This information is generated from their docstrings
4359 documented. This information is generated from their docstrings
4353 and put in a latex file included by the manual lyx file. This way
4360 and put in a latex file included by the manual lyx file. This way
4354 we get always up to date information for the magics. The manual
4361 we get always up to date information for the magics. The manual
4355 now also has proper version information, also auto-synced.
4362 now also has proper version information, also auto-synced.
4356
4363
4357 For this to work, an undocumented --magic_docstrings option was added.
4364 For this to work, an undocumented --magic_docstrings option was added.
4358
4365
4359 2002-03-13 Fernando Perez <fperez@colorado.edu>
4366 2002-03-13 Fernando Perez <fperez@colorado.edu>
4360
4367
4361 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4368 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4362 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4369 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4363
4370
4364 2002-03-12 Fernando Perez <fperez@colorado.edu>
4371 2002-03-12 Fernando Perez <fperez@colorado.edu>
4365
4372
4366 * IPython/ultraTB.py (TermColors): changed color escapes again to
4373 * IPython/ultraTB.py (TermColors): changed color escapes again to
4367 fix the (old, reintroduced) line-wrapping bug. Basically, if
4374 fix the (old, reintroduced) line-wrapping bug. Basically, if
4368 \001..\002 aren't given in the color escapes, lines get wrapped
4375 \001..\002 aren't given in the color escapes, lines get wrapped
4369 weirdly. But giving those screws up old xterms and emacs terms. So
4376 weirdly. But giving those screws up old xterms and emacs terms. So
4370 I added some logic for emacs terms to be ok, but I can't identify old
4377 I added some logic for emacs terms to be ok, but I can't identify old
4371 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4378 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4372
4379
4373 2002-03-10 Fernando Perez <fperez@colorado.edu>
4380 2002-03-10 Fernando Perez <fperez@colorado.edu>
4374
4381
4375 * IPython/usage.py (__doc__): Various documentation cleanups and
4382 * IPython/usage.py (__doc__): Various documentation cleanups and
4376 updates, both in usage docstrings and in the manual.
4383 updates, both in usage docstrings and in the manual.
4377
4384
4378 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4385 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4379 handling of caching. Set minimum acceptabe value for having a
4386 handling of caching. Set minimum acceptabe value for having a
4380 cache at 20 values.
4387 cache at 20 values.
4381
4388
4382 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4389 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4383 install_first_time function to a method, renamed it and added an
4390 install_first_time function to a method, renamed it and added an
4384 'upgrade' mode. Now people can update their config directory with
4391 'upgrade' mode. Now people can update their config directory with
4385 a simple command line switch (-upgrade, also new).
4392 a simple command line switch (-upgrade, also new).
4386
4393
4387 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4394 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4388 @file (convenient for automagic users under Python >= 2.2).
4395 @file (convenient for automagic users under Python >= 2.2).
4389 Removed @files (it seemed more like a plural than an abbrev. of
4396 Removed @files (it seemed more like a plural than an abbrev. of
4390 'file show').
4397 'file show').
4391
4398
4392 * IPython/iplib.py (install_first_time): Fixed crash if there were
4399 * IPython/iplib.py (install_first_time): Fixed crash if there were
4393 backup files ('~') in .ipython/ install directory.
4400 backup files ('~') in .ipython/ install directory.
4394
4401
4395 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4402 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4396 system. Things look fine, but these changes are fairly
4403 system. Things look fine, but these changes are fairly
4397 intrusive. Test them for a few days.
4404 intrusive. Test them for a few days.
4398
4405
4399 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4406 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4400 the prompts system. Now all in/out prompt strings are user
4407 the prompts system. Now all in/out prompt strings are user
4401 controllable. This is particularly useful for embedding, as one
4408 controllable. This is particularly useful for embedding, as one
4402 can tag embedded instances with particular prompts.
4409 can tag embedded instances with particular prompts.
4403
4410
4404 Also removed global use of sys.ps1/2, which now allows nested
4411 Also removed global use of sys.ps1/2, which now allows nested
4405 embeddings without any problems. Added command-line options for
4412 embeddings without any problems. Added command-line options for
4406 the prompt strings.
4413 the prompt strings.
4407
4414
4408 2002-03-08 Fernando Perez <fperez@colorado.edu>
4415 2002-03-08 Fernando Perez <fperez@colorado.edu>
4409
4416
4410 * IPython/UserConfig/example-embed-short.py (ipshell): added
4417 * IPython/UserConfig/example-embed-short.py (ipshell): added
4411 example file with the bare minimum code for embedding.
4418 example file with the bare minimum code for embedding.
4412
4419
4413 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4420 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4414 functionality for the embeddable shell to be activated/deactivated
4421 functionality for the embeddable shell to be activated/deactivated
4415 either globally or at each call.
4422 either globally or at each call.
4416
4423
4417 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4424 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4418 rewriting the prompt with '--->' for auto-inputs with proper
4425 rewriting the prompt with '--->' for auto-inputs with proper
4419 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4426 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4420 this is handled by the prompts class itself, as it should.
4427 this is handled by the prompts class itself, as it should.
4421
4428
4422 2002-03-05 Fernando Perez <fperez@colorado.edu>
4429 2002-03-05 Fernando Perez <fperez@colorado.edu>
4423
4430
4424 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4431 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4425 @logstart to avoid name clashes with the math log function.
4432 @logstart to avoid name clashes with the math log function.
4426
4433
4427 * Big updates to X/Emacs section of the manual.
4434 * Big updates to X/Emacs section of the manual.
4428
4435
4429 * Removed ipython_emacs. Milan explained to me how to pass
4436 * Removed ipython_emacs. Milan explained to me how to pass
4430 arguments to ipython through Emacs. Some day I'm going to end up
4437 arguments to ipython through Emacs. Some day I'm going to end up
4431 learning some lisp...
4438 learning some lisp...
4432
4439
4433 2002-03-04 Fernando Perez <fperez@colorado.edu>
4440 2002-03-04 Fernando Perez <fperez@colorado.edu>
4434
4441
4435 * IPython/ipython_emacs: Created script to be used as the
4442 * IPython/ipython_emacs: Created script to be used as the
4436 py-python-command Emacs variable so we can pass IPython
4443 py-python-command Emacs variable so we can pass IPython
4437 parameters. I can't figure out how to tell Emacs directly to pass
4444 parameters. I can't figure out how to tell Emacs directly to pass
4438 parameters to IPython, so a dummy shell script will do it.
4445 parameters to IPython, so a dummy shell script will do it.
4439
4446
4440 Other enhancements made for things to work better under Emacs'
4447 Other enhancements made for things to work better under Emacs'
4441 various types of terminals. Many thanks to Milan Zamazal
4448 various types of terminals. Many thanks to Milan Zamazal
4442 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4449 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4443
4450
4444 2002-03-01 Fernando Perez <fperez@colorado.edu>
4451 2002-03-01 Fernando Perez <fperez@colorado.edu>
4445
4452
4446 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4453 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4447 that loading of readline is now optional. This gives better
4454 that loading of readline is now optional. This gives better
4448 control to emacs users.
4455 control to emacs users.
4449
4456
4450 * IPython/ultraTB.py (__date__): Modified color escape sequences
4457 * IPython/ultraTB.py (__date__): Modified color escape sequences
4451 and now things work fine under xterm and in Emacs' term buffers
4458 and now things work fine under xterm and in Emacs' term buffers
4452 (though not shell ones). Well, in emacs you get colors, but all
4459 (though not shell ones). Well, in emacs you get colors, but all
4453 seem to be 'light' colors (no difference between dark and light
4460 seem to be 'light' colors (no difference between dark and light
4454 ones). But the garbage chars are gone, and also in xterms. It
4461 ones). But the garbage chars are gone, and also in xterms. It
4455 seems that now I'm using 'cleaner' ansi sequences.
4462 seems that now I'm using 'cleaner' ansi sequences.
4456
4463
4457 2002-02-21 Fernando Perez <fperez@colorado.edu>
4464 2002-02-21 Fernando Perez <fperez@colorado.edu>
4458
4465
4459 * Released 0.2.7 (mainly to publish the scoping fix).
4466 * Released 0.2.7 (mainly to publish the scoping fix).
4460
4467
4461 * IPython/Logger.py (Logger.logstate): added. A corresponding
4468 * IPython/Logger.py (Logger.logstate): added. A corresponding
4462 @logstate magic was created.
4469 @logstate magic was created.
4463
4470
4464 * IPython/Magic.py: fixed nested scoping problem under Python
4471 * IPython/Magic.py: fixed nested scoping problem under Python
4465 2.1.x (automagic wasn't working).
4472 2.1.x (automagic wasn't working).
4466
4473
4467 2002-02-20 Fernando Perez <fperez@colorado.edu>
4474 2002-02-20 Fernando Perez <fperez@colorado.edu>
4468
4475
4469 * Released 0.2.6.
4476 * Released 0.2.6.
4470
4477
4471 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4478 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4472 option so that logs can come out without any headers at all.
4479 option so that logs can come out without any headers at all.
4473
4480
4474 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4481 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4475 SciPy.
4482 SciPy.
4476
4483
4477 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4484 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4478 that embedded IPython calls don't require vars() to be explicitly
4485 that embedded IPython calls don't require vars() to be explicitly
4479 passed. Now they are extracted from the caller's frame (code
4486 passed. Now they are extracted from the caller's frame (code
4480 snatched from Eric Jones' weave). Added better documentation to
4487 snatched from Eric Jones' weave). Added better documentation to
4481 the section on embedding and the example file.
4488 the section on embedding and the example file.
4482
4489
4483 * IPython/genutils.py (page): Changed so that under emacs, it just
4490 * IPython/genutils.py (page): Changed so that under emacs, it just
4484 prints the string. You can then page up and down in the emacs
4491 prints the string. You can then page up and down in the emacs
4485 buffer itself. This is how the builtin help() works.
4492 buffer itself. This is how the builtin help() works.
4486
4493
4487 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4494 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4488 macro scoping: macros need to be executed in the user's namespace
4495 macro scoping: macros need to be executed in the user's namespace
4489 to work as if they had been typed by the user.
4496 to work as if they had been typed by the user.
4490
4497
4491 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4498 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4492 execute automatically (no need to type 'exec...'). They then
4499 execute automatically (no need to type 'exec...'). They then
4493 behave like 'true macros'. The printing system was also modified
4500 behave like 'true macros'. The printing system was also modified
4494 for this to work.
4501 for this to work.
4495
4502
4496 2002-02-19 Fernando Perez <fperez@colorado.edu>
4503 2002-02-19 Fernando Perez <fperez@colorado.edu>
4497
4504
4498 * IPython/genutils.py (page_file): new function for paging files
4505 * IPython/genutils.py (page_file): new function for paging files
4499 in an OS-independent way. Also necessary for file viewing to work
4506 in an OS-independent way. Also necessary for file viewing to work
4500 well inside Emacs buffers.
4507 well inside Emacs buffers.
4501 (page): Added checks for being in an emacs buffer.
4508 (page): Added checks for being in an emacs buffer.
4502 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4509 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4503 same bug in iplib.
4510 same bug in iplib.
4504
4511
4505 2002-02-18 Fernando Perez <fperez@colorado.edu>
4512 2002-02-18 Fernando Perez <fperez@colorado.edu>
4506
4513
4507 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4514 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4508 of readline so that IPython can work inside an Emacs buffer.
4515 of readline so that IPython can work inside an Emacs buffer.
4509
4516
4510 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4517 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4511 method signatures (they weren't really bugs, but it looks cleaner
4518 method signatures (they weren't really bugs, but it looks cleaner
4512 and keeps PyChecker happy).
4519 and keeps PyChecker happy).
4513
4520
4514 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4521 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4515 for implementing various user-defined hooks. Currently only
4522 for implementing various user-defined hooks. Currently only
4516 display is done.
4523 display is done.
4517
4524
4518 * IPython/Prompts.py (CachedOutput._display): changed display
4525 * IPython/Prompts.py (CachedOutput._display): changed display
4519 functions so that they can be dynamically changed by users easily.
4526 functions so that they can be dynamically changed by users easily.
4520
4527
4521 * IPython/Extensions/numeric_formats.py (num_display): added an
4528 * IPython/Extensions/numeric_formats.py (num_display): added an
4522 extension for printing NumPy arrays in flexible manners. It
4529 extension for printing NumPy arrays in flexible manners. It
4523 doesn't do anything yet, but all the structure is in
4530 doesn't do anything yet, but all the structure is in
4524 place. Ultimately the plan is to implement output format control
4531 place. Ultimately the plan is to implement output format control
4525 like in Octave.
4532 like in Octave.
4526
4533
4527 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4534 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4528 methods are found at run-time by all the automatic machinery.
4535 methods are found at run-time by all the automatic machinery.
4529
4536
4530 2002-02-17 Fernando Perez <fperez@colorado.edu>
4537 2002-02-17 Fernando Perez <fperez@colorado.edu>
4531
4538
4532 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4539 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4533 whole file a little.
4540 whole file a little.
4534
4541
4535 * ToDo: closed this document. Now there's a new_design.lyx
4542 * ToDo: closed this document. Now there's a new_design.lyx
4536 document for all new ideas. Added making a pdf of it for the
4543 document for all new ideas. Added making a pdf of it for the
4537 end-user distro.
4544 end-user distro.
4538
4545
4539 * IPython/Logger.py (Logger.switch_log): Created this to replace
4546 * IPython/Logger.py (Logger.switch_log): Created this to replace
4540 logon() and logoff(). It also fixes a nasty crash reported by
4547 logon() and logoff(). It also fixes a nasty crash reported by
4541 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4548 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4542
4549
4543 * IPython/iplib.py (complete): got auto-completion to work with
4550 * IPython/iplib.py (complete): got auto-completion to work with
4544 automagic (I had wanted this for a long time).
4551 automagic (I had wanted this for a long time).
4545
4552
4546 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4553 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4547 to @file, since file() is now a builtin and clashes with automagic
4554 to @file, since file() is now a builtin and clashes with automagic
4548 for @file.
4555 for @file.
4549
4556
4550 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4557 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4551 of this was previously in iplib, which had grown to more than 2000
4558 of this was previously in iplib, which had grown to more than 2000
4552 lines, way too long. No new functionality, but it makes managing
4559 lines, way too long. No new functionality, but it makes managing
4553 the code a bit easier.
4560 the code a bit easier.
4554
4561
4555 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4562 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4556 information to crash reports.
4563 information to crash reports.
4557
4564
4558 2002-02-12 Fernando Perez <fperez@colorado.edu>
4565 2002-02-12 Fernando Perez <fperez@colorado.edu>
4559
4566
4560 * Released 0.2.5.
4567 * Released 0.2.5.
4561
4568
4562 2002-02-11 Fernando Perez <fperez@colorado.edu>
4569 2002-02-11 Fernando Perez <fperez@colorado.edu>
4563
4570
4564 * Wrote a relatively complete Windows installer. It puts
4571 * Wrote a relatively complete Windows installer. It puts
4565 everything in place, creates Start Menu entries and fixes the
4572 everything in place, creates Start Menu entries and fixes the
4566 color issues. Nothing fancy, but it works.
4573 color issues. Nothing fancy, but it works.
4567
4574
4568 2002-02-10 Fernando Perez <fperez@colorado.edu>
4575 2002-02-10 Fernando Perez <fperez@colorado.edu>
4569
4576
4570 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4577 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4571 os.path.expanduser() call so that we can type @run ~/myfile.py and
4578 os.path.expanduser() call so that we can type @run ~/myfile.py and
4572 have thigs work as expected.
4579 have thigs work as expected.
4573
4580
4574 * IPython/genutils.py (page): fixed exception handling so things
4581 * IPython/genutils.py (page): fixed exception handling so things
4575 work both in Unix and Windows correctly. Quitting a pager triggers
4582 work both in Unix and Windows correctly. Quitting a pager triggers
4576 an IOError/broken pipe in Unix, and in windows not finding a pager
4583 an IOError/broken pipe in Unix, and in windows not finding a pager
4577 is also an IOError, so I had to actually look at the return value
4584 is also an IOError, so I had to actually look at the return value
4578 of the exception, not just the exception itself. Should be ok now.
4585 of the exception, not just the exception itself. Should be ok now.
4579
4586
4580 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4587 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4581 modified to allow case-insensitive color scheme changes.
4588 modified to allow case-insensitive color scheme changes.
4582
4589
4583 2002-02-09 Fernando Perez <fperez@colorado.edu>
4590 2002-02-09 Fernando Perez <fperez@colorado.edu>
4584
4591
4585 * IPython/genutils.py (native_line_ends): new function to leave
4592 * IPython/genutils.py (native_line_ends): new function to leave
4586 user config files with os-native line-endings.
4593 user config files with os-native line-endings.
4587
4594
4588 * README and manual updates.
4595 * README and manual updates.
4589
4596
4590 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4597 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4591 instead of StringType to catch Unicode strings.
4598 instead of StringType to catch Unicode strings.
4592
4599
4593 * IPython/genutils.py (filefind): fixed bug for paths with
4600 * IPython/genutils.py (filefind): fixed bug for paths with
4594 embedded spaces (very common in Windows).
4601 embedded spaces (very common in Windows).
4595
4602
4596 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4603 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4597 files under Windows, so that they get automatically associated
4604 files under Windows, so that they get automatically associated
4598 with a text editor. Windows makes it a pain to handle
4605 with a text editor. Windows makes it a pain to handle
4599 extension-less files.
4606 extension-less files.
4600
4607
4601 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4608 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4602 warning about readline only occur for Posix. In Windows there's no
4609 warning about readline only occur for Posix. In Windows there's no
4603 way to get readline, so why bother with the warning.
4610 way to get readline, so why bother with the warning.
4604
4611
4605 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4612 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4606 for __str__ instead of dir(self), since dir() changed in 2.2.
4613 for __str__ instead of dir(self), since dir() changed in 2.2.
4607
4614
4608 * Ported to Windows! Tested on XP, I suspect it should work fine
4615 * Ported to Windows! Tested on XP, I suspect it should work fine
4609 on NT/2000, but I don't think it will work on 98 et al. That
4616 on NT/2000, but I don't think it will work on 98 et al. That
4610 series of Windows is such a piece of junk anyway that I won't try
4617 series of Windows is such a piece of junk anyway that I won't try
4611 porting it there. The XP port was straightforward, showed a few
4618 porting it there. The XP port was straightforward, showed a few
4612 bugs here and there (fixed all), in particular some string
4619 bugs here and there (fixed all), in particular some string
4613 handling stuff which required considering Unicode strings (which
4620 handling stuff which required considering Unicode strings (which
4614 Windows uses). This is good, but hasn't been too tested :) No
4621 Windows uses). This is good, but hasn't been too tested :) No
4615 fancy installer yet, I'll put a note in the manual so people at
4622 fancy installer yet, I'll put a note in the manual so people at
4616 least make manually a shortcut.
4623 least make manually a shortcut.
4617
4624
4618 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4625 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4619 into a single one, "colors". This now controls both prompt and
4626 into a single one, "colors". This now controls both prompt and
4620 exception color schemes, and can be changed both at startup
4627 exception color schemes, and can be changed both at startup
4621 (either via command-line switches or via ipythonrc files) and at
4628 (either via command-line switches or via ipythonrc files) and at
4622 runtime, with @colors.
4629 runtime, with @colors.
4623 (Magic.magic_run): renamed @prun to @run and removed the old
4630 (Magic.magic_run): renamed @prun to @run and removed the old
4624 @run. The two were too similar to warrant keeping both.
4631 @run. The two were too similar to warrant keeping both.
4625
4632
4626 2002-02-03 Fernando Perez <fperez@colorado.edu>
4633 2002-02-03 Fernando Perez <fperez@colorado.edu>
4627
4634
4628 * IPython/iplib.py (install_first_time): Added comment on how to
4635 * IPython/iplib.py (install_first_time): Added comment on how to
4629 configure the color options for first-time users. Put a <return>
4636 configure the color options for first-time users. Put a <return>
4630 request at the end so that small-terminal users get a chance to
4637 request at the end so that small-terminal users get a chance to
4631 read the startup info.
4638 read the startup info.
4632
4639
4633 2002-01-23 Fernando Perez <fperez@colorado.edu>
4640 2002-01-23 Fernando Perez <fperez@colorado.edu>
4634
4641
4635 * IPython/iplib.py (CachedOutput.update): Changed output memory
4642 * IPython/iplib.py (CachedOutput.update): Changed output memory
4636 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4643 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4637 input history we still use _i. Did this b/c these variable are
4644 input history we still use _i. Did this b/c these variable are
4638 very commonly used in interactive work, so the less we need to
4645 very commonly used in interactive work, so the less we need to
4639 type the better off we are.
4646 type the better off we are.
4640 (Magic.magic_prun): updated @prun to better handle the namespaces
4647 (Magic.magic_prun): updated @prun to better handle the namespaces
4641 the file will run in, including a fix for __name__ not being set
4648 the file will run in, including a fix for __name__ not being set
4642 before.
4649 before.
4643
4650
4644 2002-01-20 Fernando Perez <fperez@colorado.edu>
4651 2002-01-20 Fernando Perez <fperez@colorado.edu>
4645
4652
4646 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4653 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4647 extra garbage for Python 2.2. Need to look more carefully into
4654 extra garbage for Python 2.2. Need to look more carefully into
4648 this later.
4655 this later.
4649
4656
4650 2002-01-19 Fernando Perez <fperez@colorado.edu>
4657 2002-01-19 Fernando Perez <fperez@colorado.edu>
4651
4658
4652 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4659 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4653 display SyntaxError exceptions properly formatted when they occur
4660 display SyntaxError exceptions properly formatted when they occur
4654 (they can be triggered by imported code).
4661 (they can be triggered by imported code).
4655
4662
4656 2002-01-18 Fernando Perez <fperez@colorado.edu>
4663 2002-01-18 Fernando Perez <fperez@colorado.edu>
4657
4664
4658 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4665 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4659 SyntaxError exceptions are reported nicely formatted, instead of
4666 SyntaxError exceptions are reported nicely formatted, instead of
4660 spitting out only offset information as before.
4667 spitting out only offset information as before.
4661 (Magic.magic_prun): Added the @prun function for executing
4668 (Magic.magic_prun): Added the @prun function for executing
4662 programs with command line args inside IPython.
4669 programs with command line args inside IPython.
4663
4670
4664 2002-01-16 Fernando Perez <fperez@colorado.edu>
4671 2002-01-16 Fernando Perez <fperez@colorado.edu>
4665
4672
4666 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4673 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4667 to *not* include the last item given in a range. This brings their
4674 to *not* include the last item given in a range. This brings their
4668 behavior in line with Python's slicing:
4675 behavior in line with Python's slicing:
4669 a[n1:n2] -> a[n1]...a[n2-1]
4676 a[n1:n2] -> a[n1]...a[n2-1]
4670 It may be a bit less convenient, but I prefer to stick to Python's
4677 It may be a bit less convenient, but I prefer to stick to Python's
4671 conventions *everywhere*, so users never have to wonder.
4678 conventions *everywhere*, so users never have to wonder.
4672 (Magic.magic_macro): Added @macro function to ease the creation of
4679 (Magic.magic_macro): Added @macro function to ease the creation of
4673 macros.
4680 macros.
4674
4681
4675 2002-01-05 Fernando Perez <fperez@colorado.edu>
4682 2002-01-05 Fernando Perez <fperez@colorado.edu>
4676
4683
4677 * Released 0.2.4.
4684 * Released 0.2.4.
4678
4685
4679 * IPython/iplib.py (Magic.magic_pdef):
4686 * IPython/iplib.py (Magic.magic_pdef):
4680 (InteractiveShell.safe_execfile): report magic lines and error
4687 (InteractiveShell.safe_execfile): report magic lines and error
4681 lines without line numbers so one can easily copy/paste them for
4688 lines without line numbers so one can easily copy/paste them for
4682 re-execution.
4689 re-execution.
4683
4690
4684 * Updated manual with recent changes.
4691 * Updated manual with recent changes.
4685
4692
4686 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4693 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4687 docstring printing when class? is called. Very handy for knowing
4694 docstring printing when class? is called. Very handy for knowing
4688 how to create class instances (as long as __init__ is well
4695 how to create class instances (as long as __init__ is well
4689 documented, of course :)
4696 documented, of course :)
4690 (Magic.magic_doc): print both class and constructor docstrings.
4697 (Magic.magic_doc): print both class and constructor docstrings.
4691 (Magic.magic_pdef): give constructor info if passed a class and
4698 (Magic.magic_pdef): give constructor info if passed a class and
4692 __call__ info for callable object instances.
4699 __call__ info for callable object instances.
4693
4700
4694 2002-01-04 Fernando Perez <fperez@colorado.edu>
4701 2002-01-04 Fernando Perez <fperez@colorado.edu>
4695
4702
4696 * Made deep_reload() off by default. It doesn't always work
4703 * Made deep_reload() off by default. It doesn't always work
4697 exactly as intended, so it's probably safer to have it off. It's
4704 exactly as intended, so it's probably safer to have it off. It's
4698 still available as dreload() anyway, so nothing is lost.
4705 still available as dreload() anyway, so nothing is lost.
4699
4706
4700 2002-01-02 Fernando Perez <fperez@colorado.edu>
4707 2002-01-02 Fernando Perez <fperez@colorado.edu>
4701
4708
4702 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4709 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4703 so I wanted an updated release).
4710 so I wanted an updated release).
4704
4711
4705 2001-12-27 Fernando Perez <fperez@colorado.edu>
4712 2001-12-27 Fernando Perez <fperez@colorado.edu>
4706
4713
4707 * IPython/iplib.py (InteractiveShell.interact): Added the original
4714 * IPython/iplib.py (InteractiveShell.interact): Added the original
4708 code from 'code.py' for this module in order to change the
4715 code from 'code.py' for this module in order to change the
4709 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4716 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4710 the history cache would break when the user hit Ctrl-C, and
4717 the history cache would break when the user hit Ctrl-C, and
4711 interact() offers no way to add any hooks to it.
4718 interact() offers no way to add any hooks to it.
4712
4719
4713 2001-12-23 Fernando Perez <fperez@colorado.edu>
4720 2001-12-23 Fernando Perez <fperez@colorado.edu>
4714
4721
4715 * setup.py: added check for 'MANIFEST' before trying to remove
4722 * setup.py: added check for 'MANIFEST' before trying to remove
4716 it. Thanks to Sean Reifschneider.
4723 it. Thanks to Sean Reifschneider.
4717
4724
4718 2001-12-22 Fernando Perez <fperez@colorado.edu>
4725 2001-12-22 Fernando Perez <fperez@colorado.edu>
4719
4726
4720 * Released 0.2.2.
4727 * Released 0.2.2.
4721
4728
4722 * Finished (reasonably) writing the manual. Later will add the
4729 * Finished (reasonably) writing the manual. Later will add the
4723 python-standard navigation stylesheets, but for the time being
4730 python-standard navigation stylesheets, but for the time being
4724 it's fairly complete. Distribution will include html and pdf
4731 it's fairly complete. Distribution will include html and pdf
4725 versions.
4732 versions.
4726
4733
4727 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4734 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4728 (MayaVi author).
4735 (MayaVi author).
4729
4736
4730 2001-12-21 Fernando Perez <fperez@colorado.edu>
4737 2001-12-21 Fernando Perez <fperez@colorado.edu>
4731
4738
4732 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4739 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4733 good public release, I think (with the manual and the distutils
4740 good public release, I think (with the manual and the distutils
4734 installer). The manual can use some work, but that can go
4741 installer). The manual can use some work, but that can go
4735 slowly. Otherwise I think it's quite nice for end users. Next
4742 slowly. Otherwise I think it's quite nice for end users. Next
4736 summer, rewrite the guts of it...
4743 summer, rewrite the guts of it...
4737
4744
4738 * Changed format of ipythonrc files to use whitespace as the
4745 * Changed format of ipythonrc files to use whitespace as the
4739 separator instead of an explicit '='. Cleaner.
4746 separator instead of an explicit '='. Cleaner.
4740
4747
4741 2001-12-20 Fernando Perez <fperez@colorado.edu>
4748 2001-12-20 Fernando Perez <fperez@colorado.edu>
4742
4749
4743 * Started a manual in LyX. For now it's just a quick merge of the
4750 * Started a manual in LyX. For now it's just a quick merge of the
4744 various internal docstrings and READMEs. Later it may grow into a
4751 various internal docstrings and READMEs. Later it may grow into a
4745 nice, full-blown manual.
4752 nice, full-blown manual.
4746
4753
4747 * Set up a distutils based installer. Installation should now be
4754 * Set up a distutils based installer. Installation should now be
4748 trivially simple for end-users.
4755 trivially simple for end-users.
4749
4756
4750 2001-12-11 Fernando Perez <fperez@colorado.edu>
4757 2001-12-11 Fernando Perez <fperez@colorado.edu>
4751
4758
4752 * Released 0.2.0. First public release, announced it at
4759 * Released 0.2.0. First public release, announced it at
4753 comp.lang.python. From now on, just bugfixes...
4760 comp.lang.python. From now on, just bugfixes...
4754
4761
4755 * Went through all the files, set copyright/license notices and
4762 * Went through all the files, set copyright/license notices and
4756 cleaned up things. Ready for release.
4763 cleaned up things. Ready for release.
4757
4764
4758 2001-12-10 Fernando Perez <fperez@colorado.edu>
4765 2001-12-10 Fernando Perez <fperez@colorado.edu>
4759
4766
4760 * Changed the first-time installer not to use tarfiles. It's more
4767 * Changed the first-time installer not to use tarfiles. It's more
4761 robust now and less unix-dependent. Also makes it easier for
4768 robust now and less unix-dependent. Also makes it easier for
4762 people to later upgrade versions.
4769 people to later upgrade versions.
4763
4770
4764 * Changed @exit to @abort to reflect the fact that it's pretty
4771 * Changed @exit to @abort to reflect the fact that it's pretty
4765 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4772 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4766 becomes significant only when IPyhton is embedded: in that case,
4773 becomes significant only when IPyhton is embedded: in that case,
4767 C-D closes IPython only, but @abort kills the enclosing program
4774 C-D closes IPython only, but @abort kills the enclosing program
4768 too (unless it had called IPython inside a try catching
4775 too (unless it had called IPython inside a try catching
4769 SystemExit).
4776 SystemExit).
4770
4777
4771 * Created Shell module which exposes the actuall IPython Shell
4778 * Created Shell module which exposes the actuall IPython Shell
4772 classes, currently the normal and the embeddable one. This at
4779 classes, currently the normal and the embeddable one. This at
4773 least offers a stable interface we won't need to change when
4780 least offers a stable interface we won't need to change when
4774 (later) the internals are rewritten. That rewrite will be confined
4781 (later) the internals are rewritten. That rewrite will be confined
4775 to iplib and ipmaker, but the Shell interface should remain as is.
4782 to iplib and ipmaker, but the Shell interface should remain as is.
4776
4783
4777 * Added embed module which offers an embeddable IPShell object,
4784 * Added embed module which offers an embeddable IPShell object,
4778 useful to fire up IPython *inside* a running program. Great for
4785 useful to fire up IPython *inside* a running program. Great for
4779 debugging or dynamical data analysis.
4786 debugging or dynamical data analysis.
4780
4787
4781 2001-12-08 Fernando Perez <fperez@colorado.edu>
4788 2001-12-08 Fernando Perez <fperez@colorado.edu>
4782
4789
4783 * Fixed small bug preventing seeing info from methods of defined
4790 * Fixed small bug preventing seeing info from methods of defined
4784 objects (incorrect namespace in _ofind()).
4791 objects (incorrect namespace in _ofind()).
4785
4792
4786 * Documentation cleanup. Moved the main usage docstrings to a
4793 * Documentation cleanup. Moved the main usage docstrings to a
4787 separate file, usage.py (cleaner to maintain, and hopefully in the
4794 separate file, usage.py (cleaner to maintain, and hopefully in the
4788 future some perlpod-like way of producing interactive, man and
4795 future some perlpod-like way of producing interactive, man and
4789 html docs out of it will be found).
4796 html docs out of it will be found).
4790
4797
4791 * Added @profile to see your profile at any time.
4798 * Added @profile to see your profile at any time.
4792
4799
4793 * Added @p as an alias for 'print'. It's especially convenient if
4800 * Added @p as an alias for 'print'. It's especially convenient if
4794 using automagic ('p x' prints x).
4801 using automagic ('p x' prints x).
4795
4802
4796 * Small cleanups and fixes after a pychecker run.
4803 * Small cleanups and fixes after a pychecker run.
4797
4804
4798 * Changed the @cd command to handle @cd - and @cd -<n> for
4805 * Changed the @cd command to handle @cd - and @cd -<n> for
4799 visiting any directory in _dh.
4806 visiting any directory in _dh.
4800
4807
4801 * Introduced _dh, a history of visited directories. @dhist prints
4808 * Introduced _dh, a history of visited directories. @dhist prints
4802 it out with numbers.
4809 it out with numbers.
4803
4810
4804 2001-12-07 Fernando Perez <fperez@colorado.edu>
4811 2001-12-07 Fernando Perez <fperez@colorado.edu>
4805
4812
4806 * Released 0.1.22
4813 * Released 0.1.22
4807
4814
4808 * Made initialization a bit more robust against invalid color
4815 * Made initialization a bit more robust against invalid color
4809 options in user input (exit, not traceback-crash).
4816 options in user input (exit, not traceback-crash).
4810
4817
4811 * Changed the bug crash reporter to write the report only in the
4818 * Changed the bug crash reporter to write the report only in the
4812 user's .ipython directory. That way IPython won't litter people's
4819 user's .ipython directory. That way IPython won't litter people's
4813 hard disks with crash files all over the place. Also print on
4820 hard disks with crash files all over the place. Also print on
4814 screen the necessary mail command.
4821 screen the necessary mail command.
4815
4822
4816 * With the new ultraTB, implemented LightBG color scheme for light
4823 * With the new ultraTB, implemented LightBG color scheme for light
4817 background terminals. A lot of people like white backgrounds, so I
4824 background terminals. A lot of people like white backgrounds, so I
4818 guess we should at least give them something readable.
4825 guess we should at least give them something readable.
4819
4826
4820 2001-12-06 Fernando Perez <fperez@colorado.edu>
4827 2001-12-06 Fernando Perez <fperez@colorado.edu>
4821
4828
4822 * Modified the structure of ultraTB. Now there's a proper class
4829 * Modified the structure of ultraTB. Now there's a proper class
4823 for tables of color schemes which allow adding schemes easily and
4830 for tables of color schemes which allow adding schemes easily and
4824 switching the active scheme without creating a new instance every
4831 switching the active scheme without creating a new instance every
4825 time (which was ridiculous). The syntax for creating new schemes
4832 time (which was ridiculous). The syntax for creating new schemes
4826 is also cleaner. I think ultraTB is finally done, with a clean
4833 is also cleaner. I think ultraTB is finally done, with a clean
4827 class structure. Names are also much cleaner (now there's proper
4834 class structure. Names are also much cleaner (now there's proper
4828 color tables, no need for every variable to also have 'color' in
4835 color tables, no need for every variable to also have 'color' in
4829 its name).
4836 its name).
4830
4837
4831 * Broke down genutils into separate files. Now genutils only
4838 * Broke down genutils into separate files. Now genutils only
4832 contains utility functions, and classes have been moved to their
4839 contains utility functions, and classes have been moved to their
4833 own files (they had enough independent functionality to warrant
4840 own files (they had enough independent functionality to warrant
4834 it): ConfigLoader, OutputTrap, Struct.
4841 it): ConfigLoader, OutputTrap, Struct.
4835
4842
4836 2001-12-05 Fernando Perez <fperez@colorado.edu>
4843 2001-12-05 Fernando Perez <fperez@colorado.edu>
4837
4844
4838 * IPython turns 21! Released version 0.1.21, as a candidate for
4845 * IPython turns 21! Released version 0.1.21, as a candidate for
4839 public consumption. If all goes well, release in a few days.
4846 public consumption. If all goes well, release in a few days.
4840
4847
4841 * Fixed path bug (files in Extensions/ directory wouldn't be found
4848 * Fixed path bug (files in Extensions/ directory wouldn't be found
4842 unless IPython/ was explicitly in sys.path).
4849 unless IPython/ was explicitly in sys.path).
4843
4850
4844 * Extended the FlexCompleter class as MagicCompleter to allow
4851 * Extended the FlexCompleter class as MagicCompleter to allow
4845 completion of @-starting lines.
4852 completion of @-starting lines.
4846
4853
4847 * Created __release__.py file as a central repository for release
4854 * Created __release__.py file as a central repository for release
4848 info that other files can read from.
4855 info that other files can read from.
4849
4856
4850 * Fixed small bug in logging: when logging was turned on in
4857 * Fixed small bug in logging: when logging was turned on in
4851 mid-session, old lines with special meanings (!@?) were being
4858 mid-session, old lines with special meanings (!@?) were being
4852 logged without the prepended comment, which is necessary since
4859 logged without the prepended comment, which is necessary since
4853 they are not truly valid python syntax. This should make session
4860 they are not truly valid python syntax. This should make session
4854 restores produce less errors.
4861 restores produce less errors.
4855
4862
4856 * The namespace cleanup forced me to make a FlexCompleter class
4863 * The namespace cleanup forced me to make a FlexCompleter class
4857 which is nothing but a ripoff of rlcompleter, but with selectable
4864 which is nothing but a ripoff of rlcompleter, but with selectable
4858 namespace (rlcompleter only works in __main__.__dict__). I'll try
4865 namespace (rlcompleter only works in __main__.__dict__). I'll try
4859 to submit a note to the authors to see if this change can be
4866 to submit a note to the authors to see if this change can be
4860 incorporated in future rlcompleter releases (Dec.6: done)
4867 incorporated in future rlcompleter releases (Dec.6: done)
4861
4868
4862 * More fixes to namespace handling. It was a mess! Now all
4869 * More fixes to namespace handling. It was a mess! Now all
4863 explicit references to __main__.__dict__ are gone (except when
4870 explicit references to __main__.__dict__ are gone (except when
4864 really needed) and everything is handled through the namespace
4871 really needed) and everything is handled through the namespace
4865 dicts in the IPython instance. We seem to be getting somewhere
4872 dicts in the IPython instance. We seem to be getting somewhere
4866 with this, finally...
4873 with this, finally...
4867
4874
4868 * Small documentation updates.
4875 * Small documentation updates.
4869
4876
4870 * Created the Extensions directory under IPython (with an
4877 * Created the Extensions directory under IPython (with an
4871 __init__.py). Put the PhysicalQ stuff there. This directory should
4878 __init__.py). Put the PhysicalQ stuff there. This directory should
4872 be used for all special-purpose extensions.
4879 be used for all special-purpose extensions.
4873
4880
4874 * File renaming:
4881 * File renaming:
4875 ipythonlib --> ipmaker
4882 ipythonlib --> ipmaker
4876 ipplib --> iplib
4883 ipplib --> iplib
4877 This makes a bit more sense in terms of what these files actually do.
4884 This makes a bit more sense in terms of what these files actually do.
4878
4885
4879 * Moved all the classes and functions in ipythonlib to ipplib, so
4886 * Moved all the classes and functions in ipythonlib to ipplib, so
4880 now ipythonlib only has make_IPython(). This will ease up its
4887 now ipythonlib only has make_IPython(). This will ease up its
4881 splitting in smaller functional chunks later.
4888 splitting in smaller functional chunks later.
4882
4889
4883 * Cleaned up (done, I think) output of @whos. Better column
4890 * Cleaned up (done, I think) output of @whos. Better column
4884 formatting, and now shows str(var) for as much as it can, which is
4891 formatting, and now shows str(var) for as much as it can, which is
4885 typically what one gets with a 'print var'.
4892 typically what one gets with a 'print var'.
4886
4893
4887 2001-12-04 Fernando Perez <fperez@colorado.edu>
4894 2001-12-04 Fernando Perez <fperez@colorado.edu>
4888
4895
4889 * Fixed namespace problems. Now builtin/IPyhton/user names get
4896 * Fixed namespace problems. Now builtin/IPyhton/user names get
4890 properly reported in their namespace. Internal namespace handling
4897 properly reported in their namespace. Internal namespace handling
4891 is finally getting decent (not perfect yet, but much better than
4898 is finally getting decent (not perfect yet, but much better than
4892 the ad-hoc mess we had).
4899 the ad-hoc mess we had).
4893
4900
4894 * Removed -exit option. If people just want to run a python
4901 * Removed -exit option. If people just want to run a python
4895 script, that's what the normal interpreter is for. Less
4902 script, that's what the normal interpreter is for. Less
4896 unnecessary options, less chances for bugs.
4903 unnecessary options, less chances for bugs.
4897
4904
4898 * Added a crash handler which generates a complete post-mortem if
4905 * Added a crash handler which generates a complete post-mortem if
4899 IPython crashes. This will help a lot in tracking bugs down the
4906 IPython crashes. This will help a lot in tracking bugs down the
4900 road.
4907 road.
4901
4908
4902 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4909 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4903 which were boud to functions being reassigned would bypass the
4910 which were boud to functions being reassigned would bypass the
4904 logger, breaking the sync of _il with the prompt counter. This
4911 logger, breaking the sync of _il with the prompt counter. This
4905 would then crash IPython later when a new line was logged.
4912 would then crash IPython later when a new line was logged.
4906
4913
4907 2001-12-02 Fernando Perez <fperez@colorado.edu>
4914 2001-12-02 Fernando Perez <fperez@colorado.edu>
4908
4915
4909 * Made IPython a package. This means people don't have to clutter
4916 * Made IPython a package. This means people don't have to clutter
4910 their sys.path with yet another directory. Changed the INSTALL
4917 their sys.path with yet another directory. Changed the INSTALL
4911 file accordingly.
4918 file accordingly.
4912
4919
4913 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4920 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4914 sorts its output (so @who shows it sorted) and @whos formats the
4921 sorts its output (so @who shows it sorted) and @whos formats the
4915 table according to the width of the first column. Nicer, easier to
4922 table according to the width of the first column. Nicer, easier to
4916 read. Todo: write a generic table_format() which takes a list of
4923 read. Todo: write a generic table_format() which takes a list of
4917 lists and prints it nicely formatted, with optional row/column
4924 lists and prints it nicely formatted, with optional row/column
4918 separators and proper padding and justification.
4925 separators and proper padding and justification.
4919
4926
4920 * Released 0.1.20
4927 * Released 0.1.20
4921
4928
4922 * Fixed bug in @log which would reverse the inputcache list (a
4929 * Fixed bug in @log which would reverse the inputcache list (a
4923 copy operation was missing).
4930 copy operation was missing).
4924
4931
4925 * Code cleanup. @config was changed to use page(). Better, since
4932 * Code cleanup. @config was changed to use page(). Better, since
4926 its output is always quite long.
4933 its output is always quite long.
4927
4934
4928 * Itpl is back as a dependency. I was having too many problems
4935 * Itpl is back as a dependency. I was having too many problems
4929 getting the parametric aliases to work reliably, and it's just
4936 getting the parametric aliases to work reliably, and it's just
4930 easier to code weird string operations with it than playing %()s
4937 easier to code weird string operations with it than playing %()s
4931 games. It's only ~6k, so I don't think it's too big a deal.
4938 games. It's only ~6k, so I don't think it's too big a deal.
4932
4939
4933 * Found (and fixed) a very nasty bug with history. !lines weren't
4940 * Found (and fixed) a very nasty bug with history. !lines weren't
4934 getting cached, and the out of sync caches would crash
4941 getting cached, and the out of sync caches would crash
4935 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4942 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4936 division of labor a bit better. Bug fixed, cleaner structure.
4943 division of labor a bit better. Bug fixed, cleaner structure.
4937
4944
4938 2001-12-01 Fernando Perez <fperez@colorado.edu>
4945 2001-12-01 Fernando Perez <fperez@colorado.edu>
4939
4946
4940 * Released 0.1.19
4947 * Released 0.1.19
4941
4948
4942 * Added option -n to @hist to prevent line number printing. Much
4949 * Added option -n to @hist to prevent line number printing. Much
4943 easier to copy/paste code this way.
4950 easier to copy/paste code this way.
4944
4951
4945 * Created global _il to hold the input list. Allows easy
4952 * Created global _il to hold the input list. Allows easy
4946 re-execution of blocks of code by slicing it (inspired by Janko's
4953 re-execution of blocks of code by slicing it (inspired by Janko's
4947 comment on 'macros').
4954 comment on 'macros').
4948
4955
4949 * Small fixes and doc updates.
4956 * Small fixes and doc updates.
4950
4957
4951 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4958 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4952 much too fragile with automagic. Handles properly multi-line
4959 much too fragile with automagic. Handles properly multi-line
4953 statements and takes parameters.
4960 statements and takes parameters.
4954
4961
4955 2001-11-30 Fernando Perez <fperez@colorado.edu>
4962 2001-11-30 Fernando Perez <fperez@colorado.edu>
4956
4963
4957 * Version 0.1.18 released.
4964 * Version 0.1.18 released.
4958
4965
4959 * Fixed nasty namespace bug in initial module imports.
4966 * Fixed nasty namespace bug in initial module imports.
4960
4967
4961 * Added copyright/license notes to all code files (except
4968 * Added copyright/license notes to all code files (except
4962 DPyGetOpt). For the time being, LGPL. That could change.
4969 DPyGetOpt). For the time being, LGPL. That could change.
4963
4970
4964 * Rewrote a much nicer README, updated INSTALL, cleaned up
4971 * Rewrote a much nicer README, updated INSTALL, cleaned up
4965 ipythonrc-* samples.
4972 ipythonrc-* samples.
4966
4973
4967 * Overall code/documentation cleanup. Basically ready for
4974 * Overall code/documentation cleanup. Basically ready for
4968 release. Only remaining thing: licence decision (LGPL?).
4975 release. Only remaining thing: licence decision (LGPL?).
4969
4976
4970 * Converted load_config to a class, ConfigLoader. Now recursion
4977 * Converted load_config to a class, ConfigLoader. Now recursion
4971 control is better organized. Doesn't include the same file twice.
4978 control is better organized. Doesn't include the same file twice.
4972
4979
4973 2001-11-29 Fernando Perez <fperez@colorado.edu>
4980 2001-11-29 Fernando Perez <fperez@colorado.edu>
4974
4981
4975 * Got input history working. Changed output history variables from
4982 * Got input history working. Changed output history variables from
4976 _p to _o so that _i is for input and _o for output. Just cleaner
4983 _p to _o so that _i is for input and _o for output. Just cleaner
4977 convention.
4984 convention.
4978
4985
4979 * Implemented parametric aliases. This pretty much allows the
4986 * Implemented parametric aliases. This pretty much allows the
4980 alias system to offer full-blown shell convenience, I think.
4987 alias system to offer full-blown shell convenience, I think.
4981
4988
4982 * Version 0.1.17 released, 0.1.18 opened.
4989 * Version 0.1.17 released, 0.1.18 opened.
4983
4990
4984 * dot_ipython/ipythonrc (alias): added documentation.
4991 * dot_ipython/ipythonrc (alias): added documentation.
4985 (xcolor): Fixed small bug (xcolors -> xcolor)
4992 (xcolor): Fixed small bug (xcolors -> xcolor)
4986
4993
4987 * Changed the alias system. Now alias is a magic command to define
4994 * Changed the alias system. Now alias is a magic command to define
4988 aliases just like the shell. Rationale: the builtin magics should
4995 aliases just like the shell. Rationale: the builtin magics should
4989 be there for things deeply connected to IPython's
4996 be there for things deeply connected to IPython's
4990 architecture. And this is a much lighter system for what I think
4997 architecture. And this is a much lighter system for what I think
4991 is the really important feature: allowing users to define quickly
4998 is the really important feature: allowing users to define quickly
4992 magics that will do shell things for them, so they can customize
4999 magics that will do shell things for them, so they can customize
4993 IPython easily to match their work habits. If someone is really
5000 IPython easily to match their work habits. If someone is really
4994 desperate to have another name for a builtin alias, they can
5001 desperate to have another name for a builtin alias, they can
4995 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5002 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4996 works.
5003 works.
4997
5004
4998 2001-11-28 Fernando Perez <fperez@colorado.edu>
5005 2001-11-28 Fernando Perez <fperez@colorado.edu>
4999
5006
5000 * Changed @file so that it opens the source file at the proper
5007 * Changed @file so that it opens the source file at the proper
5001 line. Since it uses less, if your EDITOR environment is
5008 line. Since it uses less, if your EDITOR environment is
5002 configured, typing v will immediately open your editor of choice
5009 configured, typing v will immediately open your editor of choice
5003 right at the line where the object is defined. Not as quick as
5010 right at the line where the object is defined. Not as quick as
5004 having a direct @edit command, but for all intents and purposes it
5011 having a direct @edit command, but for all intents and purposes it
5005 works. And I don't have to worry about writing @edit to deal with
5012 works. And I don't have to worry about writing @edit to deal with
5006 all the editors, less does that.
5013 all the editors, less does that.
5007
5014
5008 * Version 0.1.16 released, 0.1.17 opened.
5015 * Version 0.1.16 released, 0.1.17 opened.
5009
5016
5010 * Fixed some nasty bugs in the page/page_dumb combo that could
5017 * Fixed some nasty bugs in the page/page_dumb combo that could
5011 crash IPython.
5018 crash IPython.
5012
5019
5013 2001-11-27 Fernando Perez <fperez@colorado.edu>
5020 2001-11-27 Fernando Perez <fperez@colorado.edu>
5014
5021
5015 * Version 0.1.15 released, 0.1.16 opened.
5022 * Version 0.1.15 released, 0.1.16 opened.
5016
5023
5017 * Finally got ? and ?? to work for undefined things: now it's
5024 * Finally got ? and ?? to work for undefined things: now it's
5018 possible to type {}.get? and get information about the get method
5025 possible to type {}.get? and get information about the get method
5019 of dicts, or os.path? even if only os is defined (so technically
5026 of dicts, or os.path? even if only os is defined (so technically
5020 os.path isn't). Works at any level. For example, after import os,
5027 os.path isn't). Works at any level. For example, after import os,
5021 os?, os.path?, os.path.abspath? all work. This is great, took some
5028 os?, os.path?, os.path.abspath? all work. This is great, took some
5022 work in _ofind.
5029 work in _ofind.
5023
5030
5024 * Fixed more bugs with logging. The sanest way to do it was to add
5031 * Fixed more bugs with logging. The sanest way to do it was to add
5025 to @log a 'mode' parameter. Killed two in one shot (this mode
5032 to @log a 'mode' parameter. Killed two in one shot (this mode
5026 option was a request of Janko's). I think it's finally clean
5033 option was a request of Janko's). I think it's finally clean
5027 (famous last words).
5034 (famous last words).
5028
5035
5029 * Added a page_dumb() pager which does a decent job of paging on
5036 * Added a page_dumb() pager which does a decent job of paging on
5030 screen, if better things (like less) aren't available. One less
5037 screen, if better things (like less) aren't available. One less
5031 unix dependency (someday maybe somebody will port this to
5038 unix dependency (someday maybe somebody will port this to
5032 windows).
5039 windows).
5033
5040
5034 * Fixed problem in magic_log: would lock of logging out if log
5041 * Fixed problem in magic_log: would lock of logging out if log
5035 creation failed (because it would still think it had succeeded).
5042 creation failed (because it would still think it had succeeded).
5036
5043
5037 * Improved the page() function using curses to auto-detect screen
5044 * Improved the page() function using curses to auto-detect screen
5038 size. Now it can make a much better decision on whether to print
5045 size. Now it can make a much better decision on whether to print
5039 or page a string. Option screen_length was modified: a value 0
5046 or page a string. Option screen_length was modified: a value 0
5040 means auto-detect, and that's the default now.
5047 means auto-detect, and that's the default now.
5041
5048
5042 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5049 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5043 go out. I'll test it for a few days, then talk to Janko about
5050 go out. I'll test it for a few days, then talk to Janko about
5044 licences and announce it.
5051 licences and announce it.
5045
5052
5046 * Fixed the length of the auto-generated ---> prompt which appears
5053 * Fixed the length of the auto-generated ---> prompt which appears
5047 for auto-parens and auto-quotes. Getting this right isn't trivial,
5054 for auto-parens and auto-quotes. Getting this right isn't trivial,
5048 with all the color escapes, different prompt types and optional
5055 with all the color escapes, different prompt types and optional
5049 separators. But it seems to be working in all the combinations.
5056 separators. But it seems to be working in all the combinations.
5050
5057
5051 2001-11-26 Fernando Perez <fperez@colorado.edu>
5058 2001-11-26 Fernando Perez <fperez@colorado.edu>
5052
5059
5053 * Wrote a regexp filter to get option types from the option names
5060 * Wrote a regexp filter to get option types from the option names
5054 string. This eliminates the need to manually keep two duplicate
5061 string. This eliminates the need to manually keep two duplicate
5055 lists.
5062 lists.
5056
5063
5057 * Removed the unneeded check_option_names. Now options are handled
5064 * Removed the unneeded check_option_names. Now options are handled
5058 in a much saner manner and it's easy to visually check that things
5065 in a much saner manner and it's easy to visually check that things
5059 are ok.
5066 are ok.
5060
5067
5061 * Updated version numbers on all files I modified to carry a
5068 * Updated version numbers on all files I modified to carry a
5062 notice so Janko and Nathan have clear version markers.
5069 notice so Janko and Nathan have clear version markers.
5063
5070
5064 * Updated docstring for ultraTB with my changes. I should send
5071 * Updated docstring for ultraTB with my changes. I should send
5065 this to Nathan.
5072 this to Nathan.
5066
5073
5067 * Lots of small fixes. Ran everything through pychecker again.
5074 * Lots of small fixes. Ran everything through pychecker again.
5068
5075
5069 * Made loading of deep_reload an cmd line option. If it's not too
5076 * Made loading of deep_reload an cmd line option. If it's not too
5070 kosher, now people can just disable it. With -nodeep_reload it's
5077 kosher, now people can just disable it. With -nodeep_reload it's
5071 still available as dreload(), it just won't overwrite reload().
5078 still available as dreload(), it just won't overwrite reload().
5072
5079
5073 * Moved many options to the no| form (-opt and -noopt
5080 * Moved many options to the no| form (-opt and -noopt
5074 accepted). Cleaner.
5081 accepted). Cleaner.
5075
5082
5076 * Changed magic_log so that if called with no parameters, it uses
5083 * Changed magic_log so that if called with no parameters, it uses
5077 'rotate' mode. That way auto-generated logs aren't automatically
5084 'rotate' mode. That way auto-generated logs aren't automatically
5078 over-written. For normal logs, now a backup is made if it exists
5085 over-written. For normal logs, now a backup is made if it exists
5079 (only 1 level of backups). A new 'backup' mode was added to the
5086 (only 1 level of backups). A new 'backup' mode was added to the
5080 Logger class to support this. This was a request by Janko.
5087 Logger class to support this. This was a request by Janko.
5081
5088
5082 * Added @logoff/@logon to stop/restart an active log.
5089 * Added @logoff/@logon to stop/restart an active log.
5083
5090
5084 * Fixed a lot of bugs in log saving/replay. It was pretty
5091 * Fixed a lot of bugs in log saving/replay. It was pretty
5085 broken. Now special lines (!@,/) appear properly in the command
5092 broken. Now special lines (!@,/) appear properly in the command
5086 history after a log replay.
5093 history after a log replay.
5087
5094
5088 * Tried and failed to implement full session saving via pickle. My
5095 * Tried and failed to implement full session saving via pickle. My
5089 idea was to pickle __main__.__dict__, but modules can't be
5096 idea was to pickle __main__.__dict__, but modules can't be
5090 pickled. This would be a better alternative to replaying logs, but
5097 pickled. This would be a better alternative to replaying logs, but
5091 seems quite tricky to get to work. Changed -session to be called
5098 seems quite tricky to get to work. Changed -session to be called
5092 -logplay, which more accurately reflects what it does. And if we
5099 -logplay, which more accurately reflects what it does. And if we
5093 ever get real session saving working, -session is now available.
5100 ever get real session saving working, -session is now available.
5094
5101
5095 * Implemented color schemes for prompts also. As for tracebacks,
5102 * Implemented color schemes for prompts also. As for tracebacks,
5096 currently only NoColor and Linux are supported. But now the
5103 currently only NoColor and Linux are supported. But now the
5097 infrastructure is in place, based on a generic ColorScheme
5104 infrastructure is in place, based on a generic ColorScheme
5098 class. So writing and activating new schemes both for the prompts
5105 class. So writing and activating new schemes both for the prompts
5099 and the tracebacks should be straightforward.
5106 and the tracebacks should be straightforward.
5100
5107
5101 * Version 0.1.13 released, 0.1.14 opened.
5108 * Version 0.1.13 released, 0.1.14 opened.
5102
5109
5103 * Changed handling of options for output cache. Now counter is
5110 * Changed handling of options for output cache. Now counter is
5104 hardwired starting at 1 and one specifies the maximum number of
5111 hardwired starting at 1 and one specifies the maximum number of
5105 entries *in the outcache* (not the max prompt counter). This is
5112 entries *in the outcache* (not the max prompt counter). This is
5106 much better, since many statements won't increase the cache
5113 much better, since many statements won't increase the cache
5107 count. It also eliminated some confusing options, now there's only
5114 count. It also eliminated some confusing options, now there's only
5108 one: cache_size.
5115 one: cache_size.
5109
5116
5110 * Added 'alias' magic function and magic_alias option in the
5117 * Added 'alias' magic function and magic_alias option in the
5111 ipythonrc file. Now the user can easily define whatever names he
5118 ipythonrc file. Now the user can easily define whatever names he
5112 wants for the magic functions without having to play weird
5119 wants for the magic functions without having to play weird
5113 namespace games. This gives IPython a real shell-like feel.
5120 namespace games. This gives IPython a real shell-like feel.
5114
5121
5115 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5122 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5116 @ or not).
5123 @ or not).
5117
5124
5118 This was one of the last remaining 'visible' bugs (that I know
5125 This was one of the last remaining 'visible' bugs (that I know
5119 of). I think if I can clean up the session loading so it works
5126 of). I think if I can clean up the session loading so it works
5120 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5127 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5121 about licensing).
5128 about licensing).
5122
5129
5123 2001-11-25 Fernando Perez <fperez@colorado.edu>
5130 2001-11-25 Fernando Perez <fperez@colorado.edu>
5124
5131
5125 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5132 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5126 there's a cleaner distinction between what ? and ?? show.
5133 there's a cleaner distinction between what ? and ?? show.
5127
5134
5128 * Added screen_length option. Now the user can define his own
5135 * Added screen_length option. Now the user can define his own
5129 screen size for page() operations.
5136 screen size for page() operations.
5130
5137
5131 * Implemented magic shell-like functions with automatic code
5138 * Implemented magic shell-like functions with automatic code
5132 generation. Now adding another function is just a matter of adding
5139 generation. Now adding another function is just a matter of adding
5133 an entry to a dict, and the function is dynamically generated at
5140 an entry to a dict, and the function is dynamically generated at
5134 run-time. Python has some really cool features!
5141 run-time. Python has some really cool features!
5135
5142
5136 * Renamed many options to cleanup conventions a little. Now all
5143 * Renamed many options to cleanup conventions a little. Now all
5137 are lowercase, and only underscores where needed. Also in the code
5144 are lowercase, and only underscores where needed. Also in the code
5138 option name tables are clearer.
5145 option name tables are clearer.
5139
5146
5140 * Changed prompts a little. Now input is 'In [n]:' instead of
5147 * Changed prompts a little. Now input is 'In [n]:' instead of
5141 'In[n]:='. This allows it the numbers to be aligned with the
5148 'In[n]:='. This allows it the numbers to be aligned with the
5142 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5149 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5143 Python (it was a Mathematica thing). The '...' continuation prompt
5150 Python (it was a Mathematica thing). The '...' continuation prompt
5144 was also changed a little to align better.
5151 was also changed a little to align better.
5145
5152
5146 * Fixed bug when flushing output cache. Not all _p<n> variables
5153 * Fixed bug when flushing output cache. Not all _p<n> variables
5147 exist, so their deletion needs to be wrapped in a try:
5154 exist, so their deletion needs to be wrapped in a try:
5148
5155
5149 * Figured out how to properly use inspect.formatargspec() (it
5156 * Figured out how to properly use inspect.formatargspec() (it
5150 requires the args preceded by *). So I removed all the code from
5157 requires the args preceded by *). So I removed all the code from
5151 _get_pdef in Magic, which was just replicating that.
5158 _get_pdef in Magic, which was just replicating that.
5152
5159
5153 * Added test to prefilter to allow redefining magic function names
5160 * Added test to prefilter to allow redefining magic function names
5154 as variables. This is ok, since the @ form is always available,
5161 as variables. This is ok, since the @ form is always available,
5155 but whe should allow the user to define a variable called 'ls' if
5162 but whe should allow the user to define a variable called 'ls' if
5156 he needs it.
5163 he needs it.
5157
5164
5158 * Moved the ToDo information from README into a separate ToDo.
5165 * Moved the ToDo information from README into a separate ToDo.
5159
5166
5160 * General code cleanup and small bugfixes. I think it's close to a
5167 * General code cleanup and small bugfixes. I think it's close to a
5161 state where it can be released, obviously with a big 'beta'
5168 state where it can be released, obviously with a big 'beta'
5162 warning on it.
5169 warning on it.
5163
5170
5164 * Got the magic function split to work. Now all magics are defined
5171 * Got the magic function split to work. Now all magics are defined
5165 in a separate class. It just organizes things a bit, and now
5172 in a separate class. It just organizes things a bit, and now
5166 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5173 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5167 was too long).
5174 was too long).
5168
5175
5169 * Changed @clear to @reset to avoid potential confusions with
5176 * Changed @clear to @reset to avoid potential confusions with
5170 the shell command clear. Also renamed @cl to @clear, which does
5177 the shell command clear. Also renamed @cl to @clear, which does
5171 exactly what people expect it to from their shell experience.
5178 exactly what people expect it to from their shell experience.
5172
5179
5173 Added a check to the @reset command (since it's so
5180 Added a check to the @reset command (since it's so
5174 destructive, it's probably a good idea to ask for confirmation).
5181 destructive, it's probably a good idea to ask for confirmation).
5175 But now reset only works for full namespace resetting. Since the
5182 But now reset only works for full namespace resetting. Since the
5176 del keyword is already there for deleting a few specific
5183 del keyword is already there for deleting a few specific
5177 variables, I don't see the point of having a redundant magic
5184 variables, I don't see the point of having a redundant magic
5178 function for the same task.
5185 function for the same task.
5179
5186
5180 2001-11-24 Fernando Perez <fperez@colorado.edu>
5187 2001-11-24 Fernando Perez <fperez@colorado.edu>
5181
5188
5182 * Updated the builtin docs (esp. the ? ones).
5189 * Updated the builtin docs (esp. the ? ones).
5183
5190
5184 * Ran all the code through pychecker. Not terribly impressed with
5191 * Ran all the code through pychecker. Not terribly impressed with
5185 it: lots of spurious warnings and didn't really find anything of
5192 it: lots of spurious warnings and didn't really find anything of
5186 substance (just a few modules being imported and not used).
5193 substance (just a few modules being imported and not used).
5187
5194
5188 * Implemented the new ultraTB functionality into IPython. New
5195 * Implemented the new ultraTB functionality into IPython. New
5189 option: xcolors. This chooses color scheme. xmode now only selects
5196 option: xcolors. This chooses color scheme. xmode now only selects
5190 between Plain and Verbose. Better orthogonality.
5197 between Plain and Verbose. Better orthogonality.
5191
5198
5192 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5199 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5193 mode and color scheme for the exception handlers. Now it's
5200 mode and color scheme for the exception handlers. Now it's
5194 possible to have the verbose traceback with no coloring.
5201 possible to have the verbose traceback with no coloring.
5195
5202
5196 2001-11-23 Fernando Perez <fperez@colorado.edu>
5203 2001-11-23 Fernando Perez <fperez@colorado.edu>
5197
5204
5198 * Version 0.1.12 released, 0.1.13 opened.
5205 * Version 0.1.12 released, 0.1.13 opened.
5199
5206
5200 * Removed option to set auto-quote and auto-paren escapes by
5207 * Removed option to set auto-quote and auto-paren escapes by
5201 user. The chances of breaking valid syntax are just too high. If
5208 user. The chances of breaking valid syntax are just too high. If
5202 someone *really* wants, they can always dig into the code.
5209 someone *really* wants, they can always dig into the code.
5203
5210
5204 * Made prompt separators configurable.
5211 * Made prompt separators configurable.
5205
5212
5206 2001-11-22 Fernando Perez <fperez@colorado.edu>
5213 2001-11-22 Fernando Perez <fperez@colorado.edu>
5207
5214
5208 * Small bugfixes in many places.
5215 * Small bugfixes in many places.
5209
5216
5210 * Removed the MyCompleter class from ipplib. It seemed redundant
5217 * Removed the MyCompleter class from ipplib. It seemed redundant
5211 with the C-p,C-n history search functionality. Less code to
5218 with the C-p,C-n history search functionality. Less code to
5212 maintain.
5219 maintain.
5213
5220
5214 * Moved all the original ipython.py code into ipythonlib.py. Right
5221 * Moved all the original ipython.py code into ipythonlib.py. Right
5215 now it's just one big dump into a function called make_IPython, so
5222 now it's just one big dump into a function called make_IPython, so
5216 no real modularity has been gained. But at least it makes the
5223 no real modularity has been gained. But at least it makes the
5217 wrapper script tiny, and since ipythonlib is a module, it gets
5224 wrapper script tiny, and since ipythonlib is a module, it gets
5218 compiled and startup is much faster.
5225 compiled and startup is much faster.
5219
5226
5220 This is a reasobably 'deep' change, so we should test it for a
5227 This is a reasobably 'deep' change, so we should test it for a
5221 while without messing too much more with the code.
5228 while without messing too much more with the code.
5222
5229
5223 2001-11-21 Fernando Perez <fperez@colorado.edu>
5230 2001-11-21 Fernando Perez <fperez@colorado.edu>
5224
5231
5225 * Version 0.1.11 released, 0.1.12 opened for further work.
5232 * Version 0.1.11 released, 0.1.12 opened for further work.
5226
5233
5227 * Removed dependency on Itpl. It was only needed in one place. It
5234 * Removed dependency on Itpl. It was only needed in one place. It
5228 would be nice if this became part of python, though. It makes life
5235 would be nice if this became part of python, though. It makes life
5229 *a lot* easier in some cases.
5236 *a lot* easier in some cases.
5230
5237
5231 * Simplified the prefilter code a bit. Now all handlers are
5238 * Simplified the prefilter code a bit. Now all handlers are
5232 expected to explicitly return a value (at least a blank string).
5239 expected to explicitly return a value (at least a blank string).
5233
5240
5234 * Heavy edits in ipplib. Removed the help system altogether. Now
5241 * Heavy edits in ipplib. Removed the help system altogether. Now
5235 obj?/?? is used for inspecting objects, a magic @doc prints
5242 obj?/?? is used for inspecting objects, a magic @doc prints
5236 docstrings, and full-blown Python help is accessed via the 'help'
5243 docstrings, and full-blown Python help is accessed via the 'help'
5237 keyword. This cleans up a lot of code (less to maintain) and does
5244 keyword. This cleans up a lot of code (less to maintain) and does
5238 the job. Since 'help' is now a standard Python component, might as
5245 the job. Since 'help' is now a standard Python component, might as
5239 well use it and remove duplicate functionality.
5246 well use it and remove duplicate functionality.
5240
5247
5241 Also removed the option to use ipplib as a standalone program. By
5248 Also removed the option to use ipplib as a standalone program. By
5242 now it's too dependent on other parts of IPython to function alone.
5249 now it's too dependent on other parts of IPython to function alone.
5243
5250
5244 * Fixed bug in genutils.pager. It would crash if the pager was
5251 * Fixed bug in genutils.pager. It would crash if the pager was
5245 exited immediately after opening (broken pipe).
5252 exited immediately after opening (broken pipe).
5246
5253
5247 * Trimmed down the VerboseTB reporting a little. The header is
5254 * Trimmed down the VerboseTB reporting a little. The header is
5248 much shorter now and the repeated exception arguments at the end
5255 much shorter now and the repeated exception arguments at the end
5249 have been removed. For interactive use the old header seemed a bit
5256 have been removed. For interactive use the old header seemed a bit
5250 excessive.
5257 excessive.
5251
5258
5252 * Fixed small bug in output of @whos for variables with multi-word
5259 * Fixed small bug in output of @whos for variables with multi-word
5253 types (only first word was displayed).
5260 types (only first word was displayed).
5254
5261
5255 2001-11-17 Fernando Perez <fperez@colorado.edu>
5262 2001-11-17 Fernando Perez <fperez@colorado.edu>
5256
5263
5257 * Version 0.1.10 released, 0.1.11 opened for further work.
5264 * Version 0.1.10 released, 0.1.11 opened for further work.
5258
5265
5259 * Modified dirs and friends. dirs now *returns* the stack (not
5266 * Modified dirs and friends. dirs now *returns* the stack (not
5260 prints), so one can manipulate it as a variable. Convenient to
5267 prints), so one can manipulate it as a variable. Convenient to
5261 travel along many directories.
5268 travel along many directories.
5262
5269
5263 * Fixed bug in magic_pdef: would only work with functions with
5270 * Fixed bug in magic_pdef: would only work with functions with
5264 arguments with default values.
5271 arguments with default values.
5265
5272
5266 2001-11-14 Fernando Perez <fperez@colorado.edu>
5273 2001-11-14 Fernando Perez <fperez@colorado.edu>
5267
5274
5268 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5275 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5269 example with IPython. Various other minor fixes and cleanups.
5276 example with IPython. Various other minor fixes and cleanups.
5270
5277
5271 * Version 0.1.9 released, 0.1.10 opened for further work.
5278 * Version 0.1.9 released, 0.1.10 opened for further work.
5272
5279
5273 * Added sys.path to the list of directories searched in the
5280 * Added sys.path to the list of directories searched in the
5274 execfile= option. It used to be the current directory and the
5281 execfile= option. It used to be the current directory and the
5275 user's IPYTHONDIR only.
5282 user's IPYTHONDIR only.
5276
5283
5277 2001-11-13 Fernando Perez <fperez@colorado.edu>
5284 2001-11-13 Fernando Perez <fperez@colorado.edu>
5278
5285
5279 * Reinstated the raw_input/prefilter separation that Janko had
5286 * Reinstated the raw_input/prefilter separation that Janko had
5280 initially. This gives a more convenient setup for extending the
5287 initially. This gives a more convenient setup for extending the
5281 pre-processor from the outside: raw_input always gets a string,
5288 pre-processor from the outside: raw_input always gets a string,
5282 and prefilter has to process it. We can then redefine prefilter
5289 and prefilter has to process it. We can then redefine prefilter
5283 from the outside and implement extensions for special
5290 from the outside and implement extensions for special
5284 purposes.
5291 purposes.
5285
5292
5286 Today I got one for inputting PhysicalQuantity objects
5293 Today I got one for inputting PhysicalQuantity objects
5287 (from Scientific) without needing any function calls at
5294 (from Scientific) without needing any function calls at
5288 all. Extremely convenient, and it's all done as a user-level
5295 all. Extremely convenient, and it's all done as a user-level
5289 extension (no IPython code was touched). Now instead of:
5296 extension (no IPython code was touched). Now instead of:
5290 a = PhysicalQuantity(4.2,'m/s**2')
5297 a = PhysicalQuantity(4.2,'m/s**2')
5291 one can simply say
5298 one can simply say
5292 a = 4.2 m/s**2
5299 a = 4.2 m/s**2
5293 or even
5300 or even
5294 a = 4.2 m/s^2
5301 a = 4.2 m/s^2
5295
5302
5296 I use this, but it's also a proof of concept: IPython really is
5303 I use this, but it's also a proof of concept: IPython really is
5297 fully user-extensible, even at the level of the parsing of the
5304 fully user-extensible, even at the level of the parsing of the
5298 command line. It's not trivial, but it's perfectly doable.
5305 command line. It's not trivial, but it's perfectly doable.
5299
5306
5300 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5307 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5301 the problem of modules being loaded in the inverse order in which
5308 the problem of modules being loaded in the inverse order in which
5302 they were defined in
5309 they were defined in
5303
5310
5304 * Version 0.1.8 released, 0.1.9 opened for further work.
5311 * Version 0.1.8 released, 0.1.9 opened for further work.
5305
5312
5306 * Added magics pdef, source and file. They respectively show the
5313 * Added magics pdef, source and file. They respectively show the
5307 definition line ('prototype' in C), source code and full python
5314 definition line ('prototype' in C), source code and full python
5308 file for any callable object. The object inspector oinfo uses
5315 file for any callable object. The object inspector oinfo uses
5309 these to show the same information.
5316 these to show the same information.
5310
5317
5311 * Version 0.1.7 released, 0.1.8 opened for further work.
5318 * Version 0.1.7 released, 0.1.8 opened for further work.
5312
5319
5313 * Separated all the magic functions into a class called Magic. The
5320 * Separated all the magic functions into a class called Magic. The
5314 InteractiveShell class was becoming too big for Xemacs to handle
5321 InteractiveShell class was becoming too big for Xemacs to handle
5315 (de-indenting a line would lock it up for 10 seconds while it
5322 (de-indenting a line would lock it up for 10 seconds while it
5316 backtracked on the whole class!)
5323 backtracked on the whole class!)
5317
5324
5318 FIXME: didn't work. It can be done, but right now namespaces are
5325 FIXME: didn't work. It can be done, but right now namespaces are
5319 all messed up. Do it later (reverted it for now, so at least
5326 all messed up. Do it later (reverted it for now, so at least
5320 everything works as before).
5327 everything works as before).
5321
5328
5322 * Got the object introspection system (magic_oinfo) working! I
5329 * Got the object introspection system (magic_oinfo) working! I
5323 think this is pretty much ready for release to Janko, so he can
5330 think this is pretty much ready for release to Janko, so he can
5324 test it for a while and then announce it. Pretty much 100% of what
5331 test it for a while and then announce it. Pretty much 100% of what
5325 I wanted for the 'phase 1' release is ready. Happy, tired.
5332 I wanted for the 'phase 1' release is ready. Happy, tired.
5326
5333
5327 2001-11-12 Fernando Perez <fperez@colorado.edu>
5334 2001-11-12 Fernando Perez <fperez@colorado.edu>
5328
5335
5329 * Version 0.1.6 released, 0.1.7 opened for further work.
5336 * Version 0.1.6 released, 0.1.7 opened for further work.
5330
5337
5331 * Fixed bug in printing: it used to test for truth before
5338 * Fixed bug in printing: it used to test for truth before
5332 printing, so 0 wouldn't print. Now checks for None.
5339 printing, so 0 wouldn't print. Now checks for None.
5333
5340
5334 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5341 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5335 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5342 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5336 reaches by hand into the outputcache. Think of a better way to do
5343 reaches by hand into the outputcache. Think of a better way to do
5337 this later.
5344 this later.
5338
5345
5339 * Various small fixes thanks to Nathan's comments.
5346 * Various small fixes thanks to Nathan's comments.
5340
5347
5341 * Changed magic_pprint to magic_Pprint. This way it doesn't
5348 * Changed magic_pprint to magic_Pprint. This way it doesn't
5342 collide with pprint() and the name is consistent with the command
5349 collide with pprint() and the name is consistent with the command
5343 line option.
5350 line option.
5344
5351
5345 * Changed prompt counter behavior to be fully like
5352 * Changed prompt counter behavior to be fully like
5346 Mathematica's. That is, even input that doesn't return a result
5353 Mathematica's. That is, even input that doesn't return a result
5347 raises the prompt counter. The old behavior was kind of confusing
5354 raises the prompt counter. The old behavior was kind of confusing
5348 (getting the same prompt number several times if the operation
5355 (getting the same prompt number several times if the operation
5349 didn't return a result).
5356 didn't return a result).
5350
5357
5351 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5358 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5352
5359
5353 * Fixed -Classic mode (wasn't working anymore).
5360 * Fixed -Classic mode (wasn't working anymore).
5354
5361
5355 * Added colored prompts using Nathan's new code. Colors are
5362 * Added colored prompts using Nathan's new code. Colors are
5356 currently hardwired, they can be user-configurable. For
5363 currently hardwired, they can be user-configurable. For
5357 developers, they can be chosen in file ipythonlib.py, at the
5364 developers, they can be chosen in file ipythonlib.py, at the
5358 beginning of the CachedOutput class def.
5365 beginning of the CachedOutput class def.
5359
5366
5360 2001-11-11 Fernando Perez <fperez@colorado.edu>
5367 2001-11-11 Fernando Perez <fperez@colorado.edu>
5361
5368
5362 * Version 0.1.5 released, 0.1.6 opened for further work.
5369 * Version 0.1.5 released, 0.1.6 opened for further work.
5363
5370
5364 * Changed magic_env to *return* the environment as a dict (not to
5371 * Changed magic_env to *return* the environment as a dict (not to
5365 print it). This way it prints, but it can also be processed.
5372 print it). This way it prints, but it can also be processed.
5366
5373
5367 * Added Verbose exception reporting to interactive
5374 * Added Verbose exception reporting to interactive
5368 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5375 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5369 traceback. Had to make some changes to the ultraTB file. This is
5376 traceback. Had to make some changes to the ultraTB file. This is
5370 probably the last 'big' thing in my mental todo list. This ties
5377 probably the last 'big' thing in my mental todo list. This ties
5371 in with the next entry:
5378 in with the next entry:
5372
5379
5373 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5380 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5374 has to specify is Plain, Color or Verbose for all exception
5381 has to specify is Plain, Color or Verbose for all exception
5375 handling.
5382 handling.
5376
5383
5377 * Removed ShellServices option. All this can really be done via
5384 * Removed ShellServices option. All this can really be done via
5378 the magic system. It's easier to extend, cleaner and has automatic
5385 the magic system. It's easier to extend, cleaner and has automatic
5379 namespace protection and documentation.
5386 namespace protection and documentation.
5380
5387
5381 2001-11-09 Fernando Perez <fperez@colorado.edu>
5388 2001-11-09 Fernando Perez <fperez@colorado.edu>
5382
5389
5383 * Fixed bug in output cache flushing (missing parameter to
5390 * Fixed bug in output cache flushing (missing parameter to
5384 __init__). Other small bugs fixed (found using pychecker).
5391 __init__). Other small bugs fixed (found using pychecker).
5385
5392
5386 * Version 0.1.4 opened for bugfixing.
5393 * Version 0.1.4 opened for bugfixing.
5387
5394
5388 2001-11-07 Fernando Perez <fperez@colorado.edu>
5395 2001-11-07 Fernando Perez <fperez@colorado.edu>
5389
5396
5390 * Version 0.1.3 released, mainly because of the raw_input bug.
5397 * Version 0.1.3 released, mainly because of the raw_input bug.
5391
5398
5392 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5399 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5393 and when testing for whether things were callable, a call could
5400 and when testing for whether things were callable, a call could
5394 actually be made to certain functions. They would get called again
5401 actually be made to certain functions. They would get called again
5395 once 'really' executed, with a resulting double call. A disaster
5402 once 'really' executed, with a resulting double call. A disaster
5396 in many cases (list.reverse() would never work!).
5403 in many cases (list.reverse() would never work!).
5397
5404
5398 * Removed prefilter() function, moved its code to raw_input (which
5405 * Removed prefilter() function, moved its code to raw_input (which
5399 after all was just a near-empty caller for prefilter). This saves
5406 after all was just a near-empty caller for prefilter). This saves
5400 a function call on every prompt, and simplifies the class a tiny bit.
5407 a function call on every prompt, and simplifies the class a tiny bit.
5401
5408
5402 * Fix _ip to __ip name in magic example file.
5409 * Fix _ip to __ip name in magic example file.
5403
5410
5404 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5411 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5405 work with non-gnu versions of tar.
5412 work with non-gnu versions of tar.
5406
5413
5407 2001-11-06 Fernando Perez <fperez@colorado.edu>
5414 2001-11-06 Fernando Perez <fperez@colorado.edu>
5408
5415
5409 * Version 0.1.2. Just to keep track of the recent changes.
5416 * Version 0.1.2. Just to keep track of the recent changes.
5410
5417
5411 * Fixed nasty bug in output prompt routine. It used to check 'if
5418 * Fixed nasty bug in output prompt routine. It used to check 'if
5412 arg != None...'. Problem is, this fails if arg implements a
5419 arg != None...'. Problem is, this fails if arg implements a
5413 special comparison (__cmp__) which disallows comparing to
5420 special comparison (__cmp__) which disallows comparing to
5414 None. Found it when trying to use the PhysicalQuantity module from
5421 None. Found it when trying to use the PhysicalQuantity module from
5415 ScientificPython.
5422 ScientificPython.
5416
5423
5417 2001-11-05 Fernando Perez <fperez@colorado.edu>
5424 2001-11-05 Fernando Perez <fperez@colorado.edu>
5418
5425
5419 * Also added dirs. Now the pushd/popd/dirs family functions
5426 * Also added dirs. Now the pushd/popd/dirs family functions
5420 basically like the shell, with the added convenience of going home
5427 basically like the shell, with the added convenience of going home
5421 when called with no args.
5428 when called with no args.
5422
5429
5423 * pushd/popd slightly modified to mimic shell behavior more
5430 * pushd/popd slightly modified to mimic shell behavior more
5424 closely.
5431 closely.
5425
5432
5426 * Added env,pushd,popd from ShellServices as magic functions. I
5433 * Added env,pushd,popd from ShellServices as magic functions. I
5427 think the cleanest will be to port all desired functions from
5434 think the cleanest will be to port all desired functions from
5428 ShellServices as magics and remove ShellServices altogether. This
5435 ShellServices as magics and remove ShellServices altogether. This
5429 will provide a single, clean way of adding functionality
5436 will provide a single, clean way of adding functionality
5430 (shell-type or otherwise) to IP.
5437 (shell-type or otherwise) to IP.
5431
5438
5432 2001-11-04 Fernando Perez <fperez@colorado.edu>
5439 2001-11-04 Fernando Perez <fperez@colorado.edu>
5433
5440
5434 * Added .ipython/ directory to sys.path. This way users can keep
5441 * Added .ipython/ directory to sys.path. This way users can keep
5435 customizations there and access them via import.
5442 customizations there and access them via import.
5436
5443
5437 2001-11-03 Fernando Perez <fperez@colorado.edu>
5444 2001-11-03 Fernando Perez <fperez@colorado.edu>
5438
5445
5439 * Opened version 0.1.1 for new changes.
5446 * Opened version 0.1.1 for new changes.
5440
5447
5441 * Changed version number to 0.1.0: first 'public' release, sent to
5448 * Changed version number to 0.1.0: first 'public' release, sent to
5442 Nathan and Janko.
5449 Nathan and Janko.
5443
5450
5444 * Lots of small fixes and tweaks.
5451 * Lots of small fixes and tweaks.
5445
5452
5446 * Minor changes to whos format. Now strings are shown, snipped if
5453 * Minor changes to whos format. Now strings are shown, snipped if
5447 too long.
5454 too long.
5448
5455
5449 * Changed ShellServices to work on __main__ so they show up in @who
5456 * Changed ShellServices to work on __main__ so they show up in @who
5450
5457
5451 * Help also works with ? at the end of a line:
5458 * Help also works with ? at the end of a line:
5452 ?sin and sin?
5459 ?sin and sin?
5453 both produce the same effect. This is nice, as often I use the
5460 both produce the same effect. This is nice, as often I use the
5454 tab-complete to find the name of a method, but I used to then have
5461 tab-complete to find the name of a method, but I used to then have
5455 to go to the beginning of the line to put a ? if I wanted more
5462 to go to the beginning of the line to put a ? if I wanted more
5456 info. Now I can just add the ? and hit return. Convenient.
5463 info. Now I can just add the ? and hit return. Convenient.
5457
5464
5458 2001-11-02 Fernando Perez <fperez@colorado.edu>
5465 2001-11-02 Fernando Perez <fperez@colorado.edu>
5459
5466
5460 * Python version check (>=2.1) added.
5467 * Python version check (>=2.1) added.
5461
5468
5462 * Added LazyPython documentation. At this point the docs are quite
5469 * Added LazyPython documentation. At this point the docs are quite
5463 a mess. A cleanup is in order.
5470 a mess. A cleanup is in order.
5464
5471
5465 * Auto-installer created. For some bizarre reason, the zipfiles
5472 * Auto-installer created. For some bizarre reason, the zipfiles
5466 module isn't working on my system. So I made a tar version
5473 module isn't working on my system. So I made a tar version
5467 (hopefully the command line options in various systems won't kill
5474 (hopefully the command line options in various systems won't kill
5468 me).
5475 me).
5469
5476
5470 * Fixes to Struct in genutils. Now all dictionary-like methods are
5477 * Fixes to Struct in genutils. Now all dictionary-like methods are
5471 protected (reasonably).
5478 protected (reasonably).
5472
5479
5473 * Added pager function to genutils and changed ? to print usage
5480 * Added pager function to genutils and changed ? to print usage
5474 note through it (it was too long).
5481 note through it (it was too long).
5475
5482
5476 * Added the LazyPython functionality. Works great! I changed the
5483 * Added the LazyPython functionality. Works great! I changed the
5477 auto-quote escape to ';', it's on home row and next to '. But
5484 auto-quote escape to ';', it's on home row and next to '. But
5478 both auto-quote and auto-paren (still /) escapes are command-line
5485 both auto-quote and auto-paren (still /) escapes are command-line
5479 parameters.
5486 parameters.
5480
5487
5481
5488
5482 2001-11-01 Fernando Perez <fperez@colorado.edu>
5489 2001-11-01 Fernando Perez <fperez@colorado.edu>
5483
5490
5484 * Version changed to 0.0.7. Fairly large change: configuration now
5491 * Version changed to 0.0.7. Fairly large change: configuration now
5485 is all stored in a directory, by default .ipython. There, all
5492 is all stored in a directory, by default .ipython. There, all
5486 config files have normal looking names (not .names)
5493 config files have normal looking names (not .names)
5487
5494
5488 * Version 0.0.6 Released first to Lucas and Archie as a test
5495 * Version 0.0.6 Released first to Lucas and Archie as a test
5489 run. Since it's the first 'semi-public' release, change version to
5496 run. Since it's the first 'semi-public' release, change version to
5490 > 0.0.6 for any changes now.
5497 > 0.0.6 for any changes now.
5491
5498
5492 * Stuff I had put in the ipplib.py changelog:
5499 * Stuff I had put in the ipplib.py changelog:
5493
5500
5494 Changes to InteractiveShell:
5501 Changes to InteractiveShell:
5495
5502
5496 - Made the usage message a parameter.
5503 - Made the usage message a parameter.
5497
5504
5498 - Require the name of the shell variable to be given. It's a bit
5505 - Require the name of the shell variable to be given. It's a bit
5499 of a hack, but allows the name 'shell' not to be hardwire in the
5506 of a hack, but allows the name 'shell' not to be hardwire in the
5500 magic (@) handler, which is problematic b/c it requires
5507 magic (@) handler, which is problematic b/c it requires
5501 polluting the global namespace with 'shell'. This in turn is
5508 polluting the global namespace with 'shell'. This in turn is
5502 fragile: if a user redefines a variable called shell, things
5509 fragile: if a user redefines a variable called shell, things
5503 break.
5510 break.
5504
5511
5505 - magic @: all functions available through @ need to be defined
5512 - magic @: all functions available through @ need to be defined
5506 as magic_<name>, even though they can be called simply as
5513 as magic_<name>, even though they can be called simply as
5507 @<name>. This allows the special command @magic to gather
5514 @<name>. This allows the special command @magic to gather
5508 information automatically about all existing magic functions,
5515 information automatically about all existing magic functions,
5509 even if they are run-time user extensions, by parsing the shell
5516 even if they are run-time user extensions, by parsing the shell
5510 instance __dict__ looking for special magic_ names.
5517 instance __dict__ looking for special magic_ names.
5511
5518
5512 - mainloop: added *two* local namespace parameters. This allows
5519 - mainloop: added *two* local namespace parameters. This allows
5513 the class to differentiate between parameters which were there
5520 the class to differentiate between parameters which were there
5514 before and after command line initialization was processed. This
5521 before and after command line initialization was processed. This
5515 way, later @who can show things loaded at startup by the
5522 way, later @who can show things loaded at startup by the
5516 user. This trick was necessary to make session saving/reloading
5523 user. This trick was necessary to make session saving/reloading
5517 really work: ideally after saving/exiting/reloading a session,
5524 really work: ideally after saving/exiting/reloading a session,
5518 *everythin* should look the same, including the output of @who. I
5525 *everythin* should look the same, including the output of @who. I
5519 was only able to make this work with this double namespace
5526 was only able to make this work with this double namespace
5520 trick.
5527 trick.
5521
5528
5522 - added a header to the logfile which allows (almost) full
5529 - added a header to the logfile which allows (almost) full
5523 session restoring.
5530 session restoring.
5524
5531
5525 - prepend lines beginning with @ or !, with a and log
5532 - prepend lines beginning with @ or !, with a and log
5526 them. Why? !lines: may be useful to know what you did @lines:
5533 them. Why? !lines: may be useful to know what you did @lines:
5527 they may affect session state. So when restoring a session, at
5534 they may affect session state. So when restoring a session, at
5528 least inform the user of their presence. I couldn't quite get
5535 least inform the user of their presence. I couldn't quite get
5529 them to properly re-execute, but at least the user is warned.
5536 them to properly re-execute, but at least the user is warned.
5530
5537
5531 * Started ChangeLog.
5538 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now