##// END OF EJS Templates
ipalias deprecated/redundant; aliases are converted and called...
vivainio -
Show More
@@ -1,2244 +1,2252 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 1107 2006-01-30 19:02:20Z vivainio $
9 $Id: iplib.py 1111 2006-01-30 21:16:07Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from __future__ import generators # for 2.2 backwards-compatibility
31 from __future__ import generators # for 2.2 backwards-compatibility
32
32
33 from IPython import Release
33 from IPython import Release
34 __author__ = '%s <%s>\n%s <%s>' % \
34 __author__ = '%s <%s>\n%s <%s>' % \
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
36 __license__ = Release.license
36 __license__ = Release.license
37 __version__ = Release.version
37 __version__ = Release.version
38
38
39 # Python standard modules
39 # Python standard modules
40 import __main__
40 import __main__
41 import __builtin__
41 import __builtin__
42 import StringIO
42 import StringIO
43 import bdb
43 import bdb
44 import cPickle as pickle
44 import cPickle as pickle
45 import codeop
45 import codeop
46 import exceptions
46 import exceptions
47 import glob
47 import glob
48 import inspect
48 import inspect
49 import keyword
49 import keyword
50 import new
50 import new
51 import os
51 import os
52 import pdb
52 import pdb
53 import pydoc
53 import pydoc
54 import re
54 import re
55 import shutil
55 import shutil
56 import string
56 import string
57 import sys
57 import sys
58 import tempfile
58 import tempfile
59 import traceback
59 import traceback
60 import types
60 import types
61 import pickleshare
61 import pickleshare
62
62
63 from pprint import pprint, pformat
63 from pprint import pprint, pformat
64
64
65 # IPython's own modules
65 # IPython's own modules
66 import IPython
66 import IPython
67 from IPython import OInspect,PyColorize,ultraTB
67 from IPython import OInspect,PyColorize,ultraTB
68 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
68 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
69 from IPython.FakeModule import FakeModule
69 from IPython.FakeModule import FakeModule
70 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
70 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
71 from IPython.Logger import Logger
71 from IPython.Logger import Logger
72 from IPython.Magic import Magic
72 from IPython.Magic import Magic
73 from IPython.Prompts import CachedOutput
73 from IPython.Prompts import CachedOutput
74 from IPython.ipstruct import Struct
74 from IPython.ipstruct import Struct
75 from IPython.background_jobs import BackgroundJobManager
75 from IPython.background_jobs import BackgroundJobManager
76 from IPython.usage import cmd_line_usage,interactive_usage
76 from IPython.usage import cmd_line_usage,interactive_usage
77 from IPython.genutils import *
77 from IPython.genutils import *
78 import IPython.ipapi
78 import IPython.ipapi
79
79
80 # Globals
80 # Globals
81
81
82 # store the builtin raw_input globally, and use this always, in case user code
82 # store the builtin raw_input globally, and use this always, in case user code
83 # overwrites it (like wx.py.PyShell does)
83 # overwrites it (like wx.py.PyShell does)
84 raw_input_original = raw_input
84 raw_input_original = raw_input
85
85
86 # compiled regexps for autoindent management
86 # compiled regexps for autoindent management
87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88
88
89
89
90 #****************************************************************************
90 #****************************************************************************
91 # Some utility function definitions
91 # Some utility function definitions
92
92
93 ini_spaces_re = re.compile(r'^(\s+)')
93 ini_spaces_re = re.compile(r'^(\s+)')
94
94
95 def num_ini_spaces(strng):
95 def num_ini_spaces(strng):
96 """Return the number of initial spaces in a string"""
96 """Return the number of initial spaces in a string"""
97
97
98 ini_spaces = ini_spaces_re.match(strng)
98 ini_spaces = ini_spaces_re.match(strng)
99 if ini_spaces:
99 if ini_spaces:
100 return ini_spaces.end()
100 return ini_spaces.end()
101 else:
101 else:
102 return 0
102 return 0
103
103
104 def softspace(file, newvalue):
104 def softspace(file, newvalue):
105 """Copied from code.py, to remove the dependency"""
105 """Copied from code.py, to remove the dependency"""
106
106
107 oldvalue = 0
107 oldvalue = 0
108 try:
108 try:
109 oldvalue = file.softspace
109 oldvalue = file.softspace
110 except AttributeError:
110 except AttributeError:
111 pass
111 pass
112 try:
112 try:
113 file.softspace = newvalue
113 file.softspace = newvalue
114 except (AttributeError, TypeError):
114 except (AttributeError, TypeError):
115 # "attribute-less object" or "read-only attributes"
115 # "attribute-less object" or "read-only attributes"
116 pass
116 pass
117 return oldvalue
117 return oldvalue
118
118
119
119
120 #****************************************************************************
120 #****************************************************************************
121 # Local use exceptions
121 # Local use exceptions
122 class SpaceInInput(exceptions.Exception): pass
122 class SpaceInInput(exceptions.Exception): pass
123
123
124
124
125 #****************************************************************************
125 #****************************************************************************
126 # Local use classes
126 # Local use classes
127 class Bunch: pass
127 class Bunch: pass
128
128
129 class Undefined: pass
129 class Undefined: pass
130
130
131 class InputList(list):
131 class InputList(list):
132 """Class to store user input.
132 """Class to store user input.
133
133
134 It's basically a list, but slices return a string instead of a list, thus
134 It's basically a list, but slices return a string instead of a list, thus
135 allowing things like (assuming 'In' is an instance):
135 allowing things like (assuming 'In' is an instance):
136
136
137 exec In[4:7]
137 exec In[4:7]
138
138
139 or
139 or
140
140
141 exec In[5:9] + In[14] + In[21:25]"""
141 exec In[5:9] + In[14] + In[21:25]"""
142
142
143 def __getslice__(self,i,j):
143 def __getslice__(self,i,j):
144 return ''.join(list.__getslice__(self,i,j))
144 return ''.join(list.__getslice__(self,i,j))
145
145
146 class SyntaxTB(ultraTB.ListTB):
146 class SyntaxTB(ultraTB.ListTB):
147 """Extension which holds some state: the last exception value"""
147 """Extension which holds some state: the last exception value"""
148
148
149 def __init__(self,color_scheme = 'NoColor'):
149 def __init__(self,color_scheme = 'NoColor'):
150 ultraTB.ListTB.__init__(self,color_scheme)
150 ultraTB.ListTB.__init__(self,color_scheme)
151 self.last_syntax_error = None
151 self.last_syntax_error = None
152
152
153 def __call__(self, etype, value, elist):
153 def __call__(self, etype, value, elist):
154 self.last_syntax_error = value
154 self.last_syntax_error = value
155 ultraTB.ListTB.__call__(self,etype,value,elist)
155 ultraTB.ListTB.__call__(self,etype,value,elist)
156
156
157 def clear_err_state(self):
157 def clear_err_state(self):
158 """Return the current error state and clear it"""
158 """Return the current error state and clear it"""
159 e = self.last_syntax_error
159 e = self.last_syntax_error
160 self.last_syntax_error = None
160 self.last_syntax_error = None
161 return e
161 return e
162
162
163 #****************************************************************************
163 #****************************************************************************
164 # Main IPython class
164 # Main IPython class
165
165
166 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
166 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
167 # until a full rewrite is made. I've cleaned all cross-class uses of
167 # until a full rewrite is made. I've cleaned all cross-class uses of
168 # attributes and methods, but too much user code out there relies on the
168 # attributes and methods, but too much user code out there relies on the
169 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
169 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
170 #
170 #
171 # But at least now, all the pieces have been separated and we could, in
171 # But at least now, all the pieces have been separated and we could, in
172 # principle, stop using the mixin. This will ease the transition to the
172 # principle, stop using the mixin. This will ease the transition to the
173 # chainsaw branch.
173 # chainsaw branch.
174
174
175 # For reference, the following is the list of 'self.foo' uses in the Magic
175 # For reference, the following is the list of 'self.foo' uses in the Magic
176 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
176 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
177 # class, to prevent clashes.
177 # class, to prevent clashes.
178
178
179 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
179 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
180 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
180 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
181 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
181 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
182 # 'self.value']
182 # 'self.value']
183
183
184 class InteractiveShell(object,Magic):
184 class InteractiveShell(object,Magic):
185 """An enhanced console for Python."""
185 """An enhanced console for Python."""
186
186
187 # class attribute to indicate whether the class supports threads or not.
187 # class attribute to indicate whether the class supports threads or not.
188 # Subclasses with thread support should override this as needed.
188 # Subclasses with thread support should override this as needed.
189 isthreaded = False
189 isthreaded = False
190
190
191 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
191 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
192 user_ns = None,user_global_ns=None,banner2='',
192 user_ns = None,user_global_ns=None,banner2='',
193 custom_exceptions=((),None),embedded=False):
193 custom_exceptions=((),None),embedded=False):
194
194
195
195
196 # log system
196 # log system
197 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
197 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
198
198
199 # Produce a public API instance
199 # Produce a public API instance
200
200
201 self.api = IPython.ipapi.IPApi(self)
201 self.api = IPython.ipapi.IPApi(self)
202
202
203 # some minimal strict typechecks. For some core data structures, I
203 # some minimal strict typechecks. For some core data structures, I
204 # want actual basic python types, not just anything that looks like
204 # want actual basic python types, not just anything that looks like
205 # one. This is especially true for namespaces.
205 # one. This is especially true for namespaces.
206 for ns in (user_ns,user_global_ns):
206 for ns in (user_ns,user_global_ns):
207 if ns is not None and type(ns) != types.DictType:
207 if ns is not None and type(ns) != types.DictType:
208 raise TypeError,'namespace must be a dictionary'
208 raise TypeError,'namespace must be a dictionary'
209
209
210 # Job manager (for jobs run as background threads)
210 # Job manager (for jobs run as background threads)
211 self.jobs = BackgroundJobManager()
211 self.jobs = BackgroundJobManager()
212
212
213 # track which builtins we add, so we can clean up later
213 # track which builtins we add, so we can clean up later
214 self.builtins_added = {}
214 self.builtins_added = {}
215 # This method will add the necessary builtins for operation, but
215 # This method will add the necessary builtins for operation, but
216 # tracking what it did via the builtins_added dict.
216 # tracking what it did via the builtins_added dict.
217 self.add_builtins()
217 self.add_builtins()
218
218
219 # Do the intuitively correct thing for quit/exit: we remove the
219 # Do the intuitively correct thing for quit/exit: we remove the
220 # builtins if they exist, and our own magics will deal with this
220 # builtins if they exist, and our own magics will deal with this
221 try:
221 try:
222 del __builtin__.exit, __builtin__.quit
222 del __builtin__.exit, __builtin__.quit
223 except AttributeError:
223 except AttributeError:
224 pass
224 pass
225
225
226 # Store the actual shell's name
226 # Store the actual shell's name
227 self.name = name
227 self.name = name
228
228
229 # We need to know whether the instance is meant for embedding, since
229 # We need to know whether the instance is meant for embedding, since
230 # global/local namespaces need to be handled differently in that case
230 # global/local namespaces need to be handled differently in that case
231 self.embedded = embedded
231 self.embedded = embedded
232
232
233 # command compiler
233 # command compiler
234 self.compile = codeop.CommandCompiler()
234 self.compile = codeop.CommandCompiler()
235
235
236 # User input buffer
236 # User input buffer
237 self.buffer = []
237 self.buffer = []
238
238
239 # Default name given in compilation of code
239 # Default name given in compilation of code
240 self.filename = '<ipython console>'
240 self.filename = '<ipython console>'
241
241
242 # Make an empty namespace, which extension writers can rely on both
242 # Make an empty namespace, which extension writers can rely on both
243 # existing and NEVER being used by ipython itself. This gives them a
243 # existing and NEVER being used by ipython itself. This gives them a
244 # convenient location for storing additional information and state
244 # convenient location for storing additional information and state
245 # their extensions may require, without fear of collisions with other
245 # their extensions may require, without fear of collisions with other
246 # ipython names that may develop later.
246 # ipython names that may develop later.
247 self.meta = Struct()
247 self.meta = Struct()
248
248
249 # Create the namespace where the user will operate. user_ns is
249 # Create the namespace where the user will operate. user_ns is
250 # normally the only one used, and it is passed to the exec calls as
250 # normally the only one used, and it is passed to the exec calls as
251 # the locals argument. But we do carry a user_global_ns namespace
251 # the locals argument. But we do carry a user_global_ns namespace
252 # given as the exec 'globals' argument, This is useful in embedding
252 # given as the exec 'globals' argument, This is useful in embedding
253 # situations where the ipython shell opens in a context where the
253 # situations where the ipython shell opens in a context where the
254 # distinction between locals and globals is meaningful.
254 # distinction between locals and globals is meaningful.
255
255
256 # FIXME. For some strange reason, __builtins__ is showing up at user
256 # FIXME. For some strange reason, __builtins__ is showing up at user
257 # level as a dict instead of a module. This is a manual fix, but I
257 # level as a dict instead of a module. This is a manual fix, but I
258 # should really track down where the problem is coming from. Alex
258 # should really track down where the problem is coming from. Alex
259 # Schmolck reported this problem first.
259 # Schmolck reported this problem first.
260
260
261 # A useful post by Alex Martelli on this topic:
261 # A useful post by Alex Martelli on this topic:
262 # Re: inconsistent value from __builtins__
262 # Re: inconsistent value from __builtins__
263 # Von: Alex Martelli <aleaxit@yahoo.com>
263 # Von: Alex Martelli <aleaxit@yahoo.com>
264 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
264 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
265 # Gruppen: comp.lang.python
265 # Gruppen: comp.lang.python
266
266
267 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
267 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
268 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
268 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
269 # > <type 'dict'>
269 # > <type 'dict'>
270 # > >>> print type(__builtins__)
270 # > >>> print type(__builtins__)
271 # > <type 'module'>
271 # > <type 'module'>
272 # > Is this difference in return value intentional?
272 # > Is this difference in return value intentional?
273
273
274 # Well, it's documented that '__builtins__' can be either a dictionary
274 # Well, it's documented that '__builtins__' can be either a dictionary
275 # or a module, and it's been that way for a long time. Whether it's
275 # or a module, and it's been that way for a long time. Whether it's
276 # intentional (or sensible), I don't know. In any case, the idea is
276 # intentional (or sensible), I don't know. In any case, the idea is
277 # that if you need to access the built-in namespace directly, you
277 # that if you need to access the built-in namespace directly, you
278 # should start with "import __builtin__" (note, no 's') which will
278 # should start with "import __builtin__" (note, no 's') which will
279 # definitely give you a module. Yeah, it's somewhat confusing:-(.
279 # definitely give you a module. Yeah, it's somewhat confusing:-(.
280
280
281 if user_ns is None:
281 if user_ns is None:
282 # Set __name__ to __main__ to better match the behavior of the
282 # Set __name__ to __main__ to better match the behavior of the
283 # normal interpreter.
283 # normal interpreter.
284 user_ns = {'__name__' :'__main__',
284 user_ns = {'__name__' :'__main__',
285 '__builtins__' : __builtin__,
285 '__builtins__' : __builtin__,
286 }
286 }
287
287
288 if user_global_ns is None:
288 if user_global_ns is None:
289 user_global_ns = {}
289 user_global_ns = {}
290
290
291 # Assign namespaces
291 # Assign namespaces
292 # This is the namespace where all normal user variables live
292 # This is the namespace where all normal user variables live
293 self.user_ns = user_ns
293 self.user_ns = user_ns
294 # Embedded instances require a separate namespace for globals.
294 # Embedded instances require a separate namespace for globals.
295 # Normally this one is unused by non-embedded instances.
295 # Normally this one is unused by non-embedded instances.
296 self.user_global_ns = user_global_ns
296 self.user_global_ns = user_global_ns
297 # A namespace to keep track of internal data structures to prevent
297 # A namespace to keep track of internal data structures to prevent
298 # them from cluttering user-visible stuff. Will be updated later
298 # them from cluttering user-visible stuff. Will be updated later
299 self.internal_ns = {}
299 self.internal_ns = {}
300
300
301 # Namespace of system aliases. Each entry in the alias
301 # Namespace of system aliases. Each entry in the alias
302 # table must be a 2-tuple of the form (N,name), where N is the number
302 # table must be a 2-tuple of the form (N,name), where N is the number
303 # of positional arguments of the alias.
303 # of positional arguments of the alias.
304 self.alias_table = {}
304 self.alias_table = {}
305
305
306 # A table holding all the namespaces IPython deals with, so that
306 # A table holding all the namespaces IPython deals with, so that
307 # introspection facilities can search easily.
307 # introspection facilities can search easily.
308 self.ns_table = {'user':user_ns,
308 self.ns_table = {'user':user_ns,
309 'user_global':user_global_ns,
309 'user_global':user_global_ns,
310 'alias':self.alias_table,
310 'alias':self.alias_table,
311 'internal':self.internal_ns,
311 'internal':self.internal_ns,
312 'builtin':__builtin__.__dict__
312 'builtin':__builtin__.__dict__
313 }
313 }
314
314
315 # The user namespace MUST have a pointer to the shell itself.
315 # The user namespace MUST have a pointer to the shell itself.
316 self.user_ns[name] = self
316 self.user_ns[name] = self
317
317
318 # We need to insert into sys.modules something that looks like a
318 # We need to insert into sys.modules something that looks like a
319 # module but which accesses the IPython namespace, for shelve and
319 # module but which accesses the IPython namespace, for shelve and
320 # pickle to work interactively. Normally they rely on getting
320 # pickle to work interactively. Normally they rely on getting
321 # everything out of __main__, but for embedding purposes each IPython
321 # everything out of __main__, but for embedding purposes each IPython
322 # instance has its own private namespace, so we can't go shoving
322 # instance has its own private namespace, so we can't go shoving
323 # everything into __main__.
323 # everything into __main__.
324
324
325 # note, however, that we should only do this for non-embedded
325 # note, however, that we should only do this for non-embedded
326 # ipythons, which really mimic the __main__.__dict__ with their own
326 # ipythons, which really mimic the __main__.__dict__ with their own
327 # namespace. Embedded instances, on the other hand, should not do
327 # namespace. Embedded instances, on the other hand, should not do
328 # this because they need to manage the user local/global namespaces
328 # this because they need to manage the user local/global namespaces
329 # only, but they live within a 'normal' __main__ (meaning, they
329 # only, but they live within a 'normal' __main__ (meaning, they
330 # shouldn't overtake the execution environment of the script they're
330 # shouldn't overtake the execution environment of the script they're
331 # embedded in).
331 # embedded in).
332
332
333 if not embedded:
333 if not embedded:
334 try:
334 try:
335 main_name = self.user_ns['__name__']
335 main_name = self.user_ns['__name__']
336 except KeyError:
336 except KeyError:
337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
338 else:
338 else:
339 #print "pickle hack in place" # dbg
339 #print "pickle hack in place" # dbg
340 #print 'main_name:',main_name # dbg
340 #print 'main_name:',main_name # dbg
341 sys.modules[main_name] = FakeModule(self.user_ns)
341 sys.modules[main_name] = FakeModule(self.user_ns)
342
342
343 # List of input with multi-line handling.
343 # List of input with multi-line handling.
344 # Fill its zero entry, user counter starts at 1
344 # Fill its zero entry, user counter starts at 1
345 self.input_hist = InputList(['\n'])
345 self.input_hist = InputList(['\n'])
346 # This one will hold the 'raw' input history, without any
346 # This one will hold the 'raw' input history, without any
347 # pre-processing. This will allow users to retrieve the input just as
347 # pre-processing. This will allow users to retrieve the input just as
348 # it was exactly typed in by the user, with %hist -r.
348 # it was exactly typed in by the user, with %hist -r.
349 self.input_hist_raw = InputList(['\n'])
349 self.input_hist_raw = InputList(['\n'])
350
350
351 # list of visited directories
351 # list of visited directories
352 try:
352 try:
353 self.dir_hist = [os.getcwd()]
353 self.dir_hist = [os.getcwd()]
354 except IOError, e:
354 except IOError, e:
355 self.dir_hist = []
355 self.dir_hist = []
356
356
357 # dict of output history
357 # dict of output history
358 self.output_hist = {}
358 self.output_hist = {}
359
359
360 # dict of things NOT to alias (keywords, builtins and some magics)
360 # dict of things NOT to alias (keywords, builtins and some magics)
361 no_alias = {}
361 no_alias = {}
362 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
362 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
363 for key in keyword.kwlist + no_alias_magics:
363 for key in keyword.kwlist + no_alias_magics:
364 no_alias[key] = 1
364 no_alias[key] = 1
365 no_alias.update(__builtin__.__dict__)
365 no_alias.update(__builtin__.__dict__)
366 self.no_alias = no_alias
366 self.no_alias = no_alias
367
367
368 # make global variables for user access to these
368 # make global variables for user access to these
369 self.user_ns['_ih'] = self.input_hist
369 self.user_ns['_ih'] = self.input_hist
370 self.user_ns['_oh'] = self.output_hist
370 self.user_ns['_oh'] = self.output_hist
371 self.user_ns['_dh'] = self.dir_hist
371 self.user_ns['_dh'] = self.dir_hist
372
372
373 # user aliases to input and output histories
373 # user aliases to input and output histories
374 self.user_ns['In'] = self.input_hist
374 self.user_ns['In'] = self.input_hist
375 self.user_ns['Out'] = self.output_hist
375 self.user_ns['Out'] = self.output_hist
376
376
377 # Object variable to store code object waiting execution. This is
377 # Object variable to store code object waiting execution. This is
378 # used mainly by the multithreaded shells, but it can come in handy in
378 # used mainly by the multithreaded shells, but it can come in handy in
379 # other situations. No need to use a Queue here, since it's a single
379 # other situations. No need to use a Queue here, since it's a single
380 # item which gets cleared once run.
380 # item which gets cleared once run.
381 self.code_to_run = None
381 self.code_to_run = None
382
382
383 # escapes for automatic behavior on the command line
383 # escapes for automatic behavior on the command line
384 self.ESC_SHELL = '!'
384 self.ESC_SHELL = '!'
385 self.ESC_HELP = '?'
385 self.ESC_HELP = '?'
386 self.ESC_MAGIC = '%'
386 self.ESC_MAGIC = '%'
387 self.ESC_QUOTE = ','
387 self.ESC_QUOTE = ','
388 self.ESC_QUOTE2 = ';'
388 self.ESC_QUOTE2 = ';'
389 self.ESC_PAREN = '/'
389 self.ESC_PAREN = '/'
390
390
391 # And their associated handlers
391 # And their associated handlers
392 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
392 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
393 self.ESC_QUOTE : self.handle_auto,
393 self.ESC_QUOTE : self.handle_auto,
394 self.ESC_QUOTE2 : self.handle_auto,
394 self.ESC_QUOTE2 : self.handle_auto,
395 self.ESC_MAGIC : self.handle_magic,
395 self.ESC_MAGIC : self.handle_magic,
396 self.ESC_HELP : self.handle_help,
396 self.ESC_HELP : self.handle_help,
397 self.ESC_SHELL : self.handle_shell_escape,
397 self.ESC_SHELL : self.handle_shell_escape,
398 }
398 }
399
399
400 # class initializations
400 # class initializations
401 Magic.__init__(self,self)
401 Magic.__init__(self,self)
402
402
403 # Python source parser/formatter for syntax highlighting
403 # Python source parser/formatter for syntax highlighting
404 pyformat = PyColorize.Parser().format
404 pyformat = PyColorize.Parser().format
405 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
405 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
406
406
407 # hooks holds pointers used for user-side customizations
407 # hooks holds pointers used for user-side customizations
408 self.hooks = Struct()
408 self.hooks = Struct()
409
409
410 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
411 hooks = IPython.hooks
411 hooks = IPython.hooks
412 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 #print "bound hook",hook_name
415 #print "bound hook",hook_name
416
416
417 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
418 self.exit_now = False
418 self.exit_now = False
419
419
420 self.usage_min = """\
420 self.usage_min = """\
421 An enhanced console for Python.
421 An enhanced console for Python.
422 Some of its features are:
422 Some of its features are:
423 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
424 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
425 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
426 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 """
430 """
431 if usage: self.usage = usage
431 if usage: self.usage = usage
432 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
433
433
434 # Storage
434 # Storage
435 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
436 self.pager = 'less'
436 self.pager = 'less'
437 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
438 self.tempfiles = []
438 self.tempfiles = []
439
439
440 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
441 self.has_readline = False
441 self.has_readline = False
442
442
443 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
444 # logstart method.
444 # logstart method.
445 self.loghead_tpl = \
445 self.loghead_tpl = \
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 #log# opts = %s
448 #log# opts = %s
449 #log# args = %s
449 #log# args = %s
450 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
451 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
452 """
452 """
453 # for pushd/popd management
453 # for pushd/popd management
454 try:
454 try:
455 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
456 except HomeDirError,msg:
456 except HomeDirError,msg:
457 fatal(msg)
457 fatal(msg)
458
458
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460
460
461 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
462
462
463 # utility to expand user variables via Itpl
463 # utility to expand user variables via Itpl
464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
465 self.user_ns))
465 self.user_ns))
466 # The first is similar to os.system, but it doesn't return a value,
466 # The first is similar to os.system, but it doesn't return a value,
467 # and it allows interpolation of variables in the user's namespace.
467 # and it allows interpolation of variables in the user's namespace.
468 self.system = lambda cmd: shell(self.var_expand(cmd),
468 self.system = lambda cmd: shell(self.var_expand(cmd),
469 header='IPython system call: ',
469 header='IPython system call: ',
470 verbose=self.rc.system_verbose)
470 verbose=self.rc.system_verbose)
471 # These are for getoutput and getoutputerror:
471 # These are for getoutput and getoutputerror:
472 self.getoutput = lambda cmd: \
472 self.getoutput = lambda cmd: \
473 getoutput(self.var_expand(cmd),
473 getoutput(self.var_expand(cmd),
474 header='IPython system call: ',
474 header='IPython system call: ',
475 verbose=self.rc.system_verbose)
475 verbose=self.rc.system_verbose)
476 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
477 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
477 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
478 self.user_ns)),
478 self.user_ns)),
479 header='IPython system call: ',
479 header='IPython system call: ',
480 verbose=self.rc.system_verbose)
480 verbose=self.rc.system_verbose)
481
481
482 # RegExp for splitting line contents into pre-char//first
482 # RegExp for splitting line contents into pre-char//first
483 # word-method//rest. For clarity, each group in on one line.
483 # word-method//rest. For clarity, each group in on one line.
484
484
485 # WARNING: update the regexp if the above escapes are changed, as they
485 # WARNING: update the regexp if the above escapes are changed, as they
486 # are hardwired in.
486 # are hardwired in.
487
487
488 # Don't get carried away with trying to make the autocalling catch too
488 # Don't get carried away with trying to make the autocalling catch too
489 # much: it's better to be conservative rather than to trigger hidden
489 # much: it's better to be conservative rather than to trigger hidden
490 # evals() somewhere and end up causing side effects.
490 # evals() somewhere and end up causing side effects.
491
491
492 self.line_split = re.compile(r'^([\s*,;/])'
492 self.line_split = re.compile(r'^([\s*,;/])'
493 r'([\?\w\.]+\w*\s*)'
493 r'([\?\w\.]+\w*\s*)'
494 r'(\(?.*$)')
494 r'(\(?.*$)')
495
495
496 # Original re, keep around for a while in case changes break something
496 # Original re, keep around for a while in case changes break something
497 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
497 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
498 # r'(\s*[\?\w\.]+\w*\s*)'
498 # r'(\s*[\?\w\.]+\w*\s*)'
499 # r'(\(?.*$)')
499 # r'(\(?.*$)')
500
500
501 # RegExp to identify potential function names
501 # RegExp to identify potential function names
502 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
502 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
503
503
504 # RegExp to exclude strings with this start from autocalling. In
504 # RegExp to exclude strings with this start from autocalling. In
505 # particular, all binary operators should be excluded, so that if foo
505 # particular, all binary operators should be excluded, so that if foo
506 # is callable, foo OP bar doesn't become foo(OP bar), which is
506 # is callable, foo OP bar doesn't become foo(OP bar), which is
507 # invalid. The characters '!=()' don't need to be checked for, as the
507 # invalid. The characters '!=()' don't need to be checked for, as the
508 # _prefilter routine explicitely does so, to catch direct calls and
508 # _prefilter routine explicitely does so, to catch direct calls and
509 # rebindings of existing names.
509 # rebindings of existing names.
510
510
511 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
511 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
512 # it affects the rest of the group in square brackets.
512 # it affects the rest of the group in square brackets.
513 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
513 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
514 '|^is |^not |^in |^and |^or ')
514 '|^is |^not |^in |^and |^or ')
515
515
516 # try to catch also methods for stuff in lists/tuples/dicts: off
516 # try to catch also methods for stuff in lists/tuples/dicts: off
517 # (experimental). For this to work, the line_split regexp would need
517 # (experimental). For this to work, the line_split regexp would need
518 # to be modified so it wouldn't break things at '['. That line is
518 # to be modified so it wouldn't break things at '['. That line is
519 # nasty enough that I shouldn't change it until I can test it _well_.
519 # nasty enough that I shouldn't change it until I can test it _well_.
520 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
520 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
521
521
522 # keep track of where we started running (mainly for crash post-mortem)
522 # keep track of where we started running (mainly for crash post-mortem)
523 self.starting_dir = os.getcwd()
523 self.starting_dir = os.getcwd()
524
524
525 # Various switches which can be set
525 # Various switches which can be set
526 self.CACHELENGTH = 5000 # this is cheap, it's just text
526 self.CACHELENGTH = 5000 # this is cheap, it's just text
527 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
527 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
528 self.banner2 = banner2
528 self.banner2 = banner2
529
529
530 # TraceBack handlers:
530 # TraceBack handlers:
531
531
532 # Syntax error handler.
532 # Syntax error handler.
533 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
533 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
534
534
535 # The interactive one is initialized with an offset, meaning we always
535 # The interactive one is initialized with an offset, meaning we always
536 # want to remove the topmost item in the traceback, which is our own
536 # want to remove the topmost item in the traceback, which is our own
537 # internal code. Valid modes: ['Plain','Context','Verbose']
537 # internal code. Valid modes: ['Plain','Context','Verbose']
538 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
538 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
539 color_scheme='NoColor',
539 color_scheme='NoColor',
540 tb_offset = 1)
540 tb_offset = 1)
541
541
542 # IPython itself shouldn't crash. This will produce a detailed
542 # IPython itself shouldn't crash. This will produce a detailed
543 # post-mortem if it does. But we only install the crash handler for
543 # post-mortem if it does. But we only install the crash handler for
544 # non-threaded shells, the threaded ones use a normal verbose reporter
544 # non-threaded shells, the threaded ones use a normal verbose reporter
545 # and lose the crash handler. This is because exceptions in the main
545 # and lose the crash handler. This is because exceptions in the main
546 # thread (such as in GUI code) propagate directly to sys.excepthook,
546 # thread (such as in GUI code) propagate directly to sys.excepthook,
547 # and there's no point in printing crash dumps for every user exception.
547 # and there's no point in printing crash dumps for every user exception.
548 if self.isthreaded:
548 if self.isthreaded:
549 sys.excepthook = ultraTB.FormattedTB()
549 sys.excepthook = ultraTB.FormattedTB()
550 else:
550 else:
551 from IPython import CrashHandler
551 from IPython import CrashHandler
552 sys.excepthook = CrashHandler.CrashHandler(self)
552 sys.excepthook = CrashHandler.CrashHandler(self)
553
553
554 # The instance will store a pointer to this, so that runtime code
554 # The instance will store a pointer to this, so that runtime code
555 # (such as magics) can access it. This is because during the
555 # (such as magics) can access it. This is because during the
556 # read-eval loop, it gets temporarily overwritten (to deal with GUI
556 # read-eval loop, it gets temporarily overwritten (to deal with GUI
557 # frameworks).
557 # frameworks).
558 self.sys_excepthook = sys.excepthook
558 self.sys_excepthook = sys.excepthook
559
559
560 # and add any custom exception handlers the user may have specified
560 # and add any custom exception handlers the user may have specified
561 self.set_custom_exc(*custom_exceptions)
561 self.set_custom_exc(*custom_exceptions)
562
562
563 # Object inspector
563 # Object inspector
564 self.inspector = OInspect.Inspector(OInspect.InspectColors,
564 self.inspector = OInspect.Inspector(OInspect.InspectColors,
565 PyColorize.ANSICodeColors,
565 PyColorize.ANSICodeColors,
566 'NoColor')
566 'NoColor')
567 # indentation management
567 # indentation management
568 self.autoindent = False
568 self.autoindent = False
569 self.indent_current_nsp = 0
569 self.indent_current_nsp = 0
570
570
571 # Make some aliases automatically
571 # Make some aliases automatically
572 # Prepare list of shell aliases to auto-define
572 # Prepare list of shell aliases to auto-define
573 if os.name == 'posix':
573 if os.name == 'posix':
574 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
574 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
575 'mv mv -i','rm rm -i','cp cp -i',
575 'mv mv -i','rm rm -i','cp cp -i',
576 'cat cat','less less','clear clear',
576 'cat cat','less less','clear clear',
577 # a better ls
577 # a better ls
578 'ls ls -F',
578 'ls ls -F',
579 # long ls
579 # long ls
580 'll ls -lF',
580 'll ls -lF',
581 # color ls
581 # color ls
582 'lc ls -F -o --color',
582 'lc ls -F -o --color',
583 # ls normal files only
583 # ls normal files only
584 'lf ls -F -o --color %l | grep ^-',
584 'lf ls -F -o --color %l | grep ^-',
585 # ls symbolic links
585 # ls symbolic links
586 'lk ls -F -o --color %l | grep ^l',
586 'lk ls -F -o --color %l | grep ^l',
587 # directories or links to directories,
587 # directories or links to directories,
588 'ldir ls -F -o --color %l | grep /$',
588 'ldir ls -F -o --color %l | grep /$',
589 # things which are executable
589 # things which are executable
590 'lx ls -F -o --color %l | grep ^-..x',
590 'lx ls -F -o --color %l | grep ^-..x',
591 )
591 )
592 elif os.name in ['nt','dos']:
592 elif os.name in ['nt','dos']:
593 auto_alias = ('dir dir /on', 'ls dir /on',
593 auto_alias = ('dir dir /on', 'ls dir /on',
594 'ddir dir /ad /on', 'ldir dir /ad /on',
594 'ddir dir /ad /on', 'ldir dir /ad /on',
595 'mkdir mkdir','rmdir rmdir','echo echo',
595 'mkdir mkdir','rmdir rmdir','echo echo',
596 'ren ren','cls cls','copy copy')
596 'ren ren','cls cls','copy copy')
597 else:
597 else:
598 auto_alias = ()
598 auto_alias = ()
599 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
599 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
600 # Call the actual (public) initializer
600 # Call the actual (public) initializer
601 self.init_auto_alias()
601 self.init_auto_alias()
602 # end __init__
602 # end __init__
603
603
604 def post_config_initialization(self):
604 def post_config_initialization(self):
605 """Post configuration init method
605 """Post configuration init method
606
606
607 This is called after the configuration files have been processed to
607 This is called after the configuration files have been processed to
608 'finalize' the initialization."""
608 'finalize' the initialization."""
609
609
610 rc = self.rc
610 rc = self.rc
611
611
612 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
612 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
613 # Load readline proper
613 # Load readline proper
614 if rc.readline:
614 if rc.readline:
615 self.init_readline()
615 self.init_readline()
616
616
617 # local shortcut, this is used a LOT
617 # local shortcut, this is used a LOT
618 self.log = self.logger.log
618 self.log = self.logger.log
619
619
620 # Initialize cache, set in/out prompts and printing system
620 # Initialize cache, set in/out prompts and printing system
621 self.outputcache = CachedOutput(self,
621 self.outputcache = CachedOutput(self,
622 rc.cache_size,
622 rc.cache_size,
623 rc.pprint,
623 rc.pprint,
624 input_sep = rc.separate_in,
624 input_sep = rc.separate_in,
625 output_sep = rc.separate_out,
625 output_sep = rc.separate_out,
626 output_sep2 = rc.separate_out2,
626 output_sep2 = rc.separate_out2,
627 ps1 = rc.prompt_in1,
627 ps1 = rc.prompt_in1,
628 ps2 = rc.prompt_in2,
628 ps2 = rc.prompt_in2,
629 ps_out = rc.prompt_out,
629 ps_out = rc.prompt_out,
630 pad_left = rc.prompts_pad_left)
630 pad_left = rc.prompts_pad_left)
631
631
632 # user may have over-ridden the default print hook:
632 # user may have over-ridden the default print hook:
633 try:
633 try:
634 self.outputcache.__class__.display = self.hooks.display
634 self.outputcache.__class__.display = self.hooks.display
635 except AttributeError:
635 except AttributeError:
636 pass
636 pass
637
637
638 # I don't like assigning globally to sys, because it means when embedding
638 # I don't like assigning globally to sys, because it means when embedding
639 # instances, each embedded instance overrides the previous choice. But
639 # instances, each embedded instance overrides the previous choice. But
640 # sys.displayhook seems to be called internally by exec, so I don't see a
640 # sys.displayhook seems to be called internally by exec, so I don't see a
641 # way around it.
641 # way around it.
642 sys.displayhook = self.outputcache
642 sys.displayhook = self.outputcache
643
643
644 # Set user colors (don't do it in the constructor above so that it
644 # Set user colors (don't do it in the constructor above so that it
645 # doesn't crash if colors option is invalid)
645 # doesn't crash if colors option is invalid)
646 self.magic_colors(rc.colors)
646 self.magic_colors(rc.colors)
647
647
648 # Set calling of pdb on exceptions
648 # Set calling of pdb on exceptions
649 self.call_pdb = rc.pdb
649 self.call_pdb = rc.pdb
650
650
651 # Load user aliases
651 # Load user aliases
652 for alias in rc.alias:
652 for alias in rc.alias:
653 self.magic_alias(alias)
653 self.magic_alias(alias)
654 self.hooks.late_startup_hook()
654 self.hooks.late_startup_hook()
655
655
656
656
657 def add_builtins(self):
657 def add_builtins(self):
658 """Store ipython references into the builtin namespace.
658 """Store ipython references into the builtin namespace.
659
659
660 Some parts of ipython operate via builtins injected here, which hold a
660 Some parts of ipython operate via builtins injected here, which hold a
661 reference to IPython itself."""
661 reference to IPython itself."""
662
662
663 # TODO: deprecate all except _ip; 'jobs' should be installed
663 # TODO: deprecate all except _ip; 'jobs' should be installed
664 # by an extension and the rest are under _ip
664 # by an extension and the rest are under _ip, ipalias is redundant
665 builtins_new = dict(__IPYTHON__ = self,
665 builtins_new = dict(__IPYTHON__ = self,
666 ip_set_hook = self.set_hook,
666 ip_set_hook = self.set_hook,
667 jobs = self.jobs,
667 jobs = self.jobs,
668 ipmagic = self.ipmagic,
668 ipmagic = self.ipmagic,
669 ipalias = self.ipalias,
669 ipalias = self.ipalias,
670 ipsystem = self.ipsystem,
670 ipsystem = self.ipsystem,
671 _ip = self.api
671 _ip = self.api
672 )
672 )
673 for biname,bival in builtins_new.items():
673 for biname,bival in builtins_new.items():
674 try:
674 try:
675 # store the orignal value so we can restore it
675 # store the orignal value so we can restore it
676 self.builtins_added[biname] = __builtin__.__dict__[biname]
676 self.builtins_added[biname] = __builtin__.__dict__[biname]
677 except KeyError:
677 except KeyError:
678 # or mark that it wasn't defined, and we'll just delete it at
678 # or mark that it wasn't defined, and we'll just delete it at
679 # cleanup
679 # cleanup
680 self.builtins_added[biname] = Undefined
680 self.builtins_added[biname] = Undefined
681 __builtin__.__dict__[biname] = bival
681 __builtin__.__dict__[biname] = bival
682
682
683 # Keep in the builtins a flag for when IPython is active. We set it
683 # Keep in the builtins a flag for when IPython is active. We set it
684 # with setdefault so that multiple nested IPythons don't clobber one
684 # with setdefault so that multiple nested IPythons don't clobber one
685 # another. Each will increase its value by one upon being activated,
685 # another. Each will increase its value by one upon being activated,
686 # which also gives us a way to determine the nesting level.
686 # which also gives us a way to determine the nesting level.
687 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
687 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
688
688
689 def clean_builtins(self):
689 def clean_builtins(self):
690 """Remove any builtins which might have been added by add_builtins, or
690 """Remove any builtins which might have been added by add_builtins, or
691 restore overwritten ones to their previous values."""
691 restore overwritten ones to their previous values."""
692 for biname,bival in self.builtins_added.items():
692 for biname,bival in self.builtins_added.items():
693 if bival is Undefined:
693 if bival is Undefined:
694 del __builtin__.__dict__[biname]
694 del __builtin__.__dict__[biname]
695 else:
695 else:
696 __builtin__.__dict__[biname] = bival
696 __builtin__.__dict__[biname] = bival
697 self.builtins_added.clear()
697 self.builtins_added.clear()
698
698
699 def set_hook(self,name,hook, priority = 50):
699 def set_hook(self,name,hook, priority = 50):
700 """set_hook(name,hook) -> sets an internal IPython hook.
700 """set_hook(name,hook) -> sets an internal IPython hook.
701
701
702 IPython exposes some of its internal API as user-modifiable hooks. By
702 IPython exposes some of its internal API as user-modifiable hooks. By
703 adding your function to one of these hooks, you can modify IPython's
703 adding your function to one of these hooks, you can modify IPython's
704 behavior to call at runtime your own routines."""
704 behavior to call at runtime your own routines."""
705
705
706 # At some point in the future, this should validate the hook before it
706 # At some point in the future, this should validate the hook before it
707 # accepts it. Probably at least check that the hook takes the number
707 # accepts it. Probably at least check that the hook takes the number
708 # of args it's supposed to.
708 # of args it's supposed to.
709 dp = getattr(self.hooks, name, None)
709 dp = getattr(self.hooks, name, None)
710 if name not in IPython.hooks.__all__:
710 if name not in IPython.hooks.__all__:
711 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
711 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
712 if not dp:
712 if not dp:
713 dp = IPython.hooks.CommandChainDispatcher()
713 dp = IPython.hooks.CommandChainDispatcher()
714
714
715 f = new.instancemethod(hook,self,self.__class__)
715 f = new.instancemethod(hook,self,self.__class__)
716 try:
716 try:
717 dp.add(f,priority)
717 dp.add(f,priority)
718 except AttributeError:
718 except AttributeError:
719 # it was not commandchain, plain old func - replace
719 # it was not commandchain, plain old func - replace
720 dp = f
720 dp = f
721
721
722 setattr(self.hooks,name, dp)
722 setattr(self.hooks,name, dp)
723
723
724
724
725 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
725 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
726
726
727 def set_custom_exc(self,exc_tuple,handler):
727 def set_custom_exc(self,exc_tuple,handler):
728 """set_custom_exc(exc_tuple,handler)
728 """set_custom_exc(exc_tuple,handler)
729
729
730 Set a custom exception handler, which will be called if any of the
730 Set a custom exception handler, which will be called if any of the
731 exceptions in exc_tuple occur in the mainloop (specifically, in the
731 exceptions in exc_tuple occur in the mainloop (specifically, in the
732 runcode() method.
732 runcode() method.
733
733
734 Inputs:
734 Inputs:
735
735
736 - exc_tuple: a *tuple* of valid exceptions to call the defined
736 - exc_tuple: a *tuple* of valid exceptions to call the defined
737 handler for. It is very important that you use a tuple, and NOT A
737 handler for. It is very important that you use a tuple, and NOT A
738 LIST here, because of the way Python's except statement works. If
738 LIST here, because of the way Python's except statement works. If
739 you only want to trap a single exception, use a singleton tuple:
739 you only want to trap a single exception, use a singleton tuple:
740
740
741 exc_tuple == (MyCustomException,)
741 exc_tuple == (MyCustomException,)
742
742
743 - handler: this must be defined as a function with the following
743 - handler: this must be defined as a function with the following
744 basic interface: def my_handler(self,etype,value,tb).
744 basic interface: def my_handler(self,etype,value,tb).
745
745
746 This will be made into an instance method (via new.instancemethod)
746 This will be made into an instance method (via new.instancemethod)
747 of IPython itself, and it will be called if any of the exceptions
747 of IPython itself, and it will be called if any of the exceptions
748 listed in the exc_tuple are caught. If the handler is None, an
748 listed in the exc_tuple are caught. If the handler is None, an
749 internal basic one is used, which just prints basic info.
749 internal basic one is used, which just prints basic info.
750
750
751 WARNING: by putting in your own exception handler into IPython's main
751 WARNING: by putting in your own exception handler into IPython's main
752 execution loop, you run a very good chance of nasty crashes. This
752 execution loop, you run a very good chance of nasty crashes. This
753 facility should only be used if you really know what you are doing."""
753 facility should only be used if you really know what you are doing."""
754
754
755 assert type(exc_tuple)==type(()) , \
755 assert type(exc_tuple)==type(()) , \
756 "The custom exceptions must be given AS A TUPLE."
756 "The custom exceptions must be given AS A TUPLE."
757
757
758 def dummy_handler(self,etype,value,tb):
758 def dummy_handler(self,etype,value,tb):
759 print '*** Simple custom exception handler ***'
759 print '*** Simple custom exception handler ***'
760 print 'Exception type :',etype
760 print 'Exception type :',etype
761 print 'Exception value:',value
761 print 'Exception value:',value
762 print 'Traceback :',tb
762 print 'Traceback :',tb
763 print 'Source code :','\n'.join(self.buffer)
763 print 'Source code :','\n'.join(self.buffer)
764
764
765 if handler is None: handler = dummy_handler
765 if handler is None: handler = dummy_handler
766
766
767 self.CustomTB = new.instancemethod(handler,self,self.__class__)
767 self.CustomTB = new.instancemethod(handler,self,self.__class__)
768 self.custom_exceptions = exc_tuple
768 self.custom_exceptions = exc_tuple
769
769
770 def set_custom_completer(self,completer,pos=0):
770 def set_custom_completer(self,completer,pos=0):
771 """set_custom_completer(completer,pos=0)
771 """set_custom_completer(completer,pos=0)
772
772
773 Adds a new custom completer function.
773 Adds a new custom completer function.
774
774
775 The position argument (defaults to 0) is the index in the completers
775 The position argument (defaults to 0) is the index in the completers
776 list where you want the completer to be inserted."""
776 list where you want the completer to be inserted."""
777
777
778 newcomp = new.instancemethod(completer,self.Completer,
778 newcomp = new.instancemethod(completer,self.Completer,
779 self.Completer.__class__)
779 self.Completer.__class__)
780 self.Completer.matchers.insert(pos,newcomp)
780 self.Completer.matchers.insert(pos,newcomp)
781
781
782 def _get_call_pdb(self):
782 def _get_call_pdb(self):
783 return self._call_pdb
783 return self._call_pdb
784
784
785 def _set_call_pdb(self,val):
785 def _set_call_pdb(self,val):
786
786
787 if val not in (0,1,False,True):
787 if val not in (0,1,False,True):
788 raise ValueError,'new call_pdb value must be boolean'
788 raise ValueError,'new call_pdb value must be boolean'
789
789
790 # store value in instance
790 # store value in instance
791 self._call_pdb = val
791 self._call_pdb = val
792
792
793 # notify the actual exception handlers
793 # notify the actual exception handlers
794 self.InteractiveTB.call_pdb = val
794 self.InteractiveTB.call_pdb = val
795 if self.isthreaded:
795 if self.isthreaded:
796 try:
796 try:
797 self.sys_excepthook.call_pdb = val
797 self.sys_excepthook.call_pdb = val
798 except:
798 except:
799 warn('Failed to activate pdb for threaded exception handler')
799 warn('Failed to activate pdb for threaded exception handler')
800
800
801 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
801 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
802 'Control auto-activation of pdb at exceptions')
802 'Control auto-activation of pdb at exceptions')
803
803
804
804
805 # These special functions get installed in the builtin namespace, to
805 # These special functions get installed in the builtin namespace, to
806 # provide programmatic (pure python) access to magics, aliases and system
806 # provide programmatic (pure python) access to magics, aliases and system
807 # calls. This is important for logging, user scripting, and more.
807 # calls. This is important for logging, user scripting, and more.
808
808
809 # We are basically exposing, via normal python functions, the three
809 # We are basically exposing, via normal python functions, the three
810 # mechanisms in which ipython offers special call modes (magics for
810 # mechanisms in which ipython offers special call modes (magics for
811 # internal control, aliases for direct system access via pre-selected
811 # internal control, aliases for direct system access via pre-selected
812 # names, and !cmd for calling arbitrary system commands).
812 # names, and !cmd for calling arbitrary system commands).
813
813
814 def ipmagic(self,arg_s):
814 def ipmagic(self,arg_s):
815 """Call a magic function by name.
815 """Call a magic function by name.
816
816
817 Input: a string containing the name of the magic function to call and any
817 Input: a string containing the name of the magic function to call and any
818 additional arguments to be passed to the magic.
818 additional arguments to be passed to the magic.
819
819
820 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
820 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
821 prompt:
821 prompt:
822
822
823 In[1]: %name -opt foo bar
823 In[1]: %name -opt foo bar
824
824
825 To call a magic without arguments, simply use ipmagic('name').
825 To call a magic without arguments, simply use ipmagic('name').
826
826
827 This provides a proper Python function to call IPython's magics in any
827 This provides a proper Python function to call IPython's magics in any
828 valid Python code you can type at the interpreter, including loops and
828 valid Python code you can type at the interpreter, including loops and
829 compound statements. It is added by IPython to the Python builtin
829 compound statements. It is added by IPython to the Python builtin
830 namespace upon initialization."""
830 namespace upon initialization."""
831
831
832 args = arg_s.split(' ',1)
832 args = arg_s.split(' ',1)
833 magic_name = args[0]
833 magic_name = args[0]
834 magic_name = magic_name.lstrip(self.ESC_MAGIC)
834 magic_name = magic_name.lstrip(self.ESC_MAGIC)
835
835
836 try:
836 try:
837 magic_args = args[1]
837 magic_args = args[1]
838 except IndexError:
838 except IndexError:
839 magic_args = ''
839 magic_args = ''
840 fn = getattr(self,'magic_'+magic_name,None)
840 fn = getattr(self,'magic_'+magic_name,None)
841 if fn is None:
841 if fn is None:
842 error("Magic function `%s` not found." % magic_name)
842 error("Magic function `%s` not found." % magic_name)
843 else:
843 else:
844 magic_args = self.var_expand(magic_args)
844 magic_args = self.var_expand(magic_args)
845 return fn(magic_args)
845 return fn(magic_args)
846
846
847 def ipalias(self,arg_s):
847 def ipalias(self,arg_s):
848 """Call an alias by name.
848 """Call an alias by name.
849
849
850 Input: a string containing the name of the alias to call and any
850 Input: a string containing the name of the alias to call and any
851 additional arguments to be passed to the magic.
851 additional arguments to be passed to the magic.
852
852
853 ipalias('name -opt foo bar') is equivalent to typing at the ipython
853 ipalias('name -opt foo bar') is equivalent to typing at the ipython
854 prompt:
854 prompt:
855
855
856 In[1]: name -opt foo bar
856 In[1]: name -opt foo bar
857
857
858 To call an alias without arguments, simply use ipalias('name').
858 To call an alias without arguments, simply use ipalias('name').
859
859
860 This provides a proper Python function to call IPython's aliases in any
860 This provides a proper Python function to call IPython's aliases in any
861 valid Python code you can type at the interpreter, including loops and
861 valid Python code you can type at the interpreter, including loops and
862 compound statements. It is added by IPython to the Python builtin
862 compound statements. It is added by IPython to the Python builtin
863 namespace upon initialization."""
863 namespace upon initialization."""
864
864
865 args = arg_s.split(' ',1)
865 args = arg_s.split(' ',1)
866 alias_name = args[0]
866 alias_name = args[0]
867 try:
867 try:
868 alias_args = args[1]
868 alias_args = args[1]
869 except IndexError:
869 except IndexError:
870 alias_args = ''
870 alias_args = ''
871 if alias_name in self.alias_table:
871 if alias_name in self.alias_table:
872 self.call_alias(alias_name,alias_args)
872 self.call_alias(alias_name,alias_args)
873 else:
873 else:
874 error("Alias `%s` not found." % alias_name)
874 error("Alias `%s` not found." % alias_name)
875
875
876 def ipsystem(self,arg_s):
876 def ipsystem(self,arg_s):
877 """Make a system call, using IPython."""
877 """Make a system call, using IPython."""
878
878
879 self.system(arg_s)
879 self.system(arg_s)
880
880
881 def complete(self,text):
881 def complete(self,text):
882 """Return a sorted list of all possible completions on text.
882 """Return a sorted list of all possible completions on text.
883
883
884 Inputs:
884 Inputs:
885
885
886 - text: a string of text to be completed on.
886 - text: a string of text to be completed on.
887
887
888 This is a wrapper around the completion mechanism, similar to what
888 This is a wrapper around the completion mechanism, similar to what
889 readline does at the command line when the TAB key is hit. By
889 readline does at the command line when the TAB key is hit. By
890 exposing it as a method, it can be used by other non-readline
890 exposing it as a method, it can be used by other non-readline
891 environments (such as GUIs) for text completion.
891 environments (such as GUIs) for text completion.
892
892
893 Simple usage example:
893 Simple usage example:
894
894
895 In [1]: x = 'hello'
895 In [1]: x = 'hello'
896
896
897 In [2]: __IP.complete('x.l')
897 In [2]: __IP.complete('x.l')
898 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
898 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
899
899
900 complete = self.Completer.complete
900 complete = self.Completer.complete
901 state = 0
901 state = 0
902 # use a dict so we get unique keys, since ipyhton's multiple
902 # use a dict so we get unique keys, since ipyhton's multiple
903 # completers can return duplicates.
903 # completers can return duplicates.
904 comps = {}
904 comps = {}
905 while True:
905 while True:
906 newcomp = complete(text,state)
906 newcomp = complete(text,state)
907 if newcomp is None:
907 if newcomp is None:
908 break
908 break
909 comps[newcomp] = 1
909 comps[newcomp] = 1
910 state += 1
910 state += 1
911 outcomps = comps.keys()
911 outcomps = comps.keys()
912 outcomps.sort()
912 outcomps.sort()
913 return outcomps
913 return outcomps
914
914
915 def set_completer_frame(self, frame=None):
915 def set_completer_frame(self, frame=None):
916 if frame:
916 if frame:
917 self.Completer.namespace = frame.f_locals
917 self.Completer.namespace = frame.f_locals
918 self.Completer.global_namespace = frame.f_globals
918 self.Completer.global_namespace = frame.f_globals
919 else:
919 else:
920 self.Completer.namespace = self.user_ns
920 self.Completer.namespace = self.user_ns
921 self.Completer.global_namespace = self.user_global_ns
921 self.Completer.global_namespace = self.user_global_ns
922
922
923 def init_auto_alias(self):
923 def init_auto_alias(self):
924 """Define some aliases automatically.
924 """Define some aliases automatically.
925
925
926 These are ALL parameter-less aliases"""
926 These are ALL parameter-less aliases"""
927
927
928 for alias,cmd in self.auto_alias:
928 for alias,cmd in self.auto_alias:
929 self.alias_table[alias] = (0,cmd)
929 self.alias_table[alias] = (0,cmd)
930
930
931 def alias_table_validate(self,verbose=0):
931 def alias_table_validate(self,verbose=0):
932 """Update information about the alias table.
932 """Update information about the alias table.
933
933
934 In particular, make sure no Python keywords/builtins are in it."""
934 In particular, make sure no Python keywords/builtins are in it."""
935
935
936 no_alias = self.no_alias
936 no_alias = self.no_alias
937 for k in self.alias_table.keys():
937 for k in self.alias_table.keys():
938 if k in no_alias:
938 if k in no_alias:
939 del self.alias_table[k]
939 del self.alias_table[k]
940 if verbose:
940 if verbose:
941 print ("Deleting alias <%s>, it's a Python "
941 print ("Deleting alias <%s>, it's a Python "
942 "keyword or builtin." % k)
942 "keyword or builtin." % k)
943
943
944 def set_autoindent(self,value=None):
944 def set_autoindent(self,value=None):
945 """Set the autoindent flag, checking for readline support.
945 """Set the autoindent flag, checking for readline support.
946
946
947 If called with no arguments, it acts as a toggle."""
947 If called with no arguments, it acts as a toggle."""
948
948
949 if not self.has_readline:
949 if not self.has_readline:
950 if os.name == 'posix':
950 if os.name == 'posix':
951 warn("The auto-indent feature requires the readline library")
951 warn("The auto-indent feature requires the readline library")
952 self.autoindent = 0
952 self.autoindent = 0
953 return
953 return
954 if value is None:
954 if value is None:
955 self.autoindent = not self.autoindent
955 self.autoindent = not self.autoindent
956 else:
956 else:
957 self.autoindent = value
957 self.autoindent = value
958
958
959 def rc_set_toggle(self,rc_field,value=None):
959 def rc_set_toggle(self,rc_field,value=None):
960 """Set or toggle a field in IPython's rc config. structure.
960 """Set or toggle a field in IPython's rc config. structure.
961
961
962 If called with no arguments, it acts as a toggle.
962 If called with no arguments, it acts as a toggle.
963
963
964 If called with a non-existent field, the resulting AttributeError
964 If called with a non-existent field, the resulting AttributeError
965 exception will propagate out."""
965 exception will propagate out."""
966
966
967 rc_val = getattr(self.rc,rc_field)
967 rc_val = getattr(self.rc,rc_field)
968 if value is None:
968 if value is None:
969 value = not rc_val
969 value = not rc_val
970 setattr(self.rc,rc_field,value)
970 setattr(self.rc,rc_field,value)
971
971
972 def user_setup(self,ipythondir,rc_suffix,mode='install'):
972 def user_setup(self,ipythondir,rc_suffix,mode='install'):
973 """Install the user configuration directory.
973 """Install the user configuration directory.
974
974
975 Can be called when running for the first time or to upgrade the user's
975 Can be called when running for the first time or to upgrade the user's
976 .ipython/ directory with the mode parameter. Valid modes are 'install'
976 .ipython/ directory with the mode parameter. Valid modes are 'install'
977 and 'upgrade'."""
977 and 'upgrade'."""
978
978
979 def wait():
979 def wait():
980 try:
980 try:
981 raw_input("Please press <RETURN> to start IPython.")
981 raw_input("Please press <RETURN> to start IPython.")
982 except EOFError:
982 except EOFError:
983 print >> Term.cout
983 print >> Term.cout
984 print '*'*70
984 print '*'*70
985
985
986 cwd = os.getcwd() # remember where we started
986 cwd = os.getcwd() # remember where we started
987 glb = glob.glob
987 glb = glob.glob
988 print '*'*70
988 print '*'*70
989 if mode == 'install':
989 if mode == 'install':
990 print \
990 print \
991 """Welcome to IPython. I will try to create a personal configuration directory
991 """Welcome to IPython. I will try to create a personal configuration directory
992 where you can customize many aspects of IPython's functionality in:\n"""
992 where you can customize many aspects of IPython's functionality in:\n"""
993 else:
993 else:
994 print 'I am going to upgrade your configuration in:'
994 print 'I am going to upgrade your configuration in:'
995
995
996 print ipythondir
996 print ipythondir
997
997
998 rcdirend = os.path.join('IPython','UserConfig')
998 rcdirend = os.path.join('IPython','UserConfig')
999 cfg = lambda d: os.path.join(d,rcdirend)
999 cfg = lambda d: os.path.join(d,rcdirend)
1000 try:
1000 try:
1001 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1001 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1002 except IOError:
1002 except IOError:
1003 warning = """
1003 warning = """
1004 Installation error. IPython's directory was not found.
1004 Installation error. IPython's directory was not found.
1005
1005
1006 Check the following:
1006 Check the following:
1007
1007
1008 The ipython/IPython directory should be in a directory belonging to your
1008 The ipython/IPython directory should be in a directory belonging to your
1009 PYTHONPATH environment variable (that is, it should be in a directory
1009 PYTHONPATH environment variable (that is, it should be in a directory
1010 belonging to sys.path). You can copy it explicitly there or just link to it.
1010 belonging to sys.path). You can copy it explicitly there or just link to it.
1011
1011
1012 IPython will proceed with builtin defaults.
1012 IPython will proceed with builtin defaults.
1013 """
1013 """
1014 warn(warning)
1014 warn(warning)
1015 wait()
1015 wait()
1016 return
1016 return
1017
1017
1018 if mode == 'install':
1018 if mode == 'install':
1019 try:
1019 try:
1020 shutil.copytree(rcdir,ipythondir)
1020 shutil.copytree(rcdir,ipythondir)
1021 os.chdir(ipythondir)
1021 os.chdir(ipythondir)
1022 rc_files = glb("ipythonrc*")
1022 rc_files = glb("ipythonrc*")
1023 for rc_file in rc_files:
1023 for rc_file in rc_files:
1024 os.rename(rc_file,rc_file+rc_suffix)
1024 os.rename(rc_file,rc_file+rc_suffix)
1025 except:
1025 except:
1026 warning = """
1026 warning = """
1027
1027
1028 There was a problem with the installation:
1028 There was a problem with the installation:
1029 %s
1029 %s
1030 Try to correct it or contact the developers if you think it's a bug.
1030 Try to correct it or contact the developers if you think it's a bug.
1031 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1031 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1032 warn(warning)
1032 warn(warning)
1033 wait()
1033 wait()
1034 return
1034 return
1035
1035
1036 elif mode == 'upgrade':
1036 elif mode == 'upgrade':
1037 try:
1037 try:
1038 os.chdir(ipythondir)
1038 os.chdir(ipythondir)
1039 except:
1039 except:
1040 print """
1040 print """
1041 Can not upgrade: changing to directory %s failed. Details:
1041 Can not upgrade: changing to directory %s failed. Details:
1042 %s
1042 %s
1043 """ % (ipythondir,sys.exc_info()[1])
1043 """ % (ipythondir,sys.exc_info()[1])
1044 wait()
1044 wait()
1045 return
1045 return
1046 else:
1046 else:
1047 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1047 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1048 for new_full_path in sources:
1048 for new_full_path in sources:
1049 new_filename = os.path.basename(new_full_path)
1049 new_filename = os.path.basename(new_full_path)
1050 if new_filename.startswith('ipythonrc'):
1050 if new_filename.startswith('ipythonrc'):
1051 new_filename = new_filename + rc_suffix
1051 new_filename = new_filename + rc_suffix
1052 # The config directory should only contain files, skip any
1052 # The config directory should only contain files, skip any
1053 # directories which may be there (like CVS)
1053 # directories which may be there (like CVS)
1054 if os.path.isdir(new_full_path):
1054 if os.path.isdir(new_full_path):
1055 continue
1055 continue
1056 if os.path.exists(new_filename):
1056 if os.path.exists(new_filename):
1057 old_file = new_filename+'.old'
1057 old_file = new_filename+'.old'
1058 if os.path.exists(old_file):
1058 if os.path.exists(old_file):
1059 os.remove(old_file)
1059 os.remove(old_file)
1060 os.rename(new_filename,old_file)
1060 os.rename(new_filename,old_file)
1061 shutil.copy(new_full_path,new_filename)
1061 shutil.copy(new_full_path,new_filename)
1062 else:
1062 else:
1063 raise ValueError,'unrecognized mode for install:',`mode`
1063 raise ValueError,'unrecognized mode for install:',`mode`
1064
1064
1065 # Fix line-endings to those native to each platform in the config
1065 # Fix line-endings to those native to each platform in the config
1066 # directory.
1066 # directory.
1067 try:
1067 try:
1068 os.chdir(ipythondir)
1068 os.chdir(ipythondir)
1069 except:
1069 except:
1070 print """
1070 print """
1071 Problem: changing to directory %s failed.
1071 Problem: changing to directory %s failed.
1072 Details:
1072 Details:
1073 %s
1073 %s
1074
1074
1075 Some configuration files may have incorrect line endings. This should not
1075 Some configuration files may have incorrect line endings. This should not
1076 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1076 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1077 wait()
1077 wait()
1078 else:
1078 else:
1079 for fname in glb('ipythonrc*'):
1079 for fname in glb('ipythonrc*'):
1080 try:
1080 try:
1081 native_line_ends(fname,backup=0)
1081 native_line_ends(fname,backup=0)
1082 except IOError:
1082 except IOError:
1083 pass
1083 pass
1084
1084
1085 if mode == 'install':
1085 if mode == 'install':
1086 print """
1086 print """
1087 Successful installation!
1087 Successful installation!
1088
1088
1089 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1089 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1090 IPython manual (there are both HTML and PDF versions supplied with the
1090 IPython manual (there are both HTML and PDF versions supplied with the
1091 distribution) to make sure that your system environment is properly configured
1091 distribution) to make sure that your system environment is properly configured
1092 to take advantage of IPython's features.
1092 to take advantage of IPython's features.
1093
1093
1094 Important note: the configuration system has changed! The old system is
1094 Important note: the configuration system has changed! The old system is
1095 still in place, but its setting may be partly overridden by the settings in
1095 still in place, but its setting may be partly overridden by the settings in
1096 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1096 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1097 if some of the new settings bother you.
1097 if some of the new settings bother you.
1098
1098
1099 """
1099 """
1100 else:
1100 else:
1101 print """
1101 print """
1102 Successful upgrade!
1102 Successful upgrade!
1103
1103
1104 All files in your directory:
1104 All files in your directory:
1105 %(ipythondir)s
1105 %(ipythondir)s
1106 which would have been overwritten by the upgrade were backed up with a .old
1106 which would have been overwritten by the upgrade were backed up with a .old
1107 extension. If you had made particular customizations in those files you may
1107 extension. If you had made particular customizations in those files you may
1108 want to merge them back into the new files.""" % locals()
1108 want to merge them back into the new files.""" % locals()
1109 wait()
1109 wait()
1110 os.chdir(cwd)
1110 os.chdir(cwd)
1111 # end user_setup()
1111 # end user_setup()
1112
1112
1113 def atexit_operations(self):
1113 def atexit_operations(self):
1114 """This will be executed at the time of exit.
1114 """This will be executed at the time of exit.
1115
1115
1116 Saving of persistent data should be performed here. """
1116 Saving of persistent data should be performed here. """
1117
1117
1118 #print '*** IPython exit cleanup ***' # dbg
1118 #print '*** IPython exit cleanup ***' # dbg
1119 # input history
1119 # input history
1120 self.savehist()
1120 self.savehist()
1121
1121
1122 # Cleanup all tempfiles left around
1122 # Cleanup all tempfiles left around
1123 for tfile in self.tempfiles:
1123 for tfile in self.tempfiles:
1124 try:
1124 try:
1125 os.unlink(tfile)
1125 os.unlink(tfile)
1126 except OSError:
1126 except OSError:
1127 pass
1127 pass
1128
1128
1129 # save the "persistent data" catch-all dictionary
1129 # save the "persistent data" catch-all dictionary
1130 self.hooks.shutdown_hook()
1130 self.hooks.shutdown_hook()
1131
1131
1132 def savehist(self):
1132 def savehist(self):
1133 """Save input history to a file (via readline library)."""
1133 """Save input history to a file (via readline library)."""
1134 try:
1134 try:
1135 self.readline.write_history_file(self.histfile)
1135 self.readline.write_history_file(self.histfile)
1136 except:
1136 except:
1137 print 'Unable to save IPython command history to file: ' + \
1137 print 'Unable to save IPython command history to file: ' + \
1138 `self.histfile`
1138 `self.histfile`
1139
1139
1140 def pre_readline(self):
1140 def pre_readline(self):
1141 """readline hook to be used at the start of each line.
1141 """readline hook to be used at the start of each line.
1142
1142
1143 Currently it handles auto-indent only."""
1143 Currently it handles auto-indent only."""
1144
1144
1145 #debugx('self.indent_current_nsp','pre_readline:')
1145 #debugx('self.indent_current_nsp','pre_readline:')
1146 self.readline.insert_text(self.indent_current_str())
1146 self.readline.insert_text(self.indent_current_str())
1147
1147
1148 def init_readline(self):
1148 def init_readline(self):
1149 """Command history completion/saving/reloading."""
1149 """Command history completion/saving/reloading."""
1150
1150
1151 import IPython.rlineimpl as readline
1151 import IPython.rlineimpl as readline
1152 if not readline.have_readline:
1152 if not readline.have_readline:
1153 self.has_readline = 0
1153 self.has_readline = 0
1154 self.readline = None
1154 self.readline = None
1155 # no point in bugging windows users with this every time:
1155 # no point in bugging windows users with this every time:
1156 warn('Readline services not available on this platform.')
1156 warn('Readline services not available on this platform.')
1157 else:
1157 else:
1158 sys.modules['readline'] = readline
1158 sys.modules['readline'] = readline
1159 import atexit
1159 import atexit
1160 from IPython.completer import IPCompleter
1160 from IPython.completer import IPCompleter
1161 self.Completer = IPCompleter(self,
1161 self.Completer = IPCompleter(self,
1162 self.user_ns,
1162 self.user_ns,
1163 self.user_global_ns,
1163 self.user_global_ns,
1164 self.rc.readline_omit__names,
1164 self.rc.readline_omit__names,
1165 self.alias_table)
1165 self.alias_table)
1166
1166
1167 # Platform-specific configuration
1167 # Platform-specific configuration
1168 if os.name == 'nt':
1168 if os.name == 'nt':
1169 self.readline_startup_hook = readline.set_pre_input_hook
1169 self.readline_startup_hook = readline.set_pre_input_hook
1170 else:
1170 else:
1171 self.readline_startup_hook = readline.set_startup_hook
1171 self.readline_startup_hook = readline.set_startup_hook
1172
1172
1173 # Load user's initrc file (readline config)
1173 # Load user's initrc file (readline config)
1174 inputrc_name = os.environ.get('INPUTRC')
1174 inputrc_name = os.environ.get('INPUTRC')
1175 if inputrc_name is None:
1175 if inputrc_name is None:
1176 home_dir = get_home_dir()
1176 home_dir = get_home_dir()
1177 if home_dir is not None:
1177 if home_dir is not None:
1178 inputrc_name = os.path.join(home_dir,'.inputrc')
1178 inputrc_name = os.path.join(home_dir,'.inputrc')
1179 if os.path.isfile(inputrc_name):
1179 if os.path.isfile(inputrc_name):
1180 try:
1180 try:
1181 readline.read_init_file(inputrc_name)
1181 readline.read_init_file(inputrc_name)
1182 except:
1182 except:
1183 warn('Problems reading readline initialization file <%s>'
1183 warn('Problems reading readline initialization file <%s>'
1184 % inputrc_name)
1184 % inputrc_name)
1185
1185
1186 self.has_readline = 1
1186 self.has_readline = 1
1187 self.readline = readline
1187 self.readline = readline
1188 # save this in sys so embedded copies can restore it properly
1188 # save this in sys so embedded copies can restore it properly
1189 sys.ipcompleter = self.Completer.complete
1189 sys.ipcompleter = self.Completer.complete
1190 readline.set_completer(self.Completer.complete)
1190 readline.set_completer(self.Completer.complete)
1191
1191
1192 # Configure readline according to user's prefs
1192 # Configure readline according to user's prefs
1193 for rlcommand in self.rc.readline_parse_and_bind:
1193 for rlcommand in self.rc.readline_parse_and_bind:
1194 readline.parse_and_bind(rlcommand)
1194 readline.parse_and_bind(rlcommand)
1195
1195
1196 # remove some chars from the delimiters list
1196 # remove some chars from the delimiters list
1197 delims = readline.get_completer_delims()
1197 delims = readline.get_completer_delims()
1198 delims = delims.translate(string._idmap,
1198 delims = delims.translate(string._idmap,
1199 self.rc.readline_remove_delims)
1199 self.rc.readline_remove_delims)
1200 readline.set_completer_delims(delims)
1200 readline.set_completer_delims(delims)
1201 # otherwise we end up with a monster history after a while:
1201 # otherwise we end up with a monster history after a while:
1202 readline.set_history_length(1000)
1202 readline.set_history_length(1000)
1203 try:
1203 try:
1204 #print '*** Reading readline history' # dbg
1204 #print '*** Reading readline history' # dbg
1205 readline.read_history_file(self.histfile)
1205 readline.read_history_file(self.histfile)
1206 except IOError:
1206 except IOError:
1207 pass # It doesn't exist yet.
1207 pass # It doesn't exist yet.
1208
1208
1209 atexit.register(self.atexit_operations)
1209 atexit.register(self.atexit_operations)
1210 del atexit
1210 del atexit
1211
1211
1212 # Configure auto-indent for all platforms
1212 # Configure auto-indent for all platforms
1213 self.set_autoindent(self.rc.autoindent)
1213 self.set_autoindent(self.rc.autoindent)
1214
1214
1215 def _should_recompile(self,e):
1215 def _should_recompile(self,e):
1216 """Utility routine for edit_syntax_error"""
1216 """Utility routine for edit_syntax_error"""
1217
1217
1218 if e.filename in ('<ipython console>','<input>','<string>',
1218 if e.filename in ('<ipython console>','<input>','<string>',
1219 '<console>',None):
1219 '<console>',None):
1220
1220
1221 return False
1221 return False
1222 try:
1222 try:
1223 if (self.rc.autoedit_syntax != 2 and
1223 if (self.rc.autoedit_syntax != 2 and
1224 not ask_yes_no('Return to editor to correct syntax error? '
1224 not ask_yes_no('Return to editor to correct syntax error? '
1225 '[Y/n] ','y')):
1225 '[Y/n] ','y')):
1226 return False
1226 return False
1227 except EOFError:
1227 except EOFError:
1228 return False
1228 return False
1229
1229
1230 def int0(x):
1230 def int0(x):
1231 try:
1231 try:
1232 return int(x)
1232 return int(x)
1233 except TypeError:
1233 except TypeError:
1234 return 0
1234 return 0
1235 # always pass integer line and offset values to editor hook
1235 # always pass integer line and offset values to editor hook
1236 self.hooks.fix_error_editor(e.filename,
1236 self.hooks.fix_error_editor(e.filename,
1237 int0(e.lineno),int0(e.offset),e.msg)
1237 int0(e.lineno),int0(e.offset),e.msg)
1238 return True
1238 return True
1239
1239
1240 def edit_syntax_error(self):
1240 def edit_syntax_error(self):
1241 """The bottom half of the syntax error handler called in the main loop.
1241 """The bottom half of the syntax error handler called in the main loop.
1242
1242
1243 Loop until syntax error is fixed or user cancels.
1243 Loop until syntax error is fixed or user cancels.
1244 """
1244 """
1245
1245
1246 while self.SyntaxTB.last_syntax_error:
1246 while self.SyntaxTB.last_syntax_error:
1247 # copy and clear last_syntax_error
1247 # copy and clear last_syntax_error
1248 err = self.SyntaxTB.clear_err_state()
1248 err = self.SyntaxTB.clear_err_state()
1249 if not self._should_recompile(err):
1249 if not self._should_recompile(err):
1250 return
1250 return
1251 try:
1251 try:
1252 # may set last_syntax_error again if a SyntaxError is raised
1252 # may set last_syntax_error again if a SyntaxError is raised
1253 self.safe_execfile(err.filename,self.shell.user_ns)
1253 self.safe_execfile(err.filename,self.shell.user_ns)
1254 except:
1254 except:
1255 self.showtraceback()
1255 self.showtraceback()
1256 else:
1256 else:
1257 f = file(err.filename)
1257 f = file(err.filename)
1258 try:
1258 try:
1259 sys.displayhook(f.read())
1259 sys.displayhook(f.read())
1260 finally:
1260 finally:
1261 f.close()
1261 f.close()
1262
1262
1263 def showsyntaxerror(self, filename=None):
1263 def showsyntaxerror(self, filename=None):
1264 """Display the syntax error that just occurred.
1264 """Display the syntax error that just occurred.
1265
1265
1266 This doesn't display a stack trace because there isn't one.
1266 This doesn't display a stack trace because there isn't one.
1267
1267
1268 If a filename is given, it is stuffed in the exception instead
1268 If a filename is given, it is stuffed in the exception instead
1269 of what was there before (because Python's parser always uses
1269 of what was there before (because Python's parser always uses
1270 "<string>" when reading from a string).
1270 "<string>" when reading from a string).
1271 """
1271 """
1272 etype, value, last_traceback = sys.exc_info()
1272 etype, value, last_traceback = sys.exc_info()
1273 if filename and etype is SyntaxError:
1273 if filename and etype is SyntaxError:
1274 # Work hard to stuff the correct filename in the exception
1274 # Work hard to stuff the correct filename in the exception
1275 try:
1275 try:
1276 msg, (dummy_filename, lineno, offset, line) = value
1276 msg, (dummy_filename, lineno, offset, line) = value
1277 except:
1277 except:
1278 # Not the format we expect; leave it alone
1278 # Not the format we expect; leave it alone
1279 pass
1279 pass
1280 else:
1280 else:
1281 # Stuff in the right filename
1281 # Stuff in the right filename
1282 try:
1282 try:
1283 # Assume SyntaxError is a class exception
1283 # Assume SyntaxError is a class exception
1284 value = SyntaxError(msg, (filename, lineno, offset, line))
1284 value = SyntaxError(msg, (filename, lineno, offset, line))
1285 except:
1285 except:
1286 # If that failed, assume SyntaxError is a string
1286 # If that failed, assume SyntaxError is a string
1287 value = msg, (filename, lineno, offset, line)
1287 value = msg, (filename, lineno, offset, line)
1288 self.SyntaxTB(etype,value,[])
1288 self.SyntaxTB(etype,value,[])
1289
1289
1290 def debugger(self):
1290 def debugger(self):
1291 """Call the pdb debugger."""
1291 """Call the pdb debugger."""
1292
1292
1293 if not self.rc.pdb:
1293 if not self.rc.pdb:
1294 return
1294 return
1295 pdb.pm()
1295 pdb.pm()
1296
1296
1297 def showtraceback(self,exc_tuple = None,filename=None):
1297 def showtraceback(self,exc_tuple = None,filename=None):
1298 """Display the exception that just occurred."""
1298 """Display the exception that just occurred."""
1299
1299
1300 # Though this won't be called by syntax errors in the input line,
1300 # Though this won't be called by syntax errors in the input line,
1301 # there may be SyntaxError cases whith imported code.
1301 # there may be SyntaxError cases whith imported code.
1302 if exc_tuple is None:
1302 if exc_tuple is None:
1303 type, value, tb = sys.exc_info()
1303 type, value, tb = sys.exc_info()
1304 else:
1304 else:
1305 type, value, tb = exc_tuple
1305 type, value, tb = exc_tuple
1306 if type is SyntaxError:
1306 if type is SyntaxError:
1307 self.showsyntaxerror(filename)
1307 self.showsyntaxerror(filename)
1308 else:
1308 else:
1309 self.InteractiveTB()
1309 self.InteractiveTB()
1310 if self.InteractiveTB.call_pdb and self.has_readline:
1310 if self.InteractiveTB.call_pdb and self.has_readline:
1311 # pdb mucks up readline, fix it back
1311 # pdb mucks up readline, fix it back
1312 self.readline.set_completer(self.Completer.complete)
1312 self.readline.set_completer(self.Completer.complete)
1313
1313
1314 def mainloop(self,banner=None):
1314 def mainloop(self,banner=None):
1315 """Creates the local namespace and starts the mainloop.
1315 """Creates the local namespace and starts the mainloop.
1316
1316
1317 If an optional banner argument is given, it will override the
1317 If an optional banner argument is given, it will override the
1318 internally created default banner."""
1318 internally created default banner."""
1319
1319
1320 if self.rc.c: # Emulate Python's -c option
1320 if self.rc.c: # Emulate Python's -c option
1321 self.exec_init_cmd()
1321 self.exec_init_cmd()
1322 if banner is None:
1322 if banner is None:
1323 if self.rc.banner:
1323 if self.rc.banner:
1324 banner = self.BANNER+self.banner2
1324 banner = self.BANNER+self.banner2
1325 else:
1325 else:
1326 banner = ''
1326 banner = ''
1327 self.interact(banner)
1327 self.interact(banner)
1328
1328
1329 def exec_init_cmd(self):
1329 def exec_init_cmd(self):
1330 """Execute a command given at the command line.
1330 """Execute a command given at the command line.
1331
1331
1332 This emulates Python's -c option."""
1332 This emulates Python's -c option."""
1333
1333
1334 #sys.argv = ['-c']
1334 #sys.argv = ['-c']
1335 self.push(self.rc.c)
1335 self.push(self.rc.c)
1336
1336
1337 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1337 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1338 """Embeds IPython into a running python program.
1338 """Embeds IPython into a running python program.
1339
1339
1340 Input:
1340 Input:
1341
1341
1342 - header: An optional header message can be specified.
1342 - header: An optional header message can be specified.
1343
1343
1344 - local_ns, global_ns: working namespaces. If given as None, the
1344 - local_ns, global_ns: working namespaces. If given as None, the
1345 IPython-initialized one is updated with __main__.__dict__, so that
1345 IPython-initialized one is updated with __main__.__dict__, so that
1346 program variables become visible but user-specific configuration
1346 program variables become visible but user-specific configuration
1347 remains possible.
1347 remains possible.
1348
1348
1349 - stack_depth: specifies how many levels in the stack to go to
1349 - stack_depth: specifies how many levels in the stack to go to
1350 looking for namespaces (when local_ns and global_ns are None). This
1350 looking for namespaces (when local_ns and global_ns are None). This
1351 allows an intermediate caller to make sure that this function gets
1351 allows an intermediate caller to make sure that this function gets
1352 the namespace from the intended level in the stack. By default (0)
1352 the namespace from the intended level in the stack. By default (0)
1353 it will get its locals and globals from the immediate caller.
1353 it will get its locals and globals from the immediate caller.
1354
1354
1355 Warning: it's possible to use this in a program which is being run by
1355 Warning: it's possible to use this in a program which is being run by
1356 IPython itself (via %run), but some funny things will happen (a few
1356 IPython itself (via %run), but some funny things will happen (a few
1357 globals get overwritten). In the future this will be cleaned up, as
1357 globals get overwritten). In the future this will be cleaned up, as
1358 there is no fundamental reason why it can't work perfectly."""
1358 there is no fundamental reason why it can't work perfectly."""
1359
1359
1360 # Get locals and globals from caller
1360 # Get locals and globals from caller
1361 if local_ns is None or global_ns is None:
1361 if local_ns is None or global_ns is None:
1362 call_frame = sys._getframe(stack_depth).f_back
1362 call_frame = sys._getframe(stack_depth).f_back
1363
1363
1364 if local_ns is None:
1364 if local_ns is None:
1365 local_ns = call_frame.f_locals
1365 local_ns = call_frame.f_locals
1366 if global_ns is None:
1366 if global_ns is None:
1367 global_ns = call_frame.f_globals
1367 global_ns = call_frame.f_globals
1368
1368
1369 # Update namespaces and fire up interpreter
1369 # Update namespaces and fire up interpreter
1370
1370
1371 # The global one is easy, we can just throw it in
1371 # The global one is easy, we can just throw it in
1372 self.user_global_ns = global_ns
1372 self.user_global_ns = global_ns
1373
1373
1374 # but the user/local one is tricky: ipython needs it to store internal
1374 # but the user/local one is tricky: ipython needs it to store internal
1375 # data, but we also need the locals. We'll copy locals in the user
1375 # data, but we also need the locals. We'll copy locals in the user
1376 # one, but will track what got copied so we can delete them at exit.
1376 # one, but will track what got copied so we can delete them at exit.
1377 # This is so that a later embedded call doesn't see locals from a
1377 # This is so that a later embedded call doesn't see locals from a
1378 # previous call (which most likely existed in a separate scope).
1378 # previous call (which most likely existed in a separate scope).
1379 local_varnames = local_ns.keys()
1379 local_varnames = local_ns.keys()
1380 self.user_ns.update(local_ns)
1380 self.user_ns.update(local_ns)
1381
1381
1382 # Patch for global embedding to make sure that things don't overwrite
1382 # Patch for global embedding to make sure that things don't overwrite
1383 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1383 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1384 # FIXME. Test this a bit more carefully (the if.. is new)
1384 # FIXME. Test this a bit more carefully (the if.. is new)
1385 if local_ns is None and global_ns is None:
1385 if local_ns is None and global_ns is None:
1386 self.user_global_ns.update(__main__.__dict__)
1386 self.user_global_ns.update(__main__.__dict__)
1387
1387
1388 # make sure the tab-completer has the correct frame information, so it
1388 # make sure the tab-completer has the correct frame information, so it
1389 # actually completes using the frame's locals/globals
1389 # actually completes using the frame's locals/globals
1390 self.set_completer_frame()
1390 self.set_completer_frame()
1391
1391
1392 # before activating the interactive mode, we need to make sure that
1392 # before activating the interactive mode, we need to make sure that
1393 # all names in the builtin namespace needed by ipython point to
1393 # all names in the builtin namespace needed by ipython point to
1394 # ourselves, and not to other instances.
1394 # ourselves, and not to other instances.
1395 self.add_builtins()
1395 self.add_builtins()
1396
1396
1397 self.interact(header)
1397 self.interact(header)
1398
1398
1399 # now, purge out the user namespace from anything we might have added
1399 # now, purge out the user namespace from anything we might have added
1400 # from the caller's local namespace
1400 # from the caller's local namespace
1401 delvar = self.user_ns.pop
1401 delvar = self.user_ns.pop
1402 for var in local_varnames:
1402 for var in local_varnames:
1403 delvar(var,None)
1403 delvar(var,None)
1404 # and clean builtins we may have overridden
1404 # and clean builtins we may have overridden
1405 self.clean_builtins()
1405 self.clean_builtins()
1406
1406
1407 def interact(self, banner=None):
1407 def interact(self, banner=None):
1408 """Closely emulate the interactive Python console.
1408 """Closely emulate the interactive Python console.
1409
1409
1410 The optional banner argument specify the banner to print
1410 The optional banner argument specify the banner to print
1411 before the first interaction; by default it prints a banner
1411 before the first interaction; by default it prints a banner
1412 similar to the one printed by the real Python interpreter,
1412 similar to the one printed by the real Python interpreter,
1413 followed by the current class name in parentheses (so as not
1413 followed by the current class name in parentheses (so as not
1414 to confuse this with the real interpreter -- since it's so
1414 to confuse this with the real interpreter -- since it's so
1415 close!).
1415 close!).
1416
1416
1417 """
1417 """
1418 cprt = 'Type "copyright", "credits" or "license" for more information.'
1418 cprt = 'Type "copyright", "credits" or "license" for more information.'
1419 if banner is None:
1419 if banner is None:
1420 self.write("Python %s on %s\n%s\n(%s)\n" %
1420 self.write("Python %s on %s\n%s\n(%s)\n" %
1421 (sys.version, sys.platform, cprt,
1421 (sys.version, sys.platform, cprt,
1422 self.__class__.__name__))
1422 self.__class__.__name__))
1423 else:
1423 else:
1424 self.write(banner)
1424 self.write(banner)
1425
1425
1426 more = 0
1426 more = 0
1427
1427
1428 # Mark activity in the builtins
1428 # Mark activity in the builtins
1429 __builtin__.__dict__['__IPYTHON__active'] += 1
1429 __builtin__.__dict__['__IPYTHON__active'] += 1
1430
1430
1431 # exit_now is set by a call to %Exit or %Quit
1431 # exit_now is set by a call to %Exit or %Quit
1432 self.exit_now = False
1432 self.exit_now = False
1433 while not self.exit_now:
1433 while not self.exit_now:
1434 if more:
1434 if more:
1435 prompt = self.outputcache.prompt2
1435 prompt = self.outputcache.prompt2
1436 if self.autoindent:
1436 if self.autoindent:
1437 self.readline_startup_hook(self.pre_readline)
1437 self.readline_startup_hook(self.pre_readline)
1438 else:
1438 else:
1439 prompt = self.outputcache.prompt1
1439 prompt = self.outputcache.prompt1
1440 try:
1440 try:
1441 line = self.raw_input(prompt,more)
1441 line = self.raw_input(prompt,more)
1442 if self.autoindent:
1442 if self.autoindent:
1443 self.readline_startup_hook(None)
1443 self.readline_startup_hook(None)
1444 except KeyboardInterrupt:
1444 except KeyboardInterrupt:
1445 self.write('\nKeyboardInterrupt\n')
1445 self.write('\nKeyboardInterrupt\n')
1446 self.resetbuffer()
1446 self.resetbuffer()
1447 # keep cache in sync with the prompt counter:
1447 # keep cache in sync with the prompt counter:
1448 self.outputcache.prompt_count -= 1
1448 self.outputcache.prompt_count -= 1
1449
1449
1450 if self.autoindent:
1450 if self.autoindent:
1451 self.indent_current_nsp = 0
1451 self.indent_current_nsp = 0
1452 more = 0
1452 more = 0
1453 except EOFError:
1453 except EOFError:
1454 if self.autoindent:
1454 if self.autoindent:
1455 self.readline_startup_hook(None)
1455 self.readline_startup_hook(None)
1456 self.write('\n')
1456 self.write('\n')
1457 self.exit()
1457 self.exit()
1458 except bdb.BdbQuit:
1458 except bdb.BdbQuit:
1459 warn('The Python debugger has exited with a BdbQuit exception.\n'
1459 warn('The Python debugger has exited with a BdbQuit exception.\n'
1460 'Because of how pdb handles the stack, it is impossible\n'
1460 'Because of how pdb handles the stack, it is impossible\n'
1461 'for IPython to properly format this particular exception.\n'
1461 'for IPython to properly format this particular exception.\n'
1462 'IPython will resume normal operation.')
1462 'IPython will resume normal operation.')
1463 except:
1463 except:
1464 # exceptions here are VERY RARE, but they can be triggered
1464 # exceptions here are VERY RARE, but they can be triggered
1465 # asynchronously by signal handlers, for example.
1465 # asynchronously by signal handlers, for example.
1466 self.showtraceback()
1466 self.showtraceback()
1467 else:
1467 else:
1468 more = self.push(line)
1468 more = self.push(line)
1469 if (self.SyntaxTB.last_syntax_error and
1469 if (self.SyntaxTB.last_syntax_error and
1470 self.rc.autoedit_syntax):
1470 self.rc.autoedit_syntax):
1471 self.edit_syntax_error()
1471 self.edit_syntax_error()
1472
1472
1473 # We are off again...
1473 # We are off again...
1474 __builtin__.__dict__['__IPYTHON__active'] -= 1
1474 __builtin__.__dict__['__IPYTHON__active'] -= 1
1475
1475
1476 def excepthook(self, type, value, tb):
1476 def excepthook(self, type, value, tb):
1477 """One more defense for GUI apps that call sys.excepthook.
1477 """One more defense for GUI apps that call sys.excepthook.
1478
1478
1479 GUI frameworks like wxPython trap exceptions and call
1479 GUI frameworks like wxPython trap exceptions and call
1480 sys.excepthook themselves. I guess this is a feature that
1480 sys.excepthook themselves. I guess this is a feature that
1481 enables them to keep running after exceptions that would
1481 enables them to keep running after exceptions that would
1482 otherwise kill their mainloop. This is a bother for IPython
1482 otherwise kill their mainloop. This is a bother for IPython
1483 which excepts to catch all of the program exceptions with a try:
1483 which excepts to catch all of the program exceptions with a try:
1484 except: statement.
1484 except: statement.
1485
1485
1486 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1486 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1487 any app directly invokes sys.excepthook, it will look to the user like
1487 any app directly invokes sys.excepthook, it will look to the user like
1488 IPython crashed. In order to work around this, we can disable the
1488 IPython crashed. In order to work around this, we can disable the
1489 CrashHandler and replace it with this excepthook instead, which prints a
1489 CrashHandler and replace it with this excepthook instead, which prints a
1490 regular traceback using our InteractiveTB. In this fashion, apps which
1490 regular traceback using our InteractiveTB. In this fashion, apps which
1491 call sys.excepthook will generate a regular-looking exception from
1491 call sys.excepthook will generate a regular-looking exception from
1492 IPython, and the CrashHandler will only be triggered by real IPython
1492 IPython, and the CrashHandler will only be triggered by real IPython
1493 crashes.
1493 crashes.
1494
1494
1495 This hook should be used sparingly, only in places which are not likely
1495 This hook should be used sparingly, only in places which are not likely
1496 to be true IPython errors.
1496 to be true IPython errors.
1497 """
1497 """
1498
1498
1499 self.InteractiveTB(type, value, tb, tb_offset=0)
1499 self.InteractiveTB(type, value, tb, tb_offset=0)
1500 if self.InteractiveTB.call_pdb and self.has_readline:
1500 if self.InteractiveTB.call_pdb and self.has_readline:
1501 self.readline.set_completer(self.Completer.complete)
1501 self.readline.set_completer(self.Completer.complete)
1502
1502
1503 def call_alias(self,alias,rest=''):
1503 def transform_alias(self, alias,rest=''):
1504 """Call an alias given its name and the rest of the line.
1504 """ Transform alias to system command string
1505
1505
1506 This function MUST be given a proper alias, because it doesn't make
1506 """
1507 any checks when looking up into the alias table. The caller is
1508 responsible for invoking it only with a valid alias."""
1509
1510 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1511 nargs,cmd = self.alias_table[alias]
1507 nargs,cmd = self.alias_table[alias]
1512 # Expand the %l special to be the user's input line
1508 # Expand the %l special to be the user's input line
1513 if cmd.find('%l') >= 0:
1509 if cmd.find('%l') >= 0:
1514 cmd = cmd.replace('%l',rest)
1510 cmd = cmd.replace('%l',rest)
1515 rest = ''
1511 rest = ''
1516 if nargs==0:
1512 if nargs==0:
1517 # Simple, argument-less aliases
1513 # Simple, argument-less aliases
1518 cmd = '%s %s' % (cmd,rest)
1514 cmd = '%s %s' % (cmd,rest)
1519 else:
1515 else:
1520 # Handle aliases with positional arguments
1516 # Handle aliases with positional arguments
1521 args = rest.split(None,nargs)
1517 args = rest.split(None,nargs)
1522 if len(args)< nargs:
1518 if len(args)< nargs:
1523 error('Alias <%s> requires %s arguments, %s given.' %
1519 error('Alias <%s> requires %s arguments, %s given.' %
1524 (alias,nargs,len(args)))
1520 (alias,nargs,len(args)))
1525 return
1521 return None
1526 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1522 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1527 # Now call the macro, evaluating in the user's namespace
1523 # Now call the macro, evaluating in the user's namespace
1524
1525 return cmd
1526
1527 def call_alias(self,alias,rest=''):
1528 """Call an alias given its name and the rest of the line.
1529
1530 This is only used to provide backwards compatibility for users of
1531 ipalias(), use of which is not recommended for anymore."""
1532
1533 # Now call the macro, evaluating in the user's namespace
1534 cmd = self.transform_alias(alias, rest)
1528 try:
1535 try:
1529 self.system(cmd)
1536 self.system(cmd)
1530 except:
1537 except:
1531 self.showtraceback()
1538 self.showtraceback()
1532
1539
1533 def indent_current_str(self):
1540 def indent_current_str(self):
1534 """return the current level of indentation as a string"""
1541 """return the current level of indentation as a string"""
1535 return self.indent_current_nsp * ' '
1542 return self.indent_current_nsp * ' '
1536
1543
1537 def autoindent_update(self,line):
1544 def autoindent_update(self,line):
1538 """Keep track of the indent level."""
1545 """Keep track of the indent level."""
1539
1546
1540 #debugx('line')
1547 #debugx('line')
1541 #debugx('self.indent_current_nsp')
1548 #debugx('self.indent_current_nsp')
1542 if self.autoindent:
1549 if self.autoindent:
1543 if line:
1550 if line:
1544 inisp = num_ini_spaces(line)
1551 inisp = num_ini_spaces(line)
1545 if inisp < self.indent_current_nsp:
1552 if inisp < self.indent_current_nsp:
1546 self.indent_current_nsp = inisp
1553 self.indent_current_nsp = inisp
1547
1554
1548 if line[-1] == ':':
1555 if line[-1] == ':':
1549 self.indent_current_nsp += 4
1556 self.indent_current_nsp += 4
1550 elif dedent_re.match(line):
1557 elif dedent_re.match(line):
1551 self.indent_current_nsp -= 4
1558 self.indent_current_nsp -= 4
1552 else:
1559 else:
1553 self.indent_current_nsp = 0
1560 self.indent_current_nsp = 0
1554
1561
1555 def runlines(self,lines):
1562 def runlines(self,lines):
1556 """Run a string of one or more lines of source.
1563 """Run a string of one or more lines of source.
1557
1564
1558 This method is capable of running a string containing multiple source
1565 This method is capable of running a string containing multiple source
1559 lines, as if they had been entered at the IPython prompt. Since it
1566 lines, as if they had been entered at the IPython prompt. Since it
1560 exposes IPython's processing machinery, the given strings can contain
1567 exposes IPython's processing machinery, the given strings can contain
1561 magic calls (%magic), special shell access (!cmd), etc."""
1568 magic calls (%magic), special shell access (!cmd), etc."""
1562
1569
1563 # We must start with a clean buffer, in case this is run from an
1570 # We must start with a clean buffer, in case this is run from an
1564 # interactive IPython session (via a magic, for example).
1571 # interactive IPython session (via a magic, for example).
1565 self.resetbuffer()
1572 self.resetbuffer()
1566 lines = lines.split('\n')
1573 lines = lines.split('\n')
1567 more = 0
1574 more = 0
1568 for line in lines:
1575 for line in lines:
1569 # skip blank lines so we don't mess up the prompt counter, but do
1576 # skip blank lines so we don't mess up the prompt counter, but do
1570 # NOT skip even a blank line if we are in a code block (more is
1577 # NOT skip even a blank line if we are in a code block (more is
1571 # true)
1578 # true)
1572 if line or more:
1579 if line or more:
1573 more = self.push(self.prefilter(line,more))
1580 more = self.push(self.prefilter(line,more))
1574 # IPython's runsource returns None if there was an error
1581 # IPython's runsource returns None if there was an error
1575 # compiling the code. This allows us to stop processing right
1582 # compiling the code. This allows us to stop processing right
1576 # away, so the user gets the error message at the right place.
1583 # away, so the user gets the error message at the right place.
1577 if more is None:
1584 if more is None:
1578 break
1585 break
1579 # final newline in case the input didn't have it, so that the code
1586 # final newline in case the input didn't have it, so that the code
1580 # actually does get executed
1587 # actually does get executed
1581 if more:
1588 if more:
1582 self.push('\n')
1589 self.push('\n')
1583
1590
1584 def runsource(self, source, filename='<input>', symbol='single'):
1591 def runsource(self, source, filename='<input>', symbol='single'):
1585 """Compile and run some source in the interpreter.
1592 """Compile and run some source in the interpreter.
1586
1593
1587 Arguments are as for compile_command().
1594 Arguments are as for compile_command().
1588
1595
1589 One several things can happen:
1596 One several things can happen:
1590
1597
1591 1) The input is incorrect; compile_command() raised an
1598 1) The input is incorrect; compile_command() raised an
1592 exception (SyntaxError or OverflowError). A syntax traceback
1599 exception (SyntaxError or OverflowError). A syntax traceback
1593 will be printed by calling the showsyntaxerror() method.
1600 will be printed by calling the showsyntaxerror() method.
1594
1601
1595 2) The input is incomplete, and more input is required;
1602 2) The input is incomplete, and more input is required;
1596 compile_command() returned None. Nothing happens.
1603 compile_command() returned None. Nothing happens.
1597
1604
1598 3) The input is complete; compile_command() returned a code
1605 3) The input is complete; compile_command() returned a code
1599 object. The code is executed by calling self.runcode() (which
1606 object. The code is executed by calling self.runcode() (which
1600 also handles run-time exceptions, except for SystemExit).
1607 also handles run-time exceptions, except for SystemExit).
1601
1608
1602 The return value is:
1609 The return value is:
1603
1610
1604 - True in case 2
1611 - True in case 2
1605
1612
1606 - False in the other cases, unless an exception is raised, where
1613 - False in the other cases, unless an exception is raised, where
1607 None is returned instead. This can be used by external callers to
1614 None is returned instead. This can be used by external callers to
1608 know whether to continue feeding input or not.
1615 know whether to continue feeding input or not.
1609
1616
1610 The return value can be used to decide whether to use sys.ps1 or
1617 The return value can be used to decide whether to use sys.ps1 or
1611 sys.ps2 to prompt the next line."""
1618 sys.ps2 to prompt the next line."""
1612
1619
1613 try:
1620 try:
1614 code = self.compile(source,filename,symbol)
1621 code = self.compile(source,filename,symbol)
1615 except (OverflowError, SyntaxError, ValueError):
1622 except (OverflowError, SyntaxError, ValueError):
1616 # Case 1
1623 # Case 1
1617 self.showsyntaxerror(filename)
1624 self.showsyntaxerror(filename)
1618 return None
1625 return None
1619
1626
1620 if code is None:
1627 if code is None:
1621 # Case 2
1628 # Case 2
1622 return True
1629 return True
1623
1630
1624 # Case 3
1631 # Case 3
1625 # We store the code object so that threaded shells and
1632 # We store the code object so that threaded shells and
1626 # custom exception handlers can access all this info if needed.
1633 # custom exception handlers can access all this info if needed.
1627 # The source corresponding to this can be obtained from the
1634 # The source corresponding to this can be obtained from the
1628 # buffer attribute as '\n'.join(self.buffer).
1635 # buffer attribute as '\n'.join(self.buffer).
1629 self.code_to_run = code
1636 self.code_to_run = code
1630 # now actually execute the code object
1637 # now actually execute the code object
1631 if self.runcode(code) == 0:
1638 if self.runcode(code) == 0:
1632 return False
1639 return False
1633 else:
1640 else:
1634 return None
1641 return None
1635
1642
1636 def runcode(self,code_obj):
1643 def runcode(self,code_obj):
1637 """Execute a code object.
1644 """Execute a code object.
1638
1645
1639 When an exception occurs, self.showtraceback() is called to display a
1646 When an exception occurs, self.showtraceback() is called to display a
1640 traceback.
1647 traceback.
1641
1648
1642 Return value: a flag indicating whether the code to be run completed
1649 Return value: a flag indicating whether the code to be run completed
1643 successfully:
1650 successfully:
1644
1651
1645 - 0: successful execution.
1652 - 0: successful execution.
1646 - 1: an error occurred.
1653 - 1: an error occurred.
1647 """
1654 """
1648
1655
1649 # Set our own excepthook in case the user code tries to call it
1656 # Set our own excepthook in case the user code tries to call it
1650 # directly, so that the IPython crash handler doesn't get triggered
1657 # directly, so that the IPython crash handler doesn't get triggered
1651 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1658 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1652
1659
1653 # we save the original sys.excepthook in the instance, in case config
1660 # we save the original sys.excepthook in the instance, in case config
1654 # code (such as magics) needs access to it.
1661 # code (such as magics) needs access to it.
1655 self.sys_excepthook = old_excepthook
1662 self.sys_excepthook = old_excepthook
1656 outflag = 1 # happens in more places, so it's easier as default
1663 outflag = 1 # happens in more places, so it's easier as default
1657 try:
1664 try:
1658 try:
1665 try:
1659 # Embedded instances require separate global/local namespaces
1666 # Embedded instances require separate global/local namespaces
1660 # so they can see both the surrounding (local) namespace and
1667 # so they can see both the surrounding (local) namespace and
1661 # the module-level globals when called inside another function.
1668 # the module-level globals when called inside another function.
1662 if self.embedded:
1669 if self.embedded:
1663 exec code_obj in self.user_global_ns, self.user_ns
1670 exec code_obj in self.user_global_ns, self.user_ns
1664 # Normal (non-embedded) instances should only have a single
1671 # Normal (non-embedded) instances should only have a single
1665 # namespace for user code execution, otherwise functions won't
1672 # namespace for user code execution, otherwise functions won't
1666 # see interactive top-level globals.
1673 # see interactive top-level globals.
1667 else:
1674 else:
1668 exec code_obj in self.user_ns
1675 exec code_obj in self.user_ns
1669 finally:
1676 finally:
1670 # Reset our crash handler in place
1677 # Reset our crash handler in place
1671 sys.excepthook = old_excepthook
1678 sys.excepthook = old_excepthook
1672 except SystemExit:
1679 except SystemExit:
1673 self.resetbuffer()
1680 self.resetbuffer()
1674 self.showtraceback()
1681 self.showtraceback()
1675 warn("Type exit or quit to exit IPython "
1682 warn("Type exit or quit to exit IPython "
1676 "(%Exit or %Quit do so unconditionally).",level=1)
1683 "(%Exit or %Quit do so unconditionally).",level=1)
1677 except self.custom_exceptions:
1684 except self.custom_exceptions:
1678 etype,value,tb = sys.exc_info()
1685 etype,value,tb = sys.exc_info()
1679 self.CustomTB(etype,value,tb)
1686 self.CustomTB(etype,value,tb)
1680 except:
1687 except:
1681 self.showtraceback()
1688 self.showtraceback()
1682 else:
1689 else:
1683 outflag = 0
1690 outflag = 0
1684 if softspace(sys.stdout, 0):
1691 if softspace(sys.stdout, 0):
1685 print
1692 print
1686 # Flush out code object which has been run (and source)
1693 # Flush out code object which has been run (and source)
1687 self.code_to_run = None
1694 self.code_to_run = None
1688 return outflag
1695 return outflag
1689
1696
1690 def push(self, line):
1697 def push(self, line):
1691 """Push a line to the interpreter.
1698 """Push a line to the interpreter.
1692
1699
1693 The line should not have a trailing newline; it may have
1700 The line should not have a trailing newline; it may have
1694 internal newlines. The line is appended to a buffer and the
1701 internal newlines. The line is appended to a buffer and the
1695 interpreter's runsource() method is called with the
1702 interpreter's runsource() method is called with the
1696 concatenated contents of the buffer as source. If this
1703 concatenated contents of the buffer as source. If this
1697 indicates that the command was executed or invalid, the buffer
1704 indicates that the command was executed or invalid, the buffer
1698 is reset; otherwise, the command is incomplete, and the buffer
1705 is reset; otherwise, the command is incomplete, and the buffer
1699 is left as it was after the line was appended. The return
1706 is left as it was after the line was appended. The return
1700 value is 1 if more input is required, 0 if the line was dealt
1707 value is 1 if more input is required, 0 if the line was dealt
1701 with in some way (this is the same as runsource()).
1708 with in some way (this is the same as runsource()).
1702 """
1709 """
1703
1710
1704 # autoindent management should be done here, and not in the
1711 # autoindent management should be done here, and not in the
1705 # interactive loop, since that one is only seen by keyboard input. We
1712 # interactive loop, since that one is only seen by keyboard input. We
1706 # need this done correctly even for code run via runlines (which uses
1713 # need this done correctly even for code run via runlines (which uses
1707 # push).
1714 # push).
1708
1715
1709 #print 'push line: <%s>' % line # dbg
1716 #print 'push line: <%s>' % line # dbg
1710 self.autoindent_update(line)
1717 self.autoindent_update(line)
1711
1718
1712 self.buffer.append(line)
1719 self.buffer.append(line)
1713 more = self.runsource('\n'.join(self.buffer), self.filename)
1720 more = self.runsource('\n'.join(self.buffer), self.filename)
1714 if not more:
1721 if not more:
1715 self.resetbuffer()
1722 self.resetbuffer()
1716 return more
1723 return more
1717
1724
1718 def resetbuffer(self):
1725 def resetbuffer(self):
1719 """Reset the input buffer."""
1726 """Reset the input buffer."""
1720 self.buffer[:] = []
1727 self.buffer[:] = []
1721
1728
1722 def raw_input(self,prompt='',continue_prompt=False):
1729 def raw_input(self,prompt='',continue_prompt=False):
1723 """Write a prompt and read a line.
1730 """Write a prompt and read a line.
1724
1731
1725 The returned line does not include the trailing newline.
1732 The returned line does not include the trailing newline.
1726 When the user enters the EOF key sequence, EOFError is raised.
1733 When the user enters the EOF key sequence, EOFError is raised.
1727
1734
1728 Optional inputs:
1735 Optional inputs:
1729
1736
1730 - prompt(''): a string to be printed to prompt the user.
1737 - prompt(''): a string to be printed to prompt the user.
1731
1738
1732 - continue_prompt(False): whether this line is the first one or a
1739 - continue_prompt(False): whether this line is the first one or a
1733 continuation in a sequence of inputs.
1740 continuation in a sequence of inputs.
1734 """
1741 """
1735
1742
1736 line = raw_input_original(prompt)
1743 line = raw_input_original(prompt)
1737
1744
1738 # Try to be reasonably smart about not re-indenting pasted input more
1745 # Try to be reasonably smart about not re-indenting pasted input more
1739 # than necessary. We do this by trimming out the auto-indent initial
1746 # than necessary. We do this by trimming out the auto-indent initial
1740 # spaces, if the user's actual input started itself with whitespace.
1747 # spaces, if the user's actual input started itself with whitespace.
1741 #debugx('self.buffer[-1]')
1748 #debugx('self.buffer[-1]')
1742
1749
1743 if self.autoindent:
1750 if self.autoindent:
1744 if num_ini_spaces(line) > self.indent_current_nsp:
1751 if num_ini_spaces(line) > self.indent_current_nsp:
1745 line = line[self.indent_current_nsp:]
1752 line = line[self.indent_current_nsp:]
1746 self.indent_current_nsp = 0
1753 self.indent_current_nsp = 0
1747
1754
1748 # store the unfiltered input before the user has any chance to modify
1755 # store the unfiltered input before the user has any chance to modify
1749 # it.
1756 # it.
1750 if line.strip():
1757 if line.strip():
1751 if continue_prompt:
1758 if continue_prompt:
1752 self.input_hist_raw[-1] += '%s\n' % line
1759 self.input_hist_raw[-1] += '%s\n' % line
1753 else:
1760 else:
1754 self.input_hist_raw.append('%s\n' % line)
1761 self.input_hist_raw.append('%s\n' % line)
1755
1762
1756 lineout = self.prefilter(line,continue_prompt)
1763 lineout = self.prefilter(line,continue_prompt)
1757 return lineout
1764 return lineout
1758
1765
1759 def split_user_input(self,line):
1766 def split_user_input(self,line):
1760 """Split user input into pre-char, function part and rest."""
1767 """Split user input into pre-char, function part and rest."""
1761
1768
1762 lsplit = self.line_split.match(line)
1769 lsplit = self.line_split.match(line)
1763 if lsplit is None: # no regexp match returns None
1770 if lsplit is None: # no regexp match returns None
1764 try:
1771 try:
1765 iFun,theRest = line.split(None,1)
1772 iFun,theRest = line.split(None,1)
1766 except ValueError:
1773 except ValueError:
1767 iFun,theRest = line,''
1774 iFun,theRest = line,''
1768 pre = re.match('^(\s*)(.*)',line).groups()[0]
1775 pre = re.match('^(\s*)(.*)',line).groups()[0]
1769 else:
1776 else:
1770 pre,iFun,theRest = lsplit.groups()
1777 pre,iFun,theRest = lsplit.groups()
1771
1778
1772 #print 'line:<%s>' % line # dbg
1779 #print 'line:<%s>' % line # dbg
1773 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1780 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1774 return pre,iFun.strip(),theRest
1781 return pre,iFun.strip(),theRest
1775
1782
1776 def _prefilter(self, line, continue_prompt):
1783 def _prefilter(self, line, continue_prompt):
1777 """Calls different preprocessors, depending on the form of line."""
1784 """Calls different preprocessors, depending on the form of line."""
1778
1785
1779 # All handlers *must* return a value, even if it's blank ('').
1786 # All handlers *must* return a value, even if it's blank ('').
1780
1787
1781 # Lines are NOT logged here. Handlers should process the line as
1788 # Lines are NOT logged here. Handlers should process the line as
1782 # needed, update the cache AND log it (so that the input cache array
1789 # needed, update the cache AND log it (so that the input cache array
1783 # stays synced).
1790 # stays synced).
1784
1791
1785 # This function is _very_ delicate, and since it's also the one which
1792 # This function is _very_ delicate, and since it's also the one which
1786 # determines IPython's response to user input, it must be as efficient
1793 # determines IPython's response to user input, it must be as efficient
1787 # as possible. For this reason it has _many_ returns in it, trying
1794 # as possible. For this reason it has _many_ returns in it, trying
1788 # always to exit as quickly as it can figure out what it needs to do.
1795 # always to exit as quickly as it can figure out what it needs to do.
1789
1796
1790 # This function is the main responsible for maintaining IPython's
1797 # This function is the main responsible for maintaining IPython's
1791 # behavior respectful of Python's semantics. So be _very_ careful if
1798 # behavior respectful of Python's semantics. So be _very_ careful if
1792 # making changes to anything here.
1799 # making changes to anything here.
1793
1800
1794 #.....................................................................
1801 #.....................................................................
1795 # Code begins
1802 # Code begins
1796
1803
1797 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1804 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1798
1805
1799 # save the line away in case we crash, so the post-mortem handler can
1806 # save the line away in case we crash, so the post-mortem handler can
1800 # record it
1807 # record it
1801 self._last_input_line = line
1808 self._last_input_line = line
1802
1809
1803 #print '***line: <%s>' % line # dbg
1810 #print '***line: <%s>' % line # dbg
1804
1811
1805 # the input history needs to track even empty lines
1812 # the input history needs to track even empty lines
1806 stripped = line.strip()
1813 stripped = line.strip()
1807
1814
1808 if not stripped:
1815 if not stripped:
1809 if not continue_prompt:
1816 if not continue_prompt:
1810 self.outputcache.prompt_count -= 1
1817 self.outputcache.prompt_count -= 1
1811 return self.handle_normal(line,continue_prompt)
1818 return self.handle_normal(line,continue_prompt)
1812 #return self.handle_normal('',continue_prompt)
1819 #return self.handle_normal('',continue_prompt)
1813
1820
1814 # print '***cont',continue_prompt # dbg
1821 # print '***cont',continue_prompt # dbg
1815 # special handlers are only allowed for single line statements
1822 # special handlers are only allowed for single line statements
1816 if continue_prompt and not self.rc.multi_line_specials:
1823 if continue_prompt and not self.rc.multi_line_specials:
1817 return self.handle_normal(line,continue_prompt)
1824 return self.handle_normal(line,continue_prompt)
1818
1825
1819
1826
1820 # For the rest, we need the structure of the input
1827 # For the rest, we need the structure of the input
1821 pre,iFun,theRest = self.split_user_input(line)
1828 pre,iFun,theRest = self.split_user_input(line)
1822
1829
1823 # See whether any pre-existing handler can take care of it
1830 # See whether any pre-existing handler can take care of it
1824
1831
1825 rewritten = self.hooks.input_prefilter(stripped)
1832 rewritten = self.hooks.input_prefilter(stripped)
1826 if rewritten != stripped: # ok, some prefilter did something
1833 if rewritten != stripped: # ok, some prefilter did something
1827 rewritten = pre + rewritten # add indentation
1834 rewritten = pre + rewritten # add indentation
1828 return self.handle_normal(rewritten)
1835 return self.handle_normal(rewritten)
1829
1836
1830
1837
1831
1838
1832
1839
1833 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1840 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1834
1841
1835 # First check for explicit escapes in the last/first character
1842 # First check for explicit escapes in the last/first character
1836 handler = None
1843 handler = None
1837 if line[-1] == self.ESC_HELP:
1844 if line[-1] == self.ESC_HELP:
1838 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1845 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1839 if handler is None:
1846 if handler is None:
1840 # look at the first character of iFun, NOT of line, so we skip
1847 # look at the first character of iFun, NOT of line, so we skip
1841 # leading whitespace in multiline input
1848 # leading whitespace in multiline input
1842 handler = self.esc_handlers.get(iFun[0:1])
1849 handler = self.esc_handlers.get(iFun[0:1])
1843 if handler is not None:
1850 if handler is not None:
1844 return handler(line,continue_prompt,pre,iFun,theRest)
1851 return handler(line,continue_prompt,pre,iFun,theRest)
1845 # Emacs ipython-mode tags certain input lines
1852 # Emacs ipython-mode tags certain input lines
1846 if line.endswith('# PYTHON-MODE'):
1853 if line.endswith('# PYTHON-MODE'):
1847 return self.handle_emacs(line,continue_prompt)
1854 return self.handle_emacs(line,continue_prompt)
1848
1855
1849 # Next, check if we can automatically execute this thing
1856 # Next, check if we can automatically execute this thing
1850
1857
1851 # Allow ! in multi-line statements if multi_line_specials is on:
1858 # Allow ! in multi-line statements if multi_line_specials is on:
1852 if continue_prompt and self.rc.multi_line_specials and \
1859 if continue_prompt and self.rc.multi_line_specials and \
1853 iFun.startswith(self.ESC_SHELL):
1860 iFun.startswith(self.ESC_SHELL):
1854 return self.handle_shell_escape(line,continue_prompt,
1861 return self.handle_shell_escape(line,continue_prompt,
1855 pre=pre,iFun=iFun,
1862 pre=pre,iFun=iFun,
1856 theRest=theRest)
1863 theRest=theRest)
1857
1864
1858 # Let's try to find if the input line is a magic fn
1865 # Let's try to find if the input line is a magic fn
1859 oinfo = None
1866 oinfo = None
1860 if hasattr(self,'magic_'+iFun):
1867 if hasattr(self,'magic_'+iFun):
1861 # WARNING: _ofind uses getattr(), so it can consume generators and
1868 # WARNING: _ofind uses getattr(), so it can consume generators and
1862 # cause other side effects.
1869 # cause other side effects.
1863 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1870 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1864 if oinfo['ismagic']:
1871 if oinfo['ismagic']:
1865 # Be careful not to call magics when a variable assignment is
1872 # Be careful not to call magics when a variable assignment is
1866 # being made (ls='hi', for example)
1873 # being made (ls='hi', for example)
1867 if self.rc.automagic and \
1874 if self.rc.automagic and \
1868 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1875 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1869 (self.rc.multi_line_specials or not continue_prompt):
1876 (self.rc.multi_line_specials or not continue_prompt):
1870 return self.handle_magic(line,continue_prompt,
1877 return self.handle_magic(line,continue_prompt,
1871 pre,iFun,theRest)
1878 pre,iFun,theRest)
1872 else:
1879 else:
1873 return self.handle_normal(line,continue_prompt)
1880 return self.handle_normal(line,continue_prompt)
1874
1881
1875 # If the rest of the line begins with an (in)equality, assginment or
1882 # If the rest of the line begins with an (in)equality, assginment or
1876 # function call, we should not call _ofind but simply execute it.
1883 # function call, we should not call _ofind but simply execute it.
1877 # This avoids spurious geattr() accesses on objects upon assignment.
1884 # This avoids spurious geattr() accesses on objects upon assignment.
1878 #
1885 #
1879 # It also allows users to assign to either alias or magic names true
1886 # It also allows users to assign to either alias or magic names true
1880 # python variables (the magic/alias systems always take second seat to
1887 # python variables (the magic/alias systems always take second seat to
1881 # true python code).
1888 # true python code).
1882 if theRest and theRest[0] in '!=()':
1889 if theRest and theRest[0] in '!=()':
1883 return self.handle_normal(line,continue_prompt)
1890 return self.handle_normal(line,continue_prompt)
1884
1891
1885 if oinfo is None:
1892 if oinfo is None:
1886 # let's try to ensure that _oinfo is ONLY called when autocall is
1893 # let's try to ensure that _oinfo is ONLY called when autocall is
1887 # on. Since it has inevitable potential side effects, at least
1894 # on. Since it has inevitable potential side effects, at least
1888 # having autocall off should be a guarantee to the user that no
1895 # having autocall off should be a guarantee to the user that no
1889 # weird things will happen.
1896 # weird things will happen.
1890
1897
1891 if self.rc.autocall:
1898 if self.rc.autocall:
1892 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1899 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1893 else:
1900 else:
1894 # in this case, all that's left is either an alias or
1901 # in this case, all that's left is either an alias or
1895 # processing the line normally.
1902 # processing the line normally.
1896 if iFun in self.alias_table:
1903 if iFun in self.alias_table:
1897 return self.handle_alias(line,continue_prompt,
1904 return self.handle_alias(line,continue_prompt,
1898 pre,iFun,theRest)
1905 pre,iFun,theRest)
1899
1906
1900 else:
1907 else:
1901 return self.handle_normal(line,continue_prompt)
1908 return self.handle_normal(line,continue_prompt)
1902
1909
1903 if not oinfo['found']:
1910 if not oinfo['found']:
1904 return self.handle_normal(line,continue_prompt)
1911 return self.handle_normal(line,continue_prompt)
1905 else:
1912 else:
1906 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1913 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1907 if oinfo['isalias']:
1914 if oinfo['isalias']:
1908 return self.handle_alias(line,continue_prompt,
1915 return self.handle_alias(line,continue_prompt,
1909 pre,iFun,theRest)
1916 pre,iFun,theRest)
1910
1917
1911 if (self.rc.autocall
1918 if (self.rc.autocall
1912 and
1919 and
1913 (
1920 (
1914 #only consider exclusion re if not "," or ";" autoquoting
1921 #only consider exclusion re if not "," or ";" autoquoting
1915 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1922 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1916 or pre == self.ESC_PAREN) or
1923 or pre == self.ESC_PAREN) or
1917 (not self.re_exclude_auto.match(theRest)))
1924 (not self.re_exclude_auto.match(theRest)))
1918 and
1925 and
1919 self.re_fun_name.match(iFun) and
1926 self.re_fun_name.match(iFun) and
1920 callable(oinfo['obj'])) :
1927 callable(oinfo['obj'])) :
1921 #print 'going auto' # dbg
1928 #print 'going auto' # dbg
1922 return self.handle_auto(line,continue_prompt,
1929 return self.handle_auto(line,continue_prompt,
1923 pre,iFun,theRest,oinfo['obj'])
1930 pre,iFun,theRest,oinfo['obj'])
1924 else:
1931 else:
1925 #print 'was callable?', callable(oinfo['obj']) # dbg
1932 #print 'was callable?', callable(oinfo['obj']) # dbg
1926 return self.handle_normal(line,continue_prompt)
1933 return self.handle_normal(line,continue_prompt)
1927
1934
1928 # If we get here, we have a normal Python line. Log and return.
1935 # If we get here, we have a normal Python line. Log and return.
1929 return self.handle_normal(line,continue_prompt)
1936 return self.handle_normal(line,continue_prompt)
1930
1937
1931 def _prefilter_dumb(self, line, continue_prompt):
1938 def _prefilter_dumb(self, line, continue_prompt):
1932 """simple prefilter function, for debugging"""
1939 """simple prefilter function, for debugging"""
1933 return self.handle_normal(line,continue_prompt)
1940 return self.handle_normal(line,continue_prompt)
1934
1941
1935 # Set the default prefilter() function (this can be user-overridden)
1942 # Set the default prefilter() function (this can be user-overridden)
1936 prefilter = _prefilter
1943 prefilter = _prefilter
1937
1944
1938 def handle_normal(self,line,continue_prompt=None,
1945 def handle_normal(self,line,continue_prompt=None,
1939 pre=None,iFun=None,theRest=None):
1946 pre=None,iFun=None,theRest=None):
1940 """Handle normal input lines. Use as a template for handlers."""
1947 """Handle normal input lines. Use as a template for handlers."""
1941
1948
1942 # With autoindent on, we need some way to exit the input loop, and I
1949 # With autoindent on, we need some way to exit the input loop, and I
1943 # don't want to force the user to have to backspace all the way to
1950 # don't want to force the user to have to backspace all the way to
1944 # clear the line. The rule will be in this case, that either two
1951 # clear the line. The rule will be in this case, that either two
1945 # lines of pure whitespace in a row, or a line of pure whitespace but
1952 # lines of pure whitespace in a row, or a line of pure whitespace but
1946 # of a size different to the indent level, will exit the input loop.
1953 # of a size different to the indent level, will exit the input loop.
1947
1954
1948 if (continue_prompt and self.autoindent and line.isspace() and
1955 if (continue_prompt and self.autoindent and line.isspace() and
1949 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1956 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1950 (self.buffer[-1]).isspace() )):
1957 (self.buffer[-1]).isspace() )):
1951 line = ''
1958 line = ''
1952
1959
1953 self.log(line,continue_prompt)
1960 self.log(line,continue_prompt)
1954 return line
1961 return line
1955
1962
1956 def handle_alias(self,line,continue_prompt=None,
1963 def handle_alias(self,line,continue_prompt=None,
1957 pre=None,iFun=None,theRest=None):
1964 pre=None,iFun=None,theRest=None):
1958 """Handle alias input lines. """
1965 """Handle alias input lines. """
1959
1966
1960 # pre is needed, because it carries the leading whitespace. Otherwise
1967 # pre is needed, because it carries the leading whitespace. Otherwise
1961 # aliases won't work in indented sections.
1968 # aliases won't work in indented sections.
1962 line_out = '%sipalias(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
1969 transformed = self.transform_alias(iFun, theRest)
1970 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
1963 self.log(line_out,continue_prompt)
1971 self.log(line_out,continue_prompt)
1964 return line_out
1972 return line_out
1965
1973
1966 def handle_shell_escape(self, line, continue_prompt=None,
1974 def handle_shell_escape(self, line, continue_prompt=None,
1967 pre=None,iFun=None,theRest=None):
1975 pre=None,iFun=None,theRest=None):
1968 """Execute the line in a shell, empty return value"""
1976 """Execute the line in a shell, empty return value"""
1969
1977
1970 #print 'line in :', `line` # dbg
1978 #print 'line in :', `line` # dbg
1971 # Example of a special handler. Others follow a similar pattern.
1979 # Example of a special handler. Others follow a similar pattern.
1972 if line.lstrip().startswith('!!'):
1980 if line.lstrip().startswith('!!'):
1973 # rewrite iFun/theRest to properly hold the call to %sx and
1981 # rewrite iFun/theRest to properly hold the call to %sx and
1974 # the actual command to be executed, so handle_magic can work
1982 # the actual command to be executed, so handle_magic can work
1975 # correctly
1983 # correctly
1976 theRest = '%s %s' % (iFun[2:],theRest)
1984 theRest = '%s %s' % (iFun[2:],theRest)
1977 iFun = 'sx'
1985 iFun = 'sx'
1978 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
1986 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
1979 line.lstrip()[2:]),
1987 line.lstrip()[2:]),
1980 continue_prompt,pre,iFun,theRest)
1988 continue_prompt,pre,iFun,theRest)
1981 else:
1989 else:
1982 cmd=line.lstrip().lstrip('!')
1990 cmd=line.lstrip().lstrip('!')
1983 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
1991 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
1984 # update cache/log and return
1992 # update cache/log and return
1985 self.log(line_out,continue_prompt)
1993 self.log(line_out,continue_prompt)
1986 return line_out
1994 return line_out
1987
1995
1988 def handle_magic(self, line, continue_prompt=None,
1996 def handle_magic(self, line, continue_prompt=None,
1989 pre=None,iFun=None,theRest=None):
1997 pre=None,iFun=None,theRest=None):
1990 """Execute magic functions."""
1998 """Execute magic functions."""
1991
1999
1992
2000
1993 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2001 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
1994 self.log(cmd,continue_prompt)
2002 self.log(cmd,continue_prompt)
1995 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2003 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1996 return cmd
2004 return cmd
1997
2005
1998 def handle_auto(self, line, continue_prompt=None,
2006 def handle_auto(self, line, continue_prompt=None,
1999 pre=None,iFun=None,theRest=None,obj=None):
2007 pre=None,iFun=None,theRest=None,obj=None):
2000 """Hande lines which can be auto-executed, quoting if requested."""
2008 """Hande lines which can be auto-executed, quoting if requested."""
2001
2009
2002 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2010 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2003
2011
2004 # This should only be active for single-line input!
2012 # This should only be active for single-line input!
2005 if continue_prompt:
2013 if continue_prompt:
2006 self.log(line,continue_prompt)
2014 self.log(line,continue_prompt)
2007 return line
2015 return line
2008
2016
2009 auto_rewrite = True
2017 auto_rewrite = True
2010
2018
2011 if pre == self.ESC_QUOTE:
2019 if pre == self.ESC_QUOTE:
2012 # Auto-quote splitting on whitespace
2020 # Auto-quote splitting on whitespace
2013 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2021 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2014 elif pre == self.ESC_QUOTE2:
2022 elif pre == self.ESC_QUOTE2:
2015 # Auto-quote whole string
2023 # Auto-quote whole string
2016 newcmd = '%s("%s")' % (iFun,theRest)
2024 newcmd = '%s("%s")' % (iFun,theRest)
2017 elif pre == self.ESC_PAREN:
2025 elif pre == self.ESC_PAREN:
2018 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2026 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2019 else:
2027 else:
2020 # Auto-paren.
2028 # Auto-paren.
2021 # We only apply it to argument-less calls if the autocall
2029 # We only apply it to argument-less calls if the autocall
2022 # parameter is set to 2. We only need to check that autocall is <
2030 # parameter is set to 2. We only need to check that autocall is <
2023 # 2, since this function isn't called unless it's at least 1.
2031 # 2, since this function isn't called unless it's at least 1.
2024 if not theRest and (self.rc.autocall < 2):
2032 if not theRest and (self.rc.autocall < 2):
2025 newcmd = '%s %s' % (iFun,theRest)
2033 newcmd = '%s %s' % (iFun,theRest)
2026 auto_rewrite = False
2034 auto_rewrite = False
2027 else:
2035 else:
2028 if theRest.startswith('['):
2036 if theRest.startswith('['):
2029 if hasattr(obj,'__getitem__'):
2037 if hasattr(obj,'__getitem__'):
2030 # Don't autocall in this case: item access for an object
2038 # Don't autocall in this case: item access for an object
2031 # which is BOTH callable and implements __getitem__.
2039 # which is BOTH callable and implements __getitem__.
2032 newcmd = '%s %s' % (iFun,theRest)
2040 newcmd = '%s %s' % (iFun,theRest)
2033 auto_rewrite = False
2041 auto_rewrite = False
2034 else:
2042 else:
2035 # if the object doesn't support [] access, go ahead and
2043 # if the object doesn't support [] access, go ahead and
2036 # autocall
2044 # autocall
2037 newcmd = '%s(%s)' % (iFun.rstrip(),",".join(theRest.split()))
2045 newcmd = '%s(%s)' % (iFun.rstrip(),",".join(theRest.split()))
2038 elif theRest.endswith(';'):
2046 elif theRest.endswith(';'):
2039 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2047 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2040 else:
2048 else:
2041 newcmd = '%s(%s)' % (iFun.rstrip(),",".join(theRest.split()))
2049 newcmd = '%s(%s)' % (iFun.rstrip(),",".join(theRest.split()))
2042
2050
2043 if auto_rewrite:
2051 if auto_rewrite:
2044 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2052 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2045 # log what is now valid Python, not the actual user input (without the
2053 # log what is now valid Python, not the actual user input (without the
2046 # final newline)
2054 # final newline)
2047 self.log(newcmd,continue_prompt)
2055 self.log(newcmd,continue_prompt)
2048 return newcmd
2056 return newcmd
2049
2057
2050 def handle_help(self, line, continue_prompt=None,
2058 def handle_help(self, line, continue_prompt=None,
2051 pre=None,iFun=None,theRest=None):
2059 pre=None,iFun=None,theRest=None):
2052 """Try to get some help for the object.
2060 """Try to get some help for the object.
2053
2061
2054 obj? or ?obj -> basic information.
2062 obj? or ?obj -> basic information.
2055 obj?? or ??obj -> more details.
2063 obj?? or ??obj -> more details.
2056 """
2064 """
2057
2065
2058 # We need to make sure that we don't process lines which would be
2066 # We need to make sure that we don't process lines which would be
2059 # otherwise valid python, such as "x=1 # what?"
2067 # otherwise valid python, such as "x=1 # what?"
2060 try:
2068 try:
2061 codeop.compile_command(line)
2069 codeop.compile_command(line)
2062 except SyntaxError:
2070 except SyntaxError:
2063 # We should only handle as help stuff which is NOT valid syntax
2071 # We should only handle as help stuff which is NOT valid syntax
2064 if line[0]==self.ESC_HELP:
2072 if line[0]==self.ESC_HELP:
2065 line = line[1:]
2073 line = line[1:]
2066 elif line[-1]==self.ESC_HELP:
2074 elif line[-1]==self.ESC_HELP:
2067 line = line[:-1]
2075 line = line[:-1]
2068 self.log('#?'+line)
2076 self.log('#?'+line)
2069 if line:
2077 if line:
2070 self.magic_pinfo(line)
2078 self.magic_pinfo(line)
2071 else:
2079 else:
2072 page(self.usage,screen_lines=self.rc.screen_length)
2080 page(self.usage,screen_lines=self.rc.screen_length)
2073 return '' # Empty string is needed here!
2081 return '' # Empty string is needed here!
2074 except:
2082 except:
2075 # Pass any other exceptions through to the normal handler
2083 # Pass any other exceptions through to the normal handler
2076 return self.handle_normal(line,continue_prompt)
2084 return self.handle_normal(line,continue_prompt)
2077 else:
2085 else:
2078 # If the code compiles ok, we should handle it normally
2086 # If the code compiles ok, we should handle it normally
2079 return self.handle_normal(line,continue_prompt)
2087 return self.handle_normal(line,continue_prompt)
2080
2088
2081 def getapi(self):
2089 def getapi(self):
2082 """ Get an IPApi object for this shell instance
2090 """ Get an IPApi object for this shell instance
2083
2091
2084 Getting an IPApi object is always preferable to accessing the shell
2092 Getting an IPApi object is always preferable to accessing the shell
2085 directly, but this holds true especially for extensions.
2093 directly, but this holds true especially for extensions.
2086
2094
2087 It should always be possible to implement an extension with IPApi
2095 It should always be possible to implement an extension with IPApi
2088 alone. If not, contact maintainer to request an addition.
2096 alone. If not, contact maintainer to request an addition.
2089
2097
2090 """
2098 """
2091 return self.api
2099 return self.api
2092
2100
2093 def handle_emacs(self,line,continue_prompt=None,
2101 def handle_emacs(self,line,continue_prompt=None,
2094 pre=None,iFun=None,theRest=None):
2102 pre=None,iFun=None,theRest=None):
2095 """Handle input lines marked by python-mode."""
2103 """Handle input lines marked by python-mode."""
2096
2104
2097 # Currently, nothing is done. Later more functionality can be added
2105 # Currently, nothing is done. Later more functionality can be added
2098 # here if needed.
2106 # here if needed.
2099
2107
2100 # The input cache shouldn't be updated
2108 # The input cache shouldn't be updated
2101
2109
2102 return line
2110 return line
2103
2111
2104 def mktempfile(self,data=None):
2112 def mktempfile(self,data=None):
2105 """Make a new tempfile and return its filename.
2113 """Make a new tempfile and return its filename.
2106
2114
2107 This makes a call to tempfile.mktemp, but it registers the created
2115 This makes a call to tempfile.mktemp, but it registers the created
2108 filename internally so ipython cleans it up at exit time.
2116 filename internally so ipython cleans it up at exit time.
2109
2117
2110 Optional inputs:
2118 Optional inputs:
2111
2119
2112 - data(None): if data is given, it gets written out to the temp file
2120 - data(None): if data is given, it gets written out to the temp file
2113 immediately, and the file is closed again."""
2121 immediately, and the file is closed again."""
2114
2122
2115 filename = tempfile.mktemp('.py','ipython_edit_')
2123 filename = tempfile.mktemp('.py','ipython_edit_')
2116 self.tempfiles.append(filename)
2124 self.tempfiles.append(filename)
2117
2125
2118 if data:
2126 if data:
2119 tmp_file = open(filename,'w')
2127 tmp_file = open(filename,'w')
2120 tmp_file.write(data)
2128 tmp_file.write(data)
2121 tmp_file.close()
2129 tmp_file.close()
2122 return filename
2130 return filename
2123
2131
2124 def write(self,data):
2132 def write(self,data):
2125 """Write a string to the default output"""
2133 """Write a string to the default output"""
2126 Term.cout.write(data)
2134 Term.cout.write(data)
2127
2135
2128 def write_err(self,data):
2136 def write_err(self,data):
2129 """Write a string to the default error output"""
2137 """Write a string to the default error output"""
2130 Term.cerr.write(data)
2138 Term.cerr.write(data)
2131
2139
2132 def exit(self):
2140 def exit(self):
2133 """Handle interactive exit.
2141 """Handle interactive exit.
2134
2142
2135 This method sets the exit_now attribute."""
2143 This method sets the exit_now attribute."""
2136
2144
2137 if self.rc.confirm_exit:
2145 if self.rc.confirm_exit:
2138 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2146 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2139 self.exit_now = True
2147 self.exit_now = True
2140 else:
2148 else:
2141 self.exit_now = True
2149 self.exit_now = True
2142 return self.exit_now
2150 return self.exit_now
2143
2151
2144 def safe_execfile(self,fname,*where,**kw):
2152 def safe_execfile(self,fname,*where,**kw):
2145 fname = os.path.expanduser(fname)
2153 fname = os.path.expanduser(fname)
2146
2154
2147 # find things also in current directory
2155 # find things also in current directory
2148 dname = os.path.dirname(fname)
2156 dname = os.path.dirname(fname)
2149 if not sys.path.count(dname):
2157 if not sys.path.count(dname):
2150 sys.path.append(dname)
2158 sys.path.append(dname)
2151
2159
2152 try:
2160 try:
2153 xfile = open(fname)
2161 xfile = open(fname)
2154 except:
2162 except:
2155 print >> Term.cerr, \
2163 print >> Term.cerr, \
2156 'Could not open file <%s> for safe execution.' % fname
2164 'Could not open file <%s> for safe execution.' % fname
2157 return None
2165 return None
2158
2166
2159 kw.setdefault('islog',0)
2167 kw.setdefault('islog',0)
2160 kw.setdefault('quiet',1)
2168 kw.setdefault('quiet',1)
2161 kw.setdefault('exit_ignore',0)
2169 kw.setdefault('exit_ignore',0)
2162 first = xfile.readline()
2170 first = xfile.readline()
2163 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2171 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2164 xfile.close()
2172 xfile.close()
2165 # line by line execution
2173 # line by line execution
2166 if first.startswith(loghead) or kw['islog']:
2174 if first.startswith(loghead) or kw['islog']:
2167 print 'Loading log file <%s> one line at a time...' % fname
2175 print 'Loading log file <%s> one line at a time...' % fname
2168 if kw['quiet']:
2176 if kw['quiet']:
2169 stdout_save = sys.stdout
2177 stdout_save = sys.stdout
2170 sys.stdout = StringIO.StringIO()
2178 sys.stdout = StringIO.StringIO()
2171 try:
2179 try:
2172 globs,locs = where[0:2]
2180 globs,locs = where[0:2]
2173 except:
2181 except:
2174 try:
2182 try:
2175 globs = locs = where[0]
2183 globs = locs = where[0]
2176 except:
2184 except:
2177 globs = locs = globals()
2185 globs = locs = globals()
2178 badblocks = []
2186 badblocks = []
2179
2187
2180 # we also need to identify indented blocks of code when replaying
2188 # we also need to identify indented blocks of code when replaying
2181 # logs and put them together before passing them to an exec
2189 # logs and put them together before passing them to an exec
2182 # statement. This takes a bit of regexp and look-ahead work in the
2190 # statement. This takes a bit of regexp and look-ahead work in the
2183 # file. It's easiest if we swallow the whole thing in memory
2191 # file. It's easiest if we swallow the whole thing in memory
2184 # first, and manually walk through the lines list moving the
2192 # first, and manually walk through the lines list moving the
2185 # counter ourselves.
2193 # counter ourselves.
2186 indent_re = re.compile('\s+\S')
2194 indent_re = re.compile('\s+\S')
2187 xfile = open(fname)
2195 xfile = open(fname)
2188 filelines = xfile.readlines()
2196 filelines = xfile.readlines()
2189 xfile.close()
2197 xfile.close()
2190 nlines = len(filelines)
2198 nlines = len(filelines)
2191 lnum = 0
2199 lnum = 0
2192 while lnum < nlines:
2200 while lnum < nlines:
2193 line = filelines[lnum]
2201 line = filelines[lnum]
2194 lnum += 1
2202 lnum += 1
2195 # don't re-insert logger status info into cache
2203 # don't re-insert logger status info into cache
2196 if line.startswith('#log#'):
2204 if line.startswith('#log#'):
2197 continue
2205 continue
2198 else:
2206 else:
2199 # build a block of code (maybe a single line) for execution
2207 # build a block of code (maybe a single line) for execution
2200 block = line
2208 block = line
2201 try:
2209 try:
2202 next = filelines[lnum] # lnum has already incremented
2210 next = filelines[lnum] # lnum has already incremented
2203 except:
2211 except:
2204 next = None
2212 next = None
2205 while next and indent_re.match(next):
2213 while next and indent_re.match(next):
2206 block += next
2214 block += next
2207 lnum += 1
2215 lnum += 1
2208 try:
2216 try:
2209 next = filelines[lnum]
2217 next = filelines[lnum]
2210 except:
2218 except:
2211 next = None
2219 next = None
2212 # now execute the block of one or more lines
2220 # now execute the block of one or more lines
2213 try:
2221 try:
2214 exec block in globs,locs
2222 exec block in globs,locs
2215 except SystemExit:
2223 except SystemExit:
2216 pass
2224 pass
2217 except:
2225 except:
2218 badblocks.append(block.rstrip())
2226 badblocks.append(block.rstrip())
2219 if kw['quiet']: # restore stdout
2227 if kw['quiet']: # restore stdout
2220 sys.stdout.close()
2228 sys.stdout.close()
2221 sys.stdout = stdout_save
2229 sys.stdout = stdout_save
2222 print 'Finished replaying log file <%s>' % fname
2230 print 'Finished replaying log file <%s>' % fname
2223 if badblocks:
2231 if badblocks:
2224 print >> sys.stderr, ('\nThe following lines/blocks in file '
2232 print >> sys.stderr, ('\nThe following lines/blocks in file '
2225 '<%s> reported errors:' % fname)
2233 '<%s> reported errors:' % fname)
2226
2234
2227 for badline in badblocks:
2235 for badline in badblocks:
2228 print >> sys.stderr, badline
2236 print >> sys.stderr, badline
2229 else: # regular file execution
2237 else: # regular file execution
2230 try:
2238 try:
2231 execfile(fname,*where)
2239 execfile(fname,*where)
2232 except SyntaxError:
2240 except SyntaxError:
2233 etype,evalue = sys.exc_info()[:2]
2241 etype,evalue = sys.exc_info()[:2]
2234 self.SyntaxTB(etype,evalue,[])
2242 self.SyntaxTB(etype,evalue,[])
2235 warn('Failure executing file: <%s>' % fname)
2243 warn('Failure executing file: <%s>' % fname)
2236 except SystemExit,status:
2244 except SystemExit,status:
2237 if not kw['exit_ignore']:
2245 if not kw['exit_ignore']:
2238 self.InteractiveTB()
2246 self.InteractiveTB()
2239 warn('Failure executing file: <%s>' % fname)
2247 warn('Failure executing file: <%s>' % fname)
2240 except:
2248 except:
2241 self.InteractiveTB()
2249 self.InteractiveTB()
2242 warn('Failure executing file: <%s>' % fname)
2250 warn('Failure executing file: <%s>' % fname)
2243
2251
2244 #************************* end of file <iplib.py> *****************************
2252 #************************* end of file <iplib.py> *****************************
@@ -1,729 +1,727 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.1 or better.
5 Requires Python 2.1 or better.
6
6
7 This file contains the main make_IPython() starter function.
7 This file contains the main make_IPython() starter function.
8
8
9 $Id: ipmaker.py 1092 2006-01-27 23:56:32Z vivainio $"""
9 $Id: ipmaker.py 1111 2006-01-30 21:16:07Z vivainio $"""
10
10
11 #*****************************************************************************
11 #*****************************************************************************
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
13 #
13 #
14 # Distributed under the terms of the BSD License. The full license is in
14 # Distributed under the terms of the BSD License. The full license is in
15 # the file COPYING, distributed as part of this software.
15 # the file COPYING, distributed as part of this software.
16 #*****************************************************************************
16 #*****************************************************************************
17
17
18 from IPython import Release
18 from IPython import Release
19 __author__ = '%s <%s>' % Release.authors['Fernando']
19 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __license__ = Release.license
20 __license__ = Release.license
21 __version__ = Release.version
21 __version__ = Release.version
22
22
23 credits._Printer__data = """
23 credits._Printer__data = """
24 Python: %s
24 Python: %s
25
25
26 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
26 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
27 See http://ipython.scipy.org for more information.""" \
27 See http://ipython.scipy.org for more information.""" \
28 % credits._Printer__data
28 % credits._Printer__data
29
29
30 copyright._Printer__data += """
30 copyright._Printer__data += """
31
31
32 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
32 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
33 All Rights Reserved."""
33 All Rights Reserved."""
34
34
35 #****************************************************************************
35 #****************************************************************************
36 # Required modules
36 # Required modules
37
37
38 # From the standard library
38 # From the standard library
39 import __main__
39 import __main__
40 import __builtin__
40 import __builtin__
41 import os
41 import os
42 import re
42 import re
43 import sys
43 import sys
44 import types
44 import types
45 from pprint import pprint,pformat
45 from pprint import pprint,pformat
46
46
47 # Our own
47 # Our own
48 from IPython import DPyGetOpt
48 from IPython import DPyGetOpt
49 from IPython.ipstruct import Struct
49 from IPython.ipstruct import Struct
50 from IPython.OutputTrap import OutputTrap
50 from IPython.OutputTrap import OutputTrap
51 from IPython.ConfigLoader import ConfigLoader
51 from IPython.ConfigLoader import ConfigLoader
52 from IPython.iplib import InteractiveShell
52 from IPython.iplib import InteractiveShell
53 from IPython.usage import cmd_line_usage,interactive_usage
53 from IPython.usage import cmd_line_usage,interactive_usage
54 from IPython.genutils import *
54 from IPython.genutils import *
55
55
56 #-----------------------------------------------------------------------------
56 #-----------------------------------------------------------------------------
57 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
57 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
58 rc_override=None,shell_class=InteractiveShell,
58 rc_override=None,shell_class=InteractiveShell,
59 embedded=False,**kw):
59 embedded=False,**kw):
60 """This is a dump of IPython into a single function.
60 """This is a dump of IPython into a single function.
61
61
62 Later it will have to be broken up in a sensible manner.
62 Later it will have to be broken up in a sensible manner.
63
63
64 Arguments:
64 Arguments:
65
65
66 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
66 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
67 script name, b/c DPyGetOpt strips the first argument only for the real
67 script name, b/c DPyGetOpt strips the first argument only for the real
68 sys.argv.
68 sys.argv.
69
69
70 - user_ns: a dict to be used as the user's namespace."""
70 - user_ns: a dict to be used as the user's namespace."""
71
71
72 #----------------------------------------------------------------------
72 #----------------------------------------------------------------------
73 # Defaults and initialization
73 # Defaults and initialization
74
74
75 # For developer debugging, deactivates crash handler and uses pdb.
75 # For developer debugging, deactivates crash handler and uses pdb.
76 DEVDEBUG = False
76 DEVDEBUG = False
77
77
78 if argv is None:
78 if argv is None:
79 argv = sys.argv
79 argv = sys.argv
80
80
81 # __IP is the main global that lives throughout and represents the whole
81 # __IP is the main global that lives throughout and represents the whole
82 # application. If the user redefines it, all bets are off as to what
82 # application. If the user redefines it, all bets are off as to what
83 # happens.
83 # happens.
84
84
85 # __IP is the name of he global which the caller will have accessible as
85 # __IP is the name of he global which the caller will have accessible as
86 # __IP.name. We set its name via the first parameter passed to
86 # __IP.name. We set its name via the first parameter passed to
87 # InteractiveShell:
87 # InteractiveShell:
88
88
89 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
89 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
90 embedded=embedded,**kw)
90 embedded=embedded,**kw)
91
91
92 # Put 'help' in the user namespace
92 # Put 'help' in the user namespace
93 from site import _Helper
93 from site import _Helper
94 IP.user_ns['help'] = _Helper()
94 IP.user_ns['help'] = _Helper()
95
95
96
96
97 if DEVDEBUG:
97 if DEVDEBUG:
98 # For developer debugging only (global flag)
98 # For developer debugging only (global flag)
99 from IPython import ultraTB
99 from IPython import ultraTB
100 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
100 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
101
101
102 IP.BANNER_PARTS = ['Python %s\n'
102 IP.BANNER_PARTS = ['Python %s\n'
103 'Type "copyright", "credits" or "license" '
103 'Type "copyright", "credits" or "license" '
104 'for more information.\n'
104 'for more information.\n'
105 % (sys.version.split('\n')[0],),
105 % (sys.version.split('\n')[0],),
106 "IPython %s -- An enhanced Interactive Python."
106 "IPython %s -- An enhanced Interactive Python."
107 % (__version__,),
107 % (__version__,),
108 """? -> Introduction to IPython's features.
108 """? -> Introduction to IPython's features.
109 %magic -> Information about IPython's 'magic' % functions.
109 %magic -> Information about IPython's 'magic' % functions.
110 help -> Python's own help system.
110 help -> Python's own help system.
111 object? -> Details about 'object'. ?object also works, ?? prints more.
111 object? -> Details about 'object'. ?object also works, ?? prints more.
112 """ ]
112 """ ]
113
113
114 IP.usage = interactive_usage
114 IP.usage = interactive_usage
115
115
116 # Platform-dependent suffix and directory names. We use _ipython instead
116 # Platform-dependent suffix and directory names. We use _ipython instead
117 # of .ipython under win32 b/c there's software that breaks with .named
117 # of .ipython under win32 b/c there's software that breaks with .named
118 # directories on that platform.
118 # directories on that platform.
119 if os.name == 'posix':
119 if os.name == 'posix':
120 rc_suffix = ''
120 rc_suffix = ''
121 ipdir_def = '.ipython'
121 ipdir_def = '.ipython'
122 else:
122 else:
123 rc_suffix = '.ini'
123 rc_suffix = '.ini'
124 ipdir_def = '_ipython'
124 ipdir_def = '_ipython'
125
125
126 # default directory for configuration
126 # default directory for configuration
127 ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR',
127 ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR',
128 os.path.join(IP.home_dir,ipdir_def)))
128 os.path.join(IP.home_dir,ipdir_def)))
129
129
130 # we need the directory where IPython itself is installed
130 # we need the directory where IPython itself is installed
131 import IPython
131 import IPython
132 IPython_dir = os.path.dirname(IPython.__file__)
132 IPython_dir = os.path.dirname(IPython.__file__)
133 del IPython
133 del IPython
134
134
135 #-------------------------------------------------------------------------
135 #-------------------------------------------------------------------------
136 # Command line handling
136 # Command line handling
137
137
138 # Valid command line options (uses DPyGetOpt syntax, like Perl's
138 # Valid command line options (uses DPyGetOpt syntax, like Perl's
139 # GetOpt::Long)
139 # GetOpt::Long)
140
140
141 # Any key not listed here gets deleted even if in the file (like session
141 # Any key not listed here gets deleted even if in the file (like session
142 # or profile). That's deliberate, to maintain the rc namespace clean.
142 # or profile). That's deliberate, to maintain the rc namespace clean.
143
143
144 # Each set of options appears twice: under _conv only the names are
144 # Each set of options appears twice: under _conv only the names are
145 # listed, indicating which type they must be converted to when reading the
145 # listed, indicating which type they must be converted to when reading the
146 # ipythonrc file. And under DPyGetOpt they are listed with the regular
146 # ipythonrc file. And under DPyGetOpt they are listed with the regular
147 # DPyGetOpt syntax (=s,=i,:f,etc).
147 # DPyGetOpt syntax (=s,=i,:f,etc).
148
148
149 # Make sure there's a space before each end of line (they get auto-joined!)
149 # Make sure there's a space before each end of line (they get auto-joined!)
150 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
150 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
151 'c=s classic|cl color_info! colors=s confirm_exit! '
151 'c=s classic|cl color_info! colors=s confirm_exit! '
152 'debug! deep_reload! editor=s log|l messages! nosep pdb! '
152 'debug! deep_reload! editor=s log|l messages! nosep pdb! '
153 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
153 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
154 'quick screen_length|sl=i prompts_pad_left=i '
154 'quick screen_length|sl=i prompts_pad_left=i '
155 'logfile|lf=s logplay|lp=s profile|p=s '
155 'logfile|lf=s logplay|lp=s profile|p=s '
156 'readline! readline_merge_completions! '
156 'readline! readline_merge_completions! '
157 'readline_omit__names! '
157 'readline_omit__names! '
158 'rcfile=s separate_in|si=s separate_out|so=s '
158 'rcfile=s separate_in|si=s separate_out|so=s '
159 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
159 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
160 'magic_docstrings system_verbose! '
160 'magic_docstrings system_verbose! '
161 'multi_line_specials! '
161 'multi_line_specials! '
162 'wxversion=s '
162 'wxversion=s '
163 'autoedit_syntax!')
163 'autoedit_syntax!')
164
164
165 # Options that can *only* appear at the cmd line (not in rcfiles).
165 # Options that can *only* appear at the cmd line (not in rcfiles).
166
166
167 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
167 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
168 # the 'C-c !' command in emacs automatically appends a -i option at the end.
168 # the 'C-c !' command in emacs automatically appends a -i option at the end.
169 cmdline_only = ('help ignore|i ipythondir=s Version upgrade '
169 cmdline_only = ('help ignore|i ipythondir=s Version upgrade '
170 'gthread! qthread! wthread! pylab! tk!')
170 'gthread! qthread! wthread! pylab! tk!')
171
171
172 # Build the actual name list to be used by DPyGetOpt
172 # Build the actual name list to be used by DPyGetOpt
173 opts_names = qw(cmdline_opts) + qw(cmdline_only)
173 opts_names = qw(cmdline_opts) + qw(cmdline_only)
174
174
175 # Set sensible command line defaults.
175 # Set sensible command line defaults.
176 # This should have everything from cmdline_opts and cmdline_only
176 # This should have everything from cmdline_opts and cmdline_only
177 opts_def = Struct(autocall = 1,
177 opts_def = Struct(autocall = 1,
178 autoedit_syntax = 1,
178 autoedit_syntax = 1,
179 autoindent=0,
179 autoindent=0,
180 automagic = 1,
180 automagic = 1,
181 banner = 1,
181 banner = 1,
182 cache_size = 1000,
182 cache_size = 1000,
183 c = '',
183 c = '',
184 classic = 0,
184 classic = 0,
185 colors = 'NoColor',
185 colors = 'NoColor',
186 color_info = 0,
186 color_info = 0,
187 confirm_exit = 1,
187 confirm_exit = 1,
188 debug = 0,
188 debug = 0,
189 deep_reload = 0,
189 deep_reload = 0,
190 editor = '0',
190 editor = '0',
191 help = 0,
191 help = 0,
192 ignore = 0,
192 ignore = 0,
193 ipythondir = ipythondir,
193 ipythondir = ipythondir,
194 log = 0,
194 log = 0,
195 logfile = '',
195 logfile = '',
196 logplay = '',
196 logplay = '',
197 multi_line_specials = 1,
197 multi_line_specials = 1,
198 messages = 1,
198 messages = 1,
199 nosep = 0,
199 nosep = 0,
200 pdb = 0,
200 pdb = 0,
201 pprint = 0,
201 pprint = 0,
202 profile = '',
202 profile = '',
203 prompt_in1 = 'In [\\#]: ',
203 prompt_in1 = 'In [\\#]: ',
204 prompt_in2 = ' .\\D.: ',
204 prompt_in2 = ' .\\D.: ',
205 prompt_out = 'Out[\\#]: ',
205 prompt_out = 'Out[\\#]: ',
206 prompts_pad_left = 1,
206 prompts_pad_left = 1,
207 quick = 0,
207 quick = 0,
208 readline = 1,
208 readline = 1,
209 readline_merge_completions = 1,
209 readline_merge_completions = 1,
210 readline_omit__names = 0,
210 readline_omit__names = 0,
211 rcfile = 'ipythonrc' + rc_suffix,
211 rcfile = 'ipythonrc' + rc_suffix,
212 screen_length = 0,
212 screen_length = 0,
213 separate_in = '\n',
213 separate_in = '\n',
214 separate_out = '\n',
214 separate_out = '\n',
215 separate_out2 = '',
215 separate_out2 = '',
216 system_verbose = 0,
216 system_verbose = 0,
217 gthread = 0,
217 gthread = 0,
218 qthread = 0,
218 qthread = 0,
219 wthread = 0,
219 wthread = 0,
220 pylab = 0,
220 pylab = 0,
221 tk = 0,
221 tk = 0,
222 upgrade = 0,
222 upgrade = 0,
223 Version = 0,
223 Version = 0,
224 xmode = 'Verbose',
224 xmode = 'Verbose',
225 wildcards_case_sensitive = 1,
225 wildcards_case_sensitive = 1,
226 wxversion = '0',
226 wxversion = '0',
227 magic_docstrings = 0, # undocumented, for doc generation
227 magic_docstrings = 0, # undocumented, for doc generation
228 )
228 )
229
229
230 # Things that will *only* appear in rcfiles (not at the command line).
230 # Things that will *only* appear in rcfiles (not at the command line).
231 # Make sure there's a space before each end of line (they get auto-joined!)
231 # Make sure there's a space before each end of line (they get auto-joined!)
232 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
232 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
233 qw_lol: 'import_some ',
233 qw_lol: 'import_some ',
234 # for things with embedded whitespace:
234 # for things with embedded whitespace:
235 list_strings:'execute alias readline_parse_and_bind ',
235 list_strings:'execute alias readline_parse_and_bind ',
236 # Regular strings need no conversion:
236 # Regular strings need no conversion:
237 None:'readline_remove_delims ',
237 None:'readline_remove_delims ',
238 }
238 }
239 # Default values for these
239 # Default values for these
240 rc_def = Struct(include = [],
240 rc_def = Struct(include = [],
241 import_mod = [],
241 import_mod = [],
242 import_all = [],
242 import_all = [],
243 import_some = [[]],
243 import_some = [[]],
244 execute = [],
244 execute = [],
245 execfile = [],
245 execfile = [],
246 alias = [],
246 alias = [],
247 readline_parse_and_bind = [],
247 readline_parse_and_bind = [],
248 readline_remove_delims = '',
248 readline_remove_delims = '',
249 )
249 )
250
250
251 # Build the type conversion dictionary from the above tables:
251 # Build the type conversion dictionary from the above tables:
252 typeconv = rcfile_opts.copy()
252 typeconv = rcfile_opts.copy()
253 typeconv.update(optstr2types(cmdline_opts))
253 typeconv.update(optstr2types(cmdline_opts))
254
254
255 # FIXME: the None key appears in both, put that back together by hand. Ugly!
255 # FIXME: the None key appears in both, put that back together by hand. Ugly!
256 typeconv[None] += ' ' + rcfile_opts[None]
256 typeconv[None] += ' ' + rcfile_opts[None]
257
257
258 # Remove quotes at ends of all strings (used to protect spaces)
258 # Remove quotes at ends of all strings (used to protect spaces)
259 typeconv[unquote_ends] = typeconv[None]
259 typeconv[unquote_ends] = typeconv[None]
260 del typeconv[None]
260 del typeconv[None]
261
261
262 # Build the list we'll use to make all config decisions with defaults:
262 # Build the list we'll use to make all config decisions with defaults:
263 opts_all = opts_def.copy()
263 opts_all = opts_def.copy()
264 opts_all.update(rc_def)
264 opts_all.update(rc_def)
265
265
266 # Build conflict resolver for recursive loading of config files:
266 # Build conflict resolver for recursive loading of config files:
267 # - preserve means the outermost file maintains the value, it is not
267 # - preserve means the outermost file maintains the value, it is not
268 # overwritten if an included file has the same key.
268 # overwritten if an included file has the same key.
269 # - add_flip applies + to the two values, so it better make sense to add
269 # - add_flip applies + to the two values, so it better make sense to add
270 # those types of keys. But it flips them first so that things loaded
270 # those types of keys. But it flips them first so that things loaded
271 # deeper in the inclusion chain have lower precedence.
271 # deeper in the inclusion chain have lower precedence.
272 conflict = {'preserve': ' '.join([ typeconv[int],
272 conflict = {'preserve': ' '.join([ typeconv[int],
273 typeconv[unquote_ends] ]),
273 typeconv[unquote_ends] ]),
274 'add_flip': ' '.join([ typeconv[qwflat],
274 'add_flip': ' '.join([ typeconv[qwflat],
275 typeconv[qw_lol],
275 typeconv[qw_lol],
276 typeconv[list_strings] ])
276 typeconv[list_strings] ])
277 }
277 }
278
278
279 # Now actually process the command line
279 # Now actually process the command line
280 getopt = DPyGetOpt.DPyGetOpt()
280 getopt = DPyGetOpt.DPyGetOpt()
281 getopt.setIgnoreCase(0)
281 getopt.setIgnoreCase(0)
282
282
283 getopt.parseConfiguration(opts_names)
283 getopt.parseConfiguration(opts_names)
284
284
285 try:
285 try:
286 getopt.processArguments(argv)
286 getopt.processArguments(argv)
287 except:
287 except:
288 print cmd_line_usage
288 print cmd_line_usage
289 warn('\nError in Arguments: ' + `sys.exc_value`)
289 warn('\nError in Arguments: ' + `sys.exc_value`)
290 sys.exit(1)
290 sys.exit(1)
291
291
292 # convert the options dict to a struct for much lighter syntax later
292 # convert the options dict to a struct for much lighter syntax later
293 opts = Struct(getopt.optionValues)
293 opts = Struct(getopt.optionValues)
294 args = getopt.freeValues
294 args = getopt.freeValues
295
295
296 # this is the struct (which has default values at this point) with which
296 # this is the struct (which has default values at this point) with which
297 # we make all decisions:
297 # we make all decisions:
298 opts_all.update(opts)
298 opts_all.update(opts)
299
299
300 # Options that force an immediate exit
300 # Options that force an immediate exit
301 if opts_all.help:
301 if opts_all.help:
302 page(cmd_line_usage)
302 page(cmd_line_usage)
303 sys.exit()
303 sys.exit()
304
304
305 if opts_all.Version:
305 if opts_all.Version:
306 print __version__
306 print __version__
307 sys.exit()
307 sys.exit()
308
308
309 if opts_all.magic_docstrings:
309 if opts_all.magic_docstrings:
310 IP.magic_magic('-latex')
310 IP.magic_magic('-latex')
311 sys.exit()
311 sys.exit()
312
312
313 # Create user config directory if it doesn't exist. This must be done
313 # Create user config directory if it doesn't exist. This must be done
314 # *after* getting the cmd line options.
314 # *after* getting the cmd line options.
315 if not os.path.isdir(opts_all.ipythondir):
315 if not os.path.isdir(opts_all.ipythondir):
316 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
316 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
317
317
318 # upgrade user config files while preserving a copy of the originals
318 # upgrade user config files while preserving a copy of the originals
319 if opts_all.upgrade:
319 if opts_all.upgrade:
320 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
320 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
321
321
322 # check mutually exclusive options in the *original* command line
322 # check mutually exclusive options in the *original* command line
323 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
323 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
324 qw('classic profile'),qw('classic rcfile')])
324 qw('classic profile'),qw('classic rcfile')])
325
325
326 #---------------------------------------------------------------------------
326 #---------------------------------------------------------------------------
327 # Log replay
327 # Log replay
328
328
329 # if -logplay, we need to 'become' the other session. That basically means
329 # if -logplay, we need to 'become' the other session. That basically means
330 # replacing the current command line environment with that of the old
330 # replacing the current command line environment with that of the old
331 # session and moving on.
331 # session and moving on.
332
332
333 # this is needed so that later we know we're in session reload mode, as
333 # this is needed so that later we know we're in session reload mode, as
334 # opts_all will get overwritten:
334 # opts_all will get overwritten:
335 load_logplay = 0
335 load_logplay = 0
336
336
337 if opts_all.logplay:
337 if opts_all.logplay:
338 load_logplay = opts_all.logplay
338 load_logplay = opts_all.logplay
339 opts_debug_save = opts_all.debug
339 opts_debug_save = opts_all.debug
340 try:
340 try:
341 logplay = open(opts_all.logplay)
341 logplay = open(opts_all.logplay)
342 except IOError:
342 except IOError:
343 if opts_all.debug: IP.InteractiveTB()
343 if opts_all.debug: IP.InteractiveTB()
344 warn('Could not open logplay file '+`opts_all.logplay`)
344 warn('Could not open logplay file '+`opts_all.logplay`)
345 # restore state as if nothing had happened and move on, but make
345 # restore state as if nothing had happened and move on, but make
346 # sure that later we don't try to actually load the session file
346 # sure that later we don't try to actually load the session file
347 logplay = None
347 logplay = None
348 load_logplay = 0
348 load_logplay = 0
349 del opts_all.logplay
349 del opts_all.logplay
350 else:
350 else:
351 try:
351 try:
352 logplay.readline()
352 logplay.readline()
353 logplay.readline();
353 logplay.readline();
354 # this reloads that session's command line
354 # this reloads that session's command line
355 cmd = logplay.readline()[6:]
355 cmd = logplay.readline()[6:]
356 exec cmd
356 exec cmd
357 # restore the true debug flag given so that the process of
357 # restore the true debug flag given so that the process of
358 # session loading itself can be monitored.
358 # session loading itself can be monitored.
359 opts.debug = opts_debug_save
359 opts.debug = opts_debug_save
360 # save the logplay flag so later we don't overwrite the log
360 # save the logplay flag so later we don't overwrite the log
361 opts.logplay = load_logplay
361 opts.logplay = load_logplay
362 # now we must update our own structure with defaults
362 # now we must update our own structure with defaults
363 opts_all.update(opts)
363 opts_all.update(opts)
364 # now load args
364 # now load args
365 cmd = logplay.readline()[6:]
365 cmd = logplay.readline()[6:]
366 exec cmd
366 exec cmd
367 logplay.close()
367 logplay.close()
368 except:
368 except:
369 logplay.close()
369 logplay.close()
370 if opts_all.debug: IP.InteractiveTB()
370 if opts_all.debug: IP.InteractiveTB()
371 warn("Logplay file lacking full configuration information.\n"
371 warn("Logplay file lacking full configuration information.\n"
372 "I'll try to read it, but some things may not work.")
372 "I'll try to read it, but some things may not work.")
373
373
374 #-------------------------------------------------------------------------
374 #-------------------------------------------------------------------------
375 # set up output traps: catch all output from files, being run, modules
375 # set up output traps: catch all output from files, being run, modules
376 # loaded, etc. Then give it to the user in a clean form at the end.
376 # loaded, etc. Then give it to the user in a clean form at the end.
377
377
378 msg_out = 'Output messages. '
378 msg_out = 'Output messages. '
379 msg_err = 'Error messages. '
379 msg_err = 'Error messages. '
380 msg_sep = '\n'
380 msg_sep = '\n'
381 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
381 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
382 msg_err,msg_sep,debug,
382 msg_err,msg_sep,debug,
383 quiet_out=1),
383 quiet_out=1),
384 user_exec = OutputTrap('User File Execution',msg_out,
384 user_exec = OutputTrap('User File Execution',msg_out,
385 msg_err,msg_sep,debug),
385 msg_err,msg_sep,debug),
386 logplay = OutputTrap('Log Loader',msg_out,
386 logplay = OutputTrap('Log Loader',msg_out,
387 msg_err,msg_sep,debug),
387 msg_err,msg_sep,debug),
388 summary = ''
388 summary = ''
389 )
389 )
390
390
391 #-------------------------------------------------------------------------
391 #-------------------------------------------------------------------------
392 # Process user ipythonrc-type configuration files
392 # Process user ipythonrc-type configuration files
393
393
394 # turn on output trapping and log to msg.config
394 # turn on output trapping and log to msg.config
395 # remember that with debug on, trapping is actually disabled
395 # remember that with debug on, trapping is actually disabled
396 msg.config.trap_all()
396 msg.config.trap_all()
397
397
398 # look for rcfile in current or default directory
398 # look for rcfile in current or default directory
399 try:
399 try:
400 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
400 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
401 except IOError:
401 except IOError:
402 if opts_all.debug: IP.InteractiveTB()
402 if opts_all.debug: IP.InteractiveTB()
403 warn('Configuration file %s not found. Ignoring request.'
403 warn('Configuration file %s not found. Ignoring request.'
404 % (opts_all.rcfile) )
404 % (opts_all.rcfile) )
405
405
406 # 'profiles' are a shorthand notation for config filenames
406 # 'profiles' are a shorthand notation for config filenames
407 if opts_all.profile:
407 if opts_all.profile:
408
408
409 try:
409 try:
410 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
410 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
411 + rc_suffix,
411 + rc_suffix,
412 opts_all.ipythondir)
412 opts_all.ipythondir)
413 except IOError:
413 except IOError:
414 if opts_all.debug: IP.InteractiveTB()
414 if opts_all.debug: IP.InteractiveTB()
415 opts.profile = '' # remove profile from options if invalid
415 opts.profile = '' # remove profile from options if invalid
416 warn('Profile configuration file %s not found. Ignoring request.'
416 warn('Profile configuration file %s not found. Ignoring request.'
417 % (opts_all.profile) )
417 % (opts_all.profile) )
418
418
419
419
420 # load the config file
420 # load the config file
421 rcfiledata = None
421 rcfiledata = None
422 if opts_all.quick:
422 if opts_all.quick:
423 print 'Launching IPython in quick mode. No config file read.'
423 print 'Launching IPython in quick mode. No config file read.'
424 elif opts_all.classic:
424 elif opts_all.classic:
425 print 'Launching IPython in classic mode. No config file read.'
425 print 'Launching IPython in classic mode. No config file read.'
426 elif opts_all.rcfile:
426 elif opts_all.rcfile:
427 try:
427 try:
428 cfg_loader = ConfigLoader(conflict)
428 cfg_loader = ConfigLoader(conflict)
429 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
429 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
430 'include',opts_all.ipythondir,
430 'include',opts_all.ipythondir,
431 purge = 1,
431 purge = 1,
432 unique = conflict['preserve'])
432 unique = conflict['preserve'])
433 except:
433 except:
434 IP.InteractiveTB()
434 IP.InteractiveTB()
435 warn('Problems loading configuration file '+
435 warn('Problems loading configuration file '+
436 `opts_all.rcfile`+
436 `opts_all.rcfile`+
437 '\nStarting with default -bare bones- configuration.')
437 '\nStarting with default -bare bones- configuration.')
438 else:
438 else:
439 warn('No valid configuration file found in either currrent directory\n'+
439 warn('No valid configuration file found in either currrent directory\n'+
440 'or in the IPython config. directory: '+`opts_all.ipythondir`+
440 'or in the IPython config. directory: '+`opts_all.ipythondir`+
441 '\nProceeding with internal defaults.')
441 '\nProceeding with internal defaults.')
442
442
443 #------------------------------------------------------------------------
443 #------------------------------------------------------------------------
444 # Set exception handlers in mode requested by user.
444 # Set exception handlers in mode requested by user.
445 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
445 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
446 IP.magic_xmode(opts_all.xmode)
446 IP.magic_xmode(opts_all.xmode)
447 otrap.release_out()
447 otrap.release_out()
448
448
449 #------------------------------------------------------------------------
449 #------------------------------------------------------------------------
450 # Execute user config
450 # Execute user config
451
451
452 # Create a valid config structure with the right precedence order:
452 # Create a valid config structure with the right precedence order:
453 # defaults < rcfile < command line. This needs to be in the instance, so
453 # defaults < rcfile < command line. This needs to be in the instance, so
454 # that method calls below that rely on it find it.
454 # that method calls below that rely on it find it.
455 IP.rc = rc_def.copy()
455 IP.rc = rc_def.copy()
456
456
457 # Work with a local alias inside this routine to avoid unnecessary
457 # Work with a local alias inside this routine to avoid unnecessary
458 # attribute lookups.
458 # attribute lookups.
459 IP_rc = IP.rc
459 IP_rc = IP.rc
460
460
461 IP_rc.update(opts_def)
461 IP_rc.update(opts_def)
462 if rcfiledata:
462 if rcfiledata:
463 # now we can update
463 # now we can update
464 IP_rc.update(rcfiledata)
464 IP_rc.update(rcfiledata)
465 IP_rc.update(opts)
465 IP_rc.update(opts)
466 IP_rc.update(rc_override)
466 IP_rc.update(rc_override)
467
467
468 # Store the original cmd line for reference:
468 # Store the original cmd line for reference:
469 IP_rc.opts = opts
469 IP_rc.opts = opts
470 IP_rc.args = args
470 IP_rc.args = args
471
471
472 # create a *runtime* Struct like rc for holding parameters which may be
472 # create a *runtime* Struct like rc for holding parameters which may be
473 # created and/or modified by runtime user extensions.
473 # created and/or modified by runtime user extensions.
474 IP.runtime_rc = Struct()
474 IP.runtime_rc = Struct()
475
475
476 # from this point on, all config should be handled through IP_rc,
476 # from this point on, all config should be handled through IP_rc,
477 # opts* shouldn't be used anymore.
477 # opts* shouldn't be used anymore.
478
478
479 # add personal .ipython dir to sys.path so that users can put things in
479 # add personal .ipython dir to sys.path so that users can put things in
480 # there for customization
480 # there for customization
481 sys.path.append(IP_rc.ipythondir)
481 sys.path.append(IP_rc.ipythondir)
482
482
483 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
483 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
484
484
485 # update IP_rc with some special things that need manual
485 # update IP_rc with some special things that need manual
486 # tweaks. Basically options which affect other options. I guess this
486 # tweaks. Basically options which affect other options. I guess this
487 # should just be written so that options are fully orthogonal and we
487 # should just be written so that options are fully orthogonal and we
488 # wouldn't worry about this stuff!
488 # wouldn't worry about this stuff!
489
489
490 if IP_rc.classic:
490 if IP_rc.classic:
491 IP_rc.quick = 1
491 IP_rc.quick = 1
492 IP_rc.cache_size = 0
492 IP_rc.cache_size = 0
493 IP_rc.pprint = 0
493 IP_rc.pprint = 0
494 IP_rc.prompt_in1 = '>>> '
494 IP_rc.prompt_in1 = '>>> '
495 IP_rc.prompt_in2 = '... '
495 IP_rc.prompt_in2 = '... '
496 IP_rc.prompt_out = ''
496 IP_rc.prompt_out = ''
497 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
497 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
498 IP_rc.colors = 'NoColor'
498 IP_rc.colors = 'NoColor'
499 IP_rc.xmode = 'Plain'
499 IP_rc.xmode = 'Plain'
500
500
501 # configure readline
501 # configure readline
502 # Define the history file for saving commands in between sessions
502 # Define the history file for saving commands in between sessions
503 if IP_rc.profile:
503 if IP_rc.profile:
504 histfname = 'history-%s' % IP_rc.profile
504 histfname = 'history-%s' % IP_rc.profile
505 else:
505 else:
506 histfname = 'history'
506 histfname = 'history'
507 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
507 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
508
508
509 # update exception handlers with rc file status
509 # update exception handlers with rc file status
510 otrap.trap_out() # I don't want these messages ever.
510 otrap.trap_out() # I don't want these messages ever.
511 IP.magic_xmode(IP_rc.xmode)
511 IP.magic_xmode(IP_rc.xmode)
512 otrap.release_out()
512 otrap.release_out()
513
513
514 # activate logging if requested and not reloading a log
514 # activate logging if requested and not reloading a log
515 if IP_rc.logplay:
515 if IP_rc.logplay:
516 IP.magic_logstart(IP_rc.logplay + ' append')
516 IP.magic_logstart(IP_rc.logplay + ' append')
517 elif IP_rc.logfile:
517 elif IP_rc.logfile:
518 IP.magic_logstart(IP_rc.logfile)
518 IP.magic_logstart(IP_rc.logfile)
519 elif IP_rc.log:
519 elif IP_rc.log:
520 IP.magic_logstart()
520 IP.magic_logstart()
521
521
522 # find user editor so that it we don't have to look it up constantly
522 # find user editor so that it we don't have to look it up constantly
523 if IP_rc.editor.strip()=='0':
523 if IP_rc.editor.strip()=='0':
524 try:
524 try:
525 ed = os.environ['EDITOR']
525 ed = os.environ['EDITOR']
526 except KeyError:
526 except KeyError:
527 if os.name == 'posix':
527 if os.name == 'posix':
528 ed = 'vi' # the only one guaranteed to be there!
528 ed = 'vi' # the only one guaranteed to be there!
529 else:
529 else:
530 ed = 'notepad' # same in Windows!
530 ed = 'notepad' # same in Windows!
531 IP_rc.editor = ed
531 IP_rc.editor = ed
532
532
533 # Keep track of whether this is an embedded instance or not (useful for
533 # Keep track of whether this is an embedded instance or not (useful for
534 # post-mortems).
534 # post-mortems).
535 IP_rc.embedded = IP.embedded
535 IP_rc.embedded = IP.embedded
536
536
537 # Recursive reload
537 # Recursive reload
538 try:
538 try:
539 from IPython import deep_reload
539 from IPython import deep_reload
540 if IP_rc.deep_reload:
540 if IP_rc.deep_reload:
541 __builtin__.reload = deep_reload.reload
541 __builtin__.reload = deep_reload.reload
542 else:
542 else:
543 __builtin__.dreload = deep_reload.reload
543 __builtin__.dreload = deep_reload.reload
544 del deep_reload
544 del deep_reload
545 except ImportError:
545 except ImportError:
546 pass
546 pass
547
547
548 # Save the current state of our namespace so that the interactive shell
548 # Save the current state of our namespace so that the interactive shell
549 # can later know which variables have been created by us from config files
549 # can later know which variables have been created by us from config files
550 # and loading. This way, loading a file (in any way) is treated just like
550 # and loading. This way, loading a file (in any way) is treated just like
551 # defining things on the command line, and %who works as expected.
551 # defining things on the command line, and %who works as expected.
552
552
553 # DON'T do anything that affects the namespace beyond this point!
553 # DON'T do anything that affects the namespace beyond this point!
554 IP.internal_ns.update(__main__.__dict__)
554 IP.internal_ns.update(__main__.__dict__)
555
555
556 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
556 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
557
557
558 # Now run through the different sections of the users's config
558 # Now run through the different sections of the users's config
559 if IP_rc.debug:
559 if IP_rc.debug:
560 print 'Trying to execute the following configuration structure:'
560 print 'Trying to execute the following configuration structure:'
561 print '(Things listed first are deeper in the inclusion tree and get'
561 print '(Things listed first are deeper in the inclusion tree and get'
562 print 'loaded first).\n'
562 print 'loaded first).\n'
563 pprint(IP_rc.__dict__)
563 pprint(IP_rc.__dict__)
564
564
565 # Make it easy to import extensions
566 sys.path.append(os.path.join(IPython_dir,"Extensions"))
567 for mod in IP_rc.import_mod:
565 for mod in IP_rc.import_mod:
568 try:
566 try:
569 exec 'import '+mod in IP.user_ns
567 exec 'import '+mod in IP.user_ns
570 except :
568 except :
571 IP.InteractiveTB()
569 IP.InteractiveTB()
572 import_fail_info(mod)
570 import_fail_info(mod)
573
571
574 for mod_fn in IP_rc.import_some:
572 for mod_fn in IP_rc.import_some:
575 if mod_fn == []: break
573 if mod_fn == []: break
576 mod,fn = mod_fn[0],','.join(mod_fn[1:])
574 mod,fn = mod_fn[0],','.join(mod_fn[1:])
577 try:
575 try:
578 exec 'from '+mod+' import '+fn in IP.user_ns
576 exec 'from '+mod+' import '+fn in IP.user_ns
579 except :
577 except :
580 IP.InteractiveTB()
578 IP.InteractiveTB()
581 import_fail_info(mod,fn)
579 import_fail_info(mod,fn)
582
580
583 for mod in IP_rc.import_all:
581 for mod in IP_rc.import_all:
584 try:
582 try:
585 exec 'from '+mod+' import *' in IP.user_ns
583 exec 'from '+mod+' import *' in IP.user_ns
586 except :
584 except :
587 IP.InteractiveTB()
585 IP.InteractiveTB()
588 import_fail_info(mod)
586 import_fail_info(mod)
589
587
590 for code in IP_rc.execute:
588 for code in IP_rc.execute:
591 try:
589 try:
592 exec code in IP.user_ns
590 exec code in IP.user_ns
593 except:
591 except:
594 IP.InteractiveTB()
592 IP.InteractiveTB()
595 warn('Failure executing code: ' + `code`)
593 warn('Failure executing code: ' + `code`)
596
594
597 # Execute the files the user wants in ipythonrc
595 # Execute the files the user wants in ipythonrc
598 for file in IP_rc.execfile:
596 for file in IP_rc.execfile:
599 try:
597 try:
600 file = filefind(file,sys.path+[IPython_dir])
598 file = filefind(file,sys.path+[IPython_dir])
601 except IOError:
599 except IOError:
602 warn(itpl('File $file not found. Skipping it.'))
600 warn(itpl('File $file not found. Skipping it.'))
603 else:
601 else:
604 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
602 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
605
603
606 # finally, try importing ipy_*_conf for final configuration
604 # finally, try importing ipy_*_conf for final configuration
607 try:
605 try:
608 import ipy_system_conf
606 import ipy_system_conf
609 except ImportError:
607 except ImportError:
610 warn("Could not import 'ipy_system_conf'")
608 warn("Could not import 'ipy_system_conf'")
611 pass
609 pass
612 if opts_all.profile:
610 if opts_all.profile:
613 profmodname = 'ipy_profile_' + opts_all.profile
611 profmodname = 'ipy_profile_' + opts_all.profile
614 try:
612 try:
615 __import__(profmodname)
613 __import__(profmodname)
616 except ImportError:
614 except ImportError:
617 warn("Could not import '%s'" % profmodname)
615 warn("Could not import '%s'" % profmodname)
618 try:
616 try:
619 import ipy_user_conf
617 import ipy_user_conf
620 except ImportError:
618 except ImportError:
621 warn('Could not import ipy_user_conf')
619 warn('Could not import ipy_user_conf')
622
620
623 # release stdout and stderr and save config log into a global summary
621 # release stdout and stderr and save config log into a global summary
624 msg.config.release_all()
622 msg.config.release_all()
625 if IP_rc.messages:
623 if IP_rc.messages:
626 msg.summary += msg.config.summary_all()
624 msg.summary += msg.config.summary_all()
627
625
628 #------------------------------------------------------------------------
626 #------------------------------------------------------------------------
629 # Setup interactive session
627 # Setup interactive session
630
628
631 # Now we should be fully configured. We can then execute files or load
629 # Now we should be fully configured. We can then execute files or load
632 # things only needed for interactive use. Then we'll open the shell.
630 # things only needed for interactive use. Then we'll open the shell.
633
631
634 # Take a snapshot of the user namespace before opening the shell. That way
632 # Take a snapshot of the user namespace before opening the shell. That way
635 # we'll be able to identify which things were interactively defined and
633 # we'll be able to identify which things were interactively defined and
636 # which were defined through config files.
634 # which were defined through config files.
637 IP.user_config_ns = IP.user_ns.copy()
635 IP.user_config_ns = IP.user_ns.copy()
638
636
639 # Force reading a file as if it were a session log. Slower but safer.
637 # Force reading a file as if it were a session log. Slower but safer.
640 if load_logplay:
638 if load_logplay:
641 print 'Replaying log...'
639 print 'Replaying log...'
642 try:
640 try:
643 if IP_rc.debug:
641 if IP_rc.debug:
644 logplay_quiet = 0
642 logplay_quiet = 0
645 else:
643 else:
646 logplay_quiet = 1
644 logplay_quiet = 1
647
645
648 msg.logplay.trap_all()
646 msg.logplay.trap_all()
649 IP.safe_execfile(load_logplay,IP.user_ns,
647 IP.safe_execfile(load_logplay,IP.user_ns,
650 islog = 1, quiet = logplay_quiet)
648 islog = 1, quiet = logplay_quiet)
651 msg.logplay.release_all()
649 msg.logplay.release_all()
652 if IP_rc.messages:
650 if IP_rc.messages:
653 msg.summary += msg.logplay.summary_all()
651 msg.summary += msg.logplay.summary_all()
654 except:
652 except:
655 warn('Problems replaying logfile %s.' % load_logplay)
653 warn('Problems replaying logfile %s.' % load_logplay)
656 IP.InteractiveTB()
654 IP.InteractiveTB()
657
655
658 # Load remaining files in command line
656 # Load remaining files in command line
659 msg.user_exec.trap_all()
657 msg.user_exec.trap_all()
660
658
661 # Do NOT execute files named in the command line as scripts to be loaded
659 # Do NOT execute files named in the command line as scripts to be loaded
662 # by embedded instances. Doing so has the potential for an infinite
660 # by embedded instances. Doing so has the potential for an infinite
663 # recursion if there are exceptions thrown in the process.
661 # recursion if there are exceptions thrown in the process.
664
662
665 # XXX FIXME: the execution of user files should be moved out to after
663 # XXX FIXME: the execution of user files should be moved out to after
666 # ipython is fully initialized, just as if they were run via %run at the
664 # ipython is fully initialized, just as if they were run via %run at the
667 # ipython prompt. This would also give them the benefit of ipython's
665 # ipython prompt. This would also give them the benefit of ipython's
668 # nice tracebacks.
666 # nice tracebacks.
669
667
670 if not embedded and IP_rc.args:
668 if not embedded and IP_rc.args:
671 name_save = IP.user_ns['__name__']
669 name_save = IP.user_ns['__name__']
672 IP.user_ns['__name__'] = '__main__'
670 IP.user_ns['__name__'] = '__main__'
673 # Set our own excepthook in case the user code tries to call it
671 # Set our own excepthook in case the user code tries to call it
674 # directly. This prevents triggering the IPython crash handler.
672 # directly. This prevents triggering the IPython crash handler.
675 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
673 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
676
674
677 save_argv = sys.argv[:] # save it for later restoring
675 save_argv = sys.argv[:] # save it for later restoring
678
676
679 sys.argv = args
677 sys.argv = args
680
678
681 try:
679 try:
682 IP.safe_execfile(args[0], IP.user_ns)
680 IP.safe_execfile(args[0], IP.user_ns)
683 finally:
681 finally:
684 # Reset our crash handler in place
682 # Reset our crash handler in place
685 sys.excepthook = old_excepthook
683 sys.excepthook = old_excepthook
686 sys.argv = save_argv
684 sys.argv = save_argv
687 IP.user_ns['__name__'] = name_save
685 IP.user_ns['__name__'] = name_save
688
686
689 msg.user_exec.release_all()
687 msg.user_exec.release_all()
690 if IP_rc.messages:
688 if IP_rc.messages:
691 msg.summary += msg.user_exec.summary_all()
689 msg.summary += msg.user_exec.summary_all()
692
690
693 # since we can't specify a null string on the cmd line, 0 is the equivalent:
691 # since we can't specify a null string on the cmd line, 0 is the equivalent:
694 if IP_rc.nosep:
692 if IP_rc.nosep:
695 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
693 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
696 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
694 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
697 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
695 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
698 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
696 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
699 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
697 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
700 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
698 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
701 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
699 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
702
700
703 # Determine how many lines at the bottom of the screen are needed for
701 # Determine how many lines at the bottom of the screen are needed for
704 # showing prompts, so we can know wheter long strings are to be printed or
702 # showing prompts, so we can know wheter long strings are to be printed or
705 # paged:
703 # paged:
706 num_lines_bot = IP_rc.separate_in.count('\n')+1
704 num_lines_bot = IP_rc.separate_in.count('\n')+1
707 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
705 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
708
706
709 # configure startup banner
707 # configure startup banner
710 if IP_rc.c: # regular python doesn't print the banner with -c
708 if IP_rc.c: # regular python doesn't print the banner with -c
711 IP_rc.banner = 0
709 IP_rc.banner = 0
712 if IP_rc.banner:
710 if IP_rc.banner:
713 BANN_P = IP.BANNER_PARTS
711 BANN_P = IP.BANNER_PARTS
714 else:
712 else:
715 BANN_P = []
713 BANN_P = []
716
714
717 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
715 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
718
716
719 # add message log (possibly empty)
717 # add message log (possibly empty)
720 if msg.summary: BANN_P.append(msg.summary)
718 if msg.summary: BANN_P.append(msg.summary)
721 # Final banner is a string
719 # Final banner is a string
722 IP.BANNER = '\n'.join(BANN_P)
720 IP.BANNER = '\n'.join(BANN_P)
723
721
724 # Finalize the IPython instance. This assumes the rc structure is fully
722 # Finalize the IPython instance. This assumes the rc structure is fully
725 # in place.
723 # in place.
726 IP.post_config_initialization()
724 IP.post_config_initialization()
727
725
728 return IP
726 return IP
729 #************************ end of file <ipmaker.py> **************************
727 #************************ end of file <ipmaker.py> **************************
@@ -1,5145 +1,5148 b''
1 2006-01-30 Ville Vainio <vivainio@gmail.com>
1 2006-01-30 Ville Vainio <vivainio@gmail.com>
2
2
3 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
3 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
4 Now %store and bookmarks work through PickleShare, meaning that
4 Now %store and bookmarks work through PickleShare, meaning that
5 concurrent access is possible and all ipython sessions see the
5 concurrent access is possible and all ipython sessions see the
6 same database situation all the time, instead of snapshot of
6 same database situation all the time, instead of snapshot of
7 the situation when the session was started. Hence, %bookmark
7 the situation when the session was started. Hence, %bookmark
8 results are immediately accessible from othes sessions. The database
8 results are immediately accessible from othes sessions. The database
9 is also available for use by user extensions. See:
9 is also available for use by user extensions. See:
10 http://www.python.org/pypi/pickleshare
10 http://www.python.org/pypi/pickleshare
11
11
12 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
12 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
13
13
14 * aliases can now be %store'd
14 * aliases can now be %store'd
15
15
16 * path.py move to Extensions so that pickleshare does not need
16 * path.py move to Extensions so that pickleshare does not need
17 IPython-specific import. Extensions added to pythonpath right
17 IPython-specific import. Extensions added to pythonpath right
18 at __init__.
18 at __init__.
19
19
20 * iplib.py: ipalias deprecated/redundant; aliases are converted and
21 called with _ip.system and the pre-transformed command string.
22
20 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
23 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
21
24
22 * IPython/iplib.py (interact): Fix that we were not catching
25 * IPython/iplib.py (interact): Fix that we were not catching
23 KeyboardInterrupt exceptions properly. I'm not quite sure why the
26 KeyboardInterrupt exceptions properly. I'm not quite sure why the
24 logic here had to change, but it's fixed now.
27 logic here had to change, but it's fixed now.
25
28
26 2006-01-29 Ville Vainio <vivainio@gmail.com>
29 2006-01-29 Ville Vainio <vivainio@gmail.com>
27
30
28 * iplib.py: Try to import pyreadline on Windows.
31 * iplib.py: Try to import pyreadline on Windows.
29
32
30 2006-01-27 Ville Vainio <vivainio@gmail.com>
33 2006-01-27 Ville Vainio <vivainio@gmail.com>
31
34
32 * iplib.py: Expose ipapi as _ip in builtin namespace.
35 * iplib.py: Expose ipapi as _ip in builtin namespace.
33 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
36 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
34 and ip_set_hook (-> _ip.set_hook) redundant. % and !
37 and ip_set_hook (-> _ip.set_hook) redundant. % and !
35 syntax now produce _ip.* variant of the commands.
38 syntax now produce _ip.* variant of the commands.
36
39
37 * "_ip.options().autoedit_syntax = 2" automatically throws
40 * "_ip.options().autoedit_syntax = 2" automatically throws
38 user to editor for syntax error correction without prompting.
41 user to editor for syntax error correction without prompting.
39
42
40 2006-01-27 Ville Vainio <vivainio@gmail.com>
43 2006-01-27 Ville Vainio <vivainio@gmail.com>
41
44
42 * ipmaker.py: Give "realistic" sys.argv for scripts (without
45 * ipmaker.py: Give "realistic" sys.argv for scripts (without
43 'ipython' at argv[0]) executed through command line.
46 'ipython' at argv[0]) executed through command line.
44 NOTE: this DEPRECATES calling ipython with multiple scripts
47 NOTE: this DEPRECATES calling ipython with multiple scripts
45 ("ipython a.py b.py c.py")
48 ("ipython a.py b.py c.py")
46
49
47 * iplib.py, hooks.py: Added configurable input prefilter,
50 * iplib.py, hooks.py: Added configurable input prefilter,
48 named 'input_prefilter'. See ext_rescapture.py for example
51 named 'input_prefilter'. See ext_rescapture.py for example
49 usage.
52 usage.
50
53
51 * ext_rescapture.py, Magic.py: Better system command output capture
54 * ext_rescapture.py, Magic.py: Better system command output capture
52 through 'var = !ls' (deprecates user-visible %sc). Same notation
55 through 'var = !ls' (deprecates user-visible %sc). Same notation
53 applies for magics, 'var = %alias' assigns alias list to var.
56 applies for magics, 'var = %alias' assigns alias list to var.
54
57
55 * ipapi.py: added meta() for accessing extension-usable data store.
58 * ipapi.py: added meta() for accessing extension-usable data store.
56
59
57 * iplib.py: added InteractiveShell.getapi(). New magics should be
60 * iplib.py: added InteractiveShell.getapi(). New magics should be
58 written doing self.getapi() instead of using the shell directly.
61 written doing self.getapi() instead of using the shell directly.
59
62
60 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
63 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
61 %store foo >> ~/myfoo.txt to store variables to files (in clean
64 %store foo >> ~/myfoo.txt to store variables to files (in clean
62 textual form, not a restorable pickle).
65 textual form, not a restorable pickle).
63
66
64 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
67 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
65
68
66 * usage.py, Magic.py: added %quickref
69 * usage.py, Magic.py: added %quickref
67
70
68 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
71 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
69
72
70 * GetoptErrors when invoking magics etc. with wrong args
73 * GetoptErrors when invoking magics etc. with wrong args
71 are now more helpful:
74 are now more helpful:
72 GetoptError: option -l not recognized (allowed: "qb" )
75 GetoptError: option -l not recognized (allowed: "qb" )
73
76
74 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
77 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
75
78
76 * IPython/demo.py (Demo.show): Flush stdout after each block, so
79 * IPython/demo.py (Demo.show): Flush stdout after each block, so
77 computationally intensive blocks don't appear to stall the demo.
80 computationally intensive blocks don't appear to stall the demo.
78
81
79 2006-01-24 Ville Vainio <vivainio@gmail.com>
82 2006-01-24 Ville Vainio <vivainio@gmail.com>
80
83
81 * iplib.py, hooks.py: 'result_display' hook can return a non-None
84 * iplib.py, hooks.py: 'result_display' hook can return a non-None
82 value to manipulate resulting history entry.
85 value to manipulate resulting history entry.
83
86
84 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
87 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
85 to instance methods of IPApi class, to make extending an embedded
88 to instance methods of IPApi class, to make extending an embedded
86 IPython feasible. See ext_rehashdir.py for example usage.
89 IPython feasible. See ext_rehashdir.py for example usage.
87
90
88 * Merged 1071-1076 from banches/0.7.1
91 * Merged 1071-1076 from banches/0.7.1
89
92
90
93
91 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
94 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
92
95
93 * tools/release (daystamp): Fix build tools to use the new
96 * tools/release (daystamp): Fix build tools to use the new
94 eggsetup.py script to build lightweight eggs.
97 eggsetup.py script to build lightweight eggs.
95
98
96 * Applied changesets 1062 and 1064 before 0.7.1 release.
99 * Applied changesets 1062 and 1064 before 0.7.1 release.
97
100
98 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
101 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
99 see the raw input history (without conversions like %ls ->
102 see the raw input history (without conversions like %ls ->
100 ipmagic("ls")). After a request from W. Stein, SAGE
103 ipmagic("ls")). After a request from W. Stein, SAGE
101 (http://modular.ucsd.edu/sage) developer. This information is
104 (http://modular.ucsd.edu/sage) developer. This information is
102 stored in the input_hist_raw attribute of the IPython instance, so
105 stored in the input_hist_raw attribute of the IPython instance, so
103 developers can access it if needed (it's an InputList instance).
106 developers can access it if needed (it's an InputList instance).
104
107
105 * Versionstring = 0.7.2.svn
108 * Versionstring = 0.7.2.svn
106
109
107 * eggsetup.py: A separate script for constructing eggs, creates
110 * eggsetup.py: A separate script for constructing eggs, creates
108 proper launch scripts even on Windows (an .exe file in
111 proper launch scripts even on Windows (an .exe file in
109 \python24\scripts).
112 \python24\scripts).
110
113
111 * ipapi.py: launch_new_instance, launch entry point needed for the
114 * ipapi.py: launch_new_instance, launch entry point needed for the
112 egg.
115 egg.
113
116
114 2006-01-23 Ville Vainio <vivainio@gmail.com>
117 2006-01-23 Ville Vainio <vivainio@gmail.com>
115
118
116 * Added %cpaste magic for pasting python code
119 * Added %cpaste magic for pasting python code
117
120
118 2006-01-22 Ville Vainio <vivainio@gmail.com>
121 2006-01-22 Ville Vainio <vivainio@gmail.com>
119
122
120 * Merge from branches/0.7.1 into trunk, revs 1052-1057
123 * Merge from branches/0.7.1 into trunk, revs 1052-1057
121
124
122 * Versionstring = 0.7.2.svn
125 * Versionstring = 0.7.2.svn
123
126
124 * eggsetup.py: A separate script for constructing eggs, creates
127 * eggsetup.py: A separate script for constructing eggs, creates
125 proper launch scripts even on Windows (an .exe file in
128 proper launch scripts even on Windows (an .exe file in
126 \python24\scripts).
129 \python24\scripts).
127
130
128 * ipapi.py: launch_new_instance, launch entry point needed for the
131 * ipapi.py: launch_new_instance, launch entry point needed for the
129 egg.
132 egg.
130
133
131 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
134 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
132
135
133 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
136 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
134 %pfile foo would print the file for foo even if it was a binary.
137 %pfile foo would print the file for foo even if it was a binary.
135 Now, extensions '.so' and '.dll' are skipped.
138 Now, extensions '.so' and '.dll' are skipped.
136
139
137 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
140 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
138 bug, where macros would fail in all threaded modes. I'm not 100%
141 bug, where macros would fail in all threaded modes. I'm not 100%
139 sure, so I'm going to put out an rc instead of making a release
142 sure, so I'm going to put out an rc instead of making a release
140 today, and wait for feedback for at least a few days.
143 today, and wait for feedback for at least a few days.
141
144
142 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
145 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
143 it...) the handling of pasting external code with autoindent on.
146 it...) the handling of pasting external code with autoindent on.
144 To get out of a multiline input, the rule will appear for most
147 To get out of a multiline input, the rule will appear for most
145 users unchanged: two blank lines or change the indent level
148 users unchanged: two blank lines or change the indent level
146 proposed by IPython. But there is a twist now: you can
149 proposed by IPython. But there is a twist now: you can
147 add/subtract only *one or two spaces*. If you add/subtract three
150 add/subtract only *one or two spaces*. If you add/subtract three
148 or more (unless you completely delete the line), IPython will
151 or more (unless you completely delete the line), IPython will
149 accept that line, and you'll need to enter a second one of pure
152 accept that line, and you'll need to enter a second one of pure
150 whitespace. I know it sounds complicated, but I can't find a
153 whitespace. I know it sounds complicated, but I can't find a
151 different solution that covers all the cases, with the right
154 different solution that covers all the cases, with the right
152 heuristics. Hopefully in actual use, nobody will really notice
155 heuristics. Hopefully in actual use, nobody will really notice
153 all these strange rules and things will 'just work'.
156 all these strange rules and things will 'just work'.
154
157
155 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
158 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
156
159
157 * IPython/iplib.py (interact): catch exceptions which can be
160 * IPython/iplib.py (interact): catch exceptions which can be
158 triggered asynchronously by signal handlers. Thanks to an
161 triggered asynchronously by signal handlers. Thanks to an
159 automatic crash report, submitted by Colin Kingsley
162 automatic crash report, submitted by Colin Kingsley
160 <tercel-AT-gentoo.org>.
163 <tercel-AT-gentoo.org>.
161
164
162 2006-01-20 Ville Vainio <vivainio@gmail.com>
165 2006-01-20 Ville Vainio <vivainio@gmail.com>
163
166
164 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
167 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
165 (%rehashdir, very useful, try it out) of how to extend ipython
168 (%rehashdir, very useful, try it out) of how to extend ipython
166 with new magics. Also added Extensions dir to pythonpath to make
169 with new magics. Also added Extensions dir to pythonpath to make
167 importing extensions easy.
170 importing extensions easy.
168
171
169 * %store now complains when trying to store interactively declared
172 * %store now complains when trying to store interactively declared
170 classes / instances of those classes.
173 classes / instances of those classes.
171
174
172 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
175 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
173 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
176 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
174 if they exist, and ipy_user_conf.py with some defaults is created for
177 if they exist, and ipy_user_conf.py with some defaults is created for
175 the user.
178 the user.
176
179
177 * Startup rehashing done by the config file, not InterpreterExec.
180 * Startup rehashing done by the config file, not InterpreterExec.
178 This means system commands are available even without selecting the
181 This means system commands are available even without selecting the
179 pysh profile. It's the sensible default after all.
182 pysh profile. It's the sensible default after all.
180
183
181 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
184 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
182
185
183 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
186 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
184 multiline code with autoindent on working. But I am really not
187 multiline code with autoindent on working. But I am really not
185 sure, so this needs more testing. Will commit a debug-enabled
188 sure, so this needs more testing. Will commit a debug-enabled
186 version for now, while I test it some more, so that Ville and
189 version for now, while I test it some more, so that Ville and
187 others may also catch any problems. Also made
190 others may also catch any problems. Also made
188 self.indent_current_str() a method, to ensure that there's no
191 self.indent_current_str() a method, to ensure that there's no
189 chance of the indent space count and the corresponding string
192 chance of the indent space count and the corresponding string
190 falling out of sync. All code needing the string should just call
193 falling out of sync. All code needing the string should just call
191 the method.
194 the method.
192
195
193 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
196 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
194
197
195 * IPython/Magic.py (magic_edit): fix check for when users don't
198 * IPython/Magic.py (magic_edit): fix check for when users don't
196 save their output files, the try/except was in the wrong section.
199 save their output files, the try/except was in the wrong section.
197
200
198 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
201 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
199
202
200 * IPython/Magic.py (magic_run): fix __file__ global missing from
203 * IPython/Magic.py (magic_run): fix __file__ global missing from
201 script's namespace when executed via %run. After a report by
204 script's namespace when executed via %run. After a report by
202 Vivian.
205 Vivian.
203
206
204 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
207 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
205 when using python 2.4. The parent constructor changed in 2.4, and
208 when using python 2.4. The parent constructor changed in 2.4, and
206 we need to track it directly (we can't call it, as it messes up
209 we need to track it directly (we can't call it, as it messes up
207 readline and tab-completion inside our pdb would stop working).
210 readline and tab-completion inside our pdb would stop working).
208 After a bug report by R. Bernstein <rocky-AT-panix.com>.
211 After a bug report by R. Bernstein <rocky-AT-panix.com>.
209
212
210 2006-01-16 Ville Vainio <vivainio@gmail.com>
213 2006-01-16 Ville Vainio <vivainio@gmail.com>
211
214
212 * Ipython/magic.py:Reverted back to old %edit functionality
215 * Ipython/magic.py:Reverted back to old %edit functionality
213 that returns file contents on exit.
216 that returns file contents on exit.
214
217
215 * IPython/path.py: Added Jason Orendorff's "path" module to
218 * IPython/path.py: Added Jason Orendorff's "path" module to
216 IPython tree, http://www.jorendorff.com/articles/python/path/.
219 IPython tree, http://www.jorendorff.com/articles/python/path/.
217 You can get path objects conveniently through %sc, and !!, e.g.:
220 You can get path objects conveniently through %sc, and !!, e.g.:
218 sc files=ls
221 sc files=ls
219 for p in files.paths: # or files.p
222 for p in files.paths: # or files.p
220 print p,p.mtime
223 print p,p.mtime
221
224
222 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
225 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
223 now work again without considering the exclusion regexp -
226 now work again without considering the exclusion regexp -
224 hence, things like ',foo my/path' turn to 'foo("my/path")'
227 hence, things like ',foo my/path' turn to 'foo("my/path")'
225 instead of syntax error.
228 instead of syntax error.
226
229
227
230
228 2006-01-14 Ville Vainio <vivainio@gmail.com>
231 2006-01-14 Ville Vainio <vivainio@gmail.com>
229
232
230 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
233 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
231 ipapi decorators for python 2.4 users, options() provides access to rc
234 ipapi decorators for python 2.4 users, options() provides access to rc
232 data.
235 data.
233
236
234 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
237 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
235 as path separators (even on Linux ;-). Space character after
238 as path separators (even on Linux ;-). Space character after
236 backslash (as yielded by tab completer) is still space;
239 backslash (as yielded by tab completer) is still space;
237 "%cd long\ name" works as expected.
240 "%cd long\ name" works as expected.
238
241
239 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
242 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
240 as "chain of command", with priority. API stays the same,
243 as "chain of command", with priority. API stays the same,
241 TryNext exception raised by a hook function signals that
244 TryNext exception raised by a hook function signals that
242 current hook failed and next hook should try handling it, as
245 current hook failed and next hook should try handling it, as
243 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
246 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
244 requested configurable display hook, which is now implemented.
247 requested configurable display hook, which is now implemented.
245
248
246 2006-01-13 Ville Vainio <vivainio@gmail.com>
249 2006-01-13 Ville Vainio <vivainio@gmail.com>
247
250
248 * IPython/platutils*.py: platform specific utility functions,
251 * IPython/platutils*.py: platform specific utility functions,
249 so far only set_term_title is implemented (change terminal
252 so far only set_term_title is implemented (change terminal
250 label in windowing systems). %cd now changes the title to
253 label in windowing systems). %cd now changes the title to
251 current dir.
254 current dir.
252
255
253 * IPython/Release.py: Added myself to "authors" list,
256 * IPython/Release.py: Added myself to "authors" list,
254 had to create new files.
257 had to create new files.
255
258
256 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
259 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
257 shell escape; not a known bug but had potential to be one in the
260 shell escape; not a known bug but had potential to be one in the
258 future.
261 future.
259
262
260 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
263 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
261 extension API for IPython! See the module for usage example. Fix
264 extension API for IPython! See the module for usage example. Fix
262 OInspect for docstring-less magic functions.
265 OInspect for docstring-less magic functions.
263
266
264
267
265 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
268 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
266
269
267 * IPython/iplib.py (raw_input): temporarily deactivate all
270 * IPython/iplib.py (raw_input): temporarily deactivate all
268 attempts at allowing pasting of code with autoindent on. It
271 attempts at allowing pasting of code with autoindent on. It
269 introduced bugs (reported by Prabhu) and I can't seem to find a
272 introduced bugs (reported by Prabhu) and I can't seem to find a
270 robust combination which works in all cases. Will have to revisit
273 robust combination which works in all cases. Will have to revisit
271 later.
274 later.
272
275
273 * IPython/genutils.py: remove isspace() function. We've dropped
276 * IPython/genutils.py: remove isspace() function. We've dropped
274 2.2 compatibility, so it's OK to use the string method.
277 2.2 compatibility, so it's OK to use the string method.
275
278
276 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
279 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
277
280
278 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
281 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
279 matching what NOT to autocall on, to include all python binary
282 matching what NOT to autocall on, to include all python binary
280 operators (including things like 'and', 'or', 'is' and 'in').
283 operators (including things like 'and', 'or', 'is' and 'in').
281 Prompted by a bug report on 'foo & bar', but I realized we had
284 Prompted by a bug report on 'foo & bar', but I realized we had
282 many more potential bug cases with other operators. The regexp is
285 many more potential bug cases with other operators. The regexp is
283 self.re_exclude_auto, it's fairly commented.
286 self.re_exclude_auto, it's fairly commented.
284
287
285 2006-01-12 Ville Vainio <vivainio@gmail.com>
288 2006-01-12 Ville Vainio <vivainio@gmail.com>
286
289
287 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
290 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
288 Prettified and hardened string/backslash quoting with ipsystem(),
291 Prettified and hardened string/backslash quoting with ipsystem(),
289 ipalias() and ipmagic(). Now even \ characters are passed to
292 ipalias() and ipmagic(). Now even \ characters are passed to
290 %magics, !shell escapes and aliases exactly as they are in the
293 %magics, !shell escapes and aliases exactly as they are in the
291 ipython command line. Should improve backslash experience,
294 ipython command line. Should improve backslash experience,
292 particularly in Windows (path delimiter for some commands that
295 particularly in Windows (path delimiter for some commands that
293 won't understand '/'), but Unix benefits as well (regexps). %cd
296 won't understand '/'), but Unix benefits as well (regexps). %cd
294 magic still doesn't support backslash path delimiters, though. Also
297 magic still doesn't support backslash path delimiters, though. Also
295 deleted all pretense of supporting multiline command strings in
298 deleted all pretense of supporting multiline command strings in
296 !system or %magic commands. Thanks to Jerry McRae for suggestions.
299 !system or %magic commands. Thanks to Jerry McRae for suggestions.
297
300
298 * doc/build_doc_instructions.txt added. Documentation on how to
301 * doc/build_doc_instructions.txt added. Documentation on how to
299 use doc/update_manual.py, added yesterday. Both files contributed
302 use doc/update_manual.py, added yesterday. Both files contributed
300 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
303 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
301 doc/*.sh for deprecation at a later date.
304 doc/*.sh for deprecation at a later date.
302
305
303 * /ipython.py Added ipython.py to root directory for
306 * /ipython.py Added ipython.py to root directory for
304 zero-installation (tar xzvf ipython.tgz; cd ipython; python
307 zero-installation (tar xzvf ipython.tgz; cd ipython; python
305 ipython.py) and development convenience (no need to kee doing
308 ipython.py) and development convenience (no need to kee doing
306 "setup.py install" between changes).
309 "setup.py install" between changes).
307
310
308 * Made ! and !! shell escapes work (again) in multiline expressions:
311 * Made ! and !! shell escapes work (again) in multiline expressions:
309 if 1:
312 if 1:
310 !ls
313 !ls
311 !!ls
314 !!ls
312
315
313 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
316 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
314
317
315 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
318 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
316 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
319 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
317 module in case-insensitive installation. Was causing crashes
320 module in case-insensitive installation. Was causing crashes
318 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
321 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
319
322
320 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
323 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
321 <marienz-AT-gentoo.org>, closes
324 <marienz-AT-gentoo.org>, closes
322 http://www.scipy.net/roundup/ipython/issue51.
325 http://www.scipy.net/roundup/ipython/issue51.
323
326
324 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
327 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
325
328
326 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
329 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
327 problem of excessive CPU usage under *nix and keyboard lag under
330 problem of excessive CPU usage under *nix and keyboard lag under
328 win32.
331 win32.
329
332
330 2006-01-10 *** Released version 0.7.0
333 2006-01-10 *** Released version 0.7.0
331
334
332 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
335 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
333
336
334 * IPython/Release.py (revision): tag version number to 0.7.0,
337 * IPython/Release.py (revision): tag version number to 0.7.0,
335 ready for release.
338 ready for release.
336
339
337 * IPython/Magic.py (magic_edit): Add print statement to %edit so
340 * IPython/Magic.py (magic_edit): Add print statement to %edit so
338 it informs the user of the name of the temp. file used. This can
341 it informs the user of the name of the temp. file used. This can
339 help if you decide later to reuse that same file, so you know
342 help if you decide later to reuse that same file, so you know
340 where to copy the info from.
343 where to copy the info from.
341
344
342 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
345 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
343
346
344 * setup_bdist_egg.py: little script to build an egg. Added
347 * setup_bdist_egg.py: little script to build an egg. Added
345 support in the release tools as well.
348 support in the release tools as well.
346
349
347 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
350 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
348
351
349 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
352 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
350 version selection (new -wxversion command line and ipythonrc
353 version selection (new -wxversion command line and ipythonrc
351 parameter). Patch contributed by Arnd Baecker
354 parameter). Patch contributed by Arnd Baecker
352 <arnd.baecker-AT-web.de>.
355 <arnd.baecker-AT-web.de>.
353
356
354 * IPython/iplib.py (embed_mainloop): fix tab-completion in
357 * IPython/iplib.py (embed_mainloop): fix tab-completion in
355 embedded instances, for variables defined at the interactive
358 embedded instances, for variables defined at the interactive
356 prompt of the embedded ipython. Reported by Arnd.
359 prompt of the embedded ipython. Reported by Arnd.
357
360
358 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
361 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
359 it can be used as a (stateful) toggle, or with a direct parameter.
362 it can be used as a (stateful) toggle, or with a direct parameter.
360
363
361 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
364 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
362 could be triggered in certain cases and cause the traceback
365 could be triggered in certain cases and cause the traceback
363 printer not to work.
366 printer not to work.
364
367
365 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
368 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
366
369
367 * IPython/iplib.py (_should_recompile): Small fix, closes
370 * IPython/iplib.py (_should_recompile): Small fix, closes
368 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
371 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
369
372
370 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
373 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
371
374
372 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
375 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
373 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
376 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
374 Moad for help with tracking it down.
377 Moad for help with tracking it down.
375
378
376 * IPython/iplib.py (handle_auto): fix autocall handling for
379 * IPython/iplib.py (handle_auto): fix autocall handling for
377 objects which support BOTH __getitem__ and __call__ (so that f [x]
380 objects which support BOTH __getitem__ and __call__ (so that f [x]
378 is left alone, instead of becoming f([x]) automatically).
381 is left alone, instead of becoming f([x]) automatically).
379
382
380 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
383 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
381 Ville's patch.
384 Ville's patch.
382
385
383 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
386 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
384
387
385 * IPython/iplib.py (handle_auto): changed autocall semantics to
388 * IPython/iplib.py (handle_auto): changed autocall semantics to
386 include 'smart' mode, where the autocall transformation is NOT
389 include 'smart' mode, where the autocall transformation is NOT
387 applied if there are no arguments on the line. This allows you to
390 applied if there are no arguments on the line. This allows you to
388 just type 'foo' if foo is a callable to see its internal form,
391 just type 'foo' if foo is a callable to see its internal form,
389 instead of having it called with no arguments (typically a
392 instead of having it called with no arguments (typically a
390 mistake). The old 'full' autocall still exists: for that, you
393 mistake). The old 'full' autocall still exists: for that, you
391 need to set the 'autocall' parameter to 2 in your ipythonrc file.
394 need to set the 'autocall' parameter to 2 in your ipythonrc file.
392
395
393 * IPython/completer.py (Completer.attr_matches): add
396 * IPython/completer.py (Completer.attr_matches): add
394 tab-completion support for Enthoughts' traits. After a report by
397 tab-completion support for Enthoughts' traits. After a report by
395 Arnd and a patch by Prabhu.
398 Arnd and a patch by Prabhu.
396
399
397 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
400 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
398
401
399 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
402 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
400 Schmolck's patch to fix inspect.getinnerframes().
403 Schmolck's patch to fix inspect.getinnerframes().
401
404
402 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
405 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
403 for embedded instances, regarding handling of namespaces and items
406 for embedded instances, regarding handling of namespaces and items
404 added to the __builtin__ one. Multiple embedded instances and
407 added to the __builtin__ one. Multiple embedded instances and
405 recursive embeddings should work better now (though I'm not sure
408 recursive embeddings should work better now (though I'm not sure
406 I've got all the corner cases fixed, that code is a bit of a brain
409 I've got all the corner cases fixed, that code is a bit of a brain
407 twister).
410 twister).
408
411
409 * IPython/Magic.py (magic_edit): added support to edit in-memory
412 * IPython/Magic.py (magic_edit): added support to edit in-memory
410 macros (automatically creates the necessary temp files). %edit
413 macros (automatically creates the necessary temp files). %edit
411 also doesn't return the file contents anymore, it's just noise.
414 also doesn't return the file contents anymore, it's just noise.
412
415
413 * IPython/completer.py (Completer.attr_matches): revert change to
416 * IPython/completer.py (Completer.attr_matches): revert change to
414 complete only on attributes listed in __all__. I realized it
417 complete only on attributes listed in __all__. I realized it
415 cripples the tab-completion system as a tool for exploring the
418 cripples the tab-completion system as a tool for exploring the
416 internals of unknown libraries (it renders any non-__all__
419 internals of unknown libraries (it renders any non-__all__
417 attribute off-limits). I got bit by this when trying to see
420 attribute off-limits). I got bit by this when trying to see
418 something inside the dis module.
421 something inside the dis module.
419
422
420 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
423 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
421
424
422 * IPython/iplib.py (InteractiveShell.__init__): add .meta
425 * IPython/iplib.py (InteractiveShell.__init__): add .meta
423 namespace for users and extension writers to hold data in. This
426 namespace for users and extension writers to hold data in. This
424 follows the discussion in
427 follows the discussion in
425 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
428 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
426
429
427 * IPython/completer.py (IPCompleter.complete): small patch to help
430 * IPython/completer.py (IPCompleter.complete): small patch to help
428 tab-completion under Emacs, after a suggestion by John Barnard
431 tab-completion under Emacs, after a suggestion by John Barnard
429 <barnarj-AT-ccf.org>.
432 <barnarj-AT-ccf.org>.
430
433
431 * IPython/Magic.py (Magic.extract_input_slices): added support for
434 * IPython/Magic.py (Magic.extract_input_slices): added support for
432 the slice notation in magics to use N-M to represent numbers N...M
435 the slice notation in magics to use N-M to represent numbers N...M
433 (closed endpoints). This is used by %macro and %save.
436 (closed endpoints). This is used by %macro and %save.
434
437
435 * IPython/completer.py (Completer.attr_matches): for modules which
438 * IPython/completer.py (Completer.attr_matches): for modules which
436 define __all__, complete only on those. After a patch by Jeffrey
439 define __all__, complete only on those. After a patch by Jeffrey
437 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
440 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
438 speed up this routine.
441 speed up this routine.
439
442
440 * IPython/Logger.py (Logger.log): fix a history handling bug. I
443 * IPython/Logger.py (Logger.log): fix a history handling bug. I
441 don't know if this is the end of it, but the behavior now is
444 don't know if this is the end of it, but the behavior now is
442 certainly much more correct. Note that coupled with macros,
445 certainly much more correct. Note that coupled with macros,
443 slightly surprising (at first) behavior may occur: a macro will in
446 slightly surprising (at first) behavior may occur: a macro will in
444 general expand to multiple lines of input, so upon exiting, the
447 general expand to multiple lines of input, so upon exiting, the
445 in/out counters will both be bumped by the corresponding amount
448 in/out counters will both be bumped by the corresponding amount
446 (as if the macro's contents had been typed interactively). Typing
449 (as if the macro's contents had been typed interactively). Typing
447 %hist will reveal the intermediate (silently processed) lines.
450 %hist will reveal the intermediate (silently processed) lines.
448
451
449 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
452 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
450 pickle to fail (%run was overwriting __main__ and not restoring
453 pickle to fail (%run was overwriting __main__ and not restoring
451 it, but pickle relies on __main__ to operate).
454 it, but pickle relies on __main__ to operate).
452
455
453 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
456 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
454 using properties, but forgot to make the main InteractiveShell
457 using properties, but forgot to make the main InteractiveShell
455 class a new-style class. Properties fail silently, and
458 class a new-style class. Properties fail silently, and
456 misteriously, with old-style class (getters work, but
459 misteriously, with old-style class (getters work, but
457 setters don't do anything).
460 setters don't do anything).
458
461
459 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
462 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
460
463
461 * IPython/Magic.py (magic_history): fix history reporting bug (I
464 * IPython/Magic.py (magic_history): fix history reporting bug (I
462 know some nasties are still there, I just can't seem to find a
465 know some nasties are still there, I just can't seem to find a
463 reproducible test case to track them down; the input history is
466 reproducible test case to track them down; the input history is
464 falling out of sync...)
467 falling out of sync...)
465
468
466 * IPython/iplib.py (handle_shell_escape): fix bug where both
469 * IPython/iplib.py (handle_shell_escape): fix bug where both
467 aliases and system accesses where broken for indented code (such
470 aliases and system accesses where broken for indented code (such
468 as loops).
471 as loops).
469
472
470 * IPython/genutils.py (shell): fix small but critical bug for
473 * IPython/genutils.py (shell): fix small but critical bug for
471 win32 system access.
474 win32 system access.
472
475
473 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
476 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
474
477
475 * IPython/iplib.py (showtraceback): remove use of the
478 * IPython/iplib.py (showtraceback): remove use of the
476 sys.last_{type/value/traceback} structures, which are non
479 sys.last_{type/value/traceback} structures, which are non
477 thread-safe.
480 thread-safe.
478 (_prefilter): change control flow to ensure that we NEVER
481 (_prefilter): change control flow to ensure that we NEVER
479 introspect objects when autocall is off. This will guarantee that
482 introspect objects when autocall is off. This will guarantee that
480 having an input line of the form 'x.y', where access to attribute
483 having an input line of the form 'x.y', where access to attribute
481 'y' has side effects, doesn't trigger the side effect TWICE. It
484 'y' has side effects, doesn't trigger the side effect TWICE. It
482 is important to note that, with autocall on, these side effects
485 is important to note that, with autocall on, these side effects
483 can still happen.
486 can still happen.
484 (ipsystem): new builtin, to complete the ip{magic/alias/system}
487 (ipsystem): new builtin, to complete the ip{magic/alias/system}
485 trio. IPython offers these three kinds of special calls which are
488 trio. IPython offers these three kinds of special calls which are
486 not python code, and it's a good thing to have their call method
489 not python code, and it's a good thing to have their call method
487 be accessible as pure python functions (not just special syntax at
490 be accessible as pure python functions (not just special syntax at
488 the command line). It gives us a better internal implementation
491 the command line). It gives us a better internal implementation
489 structure, as well as exposing these for user scripting more
492 structure, as well as exposing these for user scripting more
490 cleanly.
493 cleanly.
491
494
492 * IPython/macro.py (Macro.__init__): moved macros to a standalone
495 * IPython/macro.py (Macro.__init__): moved macros to a standalone
493 file. Now that they'll be more likely to be used with the
496 file. Now that they'll be more likely to be used with the
494 persistance system (%store), I want to make sure their module path
497 persistance system (%store), I want to make sure their module path
495 doesn't change in the future, so that we don't break things for
498 doesn't change in the future, so that we don't break things for
496 users' persisted data.
499 users' persisted data.
497
500
498 * IPython/iplib.py (autoindent_update): move indentation
501 * IPython/iplib.py (autoindent_update): move indentation
499 management into the _text_ processing loop, not the keyboard
502 management into the _text_ processing loop, not the keyboard
500 interactive one. This is necessary to correctly process non-typed
503 interactive one. This is necessary to correctly process non-typed
501 multiline input (such as macros).
504 multiline input (such as macros).
502
505
503 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
506 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
504 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
507 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
505 which was producing problems in the resulting manual.
508 which was producing problems in the resulting manual.
506 (magic_whos): improve reporting of instances (show their class,
509 (magic_whos): improve reporting of instances (show their class,
507 instead of simply printing 'instance' which isn't terribly
510 instead of simply printing 'instance' which isn't terribly
508 informative).
511 informative).
509
512
510 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
513 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
511 (minor mods) to support network shares under win32.
514 (minor mods) to support network shares under win32.
512
515
513 * IPython/winconsole.py (get_console_size): add new winconsole
516 * IPython/winconsole.py (get_console_size): add new winconsole
514 module and fixes to page_dumb() to improve its behavior under
517 module and fixes to page_dumb() to improve its behavior under
515 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
518 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
516
519
517 * IPython/Magic.py (Macro): simplified Macro class to just
520 * IPython/Magic.py (Macro): simplified Macro class to just
518 subclass list. We've had only 2.2 compatibility for a very long
521 subclass list. We've had only 2.2 compatibility for a very long
519 time, yet I was still avoiding subclassing the builtin types. No
522 time, yet I was still avoiding subclassing the builtin types. No
520 more (I'm also starting to use properties, though I won't shift to
523 more (I'm also starting to use properties, though I won't shift to
521 2.3-specific features quite yet).
524 2.3-specific features quite yet).
522 (magic_store): added Ville's patch for lightweight variable
525 (magic_store): added Ville's patch for lightweight variable
523 persistence, after a request on the user list by Matt Wilkie
526 persistence, after a request on the user list by Matt Wilkie
524 <maphew-AT-gmail.com>. The new %store magic's docstring has full
527 <maphew-AT-gmail.com>. The new %store magic's docstring has full
525 details.
528 details.
526
529
527 * IPython/iplib.py (InteractiveShell.post_config_initialization):
530 * IPython/iplib.py (InteractiveShell.post_config_initialization):
528 changed the default logfile name from 'ipython.log' to
531 changed the default logfile name from 'ipython.log' to
529 'ipython_log.py'. These logs are real python files, and now that
532 'ipython_log.py'. These logs are real python files, and now that
530 we have much better multiline support, people are more likely to
533 we have much better multiline support, people are more likely to
531 want to use them as such. Might as well name them correctly.
534 want to use them as such. Might as well name them correctly.
532
535
533 * IPython/Magic.py: substantial cleanup. While we can't stop
536 * IPython/Magic.py: substantial cleanup. While we can't stop
534 using magics as mixins, due to the existing customizations 'out
537 using magics as mixins, due to the existing customizations 'out
535 there' which rely on the mixin naming conventions, at least I
538 there' which rely on the mixin naming conventions, at least I
536 cleaned out all cross-class name usage. So once we are OK with
539 cleaned out all cross-class name usage. So once we are OK with
537 breaking compatibility, the two systems can be separated.
540 breaking compatibility, the two systems can be separated.
538
541
539 * IPython/Logger.py: major cleanup. This one is NOT a mixin
542 * IPython/Logger.py: major cleanup. This one is NOT a mixin
540 anymore, and the class is a fair bit less hideous as well. New
543 anymore, and the class is a fair bit less hideous as well. New
541 features were also introduced: timestamping of input, and logging
544 features were also introduced: timestamping of input, and logging
542 of output results. These are user-visible with the -t and -o
545 of output results. These are user-visible with the -t and -o
543 options to %logstart. Closes
546 options to %logstart. Closes
544 http://www.scipy.net/roundup/ipython/issue11 and a request by
547 http://www.scipy.net/roundup/ipython/issue11 and a request by
545 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
548 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
546
549
547 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
550 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
548
551
549 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
552 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
550 better hadnle backslashes in paths. See the thread 'More Windows
553 better hadnle backslashes in paths. See the thread 'More Windows
551 questions part 2 - \/ characters revisited' on the iypthon user
554 questions part 2 - \/ characters revisited' on the iypthon user
552 list:
555 list:
553 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
556 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
554
557
555 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
558 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
556
559
557 (InteractiveShell.__init__): change threaded shells to not use the
560 (InteractiveShell.__init__): change threaded shells to not use the
558 ipython crash handler. This was causing more problems than not,
561 ipython crash handler. This was causing more problems than not,
559 as exceptions in the main thread (GUI code, typically) would
562 as exceptions in the main thread (GUI code, typically) would
560 always show up as a 'crash', when they really weren't.
563 always show up as a 'crash', when they really weren't.
561
564
562 The colors and exception mode commands (%colors/%xmode) have been
565 The colors and exception mode commands (%colors/%xmode) have been
563 synchronized to also take this into account, so users can get
566 synchronized to also take this into account, so users can get
564 verbose exceptions for their threaded code as well. I also added
567 verbose exceptions for their threaded code as well. I also added
565 support for activating pdb inside this exception handler as well,
568 support for activating pdb inside this exception handler as well,
566 so now GUI authors can use IPython's enhanced pdb at runtime.
569 so now GUI authors can use IPython's enhanced pdb at runtime.
567
570
568 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
571 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
569 true by default, and add it to the shipped ipythonrc file. Since
572 true by default, and add it to the shipped ipythonrc file. Since
570 this asks the user before proceeding, I think it's OK to make it
573 this asks the user before proceeding, I think it's OK to make it
571 true by default.
574 true by default.
572
575
573 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
576 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
574 of the previous special-casing of input in the eval loop. I think
577 of the previous special-casing of input in the eval loop. I think
575 this is cleaner, as they really are commands and shouldn't have
578 this is cleaner, as they really are commands and shouldn't have
576 a special role in the middle of the core code.
579 a special role in the middle of the core code.
577
580
578 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
581 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
579
582
580 * IPython/iplib.py (edit_syntax_error): added support for
583 * IPython/iplib.py (edit_syntax_error): added support for
581 automatically reopening the editor if the file had a syntax error
584 automatically reopening the editor if the file had a syntax error
582 in it. Thanks to scottt who provided the patch at:
585 in it. Thanks to scottt who provided the patch at:
583 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
586 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
584 version committed).
587 version committed).
585
588
586 * IPython/iplib.py (handle_normal): add suport for multi-line
589 * IPython/iplib.py (handle_normal): add suport for multi-line
587 input with emtpy lines. This fixes
590 input with emtpy lines. This fixes
588 http://www.scipy.net/roundup/ipython/issue43 and a similar
591 http://www.scipy.net/roundup/ipython/issue43 and a similar
589 discussion on the user list.
592 discussion on the user list.
590
593
591 WARNING: a behavior change is necessarily introduced to support
594 WARNING: a behavior change is necessarily introduced to support
592 blank lines: now a single blank line with whitespace does NOT
595 blank lines: now a single blank line with whitespace does NOT
593 break the input loop, which means that when autoindent is on, by
596 break the input loop, which means that when autoindent is on, by
594 default hitting return on the next (indented) line does NOT exit.
597 default hitting return on the next (indented) line does NOT exit.
595
598
596 Instead, to exit a multiline input you can either have:
599 Instead, to exit a multiline input you can either have:
597
600
598 - TWO whitespace lines (just hit return again), or
601 - TWO whitespace lines (just hit return again), or
599 - a single whitespace line of a different length than provided
602 - a single whitespace line of a different length than provided
600 by the autoindent (add or remove a space).
603 by the autoindent (add or remove a space).
601
604
602 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
605 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
603 module to better organize all readline-related functionality.
606 module to better organize all readline-related functionality.
604 I've deleted FlexCompleter and put all completion clases here.
607 I've deleted FlexCompleter and put all completion clases here.
605
608
606 * IPython/iplib.py (raw_input): improve indentation management.
609 * IPython/iplib.py (raw_input): improve indentation management.
607 It is now possible to paste indented code with autoindent on, and
610 It is now possible to paste indented code with autoindent on, and
608 the code is interpreted correctly (though it still looks bad on
611 the code is interpreted correctly (though it still looks bad on
609 screen, due to the line-oriented nature of ipython).
612 screen, due to the line-oriented nature of ipython).
610 (MagicCompleter.complete): change behavior so that a TAB key on an
613 (MagicCompleter.complete): change behavior so that a TAB key on an
611 otherwise empty line actually inserts a tab, instead of completing
614 otherwise empty line actually inserts a tab, instead of completing
612 on the entire global namespace. This makes it easier to use the
615 on the entire global namespace. This makes it easier to use the
613 TAB key for indentation. After a request by Hans Meine
616 TAB key for indentation. After a request by Hans Meine
614 <hans_meine-AT-gmx.net>
617 <hans_meine-AT-gmx.net>
615 (_prefilter): add support so that typing plain 'exit' or 'quit'
618 (_prefilter): add support so that typing plain 'exit' or 'quit'
616 does a sensible thing. Originally I tried to deviate as little as
619 does a sensible thing. Originally I tried to deviate as little as
617 possible from the default python behavior, but even that one may
620 possible from the default python behavior, but even that one may
618 change in this direction (thread on python-dev to that effect).
621 change in this direction (thread on python-dev to that effect).
619 Regardless, ipython should do the right thing even if CPython's
622 Regardless, ipython should do the right thing even if CPython's
620 '>>>' prompt doesn't.
623 '>>>' prompt doesn't.
621 (InteractiveShell): removed subclassing code.InteractiveConsole
624 (InteractiveShell): removed subclassing code.InteractiveConsole
622 class. By now we'd overridden just about all of its methods: I've
625 class. By now we'd overridden just about all of its methods: I've
623 copied the remaining two over, and now ipython is a standalone
626 copied the remaining two over, and now ipython is a standalone
624 class. This will provide a clearer picture for the chainsaw
627 class. This will provide a clearer picture for the chainsaw
625 branch refactoring.
628 branch refactoring.
626
629
627 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
630 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
628
631
629 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
632 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
630 failures for objects which break when dir() is called on them.
633 failures for objects which break when dir() is called on them.
631
634
632 * IPython/FlexCompleter.py (Completer.__init__): Added support for
635 * IPython/FlexCompleter.py (Completer.__init__): Added support for
633 distinct local and global namespaces in the completer API. This
636 distinct local and global namespaces in the completer API. This
634 change allows us top properly handle completion with distinct
637 change allows us top properly handle completion with distinct
635 scopes, including in embedded instances (this had never really
638 scopes, including in embedded instances (this had never really
636 worked correctly).
639 worked correctly).
637
640
638 Note: this introduces a change in the constructor for
641 Note: this introduces a change in the constructor for
639 MagicCompleter, as a new global_namespace parameter is now the
642 MagicCompleter, as a new global_namespace parameter is now the
640 second argument (the others were bumped one position).
643 second argument (the others were bumped one position).
641
644
642 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
645 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
643
646
644 * IPython/iplib.py (embed_mainloop): fix tab-completion in
647 * IPython/iplib.py (embed_mainloop): fix tab-completion in
645 embedded instances (which can be done now thanks to Vivian's
648 embedded instances (which can be done now thanks to Vivian's
646 frame-handling fixes for pdb).
649 frame-handling fixes for pdb).
647 (InteractiveShell.__init__): Fix namespace handling problem in
650 (InteractiveShell.__init__): Fix namespace handling problem in
648 embedded instances. We were overwriting __main__ unconditionally,
651 embedded instances. We were overwriting __main__ unconditionally,
649 and this should only be done for 'full' (non-embedded) IPython;
652 and this should only be done for 'full' (non-embedded) IPython;
650 embedded instances must respect the caller's __main__. Thanks to
653 embedded instances must respect the caller's __main__. Thanks to
651 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
654 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
652
655
653 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
656 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
654
657
655 * setup.py: added download_url to setup(). This registers the
658 * setup.py: added download_url to setup(). This registers the
656 download address at PyPI, which is not only useful to humans
659 download address at PyPI, which is not only useful to humans
657 browsing the site, but is also picked up by setuptools (the Eggs
660 browsing the site, but is also picked up by setuptools (the Eggs
658 machinery). Thanks to Ville and R. Kern for the info/discussion
661 machinery). Thanks to Ville and R. Kern for the info/discussion
659 on this.
662 on this.
660
663
661 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
664 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
662
665
663 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
666 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
664 This brings a lot of nice functionality to the pdb mode, which now
667 This brings a lot of nice functionality to the pdb mode, which now
665 has tab-completion, syntax highlighting, and better stack handling
668 has tab-completion, syntax highlighting, and better stack handling
666 than before. Many thanks to Vivian De Smedt
669 than before. Many thanks to Vivian De Smedt
667 <vivian-AT-vdesmedt.com> for the original patches.
670 <vivian-AT-vdesmedt.com> for the original patches.
668
671
669 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
672 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
670
673
671 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
674 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
672 sequence to consistently accept the banner argument. The
675 sequence to consistently accept the banner argument. The
673 inconsistency was tripping SAGE, thanks to Gary Zablackis
676 inconsistency was tripping SAGE, thanks to Gary Zablackis
674 <gzabl-AT-yahoo.com> for the report.
677 <gzabl-AT-yahoo.com> for the report.
675
678
676 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
679 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
677
680
678 * IPython/iplib.py (InteractiveShell.post_config_initialization):
681 * IPython/iplib.py (InteractiveShell.post_config_initialization):
679 Fix bug where a naked 'alias' call in the ipythonrc file would
682 Fix bug where a naked 'alias' call in the ipythonrc file would
680 cause a crash. Bug reported by Jorgen Stenarson.
683 cause a crash. Bug reported by Jorgen Stenarson.
681
684
682 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
685 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
683
686
684 * IPython/ipmaker.py (make_IPython): cleanups which should improve
687 * IPython/ipmaker.py (make_IPython): cleanups which should improve
685 startup time.
688 startup time.
686
689
687 * IPython/iplib.py (runcode): my globals 'fix' for embedded
690 * IPython/iplib.py (runcode): my globals 'fix' for embedded
688 instances had introduced a bug with globals in normal code. Now
691 instances had introduced a bug with globals in normal code. Now
689 it's working in all cases.
692 it's working in all cases.
690
693
691 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
694 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
692 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
695 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
693 has been introduced to set the default case sensitivity of the
696 has been introduced to set the default case sensitivity of the
694 searches. Users can still select either mode at runtime on a
697 searches. Users can still select either mode at runtime on a
695 per-search basis.
698 per-search basis.
696
699
697 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
700 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
698
701
699 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
702 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
700 attributes in wildcard searches for subclasses. Modified version
703 attributes in wildcard searches for subclasses. Modified version
701 of a patch by Jorgen.
704 of a patch by Jorgen.
702
705
703 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
706 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
704
707
705 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
708 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
706 embedded instances. I added a user_global_ns attribute to the
709 embedded instances. I added a user_global_ns attribute to the
707 InteractiveShell class to handle this.
710 InteractiveShell class to handle this.
708
711
709 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
712 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
710
713
711 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
714 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
712 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
715 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
713 (reported under win32, but may happen also in other platforms).
716 (reported under win32, but may happen also in other platforms).
714 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
717 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
715
718
716 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
719 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
717
720
718 * IPython/Magic.py (magic_psearch): new support for wildcard
721 * IPython/Magic.py (magic_psearch): new support for wildcard
719 patterns. Now, typing ?a*b will list all names which begin with a
722 patterns. Now, typing ?a*b will list all names which begin with a
720 and end in b, for example. The %psearch magic has full
723 and end in b, for example. The %psearch magic has full
721 docstrings. Many thanks to JΓΆrgen Stenarson
724 docstrings. Many thanks to JΓΆrgen Stenarson
722 <jorgen.stenarson-AT-bostream.nu>, author of the patches
725 <jorgen.stenarson-AT-bostream.nu>, author of the patches
723 implementing this functionality.
726 implementing this functionality.
724
727
725 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
728 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
726
729
727 * Manual: fixed long-standing annoyance of double-dashes (as in
730 * Manual: fixed long-standing annoyance of double-dashes (as in
728 --prefix=~, for example) being stripped in the HTML version. This
731 --prefix=~, for example) being stripped in the HTML version. This
729 is a latex2html bug, but a workaround was provided. Many thanks
732 is a latex2html bug, but a workaround was provided. Many thanks
730 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
733 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
731 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
734 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
732 rolling. This seemingly small issue had tripped a number of users
735 rolling. This seemingly small issue had tripped a number of users
733 when first installing, so I'm glad to see it gone.
736 when first installing, so I'm glad to see it gone.
734
737
735 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
738 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
736
739
737 * IPython/Extensions/numeric_formats.py: fix missing import,
740 * IPython/Extensions/numeric_formats.py: fix missing import,
738 reported by Stephen Walton.
741 reported by Stephen Walton.
739
742
740 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
743 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
741
744
742 * IPython/demo.py: finish demo module, fully documented now.
745 * IPython/demo.py: finish demo module, fully documented now.
743
746
744 * IPython/genutils.py (file_read): simple little utility to read a
747 * IPython/genutils.py (file_read): simple little utility to read a
745 file and ensure it's closed afterwards.
748 file and ensure it's closed afterwards.
746
749
747 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
750 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
748
751
749 * IPython/demo.py (Demo.__init__): added support for individually
752 * IPython/demo.py (Demo.__init__): added support for individually
750 tagging blocks for automatic execution.
753 tagging blocks for automatic execution.
751
754
752 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
755 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
753 syntax-highlighted python sources, requested by John.
756 syntax-highlighted python sources, requested by John.
754
757
755 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
758 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
756
759
757 * IPython/demo.py (Demo.again): fix bug where again() blocks after
760 * IPython/demo.py (Demo.again): fix bug where again() blocks after
758 finishing.
761 finishing.
759
762
760 * IPython/genutils.py (shlex_split): moved from Magic to here,
763 * IPython/genutils.py (shlex_split): moved from Magic to here,
761 where all 2.2 compatibility stuff lives. I needed it for demo.py.
764 where all 2.2 compatibility stuff lives. I needed it for demo.py.
762
765
763 * IPython/demo.py (Demo.__init__): added support for silent
766 * IPython/demo.py (Demo.__init__): added support for silent
764 blocks, improved marks as regexps, docstrings written.
767 blocks, improved marks as regexps, docstrings written.
765 (Demo.__init__): better docstring, added support for sys.argv.
768 (Demo.__init__): better docstring, added support for sys.argv.
766
769
767 * IPython/genutils.py (marquee): little utility used by the demo
770 * IPython/genutils.py (marquee): little utility used by the demo
768 code, handy in general.
771 code, handy in general.
769
772
770 * IPython/demo.py (Demo.__init__): new class for interactive
773 * IPython/demo.py (Demo.__init__): new class for interactive
771 demos. Not documented yet, I just wrote it in a hurry for
774 demos. Not documented yet, I just wrote it in a hurry for
772 scipy'05. Will docstring later.
775 scipy'05. Will docstring later.
773
776
774 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
777 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
775
778
776 * IPython/Shell.py (sigint_handler): Drastic simplification which
779 * IPython/Shell.py (sigint_handler): Drastic simplification which
777 also seems to make Ctrl-C work correctly across threads! This is
780 also seems to make Ctrl-C work correctly across threads! This is
778 so simple, that I can't beleive I'd missed it before. Needs more
781 so simple, that I can't beleive I'd missed it before. Needs more
779 testing, though.
782 testing, though.
780 (KBINT): Never mind, revert changes. I'm sure I'd tried something
783 (KBINT): Never mind, revert changes. I'm sure I'd tried something
781 like this before...
784 like this before...
782
785
783 * IPython/genutils.py (get_home_dir): add protection against
786 * IPython/genutils.py (get_home_dir): add protection against
784 non-dirs in win32 registry.
787 non-dirs in win32 registry.
785
788
786 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
789 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
787 bug where dict was mutated while iterating (pysh crash).
790 bug where dict was mutated while iterating (pysh crash).
788
791
789 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
792 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
790
793
791 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
794 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
792 spurious newlines added by this routine. After a report by
795 spurious newlines added by this routine. After a report by
793 F. Mantegazza.
796 F. Mantegazza.
794
797
795 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
798 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
796
799
797 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
800 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
798 calls. These were a leftover from the GTK 1.x days, and can cause
801 calls. These were a leftover from the GTK 1.x days, and can cause
799 problems in certain cases (after a report by John Hunter).
802 problems in certain cases (after a report by John Hunter).
800
803
801 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
804 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
802 os.getcwd() fails at init time. Thanks to patch from David Remahl
805 os.getcwd() fails at init time. Thanks to patch from David Remahl
803 <chmod007-AT-mac.com>.
806 <chmod007-AT-mac.com>.
804 (InteractiveShell.__init__): prevent certain special magics from
807 (InteractiveShell.__init__): prevent certain special magics from
805 being shadowed by aliases. Closes
808 being shadowed by aliases. Closes
806 http://www.scipy.net/roundup/ipython/issue41.
809 http://www.scipy.net/roundup/ipython/issue41.
807
810
808 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
811 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
809
812
810 * IPython/iplib.py (InteractiveShell.complete): Added new
813 * IPython/iplib.py (InteractiveShell.complete): Added new
811 top-level completion method to expose the completion mechanism
814 top-level completion method to expose the completion mechanism
812 beyond readline-based environments.
815 beyond readline-based environments.
813
816
814 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
817 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
815
818
816 * tools/ipsvnc (svnversion): fix svnversion capture.
819 * tools/ipsvnc (svnversion): fix svnversion capture.
817
820
818 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
821 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
819 attribute to self, which was missing. Before, it was set by a
822 attribute to self, which was missing. Before, it was set by a
820 routine which in certain cases wasn't being called, so the
823 routine which in certain cases wasn't being called, so the
821 instance could end up missing the attribute. This caused a crash.
824 instance could end up missing the attribute. This caused a crash.
822 Closes http://www.scipy.net/roundup/ipython/issue40.
825 Closes http://www.scipy.net/roundup/ipython/issue40.
823
826
824 2005-08-16 Fernando Perez <fperez@colorado.edu>
827 2005-08-16 Fernando Perez <fperez@colorado.edu>
825
828
826 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
829 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
827 contains non-string attribute. Closes
830 contains non-string attribute. Closes
828 http://www.scipy.net/roundup/ipython/issue38.
831 http://www.scipy.net/roundup/ipython/issue38.
829
832
830 2005-08-14 Fernando Perez <fperez@colorado.edu>
833 2005-08-14 Fernando Perez <fperez@colorado.edu>
831
834
832 * tools/ipsvnc: Minor improvements, to add changeset info.
835 * tools/ipsvnc: Minor improvements, to add changeset info.
833
836
834 2005-08-12 Fernando Perez <fperez@colorado.edu>
837 2005-08-12 Fernando Perez <fperez@colorado.edu>
835
838
836 * IPython/iplib.py (runsource): remove self.code_to_run_src
839 * IPython/iplib.py (runsource): remove self.code_to_run_src
837 attribute. I realized this is nothing more than
840 attribute. I realized this is nothing more than
838 '\n'.join(self.buffer), and having the same data in two different
841 '\n'.join(self.buffer), and having the same data in two different
839 places is just asking for synchronization bugs. This may impact
842 places is just asking for synchronization bugs. This may impact
840 people who have custom exception handlers, so I need to warn
843 people who have custom exception handlers, so I need to warn
841 ipython-dev about it (F. Mantegazza may use them).
844 ipython-dev about it (F. Mantegazza may use them).
842
845
843 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
846 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
844
847
845 * IPython/genutils.py: fix 2.2 compatibility (generators)
848 * IPython/genutils.py: fix 2.2 compatibility (generators)
846
849
847 2005-07-18 Fernando Perez <fperez@colorado.edu>
850 2005-07-18 Fernando Perez <fperez@colorado.edu>
848
851
849 * IPython/genutils.py (get_home_dir): fix to help users with
852 * IPython/genutils.py (get_home_dir): fix to help users with
850 invalid $HOME under win32.
853 invalid $HOME under win32.
851
854
852 2005-07-17 Fernando Perez <fperez@colorado.edu>
855 2005-07-17 Fernando Perez <fperez@colorado.edu>
853
856
854 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
857 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
855 some old hacks and clean up a bit other routines; code should be
858 some old hacks and clean up a bit other routines; code should be
856 simpler and a bit faster.
859 simpler and a bit faster.
857
860
858 * IPython/iplib.py (interact): removed some last-resort attempts
861 * IPython/iplib.py (interact): removed some last-resort attempts
859 to survive broken stdout/stderr. That code was only making it
862 to survive broken stdout/stderr. That code was only making it
860 harder to abstract out the i/o (necessary for gui integration),
863 harder to abstract out the i/o (necessary for gui integration),
861 and the crashes it could prevent were extremely rare in practice
864 and the crashes it could prevent were extremely rare in practice
862 (besides being fully user-induced in a pretty violent manner).
865 (besides being fully user-induced in a pretty violent manner).
863
866
864 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
867 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
865 Nothing major yet, but the code is simpler to read; this should
868 Nothing major yet, but the code is simpler to read; this should
866 make it easier to do more serious modifications in the future.
869 make it easier to do more serious modifications in the future.
867
870
868 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
871 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
869 which broke in .15 (thanks to a report by Ville).
872 which broke in .15 (thanks to a report by Ville).
870
873
871 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
874 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
872 be quite correct, I know next to nothing about unicode). This
875 be quite correct, I know next to nothing about unicode). This
873 will allow unicode strings to be used in prompts, amongst other
876 will allow unicode strings to be used in prompts, amongst other
874 cases. It also will prevent ipython from crashing when unicode
877 cases. It also will prevent ipython from crashing when unicode
875 shows up unexpectedly in many places. If ascii encoding fails, we
878 shows up unexpectedly in many places. If ascii encoding fails, we
876 assume utf_8. Currently the encoding is not a user-visible
879 assume utf_8. Currently the encoding is not a user-visible
877 setting, though it could be made so if there is demand for it.
880 setting, though it could be made so if there is demand for it.
878
881
879 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
882 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
880
883
881 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
884 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
882
885
883 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
886 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
884
887
885 * IPython/genutils.py: Add 2.2 compatibility here, so all other
888 * IPython/genutils.py: Add 2.2 compatibility here, so all other
886 code can work transparently for 2.2/2.3.
889 code can work transparently for 2.2/2.3.
887
890
888 2005-07-16 Fernando Perez <fperez@colorado.edu>
891 2005-07-16 Fernando Perez <fperez@colorado.edu>
889
892
890 * IPython/ultraTB.py (ExceptionColors): Make a global variable
893 * IPython/ultraTB.py (ExceptionColors): Make a global variable
891 out of the color scheme table used for coloring exception
894 out of the color scheme table used for coloring exception
892 tracebacks. This allows user code to add new schemes at runtime.
895 tracebacks. This allows user code to add new schemes at runtime.
893 This is a minimally modified version of the patch at
896 This is a minimally modified version of the patch at
894 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
897 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
895 for the contribution.
898 for the contribution.
896
899
897 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
900 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
898 slightly modified version of the patch in
901 slightly modified version of the patch in
899 http://www.scipy.net/roundup/ipython/issue34, which also allows me
902 http://www.scipy.net/roundup/ipython/issue34, which also allows me
900 to remove the previous try/except solution (which was costlier).
903 to remove the previous try/except solution (which was costlier).
901 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
904 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
902
905
903 2005-06-08 Fernando Perez <fperez@colorado.edu>
906 2005-06-08 Fernando Perez <fperez@colorado.edu>
904
907
905 * IPython/iplib.py (write/write_err): Add methods to abstract all
908 * IPython/iplib.py (write/write_err): Add methods to abstract all
906 I/O a bit more.
909 I/O a bit more.
907
910
908 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
911 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
909 warning, reported by Aric Hagberg, fix by JD Hunter.
912 warning, reported by Aric Hagberg, fix by JD Hunter.
910
913
911 2005-06-02 *** Released version 0.6.15
914 2005-06-02 *** Released version 0.6.15
912
915
913 2005-06-01 Fernando Perez <fperez@colorado.edu>
916 2005-06-01 Fernando Perez <fperez@colorado.edu>
914
917
915 * IPython/iplib.py (MagicCompleter.file_matches): Fix
918 * IPython/iplib.py (MagicCompleter.file_matches): Fix
916 tab-completion of filenames within open-quoted strings. Note that
919 tab-completion of filenames within open-quoted strings. Note that
917 this requires that in ~/.ipython/ipythonrc, users change the
920 this requires that in ~/.ipython/ipythonrc, users change the
918 readline delimiters configuration to read:
921 readline delimiters configuration to read:
919
922
920 readline_remove_delims -/~
923 readline_remove_delims -/~
921
924
922
925
923 2005-05-31 *** Released version 0.6.14
926 2005-05-31 *** Released version 0.6.14
924
927
925 2005-05-29 Fernando Perez <fperez@colorado.edu>
928 2005-05-29 Fernando Perez <fperez@colorado.edu>
926
929
927 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
930 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
928 with files not on the filesystem. Reported by Eliyahu Sandler
931 with files not on the filesystem. Reported by Eliyahu Sandler
929 <eli@gondolin.net>
932 <eli@gondolin.net>
930
933
931 2005-05-22 Fernando Perez <fperez@colorado.edu>
934 2005-05-22 Fernando Perez <fperez@colorado.edu>
932
935
933 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
936 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
934 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
937 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
935
938
936 2005-05-19 Fernando Perez <fperez@colorado.edu>
939 2005-05-19 Fernando Perez <fperez@colorado.edu>
937
940
938 * IPython/iplib.py (safe_execfile): close a file which could be
941 * IPython/iplib.py (safe_execfile): close a file which could be
939 left open (causing problems in win32, which locks open files).
942 left open (causing problems in win32, which locks open files).
940 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
943 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
941
944
942 2005-05-18 Fernando Perez <fperez@colorado.edu>
945 2005-05-18 Fernando Perez <fperez@colorado.edu>
943
946
944 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
947 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
945 keyword arguments correctly to safe_execfile().
948 keyword arguments correctly to safe_execfile().
946
949
947 2005-05-13 Fernando Perez <fperez@colorado.edu>
950 2005-05-13 Fernando Perez <fperez@colorado.edu>
948
951
949 * ipython.1: Added info about Qt to manpage, and threads warning
952 * ipython.1: Added info about Qt to manpage, and threads warning
950 to usage page (invoked with --help).
953 to usage page (invoked with --help).
951
954
952 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
955 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
953 new matcher (it goes at the end of the priority list) to do
956 new matcher (it goes at the end of the priority list) to do
954 tab-completion on named function arguments. Submitted by George
957 tab-completion on named function arguments. Submitted by George
955 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
958 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
956 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
959 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
957 for more details.
960 for more details.
958
961
959 * IPython/Magic.py (magic_run): Added new -e flag to ignore
962 * IPython/Magic.py (magic_run): Added new -e flag to ignore
960 SystemExit exceptions in the script being run. Thanks to a report
963 SystemExit exceptions in the script being run. Thanks to a report
961 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
964 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
962 producing very annoying behavior when running unit tests.
965 producing very annoying behavior when running unit tests.
963
966
964 2005-05-12 Fernando Perez <fperez@colorado.edu>
967 2005-05-12 Fernando Perez <fperez@colorado.edu>
965
968
966 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
969 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
967 which I'd broken (again) due to a changed regexp. In the process,
970 which I'd broken (again) due to a changed regexp. In the process,
968 added ';' as an escape to auto-quote the whole line without
971 added ';' as an escape to auto-quote the whole line without
969 splitting its arguments. Thanks to a report by Jerry McRae
972 splitting its arguments. Thanks to a report by Jerry McRae
970 <qrs0xyc02-AT-sneakemail.com>.
973 <qrs0xyc02-AT-sneakemail.com>.
971
974
972 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
975 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
973 possible crashes caused by a TokenError. Reported by Ed Schofield
976 possible crashes caused by a TokenError. Reported by Ed Schofield
974 <schofield-AT-ftw.at>.
977 <schofield-AT-ftw.at>.
975
978
976 2005-05-06 Fernando Perez <fperez@colorado.edu>
979 2005-05-06 Fernando Perez <fperez@colorado.edu>
977
980
978 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
981 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
979
982
980 2005-04-29 Fernando Perez <fperez@colorado.edu>
983 2005-04-29 Fernando Perez <fperez@colorado.edu>
981
984
982 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
985 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
983 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
986 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
984 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
987 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
985 which provides support for Qt interactive usage (similar to the
988 which provides support for Qt interactive usage (similar to the
986 existing one for WX and GTK). This had been often requested.
989 existing one for WX and GTK). This had been often requested.
987
990
988 2005-04-14 *** Released version 0.6.13
991 2005-04-14 *** Released version 0.6.13
989
992
990 2005-04-08 Fernando Perez <fperez@colorado.edu>
993 2005-04-08 Fernando Perez <fperez@colorado.edu>
991
994
992 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
995 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
993 from _ofind, which gets called on almost every input line. Now,
996 from _ofind, which gets called on almost every input line. Now,
994 we only try to get docstrings if they are actually going to be
997 we only try to get docstrings if they are actually going to be
995 used (the overhead of fetching unnecessary docstrings can be
998 used (the overhead of fetching unnecessary docstrings can be
996 noticeable for certain objects, such as Pyro proxies).
999 noticeable for certain objects, such as Pyro proxies).
997
1000
998 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1001 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
999 for completers. For some reason I had been passing them the state
1002 for completers. For some reason I had been passing them the state
1000 variable, which completers never actually need, and was in
1003 variable, which completers never actually need, and was in
1001 conflict with the rlcompleter API. Custom completers ONLY need to
1004 conflict with the rlcompleter API. Custom completers ONLY need to
1002 take the text parameter.
1005 take the text parameter.
1003
1006
1004 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1007 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1005 work correctly in pysh. I've also moved all the logic which used
1008 work correctly in pysh. I've also moved all the logic which used
1006 to be in pysh.py here, which will prevent problems with future
1009 to be in pysh.py here, which will prevent problems with future
1007 upgrades. However, this time I must warn users to update their
1010 upgrades. However, this time I must warn users to update their
1008 pysh profile to include the line
1011 pysh profile to include the line
1009
1012
1010 import_all IPython.Extensions.InterpreterExec
1013 import_all IPython.Extensions.InterpreterExec
1011
1014
1012 because otherwise things won't work for them. They MUST also
1015 because otherwise things won't work for them. They MUST also
1013 delete pysh.py and the line
1016 delete pysh.py and the line
1014
1017
1015 execfile pysh.py
1018 execfile pysh.py
1016
1019
1017 from their ipythonrc-pysh.
1020 from their ipythonrc-pysh.
1018
1021
1019 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1022 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1020 robust in the face of objects whose dir() returns non-strings
1023 robust in the face of objects whose dir() returns non-strings
1021 (which it shouldn't, but some broken libs like ITK do). Thanks to
1024 (which it shouldn't, but some broken libs like ITK do). Thanks to
1022 a patch by John Hunter (implemented differently, though). Also
1025 a patch by John Hunter (implemented differently, though). Also
1023 minor improvements by using .extend instead of + on lists.
1026 minor improvements by using .extend instead of + on lists.
1024
1027
1025 * pysh.py:
1028 * pysh.py:
1026
1029
1027 2005-04-06 Fernando Perez <fperez@colorado.edu>
1030 2005-04-06 Fernando Perez <fperez@colorado.edu>
1028
1031
1029 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1032 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1030 by default, so that all users benefit from it. Those who don't
1033 by default, so that all users benefit from it. Those who don't
1031 want it can still turn it off.
1034 want it can still turn it off.
1032
1035
1033 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1036 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1034 config file, I'd forgotten about this, so users were getting it
1037 config file, I'd forgotten about this, so users were getting it
1035 off by default.
1038 off by default.
1036
1039
1037 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1040 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1038 consistency. Now magics can be called in multiline statements,
1041 consistency. Now magics can be called in multiline statements,
1039 and python variables can be expanded in magic calls via $var.
1042 and python variables can be expanded in magic calls via $var.
1040 This makes the magic system behave just like aliases or !system
1043 This makes the magic system behave just like aliases or !system
1041 calls.
1044 calls.
1042
1045
1043 2005-03-28 Fernando Perez <fperez@colorado.edu>
1046 2005-03-28 Fernando Perez <fperez@colorado.edu>
1044
1047
1045 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1048 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1046 expensive string additions for building command. Add support for
1049 expensive string additions for building command. Add support for
1047 trailing ';' when autocall is used.
1050 trailing ';' when autocall is used.
1048
1051
1049 2005-03-26 Fernando Perez <fperez@colorado.edu>
1052 2005-03-26 Fernando Perez <fperez@colorado.edu>
1050
1053
1051 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1054 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1052 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1055 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1053 ipython.el robust against prompts with any number of spaces
1056 ipython.el robust against prompts with any number of spaces
1054 (including 0) after the ':' character.
1057 (including 0) after the ':' character.
1055
1058
1056 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1059 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1057 continuation prompt, which misled users to think the line was
1060 continuation prompt, which misled users to think the line was
1058 already indented. Closes debian Bug#300847, reported to me by
1061 already indented. Closes debian Bug#300847, reported to me by
1059 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1062 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1060
1063
1061 2005-03-23 Fernando Perez <fperez@colorado.edu>
1064 2005-03-23 Fernando Perez <fperez@colorado.edu>
1062
1065
1063 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1066 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1064 properly aligned if they have embedded newlines.
1067 properly aligned if they have embedded newlines.
1065
1068
1066 * IPython/iplib.py (runlines): Add a public method to expose
1069 * IPython/iplib.py (runlines): Add a public method to expose
1067 IPython's code execution machinery, so that users can run strings
1070 IPython's code execution machinery, so that users can run strings
1068 as if they had been typed at the prompt interactively.
1071 as if they had been typed at the prompt interactively.
1069 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1072 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1070 methods which can call the system shell, but with python variable
1073 methods which can call the system shell, but with python variable
1071 expansion. The three such methods are: __IPYTHON__.system,
1074 expansion. The three such methods are: __IPYTHON__.system,
1072 .getoutput and .getoutputerror. These need to be documented in a
1075 .getoutput and .getoutputerror. These need to be documented in a
1073 'public API' section (to be written) of the manual.
1076 'public API' section (to be written) of the manual.
1074
1077
1075 2005-03-20 Fernando Perez <fperez@colorado.edu>
1078 2005-03-20 Fernando Perez <fperez@colorado.edu>
1076
1079
1077 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1080 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1078 for custom exception handling. This is quite powerful, and it
1081 for custom exception handling. This is quite powerful, and it
1079 allows for user-installable exception handlers which can trap
1082 allows for user-installable exception handlers which can trap
1080 custom exceptions at runtime and treat them separately from
1083 custom exceptions at runtime and treat them separately from
1081 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1084 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1082 Mantegazza <mantegazza-AT-ill.fr>.
1085 Mantegazza <mantegazza-AT-ill.fr>.
1083 (InteractiveShell.set_custom_completer): public API function to
1086 (InteractiveShell.set_custom_completer): public API function to
1084 add new completers at runtime.
1087 add new completers at runtime.
1085
1088
1086 2005-03-19 Fernando Perez <fperez@colorado.edu>
1089 2005-03-19 Fernando Perez <fperez@colorado.edu>
1087
1090
1088 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1091 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1089 allow objects which provide their docstrings via non-standard
1092 allow objects which provide their docstrings via non-standard
1090 mechanisms (like Pyro proxies) to still be inspected by ipython's
1093 mechanisms (like Pyro proxies) to still be inspected by ipython's
1091 ? system.
1094 ? system.
1092
1095
1093 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1096 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1094 automatic capture system. I tried quite hard to make it work
1097 automatic capture system. I tried quite hard to make it work
1095 reliably, and simply failed. I tried many combinations with the
1098 reliably, and simply failed. I tried many combinations with the
1096 subprocess module, but eventually nothing worked in all needed
1099 subprocess module, but eventually nothing worked in all needed
1097 cases (not blocking stdin for the child, duplicating stdout
1100 cases (not blocking stdin for the child, duplicating stdout
1098 without blocking, etc). The new %sc/%sx still do capture to these
1101 without blocking, etc). The new %sc/%sx still do capture to these
1099 magical list/string objects which make shell use much more
1102 magical list/string objects which make shell use much more
1100 conveninent, so not all is lost.
1103 conveninent, so not all is lost.
1101
1104
1102 XXX - FIX MANUAL for the change above!
1105 XXX - FIX MANUAL for the change above!
1103
1106
1104 (runsource): I copied code.py's runsource() into ipython to modify
1107 (runsource): I copied code.py's runsource() into ipython to modify
1105 it a bit. Now the code object and source to be executed are
1108 it a bit. Now the code object and source to be executed are
1106 stored in ipython. This makes this info accessible to third-party
1109 stored in ipython. This makes this info accessible to third-party
1107 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1110 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1108 Mantegazza <mantegazza-AT-ill.fr>.
1111 Mantegazza <mantegazza-AT-ill.fr>.
1109
1112
1110 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1113 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1111 history-search via readline (like C-p/C-n). I'd wanted this for a
1114 history-search via readline (like C-p/C-n). I'd wanted this for a
1112 long time, but only recently found out how to do it. For users
1115 long time, but only recently found out how to do it. For users
1113 who already have their ipythonrc files made and want this, just
1116 who already have their ipythonrc files made and want this, just
1114 add:
1117 add:
1115
1118
1116 readline_parse_and_bind "\e[A": history-search-backward
1119 readline_parse_and_bind "\e[A": history-search-backward
1117 readline_parse_and_bind "\e[B": history-search-forward
1120 readline_parse_and_bind "\e[B": history-search-forward
1118
1121
1119 2005-03-18 Fernando Perez <fperez@colorado.edu>
1122 2005-03-18 Fernando Perez <fperez@colorado.edu>
1120
1123
1121 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1124 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1122 LSString and SList classes which allow transparent conversions
1125 LSString and SList classes which allow transparent conversions
1123 between list mode and whitespace-separated string.
1126 between list mode and whitespace-separated string.
1124 (magic_r): Fix recursion problem in %r.
1127 (magic_r): Fix recursion problem in %r.
1125
1128
1126 * IPython/genutils.py (LSString): New class to be used for
1129 * IPython/genutils.py (LSString): New class to be used for
1127 automatic storage of the results of all alias/system calls in _o
1130 automatic storage of the results of all alias/system calls in _o
1128 and _e (stdout/err). These provide a .l/.list attribute which
1131 and _e (stdout/err). These provide a .l/.list attribute which
1129 does automatic splitting on newlines. This means that for most
1132 does automatic splitting on newlines. This means that for most
1130 uses, you'll never need to do capturing of output with %sc/%sx
1133 uses, you'll never need to do capturing of output with %sc/%sx
1131 anymore, since ipython keeps this always done for you. Note that
1134 anymore, since ipython keeps this always done for you. Note that
1132 only the LAST results are stored, the _o/e variables are
1135 only the LAST results are stored, the _o/e variables are
1133 overwritten on each call. If you need to save their contents
1136 overwritten on each call. If you need to save their contents
1134 further, simply bind them to any other name.
1137 further, simply bind them to any other name.
1135
1138
1136 2005-03-17 Fernando Perez <fperez@colorado.edu>
1139 2005-03-17 Fernando Perez <fperez@colorado.edu>
1137
1140
1138 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1141 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1139 prompt namespace handling.
1142 prompt namespace handling.
1140
1143
1141 2005-03-16 Fernando Perez <fperez@colorado.edu>
1144 2005-03-16 Fernando Perez <fperez@colorado.edu>
1142
1145
1143 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1146 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1144 classic prompts to be '>>> ' (final space was missing, and it
1147 classic prompts to be '>>> ' (final space was missing, and it
1145 trips the emacs python mode).
1148 trips the emacs python mode).
1146 (BasePrompt.__str__): Added safe support for dynamic prompt
1149 (BasePrompt.__str__): Added safe support for dynamic prompt
1147 strings. Now you can set your prompt string to be '$x', and the
1150 strings. Now you can set your prompt string to be '$x', and the
1148 value of x will be printed from your interactive namespace. The
1151 value of x will be printed from your interactive namespace. The
1149 interpolation syntax includes the full Itpl support, so
1152 interpolation syntax includes the full Itpl support, so
1150 ${foo()+x+bar()} is a valid prompt string now, and the function
1153 ${foo()+x+bar()} is a valid prompt string now, and the function
1151 calls will be made at runtime.
1154 calls will be made at runtime.
1152
1155
1153 2005-03-15 Fernando Perez <fperez@colorado.edu>
1156 2005-03-15 Fernando Perez <fperez@colorado.edu>
1154
1157
1155 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1158 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1156 avoid name clashes in pylab. %hist still works, it just forwards
1159 avoid name clashes in pylab. %hist still works, it just forwards
1157 the call to %history.
1160 the call to %history.
1158
1161
1159 2005-03-02 *** Released version 0.6.12
1162 2005-03-02 *** Released version 0.6.12
1160
1163
1161 2005-03-02 Fernando Perez <fperez@colorado.edu>
1164 2005-03-02 Fernando Perez <fperez@colorado.edu>
1162
1165
1163 * IPython/iplib.py (handle_magic): log magic calls properly as
1166 * IPython/iplib.py (handle_magic): log magic calls properly as
1164 ipmagic() function calls.
1167 ipmagic() function calls.
1165
1168
1166 * IPython/Magic.py (magic_time): Improved %time to support
1169 * IPython/Magic.py (magic_time): Improved %time to support
1167 statements and provide wall-clock as well as CPU time.
1170 statements and provide wall-clock as well as CPU time.
1168
1171
1169 2005-02-27 Fernando Perez <fperez@colorado.edu>
1172 2005-02-27 Fernando Perez <fperez@colorado.edu>
1170
1173
1171 * IPython/hooks.py: New hooks module, to expose user-modifiable
1174 * IPython/hooks.py: New hooks module, to expose user-modifiable
1172 IPython functionality in a clean manner. For now only the editor
1175 IPython functionality in a clean manner. For now only the editor
1173 hook is actually written, and other thigns which I intend to turn
1176 hook is actually written, and other thigns which I intend to turn
1174 into proper hooks aren't yet there. The display and prefilter
1177 into proper hooks aren't yet there. The display and prefilter
1175 stuff, for example, should be hooks. But at least now the
1178 stuff, for example, should be hooks. But at least now the
1176 framework is in place, and the rest can be moved here with more
1179 framework is in place, and the rest can be moved here with more
1177 time later. IPython had had a .hooks variable for a long time for
1180 time later. IPython had had a .hooks variable for a long time for
1178 this purpose, but I'd never actually used it for anything.
1181 this purpose, but I'd never actually used it for anything.
1179
1182
1180 2005-02-26 Fernando Perez <fperez@colorado.edu>
1183 2005-02-26 Fernando Perez <fperez@colorado.edu>
1181
1184
1182 * IPython/ipmaker.py (make_IPython): make the default ipython
1185 * IPython/ipmaker.py (make_IPython): make the default ipython
1183 directory be called _ipython under win32, to follow more the
1186 directory be called _ipython under win32, to follow more the
1184 naming peculiarities of that platform (where buggy software like
1187 naming peculiarities of that platform (where buggy software like
1185 Visual Sourcesafe breaks with .named directories). Reported by
1188 Visual Sourcesafe breaks with .named directories). Reported by
1186 Ville Vainio.
1189 Ville Vainio.
1187
1190
1188 2005-02-23 Fernando Perez <fperez@colorado.edu>
1191 2005-02-23 Fernando Perez <fperez@colorado.edu>
1189
1192
1190 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1193 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1191 auto_aliases for win32 which were causing problems. Users can
1194 auto_aliases for win32 which were causing problems. Users can
1192 define the ones they personally like.
1195 define the ones they personally like.
1193
1196
1194 2005-02-21 Fernando Perez <fperez@colorado.edu>
1197 2005-02-21 Fernando Perez <fperez@colorado.edu>
1195
1198
1196 * IPython/Magic.py (magic_time): new magic to time execution of
1199 * IPython/Magic.py (magic_time): new magic to time execution of
1197 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1200 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1198
1201
1199 2005-02-19 Fernando Perez <fperez@colorado.edu>
1202 2005-02-19 Fernando Perez <fperez@colorado.edu>
1200
1203
1201 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1204 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1202 into keys (for prompts, for example).
1205 into keys (for prompts, for example).
1203
1206
1204 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1207 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1205 prompts in case users want them. This introduces a small behavior
1208 prompts in case users want them. This introduces a small behavior
1206 change: ipython does not automatically add a space to all prompts
1209 change: ipython does not automatically add a space to all prompts
1207 anymore. To get the old prompts with a space, users should add it
1210 anymore. To get the old prompts with a space, users should add it
1208 manually to their ipythonrc file, so for example prompt_in1 should
1211 manually to their ipythonrc file, so for example prompt_in1 should
1209 now read 'In [\#]: ' instead of 'In [\#]:'.
1212 now read 'In [\#]: ' instead of 'In [\#]:'.
1210 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1213 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1211 file) to control left-padding of secondary prompts.
1214 file) to control left-padding of secondary prompts.
1212
1215
1213 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1216 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1214 the profiler can't be imported. Fix for Debian, which removed
1217 the profiler can't be imported. Fix for Debian, which removed
1215 profile.py because of License issues. I applied a slightly
1218 profile.py because of License issues. I applied a slightly
1216 modified version of the original Debian patch at
1219 modified version of the original Debian patch at
1217 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1220 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1218
1221
1219 2005-02-17 Fernando Perez <fperez@colorado.edu>
1222 2005-02-17 Fernando Perez <fperez@colorado.edu>
1220
1223
1221 * IPython/genutils.py (native_line_ends): Fix bug which would
1224 * IPython/genutils.py (native_line_ends): Fix bug which would
1222 cause improper line-ends under win32 b/c I was not opening files
1225 cause improper line-ends under win32 b/c I was not opening files
1223 in binary mode. Bug report and fix thanks to Ville.
1226 in binary mode. Bug report and fix thanks to Ville.
1224
1227
1225 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1228 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1226 trying to catch spurious foo[1] autocalls. My fix actually broke
1229 trying to catch spurious foo[1] autocalls. My fix actually broke
1227 ',/' autoquote/call with explicit escape (bad regexp).
1230 ',/' autoquote/call with explicit escape (bad regexp).
1228
1231
1229 2005-02-15 *** Released version 0.6.11
1232 2005-02-15 *** Released version 0.6.11
1230
1233
1231 2005-02-14 Fernando Perez <fperez@colorado.edu>
1234 2005-02-14 Fernando Perez <fperez@colorado.edu>
1232
1235
1233 * IPython/background_jobs.py: New background job management
1236 * IPython/background_jobs.py: New background job management
1234 subsystem. This is implemented via a new set of classes, and
1237 subsystem. This is implemented via a new set of classes, and
1235 IPython now provides a builtin 'jobs' object for background job
1238 IPython now provides a builtin 'jobs' object for background job
1236 execution. A convenience %bg magic serves as a lightweight
1239 execution. A convenience %bg magic serves as a lightweight
1237 frontend for starting the more common type of calls. This was
1240 frontend for starting the more common type of calls. This was
1238 inspired by discussions with B. Granger and the BackgroundCommand
1241 inspired by discussions with B. Granger and the BackgroundCommand
1239 class described in the book Python Scripting for Computational
1242 class described in the book Python Scripting for Computational
1240 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1243 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1241 (although ultimately no code from this text was used, as IPython's
1244 (although ultimately no code from this text was used, as IPython's
1242 system is a separate implementation).
1245 system is a separate implementation).
1243
1246
1244 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1247 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1245 to control the completion of single/double underscore names
1248 to control the completion of single/double underscore names
1246 separately. As documented in the example ipytonrc file, the
1249 separately. As documented in the example ipytonrc file, the
1247 readline_omit__names variable can now be set to 2, to omit even
1250 readline_omit__names variable can now be set to 2, to omit even
1248 single underscore names. Thanks to a patch by Brian Wong
1251 single underscore names. Thanks to a patch by Brian Wong
1249 <BrianWong-AT-AirgoNetworks.Com>.
1252 <BrianWong-AT-AirgoNetworks.Com>.
1250 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1253 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1251 be autocalled as foo([1]) if foo were callable. A problem for
1254 be autocalled as foo([1]) if foo were callable. A problem for
1252 things which are both callable and implement __getitem__.
1255 things which are both callable and implement __getitem__.
1253 (init_readline): Fix autoindentation for win32. Thanks to a patch
1256 (init_readline): Fix autoindentation for win32. Thanks to a patch
1254 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1257 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1255
1258
1256 2005-02-12 Fernando Perez <fperez@colorado.edu>
1259 2005-02-12 Fernando Perez <fperez@colorado.edu>
1257
1260
1258 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1261 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1259 which I had written long ago to sort out user error messages which
1262 which I had written long ago to sort out user error messages which
1260 may occur during startup. This seemed like a good idea initially,
1263 may occur during startup. This seemed like a good idea initially,
1261 but it has proven a disaster in retrospect. I don't want to
1264 but it has proven a disaster in retrospect. I don't want to
1262 change much code for now, so my fix is to set the internal 'debug'
1265 change much code for now, so my fix is to set the internal 'debug'
1263 flag to true everywhere, whose only job was precisely to control
1266 flag to true everywhere, whose only job was precisely to control
1264 this subsystem. This closes issue 28 (as well as avoiding all
1267 this subsystem. This closes issue 28 (as well as avoiding all
1265 sorts of strange hangups which occur from time to time).
1268 sorts of strange hangups which occur from time to time).
1266
1269
1267 2005-02-07 Fernando Perez <fperez@colorado.edu>
1270 2005-02-07 Fernando Perez <fperez@colorado.edu>
1268
1271
1269 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1272 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1270 previous call produced a syntax error.
1273 previous call produced a syntax error.
1271
1274
1272 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1275 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1273 classes without constructor.
1276 classes without constructor.
1274
1277
1275 2005-02-06 Fernando Perez <fperez@colorado.edu>
1278 2005-02-06 Fernando Perez <fperez@colorado.edu>
1276
1279
1277 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1280 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1278 completions with the results of each matcher, so we return results
1281 completions with the results of each matcher, so we return results
1279 to the user from all namespaces. This breaks with ipython
1282 to the user from all namespaces. This breaks with ipython
1280 tradition, but I think it's a nicer behavior. Now you get all
1283 tradition, but I think it's a nicer behavior. Now you get all
1281 possible completions listed, from all possible namespaces (python,
1284 possible completions listed, from all possible namespaces (python,
1282 filesystem, magics...) After a request by John Hunter
1285 filesystem, magics...) After a request by John Hunter
1283 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1286 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1284
1287
1285 2005-02-05 Fernando Perez <fperez@colorado.edu>
1288 2005-02-05 Fernando Perez <fperez@colorado.edu>
1286
1289
1287 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1290 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1288 the call had quote characters in it (the quotes were stripped).
1291 the call had quote characters in it (the quotes were stripped).
1289
1292
1290 2005-01-31 Fernando Perez <fperez@colorado.edu>
1293 2005-01-31 Fernando Perez <fperez@colorado.edu>
1291
1294
1292 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1295 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1293 Itpl.itpl() to make the code more robust against psyco
1296 Itpl.itpl() to make the code more robust against psyco
1294 optimizations.
1297 optimizations.
1295
1298
1296 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1299 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1297 of causing an exception. Quicker, cleaner.
1300 of causing an exception. Quicker, cleaner.
1298
1301
1299 2005-01-28 Fernando Perez <fperez@colorado.edu>
1302 2005-01-28 Fernando Perez <fperez@colorado.edu>
1300
1303
1301 * scripts/ipython_win_post_install.py (install): hardcode
1304 * scripts/ipython_win_post_install.py (install): hardcode
1302 sys.prefix+'python.exe' as the executable path. It turns out that
1305 sys.prefix+'python.exe' as the executable path. It turns out that
1303 during the post-installation run, sys.executable resolves to the
1306 during the post-installation run, sys.executable resolves to the
1304 name of the binary installer! I should report this as a distutils
1307 name of the binary installer! I should report this as a distutils
1305 bug, I think. I updated the .10 release with this tiny fix, to
1308 bug, I think. I updated the .10 release with this tiny fix, to
1306 avoid annoying the lists further.
1309 avoid annoying the lists further.
1307
1310
1308 2005-01-27 *** Released version 0.6.10
1311 2005-01-27 *** Released version 0.6.10
1309
1312
1310 2005-01-27 Fernando Perez <fperez@colorado.edu>
1313 2005-01-27 Fernando Perez <fperez@colorado.edu>
1311
1314
1312 * IPython/numutils.py (norm): Added 'inf' as optional name for
1315 * IPython/numutils.py (norm): Added 'inf' as optional name for
1313 L-infinity norm, included references to mathworld.com for vector
1316 L-infinity norm, included references to mathworld.com for vector
1314 norm definitions.
1317 norm definitions.
1315 (amin/amax): added amin/amax for array min/max. Similar to what
1318 (amin/amax): added amin/amax for array min/max. Similar to what
1316 pylab ships with after the recent reorganization of names.
1319 pylab ships with after the recent reorganization of names.
1317 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1320 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1318
1321
1319 * ipython.el: committed Alex's recent fixes and improvements.
1322 * ipython.el: committed Alex's recent fixes and improvements.
1320 Tested with python-mode from CVS, and it looks excellent. Since
1323 Tested with python-mode from CVS, and it looks excellent. Since
1321 python-mode hasn't released anything in a while, I'm temporarily
1324 python-mode hasn't released anything in a while, I'm temporarily
1322 putting a copy of today's CVS (v 4.70) of python-mode in:
1325 putting a copy of today's CVS (v 4.70) of python-mode in:
1323 http://ipython.scipy.org/tmp/python-mode.el
1326 http://ipython.scipy.org/tmp/python-mode.el
1324
1327
1325 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1328 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1326 sys.executable for the executable name, instead of assuming it's
1329 sys.executable for the executable name, instead of assuming it's
1327 called 'python.exe' (the post-installer would have produced broken
1330 called 'python.exe' (the post-installer would have produced broken
1328 setups on systems with a differently named python binary).
1331 setups on systems with a differently named python binary).
1329
1332
1330 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1333 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1331 references to os.linesep, to make the code more
1334 references to os.linesep, to make the code more
1332 platform-independent. This is also part of the win32 coloring
1335 platform-independent. This is also part of the win32 coloring
1333 fixes.
1336 fixes.
1334
1337
1335 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1338 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1336 lines, which actually cause coloring bugs because the length of
1339 lines, which actually cause coloring bugs because the length of
1337 the line is very difficult to correctly compute with embedded
1340 the line is very difficult to correctly compute with embedded
1338 escapes. This was the source of all the coloring problems under
1341 escapes. This was the source of all the coloring problems under
1339 Win32. I think that _finally_, Win32 users have a properly
1342 Win32. I think that _finally_, Win32 users have a properly
1340 working ipython in all respects. This would never have happened
1343 working ipython in all respects. This would never have happened
1341 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1344 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1342
1345
1343 2005-01-26 *** Released version 0.6.9
1346 2005-01-26 *** Released version 0.6.9
1344
1347
1345 2005-01-25 Fernando Perez <fperez@colorado.edu>
1348 2005-01-25 Fernando Perez <fperez@colorado.edu>
1346
1349
1347 * setup.py: finally, we have a true Windows installer, thanks to
1350 * setup.py: finally, we have a true Windows installer, thanks to
1348 the excellent work of Viktor Ransmayr
1351 the excellent work of Viktor Ransmayr
1349 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1352 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1350 Windows users. The setup routine is quite a bit cleaner thanks to
1353 Windows users. The setup routine is quite a bit cleaner thanks to
1351 this, and the post-install script uses the proper functions to
1354 this, and the post-install script uses the proper functions to
1352 allow a clean de-installation using the standard Windows Control
1355 allow a clean de-installation using the standard Windows Control
1353 Panel.
1356 Panel.
1354
1357
1355 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1358 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1356 environment variable under all OSes (including win32) if
1359 environment variable under all OSes (including win32) if
1357 available. This will give consistency to win32 users who have set
1360 available. This will give consistency to win32 users who have set
1358 this variable for any reason. If os.environ['HOME'] fails, the
1361 this variable for any reason. If os.environ['HOME'] fails, the
1359 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1362 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1360
1363
1361 2005-01-24 Fernando Perez <fperez@colorado.edu>
1364 2005-01-24 Fernando Perez <fperez@colorado.edu>
1362
1365
1363 * IPython/numutils.py (empty_like): add empty_like(), similar to
1366 * IPython/numutils.py (empty_like): add empty_like(), similar to
1364 zeros_like() but taking advantage of the new empty() Numeric routine.
1367 zeros_like() but taking advantage of the new empty() Numeric routine.
1365
1368
1366 2005-01-23 *** Released version 0.6.8
1369 2005-01-23 *** Released version 0.6.8
1367
1370
1368 2005-01-22 Fernando Perez <fperez@colorado.edu>
1371 2005-01-22 Fernando Perez <fperez@colorado.edu>
1369
1372
1370 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1373 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1371 automatic show() calls. After discussing things with JDH, it
1374 automatic show() calls. After discussing things with JDH, it
1372 turns out there are too many corner cases where this can go wrong.
1375 turns out there are too many corner cases where this can go wrong.
1373 It's best not to try to be 'too smart', and simply have ipython
1376 It's best not to try to be 'too smart', and simply have ipython
1374 reproduce as much as possible the default behavior of a normal
1377 reproduce as much as possible the default behavior of a normal
1375 python shell.
1378 python shell.
1376
1379
1377 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1380 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1378 line-splitting regexp and _prefilter() to avoid calling getattr()
1381 line-splitting regexp and _prefilter() to avoid calling getattr()
1379 on assignments. This closes
1382 on assignments. This closes
1380 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1383 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1381 readline uses getattr(), so a simple <TAB> keypress is still
1384 readline uses getattr(), so a simple <TAB> keypress is still
1382 enough to trigger getattr() calls on an object.
1385 enough to trigger getattr() calls on an object.
1383
1386
1384 2005-01-21 Fernando Perez <fperez@colorado.edu>
1387 2005-01-21 Fernando Perez <fperez@colorado.edu>
1385
1388
1386 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1389 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1387 docstring under pylab so it doesn't mask the original.
1390 docstring under pylab so it doesn't mask the original.
1388
1391
1389 2005-01-21 *** Released version 0.6.7
1392 2005-01-21 *** Released version 0.6.7
1390
1393
1391 2005-01-21 Fernando Perez <fperez@colorado.edu>
1394 2005-01-21 Fernando Perez <fperez@colorado.edu>
1392
1395
1393 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1396 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1394 signal handling for win32 users in multithreaded mode.
1397 signal handling for win32 users in multithreaded mode.
1395
1398
1396 2005-01-17 Fernando Perez <fperez@colorado.edu>
1399 2005-01-17 Fernando Perez <fperez@colorado.edu>
1397
1400
1398 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1401 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1399 instances with no __init__. After a crash report by Norbert Nemec
1402 instances with no __init__. After a crash report by Norbert Nemec
1400 <Norbert-AT-nemec-online.de>.
1403 <Norbert-AT-nemec-online.de>.
1401
1404
1402 2005-01-14 Fernando Perez <fperez@colorado.edu>
1405 2005-01-14 Fernando Perez <fperez@colorado.edu>
1403
1406
1404 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1407 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1405 names for verbose exceptions, when multiple dotted names and the
1408 names for verbose exceptions, when multiple dotted names and the
1406 'parent' object were present on the same line.
1409 'parent' object were present on the same line.
1407
1410
1408 2005-01-11 Fernando Perez <fperez@colorado.edu>
1411 2005-01-11 Fernando Perez <fperez@colorado.edu>
1409
1412
1410 * IPython/genutils.py (flag_calls): new utility to trap and flag
1413 * IPython/genutils.py (flag_calls): new utility to trap and flag
1411 calls in functions. I need it to clean up matplotlib support.
1414 calls in functions. I need it to clean up matplotlib support.
1412 Also removed some deprecated code in genutils.
1415 Also removed some deprecated code in genutils.
1413
1416
1414 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1417 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1415 that matplotlib scripts called with %run, which don't call show()
1418 that matplotlib scripts called with %run, which don't call show()
1416 themselves, still have their plotting windows open.
1419 themselves, still have their plotting windows open.
1417
1420
1418 2005-01-05 Fernando Perez <fperez@colorado.edu>
1421 2005-01-05 Fernando Perez <fperez@colorado.edu>
1419
1422
1420 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1423 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1421 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1424 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1422
1425
1423 2004-12-19 Fernando Perez <fperez@colorado.edu>
1426 2004-12-19 Fernando Perez <fperez@colorado.edu>
1424
1427
1425 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1428 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1426 parent_runcode, which was an eyesore. The same result can be
1429 parent_runcode, which was an eyesore. The same result can be
1427 obtained with Python's regular superclass mechanisms.
1430 obtained with Python's regular superclass mechanisms.
1428
1431
1429 2004-12-17 Fernando Perez <fperez@colorado.edu>
1432 2004-12-17 Fernando Perez <fperez@colorado.edu>
1430
1433
1431 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1434 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1432 reported by Prabhu.
1435 reported by Prabhu.
1433 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1436 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1434 sys.stderr) instead of explicitly calling sys.stderr. This helps
1437 sys.stderr) instead of explicitly calling sys.stderr. This helps
1435 maintain our I/O abstractions clean, for future GUI embeddings.
1438 maintain our I/O abstractions clean, for future GUI embeddings.
1436
1439
1437 * IPython/genutils.py (info): added new utility for sys.stderr
1440 * IPython/genutils.py (info): added new utility for sys.stderr
1438 unified info message handling (thin wrapper around warn()).
1441 unified info message handling (thin wrapper around warn()).
1439
1442
1440 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1443 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1441 composite (dotted) names on verbose exceptions.
1444 composite (dotted) names on verbose exceptions.
1442 (VerboseTB.nullrepr): harden against another kind of errors which
1445 (VerboseTB.nullrepr): harden against another kind of errors which
1443 Python's inspect module can trigger, and which were crashing
1446 Python's inspect module can trigger, and which were crashing
1444 IPython. Thanks to a report by Marco Lombardi
1447 IPython. Thanks to a report by Marco Lombardi
1445 <mlombard-AT-ma010192.hq.eso.org>.
1448 <mlombard-AT-ma010192.hq.eso.org>.
1446
1449
1447 2004-12-13 *** Released version 0.6.6
1450 2004-12-13 *** Released version 0.6.6
1448
1451
1449 2004-12-12 Fernando Perez <fperez@colorado.edu>
1452 2004-12-12 Fernando Perez <fperez@colorado.edu>
1450
1453
1451 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1454 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1452 generated by pygtk upon initialization if it was built without
1455 generated by pygtk upon initialization if it was built without
1453 threads (for matplotlib users). After a crash reported by
1456 threads (for matplotlib users). After a crash reported by
1454 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1457 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1455
1458
1456 * IPython/ipmaker.py (make_IPython): fix small bug in the
1459 * IPython/ipmaker.py (make_IPython): fix small bug in the
1457 import_some parameter for multiple imports.
1460 import_some parameter for multiple imports.
1458
1461
1459 * IPython/iplib.py (ipmagic): simplified the interface of
1462 * IPython/iplib.py (ipmagic): simplified the interface of
1460 ipmagic() to take a single string argument, just as it would be
1463 ipmagic() to take a single string argument, just as it would be
1461 typed at the IPython cmd line.
1464 typed at the IPython cmd line.
1462 (ipalias): Added new ipalias() with an interface identical to
1465 (ipalias): Added new ipalias() with an interface identical to
1463 ipmagic(). This completes exposing a pure python interface to the
1466 ipmagic(). This completes exposing a pure python interface to the
1464 alias and magic system, which can be used in loops or more complex
1467 alias and magic system, which can be used in loops or more complex
1465 code where IPython's automatic line mangling is not active.
1468 code where IPython's automatic line mangling is not active.
1466
1469
1467 * IPython/genutils.py (timing): changed interface of timing to
1470 * IPython/genutils.py (timing): changed interface of timing to
1468 simply run code once, which is the most common case. timings()
1471 simply run code once, which is the most common case. timings()
1469 remains unchanged, for the cases where you want multiple runs.
1472 remains unchanged, for the cases where you want multiple runs.
1470
1473
1471 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1474 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1472 bug where Python2.2 crashes with exec'ing code which does not end
1475 bug where Python2.2 crashes with exec'ing code which does not end
1473 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1476 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1474 before.
1477 before.
1475
1478
1476 2004-12-10 Fernando Perez <fperez@colorado.edu>
1479 2004-12-10 Fernando Perez <fperez@colorado.edu>
1477
1480
1478 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1481 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1479 -t to -T, to accomodate the new -t flag in %run (the %run and
1482 -t to -T, to accomodate the new -t flag in %run (the %run and
1480 %prun options are kind of intermixed, and it's not easy to change
1483 %prun options are kind of intermixed, and it's not easy to change
1481 this with the limitations of python's getopt).
1484 this with the limitations of python's getopt).
1482
1485
1483 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1486 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1484 the execution of scripts. It's not as fine-tuned as timeit.py,
1487 the execution of scripts. It's not as fine-tuned as timeit.py,
1485 but it works from inside ipython (and under 2.2, which lacks
1488 but it works from inside ipython (and under 2.2, which lacks
1486 timeit.py). Optionally a number of runs > 1 can be given for
1489 timeit.py). Optionally a number of runs > 1 can be given for
1487 timing very short-running code.
1490 timing very short-running code.
1488
1491
1489 * IPython/genutils.py (uniq_stable): new routine which returns a
1492 * IPython/genutils.py (uniq_stable): new routine which returns a
1490 list of unique elements in any iterable, but in stable order of
1493 list of unique elements in any iterable, but in stable order of
1491 appearance. I needed this for the ultraTB fixes, and it's a handy
1494 appearance. I needed this for the ultraTB fixes, and it's a handy
1492 utility.
1495 utility.
1493
1496
1494 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1497 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1495 dotted names in Verbose exceptions. This had been broken since
1498 dotted names in Verbose exceptions. This had been broken since
1496 the very start, now x.y will properly be printed in a Verbose
1499 the very start, now x.y will properly be printed in a Verbose
1497 traceback, instead of x being shown and y appearing always as an
1500 traceback, instead of x being shown and y appearing always as an
1498 'undefined global'. Getting this to work was a bit tricky,
1501 'undefined global'. Getting this to work was a bit tricky,
1499 because by default python tokenizers are stateless. Saved by
1502 because by default python tokenizers are stateless. Saved by
1500 python's ability to easily add a bit of state to an arbitrary
1503 python's ability to easily add a bit of state to an arbitrary
1501 function (without needing to build a full-blown callable object).
1504 function (without needing to build a full-blown callable object).
1502
1505
1503 Also big cleanup of this code, which had horrendous runtime
1506 Also big cleanup of this code, which had horrendous runtime
1504 lookups of zillions of attributes for colorization. Moved all
1507 lookups of zillions of attributes for colorization. Moved all
1505 this code into a few templates, which make it cleaner and quicker.
1508 this code into a few templates, which make it cleaner and quicker.
1506
1509
1507 Printout quality was also improved for Verbose exceptions: one
1510 Printout quality was also improved for Verbose exceptions: one
1508 variable per line, and memory addresses are printed (this can be
1511 variable per line, and memory addresses are printed (this can be
1509 quite handy in nasty debugging situations, which is what Verbose
1512 quite handy in nasty debugging situations, which is what Verbose
1510 is for).
1513 is for).
1511
1514
1512 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1515 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1513 the command line as scripts to be loaded by embedded instances.
1516 the command line as scripts to be loaded by embedded instances.
1514 Doing so has the potential for an infinite recursion if there are
1517 Doing so has the potential for an infinite recursion if there are
1515 exceptions thrown in the process. This fixes a strange crash
1518 exceptions thrown in the process. This fixes a strange crash
1516 reported by Philippe MULLER <muller-AT-irit.fr>.
1519 reported by Philippe MULLER <muller-AT-irit.fr>.
1517
1520
1518 2004-12-09 Fernando Perez <fperez@colorado.edu>
1521 2004-12-09 Fernando Perez <fperez@colorado.edu>
1519
1522
1520 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1523 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1521 to reflect new names in matplotlib, which now expose the
1524 to reflect new names in matplotlib, which now expose the
1522 matlab-compatible interface via a pylab module instead of the
1525 matlab-compatible interface via a pylab module instead of the
1523 'matlab' name. The new code is backwards compatible, so users of
1526 'matlab' name. The new code is backwards compatible, so users of
1524 all matplotlib versions are OK. Patch by J. Hunter.
1527 all matplotlib versions are OK. Patch by J. Hunter.
1525
1528
1526 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1529 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1527 of __init__ docstrings for instances (class docstrings are already
1530 of __init__ docstrings for instances (class docstrings are already
1528 automatically printed). Instances with customized docstrings
1531 automatically printed). Instances with customized docstrings
1529 (indep. of the class) are also recognized and all 3 separate
1532 (indep. of the class) are also recognized and all 3 separate
1530 docstrings are printed (instance, class, constructor). After some
1533 docstrings are printed (instance, class, constructor). After some
1531 comments/suggestions by J. Hunter.
1534 comments/suggestions by J. Hunter.
1532
1535
1533 2004-12-05 Fernando Perez <fperez@colorado.edu>
1536 2004-12-05 Fernando Perez <fperez@colorado.edu>
1534
1537
1535 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1538 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1536 warnings when tab-completion fails and triggers an exception.
1539 warnings when tab-completion fails and triggers an exception.
1537
1540
1538 2004-12-03 Fernando Perez <fperez@colorado.edu>
1541 2004-12-03 Fernando Perez <fperez@colorado.edu>
1539
1542
1540 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1543 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1541 be triggered when using 'run -p'. An incorrect option flag was
1544 be triggered when using 'run -p'. An incorrect option flag was
1542 being set ('d' instead of 'D').
1545 being set ('d' instead of 'D').
1543 (manpage): fix missing escaped \- sign.
1546 (manpage): fix missing escaped \- sign.
1544
1547
1545 2004-11-30 *** Released version 0.6.5
1548 2004-11-30 *** Released version 0.6.5
1546
1549
1547 2004-11-30 Fernando Perez <fperez@colorado.edu>
1550 2004-11-30 Fernando Perez <fperez@colorado.edu>
1548
1551
1549 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1552 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1550 setting with -d option.
1553 setting with -d option.
1551
1554
1552 * setup.py (docfiles): Fix problem where the doc glob I was using
1555 * setup.py (docfiles): Fix problem where the doc glob I was using
1553 was COMPLETELY BROKEN. It was giving the right files by pure
1556 was COMPLETELY BROKEN. It was giving the right files by pure
1554 accident, but failed once I tried to include ipython.el. Note:
1557 accident, but failed once I tried to include ipython.el. Note:
1555 glob() does NOT allow you to do exclusion on multiple endings!
1558 glob() does NOT allow you to do exclusion on multiple endings!
1556
1559
1557 2004-11-29 Fernando Perez <fperez@colorado.edu>
1560 2004-11-29 Fernando Perez <fperez@colorado.edu>
1558
1561
1559 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1562 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1560 the manpage as the source. Better formatting & consistency.
1563 the manpage as the source. Better formatting & consistency.
1561
1564
1562 * IPython/Magic.py (magic_run): Added new -d option, to run
1565 * IPython/Magic.py (magic_run): Added new -d option, to run
1563 scripts under the control of the python pdb debugger. Note that
1566 scripts under the control of the python pdb debugger. Note that
1564 this required changing the %prun option -d to -D, to avoid a clash
1567 this required changing the %prun option -d to -D, to avoid a clash
1565 (since %run must pass options to %prun, and getopt is too dumb to
1568 (since %run must pass options to %prun, and getopt is too dumb to
1566 handle options with string values with embedded spaces). Thanks
1569 handle options with string values with embedded spaces). Thanks
1567 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1570 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1568 (magic_who_ls): added type matching to %who and %whos, so that one
1571 (magic_who_ls): added type matching to %who and %whos, so that one
1569 can filter their output to only include variables of certain
1572 can filter their output to only include variables of certain
1570 types. Another suggestion by Matthew.
1573 types. Another suggestion by Matthew.
1571 (magic_whos): Added memory summaries in kb and Mb for arrays.
1574 (magic_whos): Added memory summaries in kb and Mb for arrays.
1572 (magic_who): Improve formatting (break lines every 9 vars).
1575 (magic_who): Improve formatting (break lines every 9 vars).
1573
1576
1574 2004-11-28 Fernando Perez <fperez@colorado.edu>
1577 2004-11-28 Fernando Perez <fperez@colorado.edu>
1575
1578
1576 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1579 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1577 cache when empty lines were present.
1580 cache when empty lines were present.
1578
1581
1579 2004-11-24 Fernando Perez <fperez@colorado.edu>
1582 2004-11-24 Fernando Perez <fperez@colorado.edu>
1580
1583
1581 * IPython/usage.py (__doc__): document the re-activated threading
1584 * IPython/usage.py (__doc__): document the re-activated threading
1582 options for WX and GTK.
1585 options for WX and GTK.
1583
1586
1584 2004-11-23 Fernando Perez <fperez@colorado.edu>
1587 2004-11-23 Fernando Perez <fperez@colorado.edu>
1585
1588
1586 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1589 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1587 the -wthread and -gthread options, along with a new -tk one to try
1590 the -wthread and -gthread options, along with a new -tk one to try
1588 and coordinate Tk threading with wx/gtk. The tk support is very
1591 and coordinate Tk threading with wx/gtk. The tk support is very
1589 platform dependent, since it seems to require Tcl and Tk to be
1592 platform dependent, since it seems to require Tcl and Tk to be
1590 built with threads (Fedora1/2 appears NOT to have it, but in
1593 built with threads (Fedora1/2 appears NOT to have it, but in
1591 Prabhu's Debian boxes it works OK). But even with some Tk
1594 Prabhu's Debian boxes it works OK). But even with some Tk
1592 limitations, this is a great improvement.
1595 limitations, this is a great improvement.
1593
1596
1594 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1597 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1595 info in user prompts. Patch by Prabhu.
1598 info in user prompts. Patch by Prabhu.
1596
1599
1597 2004-11-18 Fernando Perez <fperez@colorado.edu>
1600 2004-11-18 Fernando Perez <fperez@colorado.edu>
1598
1601
1599 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1602 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1600 EOFErrors and bail, to avoid infinite loops if a non-terminating
1603 EOFErrors and bail, to avoid infinite loops if a non-terminating
1601 file is fed into ipython. Patch submitted in issue 19 by user,
1604 file is fed into ipython. Patch submitted in issue 19 by user,
1602 many thanks.
1605 many thanks.
1603
1606
1604 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1607 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1605 autoquote/parens in continuation prompts, which can cause lots of
1608 autoquote/parens in continuation prompts, which can cause lots of
1606 problems. Closes roundup issue 20.
1609 problems. Closes roundup issue 20.
1607
1610
1608 2004-11-17 Fernando Perez <fperez@colorado.edu>
1611 2004-11-17 Fernando Perez <fperez@colorado.edu>
1609
1612
1610 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1613 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1611 reported as debian bug #280505. I'm not sure my local changelog
1614 reported as debian bug #280505. I'm not sure my local changelog
1612 entry has the proper debian format (Jack?).
1615 entry has the proper debian format (Jack?).
1613
1616
1614 2004-11-08 *** Released version 0.6.4
1617 2004-11-08 *** Released version 0.6.4
1615
1618
1616 2004-11-08 Fernando Perez <fperez@colorado.edu>
1619 2004-11-08 Fernando Perez <fperez@colorado.edu>
1617
1620
1618 * IPython/iplib.py (init_readline): Fix exit message for Windows
1621 * IPython/iplib.py (init_readline): Fix exit message for Windows
1619 when readline is active. Thanks to a report by Eric Jones
1622 when readline is active. Thanks to a report by Eric Jones
1620 <eric-AT-enthought.com>.
1623 <eric-AT-enthought.com>.
1621
1624
1622 2004-11-07 Fernando Perez <fperez@colorado.edu>
1625 2004-11-07 Fernando Perez <fperez@colorado.edu>
1623
1626
1624 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1627 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1625 sometimes seen by win2k/cygwin users.
1628 sometimes seen by win2k/cygwin users.
1626
1629
1627 2004-11-06 Fernando Perez <fperez@colorado.edu>
1630 2004-11-06 Fernando Perez <fperez@colorado.edu>
1628
1631
1629 * IPython/iplib.py (interact): Change the handling of %Exit from
1632 * IPython/iplib.py (interact): Change the handling of %Exit from
1630 trying to propagate a SystemExit to an internal ipython flag.
1633 trying to propagate a SystemExit to an internal ipython flag.
1631 This is less elegant than using Python's exception mechanism, but
1634 This is less elegant than using Python's exception mechanism, but
1632 I can't get that to work reliably with threads, so under -pylab
1635 I can't get that to work reliably with threads, so under -pylab
1633 %Exit was hanging IPython. Cross-thread exception handling is
1636 %Exit was hanging IPython. Cross-thread exception handling is
1634 really a bitch. Thaks to a bug report by Stephen Walton
1637 really a bitch. Thaks to a bug report by Stephen Walton
1635 <stephen.walton-AT-csun.edu>.
1638 <stephen.walton-AT-csun.edu>.
1636
1639
1637 2004-11-04 Fernando Perez <fperez@colorado.edu>
1640 2004-11-04 Fernando Perez <fperez@colorado.edu>
1638
1641
1639 * IPython/iplib.py (raw_input_original): store a pointer to the
1642 * IPython/iplib.py (raw_input_original): store a pointer to the
1640 true raw_input to harden against code which can modify it
1643 true raw_input to harden against code which can modify it
1641 (wx.py.PyShell does this and would otherwise crash ipython).
1644 (wx.py.PyShell does this and would otherwise crash ipython).
1642 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1645 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1643
1646
1644 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1647 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1645 Ctrl-C problem, which does not mess up the input line.
1648 Ctrl-C problem, which does not mess up the input line.
1646
1649
1647 2004-11-03 Fernando Perez <fperez@colorado.edu>
1650 2004-11-03 Fernando Perez <fperez@colorado.edu>
1648
1651
1649 * IPython/Release.py: Changed licensing to BSD, in all files.
1652 * IPython/Release.py: Changed licensing to BSD, in all files.
1650 (name): lowercase name for tarball/RPM release.
1653 (name): lowercase name for tarball/RPM release.
1651
1654
1652 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1655 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1653 use throughout ipython.
1656 use throughout ipython.
1654
1657
1655 * IPython/Magic.py (Magic._ofind): Switch to using the new
1658 * IPython/Magic.py (Magic._ofind): Switch to using the new
1656 OInspect.getdoc() function.
1659 OInspect.getdoc() function.
1657
1660
1658 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1661 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1659 of the line currently being canceled via Ctrl-C. It's extremely
1662 of the line currently being canceled via Ctrl-C. It's extremely
1660 ugly, but I don't know how to do it better (the problem is one of
1663 ugly, but I don't know how to do it better (the problem is one of
1661 handling cross-thread exceptions).
1664 handling cross-thread exceptions).
1662
1665
1663 2004-10-28 Fernando Perez <fperez@colorado.edu>
1666 2004-10-28 Fernando Perez <fperez@colorado.edu>
1664
1667
1665 * IPython/Shell.py (signal_handler): add signal handlers to trap
1668 * IPython/Shell.py (signal_handler): add signal handlers to trap
1666 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1669 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1667 report by Francesc Alted.
1670 report by Francesc Alted.
1668
1671
1669 2004-10-21 Fernando Perez <fperez@colorado.edu>
1672 2004-10-21 Fernando Perez <fperez@colorado.edu>
1670
1673
1671 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1674 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1672 to % for pysh syntax extensions.
1675 to % for pysh syntax extensions.
1673
1676
1674 2004-10-09 Fernando Perez <fperez@colorado.edu>
1677 2004-10-09 Fernando Perez <fperez@colorado.edu>
1675
1678
1676 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1679 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1677 arrays to print a more useful summary, without calling str(arr).
1680 arrays to print a more useful summary, without calling str(arr).
1678 This avoids the problem of extremely lengthy computations which
1681 This avoids the problem of extremely lengthy computations which
1679 occur if arr is large, and appear to the user as a system lockup
1682 occur if arr is large, and appear to the user as a system lockup
1680 with 100% cpu activity. After a suggestion by Kristian Sandberg
1683 with 100% cpu activity. After a suggestion by Kristian Sandberg
1681 <Kristian.Sandberg@colorado.edu>.
1684 <Kristian.Sandberg@colorado.edu>.
1682 (Magic.__init__): fix bug in global magic escapes not being
1685 (Magic.__init__): fix bug in global magic escapes not being
1683 correctly set.
1686 correctly set.
1684
1687
1685 2004-10-08 Fernando Perez <fperez@colorado.edu>
1688 2004-10-08 Fernando Perez <fperez@colorado.edu>
1686
1689
1687 * IPython/Magic.py (__license__): change to absolute imports of
1690 * IPython/Magic.py (__license__): change to absolute imports of
1688 ipython's own internal packages, to start adapting to the absolute
1691 ipython's own internal packages, to start adapting to the absolute
1689 import requirement of PEP-328.
1692 import requirement of PEP-328.
1690
1693
1691 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1694 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1692 files, and standardize author/license marks through the Release
1695 files, and standardize author/license marks through the Release
1693 module instead of having per/file stuff (except for files with
1696 module instead of having per/file stuff (except for files with
1694 particular licenses, like the MIT/PSF-licensed codes).
1697 particular licenses, like the MIT/PSF-licensed codes).
1695
1698
1696 * IPython/Debugger.py: remove dead code for python 2.1
1699 * IPython/Debugger.py: remove dead code for python 2.1
1697
1700
1698 2004-10-04 Fernando Perez <fperez@colorado.edu>
1701 2004-10-04 Fernando Perez <fperez@colorado.edu>
1699
1702
1700 * IPython/iplib.py (ipmagic): New function for accessing magics
1703 * IPython/iplib.py (ipmagic): New function for accessing magics
1701 via a normal python function call.
1704 via a normal python function call.
1702
1705
1703 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1706 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1704 from '@' to '%', to accomodate the new @decorator syntax of python
1707 from '@' to '%', to accomodate the new @decorator syntax of python
1705 2.4.
1708 2.4.
1706
1709
1707 2004-09-29 Fernando Perez <fperez@colorado.edu>
1710 2004-09-29 Fernando Perez <fperez@colorado.edu>
1708
1711
1709 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1712 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1710 matplotlib.use to prevent running scripts which try to switch
1713 matplotlib.use to prevent running scripts which try to switch
1711 interactive backends from within ipython. This will just crash
1714 interactive backends from within ipython. This will just crash
1712 the python interpreter, so we can't allow it (but a detailed error
1715 the python interpreter, so we can't allow it (but a detailed error
1713 is given to the user).
1716 is given to the user).
1714
1717
1715 2004-09-28 Fernando Perez <fperez@colorado.edu>
1718 2004-09-28 Fernando Perez <fperez@colorado.edu>
1716
1719
1717 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1720 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1718 matplotlib-related fixes so that using @run with non-matplotlib
1721 matplotlib-related fixes so that using @run with non-matplotlib
1719 scripts doesn't pop up spurious plot windows. This requires
1722 scripts doesn't pop up spurious plot windows. This requires
1720 matplotlib >= 0.63, where I had to make some changes as well.
1723 matplotlib >= 0.63, where I had to make some changes as well.
1721
1724
1722 * IPython/ipmaker.py (make_IPython): update version requirement to
1725 * IPython/ipmaker.py (make_IPython): update version requirement to
1723 python 2.2.
1726 python 2.2.
1724
1727
1725 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1728 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1726 banner arg for embedded customization.
1729 banner arg for embedded customization.
1727
1730
1728 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1731 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1729 explicit uses of __IP as the IPython's instance name. Now things
1732 explicit uses of __IP as the IPython's instance name. Now things
1730 are properly handled via the shell.name value. The actual code
1733 are properly handled via the shell.name value. The actual code
1731 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1734 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1732 is much better than before. I'll clean things completely when the
1735 is much better than before. I'll clean things completely when the
1733 magic stuff gets a real overhaul.
1736 magic stuff gets a real overhaul.
1734
1737
1735 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1738 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1736 minor changes to debian dir.
1739 minor changes to debian dir.
1737
1740
1738 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1741 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1739 pointer to the shell itself in the interactive namespace even when
1742 pointer to the shell itself in the interactive namespace even when
1740 a user-supplied dict is provided. This is needed for embedding
1743 a user-supplied dict is provided. This is needed for embedding
1741 purposes (found by tests with Michel Sanner).
1744 purposes (found by tests with Michel Sanner).
1742
1745
1743 2004-09-27 Fernando Perez <fperez@colorado.edu>
1746 2004-09-27 Fernando Perez <fperez@colorado.edu>
1744
1747
1745 * IPython/UserConfig/ipythonrc: remove []{} from
1748 * IPython/UserConfig/ipythonrc: remove []{} from
1746 readline_remove_delims, so that things like [modname.<TAB> do
1749 readline_remove_delims, so that things like [modname.<TAB> do
1747 proper completion. This disables [].TAB, but that's a less common
1750 proper completion. This disables [].TAB, but that's a less common
1748 case than module names in list comprehensions, for example.
1751 case than module names in list comprehensions, for example.
1749 Thanks to a report by Andrea Riciputi.
1752 Thanks to a report by Andrea Riciputi.
1750
1753
1751 2004-09-09 Fernando Perez <fperez@colorado.edu>
1754 2004-09-09 Fernando Perez <fperez@colorado.edu>
1752
1755
1753 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1756 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1754 blocking problems in win32 and osx. Fix by John.
1757 blocking problems in win32 and osx. Fix by John.
1755
1758
1756 2004-09-08 Fernando Perez <fperez@colorado.edu>
1759 2004-09-08 Fernando Perez <fperez@colorado.edu>
1757
1760
1758 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1761 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1759 for Win32 and OSX. Fix by John Hunter.
1762 for Win32 and OSX. Fix by John Hunter.
1760
1763
1761 2004-08-30 *** Released version 0.6.3
1764 2004-08-30 *** Released version 0.6.3
1762
1765
1763 2004-08-30 Fernando Perez <fperez@colorado.edu>
1766 2004-08-30 Fernando Perez <fperez@colorado.edu>
1764
1767
1765 * setup.py (isfile): Add manpages to list of dependent files to be
1768 * setup.py (isfile): Add manpages to list of dependent files to be
1766 updated.
1769 updated.
1767
1770
1768 2004-08-27 Fernando Perez <fperez@colorado.edu>
1771 2004-08-27 Fernando Perez <fperez@colorado.edu>
1769
1772
1770 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1773 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1771 for now. They don't really work with standalone WX/GTK code
1774 for now. They don't really work with standalone WX/GTK code
1772 (though matplotlib IS working fine with both of those backends).
1775 (though matplotlib IS working fine with both of those backends).
1773 This will neeed much more testing. I disabled most things with
1776 This will neeed much more testing. I disabled most things with
1774 comments, so turning it back on later should be pretty easy.
1777 comments, so turning it back on later should be pretty easy.
1775
1778
1776 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1779 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1777 autocalling of expressions like r'foo', by modifying the line
1780 autocalling of expressions like r'foo', by modifying the line
1778 split regexp. Closes
1781 split regexp. Closes
1779 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1782 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1780 Riley <ipythonbugs-AT-sabi.net>.
1783 Riley <ipythonbugs-AT-sabi.net>.
1781 (InteractiveShell.mainloop): honor --nobanner with banner
1784 (InteractiveShell.mainloop): honor --nobanner with banner
1782 extensions.
1785 extensions.
1783
1786
1784 * IPython/Shell.py: Significant refactoring of all classes, so
1787 * IPython/Shell.py: Significant refactoring of all classes, so
1785 that we can really support ALL matplotlib backends and threading
1788 that we can really support ALL matplotlib backends and threading
1786 models (John spotted a bug with Tk which required this). Now we
1789 models (John spotted a bug with Tk which required this). Now we
1787 should support single-threaded, WX-threads and GTK-threads, both
1790 should support single-threaded, WX-threads and GTK-threads, both
1788 for generic code and for matplotlib.
1791 for generic code and for matplotlib.
1789
1792
1790 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1793 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1791 -pylab, to simplify things for users. Will also remove the pylab
1794 -pylab, to simplify things for users. Will also remove the pylab
1792 profile, since now all of matplotlib configuration is directly
1795 profile, since now all of matplotlib configuration is directly
1793 handled here. This also reduces startup time.
1796 handled here. This also reduces startup time.
1794
1797
1795 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1798 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1796 shell wasn't being correctly called. Also in IPShellWX.
1799 shell wasn't being correctly called. Also in IPShellWX.
1797
1800
1798 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1801 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1799 fine-tune banner.
1802 fine-tune banner.
1800
1803
1801 * IPython/numutils.py (spike): Deprecate these spike functions,
1804 * IPython/numutils.py (spike): Deprecate these spike functions,
1802 delete (long deprecated) gnuplot_exec handler.
1805 delete (long deprecated) gnuplot_exec handler.
1803
1806
1804 2004-08-26 Fernando Perez <fperez@colorado.edu>
1807 2004-08-26 Fernando Perez <fperez@colorado.edu>
1805
1808
1806 * ipython.1: Update for threading options, plus some others which
1809 * ipython.1: Update for threading options, plus some others which
1807 were missing.
1810 were missing.
1808
1811
1809 * IPython/ipmaker.py (__call__): Added -wthread option for
1812 * IPython/ipmaker.py (__call__): Added -wthread option for
1810 wxpython thread handling. Make sure threading options are only
1813 wxpython thread handling. Make sure threading options are only
1811 valid at the command line.
1814 valid at the command line.
1812
1815
1813 * scripts/ipython: moved shell selection into a factory function
1816 * scripts/ipython: moved shell selection into a factory function
1814 in Shell.py, to keep the starter script to a minimum.
1817 in Shell.py, to keep the starter script to a minimum.
1815
1818
1816 2004-08-25 Fernando Perez <fperez@colorado.edu>
1819 2004-08-25 Fernando Perez <fperez@colorado.edu>
1817
1820
1818 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1821 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1819 John. Along with some recent changes he made to matplotlib, the
1822 John. Along with some recent changes he made to matplotlib, the
1820 next versions of both systems should work very well together.
1823 next versions of both systems should work very well together.
1821
1824
1822 2004-08-24 Fernando Perez <fperez@colorado.edu>
1825 2004-08-24 Fernando Perez <fperez@colorado.edu>
1823
1826
1824 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1827 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1825 tried to switch the profiling to using hotshot, but I'm getting
1828 tried to switch the profiling to using hotshot, but I'm getting
1826 strange errors from prof.runctx() there. I may be misreading the
1829 strange errors from prof.runctx() there. I may be misreading the
1827 docs, but it looks weird. For now the profiling code will
1830 docs, but it looks weird. For now the profiling code will
1828 continue to use the standard profiler.
1831 continue to use the standard profiler.
1829
1832
1830 2004-08-23 Fernando Perez <fperez@colorado.edu>
1833 2004-08-23 Fernando Perez <fperez@colorado.edu>
1831
1834
1832 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1835 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1833 threaded shell, by John Hunter. It's not quite ready yet, but
1836 threaded shell, by John Hunter. It's not quite ready yet, but
1834 close.
1837 close.
1835
1838
1836 2004-08-22 Fernando Perez <fperez@colorado.edu>
1839 2004-08-22 Fernando Perez <fperez@colorado.edu>
1837
1840
1838 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1841 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1839 in Magic and ultraTB.
1842 in Magic and ultraTB.
1840
1843
1841 * ipython.1: document threading options in manpage.
1844 * ipython.1: document threading options in manpage.
1842
1845
1843 * scripts/ipython: Changed name of -thread option to -gthread,
1846 * scripts/ipython: Changed name of -thread option to -gthread,
1844 since this is GTK specific. I want to leave the door open for a
1847 since this is GTK specific. I want to leave the door open for a
1845 -wthread option for WX, which will most likely be necessary. This
1848 -wthread option for WX, which will most likely be necessary. This
1846 change affects usage and ipmaker as well.
1849 change affects usage and ipmaker as well.
1847
1850
1848 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1851 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1849 handle the matplotlib shell issues. Code by John Hunter
1852 handle the matplotlib shell issues. Code by John Hunter
1850 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1853 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1851 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1854 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1852 broken (and disabled for end users) for now, but it puts the
1855 broken (and disabled for end users) for now, but it puts the
1853 infrastructure in place.
1856 infrastructure in place.
1854
1857
1855 2004-08-21 Fernando Perez <fperez@colorado.edu>
1858 2004-08-21 Fernando Perez <fperez@colorado.edu>
1856
1859
1857 * ipythonrc-pylab: Add matplotlib support.
1860 * ipythonrc-pylab: Add matplotlib support.
1858
1861
1859 * matplotlib_config.py: new files for matplotlib support, part of
1862 * matplotlib_config.py: new files for matplotlib support, part of
1860 the pylab profile.
1863 the pylab profile.
1861
1864
1862 * IPython/usage.py (__doc__): documented the threading options.
1865 * IPython/usage.py (__doc__): documented the threading options.
1863
1866
1864 2004-08-20 Fernando Perez <fperez@colorado.edu>
1867 2004-08-20 Fernando Perez <fperez@colorado.edu>
1865
1868
1866 * ipython: Modified the main calling routine to handle the -thread
1869 * ipython: Modified the main calling routine to handle the -thread
1867 and -mpthread options. This needs to be done as a top-level hack,
1870 and -mpthread options. This needs to be done as a top-level hack,
1868 because it determines which class to instantiate for IPython
1871 because it determines which class to instantiate for IPython
1869 itself.
1872 itself.
1870
1873
1871 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1874 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1872 classes to support multithreaded GTK operation without blocking,
1875 classes to support multithreaded GTK operation without blocking,
1873 and matplotlib with all backends. This is a lot of still very
1876 and matplotlib with all backends. This is a lot of still very
1874 experimental code, and threads are tricky. So it may still have a
1877 experimental code, and threads are tricky. So it may still have a
1875 few rough edges... This code owes a lot to
1878 few rough edges... This code owes a lot to
1876 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1879 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1877 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1880 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1878 to John Hunter for all the matplotlib work.
1881 to John Hunter for all the matplotlib work.
1879
1882
1880 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1883 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1881 options for gtk thread and matplotlib support.
1884 options for gtk thread and matplotlib support.
1882
1885
1883 2004-08-16 Fernando Perez <fperez@colorado.edu>
1886 2004-08-16 Fernando Perez <fperez@colorado.edu>
1884
1887
1885 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1888 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1886 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1889 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1887 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1890 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1888
1891
1889 2004-08-11 Fernando Perez <fperez@colorado.edu>
1892 2004-08-11 Fernando Perez <fperez@colorado.edu>
1890
1893
1891 * setup.py (isfile): Fix build so documentation gets updated for
1894 * setup.py (isfile): Fix build so documentation gets updated for
1892 rpms (it was only done for .tgz builds).
1895 rpms (it was only done for .tgz builds).
1893
1896
1894 2004-08-10 Fernando Perez <fperez@colorado.edu>
1897 2004-08-10 Fernando Perez <fperez@colorado.edu>
1895
1898
1896 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1899 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1897
1900
1898 * iplib.py : Silence syntax error exceptions in tab-completion.
1901 * iplib.py : Silence syntax error exceptions in tab-completion.
1899
1902
1900 2004-08-05 Fernando Perez <fperez@colorado.edu>
1903 2004-08-05 Fernando Perez <fperez@colorado.edu>
1901
1904
1902 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1905 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1903 'color off' mark for continuation prompts. This was causing long
1906 'color off' mark for continuation prompts. This was causing long
1904 continuation lines to mis-wrap.
1907 continuation lines to mis-wrap.
1905
1908
1906 2004-08-01 Fernando Perez <fperez@colorado.edu>
1909 2004-08-01 Fernando Perez <fperez@colorado.edu>
1907
1910
1908 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1911 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1909 for building ipython to be a parameter. All this is necessary
1912 for building ipython to be a parameter. All this is necessary
1910 right now to have a multithreaded version, but this insane
1913 right now to have a multithreaded version, but this insane
1911 non-design will be cleaned up soon. For now, it's a hack that
1914 non-design will be cleaned up soon. For now, it's a hack that
1912 works.
1915 works.
1913
1916
1914 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1917 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1915 args in various places. No bugs so far, but it's a dangerous
1918 args in various places. No bugs so far, but it's a dangerous
1916 practice.
1919 practice.
1917
1920
1918 2004-07-31 Fernando Perez <fperez@colorado.edu>
1921 2004-07-31 Fernando Perez <fperez@colorado.edu>
1919
1922
1920 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1923 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1921 fix completion of files with dots in their names under most
1924 fix completion of files with dots in their names under most
1922 profiles (pysh was OK because the completion order is different).
1925 profiles (pysh was OK because the completion order is different).
1923
1926
1924 2004-07-27 Fernando Perez <fperez@colorado.edu>
1927 2004-07-27 Fernando Perez <fperez@colorado.edu>
1925
1928
1926 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1929 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1927 keywords manually, b/c the one in keyword.py was removed in python
1930 keywords manually, b/c the one in keyword.py was removed in python
1928 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1931 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1929 This is NOT a bug under python 2.3 and earlier.
1932 This is NOT a bug under python 2.3 and earlier.
1930
1933
1931 2004-07-26 Fernando Perez <fperez@colorado.edu>
1934 2004-07-26 Fernando Perez <fperez@colorado.edu>
1932
1935
1933 * IPython/ultraTB.py (VerboseTB.text): Add another
1936 * IPython/ultraTB.py (VerboseTB.text): Add another
1934 linecache.checkcache() call to try to prevent inspect.py from
1937 linecache.checkcache() call to try to prevent inspect.py from
1935 crashing under python 2.3. I think this fixes
1938 crashing under python 2.3. I think this fixes
1936 http://www.scipy.net/roundup/ipython/issue17.
1939 http://www.scipy.net/roundup/ipython/issue17.
1937
1940
1938 2004-07-26 *** Released version 0.6.2
1941 2004-07-26 *** Released version 0.6.2
1939
1942
1940 2004-07-26 Fernando Perez <fperez@colorado.edu>
1943 2004-07-26 Fernando Perez <fperez@colorado.edu>
1941
1944
1942 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1945 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1943 fail for any number.
1946 fail for any number.
1944 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1947 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1945 empty bookmarks.
1948 empty bookmarks.
1946
1949
1947 2004-07-26 *** Released version 0.6.1
1950 2004-07-26 *** Released version 0.6.1
1948
1951
1949 2004-07-26 Fernando Perez <fperez@colorado.edu>
1952 2004-07-26 Fernando Perez <fperez@colorado.edu>
1950
1953
1951 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1954 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1952
1955
1953 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1956 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1954 escaping '()[]{}' in filenames.
1957 escaping '()[]{}' in filenames.
1955
1958
1956 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1959 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1957 Python 2.2 users who lack a proper shlex.split.
1960 Python 2.2 users who lack a proper shlex.split.
1958
1961
1959 2004-07-19 Fernando Perez <fperez@colorado.edu>
1962 2004-07-19 Fernando Perez <fperez@colorado.edu>
1960
1963
1961 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1964 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1962 for reading readline's init file. I follow the normal chain:
1965 for reading readline's init file. I follow the normal chain:
1963 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1966 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1964 report by Mike Heeter. This closes
1967 report by Mike Heeter. This closes
1965 http://www.scipy.net/roundup/ipython/issue16.
1968 http://www.scipy.net/roundup/ipython/issue16.
1966
1969
1967 2004-07-18 Fernando Perez <fperez@colorado.edu>
1970 2004-07-18 Fernando Perez <fperez@colorado.edu>
1968
1971
1969 * IPython/iplib.py (__init__): Add better handling of '\' under
1972 * IPython/iplib.py (__init__): Add better handling of '\' under
1970 Win32 for filenames. After a patch by Ville.
1973 Win32 for filenames. After a patch by Ville.
1971
1974
1972 2004-07-17 Fernando Perez <fperez@colorado.edu>
1975 2004-07-17 Fernando Perez <fperez@colorado.edu>
1973
1976
1974 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1977 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1975 autocalling would be triggered for 'foo is bar' if foo is
1978 autocalling would be triggered for 'foo is bar' if foo is
1976 callable. I also cleaned up the autocall detection code to use a
1979 callable. I also cleaned up the autocall detection code to use a
1977 regexp, which is faster. Bug reported by Alexander Schmolck.
1980 regexp, which is faster. Bug reported by Alexander Schmolck.
1978
1981
1979 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1982 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1980 '?' in them would confuse the help system. Reported by Alex
1983 '?' in them would confuse the help system. Reported by Alex
1981 Schmolck.
1984 Schmolck.
1982
1985
1983 2004-07-16 Fernando Perez <fperez@colorado.edu>
1986 2004-07-16 Fernando Perez <fperez@colorado.edu>
1984
1987
1985 * IPython/GnuplotInteractive.py (__all__): added plot2.
1988 * IPython/GnuplotInteractive.py (__all__): added plot2.
1986
1989
1987 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1990 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1988 plotting dictionaries, lists or tuples of 1d arrays.
1991 plotting dictionaries, lists or tuples of 1d arrays.
1989
1992
1990 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1993 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1991 optimizations.
1994 optimizations.
1992
1995
1993 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1996 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1994 the information which was there from Janko's original IPP code:
1997 the information which was there from Janko's original IPP code:
1995
1998
1996 03.05.99 20:53 porto.ifm.uni-kiel.de
1999 03.05.99 20:53 porto.ifm.uni-kiel.de
1997 --Started changelog.
2000 --Started changelog.
1998 --make clear do what it say it does
2001 --make clear do what it say it does
1999 --added pretty output of lines from inputcache
2002 --added pretty output of lines from inputcache
2000 --Made Logger a mixin class, simplifies handling of switches
2003 --Made Logger a mixin class, simplifies handling of switches
2001 --Added own completer class. .string<TAB> expands to last history
2004 --Added own completer class. .string<TAB> expands to last history
2002 line which starts with string. The new expansion is also present
2005 line which starts with string. The new expansion is also present
2003 with Ctrl-r from the readline library. But this shows, who this
2006 with Ctrl-r from the readline library. But this shows, who this
2004 can be done for other cases.
2007 can be done for other cases.
2005 --Added convention that all shell functions should accept a
2008 --Added convention that all shell functions should accept a
2006 parameter_string This opens the door for different behaviour for
2009 parameter_string This opens the door for different behaviour for
2007 each function. @cd is a good example of this.
2010 each function. @cd is a good example of this.
2008
2011
2009 04.05.99 12:12 porto.ifm.uni-kiel.de
2012 04.05.99 12:12 porto.ifm.uni-kiel.de
2010 --added logfile rotation
2013 --added logfile rotation
2011 --added new mainloop method which freezes first the namespace
2014 --added new mainloop method which freezes first the namespace
2012
2015
2013 07.05.99 21:24 porto.ifm.uni-kiel.de
2016 07.05.99 21:24 porto.ifm.uni-kiel.de
2014 --added the docreader classes. Now there is a help system.
2017 --added the docreader classes. Now there is a help system.
2015 -This is only a first try. Currently it's not easy to put new
2018 -This is only a first try. Currently it's not easy to put new
2016 stuff in the indices. But this is the way to go. Info would be
2019 stuff in the indices. But this is the way to go. Info would be
2017 better, but HTML is every where and not everybody has an info
2020 better, but HTML is every where and not everybody has an info
2018 system installed and it's not so easy to change html-docs to info.
2021 system installed and it's not so easy to change html-docs to info.
2019 --added global logfile option
2022 --added global logfile option
2020 --there is now a hook for object inspection method pinfo needs to
2023 --there is now a hook for object inspection method pinfo needs to
2021 be provided for this. Can be reached by two '??'.
2024 be provided for this. Can be reached by two '??'.
2022
2025
2023 08.05.99 20:51 porto.ifm.uni-kiel.de
2026 08.05.99 20:51 porto.ifm.uni-kiel.de
2024 --added a README
2027 --added a README
2025 --bug in rc file. Something has changed so functions in the rc
2028 --bug in rc file. Something has changed so functions in the rc
2026 file need to reference the shell and not self. Not clear if it's a
2029 file need to reference the shell and not self. Not clear if it's a
2027 bug or feature.
2030 bug or feature.
2028 --changed rc file for new behavior
2031 --changed rc file for new behavior
2029
2032
2030 2004-07-15 Fernando Perez <fperez@colorado.edu>
2033 2004-07-15 Fernando Perez <fperez@colorado.edu>
2031
2034
2032 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2035 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2033 cache was falling out of sync in bizarre manners when multi-line
2036 cache was falling out of sync in bizarre manners when multi-line
2034 input was present. Minor optimizations and cleanup.
2037 input was present. Minor optimizations and cleanup.
2035
2038
2036 (Logger): Remove old Changelog info for cleanup. This is the
2039 (Logger): Remove old Changelog info for cleanup. This is the
2037 information which was there from Janko's original code:
2040 information which was there from Janko's original code:
2038
2041
2039 Changes to Logger: - made the default log filename a parameter
2042 Changes to Logger: - made the default log filename a parameter
2040
2043
2041 - put a check for lines beginning with !@? in log(). Needed
2044 - put a check for lines beginning with !@? in log(). Needed
2042 (even if the handlers properly log their lines) for mid-session
2045 (even if the handlers properly log their lines) for mid-session
2043 logging activation to work properly. Without this, lines logged
2046 logging activation to work properly. Without this, lines logged
2044 in mid session, which get read from the cache, would end up
2047 in mid session, which get read from the cache, would end up
2045 'bare' (with !@? in the open) in the log. Now they are caught
2048 'bare' (with !@? in the open) in the log. Now they are caught
2046 and prepended with a #.
2049 and prepended with a #.
2047
2050
2048 * IPython/iplib.py (InteractiveShell.init_readline): added check
2051 * IPython/iplib.py (InteractiveShell.init_readline): added check
2049 in case MagicCompleter fails to be defined, so we don't crash.
2052 in case MagicCompleter fails to be defined, so we don't crash.
2050
2053
2051 2004-07-13 Fernando Perez <fperez@colorado.edu>
2054 2004-07-13 Fernando Perez <fperez@colorado.edu>
2052
2055
2053 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2056 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2054 of EPS if the requested filename ends in '.eps'.
2057 of EPS if the requested filename ends in '.eps'.
2055
2058
2056 2004-07-04 Fernando Perez <fperez@colorado.edu>
2059 2004-07-04 Fernando Perez <fperez@colorado.edu>
2057
2060
2058 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2061 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2059 escaping of quotes when calling the shell.
2062 escaping of quotes when calling the shell.
2060
2063
2061 2004-07-02 Fernando Perez <fperez@colorado.edu>
2064 2004-07-02 Fernando Perez <fperez@colorado.edu>
2062
2065
2063 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2066 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2064 gettext not working because we were clobbering '_'. Fixes
2067 gettext not working because we were clobbering '_'. Fixes
2065 http://www.scipy.net/roundup/ipython/issue6.
2068 http://www.scipy.net/roundup/ipython/issue6.
2066
2069
2067 2004-07-01 Fernando Perez <fperez@colorado.edu>
2070 2004-07-01 Fernando Perez <fperez@colorado.edu>
2068
2071
2069 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2072 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2070 into @cd. Patch by Ville.
2073 into @cd. Patch by Ville.
2071
2074
2072 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2075 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2073 new function to store things after ipmaker runs. Patch by Ville.
2076 new function to store things after ipmaker runs. Patch by Ville.
2074 Eventually this will go away once ipmaker is removed and the class
2077 Eventually this will go away once ipmaker is removed and the class
2075 gets cleaned up, but for now it's ok. Key functionality here is
2078 gets cleaned up, but for now it's ok. Key functionality here is
2076 the addition of the persistent storage mechanism, a dict for
2079 the addition of the persistent storage mechanism, a dict for
2077 keeping data across sessions (for now just bookmarks, but more can
2080 keeping data across sessions (for now just bookmarks, but more can
2078 be implemented later).
2081 be implemented later).
2079
2082
2080 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2083 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2081 persistent across sections. Patch by Ville, I modified it
2084 persistent across sections. Patch by Ville, I modified it
2082 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2085 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2083 added a '-l' option to list all bookmarks.
2086 added a '-l' option to list all bookmarks.
2084
2087
2085 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2088 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2086 center for cleanup. Registered with atexit.register(). I moved
2089 center for cleanup. Registered with atexit.register(). I moved
2087 here the old exit_cleanup(). After a patch by Ville.
2090 here the old exit_cleanup(). After a patch by Ville.
2088
2091
2089 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2092 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2090 characters in the hacked shlex_split for python 2.2.
2093 characters in the hacked shlex_split for python 2.2.
2091
2094
2092 * IPython/iplib.py (file_matches): more fixes to filenames with
2095 * IPython/iplib.py (file_matches): more fixes to filenames with
2093 whitespace in them. It's not perfect, but limitations in python's
2096 whitespace in them. It's not perfect, but limitations in python's
2094 readline make it impossible to go further.
2097 readline make it impossible to go further.
2095
2098
2096 2004-06-29 Fernando Perez <fperez@colorado.edu>
2099 2004-06-29 Fernando Perez <fperez@colorado.edu>
2097
2100
2098 * IPython/iplib.py (file_matches): escape whitespace correctly in
2101 * IPython/iplib.py (file_matches): escape whitespace correctly in
2099 filename completions. Bug reported by Ville.
2102 filename completions. Bug reported by Ville.
2100
2103
2101 2004-06-28 Fernando Perez <fperez@colorado.edu>
2104 2004-06-28 Fernando Perez <fperez@colorado.edu>
2102
2105
2103 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2106 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2104 the history file will be called 'history-PROFNAME' (or just
2107 the history file will be called 'history-PROFNAME' (or just
2105 'history' if no profile is loaded). I was getting annoyed at
2108 'history' if no profile is loaded). I was getting annoyed at
2106 getting my Numerical work history clobbered by pysh sessions.
2109 getting my Numerical work history clobbered by pysh sessions.
2107
2110
2108 * IPython/iplib.py (InteractiveShell.__init__): Internal
2111 * IPython/iplib.py (InteractiveShell.__init__): Internal
2109 getoutputerror() function so that we can honor the system_verbose
2112 getoutputerror() function so that we can honor the system_verbose
2110 flag for _all_ system calls. I also added escaping of #
2113 flag for _all_ system calls. I also added escaping of #
2111 characters here to avoid confusing Itpl.
2114 characters here to avoid confusing Itpl.
2112
2115
2113 * IPython/Magic.py (shlex_split): removed call to shell in
2116 * IPython/Magic.py (shlex_split): removed call to shell in
2114 parse_options and replaced it with shlex.split(). The annoying
2117 parse_options and replaced it with shlex.split(). The annoying
2115 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2118 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2116 to backport it from 2.3, with several frail hacks (the shlex
2119 to backport it from 2.3, with several frail hacks (the shlex
2117 module is rather limited in 2.2). Thanks to a suggestion by Ville
2120 module is rather limited in 2.2). Thanks to a suggestion by Ville
2118 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2121 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2119 problem.
2122 problem.
2120
2123
2121 (Magic.magic_system_verbose): new toggle to print the actual
2124 (Magic.magic_system_verbose): new toggle to print the actual
2122 system calls made by ipython. Mainly for debugging purposes.
2125 system calls made by ipython. Mainly for debugging purposes.
2123
2126
2124 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2127 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2125 doesn't support persistence. Reported (and fix suggested) by
2128 doesn't support persistence. Reported (and fix suggested) by
2126 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2129 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2127
2130
2128 2004-06-26 Fernando Perez <fperez@colorado.edu>
2131 2004-06-26 Fernando Perez <fperez@colorado.edu>
2129
2132
2130 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2133 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2131 continue prompts.
2134 continue prompts.
2132
2135
2133 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2136 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2134 function (basically a big docstring) and a few more things here to
2137 function (basically a big docstring) and a few more things here to
2135 speedup startup. pysh.py is now very lightweight. We want because
2138 speedup startup. pysh.py is now very lightweight. We want because
2136 it gets execfile'd, while InterpreterExec gets imported, so
2139 it gets execfile'd, while InterpreterExec gets imported, so
2137 byte-compilation saves time.
2140 byte-compilation saves time.
2138
2141
2139 2004-06-25 Fernando Perez <fperez@colorado.edu>
2142 2004-06-25 Fernando Perez <fperez@colorado.edu>
2140
2143
2141 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2144 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2142 -NUM', which was recently broken.
2145 -NUM', which was recently broken.
2143
2146
2144 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2147 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2145 in multi-line input (but not !!, which doesn't make sense there).
2148 in multi-line input (but not !!, which doesn't make sense there).
2146
2149
2147 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2150 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2148 It's just too useful, and people can turn it off in the less
2151 It's just too useful, and people can turn it off in the less
2149 common cases where it's a problem.
2152 common cases where it's a problem.
2150
2153
2151 2004-06-24 Fernando Perez <fperez@colorado.edu>
2154 2004-06-24 Fernando Perez <fperez@colorado.edu>
2152
2155
2153 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2156 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2154 special syntaxes (like alias calling) is now allied in multi-line
2157 special syntaxes (like alias calling) is now allied in multi-line
2155 input. This is still _very_ experimental, but it's necessary for
2158 input. This is still _very_ experimental, but it's necessary for
2156 efficient shell usage combining python looping syntax with system
2159 efficient shell usage combining python looping syntax with system
2157 calls. For now it's restricted to aliases, I don't think it
2160 calls. For now it's restricted to aliases, I don't think it
2158 really even makes sense to have this for magics.
2161 really even makes sense to have this for magics.
2159
2162
2160 2004-06-23 Fernando Perez <fperez@colorado.edu>
2163 2004-06-23 Fernando Perez <fperez@colorado.edu>
2161
2164
2162 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2165 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2163 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2166 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2164
2167
2165 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2168 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2166 extensions under Windows (after code sent by Gary Bishop). The
2169 extensions under Windows (after code sent by Gary Bishop). The
2167 extensions considered 'executable' are stored in IPython's rc
2170 extensions considered 'executable' are stored in IPython's rc
2168 structure as win_exec_ext.
2171 structure as win_exec_ext.
2169
2172
2170 * IPython/genutils.py (shell): new function, like system() but
2173 * IPython/genutils.py (shell): new function, like system() but
2171 without return value. Very useful for interactive shell work.
2174 without return value. Very useful for interactive shell work.
2172
2175
2173 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2176 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2174 delete aliases.
2177 delete aliases.
2175
2178
2176 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2179 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2177 sure that the alias table doesn't contain python keywords.
2180 sure that the alias table doesn't contain python keywords.
2178
2181
2179 2004-06-21 Fernando Perez <fperez@colorado.edu>
2182 2004-06-21 Fernando Perez <fperez@colorado.edu>
2180
2183
2181 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2184 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2182 non-existent items are found in $PATH. Reported by Thorsten.
2185 non-existent items are found in $PATH. Reported by Thorsten.
2183
2186
2184 2004-06-20 Fernando Perez <fperez@colorado.edu>
2187 2004-06-20 Fernando Perez <fperez@colorado.edu>
2185
2188
2186 * IPython/iplib.py (complete): modified the completer so that the
2189 * IPython/iplib.py (complete): modified the completer so that the
2187 order of priorities can be easily changed at runtime.
2190 order of priorities can be easily changed at runtime.
2188
2191
2189 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2192 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2190 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2193 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2191
2194
2192 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2195 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2193 expand Python variables prepended with $ in all system calls. The
2196 expand Python variables prepended with $ in all system calls. The
2194 same was done to InteractiveShell.handle_shell_escape. Now all
2197 same was done to InteractiveShell.handle_shell_escape. Now all
2195 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2198 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2196 expansion of python variables and expressions according to the
2199 expansion of python variables and expressions according to the
2197 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2200 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2198
2201
2199 Though PEP-215 has been rejected, a similar (but simpler) one
2202 Though PEP-215 has been rejected, a similar (but simpler) one
2200 seems like it will go into Python 2.4, PEP-292 -
2203 seems like it will go into Python 2.4, PEP-292 -
2201 http://www.python.org/peps/pep-0292.html.
2204 http://www.python.org/peps/pep-0292.html.
2202
2205
2203 I'll keep the full syntax of PEP-215, since IPython has since the
2206 I'll keep the full syntax of PEP-215, since IPython has since the
2204 start used Ka-Ping Yee's reference implementation discussed there
2207 start used Ka-Ping Yee's reference implementation discussed there
2205 (Itpl), and I actually like the powerful semantics it offers.
2208 (Itpl), and I actually like the powerful semantics it offers.
2206
2209
2207 In order to access normal shell variables, the $ has to be escaped
2210 In order to access normal shell variables, the $ has to be escaped
2208 via an extra $. For example:
2211 via an extra $. For example:
2209
2212
2210 In [7]: PATH='a python variable'
2213 In [7]: PATH='a python variable'
2211
2214
2212 In [8]: !echo $PATH
2215 In [8]: !echo $PATH
2213 a python variable
2216 a python variable
2214
2217
2215 In [9]: !echo $$PATH
2218 In [9]: !echo $$PATH
2216 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2219 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2217
2220
2218 (Magic.parse_options): escape $ so the shell doesn't evaluate
2221 (Magic.parse_options): escape $ so the shell doesn't evaluate
2219 things prematurely.
2222 things prematurely.
2220
2223
2221 * IPython/iplib.py (InteractiveShell.call_alias): added the
2224 * IPython/iplib.py (InteractiveShell.call_alias): added the
2222 ability for aliases to expand python variables via $.
2225 ability for aliases to expand python variables via $.
2223
2226
2224 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2227 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2225 system, now there's a @rehash/@rehashx pair of magics. These work
2228 system, now there's a @rehash/@rehashx pair of magics. These work
2226 like the csh rehash command, and can be invoked at any time. They
2229 like the csh rehash command, and can be invoked at any time. They
2227 build a table of aliases to everything in the user's $PATH
2230 build a table of aliases to everything in the user's $PATH
2228 (@rehash uses everything, @rehashx is slower but only adds
2231 (@rehash uses everything, @rehashx is slower but only adds
2229 executable files). With this, the pysh.py-based shell profile can
2232 executable files). With this, the pysh.py-based shell profile can
2230 now simply call rehash upon startup, and full access to all
2233 now simply call rehash upon startup, and full access to all
2231 programs in the user's path is obtained.
2234 programs in the user's path is obtained.
2232
2235
2233 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2236 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2234 functionality is now fully in place. I removed the old dynamic
2237 functionality is now fully in place. I removed the old dynamic
2235 code generation based approach, in favor of a much lighter one
2238 code generation based approach, in favor of a much lighter one
2236 based on a simple dict. The advantage is that this allows me to
2239 based on a simple dict. The advantage is that this allows me to
2237 now have thousands of aliases with negligible cost (unthinkable
2240 now have thousands of aliases with negligible cost (unthinkable
2238 with the old system).
2241 with the old system).
2239
2242
2240 2004-06-19 Fernando Perez <fperez@colorado.edu>
2243 2004-06-19 Fernando Perez <fperez@colorado.edu>
2241
2244
2242 * IPython/iplib.py (__init__): extended MagicCompleter class to
2245 * IPython/iplib.py (__init__): extended MagicCompleter class to
2243 also complete (last in priority) on user aliases.
2246 also complete (last in priority) on user aliases.
2244
2247
2245 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2248 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2246 call to eval.
2249 call to eval.
2247 (ItplNS.__init__): Added a new class which functions like Itpl,
2250 (ItplNS.__init__): Added a new class which functions like Itpl,
2248 but allows configuring the namespace for the evaluation to occur
2251 but allows configuring the namespace for the evaluation to occur
2249 in.
2252 in.
2250
2253
2251 2004-06-18 Fernando Perez <fperez@colorado.edu>
2254 2004-06-18 Fernando Perez <fperez@colorado.edu>
2252
2255
2253 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2256 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2254 better message when 'exit' or 'quit' are typed (a common newbie
2257 better message when 'exit' or 'quit' are typed (a common newbie
2255 confusion).
2258 confusion).
2256
2259
2257 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2260 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2258 check for Windows users.
2261 check for Windows users.
2259
2262
2260 * IPython/iplib.py (InteractiveShell.user_setup): removed
2263 * IPython/iplib.py (InteractiveShell.user_setup): removed
2261 disabling of colors for Windows. I'll test at runtime and issue a
2264 disabling of colors for Windows. I'll test at runtime and issue a
2262 warning if Gary's readline isn't found, as to nudge users to
2265 warning if Gary's readline isn't found, as to nudge users to
2263 download it.
2266 download it.
2264
2267
2265 2004-06-16 Fernando Perez <fperez@colorado.edu>
2268 2004-06-16 Fernando Perez <fperez@colorado.edu>
2266
2269
2267 * IPython/genutils.py (Stream.__init__): changed to print errors
2270 * IPython/genutils.py (Stream.__init__): changed to print errors
2268 to sys.stderr. I had a circular dependency here. Now it's
2271 to sys.stderr. I had a circular dependency here. Now it's
2269 possible to run ipython as IDLE's shell (consider this pre-alpha,
2272 possible to run ipython as IDLE's shell (consider this pre-alpha,
2270 since true stdout things end up in the starting terminal instead
2273 since true stdout things end up in the starting terminal instead
2271 of IDLE's out).
2274 of IDLE's out).
2272
2275
2273 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2276 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2274 users who haven't # updated their prompt_in2 definitions. Remove
2277 users who haven't # updated their prompt_in2 definitions. Remove
2275 eventually.
2278 eventually.
2276 (multiple_replace): added credit to original ASPN recipe.
2279 (multiple_replace): added credit to original ASPN recipe.
2277
2280
2278 2004-06-15 Fernando Perez <fperez@colorado.edu>
2281 2004-06-15 Fernando Perez <fperez@colorado.edu>
2279
2282
2280 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2283 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2281 list of auto-defined aliases.
2284 list of auto-defined aliases.
2282
2285
2283 2004-06-13 Fernando Perez <fperez@colorado.edu>
2286 2004-06-13 Fernando Perez <fperez@colorado.edu>
2284
2287
2285 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2288 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2286 install was really requested (so setup.py can be used for other
2289 install was really requested (so setup.py can be used for other
2287 things under Windows).
2290 things under Windows).
2288
2291
2289 2004-06-10 Fernando Perez <fperez@colorado.edu>
2292 2004-06-10 Fernando Perez <fperez@colorado.edu>
2290
2293
2291 * IPython/Logger.py (Logger.create_log): Manually remove any old
2294 * IPython/Logger.py (Logger.create_log): Manually remove any old
2292 backup, since os.remove may fail under Windows. Fixes bug
2295 backup, since os.remove may fail under Windows. Fixes bug
2293 reported by Thorsten.
2296 reported by Thorsten.
2294
2297
2295 2004-06-09 Fernando Perez <fperez@colorado.edu>
2298 2004-06-09 Fernando Perez <fperez@colorado.edu>
2296
2299
2297 * examples/example-embed.py: fixed all references to %n (replaced
2300 * examples/example-embed.py: fixed all references to %n (replaced
2298 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2301 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2299 for all examples and the manual as well.
2302 for all examples and the manual as well.
2300
2303
2301 2004-06-08 Fernando Perez <fperez@colorado.edu>
2304 2004-06-08 Fernando Perez <fperez@colorado.edu>
2302
2305
2303 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2306 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2304 alignment and color management. All 3 prompt subsystems now
2307 alignment and color management. All 3 prompt subsystems now
2305 inherit from BasePrompt.
2308 inherit from BasePrompt.
2306
2309
2307 * tools/release: updates for windows installer build and tag rpms
2310 * tools/release: updates for windows installer build and tag rpms
2308 with python version (since paths are fixed).
2311 with python version (since paths are fixed).
2309
2312
2310 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2313 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2311 which will become eventually obsolete. Also fixed the default
2314 which will become eventually obsolete. Also fixed the default
2312 prompt_in2 to use \D, so at least new users start with the correct
2315 prompt_in2 to use \D, so at least new users start with the correct
2313 defaults.
2316 defaults.
2314 WARNING: Users with existing ipythonrc files will need to apply
2317 WARNING: Users with existing ipythonrc files will need to apply
2315 this fix manually!
2318 this fix manually!
2316
2319
2317 * setup.py: make windows installer (.exe). This is finally the
2320 * setup.py: make windows installer (.exe). This is finally the
2318 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2321 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2319 which I hadn't included because it required Python 2.3 (or recent
2322 which I hadn't included because it required Python 2.3 (or recent
2320 distutils).
2323 distutils).
2321
2324
2322 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2325 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2323 usage of new '\D' escape.
2326 usage of new '\D' escape.
2324
2327
2325 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2328 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2326 lacks os.getuid())
2329 lacks os.getuid())
2327 (CachedOutput.set_colors): Added the ability to turn coloring
2330 (CachedOutput.set_colors): Added the ability to turn coloring
2328 on/off with @colors even for manually defined prompt colors. It
2331 on/off with @colors even for manually defined prompt colors. It
2329 uses a nasty global, but it works safely and via the generic color
2332 uses a nasty global, but it works safely and via the generic color
2330 handling mechanism.
2333 handling mechanism.
2331 (Prompt2.__init__): Introduced new escape '\D' for continuation
2334 (Prompt2.__init__): Introduced new escape '\D' for continuation
2332 prompts. It represents the counter ('\#') as dots.
2335 prompts. It represents the counter ('\#') as dots.
2333 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2336 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2334 need to update their ipythonrc files and replace '%n' with '\D' in
2337 need to update their ipythonrc files and replace '%n' with '\D' in
2335 their prompt_in2 settings everywhere. Sorry, but there's
2338 their prompt_in2 settings everywhere. Sorry, but there's
2336 otherwise no clean way to get all prompts to properly align. The
2339 otherwise no clean way to get all prompts to properly align. The
2337 ipythonrc shipped with IPython has been updated.
2340 ipythonrc shipped with IPython has been updated.
2338
2341
2339 2004-06-07 Fernando Perez <fperez@colorado.edu>
2342 2004-06-07 Fernando Perez <fperez@colorado.edu>
2340
2343
2341 * setup.py (isfile): Pass local_icons option to latex2html, so the
2344 * setup.py (isfile): Pass local_icons option to latex2html, so the
2342 resulting HTML file is self-contained. Thanks to
2345 resulting HTML file is self-contained. Thanks to
2343 dryice-AT-liu.com.cn for the tip.
2346 dryice-AT-liu.com.cn for the tip.
2344
2347
2345 * pysh.py: I created a new profile 'shell', which implements a
2348 * pysh.py: I created a new profile 'shell', which implements a
2346 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2349 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2347 system shell, nor will it become one anytime soon. It's mainly
2350 system shell, nor will it become one anytime soon. It's mainly
2348 meant to illustrate the use of the new flexible bash-like prompts.
2351 meant to illustrate the use of the new flexible bash-like prompts.
2349 I guess it could be used by hardy souls for true shell management,
2352 I guess it could be used by hardy souls for true shell management,
2350 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2353 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2351 profile. This uses the InterpreterExec extension provided by
2354 profile. This uses the InterpreterExec extension provided by
2352 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2355 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2353
2356
2354 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2357 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2355 auto-align itself with the length of the previous input prompt
2358 auto-align itself with the length of the previous input prompt
2356 (taking into account the invisible color escapes).
2359 (taking into account the invisible color escapes).
2357 (CachedOutput.__init__): Large restructuring of this class. Now
2360 (CachedOutput.__init__): Large restructuring of this class. Now
2358 all three prompts (primary1, primary2, output) are proper objects,
2361 all three prompts (primary1, primary2, output) are proper objects,
2359 managed by the 'parent' CachedOutput class. The code is still a
2362 managed by the 'parent' CachedOutput class. The code is still a
2360 bit hackish (all prompts share state via a pointer to the cache),
2363 bit hackish (all prompts share state via a pointer to the cache),
2361 but it's overall far cleaner than before.
2364 but it's overall far cleaner than before.
2362
2365
2363 * IPython/genutils.py (getoutputerror): modified to add verbose,
2366 * IPython/genutils.py (getoutputerror): modified to add verbose,
2364 debug and header options. This makes the interface of all getout*
2367 debug and header options. This makes the interface of all getout*
2365 functions uniform.
2368 functions uniform.
2366 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2369 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2367
2370
2368 * IPython/Magic.py (Magic.default_option): added a function to
2371 * IPython/Magic.py (Magic.default_option): added a function to
2369 allow registering default options for any magic command. This
2372 allow registering default options for any magic command. This
2370 makes it easy to have profiles which customize the magics globally
2373 makes it easy to have profiles which customize the magics globally
2371 for a certain use. The values set through this function are
2374 for a certain use. The values set through this function are
2372 picked up by the parse_options() method, which all magics should
2375 picked up by the parse_options() method, which all magics should
2373 use to parse their options.
2376 use to parse their options.
2374
2377
2375 * IPython/genutils.py (warn): modified the warnings framework to
2378 * IPython/genutils.py (warn): modified the warnings framework to
2376 use the Term I/O class. I'm trying to slowly unify all of
2379 use the Term I/O class. I'm trying to slowly unify all of
2377 IPython's I/O operations to pass through Term.
2380 IPython's I/O operations to pass through Term.
2378
2381
2379 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2382 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2380 the secondary prompt to correctly match the length of the primary
2383 the secondary prompt to correctly match the length of the primary
2381 one for any prompt. Now multi-line code will properly line up
2384 one for any prompt. Now multi-line code will properly line up
2382 even for path dependent prompts, such as the new ones available
2385 even for path dependent prompts, such as the new ones available
2383 via the prompt_specials.
2386 via the prompt_specials.
2384
2387
2385 2004-06-06 Fernando Perez <fperez@colorado.edu>
2388 2004-06-06 Fernando Perez <fperez@colorado.edu>
2386
2389
2387 * IPython/Prompts.py (prompt_specials): Added the ability to have
2390 * IPython/Prompts.py (prompt_specials): Added the ability to have
2388 bash-like special sequences in the prompts, which get
2391 bash-like special sequences in the prompts, which get
2389 automatically expanded. Things like hostname, current working
2392 automatically expanded. Things like hostname, current working
2390 directory and username are implemented already, but it's easy to
2393 directory and username are implemented already, but it's easy to
2391 add more in the future. Thanks to a patch by W.J. van der Laan
2394 add more in the future. Thanks to a patch by W.J. van der Laan
2392 <gnufnork-AT-hetdigitalegat.nl>
2395 <gnufnork-AT-hetdigitalegat.nl>
2393 (prompt_specials): Added color support for prompt strings, so
2396 (prompt_specials): Added color support for prompt strings, so
2394 users can define arbitrary color setups for their prompts.
2397 users can define arbitrary color setups for their prompts.
2395
2398
2396 2004-06-05 Fernando Perez <fperez@colorado.edu>
2399 2004-06-05 Fernando Perez <fperez@colorado.edu>
2397
2400
2398 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2401 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2399 code to load Gary Bishop's readline and configure it
2402 code to load Gary Bishop's readline and configure it
2400 automatically. Thanks to Gary for help on this.
2403 automatically. Thanks to Gary for help on this.
2401
2404
2402 2004-06-01 Fernando Perez <fperez@colorado.edu>
2405 2004-06-01 Fernando Perez <fperez@colorado.edu>
2403
2406
2404 * IPython/Logger.py (Logger.create_log): fix bug for logging
2407 * IPython/Logger.py (Logger.create_log): fix bug for logging
2405 with no filename (previous fix was incomplete).
2408 with no filename (previous fix was incomplete).
2406
2409
2407 2004-05-25 Fernando Perez <fperez@colorado.edu>
2410 2004-05-25 Fernando Perez <fperez@colorado.edu>
2408
2411
2409 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2412 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2410 parens would get passed to the shell.
2413 parens would get passed to the shell.
2411
2414
2412 2004-05-20 Fernando Perez <fperez@colorado.edu>
2415 2004-05-20 Fernando Perez <fperez@colorado.edu>
2413
2416
2414 * IPython/Magic.py (Magic.magic_prun): changed default profile
2417 * IPython/Magic.py (Magic.magic_prun): changed default profile
2415 sort order to 'time' (the more common profiling need).
2418 sort order to 'time' (the more common profiling need).
2416
2419
2417 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2420 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2418 so that source code shown is guaranteed in sync with the file on
2421 so that source code shown is guaranteed in sync with the file on
2419 disk (also changed in psource). Similar fix to the one for
2422 disk (also changed in psource). Similar fix to the one for
2420 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2423 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2421 <yann.ledu-AT-noos.fr>.
2424 <yann.ledu-AT-noos.fr>.
2422
2425
2423 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2426 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2424 with a single option would not be correctly parsed. Closes
2427 with a single option would not be correctly parsed. Closes
2425 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2428 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2426 introduced in 0.6.0 (on 2004-05-06).
2429 introduced in 0.6.0 (on 2004-05-06).
2427
2430
2428 2004-05-13 *** Released version 0.6.0
2431 2004-05-13 *** Released version 0.6.0
2429
2432
2430 2004-05-13 Fernando Perez <fperez@colorado.edu>
2433 2004-05-13 Fernando Perez <fperez@colorado.edu>
2431
2434
2432 * debian/: Added debian/ directory to CVS, so that debian support
2435 * debian/: Added debian/ directory to CVS, so that debian support
2433 is publicly accessible. The debian package is maintained by Jack
2436 is publicly accessible. The debian package is maintained by Jack
2434 Moffit <jack-AT-xiph.org>.
2437 Moffit <jack-AT-xiph.org>.
2435
2438
2436 * Documentation: included the notes about an ipython-based system
2439 * Documentation: included the notes about an ipython-based system
2437 shell (the hypothetical 'pysh') into the new_design.pdf document,
2440 shell (the hypothetical 'pysh') into the new_design.pdf document,
2438 so that these ideas get distributed to users along with the
2441 so that these ideas get distributed to users along with the
2439 official documentation.
2442 official documentation.
2440
2443
2441 2004-05-10 Fernando Perez <fperez@colorado.edu>
2444 2004-05-10 Fernando Perez <fperez@colorado.edu>
2442
2445
2443 * IPython/Logger.py (Logger.create_log): fix recently introduced
2446 * IPython/Logger.py (Logger.create_log): fix recently introduced
2444 bug (misindented line) where logstart would fail when not given an
2447 bug (misindented line) where logstart would fail when not given an
2445 explicit filename.
2448 explicit filename.
2446
2449
2447 2004-05-09 Fernando Perez <fperez@colorado.edu>
2450 2004-05-09 Fernando Perez <fperez@colorado.edu>
2448
2451
2449 * IPython/Magic.py (Magic.parse_options): skip system call when
2452 * IPython/Magic.py (Magic.parse_options): skip system call when
2450 there are no options to look for. Faster, cleaner for the common
2453 there are no options to look for. Faster, cleaner for the common
2451 case.
2454 case.
2452
2455
2453 * Documentation: many updates to the manual: describing Windows
2456 * Documentation: many updates to the manual: describing Windows
2454 support better, Gnuplot updates, credits, misc small stuff. Also
2457 support better, Gnuplot updates, credits, misc small stuff. Also
2455 updated the new_design doc a bit.
2458 updated the new_design doc a bit.
2456
2459
2457 2004-05-06 *** Released version 0.6.0.rc1
2460 2004-05-06 *** Released version 0.6.0.rc1
2458
2461
2459 2004-05-06 Fernando Perez <fperez@colorado.edu>
2462 2004-05-06 Fernando Perez <fperez@colorado.edu>
2460
2463
2461 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2464 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2462 operations to use the vastly more efficient list/''.join() method.
2465 operations to use the vastly more efficient list/''.join() method.
2463 (FormattedTB.text): Fix
2466 (FormattedTB.text): Fix
2464 http://www.scipy.net/roundup/ipython/issue12 - exception source
2467 http://www.scipy.net/roundup/ipython/issue12 - exception source
2465 extract not updated after reload. Thanks to Mike Salib
2468 extract not updated after reload. Thanks to Mike Salib
2466 <msalib-AT-mit.edu> for pinning the source of the problem.
2469 <msalib-AT-mit.edu> for pinning the source of the problem.
2467 Fortunately, the solution works inside ipython and doesn't require
2470 Fortunately, the solution works inside ipython and doesn't require
2468 any changes to python proper.
2471 any changes to python proper.
2469
2472
2470 * IPython/Magic.py (Magic.parse_options): Improved to process the
2473 * IPython/Magic.py (Magic.parse_options): Improved to process the
2471 argument list as a true shell would (by actually using the
2474 argument list as a true shell would (by actually using the
2472 underlying system shell). This way, all @magics automatically get
2475 underlying system shell). This way, all @magics automatically get
2473 shell expansion for variables. Thanks to a comment by Alex
2476 shell expansion for variables. Thanks to a comment by Alex
2474 Schmolck.
2477 Schmolck.
2475
2478
2476 2004-04-04 Fernando Perez <fperez@colorado.edu>
2479 2004-04-04 Fernando Perez <fperez@colorado.edu>
2477
2480
2478 * IPython/iplib.py (InteractiveShell.interact): Added a special
2481 * IPython/iplib.py (InteractiveShell.interact): Added a special
2479 trap for a debugger quit exception, which is basically impossible
2482 trap for a debugger quit exception, which is basically impossible
2480 to handle by normal mechanisms, given what pdb does to the stack.
2483 to handle by normal mechanisms, given what pdb does to the stack.
2481 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2484 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2482
2485
2483 2004-04-03 Fernando Perez <fperez@colorado.edu>
2486 2004-04-03 Fernando Perez <fperez@colorado.edu>
2484
2487
2485 * IPython/genutils.py (Term): Standardized the names of the Term
2488 * IPython/genutils.py (Term): Standardized the names of the Term
2486 class streams to cin/cout/cerr, following C++ naming conventions
2489 class streams to cin/cout/cerr, following C++ naming conventions
2487 (I can't use in/out/err because 'in' is not a valid attribute
2490 (I can't use in/out/err because 'in' is not a valid attribute
2488 name).
2491 name).
2489
2492
2490 * IPython/iplib.py (InteractiveShell.interact): don't increment
2493 * IPython/iplib.py (InteractiveShell.interact): don't increment
2491 the prompt if there's no user input. By Daniel 'Dang' Griffith
2494 the prompt if there's no user input. By Daniel 'Dang' Griffith
2492 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2495 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2493 Francois Pinard.
2496 Francois Pinard.
2494
2497
2495 2004-04-02 Fernando Perez <fperez@colorado.edu>
2498 2004-04-02 Fernando Perez <fperez@colorado.edu>
2496
2499
2497 * IPython/genutils.py (Stream.__init__): Modified to survive at
2500 * IPython/genutils.py (Stream.__init__): Modified to survive at
2498 least importing in contexts where stdin/out/err aren't true file
2501 least importing in contexts where stdin/out/err aren't true file
2499 objects, such as PyCrust (they lack fileno() and mode). However,
2502 objects, such as PyCrust (they lack fileno() and mode). However,
2500 the recovery facilities which rely on these things existing will
2503 the recovery facilities which rely on these things existing will
2501 not work.
2504 not work.
2502
2505
2503 2004-04-01 Fernando Perez <fperez@colorado.edu>
2506 2004-04-01 Fernando Perez <fperez@colorado.edu>
2504
2507
2505 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2508 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2506 use the new getoutputerror() function, so it properly
2509 use the new getoutputerror() function, so it properly
2507 distinguishes stdout/err.
2510 distinguishes stdout/err.
2508
2511
2509 * IPython/genutils.py (getoutputerror): added a function to
2512 * IPython/genutils.py (getoutputerror): added a function to
2510 capture separately the standard output and error of a command.
2513 capture separately the standard output and error of a command.
2511 After a comment from dang on the mailing lists. This code is
2514 After a comment from dang on the mailing lists. This code is
2512 basically a modified version of commands.getstatusoutput(), from
2515 basically a modified version of commands.getstatusoutput(), from
2513 the standard library.
2516 the standard library.
2514
2517
2515 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2518 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2516 '!!' as a special syntax (shorthand) to access @sx.
2519 '!!' as a special syntax (shorthand) to access @sx.
2517
2520
2518 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2521 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2519 command and return its output as a list split on '\n'.
2522 command and return its output as a list split on '\n'.
2520
2523
2521 2004-03-31 Fernando Perez <fperez@colorado.edu>
2524 2004-03-31 Fernando Perez <fperez@colorado.edu>
2522
2525
2523 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2526 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2524 method to dictionaries used as FakeModule instances if they lack
2527 method to dictionaries used as FakeModule instances if they lack
2525 it. At least pydoc in python2.3 breaks for runtime-defined
2528 it. At least pydoc in python2.3 breaks for runtime-defined
2526 functions without this hack. At some point I need to _really_
2529 functions without this hack. At some point I need to _really_
2527 understand what FakeModule is doing, because it's a gross hack.
2530 understand what FakeModule is doing, because it's a gross hack.
2528 But it solves Arnd's problem for now...
2531 But it solves Arnd's problem for now...
2529
2532
2530 2004-02-27 Fernando Perez <fperez@colorado.edu>
2533 2004-02-27 Fernando Perez <fperez@colorado.edu>
2531
2534
2532 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2535 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2533 mode would behave erratically. Also increased the number of
2536 mode would behave erratically. Also increased the number of
2534 possible logs in rotate mod to 999. Thanks to Rod Holland
2537 possible logs in rotate mod to 999. Thanks to Rod Holland
2535 <rhh@StructureLABS.com> for the report and fixes.
2538 <rhh@StructureLABS.com> for the report and fixes.
2536
2539
2537 2004-02-26 Fernando Perez <fperez@colorado.edu>
2540 2004-02-26 Fernando Perez <fperez@colorado.edu>
2538
2541
2539 * IPython/genutils.py (page): Check that the curses module really
2542 * IPython/genutils.py (page): Check that the curses module really
2540 has the initscr attribute before trying to use it. For some
2543 has the initscr attribute before trying to use it. For some
2541 reason, the Solaris curses module is missing this. I think this
2544 reason, the Solaris curses module is missing this. I think this
2542 should be considered a Solaris python bug, but I'm not sure.
2545 should be considered a Solaris python bug, but I'm not sure.
2543
2546
2544 2004-01-17 Fernando Perez <fperez@colorado.edu>
2547 2004-01-17 Fernando Perez <fperez@colorado.edu>
2545
2548
2546 * IPython/genutils.py (Stream.__init__): Changes to try to make
2549 * IPython/genutils.py (Stream.__init__): Changes to try to make
2547 ipython robust against stdin/out/err being closed by the user.
2550 ipython robust against stdin/out/err being closed by the user.
2548 This is 'user error' (and blocks a normal python session, at least
2551 This is 'user error' (and blocks a normal python session, at least
2549 the stdout case). However, Ipython should be able to survive such
2552 the stdout case). However, Ipython should be able to survive such
2550 instances of abuse as gracefully as possible. To simplify the
2553 instances of abuse as gracefully as possible. To simplify the
2551 coding and maintain compatibility with Gary Bishop's Term
2554 coding and maintain compatibility with Gary Bishop's Term
2552 contributions, I've made use of classmethods for this. I think
2555 contributions, I've made use of classmethods for this. I think
2553 this introduces a dependency on python 2.2.
2556 this introduces a dependency on python 2.2.
2554
2557
2555 2004-01-13 Fernando Perez <fperez@colorado.edu>
2558 2004-01-13 Fernando Perez <fperez@colorado.edu>
2556
2559
2557 * IPython/numutils.py (exp_safe): simplified the code a bit and
2560 * IPython/numutils.py (exp_safe): simplified the code a bit and
2558 removed the need for importing the kinds module altogether.
2561 removed the need for importing the kinds module altogether.
2559
2562
2560 2004-01-06 Fernando Perez <fperez@colorado.edu>
2563 2004-01-06 Fernando Perez <fperez@colorado.edu>
2561
2564
2562 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2565 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2563 a magic function instead, after some community feedback. No
2566 a magic function instead, after some community feedback. No
2564 special syntax will exist for it, but its name is deliberately
2567 special syntax will exist for it, but its name is deliberately
2565 very short.
2568 very short.
2566
2569
2567 2003-12-20 Fernando Perez <fperez@colorado.edu>
2570 2003-12-20 Fernando Perez <fperez@colorado.edu>
2568
2571
2569 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2572 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2570 new functionality, to automagically assign the result of a shell
2573 new functionality, to automagically assign the result of a shell
2571 command to a variable. I'll solicit some community feedback on
2574 command to a variable. I'll solicit some community feedback on
2572 this before making it permanent.
2575 this before making it permanent.
2573
2576
2574 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2577 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2575 requested about callables for which inspect couldn't obtain a
2578 requested about callables for which inspect couldn't obtain a
2576 proper argspec. Thanks to a crash report sent by Etienne
2579 proper argspec. Thanks to a crash report sent by Etienne
2577 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2580 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2578
2581
2579 2003-12-09 Fernando Perez <fperez@colorado.edu>
2582 2003-12-09 Fernando Perez <fperez@colorado.edu>
2580
2583
2581 * IPython/genutils.py (page): patch for the pager to work across
2584 * IPython/genutils.py (page): patch for the pager to work across
2582 various versions of Windows. By Gary Bishop.
2585 various versions of Windows. By Gary Bishop.
2583
2586
2584 2003-12-04 Fernando Perez <fperez@colorado.edu>
2587 2003-12-04 Fernando Perez <fperez@colorado.edu>
2585
2588
2586 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2589 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2587 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2590 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2588 While I tested this and it looks ok, there may still be corner
2591 While I tested this and it looks ok, there may still be corner
2589 cases I've missed.
2592 cases I've missed.
2590
2593
2591 2003-12-01 Fernando Perez <fperez@colorado.edu>
2594 2003-12-01 Fernando Perez <fperez@colorado.edu>
2592
2595
2593 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2596 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2594 where a line like 'p,q=1,2' would fail because the automagic
2597 where a line like 'p,q=1,2' would fail because the automagic
2595 system would be triggered for @p.
2598 system would be triggered for @p.
2596
2599
2597 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2600 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2598 cleanups, code unmodified.
2601 cleanups, code unmodified.
2599
2602
2600 * IPython/genutils.py (Term): added a class for IPython to handle
2603 * IPython/genutils.py (Term): added a class for IPython to handle
2601 output. In most cases it will just be a proxy for stdout/err, but
2604 output. In most cases it will just be a proxy for stdout/err, but
2602 having this allows modifications to be made for some platforms,
2605 having this allows modifications to be made for some platforms,
2603 such as handling color escapes under Windows. All of this code
2606 such as handling color escapes under Windows. All of this code
2604 was contributed by Gary Bishop, with minor modifications by me.
2607 was contributed by Gary Bishop, with minor modifications by me.
2605 The actual changes affect many files.
2608 The actual changes affect many files.
2606
2609
2607 2003-11-30 Fernando Perez <fperez@colorado.edu>
2610 2003-11-30 Fernando Perez <fperez@colorado.edu>
2608
2611
2609 * IPython/iplib.py (file_matches): new completion code, courtesy
2612 * IPython/iplib.py (file_matches): new completion code, courtesy
2610 of Jeff Collins. This enables filename completion again under
2613 of Jeff Collins. This enables filename completion again under
2611 python 2.3, which disabled it at the C level.
2614 python 2.3, which disabled it at the C level.
2612
2615
2613 2003-11-11 Fernando Perez <fperez@colorado.edu>
2616 2003-11-11 Fernando Perez <fperez@colorado.edu>
2614
2617
2615 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2618 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2616 for Numeric.array(map(...)), but often convenient.
2619 for Numeric.array(map(...)), but often convenient.
2617
2620
2618 2003-11-05 Fernando Perez <fperez@colorado.edu>
2621 2003-11-05 Fernando Perez <fperez@colorado.edu>
2619
2622
2620 * IPython/numutils.py (frange): Changed a call from int() to
2623 * IPython/numutils.py (frange): Changed a call from int() to
2621 int(round()) to prevent a problem reported with arange() in the
2624 int(round()) to prevent a problem reported with arange() in the
2622 numpy list.
2625 numpy list.
2623
2626
2624 2003-10-06 Fernando Perez <fperez@colorado.edu>
2627 2003-10-06 Fernando Perez <fperez@colorado.edu>
2625
2628
2626 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2629 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2627 prevent crashes if sys lacks an argv attribute (it happens with
2630 prevent crashes if sys lacks an argv attribute (it happens with
2628 embedded interpreters which build a bare-bones sys module).
2631 embedded interpreters which build a bare-bones sys module).
2629 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2632 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2630
2633
2631 2003-09-24 Fernando Perez <fperez@colorado.edu>
2634 2003-09-24 Fernando Perez <fperez@colorado.edu>
2632
2635
2633 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2636 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2634 to protect against poorly written user objects where __getattr__
2637 to protect against poorly written user objects where __getattr__
2635 raises exceptions other than AttributeError. Thanks to a bug
2638 raises exceptions other than AttributeError. Thanks to a bug
2636 report by Oliver Sander <osander-AT-gmx.de>.
2639 report by Oliver Sander <osander-AT-gmx.de>.
2637
2640
2638 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2641 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2639 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2642 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2640
2643
2641 2003-09-09 Fernando Perez <fperez@colorado.edu>
2644 2003-09-09 Fernando Perez <fperez@colorado.edu>
2642
2645
2643 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2646 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2644 unpacking a list whith a callable as first element would
2647 unpacking a list whith a callable as first element would
2645 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2648 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2646 Collins.
2649 Collins.
2647
2650
2648 2003-08-25 *** Released version 0.5.0
2651 2003-08-25 *** Released version 0.5.0
2649
2652
2650 2003-08-22 Fernando Perez <fperez@colorado.edu>
2653 2003-08-22 Fernando Perez <fperez@colorado.edu>
2651
2654
2652 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2655 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2653 improperly defined user exceptions. Thanks to feedback from Mark
2656 improperly defined user exceptions. Thanks to feedback from Mark
2654 Russell <mrussell-AT-verio.net>.
2657 Russell <mrussell-AT-verio.net>.
2655
2658
2656 2003-08-20 Fernando Perez <fperez@colorado.edu>
2659 2003-08-20 Fernando Perez <fperez@colorado.edu>
2657
2660
2658 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2661 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2659 printing so that it would print multi-line string forms starting
2662 printing so that it would print multi-line string forms starting
2660 with a new line. This way the formatting is better respected for
2663 with a new line. This way the formatting is better respected for
2661 objects which work hard to make nice string forms.
2664 objects which work hard to make nice string forms.
2662
2665
2663 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2666 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2664 autocall would overtake data access for objects with both
2667 autocall would overtake data access for objects with both
2665 __getitem__ and __call__.
2668 __getitem__ and __call__.
2666
2669
2667 2003-08-19 *** Released version 0.5.0-rc1
2670 2003-08-19 *** Released version 0.5.0-rc1
2668
2671
2669 2003-08-19 Fernando Perez <fperez@colorado.edu>
2672 2003-08-19 Fernando Perez <fperez@colorado.edu>
2670
2673
2671 * IPython/deep_reload.py (load_tail): single tiny change here
2674 * IPython/deep_reload.py (load_tail): single tiny change here
2672 seems to fix the long-standing bug of dreload() failing to work
2675 seems to fix the long-standing bug of dreload() failing to work
2673 for dotted names. But this module is pretty tricky, so I may have
2676 for dotted names. But this module is pretty tricky, so I may have
2674 missed some subtlety. Needs more testing!.
2677 missed some subtlety. Needs more testing!.
2675
2678
2676 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2679 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2677 exceptions which have badly implemented __str__ methods.
2680 exceptions which have badly implemented __str__ methods.
2678 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2681 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2679 which I've been getting reports about from Python 2.3 users. I
2682 which I've been getting reports about from Python 2.3 users. I
2680 wish I had a simple test case to reproduce the problem, so I could
2683 wish I had a simple test case to reproduce the problem, so I could
2681 either write a cleaner workaround or file a bug report if
2684 either write a cleaner workaround or file a bug report if
2682 necessary.
2685 necessary.
2683
2686
2684 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2687 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2685 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2688 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2686 a bug report by Tjabo Kloppenburg.
2689 a bug report by Tjabo Kloppenburg.
2687
2690
2688 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2691 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2689 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2692 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2690 seems rather unstable. Thanks to a bug report by Tjabo
2693 seems rather unstable. Thanks to a bug report by Tjabo
2691 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2694 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2692
2695
2693 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2696 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2694 this out soon because of the critical fixes in the inner loop for
2697 this out soon because of the critical fixes in the inner loop for
2695 generators.
2698 generators.
2696
2699
2697 * IPython/Magic.py (Magic.getargspec): removed. This (and
2700 * IPython/Magic.py (Magic.getargspec): removed. This (and
2698 _get_def) have been obsoleted by OInspect for a long time, I
2701 _get_def) have been obsoleted by OInspect for a long time, I
2699 hadn't noticed that they were dead code.
2702 hadn't noticed that they were dead code.
2700 (Magic._ofind): restored _ofind functionality for a few literals
2703 (Magic._ofind): restored _ofind functionality for a few literals
2701 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2704 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2702 for things like "hello".capitalize?, since that would require a
2705 for things like "hello".capitalize?, since that would require a
2703 potentially dangerous eval() again.
2706 potentially dangerous eval() again.
2704
2707
2705 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2708 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2706 logic a bit more to clean up the escapes handling and minimize the
2709 logic a bit more to clean up the escapes handling and minimize the
2707 use of _ofind to only necessary cases. The interactive 'feel' of
2710 use of _ofind to only necessary cases. The interactive 'feel' of
2708 IPython should have improved quite a bit with the changes in
2711 IPython should have improved quite a bit with the changes in
2709 _prefilter and _ofind (besides being far safer than before).
2712 _prefilter and _ofind (besides being far safer than before).
2710
2713
2711 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2714 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2712 obscure, never reported). Edit would fail to find the object to
2715 obscure, never reported). Edit would fail to find the object to
2713 edit under some circumstances.
2716 edit under some circumstances.
2714 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2717 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2715 which were causing double-calling of generators. Those eval calls
2718 which were causing double-calling of generators. Those eval calls
2716 were _very_ dangerous, since code with side effects could be
2719 were _very_ dangerous, since code with side effects could be
2717 triggered. As they say, 'eval is evil'... These were the
2720 triggered. As they say, 'eval is evil'... These were the
2718 nastiest evals in IPython. Besides, _ofind is now far simpler,
2721 nastiest evals in IPython. Besides, _ofind is now far simpler,
2719 and it should also be quite a bit faster. Its use of inspect is
2722 and it should also be quite a bit faster. Its use of inspect is
2720 also safer, so perhaps some of the inspect-related crashes I've
2723 also safer, so perhaps some of the inspect-related crashes I've
2721 seen lately with Python 2.3 might be taken care of. That will
2724 seen lately with Python 2.3 might be taken care of. That will
2722 need more testing.
2725 need more testing.
2723
2726
2724 2003-08-17 Fernando Perez <fperez@colorado.edu>
2727 2003-08-17 Fernando Perez <fperez@colorado.edu>
2725
2728
2726 * IPython/iplib.py (InteractiveShell._prefilter): significant
2729 * IPython/iplib.py (InteractiveShell._prefilter): significant
2727 simplifications to the logic for handling user escapes. Faster
2730 simplifications to the logic for handling user escapes. Faster
2728 and simpler code.
2731 and simpler code.
2729
2732
2730 2003-08-14 Fernando Perez <fperez@colorado.edu>
2733 2003-08-14 Fernando Perez <fperez@colorado.edu>
2731
2734
2732 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2735 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2733 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2736 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2734 but it should be quite a bit faster. And the recursive version
2737 but it should be quite a bit faster. And the recursive version
2735 generated O(log N) intermediate storage for all rank>1 arrays,
2738 generated O(log N) intermediate storage for all rank>1 arrays,
2736 even if they were contiguous.
2739 even if they were contiguous.
2737 (l1norm): Added this function.
2740 (l1norm): Added this function.
2738 (norm): Added this function for arbitrary norms (including
2741 (norm): Added this function for arbitrary norms (including
2739 l-infinity). l1 and l2 are still special cases for convenience
2742 l-infinity). l1 and l2 are still special cases for convenience
2740 and speed.
2743 and speed.
2741
2744
2742 2003-08-03 Fernando Perez <fperez@colorado.edu>
2745 2003-08-03 Fernando Perez <fperez@colorado.edu>
2743
2746
2744 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2747 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2745 exceptions, which now raise PendingDeprecationWarnings in Python
2748 exceptions, which now raise PendingDeprecationWarnings in Python
2746 2.3. There were some in Magic and some in Gnuplot2.
2749 2.3. There were some in Magic and some in Gnuplot2.
2747
2750
2748 2003-06-30 Fernando Perez <fperez@colorado.edu>
2751 2003-06-30 Fernando Perez <fperez@colorado.edu>
2749
2752
2750 * IPython/genutils.py (page): modified to call curses only for
2753 * IPython/genutils.py (page): modified to call curses only for
2751 terminals where TERM=='xterm'. After problems under many other
2754 terminals where TERM=='xterm'. After problems under many other
2752 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2755 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2753
2756
2754 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2757 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2755 would be triggered when readline was absent. This was just an old
2758 would be triggered when readline was absent. This was just an old
2756 debugging statement I'd forgotten to take out.
2759 debugging statement I'd forgotten to take out.
2757
2760
2758 2003-06-20 Fernando Perez <fperez@colorado.edu>
2761 2003-06-20 Fernando Perez <fperez@colorado.edu>
2759
2762
2760 * IPython/genutils.py (clock): modified to return only user time
2763 * IPython/genutils.py (clock): modified to return only user time
2761 (not counting system time), after a discussion on scipy. While
2764 (not counting system time), after a discussion on scipy. While
2762 system time may be a useful quantity occasionally, it may much
2765 system time may be a useful quantity occasionally, it may much
2763 more easily be skewed by occasional swapping or other similar
2766 more easily be skewed by occasional swapping or other similar
2764 activity.
2767 activity.
2765
2768
2766 2003-06-05 Fernando Perez <fperez@colorado.edu>
2769 2003-06-05 Fernando Perez <fperez@colorado.edu>
2767
2770
2768 * IPython/numutils.py (identity): new function, for building
2771 * IPython/numutils.py (identity): new function, for building
2769 arbitrary rank Kronecker deltas (mostly backwards compatible with
2772 arbitrary rank Kronecker deltas (mostly backwards compatible with
2770 Numeric.identity)
2773 Numeric.identity)
2771
2774
2772 2003-06-03 Fernando Perez <fperez@colorado.edu>
2775 2003-06-03 Fernando Perez <fperez@colorado.edu>
2773
2776
2774 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2777 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2775 arguments passed to magics with spaces, to allow trailing '\' to
2778 arguments passed to magics with spaces, to allow trailing '\' to
2776 work normally (mainly for Windows users).
2779 work normally (mainly for Windows users).
2777
2780
2778 2003-05-29 Fernando Perez <fperez@colorado.edu>
2781 2003-05-29 Fernando Perez <fperez@colorado.edu>
2779
2782
2780 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2783 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2781 instead of pydoc.help. This fixes a bizarre behavior where
2784 instead of pydoc.help. This fixes a bizarre behavior where
2782 printing '%s' % locals() would trigger the help system. Now
2785 printing '%s' % locals() would trigger the help system. Now
2783 ipython behaves like normal python does.
2786 ipython behaves like normal python does.
2784
2787
2785 Note that if one does 'from pydoc import help', the bizarre
2788 Note that if one does 'from pydoc import help', the bizarre
2786 behavior returns, but this will also happen in normal python, so
2789 behavior returns, but this will also happen in normal python, so
2787 it's not an ipython bug anymore (it has to do with how pydoc.help
2790 it's not an ipython bug anymore (it has to do with how pydoc.help
2788 is implemented).
2791 is implemented).
2789
2792
2790 2003-05-22 Fernando Perez <fperez@colorado.edu>
2793 2003-05-22 Fernando Perez <fperez@colorado.edu>
2791
2794
2792 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2795 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2793 return [] instead of None when nothing matches, also match to end
2796 return [] instead of None when nothing matches, also match to end
2794 of line. Patch by Gary Bishop.
2797 of line. Patch by Gary Bishop.
2795
2798
2796 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2799 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2797 protection as before, for files passed on the command line. This
2800 protection as before, for files passed on the command line. This
2798 prevents the CrashHandler from kicking in if user files call into
2801 prevents the CrashHandler from kicking in if user files call into
2799 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2802 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2800 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2803 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2801
2804
2802 2003-05-20 *** Released version 0.4.0
2805 2003-05-20 *** Released version 0.4.0
2803
2806
2804 2003-05-20 Fernando Perez <fperez@colorado.edu>
2807 2003-05-20 Fernando Perez <fperez@colorado.edu>
2805
2808
2806 * setup.py: added support for manpages. It's a bit hackish b/c of
2809 * setup.py: added support for manpages. It's a bit hackish b/c of
2807 a bug in the way the bdist_rpm distutils target handles gzipped
2810 a bug in the way the bdist_rpm distutils target handles gzipped
2808 manpages, but it works. After a patch by Jack.
2811 manpages, but it works. After a patch by Jack.
2809
2812
2810 2003-05-19 Fernando Perez <fperez@colorado.edu>
2813 2003-05-19 Fernando Perez <fperez@colorado.edu>
2811
2814
2812 * IPython/numutils.py: added a mockup of the kinds module, since
2815 * IPython/numutils.py: added a mockup of the kinds module, since
2813 it was recently removed from Numeric. This way, numutils will
2816 it was recently removed from Numeric. This way, numutils will
2814 work for all users even if they are missing kinds.
2817 work for all users even if they are missing kinds.
2815
2818
2816 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2819 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2817 failure, which can occur with SWIG-wrapped extensions. After a
2820 failure, which can occur with SWIG-wrapped extensions. After a
2818 crash report from Prabhu.
2821 crash report from Prabhu.
2819
2822
2820 2003-05-16 Fernando Perez <fperez@colorado.edu>
2823 2003-05-16 Fernando Perez <fperez@colorado.edu>
2821
2824
2822 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2825 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2823 protect ipython from user code which may call directly
2826 protect ipython from user code which may call directly
2824 sys.excepthook (this looks like an ipython crash to the user, even
2827 sys.excepthook (this looks like an ipython crash to the user, even
2825 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2828 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2826 This is especially important to help users of WxWindows, but may
2829 This is especially important to help users of WxWindows, but may
2827 also be useful in other cases.
2830 also be useful in other cases.
2828
2831
2829 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2832 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2830 an optional tb_offset to be specified, and to preserve exception
2833 an optional tb_offset to be specified, and to preserve exception
2831 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2834 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2832
2835
2833 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2836 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2834
2837
2835 2003-05-15 Fernando Perez <fperez@colorado.edu>
2838 2003-05-15 Fernando Perez <fperez@colorado.edu>
2836
2839
2837 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2840 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2838 installing for a new user under Windows.
2841 installing for a new user under Windows.
2839
2842
2840 2003-05-12 Fernando Perez <fperez@colorado.edu>
2843 2003-05-12 Fernando Perez <fperez@colorado.edu>
2841
2844
2842 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2845 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2843 handler for Emacs comint-based lines. Currently it doesn't do
2846 handler for Emacs comint-based lines. Currently it doesn't do
2844 much (but importantly, it doesn't update the history cache). In
2847 much (but importantly, it doesn't update the history cache). In
2845 the future it may be expanded if Alex needs more functionality
2848 the future it may be expanded if Alex needs more functionality
2846 there.
2849 there.
2847
2850
2848 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2851 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2849 info to crash reports.
2852 info to crash reports.
2850
2853
2851 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2854 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2852 just like Python's -c. Also fixed crash with invalid -color
2855 just like Python's -c. Also fixed crash with invalid -color
2853 option value at startup. Thanks to Will French
2856 option value at startup. Thanks to Will French
2854 <wfrench-AT-bestweb.net> for the bug report.
2857 <wfrench-AT-bestweb.net> for the bug report.
2855
2858
2856 2003-05-09 Fernando Perez <fperez@colorado.edu>
2859 2003-05-09 Fernando Perez <fperez@colorado.edu>
2857
2860
2858 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2861 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2859 to EvalDict (it's a mapping, after all) and simplified its code
2862 to EvalDict (it's a mapping, after all) and simplified its code
2860 quite a bit, after a nice discussion on c.l.py where Gustavo
2863 quite a bit, after a nice discussion on c.l.py where Gustavo
2861 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2864 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2862
2865
2863 2003-04-30 Fernando Perez <fperez@colorado.edu>
2866 2003-04-30 Fernando Perez <fperez@colorado.edu>
2864
2867
2865 * IPython/genutils.py (timings_out): modified it to reduce its
2868 * IPython/genutils.py (timings_out): modified it to reduce its
2866 overhead in the common reps==1 case.
2869 overhead in the common reps==1 case.
2867
2870
2868 2003-04-29 Fernando Perez <fperez@colorado.edu>
2871 2003-04-29 Fernando Perez <fperez@colorado.edu>
2869
2872
2870 * IPython/genutils.py (timings_out): Modified to use the resource
2873 * IPython/genutils.py (timings_out): Modified to use the resource
2871 module, which avoids the wraparound problems of time.clock().
2874 module, which avoids the wraparound problems of time.clock().
2872
2875
2873 2003-04-17 *** Released version 0.2.15pre4
2876 2003-04-17 *** Released version 0.2.15pre4
2874
2877
2875 2003-04-17 Fernando Perez <fperez@colorado.edu>
2878 2003-04-17 Fernando Perez <fperez@colorado.edu>
2876
2879
2877 * setup.py (scriptfiles): Split windows-specific stuff over to a
2880 * setup.py (scriptfiles): Split windows-specific stuff over to a
2878 separate file, in an attempt to have a Windows GUI installer.
2881 separate file, in an attempt to have a Windows GUI installer.
2879 That didn't work, but part of the groundwork is done.
2882 That didn't work, but part of the groundwork is done.
2880
2883
2881 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2884 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2882 indent/unindent with 4 spaces. Particularly useful in combination
2885 indent/unindent with 4 spaces. Particularly useful in combination
2883 with the new auto-indent option.
2886 with the new auto-indent option.
2884
2887
2885 2003-04-16 Fernando Perez <fperez@colorado.edu>
2888 2003-04-16 Fernando Perez <fperez@colorado.edu>
2886
2889
2887 * IPython/Magic.py: various replacements of self.rc for
2890 * IPython/Magic.py: various replacements of self.rc for
2888 self.shell.rc. A lot more remains to be done to fully disentangle
2891 self.shell.rc. A lot more remains to be done to fully disentangle
2889 this class from the main Shell class.
2892 this class from the main Shell class.
2890
2893
2891 * IPython/GnuplotRuntime.py: added checks for mouse support so
2894 * IPython/GnuplotRuntime.py: added checks for mouse support so
2892 that we don't try to enable it if the current gnuplot doesn't
2895 that we don't try to enable it if the current gnuplot doesn't
2893 really support it. Also added checks so that we don't try to
2896 really support it. Also added checks so that we don't try to
2894 enable persist under Windows (where Gnuplot doesn't recognize the
2897 enable persist under Windows (where Gnuplot doesn't recognize the
2895 option).
2898 option).
2896
2899
2897 * IPython/iplib.py (InteractiveShell.interact): Added optional
2900 * IPython/iplib.py (InteractiveShell.interact): Added optional
2898 auto-indenting code, after a patch by King C. Shu
2901 auto-indenting code, after a patch by King C. Shu
2899 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2902 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2900 get along well with pasting indented code. If I ever figure out
2903 get along well with pasting indented code. If I ever figure out
2901 how to make that part go well, it will become on by default.
2904 how to make that part go well, it will become on by default.
2902
2905
2903 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2906 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2904 crash ipython if there was an unmatched '%' in the user's prompt
2907 crash ipython if there was an unmatched '%' in the user's prompt
2905 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2908 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2906
2909
2907 * IPython/iplib.py (InteractiveShell.interact): removed the
2910 * IPython/iplib.py (InteractiveShell.interact): removed the
2908 ability to ask the user whether he wants to crash or not at the
2911 ability to ask the user whether he wants to crash or not at the
2909 'last line' exception handler. Calling functions at that point
2912 'last line' exception handler. Calling functions at that point
2910 changes the stack, and the error reports would have incorrect
2913 changes the stack, and the error reports would have incorrect
2911 tracebacks.
2914 tracebacks.
2912
2915
2913 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2916 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2914 pass through a peger a pretty-printed form of any object. After a
2917 pass through a peger a pretty-printed form of any object. After a
2915 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2918 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2916
2919
2917 2003-04-14 Fernando Perez <fperez@colorado.edu>
2920 2003-04-14 Fernando Perez <fperez@colorado.edu>
2918
2921
2919 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2922 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2920 all files in ~ would be modified at first install (instead of
2923 all files in ~ would be modified at first install (instead of
2921 ~/.ipython). This could be potentially disastrous, as the
2924 ~/.ipython). This could be potentially disastrous, as the
2922 modification (make line-endings native) could damage binary files.
2925 modification (make line-endings native) could damage binary files.
2923
2926
2924 2003-04-10 Fernando Perez <fperez@colorado.edu>
2927 2003-04-10 Fernando Perez <fperez@colorado.edu>
2925
2928
2926 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2929 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2927 handle only lines which are invalid python. This now means that
2930 handle only lines which are invalid python. This now means that
2928 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2931 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2929 for the bug report.
2932 for the bug report.
2930
2933
2931 2003-04-01 Fernando Perez <fperez@colorado.edu>
2934 2003-04-01 Fernando Perez <fperez@colorado.edu>
2932
2935
2933 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2936 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2934 where failing to set sys.last_traceback would crash pdb.pm().
2937 where failing to set sys.last_traceback would crash pdb.pm().
2935 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2938 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2936 report.
2939 report.
2937
2940
2938 2003-03-25 Fernando Perez <fperez@colorado.edu>
2941 2003-03-25 Fernando Perez <fperez@colorado.edu>
2939
2942
2940 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2943 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2941 before printing it (it had a lot of spurious blank lines at the
2944 before printing it (it had a lot of spurious blank lines at the
2942 end).
2945 end).
2943
2946
2944 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2947 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2945 output would be sent 21 times! Obviously people don't use this
2948 output would be sent 21 times! Obviously people don't use this
2946 too often, or I would have heard about it.
2949 too often, or I would have heard about it.
2947
2950
2948 2003-03-24 Fernando Perez <fperez@colorado.edu>
2951 2003-03-24 Fernando Perez <fperez@colorado.edu>
2949
2952
2950 * setup.py (scriptfiles): renamed the data_files parameter from
2953 * setup.py (scriptfiles): renamed the data_files parameter from
2951 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2954 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2952 for the patch.
2955 for the patch.
2953
2956
2954 2003-03-20 Fernando Perez <fperez@colorado.edu>
2957 2003-03-20 Fernando Perez <fperez@colorado.edu>
2955
2958
2956 * IPython/genutils.py (error): added error() and fatal()
2959 * IPython/genutils.py (error): added error() and fatal()
2957 functions.
2960 functions.
2958
2961
2959 2003-03-18 *** Released version 0.2.15pre3
2962 2003-03-18 *** Released version 0.2.15pre3
2960
2963
2961 2003-03-18 Fernando Perez <fperez@colorado.edu>
2964 2003-03-18 Fernando Perez <fperez@colorado.edu>
2962
2965
2963 * setupext/install_data_ext.py
2966 * setupext/install_data_ext.py
2964 (install_data_ext.initialize_options): Class contributed by Jack
2967 (install_data_ext.initialize_options): Class contributed by Jack
2965 Moffit for fixing the old distutils hack. He is sending this to
2968 Moffit for fixing the old distutils hack. He is sending this to
2966 the distutils folks so in the future we may not need it as a
2969 the distutils folks so in the future we may not need it as a
2967 private fix.
2970 private fix.
2968
2971
2969 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2972 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2970 changes for Debian packaging. See his patch for full details.
2973 changes for Debian packaging. See his patch for full details.
2971 The old distutils hack of making the ipythonrc* files carry a
2974 The old distutils hack of making the ipythonrc* files carry a
2972 bogus .py extension is gone, at last. Examples were moved to a
2975 bogus .py extension is gone, at last. Examples were moved to a
2973 separate subdir under doc/, and the separate executable scripts
2976 separate subdir under doc/, and the separate executable scripts
2974 now live in their own directory. Overall a great cleanup. The
2977 now live in their own directory. Overall a great cleanup. The
2975 manual was updated to use the new files, and setup.py has been
2978 manual was updated to use the new files, and setup.py has been
2976 fixed for this setup.
2979 fixed for this setup.
2977
2980
2978 * IPython/PyColorize.py (Parser.usage): made non-executable and
2981 * IPython/PyColorize.py (Parser.usage): made non-executable and
2979 created a pycolor wrapper around it to be included as a script.
2982 created a pycolor wrapper around it to be included as a script.
2980
2983
2981 2003-03-12 *** Released version 0.2.15pre2
2984 2003-03-12 *** Released version 0.2.15pre2
2982
2985
2983 2003-03-12 Fernando Perez <fperez@colorado.edu>
2986 2003-03-12 Fernando Perez <fperez@colorado.edu>
2984
2987
2985 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2988 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2986 long-standing problem with garbage characters in some terminals.
2989 long-standing problem with garbage characters in some terminals.
2987 The issue was really that the \001 and \002 escapes must _only_ be
2990 The issue was really that the \001 and \002 escapes must _only_ be
2988 passed to input prompts (which call readline), but _never_ to
2991 passed to input prompts (which call readline), but _never_ to
2989 normal text to be printed on screen. I changed ColorANSI to have
2992 normal text to be printed on screen. I changed ColorANSI to have
2990 two classes: TermColors and InputTermColors, each with the
2993 two classes: TermColors and InputTermColors, each with the
2991 appropriate escapes for input prompts or normal text. The code in
2994 appropriate escapes for input prompts or normal text. The code in
2992 Prompts.py got slightly more complicated, but this very old and
2995 Prompts.py got slightly more complicated, but this very old and
2993 annoying bug is finally fixed.
2996 annoying bug is finally fixed.
2994
2997
2995 All the credit for nailing down the real origin of this problem
2998 All the credit for nailing down the real origin of this problem
2996 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2999 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2997 *Many* thanks to him for spending quite a bit of effort on this.
3000 *Many* thanks to him for spending quite a bit of effort on this.
2998
3001
2999 2003-03-05 *** Released version 0.2.15pre1
3002 2003-03-05 *** Released version 0.2.15pre1
3000
3003
3001 2003-03-03 Fernando Perez <fperez@colorado.edu>
3004 2003-03-03 Fernando Perez <fperez@colorado.edu>
3002
3005
3003 * IPython/FakeModule.py: Moved the former _FakeModule to a
3006 * IPython/FakeModule.py: Moved the former _FakeModule to a
3004 separate file, because it's also needed by Magic (to fix a similar
3007 separate file, because it's also needed by Magic (to fix a similar
3005 pickle-related issue in @run).
3008 pickle-related issue in @run).
3006
3009
3007 2003-03-02 Fernando Perez <fperez@colorado.edu>
3010 2003-03-02 Fernando Perez <fperez@colorado.edu>
3008
3011
3009 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3012 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3010 the autocall option at runtime.
3013 the autocall option at runtime.
3011 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3014 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3012 across Magic.py to start separating Magic from InteractiveShell.
3015 across Magic.py to start separating Magic from InteractiveShell.
3013 (Magic._ofind): Fixed to return proper namespace for dotted
3016 (Magic._ofind): Fixed to return proper namespace for dotted
3014 names. Before, a dotted name would always return 'not currently
3017 names. Before, a dotted name would always return 'not currently
3015 defined', because it would find the 'parent'. s.x would be found,
3018 defined', because it would find the 'parent'. s.x would be found,
3016 but since 'x' isn't defined by itself, it would get confused.
3019 but since 'x' isn't defined by itself, it would get confused.
3017 (Magic.magic_run): Fixed pickling problems reported by Ralf
3020 (Magic.magic_run): Fixed pickling problems reported by Ralf
3018 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3021 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3019 that I'd used when Mike Heeter reported similar issues at the
3022 that I'd used when Mike Heeter reported similar issues at the
3020 top-level, but now for @run. It boils down to injecting the
3023 top-level, but now for @run. It boils down to injecting the
3021 namespace where code is being executed with something that looks
3024 namespace where code is being executed with something that looks
3022 enough like a module to fool pickle.dump(). Since a pickle stores
3025 enough like a module to fool pickle.dump(). Since a pickle stores
3023 a named reference to the importing module, we need this for
3026 a named reference to the importing module, we need this for
3024 pickles to save something sensible.
3027 pickles to save something sensible.
3025
3028
3026 * IPython/ipmaker.py (make_IPython): added an autocall option.
3029 * IPython/ipmaker.py (make_IPython): added an autocall option.
3027
3030
3028 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3031 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3029 the auto-eval code. Now autocalling is an option, and the code is
3032 the auto-eval code. Now autocalling is an option, and the code is
3030 also vastly safer. There is no more eval() involved at all.
3033 also vastly safer. There is no more eval() involved at all.
3031
3034
3032 2003-03-01 Fernando Perez <fperez@colorado.edu>
3035 2003-03-01 Fernando Perez <fperez@colorado.edu>
3033
3036
3034 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3037 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3035 dict with named keys instead of a tuple.
3038 dict with named keys instead of a tuple.
3036
3039
3037 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3040 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3038
3041
3039 * setup.py (make_shortcut): Fixed message about directories
3042 * setup.py (make_shortcut): Fixed message about directories
3040 created during Windows installation (the directories were ok, just
3043 created during Windows installation (the directories were ok, just
3041 the printed message was misleading). Thanks to Chris Liechti
3044 the printed message was misleading). Thanks to Chris Liechti
3042 <cliechti-AT-gmx.net> for the heads up.
3045 <cliechti-AT-gmx.net> for the heads up.
3043
3046
3044 2003-02-21 Fernando Perez <fperez@colorado.edu>
3047 2003-02-21 Fernando Perez <fperez@colorado.edu>
3045
3048
3046 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3049 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3047 of ValueError exception when checking for auto-execution. This
3050 of ValueError exception when checking for auto-execution. This
3048 one is raised by things like Numeric arrays arr.flat when the
3051 one is raised by things like Numeric arrays arr.flat when the
3049 array is non-contiguous.
3052 array is non-contiguous.
3050
3053
3051 2003-01-31 Fernando Perez <fperez@colorado.edu>
3054 2003-01-31 Fernando Perez <fperez@colorado.edu>
3052
3055
3053 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3056 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3054 not return any value at all (even though the command would get
3057 not return any value at all (even though the command would get
3055 executed).
3058 executed).
3056 (xsys): Flush stdout right after printing the command to ensure
3059 (xsys): Flush stdout right after printing the command to ensure
3057 proper ordering of commands and command output in the total
3060 proper ordering of commands and command output in the total
3058 output.
3061 output.
3059 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3062 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3060 system/getoutput as defaults. The old ones are kept for
3063 system/getoutput as defaults. The old ones are kept for
3061 compatibility reasons, so no code which uses this library needs
3064 compatibility reasons, so no code which uses this library needs
3062 changing.
3065 changing.
3063
3066
3064 2003-01-27 *** Released version 0.2.14
3067 2003-01-27 *** Released version 0.2.14
3065
3068
3066 2003-01-25 Fernando Perez <fperez@colorado.edu>
3069 2003-01-25 Fernando Perez <fperez@colorado.edu>
3067
3070
3068 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3071 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3069 functions defined in previous edit sessions could not be re-edited
3072 functions defined in previous edit sessions could not be re-edited
3070 (because the temp files were immediately removed). Now temp files
3073 (because the temp files were immediately removed). Now temp files
3071 are removed only at IPython's exit.
3074 are removed only at IPython's exit.
3072 (Magic.magic_run): Improved @run to perform shell-like expansions
3075 (Magic.magic_run): Improved @run to perform shell-like expansions
3073 on its arguments (~users and $VARS). With this, @run becomes more
3076 on its arguments (~users and $VARS). With this, @run becomes more
3074 like a normal command-line.
3077 like a normal command-line.
3075
3078
3076 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3079 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3077 bugs related to embedding and cleaned up that code. A fairly
3080 bugs related to embedding and cleaned up that code. A fairly
3078 important one was the impossibility to access the global namespace
3081 important one was the impossibility to access the global namespace
3079 through the embedded IPython (only local variables were visible).
3082 through the embedded IPython (only local variables were visible).
3080
3083
3081 2003-01-14 Fernando Perez <fperez@colorado.edu>
3084 2003-01-14 Fernando Perez <fperez@colorado.edu>
3082
3085
3083 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3086 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3084 auto-calling to be a bit more conservative. Now it doesn't get
3087 auto-calling to be a bit more conservative. Now it doesn't get
3085 triggered if any of '!=()<>' are in the rest of the input line, to
3088 triggered if any of '!=()<>' are in the rest of the input line, to
3086 allow comparing callables. Thanks to Alex for the heads up.
3089 allow comparing callables. Thanks to Alex for the heads up.
3087
3090
3088 2003-01-07 Fernando Perez <fperez@colorado.edu>
3091 2003-01-07 Fernando Perez <fperez@colorado.edu>
3089
3092
3090 * IPython/genutils.py (page): fixed estimation of the number of
3093 * IPython/genutils.py (page): fixed estimation of the number of
3091 lines in a string to be paged to simply count newlines. This
3094 lines in a string to be paged to simply count newlines. This
3092 prevents over-guessing due to embedded escape sequences. A better
3095 prevents over-guessing due to embedded escape sequences. A better
3093 long-term solution would involve stripping out the control chars
3096 long-term solution would involve stripping out the control chars
3094 for the count, but it's potentially so expensive I just don't
3097 for the count, but it's potentially so expensive I just don't
3095 think it's worth doing.
3098 think it's worth doing.
3096
3099
3097 2002-12-19 *** Released version 0.2.14pre50
3100 2002-12-19 *** Released version 0.2.14pre50
3098
3101
3099 2002-12-19 Fernando Perez <fperez@colorado.edu>
3102 2002-12-19 Fernando Perez <fperez@colorado.edu>
3100
3103
3101 * tools/release (version): Changed release scripts to inform
3104 * tools/release (version): Changed release scripts to inform
3102 Andrea and build a NEWS file with a list of recent changes.
3105 Andrea and build a NEWS file with a list of recent changes.
3103
3106
3104 * IPython/ColorANSI.py (__all__): changed terminal detection
3107 * IPython/ColorANSI.py (__all__): changed terminal detection
3105 code. Seems to work better for xterms without breaking
3108 code. Seems to work better for xterms without breaking
3106 konsole. Will need more testing to determine if WinXP and Mac OSX
3109 konsole. Will need more testing to determine if WinXP and Mac OSX
3107 also work ok.
3110 also work ok.
3108
3111
3109 2002-12-18 *** Released version 0.2.14pre49
3112 2002-12-18 *** Released version 0.2.14pre49
3110
3113
3111 2002-12-18 Fernando Perez <fperez@colorado.edu>
3114 2002-12-18 Fernando Perez <fperez@colorado.edu>
3112
3115
3113 * Docs: added new info about Mac OSX, from Andrea.
3116 * Docs: added new info about Mac OSX, from Andrea.
3114
3117
3115 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3118 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3116 allow direct plotting of python strings whose format is the same
3119 allow direct plotting of python strings whose format is the same
3117 of gnuplot data files.
3120 of gnuplot data files.
3118
3121
3119 2002-12-16 Fernando Perez <fperez@colorado.edu>
3122 2002-12-16 Fernando Perez <fperez@colorado.edu>
3120
3123
3121 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3124 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3122 value of exit question to be acknowledged.
3125 value of exit question to be acknowledged.
3123
3126
3124 2002-12-03 Fernando Perez <fperez@colorado.edu>
3127 2002-12-03 Fernando Perez <fperez@colorado.edu>
3125
3128
3126 * IPython/ipmaker.py: removed generators, which had been added
3129 * IPython/ipmaker.py: removed generators, which had been added
3127 by mistake in an earlier debugging run. This was causing trouble
3130 by mistake in an earlier debugging run. This was causing trouble
3128 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3131 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3129 for pointing this out.
3132 for pointing this out.
3130
3133
3131 2002-11-17 Fernando Perez <fperez@colorado.edu>
3134 2002-11-17 Fernando Perez <fperez@colorado.edu>
3132
3135
3133 * Manual: updated the Gnuplot section.
3136 * Manual: updated the Gnuplot section.
3134
3137
3135 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3138 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3136 a much better split of what goes in Runtime and what goes in
3139 a much better split of what goes in Runtime and what goes in
3137 Interactive.
3140 Interactive.
3138
3141
3139 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3142 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3140 being imported from iplib.
3143 being imported from iplib.
3141
3144
3142 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3145 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3143 for command-passing. Now the global Gnuplot instance is called
3146 for command-passing. Now the global Gnuplot instance is called
3144 'gp' instead of 'g', which was really a far too fragile and
3147 'gp' instead of 'g', which was really a far too fragile and
3145 common name.
3148 common name.
3146
3149
3147 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3150 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3148 bounding boxes generated by Gnuplot for square plots.
3151 bounding boxes generated by Gnuplot for square plots.
3149
3152
3150 * IPython/genutils.py (popkey): new function added. I should
3153 * IPython/genutils.py (popkey): new function added. I should
3151 suggest this on c.l.py as a dict method, it seems useful.
3154 suggest this on c.l.py as a dict method, it seems useful.
3152
3155
3153 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3156 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3154 to transparently handle PostScript generation. MUCH better than
3157 to transparently handle PostScript generation. MUCH better than
3155 the previous plot_eps/replot_eps (which I removed now). The code
3158 the previous plot_eps/replot_eps (which I removed now). The code
3156 is also fairly clean and well documented now (including
3159 is also fairly clean and well documented now (including
3157 docstrings).
3160 docstrings).
3158
3161
3159 2002-11-13 Fernando Perez <fperez@colorado.edu>
3162 2002-11-13 Fernando Perez <fperez@colorado.edu>
3160
3163
3161 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3164 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3162 (inconsistent with options).
3165 (inconsistent with options).
3163
3166
3164 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3167 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3165 manually disabled, I don't know why. Fixed it.
3168 manually disabled, I don't know why. Fixed it.
3166 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3169 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3167 eps output.
3170 eps output.
3168
3171
3169 2002-11-12 Fernando Perez <fperez@colorado.edu>
3172 2002-11-12 Fernando Perez <fperez@colorado.edu>
3170
3173
3171 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3174 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3172 don't propagate up to caller. Fixes crash reported by François
3175 don't propagate up to caller. Fixes crash reported by François
3173 Pinard.
3176 Pinard.
3174
3177
3175 2002-11-09 Fernando Perez <fperez@colorado.edu>
3178 2002-11-09 Fernando Perez <fperez@colorado.edu>
3176
3179
3177 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3180 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3178 history file for new users.
3181 history file for new users.
3179 (make_IPython): fixed bug where initial install would leave the
3182 (make_IPython): fixed bug where initial install would leave the
3180 user running in the .ipython dir.
3183 user running in the .ipython dir.
3181 (make_IPython): fixed bug where config dir .ipython would be
3184 (make_IPython): fixed bug where config dir .ipython would be
3182 created regardless of the given -ipythondir option. Thanks to Cory
3185 created regardless of the given -ipythondir option. Thanks to Cory
3183 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3186 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3184
3187
3185 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3188 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3186 type confirmations. Will need to use it in all of IPython's code
3189 type confirmations. Will need to use it in all of IPython's code
3187 consistently.
3190 consistently.
3188
3191
3189 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3192 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3190 context to print 31 lines instead of the default 5. This will make
3193 context to print 31 lines instead of the default 5. This will make
3191 the crash reports extremely detailed in case the problem is in
3194 the crash reports extremely detailed in case the problem is in
3192 libraries I don't have access to.
3195 libraries I don't have access to.
3193
3196
3194 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3197 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3195 line of defense' code to still crash, but giving users fair
3198 line of defense' code to still crash, but giving users fair
3196 warning. I don't want internal errors to go unreported: if there's
3199 warning. I don't want internal errors to go unreported: if there's
3197 an internal problem, IPython should crash and generate a full
3200 an internal problem, IPython should crash and generate a full
3198 report.
3201 report.
3199
3202
3200 2002-11-08 Fernando Perez <fperez@colorado.edu>
3203 2002-11-08 Fernando Perez <fperez@colorado.edu>
3201
3204
3202 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3205 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3203 otherwise uncaught exceptions which can appear if people set
3206 otherwise uncaught exceptions which can appear if people set
3204 sys.stdout to something badly broken. Thanks to a crash report
3207 sys.stdout to something badly broken. Thanks to a crash report
3205 from henni-AT-mail.brainbot.com.
3208 from henni-AT-mail.brainbot.com.
3206
3209
3207 2002-11-04 Fernando Perez <fperez@colorado.edu>
3210 2002-11-04 Fernando Perez <fperez@colorado.edu>
3208
3211
3209 * IPython/iplib.py (InteractiveShell.interact): added
3212 * IPython/iplib.py (InteractiveShell.interact): added
3210 __IPYTHON__active to the builtins. It's a flag which goes on when
3213 __IPYTHON__active to the builtins. It's a flag which goes on when
3211 the interaction starts and goes off again when it stops. This
3214 the interaction starts and goes off again when it stops. This
3212 allows embedding code to detect being inside IPython. Before this
3215 allows embedding code to detect being inside IPython. Before this
3213 was done via __IPYTHON__, but that only shows that an IPython
3216 was done via __IPYTHON__, but that only shows that an IPython
3214 instance has been created.
3217 instance has been created.
3215
3218
3216 * IPython/Magic.py (Magic.magic_env): I realized that in a
3219 * IPython/Magic.py (Magic.magic_env): I realized that in a
3217 UserDict, instance.data holds the data as a normal dict. So I
3220 UserDict, instance.data holds the data as a normal dict. So I
3218 modified @env to return os.environ.data instead of rebuilding a
3221 modified @env to return os.environ.data instead of rebuilding a
3219 dict by hand.
3222 dict by hand.
3220
3223
3221 2002-11-02 Fernando Perez <fperez@colorado.edu>
3224 2002-11-02 Fernando Perez <fperez@colorado.edu>
3222
3225
3223 * IPython/genutils.py (warn): changed so that level 1 prints no
3226 * IPython/genutils.py (warn): changed so that level 1 prints no
3224 header. Level 2 is now the default (with 'WARNING' header, as
3227 header. Level 2 is now the default (with 'WARNING' header, as
3225 before). I think I tracked all places where changes were needed in
3228 before). I think I tracked all places where changes were needed in
3226 IPython, but outside code using the old level numbering may have
3229 IPython, but outside code using the old level numbering may have
3227 broken.
3230 broken.
3228
3231
3229 * IPython/iplib.py (InteractiveShell.runcode): added this to
3232 * IPython/iplib.py (InteractiveShell.runcode): added this to
3230 handle the tracebacks in SystemExit traps correctly. The previous
3233 handle the tracebacks in SystemExit traps correctly. The previous
3231 code (through interact) was printing more of the stack than
3234 code (through interact) was printing more of the stack than
3232 necessary, showing IPython internal code to the user.
3235 necessary, showing IPython internal code to the user.
3233
3236
3234 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3237 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3235 default. Now that the default at the confirmation prompt is yes,
3238 default. Now that the default at the confirmation prompt is yes,
3236 it's not so intrusive. François' argument that ipython sessions
3239 it's not so intrusive. François' argument that ipython sessions
3237 tend to be complex enough not to lose them from an accidental C-d,
3240 tend to be complex enough not to lose them from an accidental C-d,
3238 is a valid one.
3241 is a valid one.
3239
3242
3240 * IPython/iplib.py (InteractiveShell.interact): added a
3243 * IPython/iplib.py (InteractiveShell.interact): added a
3241 showtraceback() call to the SystemExit trap, and modified the exit
3244 showtraceback() call to the SystemExit trap, and modified the exit
3242 confirmation to have yes as the default.
3245 confirmation to have yes as the default.
3243
3246
3244 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3247 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3245 this file. It's been gone from the code for a long time, this was
3248 this file. It's been gone from the code for a long time, this was
3246 simply leftover junk.
3249 simply leftover junk.
3247
3250
3248 2002-11-01 Fernando Perez <fperez@colorado.edu>
3251 2002-11-01 Fernando Perez <fperez@colorado.edu>
3249
3252
3250 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3253 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3251 added. If set, IPython now traps EOF and asks for
3254 added. If set, IPython now traps EOF and asks for
3252 confirmation. After a request by François Pinard.
3255 confirmation. After a request by François Pinard.
3253
3256
3254 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3257 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3255 of @abort, and with a new (better) mechanism for handling the
3258 of @abort, and with a new (better) mechanism for handling the
3256 exceptions.
3259 exceptions.
3257
3260
3258 2002-10-27 Fernando Perez <fperez@colorado.edu>
3261 2002-10-27 Fernando Perez <fperez@colorado.edu>
3259
3262
3260 * IPython/usage.py (__doc__): updated the --help information and
3263 * IPython/usage.py (__doc__): updated the --help information and
3261 the ipythonrc file to indicate that -log generates
3264 the ipythonrc file to indicate that -log generates
3262 ./ipython.log. Also fixed the corresponding info in @logstart.
3265 ./ipython.log. Also fixed the corresponding info in @logstart.
3263 This and several other fixes in the manuals thanks to reports by
3266 This and several other fixes in the manuals thanks to reports by
3264 François Pinard <pinard-AT-iro.umontreal.ca>.
3267 François Pinard <pinard-AT-iro.umontreal.ca>.
3265
3268
3266 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3269 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3267 refer to @logstart (instead of @log, which doesn't exist).
3270 refer to @logstart (instead of @log, which doesn't exist).
3268
3271
3269 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3272 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3270 AttributeError crash. Thanks to Christopher Armstrong
3273 AttributeError crash. Thanks to Christopher Armstrong
3271 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3274 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3272 introduced recently (in 0.2.14pre37) with the fix to the eval
3275 introduced recently (in 0.2.14pre37) with the fix to the eval
3273 problem mentioned below.
3276 problem mentioned below.
3274
3277
3275 2002-10-17 Fernando Perez <fperez@colorado.edu>
3278 2002-10-17 Fernando Perez <fperez@colorado.edu>
3276
3279
3277 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3280 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3278 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3281 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3279
3282
3280 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3283 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3281 this function to fix a problem reported by Alex Schmolck. He saw
3284 this function to fix a problem reported by Alex Schmolck. He saw
3282 it with list comprehensions and generators, which were getting
3285 it with list comprehensions and generators, which were getting
3283 called twice. The real problem was an 'eval' call in testing for
3286 called twice. The real problem was an 'eval' call in testing for
3284 automagic which was evaluating the input line silently.
3287 automagic which was evaluating the input line silently.
3285
3288
3286 This is a potentially very nasty bug, if the input has side
3289 This is a potentially very nasty bug, if the input has side
3287 effects which must not be repeated. The code is much cleaner now,
3290 effects which must not be repeated. The code is much cleaner now,
3288 without any blanket 'except' left and with a regexp test for
3291 without any blanket 'except' left and with a regexp test for
3289 actual function names.
3292 actual function names.
3290
3293
3291 But an eval remains, which I'm not fully comfortable with. I just
3294 But an eval remains, which I'm not fully comfortable with. I just
3292 don't know how to find out if an expression could be a callable in
3295 don't know how to find out if an expression could be a callable in
3293 the user's namespace without doing an eval on the string. However
3296 the user's namespace without doing an eval on the string. However
3294 that string is now much more strictly checked so that no code
3297 that string is now much more strictly checked so that no code
3295 slips by, so the eval should only happen for things that can
3298 slips by, so the eval should only happen for things that can
3296 really be only function/method names.
3299 really be only function/method names.
3297
3300
3298 2002-10-15 Fernando Perez <fperez@colorado.edu>
3301 2002-10-15 Fernando Perez <fperez@colorado.edu>
3299
3302
3300 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3303 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3301 OSX information to main manual, removed README_Mac_OSX file from
3304 OSX information to main manual, removed README_Mac_OSX file from
3302 distribution. Also updated credits for recent additions.
3305 distribution. Also updated credits for recent additions.
3303
3306
3304 2002-10-10 Fernando Perez <fperez@colorado.edu>
3307 2002-10-10 Fernando Perez <fperez@colorado.edu>
3305
3308
3306 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3309 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3307 terminal-related issues. Many thanks to Andrea Riciputi
3310 terminal-related issues. Many thanks to Andrea Riciputi
3308 <andrea.riciputi-AT-libero.it> for writing it.
3311 <andrea.riciputi-AT-libero.it> for writing it.
3309
3312
3310 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3313 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3311 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3314 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3312
3315
3313 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3316 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3314 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3317 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3315 <syver-en-AT-online.no> who both submitted patches for this problem.
3318 <syver-en-AT-online.no> who both submitted patches for this problem.
3316
3319
3317 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3320 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3318 global embedding to make sure that things don't overwrite user
3321 global embedding to make sure that things don't overwrite user
3319 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3322 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3320
3323
3321 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3324 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3322 compatibility. Thanks to Hayden Callow
3325 compatibility. Thanks to Hayden Callow
3323 <h.callow-AT-elec.canterbury.ac.nz>
3326 <h.callow-AT-elec.canterbury.ac.nz>
3324
3327
3325 2002-10-04 Fernando Perez <fperez@colorado.edu>
3328 2002-10-04 Fernando Perez <fperez@colorado.edu>
3326
3329
3327 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3330 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3328 Gnuplot.File objects.
3331 Gnuplot.File objects.
3329
3332
3330 2002-07-23 Fernando Perez <fperez@colorado.edu>
3333 2002-07-23 Fernando Perez <fperez@colorado.edu>
3331
3334
3332 * IPython/genutils.py (timing): Added timings() and timing() for
3335 * IPython/genutils.py (timing): Added timings() and timing() for
3333 quick access to the most commonly needed data, the execution
3336 quick access to the most commonly needed data, the execution
3334 times. Old timing() renamed to timings_out().
3337 times. Old timing() renamed to timings_out().
3335
3338
3336 2002-07-18 Fernando Perez <fperez@colorado.edu>
3339 2002-07-18 Fernando Perez <fperez@colorado.edu>
3337
3340
3338 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3341 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3339 bug with nested instances disrupting the parent's tab completion.
3342 bug with nested instances disrupting the parent's tab completion.
3340
3343
3341 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3344 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3342 all_completions code to begin the emacs integration.
3345 all_completions code to begin the emacs integration.
3343
3346
3344 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3347 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3345 argument to allow titling individual arrays when plotting.
3348 argument to allow titling individual arrays when plotting.
3346
3349
3347 2002-07-15 Fernando Perez <fperez@colorado.edu>
3350 2002-07-15 Fernando Perez <fperez@colorado.edu>
3348
3351
3349 * setup.py (make_shortcut): changed to retrieve the value of
3352 * setup.py (make_shortcut): changed to retrieve the value of
3350 'Program Files' directory from the registry (this value changes in
3353 'Program Files' directory from the registry (this value changes in
3351 non-english versions of Windows). Thanks to Thomas Fanslau
3354 non-english versions of Windows). Thanks to Thomas Fanslau
3352 <tfanslau-AT-gmx.de> for the report.
3355 <tfanslau-AT-gmx.de> for the report.
3353
3356
3354 2002-07-10 Fernando Perez <fperez@colorado.edu>
3357 2002-07-10 Fernando Perez <fperez@colorado.edu>
3355
3358
3356 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3359 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3357 a bug in pdb, which crashes if a line with only whitespace is
3360 a bug in pdb, which crashes if a line with only whitespace is
3358 entered. Bug report submitted to sourceforge.
3361 entered. Bug report submitted to sourceforge.
3359
3362
3360 2002-07-09 Fernando Perez <fperez@colorado.edu>
3363 2002-07-09 Fernando Perez <fperez@colorado.edu>
3361
3364
3362 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3365 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3363 reporting exceptions (it's a bug in inspect.py, I just set a
3366 reporting exceptions (it's a bug in inspect.py, I just set a
3364 workaround).
3367 workaround).
3365
3368
3366 2002-07-08 Fernando Perez <fperez@colorado.edu>
3369 2002-07-08 Fernando Perez <fperez@colorado.edu>
3367
3370
3368 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3371 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3369 __IPYTHON__ in __builtins__ to show up in user_ns.
3372 __IPYTHON__ in __builtins__ to show up in user_ns.
3370
3373
3371 2002-07-03 Fernando Perez <fperez@colorado.edu>
3374 2002-07-03 Fernando Perez <fperez@colorado.edu>
3372
3375
3373 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3376 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3374 name from @gp_set_instance to @gp_set_default.
3377 name from @gp_set_instance to @gp_set_default.
3375
3378
3376 * IPython/ipmaker.py (make_IPython): default editor value set to
3379 * IPython/ipmaker.py (make_IPython): default editor value set to
3377 '0' (a string), to match the rc file. Otherwise will crash when
3380 '0' (a string), to match the rc file. Otherwise will crash when
3378 .strip() is called on it.
3381 .strip() is called on it.
3379
3382
3380
3383
3381 2002-06-28 Fernando Perez <fperez@colorado.edu>
3384 2002-06-28 Fernando Perez <fperez@colorado.edu>
3382
3385
3383 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3386 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3384 of files in current directory when a file is executed via
3387 of files in current directory when a file is executed via
3385 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3388 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3386
3389
3387 * setup.py (manfiles): fix for rpm builds, submitted by RA
3390 * setup.py (manfiles): fix for rpm builds, submitted by RA
3388 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3391 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3389
3392
3390 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3393 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3391 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3394 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3392 string!). A. Schmolck caught this one.
3395 string!). A. Schmolck caught this one.
3393
3396
3394 2002-06-27 Fernando Perez <fperez@colorado.edu>
3397 2002-06-27 Fernando Perez <fperez@colorado.edu>
3395
3398
3396 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3399 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3397 defined files at the cmd line. __name__ wasn't being set to
3400 defined files at the cmd line. __name__ wasn't being set to
3398 __main__.
3401 __main__.
3399
3402
3400 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3403 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3401 regular lists and tuples besides Numeric arrays.
3404 regular lists and tuples besides Numeric arrays.
3402
3405
3403 * IPython/Prompts.py (CachedOutput.__call__): Added output
3406 * IPython/Prompts.py (CachedOutput.__call__): Added output
3404 supression for input ending with ';'. Similar to Mathematica and
3407 supression for input ending with ';'. Similar to Mathematica and
3405 Matlab. The _* vars and Out[] list are still updated, just like
3408 Matlab. The _* vars and Out[] list are still updated, just like
3406 Mathematica behaves.
3409 Mathematica behaves.
3407
3410
3408 2002-06-25 Fernando Perez <fperez@colorado.edu>
3411 2002-06-25 Fernando Perez <fperez@colorado.edu>
3409
3412
3410 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3413 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3411 .ini extensions for profiels under Windows.
3414 .ini extensions for profiels under Windows.
3412
3415
3413 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3416 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3414 string form. Fix contributed by Alexander Schmolck
3417 string form. Fix contributed by Alexander Schmolck
3415 <a.schmolck-AT-gmx.net>
3418 <a.schmolck-AT-gmx.net>
3416
3419
3417 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3420 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3418 pre-configured Gnuplot instance.
3421 pre-configured Gnuplot instance.
3419
3422
3420 2002-06-21 Fernando Perez <fperez@colorado.edu>
3423 2002-06-21 Fernando Perez <fperez@colorado.edu>
3421
3424
3422 * IPython/numutils.py (exp_safe): new function, works around the
3425 * IPython/numutils.py (exp_safe): new function, works around the
3423 underflow problems in Numeric.
3426 underflow problems in Numeric.
3424 (log2): New fn. Safe log in base 2: returns exact integer answer
3427 (log2): New fn. Safe log in base 2: returns exact integer answer
3425 for exact integer powers of 2.
3428 for exact integer powers of 2.
3426
3429
3427 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3430 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3428 properly.
3431 properly.
3429
3432
3430 2002-06-20 Fernando Perez <fperez@colorado.edu>
3433 2002-06-20 Fernando Perez <fperez@colorado.edu>
3431
3434
3432 * IPython/genutils.py (timing): new function like
3435 * IPython/genutils.py (timing): new function like
3433 Mathematica's. Similar to time_test, but returns more info.
3436 Mathematica's. Similar to time_test, but returns more info.
3434
3437
3435 2002-06-18 Fernando Perez <fperez@colorado.edu>
3438 2002-06-18 Fernando Perez <fperez@colorado.edu>
3436
3439
3437 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3440 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3438 according to Mike Heeter's suggestions.
3441 according to Mike Heeter's suggestions.
3439
3442
3440 2002-06-16 Fernando Perez <fperez@colorado.edu>
3443 2002-06-16 Fernando Perez <fperez@colorado.edu>
3441
3444
3442 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3445 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3443 system. GnuplotMagic is gone as a user-directory option. New files
3446 system. GnuplotMagic is gone as a user-directory option. New files
3444 make it easier to use all the gnuplot stuff both from external
3447 make it easier to use all the gnuplot stuff both from external
3445 programs as well as from IPython. Had to rewrite part of
3448 programs as well as from IPython. Had to rewrite part of
3446 hardcopy() b/c of a strange bug: often the ps files simply don't
3449 hardcopy() b/c of a strange bug: often the ps files simply don't
3447 get created, and require a repeat of the command (often several
3450 get created, and require a repeat of the command (often several
3448 times).
3451 times).
3449
3452
3450 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3453 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3451 resolve output channel at call time, so that if sys.stderr has
3454 resolve output channel at call time, so that if sys.stderr has
3452 been redirected by user this gets honored.
3455 been redirected by user this gets honored.
3453
3456
3454 2002-06-13 Fernando Perez <fperez@colorado.edu>
3457 2002-06-13 Fernando Perez <fperez@colorado.edu>
3455
3458
3456 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3459 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3457 IPShell. Kept a copy with the old names to avoid breaking people's
3460 IPShell. Kept a copy with the old names to avoid breaking people's
3458 embedded code.
3461 embedded code.
3459
3462
3460 * IPython/ipython: simplified it to the bare minimum after
3463 * IPython/ipython: simplified it to the bare minimum after
3461 Holger's suggestions. Added info about how to use it in
3464 Holger's suggestions. Added info about how to use it in
3462 PYTHONSTARTUP.
3465 PYTHONSTARTUP.
3463
3466
3464 * IPython/Shell.py (IPythonShell): changed the options passing
3467 * IPython/Shell.py (IPythonShell): changed the options passing
3465 from a string with funky %s replacements to a straight list. Maybe
3468 from a string with funky %s replacements to a straight list. Maybe
3466 a bit more typing, but it follows sys.argv conventions, so there's
3469 a bit more typing, but it follows sys.argv conventions, so there's
3467 less special-casing to remember.
3470 less special-casing to remember.
3468
3471
3469 2002-06-12 Fernando Perez <fperez@colorado.edu>
3472 2002-06-12 Fernando Perez <fperez@colorado.edu>
3470
3473
3471 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3474 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3472 command. Thanks to a suggestion by Mike Heeter.
3475 command. Thanks to a suggestion by Mike Heeter.
3473 (Magic.magic_pfile): added behavior to look at filenames if given
3476 (Magic.magic_pfile): added behavior to look at filenames if given
3474 arg is not a defined object.
3477 arg is not a defined object.
3475 (Magic.magic_save): New @save function to save code snippets. Also
3478 (Magic.magic_save): New @save function to save code snippets. Also
3476 a Mike Heeter idea.
3479 a Mike Heeter idea.
3477
3480
3478 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3481 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3479 plot() and replot(). Much more convenient now, especially for
3482 plot() and replot(). Much more convenient now, especially for
3480 interactive use.
3483 interactive use.
3481
3484
3482 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3485 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3483 filenames.
3486 filenames.
3484
3487
3485 2002-06-02 Fernando Perez <fperez@colorado.edu>
3488 2002-06-02 Fernando Perez <fperez@colorado.edu>
3486
3489
3487 * IPython/Struct.py (Struct.__init__): modified to admit
3490 * IPython/Struct.py (Struct.__init__): modified to admit
3488 initialization via another struct.
3491 initialization via another struct.
3489
3492
3490 * IPython/genutils.py (SystemExec.__init__): New stateful
3493 * IPython/genutils.py (SystemExec.__init__): New stateful
3491 interface to xsys and bq. Useful for writing system scripts.
3494 interface to xsys and bq. Useful for writing system scripts.
3492
3495
3493 2002-05-30 Fernando Perez <fperez@colorado.edu>
3496 2002-05-30 Fernando Perez <fperez@colorado.edu>
3494
3497
3495 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3498 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3496 documents. This will make the user download smaller (it's getting
3499 documents. This will make the user download smaller (it's getting
3497 too big).
3500 too big).
3498
3501
3499 2002-05-29 Fernando Perez <fperez@colorado.edu>
3502 2002-05-29 Fernando Perez <fperez@colorado.edu>
3500
3503
3501 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3504 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3502 fix problems with shelve and pickle. Seems to work, but I don't
3505 fix problems with shelve and pickle. Seems to work, but I don't
3503 know if corner cases break it. Thanks to Mike Heeter
3506 know if corner cases break it. Thanks to Mike Heeter
3504 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3507 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3505
3508
3506 2002-05-24 Fernando Perez <fperez@colorado.edu>
3509 2002-05-24 Fernando Perez <fperez@colorado.edu>
3507
3510
3508 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3511 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3509 macros having broken.
3512 macros having broken.
3510
3513
3511 2002-05-21 Fernando Perez <fperez@colorado.edu>
3514 2002-05-21 Fernando Perez <fperez@colorado.edu>
3512
3515
3513 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3516 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3514 introduced logging bug: all history before logging started was
3517 introduced logging bug: all history before logging started was
3515 being written one character per line! This came from the redesign
3518 being written one character per line! This came from the redesign
3516 of the input history as a special list which slices to strings,
3519 of the input history as a special list which slices to strings,
3517 not to lists.
3520 not to lists.
3518
3521
3519 2002-05-20 Fernando Perez <fperez@colorado.edu>
3522 2002-05-20 Fernando Perez <fperez@colorado.edu>
3520
3523
3521 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3524 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3522 be an attribute of all classes in this module. The design of these
3525 be an attribute of all classes in this module. The design of these
3523 classes needs some serious overhauling.
3526 classes needs some serious overhauling.
3524
3527
3525 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3528 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3526 which was ignoring '_' in option names.
3529 which was ignoring '_' in option names.
3527
3530
3528 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3531 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3529 'Verbose_novars' to 'Context' and made it the new default. It's a
3532 'Verbose_novars' to 'Context' and made it the new default. It's a
3530 bit more readable and also safer than verbose.
3533 bit more readable and also safer than verbose.
3531
3534
3532 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3535 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3533 triple-quoted strings.
3536 triple-quoted strings.
3534
3537
3535 * IPython/OInspect.py (__all__): new module exposing the object
3538 * IPython/OInspect.py (__all__): new module exposing the object
3536 introspection facilities. Now the corresponding magics are dummy
3539 introspection facilities. Now the corresponding magics are dummy
3537 wrappers around this. Having this module will make it much easier
3540 wrappers around this. Having this module will make it much easier
3538 to put these functions into our modified pdb.
3541 to put these functions into our modified pdb.
3539 This new object inspector system uses the new colorizing module,
3542 This new object inspector system uses the new colorizing module,
3540 so source code and other things are nicely syntax highlighted.
3543 so source code and other things are nicely syntax highlighted.
3541
3544
3542 2002-05-18 Fernando Perez <fperez@colorado.edu>
3545 2002-05-18 Fernando Perez <fperez@colorado.edu>
3543
3546
3544 * IPython/ColorANSI.py: Split the coloring tools into a separate
3547 * IPython/ColorANSI.py: Split the coloring tools into a separate
3545 module so I can use them in other code easier (they were part of
3548 module so I can use them in other code easier (they were part of
3546 ultraTB).
3549 ultraTB).
3547
3550
3548 2002-05-17 Fernando Perez <fperez@colorado.edu>
3551 2002-05-17 Fernando Perez <fperez@colorado.edu>
3549
3552
3550 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3553 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3551 fixed it to set the global 'g' also to the called instance, as
3554 fixed it to set the global 'g' also to the called instance, as
3552 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3555 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3553 user's 'g' variables).
3556 user's 'g' variables).
3554
3557
3555 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3558 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3556 global variables (aliases to _ih,_oh) so that users which expect
3559 global variables (aliases to _ih,_oh) so that users which expect
3557 In[5] or Out[7] to work aren't unpleasantly surprised.
3560 In[5] or Out[7] to work aren't unpleasantly surprised.
3558 (InputList.__getslice__): new class to allow executing slices of
3561 (InputList.__getslice__): new class to allow executing slices of
3559 input history directly. Very simple class, complements the use of
3562 input history directly. Very simple class, complements the use of
3560 macros.
3563 macros.
3561
3564
3562 2002-05-16 Fernando Perez <fperez@colorado.edu>
3565 2002-05-16 Fernando Perez <fperez@colorado.edu>
3563
3566
3564 * setup.py (docdirbase): make doc directory be just doc/IPython
3567 * setup.py (docdirbase): make doc directory be just doc/IPython
3565 without version numbers, it will reduce clutter for users.
3568 without version numbers, it will reduce clutter for users.
3566
3569
3567 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3570 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3568 execfile call to prevent possible memory leak. See for details:
3571 execfile call to prevent possible memory leak. See for details:
3569 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3572 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3570
3573
3571 2002-05-15 Fernando Perez <fperez@colorado.edu>
3574 2002-05-15 Fernando Perez <fperez@colorado.edu>
3572
3575
3573 * IPython/Magic.py (Magic.magic_psource): made the object
3576 * IPython/Magic.py (Magic.magic_psource): made the object
3574 introspection names be more standard: pdoc, pdef, pfile and
3577 introspection names be more standard: pdoc, pdef, pfile and
3575 psource. They all print/page their output, and it makes
3578 psource. They all print/page their output, and it makes
3576 remembering them easier. Kept old names for compatibility as
3579 remembering them easier. Kept old names for compatibility as
3577 aliases.
3580 aliases.
3578
3581
3579 2002-05-14 Fernando Perez <fperez@colorado.edu>
3582 2002-05-14 Fernando Perez <fperez@colorado.edu>
3580
3583
3581 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3584 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3582 what the mouse problem was. The trick is to use gnuplot with temp
3585 what the mouse problem was. The trick is to use gnuplot with temp
3583 files and NOT with pipes (for data communication), because having
3586 files and NOT with pipes (for data communication), because having
3584 both pipes and the mouse on is bad news.
3587 both pipes and the mouse on is bad news.
3585
3588
3586 2002-05-13 Fernando Perez <fperez@colorado.edu>
3589 2002-05-13 Fernando Perez <fperez@colorado.edu>
3587
3590
3588 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3591 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3589 bug. Information would be reported about builtins even when
3592 bug. Information would be reported about builtins even when
3590 user-defined functions overrode them.
3593 user-defined functions overrode them.
3591
3594
3592 2002-05-11 Fernando Perez <fperez@colorado.edu>
3595 2002-05-11 Fernando Perez <fperez@colorado.edu>
3593
3596
3594 * IPython/__init__.py (__all__): removed FlexCompleter from
3597 * IPython/__init__.py (__all__): removed FlexCompleter from
3595 __all__ so that things don't fail in platforms without readline.
3598 __all__ so that things don't fail in platforms without readline.
3596
3599
3597 2002-05-10 Fernando Perez <fperez@colorado.edu>
3600 2002-05-10 Fernando Perez <fperez@colorado.edu>
3598
3601
3599 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3602 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3600 it requires Numeric, effectively making Numeric a dependency for
3603 it requires Numeric, effectively making Numeric a dependency for
3601 IPython.
3604 IPython.
3602
3605
3603 * Released 0.2.13
3606 * Released 0.2.13
3604
3607
3605 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3608 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3606 profiler interface. Now all the major options from the profiler
3609 profiler interface. Now all the major options from the profiler
3607 module are directly supported in IPython, both for single
3610 module are directly supported in IPython, both for single
3608 expressions (@prun) and for full programs (@run -p).
3611 expressions (@prun) and for full programs (@run -p).
3609
3612
3610 2002-05-09 Fernando Perez <fperez@colorado.edu>
3613 2002-05-09 Fernando Perez <fperez@colorado.edu>
3611
3614
3612 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3615 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3613 magic properly formatted for screen.
3616 magic properly formatted for screen.
3614
3617
3615 * setup.py (make_shortcut): Changed things to put pdf version in
3618 * setup.py (make_shortcut): Changed things to put pdf version in
3616 doc/ instead of doc/manual (had to change lyxport a bit).
3619 doc/ instead of doc/manual (had to change lyxport a bit).
3617
3620
3618 * IPython/Magic.py (Profile.string_stats): made profile runs go
3621 * IPython/Magic.py (Profile.string_stats): made profile runs go
3619 through pager (they are long and a pager allows searching, saving,
3622 through pager (they are long and a pager allows searching, saving,
3620 etc.)
3623 etc.)
3621
3624
3622 2002-05-08 Fernando Perez <fperez@colorado.edu>
3625 2002-05-08 Fernando Perez <fperez@colorado.edu>
3623
3626
3624 * Released 0.2.12
3627 * Released 0.2.12
3625
3628
3626 2002-05-06 Fernando Perez <fperez@colorado.edu>
3629 2002-05-06 Fernando Perez <fperez@colorado.edu>
3627
3630
3628 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3631 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3629 introduced); 'hist n1 n2' was broken.
3632 introduced); 'hist n1 n2' was broken.
3630 (Magic.magic_pdb): added optional on/off arguments to @pdb
3633 (Magic.magic_pdb): added optional on/off arguments to @pdb
3631 (Magic.magic_run): added option -i to @run, which executes code in
3634 (Magic.magic_run): added option -i to @run, which executes code in
3632 the IPython namespace instead of a clean one. Also added @irun as
3635 the IPython namespace instead of a clean one. Also added @irun as
3633 an alias to @run -i.
3636 an alias to @run -i.
3634
3637
3635 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3638 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3636 fixed (it didn't really do anything, the namespaces were wrong).
3639 fixed (it didn't really do anything, the namespaces were wrong).
3637
3640
3638 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3641 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3639
3642
3640 * IPython/__init__.py (__all__): Fixed package namespace, now
3643 * IPython/__init__.py (__all__): Fixed package namespace, now
3641 'import IPython' does give access to IPython.<all> as
3644 'import IPython' does give access to IPython.<all> as
3642 expected. Also renamed __release__ to Release.
3645 expected. Also renamed __release__ to Release.
3643
3646
3644 * IPython/Debugger.py (__license__): created new Pdb class which
3647 * IPython/Debugger.py (__license__): created new Pdb class which
3645 functions like a drop-in for the normal pdb.Pdb but does NOT
3648 functions like a drop-in for the normal pdb.Pdb but does NOT
3646 import readline by default. This way it doesn't muck up IPython's
3649 import readline by default. This way it doesn't muck up IPython's
3647 readline handling, and now tab-completion finally works in the
3650 readline handling, and now tab-completion finally works in the
3648 debugger -- sort of. It completes things globally visible, but the
3651 debugger -- sort of. It completes things globally visible, but the
3649 completer doesn't track the stack as pdb walks it. That's a bit
3652 completer doesn't track the stack as pdb walks it. That's a bit
3650 tricky, and I'll have to implement it later.
3653 tricky, and I'll have to implement it later.
3651
3654
3652 2002-05-05 Fernando Perez <fperez@colorado.edu>
3655 2002-05-05 Fernando Perez <fperez@colorado.edu>
3653
3656
3654 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3657 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3655 magic docstrings when printed via ? (explicit \'s were being
3658 magic docstrings when printed via ? (explicit \'s were being
3656 printed).
3659 printed).
3657
3660
3658 * IPython/ipmaker.py (make_IPython): fixed namespace
3661 * IPython/ipmaker.py (make_IPython): fixed namespace
3659 identification bug. Now variables loaded via logs or command-line
3662 identification bug. Now variables loaded via logs or command-line
3660 files are recognized in the interactive namespace by @who.
3663 files are recognized in the interactive namespace by @who.
3661
3664
3662 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3665 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3663 log replay system stemming from the string form of Structs.
3666 log replay system stemming from the string form of Structs.
3664
3667
3665 * IPython/Magic.py (Macro.__init__): improved macros to properly
3668 * IPython/Magic.py (Macro.__init__): improved macros to properly
3666 handle magic commands in them.
3669 handle magic commands in them.
3667 (Magic.magic_logstart): usernames are now expanded so 'logstart
3670 (Magic.magic_logstart): usernames are now expanded so 'logstart
3668 ~/mylog' now works.
3671 ~/mylog' now works.
3669
3672
3670 * IPython/iplib.py (complete): fixed bug where paths starting with
3673 * IPython/iplib.py (complete): fixed bug where paths starting with
3671 '/' would be completed as magic names.
3674 '/' would be completed as magic names.
3672
3675
3673 2002-05-04 Fernando Perez <fperez@colorado.edu>
3676 2002-05-04 Fernando Perez <fperez@colorado.edu>
3674
3677
3675 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3678 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3676 allow running full programs under the profiler's control.
3679 allow running full programs under the profiler's control.
3677
3680
3678 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3681 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3679 mode to report exceptions verbosely but without formatting
3682 mode to report exceptions verbosely but without formatting
3680 variables. This addresses the issue of ipython 'freezing' (it's
3683 variables. This addresses the issue of ipython 'freezing' (it's
3681 not frozen, but caught in an expensive formatting loop) when huge
3684 not frozen, but caught in an expensive formatting loop) when huge
3682 variables are in the context of an exception.
3685 variables are in the context of an exception.
3683 (VerboseTB.text): Added '--->' markers at line where exception was
3686 (VerboseTB.text): Added '--->' markers at line where exception was
3684 triggered. Much clearer to read, especially in NoColor modes.
3687 triggered. Much clearer to read, especially in NoColor modes.
3685
3688
3686 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3689 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3687 implemented in reverse when changing to the new parse_options().
3690 implemented in reverse when changing to the new parse_options().
3688
3691
3689 2002-05-03 Fernando Perez <fperez@colorado.edu>
3692 2002-05-03 Fernando Perez <fperez@colorado.edu>
3690
3693
3691 * IPython/Magic.py (Magic.parse_options): new function so that
3694 * IPython/Magic.py (Magic.parse_options): new function so that
3692 magics can parse options easier.
3695 magics can parse options easier.
3693 (Magic.magic_prun): new function similar to profile.run(),
3696 (Magic.magic_prun): new function similar to profile.run(),
3694 suggested by Chris Hart.
3697 suggested by Chris Hart.
3695 (Magic.magic_cd): fixed behavior so that it only changes if
3698 (Magic.magic_cd): fixed behavior so that it only changes if
3696 directory actually is in history.
3699 directory actually is in history.
3697
3700
3698 * IPython/usage.py (__doc__): added information about potential
3701 * IPython/usage.py (__doc__): added information about potential
3699 slowness of Verbose exception mode when there are huge data
3702 slowness of Verbose exception mode when there are huge data
3700 structures to be formatted (thanks to Archie Paulson).
3703 structures to be formatted (thanks to Archie Paulson).
3701
3704
3702 * IPython/ipmaker.py (make_IPython): Changed default logging
3705 * IPython/ipmaker.py (make_IPython): Changed default logging
3703 (when simply called with -log) to use curr_dir/ipython.log in
3706 (when simply called with -log) to use curr_dir/ipython.log in
3704 rotate mode. Fixed crash which was occuring with -log before
3707 rotate mode. Fixed crash which was occuring with -log before
3705 (thanks to Jim Boyle).
3708 (thanks to Jim Boyle).
3706
3709
3707 2002-05-01 Fernando Perez <fperez@colorado.edu>
3710 2002-05-01 Fernando Perez <fperez@colorado.edu>
3708
3711
3709 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3712 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3710 was nasty -- though somewhat of a corner case).
3713 was nasty -- though somewhat of a corner case).
3711
3714
3712 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3715 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3713 text (was a bug).
3716 text (was a bug).
3714
3717
3715 2002-04-30 Fernando Perez <fperez@colorado.edu>
3718 2002-04-30 Fernando Perez <fperez@colorado.edu>
3716
3719
3717 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3720 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3718 a print after ^D or ^C from the user so that the In[] prompt
3721 a print after ^D or ^C from the user so that the In[] prompt
3719 doesn't over-run the gnuplot one.
3722 doesn't over-run the gnuplot one.
3720
3723
3721 2002-04-29 Fernando Perez <fperez@colorado.edu>
3724 2002-04-29 Fernando Perez <fperez@colorado.edu>
3722
3725
3723 * Released 0.2.10
3726 * Released 0.2.10
3724
3727
3725 * IPython/__release__.py (version): get date dynamically.
3728 * IPython/__release__.py (version): get date dynamically.
3726
3729
3727 * Misc. documentation updates thanks to Arnd's comments. Also ran
3730 * Misc. documentation updates thanks to Arnd's comments. Also ran
3728 a full spellcheck on the manual (hadn't been done in a while).
3731 a full spellcheck on the manual (hadn't been done in a while).
3729
3732
3730 2002-04-27 Fernando Perez <fperez@colorado.edu>
3733 2002-04-27 Fernando Perez <fperez@colorado.edu>
3731
3734
3732 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3735 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3733 starting a log in mid-session would reset the input history list.
3736 starting a log in mid-session would reset the input history list.
3734
3737
3735 2002-04-26 Fernando Perez <fperez@colorado.edu>
3738 2002-04-26 Fernando Perez <fperez@colorado.edu>
3736
3739
3737 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3740 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3738 all files were being included in an update. Now anything in
3741 all files were being included in an update. Now anything in
3739 UserConfig that matches [A-Za-z]*.py will go (this excludes
3742 UserConfig that matches [A-Za-z]*.py will go (this excludes
3740 __init__.py)
3743 __init__.py)
3741
3744
3742 2002-04-25 Fernando Perez <fperez@colorado.edu>
3745 2002-04-25 Fernando Perez <fperez@colorado.edu>
3743
3746
3744 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3747 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3745 to __builtins__ so that any form of embedded or imported code can
3748 to __builtins__ so that any form of embedded or imported code can
3746 test for being inside IPython.
3749 test for being inside IPython.
3747
3750
3748 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3751 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3749 changed to GnuplotMagic because it's now an importable module,
3752 changed to GnuplotMagic because it's now an importable module,
3750 this makes the name follow that of the standard Gnuplot module.
3753 this makes the name follow that of the standard Gnuplot module.
3751 GnuplotMagic can now be loaded at any time in mid-session.
3754 GnuplotMagic can now be loaded at any time in mid-session.
3752
3755
3753 2002-04-24 Fernando Perez <fperez@colorado.edu>
3756 2002-04-24 Fernando Perez <fperez@colorado.edu>
3754
3757
3755 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3758 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3756 the globals (IPython has its own namespace) and the
3759 the globals (IPython has its own namespace) and the
3757 PhysicalQuantity stuff is much better anyway.
3760 PhysicalQuantity stuff is much better anyway.
3758
3761
3759 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3762 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3760 embedding example to standard user directory for
3763 embedding example to standard user directory for
3761 distribution. Also put it in the manual.
3764 distribution. Also put it in the manual.
3762
3765
3763 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3766 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3764 instance as first argument (so it doesn't rely on some obscure
3767 instance as first argument (so it doesn't rely on some obscure
3765 hidden global).
3768 hidden global).
3766
3769
3767 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3770 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3768 delimiters. While it prevents ().TAB from working, it allows
3771 delimiters. While it prevents ().TAB from working, it allows
3769 completions in open (... expressions. This is by far a more common
3772 completions in open (... expressions. This is by far a more common
3770 case.
3773 case.
3771
3774
3772 2002-04-23 Fernando Perez <fperez@colorado.edu>
3775 2002-04-23 Fernando Perez <fperez@colorado.edu>
3773
3776
3774 * IPython/Extensions/InterpreterPasteInput.py: new
3777 * IPython/Extensions/InterpreterPasteInput.py: new
3775 syntax-processing module for pasting lines with >>> or ... at the
3778 syntax-processing module for pasting lines with >>> or ... at the
3776 start.
3779 start.
3777
3780
3778 * IPython/Extensions/PhysicalQ_Interactive.py
3781 * IPython/Extensions/PhysicalQ_Interactive.py
3779 (PhysicalQuantityInteractive.__int__): fixed to work with either
3782 (PhysicalQuantityInteractive.__int__): fixed to work with either
3780 Numeric or math.
3783 Numeric or math.
3781
3784
3782 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3785 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3783 provided profiles. Now we have:
3786 provided profiles. Now we have:
3784 -math -> math module as * and cmath with its own namespace.
3787 -math -> math module as * and cmath with its own namespace.
3785 -numeric -> Numeric as *, plus gnuplot & grace
3788 -numeric -> Numeric as *, plus gnuplot & grace
3786 -physics -> same as before
3789 -physics -> same as before
3787
3790
3788 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3791 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3789 user-defined magics wouldn't be found by @magic if they were
3792 user-defined magics wouldn't be found by @magic if they were
3790 defined as class methods. Also cleaned up the namespace search
3793 defined as class methods. Also cleaned up the namespace search
3791 logic and the string building (to use %s instead of many repeated
3794 logic and the string building (to use %s instead of many repeated
3792 string adds).
3795 string adds).
3793
3796
3794 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3797 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3795 of user-defined magics to operate with class methods (cleaner, in
3798 of user-defined magics to operate with class methods (cleaner, in
3796 line with the gnuplot code).
3799 line with the gnuplot code).
3797
3800
3798 2002-04-22 Fernando Perez <fperez@colorado.edu>
3801 2002-04-22 Fernando Perez <fperez@colorado.edu>
3799
3802
3800 * setup.py: updated dependency list so that manual is updated when
3803 * setup.py: updated dependency list so that manual is updated when
3801 all included files change.
3804 all included files change.
3802
3805
3803 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3806 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3804 the delimiter removal option (the fix is ugly right now).
3807 the delimiter removal option (the fix is ugly right now).
3805
3808
3806 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3809 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3807 all of the math profile (quicker loading, no conflict between
3810 all of the math profile (quicker loading, no conflict between
3808 g-9.8 and g-gnuplot).
3811 g-9.8 and g-gnuplot).
3809
3812
3810 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3813 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3811 name of post-mortem files to IPython_crash_report.txt.
3814 name of post-mortem files to IPython_crash_report.txt.
3812
3815
3813 * Cleanup/update of the docs. Added all the new readline info and
3816 * Cleanup/update of the docs. Added all the new readline info and
3814 formatted all lists as 'real lists'.
3817 formatted all lists as 'real lists'.
3815
3818
3816 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3819 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3817 tab-completion options, since the full readline parse_and_bind is
3820 tab-completion options, since the full readline parse_and_bind is
3818 now accessible.
3821 now accessible.
3819
3822
3820 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3823 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3821 handling of readline options. Now users can specify any string to
3824 handling of readline options. Now users can specify any string to
3822 be passed to parse_and_bind(), as well as the delimiters to be
3825 be passed to parse_and_bind(), as well as the delimiters to be
3823 removed.
3826 removed.
3824 (InteractiveShell.__init__): Added __name__ to the global
3827 (InteractiveShell.__init__): Added __name__ to the global
3825 namespace so that things like Itpl which rely on its existence
3828 namespace so that things like Itpl which rely on its existence
3826 don't crash.
3829 don't crash.
3827 (InteractiveShell._prefilter): Defined the default with a _ so
3830 (InteractiveShell._prefilter): Defined the default with a _ so
3828 that prefilter() is easier to override, while the default one
3831 that prefilter() is easier to override, while the default one
3829 remains available.
3832 remains available.
3830
3833
3831 2002-04-18 Fernando Perez <fperez@colorado.edu>
3834 2002-04-18 Fernando Perez <fperez@colorado.edu>
3832
3835
3833 * Added information about pdb in the docs.
3836 * Added information about pdb in the docs.
3834
3837
3835 2002-04-17 Fernando Perez <fperez@colorado.edu>
3838 2002-04-17 Fernando Perez <fperez@colorado.edu>
3836
3839
3837 * IPython/ipmaker.py (make_IPython): added rc_override option to
3840 * IPython/ipmaker.py (make_IPython): added rc_override option to
3838 allow passing config options at creation time which may override
3841 allow passing config options at creation time which may override
3839 anything set in the config files or command line. This is
3842 anything set in the config files or command line. This is
3840 particularly useful for configuring embedded instances.
3843 particularly useful for configuring embedded instances.
3841
3844
3842 2002-04-15 Fernando Perez <fperez@colorado.edu>
3845 2002-04-15 Fernando Perez <fperez@colorado.edu>
3843
3846
3844 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3847 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3845 crash embedded instances because of the input cache falling out of
3848 crash embedded instances because of the input cache falling out of
3846 sync with the output counter.
3849 sync with the output counter.
3847
3850
3848 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3851 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3849 mode which calls pdb after an uncaught exception in IPython itself.
3852 mode which calls pdb after an uncaught exception in IPython itself.
3850
3853
3851 2002-04-14 Fernando Perez <fperez@colorado.edu>
3854 2002-04-14 Fernando Perez <fperez@colorado.edu>
3852
3855
3853 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3856 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3854 readline, fix it back after each call.
3857 readline, fix it back after each call.
3855
3858
3856 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3859 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3857 method to force all access via __call__(), which guarantees that
3860 method to force all access via __call__(), which guarantees that
3858 traceback references are properly deleted.
3861 traceback references are properly deleted.
3859
3862
3860 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3863 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3861 improve printing when pprint is in use.
3864 improve printing when pprint is in use.
3862
3865
3863 2002-04-13 Fernando Perez <fperez@colorado.edu>
3866 2002-04-13 Fernando Perez <fperez@colorado.edu>
3864
3867
3865 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3868 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3866 exceptions aren't caught anymore. If the user triggers one, he
3869 exceptions aren't caught anymore. If the user triggers one, he
3867 should know why he's doing it and it should go all the way up,
3870 should know why he's doing it and it should go all the way up,
3868 just like any other exception. So now @abort will fully kill the
3871 just like any other exception. So now @abort will fully kill the
3869 embedded interpreter and the embedding code (unless that happens
3872 embedded interpreter and the embedding code (unless that happens
3870 to catch SystemExit).
3873 to catch SystemExit).
3871
3874
3872 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3875 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3873 and a debugger() method to invoke the interactive pdb debugger
3876 and a debugger() method to invoke the interactive pdb debugger
3874 after printing exception information. Also added the corresponding
3877 after printing exception information. Also added the corresponding
3875 -pdb option and @pdb magic to control this feature, and updated
3878 -pdb option and @pdb magic to control this feature, and updated
3876 the docs. After a suggestion from Christopher Hart
3879 the docs. After a suggestion from Christopher Hart
3877 (hart-AT-caltech.edu).
3880 (hart-AT-caltech.edu).
3878
3881
3879 2002-04-12 Fernando Perez <fperez@colorado.edu>
3882 2002-04-12 Fernando Perez <fperez@colorado.edu>
3880
3883
3881 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3884 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3882 the exception handlers defined by the user (not the CrashHandler)
3885 the exception handlers defined by the user (not the CrashHandler)
3883 so that user exceptions don't trigger an ipython bug report.
3886 so that user exceptions don't trigger an ipython bug report.
3884
3887
3885 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3888 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3886 configurable (it should have always been so).
3889 configurable (it should have always been so).
3887
3890
3888 2002-03-26 Fernando Perez <fperez@colorado.edu>
3891 2002-03-26 Fernando Perez <fperez@colorado.edu>
3889
3892
3890 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3893 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3891 and there to fix embedding namespace issues. This should all be
3894 and there to fix embedding namespace issues. This should all be
3892 done in a more elegant way.
3895 done in a more elegant way.
3893
3896
3894 2002-03-25 Fernando Perez <fperez@colorado.edu>
3897 2002-03-25 Fernando Perez <fperez@colorado.edu>
3895
3898
3896 * IPython/genutils.py (get_home_dir): Try to make it work under
3899 * IPython/genutils.py (get_home_dir): Try to make it work under
3897 win9x also.
3900 win9x also.
3898
3901
3899 2002-03-20 Fernando Perez <fperez@colorado.edu>
3902 2002-03-20 Fernando Perez <fperez@colorado.edu>
3900
3903
3901 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3904 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3902 sys.displayhook untouched upon __init__.
3905 sys.displayhook untouched upon __init__.
3903
3906
3904 2002-03-19 Fernando Perez <fperez@colorado.edu>
3907 2002-03-19 Fernando Perez <fperez@colorado.edu>
3905
3908
3906 * Released 0.2.9 (for embedding bug, basically).
3909 * Released 0.2.9 (for embedding bug, basically).
3907
3910
3908 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3911 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3909 exceptions so that enclosing shell's state can be restored.
3912 exceptions so that enclosing shell's state can be restored.
3910
3913
3911 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3914 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3912 naming conventions in the .ipython/ dir.
3915 naming conventions in the .ipython/ dir.
3913
3916
3914 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3917 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3915 from delimiters list so filenames with - in them get expanded.
3918 from delimiters list so filenames with - in them get expanded.
3916
3919
3917 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3920 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3918 sys.displayhook not being properly restored after an embedded call.
3921 sys.displayhook not being properly restored after an embedded call.
3919
3922
3920 2002-03-18 Fernando Perez <fperez@colorado.edu>
3923 2002-03-18 Fernando Perez <fperez@colorado.edu>
3921
3924
3922 * Released 0.2.8
3925 * Released 0.2.8
3923
3926
3924 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3927 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3925 some files weren't being included in a -upgrade.
3928 some files weren't being included in a -upgrade.
3926 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3929 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3927 on' so that the first tab completes.
3930 on' so that the first tab completes.
3928 (InteractiveShell.handle_magic): fixed bug with spaces around
3931 (InteractiveShell.handle_magic): fixed bug with spaces around
3929 quotes breaking many magic commands.
3932 quotes breaking many magic commands.
3930
3933
3931 * setup.py: added note about ignoring the syntax error messages at
3934 * setup.py: added note about ignoring the syntax error messages at
3932 installation.
3935 installation.
3933
3936
3934 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3937 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3935 streamlining the gnuplot interface, now there's only one magic @gp.
3938 streamlining the gnuplot interface, now there's only one magic @gp.
3936
3939
3937 2002-03-17 Fernando Perez <fperez@colorado.edu>
3940 2002-03-17 Fernando Perez <fperez@colorado.edu>
3938
3941
3939 * IPython/UserConfig/magic_gnuplot.py: new name for the
3942 * IPython/UserConfig/magic_gnuplot.py: new name for the
3940 example-magic_pm.py file. Much enhanced system, now with a shell
3943 example-magic_pm.py file. Much enhanced system, now with a shell
3941 for communicating directly with gnuplot, one command at a time.
3944 for communicating directly with gnuplot, one command at a time.
3942
3945
3943 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3946 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3944 setting __name__=='__main__'.
3947 setting __name__=='__main__'.
3945
3948
3946 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3949 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3947 mini-shell for accessing gnuplot from inside ipython. Should
3950 mini-shell for accessing gnuplot from inside ipython. Should
3948 extend it later for grace access too. Inspired by Arnd's
3951 extend it later for grace access too. Inspired by Arnd's
3949 suggestion.
3952 suggestion.
3950
3953
3951 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3954 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3952 calling magic functions with () in their arguments. Thanks to Arnd
3955 calling magic functions with () in their arguments. Thanks to Arnd
3953 Baecker for pointing this to me.
3956 Baecker for pointing this to me.
3954
3957
3955 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3958 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3956 infinitely for integer or complex arrays (only worked with floats).
3959 infinitely for integer or complex arrays (only worked with floats).
3957
3960
3958 2002-03-16 Fernando Perez <fperez@colorado.edu>
3961 2002-03-16 Fernando Perez <fperez@colorado.edu>
3959
3962
3960 * setup.py: Merged setup and setup_windows into a single script
3963 * setup.py: Merged setup and setup_windows into a single script
3961 which properly handles things for windows users.
3964 which properly handles things for windows users.
3962
3965
3963 2002-03-15 Fernando Perez <fperez@colorado.edu>
3966 2002-03-15 Fernando Perez <fperez@colorado.edu>
3964
3967
3965 * Big change to the manual: now the magics are all automatically
3968 * Big change to the manual: now the magics are all automatically
3966 documented. This information is generated from their docstrings
3969 documented. This information is generated from their docstrings
3967 and put in a latex file included by the manual lyx file. This way
3970 and put in a latex file included by the manual lyx file. This way
3968 we get always up to date information for the magics. The manual
3971 we get always up to date information for the magics. The manual
3969 now also has proper version information, also auto-synced.
3972 now also has proper version information, also auto-synced.
3970
3973
3971 For this to work, an undocumented --magic_docstrings option was added.
3974 For this to work, an undocumented --magic_docstrings option was added.
3972
3975
3973 2002-03-13 Fernando Perez <fperez@colorado.edu>
3976 2002-03-13 Fernando Perez <fperez@colorado.edu>
3974
3977
3975 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3978 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3976 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3979 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3977
3980
3978 2002-03-12 Fernando Perez <fperez@colorado.edu>
3981 2002-03-12 Fernando Perez <fperez@colorado.edu>
3979
3982
3980 * IPython/ultraTB.py (TermColors): changed color escapes again to
3983 * IPython/ultraTB.py (TermColors): changed color escapes again to
3981 fix the (old, reintroduced) line-wrapping bug. Basically, if
3984 fix the (old, reintroduced) line-wrapping bug. Basically, if
3982 \001..\002 aren't given in the color escapes, lines get wrapped
3985 \001..\002 aren't given in the color escapes, lines get wrapped
3983 weirdly. But giving those screws up old xterms and emacs terms. So
3986 weirdly. But giving those screws up old xterms and emacs terms. So
3984 I added some logic for emacs terms to be ok, but I can't identify old
3987 I added some logic for emacs terms to be ok, but I can't identify old
3985 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3988 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3986
3989
3987 2002-03-10 Fernando Perez <fperez@colorado.edu>
3990 2002-03-10 Fernando Perez <fperez@colorado.edu>
3988
3991
3989 * IPython/usage.py (__doc__): Various documentation cleanups and
3992 * IPython/usage.py (__doc__): Various documentation cleanups and
3990 updates, both in usage docstrings and in the manual.
3993 updates, both in usage docstrings and in the manual.
3991
3994
3992 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3995 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3993 handling of caching. Set minimum acceptabe value for having a
3996 handling of caching. Set minimum acceptabe value for having a
3994 cache at 20 values.
3997 cache at 20 values.
3995
3998
3996 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3999 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3997 install_first_time function to a method, renamed it and added an
4000 install_first_time function to a method, renamed it and added an
3998 'upgrade' mode. Now people can update their config directory with
4001 'upgrade' mode. Now people can update their config directory with
3999 a simple command line switch (-upgrade, also new).
4002 a simple command line switch (-upgrade, also new).
4000
4003
4001 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4004 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4002 @file (convenient for automagic users under Python >= 2.2).
4005 @file (convenient for automagic users under Python >= 2.2).
4003 Removed @files (it seemed more like a plural than an abbrev. of
4006 Removed @files (it seemed more like a plural than an abbrev. of
4004 'file show').
4007 'file show').
4005
4008
4006 * IPython/iplib.py (install_first_time): Fixed crash if there were
4009 * IPython/iplib.py (install_first_time): Fixed crash if there were
4007 backup files ('~') in .ipython/ install directory.
4010 backup files ('~') in .ipython/ install directory.
4008
4011
4009 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4012 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4010 system. Things look fine, but these changes are fairly
4013 system. Things look fine, but these changes are fairly
4011 intrusive. Test them for a few days.
4014 intrusive. Test them for a few days.
4012
4015
4013 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4016 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4014 the prompts system. Now all in/out prompt strings are user
4017 the prompts system. Now all in/out prompt strings are user
4015 controllable. This is particularly useful for embedding, as one
4018 controllable. This is particularly useful for embedding, as one
4016 can tag embedded instances with particular prompts.
4019 can tag embedded instances with particular prompts.
4017
4020
4018 Also removed global use of sys.ps1/2, which now allows nested
4021 Also removed global use of sys.ps1/2, which now allows nested
4019 embeddings without any problems. Added command-line options for
4022 embeddings without any problems. Added command-line options for
4020 the prompt strings.
4023 the prompt strings.
4021
4024
4022 2002-03-08 Fernando Perez <fperez@colorado.edu>
4025 2002-03-08 Fernando Perez <fperez@colorado.edu>
4023
4026
4024 * IPython/UserConfig/example-embed-short.py (ipshell): added
4027 * IPython/UserConfig/example-embed-short.py (ipshell): added
4025 example file with the bare minimum code for embedding.
4028 example file with the bare minimum code for embedding.
4026
4029
4027 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4030 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4028 functionality for the embeddable shell to be activated/deactivated
4031 functionality for the embeddable shell to be activated/deactivated
4029 either globally or at each call.
4032 either globally or at each call.
4030
4033
4031 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4034 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4032 rewriting the prompt with '--->' for auto-inputs with proper
4035 rewriting the prompt with '--->' for auto-inputs with proper
4033 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4036 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4034 this is handled by the prompts class itself, as it should.
4037 this is handled by the prompts class itself, as it should.
4035
4038
4036 2002-03-05 Fernando Perez <fperez@colorado.edu>
4039 2002-03-05 Fernando Perez <fperez@colorado.edu>
4037
4040
4038 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4041 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4039 @logstart to avoid name clashes with the math log function.
4042 @logstart to avoid name clashes with the math log function.
4040
4043
4041 * Big updates to X/Emacs section of the manual.
4044 * Big updates to X/Emacs section of the manual.
4042
4045
4043 * Removed ipython_emacs. Milan explained to me how to pass
4046 * Removed ipython_emacs. Milan explained to me how to pass
4044 arguments to ipython through Emacs. Some day I'm going to end up
4047 arguments to ipython through Emacs. Some day I'm going to end up
4045 learning some lisp...
4048 learning some lisp...
4046
4049
4047 2002-03-04 Fernando Perez <fperez@colorado.edu>
4050 2002-03-04 Fernando Perez <fperez@colorado.edu>
4048
4051
4049 * IPython/ipython_emacs: Created script to be used as the
4052 * IPython/ipython_emacs: Created script to be used as the
4050 py-python-command Emacs variable so we can pass IPython
4053 py-python-command Emacs variable so we can pass IPython
4051 parameters. I can't figure out how to tell Emacs directly to pass
4054 parameters. I can't figure out how to tell Emacs directly to pass
4052 parameters to IPython, so a dummy shell script will do it.
4055 parameters to IPython, so a dummy shell script will do it.
4053
4056
4054 Other enhancements made for things to work better under Emacs'
4057 Other enhancements made for things to work better under Emacs'
4055 various types of terminals. Many thanks to Milan Zamazal
4058 various types of terminals. Many thanks to Milan Zamazal
4056 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4059 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4057
4060
4058 2002-03-01 Fernando Perez <fperez@colorado.edu>
4061 2002-03-01 Fernando Perez <fperez@colorado.edu>
4059
4062
4060 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4063 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4061 that loading of readline is now optional. This gives better
4064 that loading of readline is now optional. This gives better
4062 control to emacs users.
4065 control to emacs users.
4063
4066
4064 * IPython/ultraTB.py (__date__): Modified color escape sequences
4067 * IPython/ultraTB.py (__date__): Modified color escape sequences
4065 and now things work fine under xterm and in Emacs' term buffers
4068 and now things work fine under xterm and in Emacs' term buffers
4066 (though not shell ones). Well, in emacs you get colors, but all
4069 (though not shell ones). Well, in emacs you get colors, but all
4067 seem to be 'light' colors (no difference between dark and light
4070 seem to be 'light' colors (no difference between dark and light
4068 ones). But the garbage chars are gone, and also in xterms. It
4071 ones). But the garbage chars are gone, and also in xterms. It
4069 seems that now I'm using 'cleaner' ansi sequences.
4072 seems that now I'm using 'cleaner' ansi sequences.
4070
4073
4071 2002-02-21 Fernando Perez <fperez@colorado.edu>
4074 2002-02-21 Fernando Perez <fperez@colorado.edu>
4072
4075
4073 * Released 0.2.7 (mainly to publish the scoping fix).
4076 * Released 0.2.7 (mainly to publish the scoping fix).
4074
4077
4075 * IPython/Logger.py (Logger.logstate): added. A corresponding
4078 * IPython/Logger.py (Logger.logstate): added. A corresponding
4076 @logstate magic was created.
4079 @logstate magic was created.
4077
4080
4078 * IPython/Magic.py: fixed nested scoping problem under Python
4081 * IPython/Magic.py: fixed nested scoping problem under Python
4079 2.1.x (automagic wasn't working).
4082 2.1.x (automagic wasn't working).
4080
4083
4081 2002-02-20 Fernando Perez <fperez@colorado.edu>
4084 2002-02-20 Fernando Perez <fperez@colorado.edu>
4082
4085
4083 * Released 0.2.6.
4086 * Released 0.2.6.
4084
4087
4085 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4088 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4086 option so that logs can come out without any headers at all.
4089 option so that logs can come out without any headers at all.
4087
4090
4088 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4091 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4089 SciPy.
4092 SciPy.
4090
4093
4091 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4094 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4092 that embedded IPython calls don't require vars() to be explicitly
4095 that embedded IPython calls don't require vars() to be explicitly
4093 passed. Now they are extracted from the caller's frame (code
4096 passed. Now they are extracted from the caller's frame (code
4094 snatched from Eric Jones' weave). Added better documentation to
4097 snatched from Eric Jones' weave). Added better documentation to
4095 the section on embedding and the example file.
4098 the section on embedding and the example file.
4096
4099
4097 * IPython/genutils.py (page): Changed so that under emacs, it just
4100 * IPython/genutils.py (page): Changed so that under emacs, it just
4098 prints the string. You can then page up and down in the emacs
4101 prints the string. You can then page up and down in the emacs
4099 buffer itself. This is how the builtin help() works.
4102 buffer itself. This is how the builtin help() works.
4100
4103
4101 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4104 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4102 macro scoping: macros need to be executed in the user's namespace
4105 macro scoping: macros need to be executed in the user's namespace
4103 to work as if they had been typed by the user.
4106 to work as if they had been typed by the user.
4104
4107
4105 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4108 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4106 execute automatically (no need to type 'exec...'). They then
4109 execute automatically (no need to type 'exec...'). They then
4107 behave like 'true macros'. The printing system was also modified
4110 behave like 'true macros'. The printing system was also modified
4108 for this to work.
4111 for this to work.
4109
4112
4110 2002-02-19 Fernando Perez <fperez@colorado.edu>
4113 2002-02-19 Fernando Perez <fperez@colorado.edu>
4111
4114
4112 * IPython/genutils.py (page_file): new function for paging files
4115 * IPython/genutils.py (page_file): new function for paging files
4113 in an OS-independent way. Also necessary for file viewing to work
4116 in an OS-independent way. Also necessary for file viewing to work
4114 well inside Emacs buffers.
4117 well inside Emacs buffers.
4115 (page): Added checks for being in an emacs buffer.
4118 (page): Added checks for being in an emacs buffer.
4116 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4119 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4117 same bug in iplib.
4120 same bug in iplib.
4118
4121
4119 2002-02-18 Fernando Perez <fperez@colorado.edu>
4122 2002-02-18 Fernando Perez <fperez@colorado.edu>
4120
4123
4121 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4124 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4122 of readline so that IPython can work inside an Emacs buffer.
4125 of readline so that IPython can work inside an Emacs buffer.
4123
4126
4124 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4127 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4125 method signatures (they weren't really bugs, but it looks cleaner
4128 method signatures (they weren't really bugs, but it looks cleaner
4126 and keeps PyChecker happy).
4129 and keeps PyChecker happy).
4127
4130
4128 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4131 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4129 for implementing various user-defined hooks. Currently only
4132 for implementing various user-defined hooks. Currently only
4130 display is done.
4133 display is done.
4131
4134
4132 * IPython/Prompts.py (CachedOutput._display): changed display
4135 * IPython/Prompts.py (CachedOutput._display): changed display
4133 functions so that they can be dynamically changed by users easily.
4136 functions so that they can be dynamically changed by users easily.
4134
4137
4135 * IPython/Extensions/numeric_formats.py (num_display): added an
4138 * IPython/Extensions/numeric_formats.py (num_display): added an
4136 extension for printing NumPy arrays in flexible manners. It
4139 extension for printing NumPy arrays in flexible manners. It
4137 doesn't do anything yet, but all the structure is in
4140 doesn't do anything yet, but all the structure is in
4138 place. Ultimately the plan is to implement output format control
4141 place. Ultimately the plan is to implement output format control
4139 like in Octave.
4142 like in Octave.
4140
4143
4141 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4144 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4142 methods are found at run-time by all the automatic machinery.
4145 methods are found at run-time by all the automatic machinery.
4143
4146
4144 2002-02-17 Fernando Perez <fperez@colorado.edu>
4147 2002-02-17 Fernando Perez <fperez@colorado.edu>
4145
4148
4146 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4149 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4147 whole file a little.
4150 whole file a little.
4148
4151
4149 * ToDo: closed this document. Now there's a new_design.lyx
4152 * ToDo: closed this document. Now there's a new_design.lyx
4150 document for all new ideas. Added making a pdf of it for the
4153 document for all new ideas. Added making a pdf of it for the
4151 end-user distro.
4154 end-user distro.
4152
4155
4153 * IPython/Logger.py (Logger.switch_log): Created this to replace
4156 * IPython/Logger.py (Logger.switch_log): Created this to replace
4154 logon() and logoff(). It also fixes a nasty crash reported by
4157 logon() and logoff(). It also fixes a nasty crash reported by
4155 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4158 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4156
4159
4157 * IPython/iplib.py (complete): got auto-completion to work with
4160 * IPython/iplib.py (complete): got auto-completion to work with
4158 automagic (I had wanted this for a long time).
4161 automagic (I had wanted this for a long time).
4159
4162
4160 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4163 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4161 to @file, since file() is now a builtin and clashes with automagic
4164 to @file, since file() is now a builtin and clashes with automagic
4162 for @file.
4165 for @file.
4163
4166
4164 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4167 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4165 of this was previously in iplib, which had grown to more than 2000
4168 of this was previously in iplib, which had grown to more than 2000
4166 lines, way too long. No new functionality, but it makes managing
4169 lines, way too long. No new functionality, but it makes managing
4167 the code a bit easier.
4170 the code a bit easier.
4168
4171
4169 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4172 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4170 information to crash reports.
4173 information to crash reports.
4171
4174
4172 2002-02-12 Fernando Perez <fperez@colorado.edu>
4175 2002-02-12 Fernando Perez <fperez@colorado.edu>
4173
4176
4174 * Released 0.2.5.
4177 * Released 0.2.5.
4175
4178
4176 2002-02-11 Fernando Perez <fperez@colorado.edu>
4179 2002-02-11 Fernando Perez <fperez@colorado.edu>
4177
4180
4178 * Wrote a relatively complete Windows installer. It puts
4181 * Wrote a relatively complete Windows installer. It puts
4179 everything in place, creates Start Menu entries and fixes the
4182 everything in place, creates Start Menu entries and fixes the
4180 color issues. Nothing fancy, but it works.
4183 color issues. Nothing fancy, but it works.
4181
4184
4182 2002-02-10 Fernando Perez <fperez@colorado.edu>
4185 2002-02-10 Fernando Perez <fperez@colorado.edu>
4183
4186
4184 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4187 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4185 os.path.expanduser() call so that we can type @run ~/myfile.py and
4188 os.path.expanduser() call so that we can type @run ~/myfile.py and
4186 have thigs work as expected.
4189 have thigs work as expected.
4187
4190
4188 * IPython/genutils.py (page): fixed exception handling so things
4191 * IPython/genutils.py (page): fixed exception handling so things
4189 work both in Unix and Windows correctly. Quitting a pager triggers
4192 work both in Unix and Windows correctly. Quitting a pager triggers
4190 an IOError/broken pipe in Unix, and in windows not finding a pager
4193 an IOError/broken pipe in Unix, and in windows not finding a pager
4191 is also an IOError, so I had to actually look at the return value
4194 is also an IOError, so I had to actually look at the return value
4192 of the exception, not just the exception itself. Should be ok now.
4195 of the exception, not just the exception itself. Should be ok now.
4193
4196
4194 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4197 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4195 modified to allow case-insensitive color scheme changes.
4198 modified to allow case-insensitive color scheme changes.
4196
4199
4197 2002-02-09 Fernando Perez <fperez@colorado.edu>
4200 2002-02-09 Fernando Perez <fperez@colorado.edu>
4198
4201
4199 * IPython/genutils.py (native_line_ends): new function to leave
4202 * IPython/genutils.py (native_line_ends): new function to leave
4200 user config files with os-native line-endings.
4203 user config files with os-native line-endings.
4201
4204
4202 * README and manual updates.
4205 * README and manual updates.
4203
4206
4204 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4207 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4205 instead of StringType to catch Unicode strings.
4208 instead of StringType to catch Unicode strings.
4206
4209
4207 * IPython/genutils.py (filefind): fixed bug for paths with
4210 * IPython/genutils.py (filefind): fixed bug for paths with
4208 embedded spaces (very common in Windows).
4211 embedded spaces (very common in Windows).
4209
4212
4210 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4213 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4211 files under Windows, so that they get automatically associated
4214 files under Windows, so that they get automatically associated
4212 with a text editor. Windows makes it a pain to handle
4215 with a text editor. Windows makes it a pain to handle
4213 extension-less files.
4216 extension-less files.
4214
4217
4215 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4218 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4216 warning about readline only occur for Posix. In Windows there's no
4219 warning about readline only occur for Posix. In Windows there's no
4217 way to get readline, so why bother with the warning.
4220 way to get readline, so why bother with the warning.
4218
4221
4219 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4222 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4220 for __str__ instead of dir(self), since dir() changed in 2.2.
4223 for __str__ instead of dir(self), since dir() changed in 2.2.
4221
4224
4222 * Ported to Windows! Tested on XP, I suspect it should work fine
4225 * Ported to Windows! Tested on XP, I suspect it should work fine
4223 on NT/2000, but I don't think it will work on 98 et al. That
4226 on NT/2000, but I don't think it will work on 98 et al. That
4224 series of Windows is such a piece of junk anyway that I won't try
4227 series of Windows is such a piece of junk anyway that I won't try
4225 porting it there. The XP port was straightforward, showed a few
4228 porting it there. The XP port was straightforward, showed a few
4226 bugs here and there (fixed all), in particular some string
4229 bugs here and there (fixed all), in particular some string
4227 handling stuff which required considering Unicode strings (which
4230 handling stuff which required considering Unicode strings (which
4228 Windows uses). This is good, but hasn't been too tested :) No
4231 Windows uses). This is good, but hasn't been too tested :) No
4229 fancy installer yet, I'll put a note in the manual so people at
4232 fancy installer yet, I'll put a note in the manual so people at
4230 least make manually a shortcut.
4233 least make manually a shortcut.
4231
4234
4232 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4235 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4233 into a single one, "colors". This now controls both prompt and
4236 into a single one, "colors". This now controls both prompt and
4234 exception color schemes, and can be changed both at startup
4237 exception color schemes, and can be changed both at startup
4235 (either via command-line switches or via ipythonrc files) and at
4238 (either via command-line switches or via ipythonrc files) and at
4236 runtime, with @colors.
4239 runtime, with @colors.
4237 (Magic.magic_run): renamed @prun to @run and removed the old
4240 (Magic.magic_run): renamed @prun to @run and removed the old
4238 @run. The two were too similar to warrant keeping both.
4241 @run. The two were too similar to warrant keeping both.
4239
4242
4240 2002-02-03 Fernando Perez <fperez@colorado.edu>
4243 2002-02-03 Fernando Perez <fperez@colorado.edu>
4241
4244
4242 * IPython/iplib.py (install_first_time): Added comment on how to
4245 * IPython/iplib.py (install_first_time): Added comment on how to
4243 configure the color options for first-time users. Put a <return>
4246 configure the color options for first-time users. Put a <return>
4244 request at the end so that small-terminal users get a chance to
4247 request at the end so that small-terminal users get a chance to
4245 read the startup info.
4248 read the startup info.
4246
4249
4247 2002-01-23 Fernando Perez <fperez@colorado.edu>
4250 2002-01-23 Fernando Perez <fperez@colorado.edu>
4248
4251
4249 * IPython/iplib.py (CachedOutput.update): Changed output memory
4252 * IPython/iplib.py (CachedOutput.update): Changed output memory
4250 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4253 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4251 input history we still use _i. Did this b/c these variable are
4254 input history we still use _i. Did this b/c these variable are
4252 very commonly used in interactive work, so the less we need to
4255 very commonly used in interactive work, so the less we need to
4253 type the better off we are.
4256 type the better off we are.
4254 (Magic.magic_prun): updated @prun to better handle the namespaces
4257 (Magic.magic_prun): updated @prun to better handle the namespaces
4255 the file will run in, including a fix for __name__ not being set
4258 the file will run in, including a fix for __name__ not being set
4256 before.
4259 before.
4257
4260
4258 2002-01-20 Fernando Perez <fperez@colorado.edu>
4261 2002-01-20 Fernando Perez <fperez@colorado.edu>
4259
4262
4260 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4263 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4261 extra garbage for Python 2.2. Need to look more carefully into
4264 extra garbage for Python 2.2. Need to look more carefully into
4262 this later.
4265 this later.
4263
4266
4264 2002-01-19 Fernando Perez <fperez@colorado.edu>
4267 2002-01-19 Fernando Perez <fperez@colorado.edu>
4265
4268
4266 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4269 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4267 display SyntaxError exceptions properly formatted when they occur
4270 display SyntaxError exceptions properly formatted when they occur
4268 (they can be triggered by imported code).
4271 (they can be triggered by imported code).
4269
4272
4270 2002-01-18 Fernando Perez <fperez@colorado.edu>
4273 2002-01-18 Fernando Perez <fperez@colorado.edu>
4271
4274
4272 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4275 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4273 SyntaxError exceptions are reported nicely formatted, instead of
4276 SyntaxError exceptions are reported nicely formatted, instead of
4274 spitting out only offset information as before.
4277 spitting out only offset information as before.
4275 (Magic.magic_prun): Added the @prun function for executing
4278 (Magic.magic_prun): Added the @prun function for executing
4276 programs with command line args inside IPython.
4279 programs with command line args inside IPython.
4277
4280
4278 2002-01-16 Fernando Perez <fperez@colorado.edu>
4281 2002-01-16 Fernando Perez <fperez@colorado.edu>
4279
4282
4280 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4283 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4281 to *not* include the last item given in a range. This brings their
4284 to *not* include the last item given in a range. This brings their
4282 behavior in line with Python's slicing:
4285 behavior in line with Python's slicing:
4283 a[n1:n2] -> a[n1]...a[n2-1]
4286 a[n1:n2] -> a[n1]...a[n2-1]
4284 It may be a bit less convenient, but I prefer to stick to Python's
4287 It may be a bit less convenient, but I prefer to stick to Python's
4285 conventions *everywhere*, so users never have to wonder.
4288 conventions *everywhere*, so users never have to wonder.
4286 (Magic.magic_macro): Added @macro function to ease the creation of
4289 (Magic.magic_macro): Added @macro function to ease the creation of
4287 macros.
4290 macros.
4288
4291
4289 2002-01-05 Fernando Perez <fperez@colorado.edu>
4292 2002-01-05 Fernando Perez <fperez@colorado.edu>
4290
4293
4291 * Released 0.2.4.
4294 * Released 0.2.4.
4292
4295
4293 * IPython/iplib.py (Magic.magic_pdef):
4296 * IPython/iplib.py (Magic.magic_pdef):
4294 (InteractiveShell.safe_execfile): report magic lines and error
4297 (InteractiveShell.safe_execfile): report magic lines and error
4295 lines without line numbers so one can easily copy/paste them for
4298 lines without line numbers so one can easily copy/paste them for
4296 re-execution.
4299 re-execution.
4297
4300
4298 * Updated manual with recent changes.
4301 * Updated manual with recent changes.
4299
4302
4300 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4303 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4301 docstring printing when class? is called. Very handy for knowing
4304 docstring printing when class? is called. Very handy for knowing
4302 how to create class instances (as long as __init__ is well
4305 how to create class instances (as long as __init__ is well
4303 documented, of course :)
4306 documented, of course :)
4304 (Magic.magic_doc): print both class and constructor docstrings.
4307 (Magic.magic_doc): print both class and constructor docstrings.
4305 (Magic.magic_pdef): give constructor info if passed a class and
4308 (Magic.magic_pdef): give constructor info if passed a class and
4306 __call__ info for callable object instances.
4309 __call__ info for callable object instances.
4307
4310
4308 2002-01-04 Fernando Perez <fperez@colorado.edu>
4311 2002-01-04 Fernando Perez <fperez@colorado.edu>
4309
4312
4310 * Made deep_reload() off by default. It doesn't always work
4313 * Made deep_reload() off by default. It doesn't always work
4311 exactly as intended, so it's probably safer to have it off. It's
4314 exactly as intended, so it's probably safer to have it off. It's
4312 still available as dreload() anyway, so nothing is lost.
4315 still available as dreload() anyway, so nothing is lost.
4313
4316
4314 2002-01-02 Fernando Perez <fperez@colorado.edu>
4317 2002-01-02 Fernando Perez <fperez@colorado.edu>
4315
4318
4316 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4319 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4317 so I wanted an updated release).
4320 so I wanted an updated release).
4318
4321
4319 2001-12-27 Fernando Perez <fperez@colorado.edu>
4322 2001-12-27 Fernando Perez <fperez@colorado.edu>
4320
4323
4321 * IPython/iplib.py (InteractiveShell.interact): Added the original
4324 * IPython/iplib.py (InteractiveShell.interact): Added the original
4322 code from 'code.py' for this module in order to change the
4325 code from 'code.py' for this module in order to change the
4323 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4326 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4324 the history cache would break when the user hit Ctrl-C, and
4327 the history cache would break when the user hit Ctrl-C, and
4325 interact() offers no way to add any hooks to it.
4328 interact() offers no way to add any hooks to it.
4326
4329
4327 2001-12-23 Fernando Perez <fperez@colorado.edu>
4330 2001-12-23 Fernando Perez <fperez@colorado.edu>
4328
4331
4329 * setup.py: added check for 'MANIFEST' before trying to remove
4332 * setup.py: added check for 'MANIFEST' before trying to remove
4330 it. Thanks to Sean Reifschneider.
4333 it. Thanks to Sean Reifschneider.
4331
4334
4332 2001-12-22 Fernando Perez <fperez@colorado.edu>
4335 2001-12-22 Fernando Perez <fperez@colorado.edu>
4333
4336
4334 * Released 0.2.2.
4337 * Released 0.2.2.
4335
4338
4336 * Finished (reasonably) writing the manual. Later will add the
4339 * Finished (reasonably) writing the manual. Later will add the
4337 python-standard navigation stylesheets, but for the time being
4340 python-standard navigation stylesheets, but for the time being
4338 it's fairly complete. Distribution will include html and pdf
4341 it's fairly complete. Distribution will include html and pdf
4339 versions.
4342 versions.
4340
4343
4341 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4344 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4342 (MayaVi author).
4345 (MayaVi author).
4343
4346
4344 2001-12-21 Fernando Perez <fperez@colorado.edu>
4347 2001-12-21 Fernando Perez <fperez@colorado.edu>
4345
4348
4346 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4349 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4347 good public release, I think (with the manual and the distutils
4350 good public release, I think (with the manual and the distutils
4348 installer). The manual can use some work, but that can go
4351 installer). The manual can use some work, but that can go
4349 slowly. Otherwise I think it's quite nice for end users. Next
4352 slowly. Otherwise I think it's quite nice for end users. Next
4350 summer, rewrite the guts of it...
4353 summer, rewrite the guts of it...
4351
4354
4352 * Changed format of ipythonrc files to use whitespace as the
4355 * Changed format of ipythonrc files to use whitespace as the
4353 separator instead of an explicit '='. Cleaner.
4356 separator instead of an explicit '='. Cleaner.
4354
4357
4355 2001-12-20 Fernando Perez <fperez@colorado.edu>
4358 2001-12-20 Fernando Perez <fperez@colorado.edu>
4356
4359
4357 * Started a manual in LyX. For now it's just a quick merge of the
4360 * Started a manual in LyX. For now it's just a quick merge of the
4358 various internal docstrings and READMEs. Later it may grow into a
4361 various internal docstrings and READMEs. Later it may grow into a
4359 nice, full-blown manual.
4362 nice, full-blown manual.
4360
4363
4361 * Set up a distutils based installer. Installation should now be
4364 * Set up a distutils based installer. Installation should now be
4362 trivially simple for end-users.
4365 trivially simple for end-users.
4363
4366
4364 2001-12-11 Fernando Perez <fperez@colorado.edu>
4367 2001-12-11 Fernando Perez <fperez@colorado.edu>
4365
4368
4366 * Released 0.2.0. First public release, announced it at
4369 * Released 0.2.0. First public release, announced it at
4367 comp.lang.python. From now on, just bugfixes...
4370 comp.lang.python. From now on, just bugfixes...
4368
4371
4369 * Went through all the files, set copyright/license notices and
4372 * Went through all the files, set copyright/license notices and
4370 cleaned up things. Ready for release.
4373 cleaned up things. Ready for release.
4371
4374
4372 2001-12-10 Fernando Perez <fperez@colorado.edu>
4375 2001-12-10 Fernando Perez <fperez@colorado.edu>
4373
4376
4374 * Changed the first-time installer not to use tarfiles. It's more
4377 * Changed the first-time installer not to use tarfiles. It's more
4375 robust now and less unix-dependent. Also makes it easier for
4378 robust now and less unix-dependent. Also makes it easier for
4376 people to later upgrade versions.
4379 people to later upgrade versions.
4377
4380
4378 * Changed @exit to @abort to reflect the fact that it's pretty
4381 * Changed @exit to @abort to reflect the fact that it's pretty
4379 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4382 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4380 becomes significant only when IPyhton is embedded: in that case,
4383 becomes significant only when IPyhton is embedded: in that case,
4381 C-D closes IPython only, but @abort kills the enclosing program
4384 C-D closes IPython only, but @abort kills the enclosing program
4382 too (unless it had called IPython inside a try catching
4385 too (unless it had called IPython inside a try catching
4383 SystemExit).
4386 SystemExit).
4384
4387
4385 * Created Shell module which exposes the actuall IPython Shell
4388 * Created Shell module which exposes the actuall IPython Shell
4386 classes, currently the normal and the embeddable one. This at
4389 classes, currently the normal and the embeddable one. This at
4387 least offers a stable interface we won't need to change when
4390 least offers a stable interface we won't need to change when
4388 (later) the internals are rewritten. That rewrite will be confined
4391 (later) the internals are rewritten. That rewrite will be confined
4389 to iplib and ipmaker, but the Shell interface should remain as is.
4392 to iplib and ipmaker, but the Shell interface should remain as is.
4390
4393
4391 * Added embed module which offers an embeddable IPShell object,
4394 * Added embed module which offers an embeddable IPShell object,
4392 useful to fire up IPython *inside* a running program. Great for
4395 useful to fire up IPython *inside* a running program. Great for
4393 debugging or dynamical data analysis.
4396 debugging or dynamical data analysis.
4394
4397
4395 2001-12-08 Fernando Perez <fperez@colorado.edu>
4398 2001-12-08 Fernando Perez <fperez@colorado.edu>
4396
4399
4397 * Fixed small bug preventing seeing info from methods of defined
4400 * Fixed small bug preventing seeing info from methods of defined
4398 objects (incorrect namespace in _ofind()).
4401 objects (incorrect namespace in _ofind()).
4399
4402
4400 * Documentation cleanup. Moved the main usage docstrings to a
4403 * Documentation cleanup. Moved the main usage docstrings to a
4401 separate file, usage.py (cleaner to maintain, and hopefully in the
4404 separate file, usage.py (cleaner to maintain, and hopefully in the
4402 future some perlpod-like way of producing interactive, man and
4405 future some perlpod-like way of producing interactive, man and
4403 html docs out of it will be found).
4406 html docs out of it will be found).
4404
4407
4405 * Added @profile to see your profile at any time.
4408 * Added @profile to see your profile at any time.
4406
4409
4407 * Added @p as an alias for 'print'. It's especially convenient if
4410 * Added @p as an alias for 'print'. It's especially convenient if
4408 using automagic ('p x' prints x).
4411 using automagic ('p x' prints x).
4409
4412
4410 * Small cleanups and fixes after a pychecker run.
4413 * Small cleanups and fixes after a pychecker run.
4411
4414
4412 * Changed the @cd command to handle @cd - and @cd -<n> for
4415 * Changed the @cd command to handle @cd - and @cd -<n> for
4413 visiting any directory in _dh.
4416 visiting any directory in _dh.
4414
4417
4415 * Introduced _dh, a history of visited directories. @dhist prints
4418 * Introduced _dh, a history of visited directories. @dhist prints
4416 it out with numbers.
4419 it out with numbers.
4417
4420
4418 2001-12-07 Fernando Perez <fperez@colorado.edu>
4421 2001-12-07 Fernando Perez <fperez@colorado.edu>
4419
4422
4420 * Released 0.1.22
4423 * Released 0.1.22
4421
4424
4422 * Made initialization a bit more robust against invalid color
4425 * Made initialization a bit more robust against invalid color
4423 options in user input (exit, not traceback-crash).
4426 options in user input (exit, not traceback-crash).
4424
4427
4425 * Changed the bug crash reporter to write the report only in the
4428 * Changed the bug crash reporter to write the report only in the
4426 user's .ipython directory. That way IPython won't litter people's
4429 user's .ipython directory. That way IPython won't litter people's
4427 hard disks with crash files all over the place. Also print on
4430 hard disks with crash files all over the place. Also print on
4428 screen the necessary mail command.
4431 screen the necessary mail command.
4429
4432
4430 * With the new ultraTB, implemented LightBG color scheme for light
4433 * With the new ultraTB, implemented LightBG color scheme for light
4431 background terminals. A lot of people like white backgrounds, so I
4434 background terminals. A lot of people like white backgrounds, so I
4432 guess we should at least give them something readable.
4435 guess we should at least give them something readable.
4433
4436
4434 2001-12-06 Fernando Perez <fperez@colorado.edu>
4437 2001-12-06 Fernando Perez <fperez@colorado.edu>
4435
4438
4436 * Modified the structure of ultraTB. Now there's a proper class
4439 * Modified the structure of ultraTB. Now there's a proper class
4437 for tables of color schemes which allow adding schemes easily and
4440 for tables of color schemes which allow adding schemes easily and
4438 switching the active scheme without creating a new instance every
4441 switching the active scheme without creating a new instance every
4439 time (which was ridiculous). The syntax for creating new schemes
4442 time (which was ridiculous). The syntax for creating new schemes
4440 is also cleaner. I think ultraTB is finally done, with a clean
4443 is also cleaner. I think ultraTB is finally done, with a clean
4441 class structure. Names are also much cleaner (now there's proper
4444 class structure. Names are also much cleaner (now there's proper
4442 color tables, no need for every variable to also have 'color' in
4445 color tables, no need for every variable to also have 'color' in
4443 its name).
4446 its name).
4444
4447
4445 * Broke down genutils into separate files. Now genutils only
4448 * Broke down genutils into separate files. Now genutils only
4446 contains utility functions, and classes have been moved to their
4449 contains utility functions, and classes have been moved to their
4447 own files (they had enough independent functionality to warrant
4450 own files (they had enough independent functionality to warrant
4448 it): ConfigLoader, OutputTrap, Struct.
4451 it): ConfigLoader, OutputTrap, Struct.
4449
4452
4450 2001-12-05 Fernando Perez <fperez@colorado.edu>
4453 2001-12-05 Fernando Perez <fperez@colorado.edu>
4451
4454
4452 * IPython turns 21! Released version 0.1.21, as a candidate for
4455 * IPython turns 21! Released version 0.1.21, as a candidate for
4453 public consumption. If all goes well, release in a few days.
4456 public consumption. If all goes well, release in a few days.
4454
4457
4455 * Fixed path bug (files in Extensions/ directory wouldn't be found
4458 * Fixed path bug (files in Extensions/ directory wouldn't be found
4456 unless IPython/ was explicitly in sys.path).
4459 unless IPython/ was explicitly in sys.path).
4457
4460
4458 * Extended the FlexCompleter class as MagicCompleter to allow
4461 * Extended the FlexCompleter class as MagicCompleter to allow
4459 completion of @-starting lines.
4462 completion of @-starting lines.
4460
4463
4461 * Created __release__.py file as a central repository for release
4464 * Created __release__.py file as a central repository for release
4462 info that other files can read from.
4465 info that other files can read from.
4463
4466
4464 * Fixed small bug in logging: when logging was turned on in
4467 * Fixed small bug in logging: when logging was turned on in
4465 mid-session, old lines with special meanings (!@?) were being
4468 mid-session, old lines with special meanings (!@?) were being
4466 logged without the prepended comment, which is necessary since
4469 logged without the prepended comment, which is necessary since
4467 they are not truly valid python syntax. This should make session
4470 they are not truly valid python syntax. This should make session
4468 restores produce less errors.
4471 restores produce less errors.
4469
4472
4470 * The namespace cleanup forced me to make a FlexCompleter class
4473 * The namespace cleanup forced me to make a FlexCompleter class
4471 which is nothing but a ripoff of rlcompleter, but with selectable
4474 which is nothing but a ripoff of rlcompleter, but with selectable
4472 namespace (rlcompleter only works in __main__.__dict__). I'll try
4475 namespace (rlcompleter only works in __main__.__dict__). I'll try
4473 to submit a note to the authors to see if this change can be
4476 to submit a note to the authors to see if this change can be
4474 incorporated in future rlcompleter releases (Dec.6: done)
4477 incorporated in future rlcompleter releases (Dec.6: done)
4475
4478
4476 * More fixes to namespace handling. It was a mess! Now all
4479 * More fixes to namespace handling. It was a mess! Now all
4477 explicit references to __main__.__dict__ are gone (except when
4480 explicit references to __main__.__dict__ are gone (except when
4478 really needed) and everything is handled through the namespace
4481 really needed) and everything is handled through the namespace
4479 dicts in the IPython instance. We seem to be getting somewhere
4482 dicts in the IPython instance. We seem to be getting somewhere
4480 with this, finally...
4483 with this, finally...
4481
4484
4482 * Small documentation updates.
4485 * Small documentation updates.
4483
4486
4484 * Created the Extensions directory under IPython (with an
4487 * Created the Extensions directory under IPython (with an
4485 __init__.py). Put the PhysicalQ stuff there. This directory should
4488 __init__.py). Put the PhysicalQ stuff there. This directory should
4486 be used for all special-purpose extensions.
4489 be used for all special-purpose extensions.
4487
4490
4488 * File renaming:
4491 * File renaming:
4489 ipythonlib --> ipmaker
4492 ipythonlib --> ipmaker
4490 ipplib --> iplib
4493 ipplib --> iplib
4491 This makes a bit more sense in terms of what these files actually do.
4494 This makes a bit more sense in terms of what these files actually do.
4492
4495
4493 * Moved all the classes and functions in ipythonlib to ipplib, so
4496 * Moved all the classes and functions in ipythonlib to ipplib, so
4494 now ipythonlib only has make_IPython(). This will ease up its
4497 now ipythonlib only has make_IPython(). This will ease up its
4495 splitting in smaller functional chunks later.
4498 splitting in smaller functional chunks later.
4496
4499
4497 * Cleaned up (done, I think) output of @whos. Better column
4500 * Cleaned up (done, I think) output of @whos. Better column
4498 formatting, and now shows str(var) for as much as it can, which is
4501 formatting, and now shows str(var) for as much as it can, which is
4499 typically what one gets with a 'print var'.
4502 typically what one gets with a 'print var'.
4500
4503
4501 2001-12-04 Fernando Perez <fperez@colorado.edu>
4504 2001-12-04 Fernando Perez <fperez@colorado.edu>
4502
4505
4503 * Fixed namespace problems. Now builtin/IPyhton/user names get
4506 * Fixed namespace problems. Now builtin/IPyhton/user names get
4504 properly reported in their namespace. Internal namespace handling
4507 properly reported in their namespace. Internal namespace handling
4505 is finally getting decent (not perfect yet, but much better than
4508 is finally getting decent (not perfect yet, but much better than
4506 the ad-hoc mess we had).
4509 the ad-hoc mess we had).
4507
4510
4508 * Removed -exit option. If people just want to run a python
4511 * Removed -exit option. If people just want to run a python
4509 script, that's what the normal interpreter is for. Less
4512 script, that's what the normal interpreter is for. Less
4510 unnecessary options, less chances for bugs.
4513 unnecessary options, less chances for bugs.
4511
4514
4512 * Added a crash handler which generates a complete post-mortem if
4515 * Added a crash handler which generates a complete post-mortem if
4513 IPython crashes. This will help a lot in tracking bugs down the
4516 IPython crashes. This will help a lot in tracking bugs down the
4514 road.
4517 road.
4515
4518
4516 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4519 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4517 which were boud to functions being reassigned would bypass the
4520 which were boud to functions being reassigned would bypass the
4518 logger, breaking the sync of _il with the prompt counter. This
4521 logger, breaking the sync of _il with the prompt counter. This
4519 would then crash IPython later when a new line was logged.
4522 would then crash IPython later when a new line was logged.
4520
4523
4521 2001-12-02 Fernando Perez <fperez@colorado.edu>
4524 2001-12-02 Fernando Perez <fperez@colorado.edu>
4522
4525
4523 * Made IPython a package. This means people don't have to clutter
4526 * Made IPython a package. This means people don't have to clutter
4524 their sys.path with yet another directory. Changed the INSTALL
4527 their sys.path with yet another directory. Changed the INSTALL
4525 file accordingly.
4528 file accordingly.
4526
4529
4527 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4530 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4528 sorts its output (so @who shows it sorted) and @whos formats the
4531 sorts its output (so @who shows it sorted) and @whos formats the
4529 table according to the width of the first column. Nicer, easier to
4532 table according to the width of the first column. Nicer, easier to
4530 read. Todo: write a generic table_format() which takes a list of
4533 read. Todo: write a generic table_format() which takes a list of
4531 lists and prints it nicely formatted, with optional row/column
4534 lists and prints it nicely formatted, with optional row/column
4532 separators and proper padding and justification.
4535 separators and proper padding and justification.
4533
4536
4534 * Released 0.1.20
4537 * Released 0.1.20
4535
4538
4536 * Fixed bug in @log which would reverse the inputcache list (a
4539 * Fixed bug in @log which would reverse the inputcache list (a
4537 copy operation was missing).
4540 copy operation was missing).
4538
4541
4539 * Code cleanup. @config was changed to use page(). Better, since
4542 * Code cleanup. @config was changed to use page(). Better, since
4540 its output is always quite long.
4543 its output is always quite long.
4541
4544
4542 * Itpl is back as a dependency. I was having too many problems
4545 * Itpl is back as a dependency. I was having too many problems
4543 getting the parametric aliases to work reliably, and it's just
4546 getting the parametric aliases to work reliably, and it's just
4544 easier to code weird string operations with it than playing %()s
4547 easier to code weird string operations with it than playing %()s
4545 games. It's only ~6k, so I don't think it's too big a deal.
4548 games. It's only ~6k, so I don't think it's too big a deal.
4546
4549
4547 * Found (and fixed) a very nasty bug with history. !lines weren't
4550 * Found (and fixed) a very nasty bug with history. !lines weren't
4548 getting cached, and the out of sync caches would crash
4551 getting cached, and the out of sync caches would crash
4549 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4552 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4550 division of labor a bit better. Bug fixed, cleaner structure.
4553 division of labor a bit better. Bug fixed, cleaner structure.
4551
4554
4552 2001-12-01 Fernando Perez <fperez@colorado.edu>
4555 2001-12-01 Fernando Perez <fperez@colorado.edu>
4553
4556
4554 * Released 0.1.19
4557 * Released 0.1.19
4555
4558
4556 * Added option -n to @hist to prevent line number printing. Much
4559 * Added option -n to @hist to prevent line number printing. Much
4557 easier to copy/paste code this way.
4560 easier to copy/paste code this way.
4558
4561
4559 * Created global _il to hold the input list. Allows easy
4562 * Created global _il to hold the input list. Allows easy
4560 re-execution of blocks of code by slicing it (inspired by Janko's
4563 re-execution of blocks of code by slicing it (inspired by Janko's
4561 comment on 'macros').
4564 comment on 'macros').
4562
4565
4563 * Small fixes and doc updates.
4566 * Small fixes and doc updates.
4564
4567
4565 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4568 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4566 much too fragile with automagic. Handles properly multi-line
4569 much too fragile with automagic. Handles properly multi-line
4567 statements and takes parameters.
4570 statements and takes parameters.
4568
4571
4569 2001-11-30 Fernando Perez <fperez@colorado.edu>
4572 2001-11-30 Fernando Perez <fperez@colorado.edu>
4570
4573
4571 * Version 0.1.18 released.
4574 * Version 0.1.18 released.
4572
4575
4573 * Fixed nasty namespace bug in initial module imports.
4576 * Fixed nasty namespace bug in initial module imports.
4574
4577
4575 * Added copyright/license notes to all code files (except
4578 * Added copyright/license notes to all code files (except
4576 DPyGetOpt). For the time being, LGPL. That could change.
4579 DPyGetOpt). For the time being, LGPL. That could change.
4577
4580
4578 * Rewrote a much nicer README, updated INSTALL, cleaned up
4581 * Rewrote a much nicer README, updated INSTALL, cleaned up
4579 ipythonrc-* samples.
4582 ipythonrc-* samples.
4580
4583
4581 * Overall code/documentation cleanup. Basically ready for
4584 * Overall code/documentation cleanup. Basically ready for
4582 release. Only remaining thing: licence decision (LGPL?).
4585 release. Only remaining thing: licence decision (LGPL?).
4583
4586
4584 * Converted load_config to a class, ConfigLoader. Now recursion
4587 * Converted load_config to a class, ConfigLoader. Now recursion
4585 control is better organized. Doesn't include the same file twice.
4588 control is better organized. Doesn't include the same file twice.
4586
4589
4587 2001-11-29 Fernando Perez <fperez@colorado.edu>
4590 2001-11-29 Fernando Perez <fperez@colorado.edu>
4588
4591
4589 * Got input history working. Changed output history variables from
4592 * Got input history working. Changed output history variables from
4590 _p to _o so that _i is for input and _o for output. Just cleaner
4593 _p to _o so that _i is for input and _o for output. Just cleaner
4591 convention.
4594 convention.
4592
4595
4593 * Implemented parametric aliases. This pretty much allows the
4596 * Implemented parametric aliases. This pretty much allows the
4594 alias system to offer full-blown shell convenience, I think.
4597 alias system to offer full-blown shell convenience, I think.
4595
4598
4596 * Version 0.1.17 released, 0.1.18 opened.
4599 * Version 0.1.17 released, 0.1.18 opened.
4597
4600
4598 * dot_ipython/ipythonrc (alias): added documentation.
4601 * dot_ipython/ipythonrc (alias): added documentation.
4599 (xcolor): Fixed small bug (xcolors -> xcolor)
4602 (xcolor): Fixed small bug (xcolors -> xcolor)
4600
4603
4601 * Changed the alias system. Now alias is a magic command to define
4604 * Changed the alias system. Now alias is a magic command to define
4602 aliases just like the shell. Rationale: the builtin magics should
4605 aliases just like the shell. Rationale: the builtin magics should
4603 be there for things deeply connected to IPython's
4606 be there for things deeply connected to IPython's
4604 architecture. And this is a much lighter system for what I think
4607 architecture. And this is a much lighter system for what I think
4605 is the really important feature: allowing users to define quickly
4608 is the really important feature: allowing users to define quickly
4606 magics that will do shell things for them, so they can customize
4609 magics that will do shell things for them, so they can customize
4607 IPython easily to match their work habits. If someone is really
4610 IPython easily to match their work habits. If someone is really
4608 desperate to have another name for a builtin alias, they can
4611 desperate to have another name for a builtin alias, they can
4609 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4612 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4610 works.
4613 works.
4611
4614
4612 2001-11-28 Fernando Perez <fperez@colorado.edu>
4615 2001-11-28 Fernando Perez <fperez@colorado.edu>
4613
4616
4614 * Changed @file so that it opens the source file at the proper
4617 * Changed @file so that it opens the source file at the proper
4615 line. Since it uses less, if your EDITOR environment is
4618 line. Since it uses less, if your EDITOR environment is
4616 configured, typing v will immediately open your editor of choice
4619 configured, typing v will immediately open your editor of choice
4617 right at the line where the object is defined. Not as quick as
4620 right at the line where the object is defined. Not as quick as
4618 having a direct @edit command, but for all intents and purposes it
4621 having a direct @edit command, but for all intents and purposes it
4619 works. And I don't have to worry about writing @edit to deal with
4622 works. And I don't have to worry about writing @edit to deal with
4620 all the editors, less does that.
4623 all the editors, less does that.
4621
4624
4622 * Version 0.1.16 released, 0.1.17 opened.
4625 * Version 0.1.16 released, 0.1.17 opened.
4623
4626
4624 * Fixed some nasty bugs in the page/page_dumb combo that could
4627 * Fixed some nasty bugs in the page/page_dumb combo that could
4625 crash IPython.
4628 crash IPython.
4626
4629
4627 2001-11-27 Fernando Perez <fperez@colorado.edu>
4630 2001-11-27 Fernando Perez <fperez@colorado.edu>
4628
4631
4629 * Version 0.1.15 released, 0.1.16 opened.
4632 * Version 0.1.15 released, 0.1.16 opened.
4630
4633
4631 * Finally got ? and ?? to work for undefined things: now it's
4634 * Finally got ? and ?? to work for undefined things: now it's
4632 possible to type {}.get? and get information about the get method
4635 possible to type {}.get? and get information about the get method
4633 of dicts, or os.path? even if only os is defined (so technically
4636 of dicts, or os.path? even if only os is defined (so technically
4634 os.path isn't). Works at any level. For example, after import os,
4637 os.path isn't). Works at any level. For example, after import os,
4635 os?, os.path?, os.path.abspath? all work. This is great, took some
4638 os?, os.path?, os.path.abspath? all work. This is great, took some
4636 work in _ofind.
4639 work in _ofind.
4637
4640
4638 * Fixed more bugs with logging. The sanest way to do it was to add
4641 * Fixed more bugs with logging. The sanest way to do it was to add
4639 to @log a 'mode' parameter. Killed two in one shot (this mode
4642 to @log a 'mode' parameter. Killed two in one shot (this mode
4640 option was a request of Janko's). I think it's finally clean
4643 option was a request of Janko's). I think it's finally clean
4641 (famous last words).
4644 (famous last words).
4642
4645
4643 * Added a page_dumb() pager which does a decent job of paging on
4646 * Added a page_dumb() pager which does a decent job of paging on
4644 screen, if better things (like less) aren't available. One less
4647 screen, if better things (like less) aren't available. One less
4645 unix dependency (someday maybe somebody will port this to
4648 unix dependency (someday maybe somebody will port this to
4646 windows).
4649 windows).
4647
4650
4648 * Fixed problem in magic_log: would lock of logging out if log
4651 * Fixed problem in magic_log: would lock of logging out if log
4649 creation failed (because it would still think it had succeeded).
4652 creation failed (because it would still think it had succeeded).
4650
4653
4651 * Improved the page() function using curses to auto-detect screen
4654 * Improved the page() function using curses to auto-detect screen
4652 size. Now it can make a much better decision on whether to print
4655 size. Now it can make a much better decision on whether to print
4653 or page a string. Option screen_length was modified: a value 0
4656 or page a string. Option screen_length was modified: a value 0
4654 means auto-detect, and that's the default now.
4657 means auto-detect, and that's the default now.
4655
4658
4656 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4659 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4657 go out. I'll test it for a few days, then talk to Janko about
4660 go out. I'll test it for a few days, then talk to Janko about
4658 licences and announce it.
4661 licences and announce it.
4659
4662
4660 * Fixed the length of the auto-generated ---> prompt which appears
4663 * Fixed the length of the auto-generated ---> prompt which appears
4661 for auto-parens and auto-quotes. Getting this right isn't trivial,
4664 for auto-parens and auto-quotes. Getting this right isn't trivial,
4662 with all the color escapes, different prompt types and optional
4665 with all the color escapes, different prompt types and optional
4663 separators. But it seems to be working in all the combinations.
4666 separators. But it seems to be working in all the combinations.
4664
4667
4665 2001-11-26 Fernando Perez <fperez@colorado.edu>
4668 2001-11-26 Fernando Perez <fperez@colorado.edu>
4666
4669
4667 * Wrote a regexp filter to get option types from the option names
4670 * Wrote a regexp filter to get option types from the option names
4668 string. This eliminates the need to manually keep two duplicate
4671 string. This eliminates the need to manually keep two duplicate
4669 lists.
4672 lists.
4670
4673
4671 * Removed the unneeded check_option_names. Now options are handled
4674 * Removed the unneeded check_option_names. Now options are handled
4672 in a much saner manner and it's easy to visually check that things
4675 in a much saner manner and it's easy to visually check that things
4673 are ok.
4676 are ok.
4674
4677
4675 * Updated version numbers on all files I modified to carry a
4678 * Updated version numbers on all files I modified to carry a
4676 notice so Janko and Nathan have clear version markers.
4679 notice so Janko and Nathan have clear version markers.
4677
4680
4678 * Updated docstring for ultraTB with my changes. I should send
4681 * Updated docstring for ultraTB with my changes. I should send
4679 this to Nathan.
4682 this to Nathan.
4680
4683
4681 * Lots of small fixes. Ran everything through pychecker again.
4684 * Lots of small fixes. Ran everything through pychecker again.
4682
4685
4683 * Made loading of deep_reload an cmd line option. If it's not too
4686 * Made loading of deep_reload an cmd line option. If it's not too
4684 kosher, now people can just disable it. With -nodeep_reload it's
4687 kosher, now people can just disable it. With -nodeep_reload it's
4685 still available as dreload(), it just won't overwrite reload().
4688 still available as dreload(), it just won't overwrite reload().
4686
4689
4687 * Moved many options to the no| form (-opt and -noopt
4690 * Moved many options to the no| form (-opt and -noopt
4688 accepted). Cleaner.
4691 accepted). Cleaner.
4689
4692
4690 * Changed magic_log so that if called with no parameters, it uses
4693 * Changed magic_log so that if called with no parameters, it uses
4691 'rotate' mode. That way auto-generated logs aren't automatically
4694 'rotate' mode. That way auto-generated logs aren't automatically
4692 over-written. For normal logs, now a backup is made if it exists
4695 over-written. For normal logs, now a backup is made if it exists
4693 (only 1 level of backups). A new 'backup' mode was added to the
4696 (only 1 level of backups). A new 'backup' mode was added to the
4694 Logger class to support this. This was a request by Janko.
4697 Logger class to support this. This was a request by Janko.
4695
4698
4696 * Added @logoff/@logon to stop/restart an active log.
4699 * Added @logoff/@logon to stop/restart an active log.
4697
4700
4698 * Fixed a lot of bugs in log saving/replay. It was pretty
4701 * Fixed a lot of bugs in log saving/replay. It was pretty
4699 broken. Now special lines (!@,/) appear properly in the command
4702 broken. Now special lines (!@,/) appear properly in the command
4700 history after a log replay.
4703 history after a log replay.
4701
4704
4702 * Tried and failed to implement full session saving via pickle. My
4705 * Tried and failed to implement full session saving via pickle. My
4703 idea was to pickle __main__.__dict__, but modules can't be
4706 idea was to pickle __main__.__dict__, but modules can't be
4704 pickled. This would be a better alternative to replaying logs, but
4707 pickled. This would be a better alternative to replaying logs, but
4705 seems quite tricky to get to work. Changed -session to be called
4708 seems quite tricky to get to work. Changed -session to be called
4706 -logplay, which more accurately reflects what it does. And if we
4709 -logplay, which more accurately reflects what it does. And if we
4707 ever get real session saving working, -session is now available.
4710 ever get real session saving working, -session is now available.
4708
4711
4709 * Implemented color schemes for prompts also. As for tracebacks,
4712 * Implemented color schemes for prompts also. As for tracebacks,
4710 currently only NoColor and Linux are supported. But now the
4713 currently only NoColor and Linux are supported. But now the
4711 infrastructure is in place, based on a generic ColorScheme
4714 infrastructure is in place, based on a generic ColorScheme
4712 class. So writing and activating new schemes both for the prompts
4715 class. So writing and activating new schemes both for the prompts
4713 and the tracebacks should be straightforward.
4716 and the tracebacks should be straightforward.
4714
4717
4715 * Version 0.1.13 released, 0.1.14 opened.
4718 * Version 0.1.13 released, 0.1.14 opened.
4716
4719
4717 * Changed handling of options for output cache. Now counter is
4720 * Changed handling of options for output cache. Now counter is
4718 hardwired starting at 1 and one specifies the maximum number of
4721 hardwired starting at 1 and one specifies the maximum number of
4719 entries *in the outcache* (not the max prompt counter). This is
4722 entries *in the outcache* (not the max prompt counter). This is
4720 much better, since many statements won't increase the cache
4723 much better, since many statements won't increase the cache
4721 count. It also eliminated some confusing options, now there's only
4724 count. It also eliminated some confusing options, now there's only
4722 one: cache_size.
4725 one: cache_size.
4723
4726
4724 * Added 'alias' magic function and magic_alias option in the
4727 * Added 'alias' magic function and magic_alias option in the
4725 ipythonrc file. Now the user can easily define whatever names he
4728 ipythonrc file. Now the user can easily define whatever names he
4726 wants for the magic functions without having to play weird
4729 wants for the magic functions without having to play weird
4727 namespace games. This gives IPython a real shell-like feel.
4730 namespace games. This gives IPython a real shell-like feel.
4728
4731
4729 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4732 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4730 @ or not).
4733 @ or not).
4731
4734
4732 This was one of the last remaining 'visible' bugs (that I know
4735 This was one of the last remaining 'visible' bugs (that I know
4733 of). I think if I can clean up the session loading so it works
4736 of). I think if I can clean up the session loading so it works
4734 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4737 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4735 about licensing).
4738 about licensing).
4736
4739
4737 2001-11-25 Fernando Perez <fperez@colorado.edu>
4740 2001-11-25 Fernando Perez <fperez@colorado.edu>
4738
4741
4739 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4742 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4740 there's a cleaner distinction between what ? and ?? show.
4743 there's a cleaner distinction between what ? and ?? show.
4741
4744
4742 * Added screen_length option. Now the user can define his own
4745 * Added screen_length option. Now the user can define his own
4743 screen size for page() operations.
4746 screen size for page() operations.
4744
4747
4745 * Implemented magic shell-like functions with automatic code
4748 * Implemented magic shell-like functions with automatic code
4746 generation. Now adding another function is just a matter of adding
4749 generation. Now adding another function is just a matter of adding
4747 an entry to a dict, and the function is dynamically generated at
4750 an entry to a dict, and the function is dynamically generated at
4748 run-time. Python has some really cool features!
4751 run-time. Python has some really cool features!
4749
4752
4750 * Renamed many options to cleanup conventions a little. Now all
4753 * Renamed many options to cleanup conventions a little. Now all
4751 are lowercase, and only underscores where needed. Also in the code
4754 are lowercase, and only underscores where needed. Also in the code
4752 option name tables are clearer.
4755 option name tables are clearer.
4753
4756
4754 * Changed prompts a little. Now input is 'In [n]:' instead of
4757 * Changed prompts a little. Now input is 'In [n]:' instead of
4755 'In[n]:='. This allows it the numbers to be aligned with the
4758 'In[n]:='. This allows it the numbers to be aligned with the
4756 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4759 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4757 Python (it was a Mathematica thing). The '...' continuation prompt
4760 Python (it was a Mathematica thing). The '...' continuation prompt
4758 was also changed a little to align better.
4761 was also changed a little to align better.
4759
4762
4760 * Fixed bug when flushing output cache. Not all _p<n> variables
4763 * Fixed bug when flushing output cache. Not all _p<n> variables
4761 exist, so their deletion needs to be wrapped in a try:
4764 exist, so their deletion needs to be wrapped in a try:
4762
4765
4763 * Figured out how to properly use inspect.formatargspec() (it
4766 * Figured out how to properly use inspect.formatargspec() (it
4764 requires the args preceded by *). So I removed all the code from
4767 requires the args preceded by *). So I removed all the code from
4765 _get_pdef in Magic, which was just replicating that.
4768 _get_pdef in Magic, which was just replicating that.
4766
4769
4767 * Added test to prefilter to allow redefining magic function names
4770 * Added test to prefilter to allow redefining magic function names
4768 as variables. This is ok, since the @ form is always available,
4771 as variables. This is ok, since the @ form is always available,
4769 but whe should allow the user to define a variable called 'ls' if
4772 but whe should allow the user to define a variable called 'ls' if
4770 he needs it.
4773 he needs it.
4771
4774
4772 * Moved the ToDo information from README into a separate ToDo.
4775 * Moved the ToDo information from README into a separate ToDo.
4773
4776
4774 * General code cleanup and small bugfixes. I think it's close to a
4777 * General code cleanup and small bugfixes. I think it's close to a
4775 state where it can be released, obviously with a big 'beta'
4778 state where it can be released, obviously with a big 'beta'
4776 warning on it.
4779 warning on it.
4777
4780
4778 * Got the magic function split to work. Now all magics are defined
4781 * Got the magic function split to work. Now all magics are defined
4779 in a separate class. It just organizes things a bit, and now
4782 in a separate class. It just organizes things a bit, and now
4780 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4783 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4781 was too long).
4784 was too long).
4782
4785
4783 * Changed @clear to @reset to avoid potential confusions with
4786 * Changed @clear to @reset to avoid potential confusions with
4784 the shell command clear. Also renamed @cl to @clear, which does
4787 the shell command clear. Also renamed @cl to @clear, which does
4785 exactly what people expect it to from their shell experience.
4788 exactly what people expect it to from their shell experience.
4786
4789
4787 Added a check to the @reset command (since it's so
4790 Added a check to the @reset command (since it's so
4788 destructive, it's probably a good idea to ask for confirmation).
4791 destructive, it's probably a good idea to ask for confirmation).
4789 But now reset only works for full namespace resetting. Since the
4792 But now reset only works for full namespace resetting. Since the
4790 del keyword is already there for deleting a few specific
4793 del keyword is already there for deleting a few specific
4791 variables, I don't see the point of having a redundant magic
4794 variables, I don't see the point of having a redundant magic
4792 function for the same task.
4795 function for the same task.
4793
4796
4794 2001-11-24 Fernando Perez <fperez@colorado.edu>
4797 2001-11-24 Fernando Perez <fperez@colorado.edu>
4795
4798
4796 * Updated the builtin docs (esp. the ? ones).
4799 * Updated the builtin docs (esp. the ? ones).
4797
4800
4798 * Ran all the code through pychecker. Not terribly impressed with
4801 * Ran all the code through pychecker. Not terribly impressed with
4799 it: lots of spurious warnings and didn't really find anything of
4802 it: lots of spurious warnings and didn't really find anything of
4800 substance (just a few modules being imported and not used).
4803 substance (just a few modules being imported and not used).
4801
4804
4802 * Implemented the new ultraTB functionality into IPython. New
4805 * Implemented the new ultraTB functionality into IPython. New
4803 option: xcolors. This chooses color scheme. xmode now only selects
4806 option: xcolors. This chooses color scheme. xmode now only selects
4804 between Plain and Verbose. Better orthogonality.
4807 between Plain and Verbose. Better orthogonality.
4805
4808
4806 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4809 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4807 mode and color scheme for the exception handlers. Now it's
4810 mode and color scheme for the exception handlers. Now it's
4808 possible to have the verbose traceback with no coloring.
4811 possible to have the verbose traceback with no coloring.
4809
4812
4810 2001-11-23 Fernando Perez <fperez@colorado.edu>
4813 2001-11-23 Fernando Perez <fperez@colorado.edu>
4811
4814
4812 * Version 0.1.12 released, 0.1.13 opened.
4815 * Version 0.1.12 released, 0.1.13 opened.
4813
4816
4814 * Removed option to set auto-quote and auto-paren escapes by
4817 * Removed option to set auto-quote and auto-paren escapes by
4815 user. The chances of breaking valid syntax are just too high. If
4818 user. The chances of breaking valid syntax are just too high. If
4816 someone *really* wants, they can always dig into the code.
4819 someone *really* wants, they can always dig into the code.
4817
4820
4818 * Made prompt separators configurable.
4821 * Made prompt separators configurable.
4819
4822
4820 2001-11-22 Fernando Perez <fperez@colorado.edu>
4823 2001-11-22 Fernando Perez <fperez@colorado.edu>
4821
4824
4822 * Small bugfixes in many places.
4825 * Small bugfixes in many places.
4823
4826
4824 * Removed the MyCompleter class from ipplib. It seemed redundant
4827 * Removed the MyCompleter class from ipplib. It seemed redundant
4825 with the C-p,C-n history search functionality. Less code to
4828 with the C-p,C-n history search functionality. Less code to
4826 maintain.
4829 maintain.
4827
4830
4828 * Moved all the original ipython.py code into ipythonlib.py. Right
4831 * Moved all the original ipython.py code into ipythonlib.py. Right
4829 now it's just one big dump into a function called make_IPython, so
4832 now it's just one big dump into a function called make_IPython, so
4830 no real modularity has been gained. But at least it makes the
4833 no real modularity has been gained. But at least it makes the
4831 wrapper script tiny, and since ipythonlib is a module, it gets
4834 wrapper script tiny, and since ipythonlib is a module, it gets
4832 compiled and startup is much faster.
4835 compiled and startup is much faster.
4833
4836
4834 This is a reasobably 'deep' change, so we should test it for a
4837 This is a reasobably 'deep' change, so we should test it for a
4835 while without messing too much more with the code.
4838 while without messing too much more with the code.
4836
4839
4837 2001-11-21 Fernando Perez <fperez@colorado.edu>
4840 2001-11-21 Fernando Perez <fperez@colorado.edu>
4838
4841
4839 * Version 0.1.11 released, 0.1.12 opened for further work.
4842 * Version 0.1.11 released, 0.1.12 opened for further work.
4840
4843
4841 * Removed dependency on Itpl. It was only needed in one place. It
4844 * Removed dependency on Itpl. It was only needed in one place. It
4842 would be nice if this became part of python, though. It makes life
4845 would be nice if this became part of python, though. It makes life
4843 *a lot* easier in some cases.
4846 *a lot* easier in some cases.
4844
4847
4845 * Simplified the prefilter code a bit. Now all handlers are
4848 * Simplified the prefilter code a bit. Now all handlers are
4846 expected to explicitly return a value (at least a blank string).
4849 expected to explicitly return a value (at least a blank string).
4847
4850
4848 * Heavy edits in ipplib. Removed the help system altogether. Now
4851 * Heavy edits in ipplib. Removed the help system altogether. Now
4849 obj?/?? is used for inspecting objects, a magic @doc prints
4852 obj?/?? is used for inspecting objects, a magic @doc prints
4850 docstrings, and full-blown Python help is accessed via the 'help'
4853 docstrings, and full-blown Python help is accessed via the 'help'
4851 keyword. This cleans up a lot of code (less to maintain) and does
4854 keyword. This cleans up a lot of code (less to maintain) and does
4852 the job. Since 'help' is now a standard Python component, might as
4855 the job. Since 'help' is now a standard Python component, might as
4853 well use it and remove duplicate functionality.
4856 well use it and remove duplicate functionality.
4854
4857
4855 Also removed the option to use ipplib as a standalone program. By
4858 Also removed the option to use ipplib as a standalone program. By
4856 now it's too dependent on other parts of IPython to function alone.
4859 now it's too dependent on other parts of IPython to function alone.
4857
4860
4858 * Fixed bug in genutils.pager. It would crash if the pager was
4861 * Fixed bug in genutils.pager. It would crash if the pager was
4859 exited immediately after opening (broken pipe).
4862 exited immediately after opening (broken pipe).
4860
4863
4861 * Trimmed down the VerboseTB reporting a little. The header is
4864 * Trimmed down the VerboseTB reporting a little. The header is
4862 much shorter now and the repeated exception arguments at the end
4865 much shorter now and the repeated exception arguments at the end
4863 have been removed. For interactive use the old header seemed a bit
4866 have been removed. For interactive use the old header seemed a bit
4864 excessive.
4867 excessive.
4865
4868
4866 * Fixed small bug in output of @whos for variables with multi-word
4869 * Fixed small bug in output of @whos for variables with multi-word
4867 types (only first word was displayed).
4870 types (only first word was displayed).
4868
4871
4869 2001-11-17 Fernando Perez <fperez@colorado.edu>
4872 2001-11-17 Fernando Perez <fperez@colorado.edu>
4870
4873
4871 * Version 0.1.10 released, 0.1.11 opened for further work.
4874 * Version 0.1.10 released, 0.1.11 opened for further work.
4872
4875
4873 * Modified dirs and friends. dirs now *returns* the stack (not
4876 * Modified dirs and friends. dirs now *returns* the stack (not
4874 prints), so one can manipulate it as a variable. Convenient to
4877 prints), so one can manipulate it as a variable. Convenient to
4875 travel along many directories.
4878 travel along many directories.
4876
4879
4877 * Fixed bug in magic_pdef: would only work with functions with
4880 * Fixed bug in magic_pdef: would only work with functions with
4878 arguments with default values.
4881 arguments with default values.
4879
4882
4880 2001-11-14 Fernando Perez <fperez@colorado.edu>
4883 2001-11-14 Fernando Perez <fperez@colorado.edu>
4881
4884
4882 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4885 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4883 example with IPython. Various other minor fixes and cleanups.
4886 example with IPython. Various other minor fixes and cleanups.
4884
4887
4885 * Version 0.1.9 released, 0.1.10 opened for further work.
4888 * Version 0.1.9 released, 0.1.10 opened for further work.
4886
4889
4887 * Added sys.path to the list of directories searched in the
4890 * Added sys.path to the list of directories searched in the
4888 execfile= option. It used to be the current directory and the
4891 execfile= option. It used to be the current directory and the
4889 user's IPYTHONDIR only.
4892 user's IPYTHONDIR only.
4890
4893
4891 2001-11-13 Fernando Perez <fperez@colorado.edu>
4894 2001-11-13 Fernando Perez <fperez@colorado.edu>
4892
4895
4893 * Reinstated the raw_input/prefilter separation that Janko had
4896 * Reinstated the raw_input/prefilter separation that Janko had
4894 initially. This gives a more convenient setup for extending the
4897 initially. This gives a more convenient setup for extending the
4895 pre-processor from the outside: raw_input always gets a string,
4898 pre-processor from the outside: raw_input always gets a string,
4896 and prefilter has to process it. We can then redefine prefilter
4899 and prefilter has to process it. We can then redefine prefilter
4897 from the outside and implement extensions for special
4900 from the outside and implement extensions for special
4898 purposes.
4901 purposes.
4899
4902
4900 Today I got one for inputting PhysicalQuantity objects
4903 Today I got one for inputting PhysicalQuantity objects
4901 (from Scientific) without needing any function calls at
4904 (from Scientific) without needing any function calls at
4902 all. Extremely convenient, and it's all done as a user-level
4905 all. Extremely convenient, and it's all done as a user-level
4903 extension (no IPython code was touched). Now instead of:
4906 extension (no IPython code was touched). Now instead of:
4904 a = PhysicalQuantity(4.2,'m/s**2')
4907 a = PhysicalQuantity(4.2,'m/s**2')
4905 one can simply say
4908 one can simply say
4906 a = 4.2 m/s**2
4909 a = 4.2 m/s**2
4907 or even
4910 or even
4908 a = 4.2 m/s^2
4911 a = 4.2 m/s^2
4909
4912
4910 I use this, but it's also a proof of concept: IPython really is
4913 I use this, but it's also a proof of concept: IPython really is
4911 fully user-extensible, even at the level of the parsing of the
4914 fully user-extensible, even at the level of the parsing of the
4912 command line. It's not trivial, but it's perfectly doable.
4915 command line. It's not trivial, but it's perfectly doable.
4913
4916
4914 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4917 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4915 the problem of modules being loaded in the inverse order in which
4918 the problem of modules being loaded in the inverse order in which
4916 they were defined in
4919 they were defined in
4917
4920
4918 * Version 0.1.8 released, 0.1.9 opened for further work.
4921 * Version 0.1.8 released, 0.1.9 opened for further work.
4919
4922
4920 * Added magics pdef, source and file. They respectively show the
4923 * Added magics pdef, source and file. They respectively show the
4921 definition line ('prototype' in C), source code and full python
4924 definition line ('prototype' in C), source code and full python
4922 file for any callable object. The object inspector oinfo uses
4925 file for any callable object. The object inspector oinfo uses
4923 these to show the same information.
4926 these to show the same information.
4924
4927
4925 * Version 0.1.7 released, 0.1.8 opened for further work.
4928 * Version 0.1.7 released, 0.1.8 opened for further work.
4926
4929
4927 * Separated all the magic functions into a class called Magic. The
4930 * Separated all the magic functions into a class called Magic. The
4928 InteractiveShell class was becoming too big for Xemacs to handle
4931 InteractiveShell class was becoming too big for Xemacs to handle
4929 (de-indenting a line would lock it up for 10 seconds while it
4932 (de-indenting a line would lock it up for 10 seconds while it
4930 backtracked on the whole class!)
4933 backtracked on the whole class!)
4931
4934
4932 FIXME: didn't work. It can be done, but right now namespaces are
4935 FIXME: didn't work. It can be done, but right now namespaces are
4933 all messed up. Do it later (reverted it for now, so at least
4936 all messed up. Do it later (reverted it for now, so at least
4934 everything works as before).
4937 everything works as before).
4935
4938
4936 * Got the object introspection system (magic_oinfo) working! I
4939 * Got the object introspection system (magic_oinfo) working! I
4937 think this is pretty much ready for release to Janko, so he can
4940 think this is pretty much ready for release to Janko, so he can
4938 test it for a while and then announce it. Pretty much 100% of what
4941 test it for a while and then announce it. Pretty much 100% of what
4939 I wanted for the 'phase 1' release is ready. Happy, tired.
4942 I wanted for the 'phase 1' release is ready. Happy, tired.
4940
4943
4941 2001-11-12 Fernando Perez <fperez@colorado.edu>
4944 2001-11-12 Fernando Perez <fperez@colorado.edu>
4942
4945
4943 * Version 0.1.6 released, 0.1.7 opened for further work.
4946 * Version 0.1.6 released, 0.1.7 opened for further work.
4944
4947
4945 * Fixed bug in printing: it used to test for truth before
4948 * Fixed bug in printing: it used to test for truth before
4946 printing, so 0 wouldn't print. Now checks for None.
4949 printing, so 0 wouldn't print. Now checks for None.
4947
4950
4948 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4951 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4949 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4952 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4950 reaches by hand into the outputcache. Think of a better way to do
4953 reaches by hand into the outputcache. Think of a better way to do
4951 this later.
4954 this later.
4952
4955
4953 * Various small fixes thanks to Nathan's comments.
4956 * Various small fixes thanks to Nathan's comments.
4954
4957
4955 * Changed magic_pprint to magic_Pprint. This way it doesn't
4958 * Changed magic_pprint to magic_Pprint. This way it doesn't
4956 collide with pprint() and the name is consistent with the command
4959 collide with pprint() and the name is consistent with the command
4957 line option.
4960 line option.
4958
4961
4959 * Changed prompt counter behavior to be fully like
4962 * Changed prompt counter behavior to be fully like
4960 Mathematica's. That is, even input that doesn't return a result
4963 Mathematica's. That is, even input that doesn't return a result
4961 raises the prompt counter. The old behavior was kind of confusing
4964 raises the prompt counter. The old behavior was kind of confusing
4962 (getting the same prompt number several times if the operation
4965 (getting the same prompt number several times if the operation
4963 didn't return a result).
4966 didn't return a result).
4964
4967
4965 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4968 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4966
4969
4967 * Fixed -Classic mode (wasn't working anymore).
4970 * Fixed -Classic mode (wasn't working anymore).
4968
4971
4969 * Added colored prompts using Nathan's new code. Colors are
4972 * Added colored prompts using Nathan's new code. Colors are
4970 currently hardwired, they can be user-configurable. For
4973 currently hardwired, they can be user-configurable. For
4971 developers, they can be chosen in file ipythonlib.py, at the
4974 developers, they can be chosen in file ipythonlib.py, at the
4972 beginning of the CachedOutput class def.
4975 beginning of the CachedOutput class def.
4973
4976
4974 2001-11-11 Fernando Perez <fperez@colorado.edu>
4977 2001-11-11 Fernando Perez <fperez@colorado.edu>
4975
4978
4976 * Version 0.1.5 released, 0.1.6 opened for further work.
4979 * Version 0.1.5 released, 0.1.6 opened for further work.
4977
4980
4978 * Changed magic_env to *return* the environment as a dict (not to
4981 * Changed magic_env to *return* the environment as a dict (not to
4979 print it). This way it prints, but it can also be processed.
4982 print it). This way it prints, but it can also be processed.
4980
4983
4981 * Added Verbose exception reporting to interactive
4984 * Added Verbose exception reporting to interactive
4982 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4985 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4983 traceback. Had to make some changes to the ultraTB file. This is
4986 traceback. Had to make some changes to the ultraTB file. This is
4984 probably the last 'big' thing in my mental todo list. This ties
4987 probably the last 'big' thing in my mental todo list. This ties
4985 in with the next entry:
4988 in with the next entry:
4986
4989
4987 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4990 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4988 has to specify is Plain, Color or Verbose for all exception
4991 has to specify is Plain, Color or Verbose for all exception
4989 handling.
4992 handling.
4990
4993
4991 * Removed ShellServices option. All this can really be done via
4994 * Removed ShellServices option. All this can really be done via
4992 the magic system. It's easier to extend, cleaner and has automatic
4995 the magic system. It's easier to extend, cleaner and has automatic
4993 namespace protection and documentation.
4996 namespace protection and documentation.
4994
4997
4995 2001-11-09 Fernando Perez <fperez@colorado.edu>
4998 2001-11-09 Fernando Perez <fperez@colorado.edu>
4996
4999
4997 * Fixed bug in output cache flushing (missing parameter to
5000 * Fixed bug in output cache flushing (missing parameter to
4998 __init__). Other small bugs fixed (found using pychecker).
5001 __init__). Other small bugs fixed (found using pychecker).
4999
5002
5000 * Version 0.1.4 opened for bugfixing.
5003 * Version 0.1.4 opened for bugfixing.
5001
5004
5002 2001-11-07 Fernando Perez <fperez@colorado.edu>
5005 2001-11-07 Fernando Perez <fperez@colorado.edu>
5003
5006
5004 * Version 0.1.3 released, mainly because of the raw_input bug.
5007 * Version 0.1.3 released, mainly because of the raw_input bug.
5005
5008
5006 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5009 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5007 and when testing for whether things were callable, a call could
5010 and when testing for whether things were callable, a call could
5008 actually be made to certain functions. They would get called again
5011 actually be made to certain functions. They would get called again
5009 once 'really' executed, with a resulting double call. A disaster
5012 once 'really' executed, with a resulting double call. A disaster
5010 in many cases (list.reverse() would never work!).
5013 in many cases (list.reverse() would never work!).
5011
5014
5012 * Removed prefilter() function, moved its code to raw_input (which
5015 * Removed prefilter() function, moved its code to raw_input (which
5013 after all was just a near-empty caller for prefilter). This saves
5016 after all was just a near-empty caller for prefilter). This saves
5014 a function call on every prompt, and simplifies the class a tiny bit.
5017 a function call on every prompt, and simplifies the class a tiny bit.
5015
5018
5016 * Fix _ip to __ip name in magic example file.
5019 * Fix _ip to __ip name in magic example file.
5017
5020
5018 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5021 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5019 work with non-gnu versions of tar.
5022 work with non-gnu versions of tar.
5020
5023
5021 2001-11-06 Fernando Perez <fperez@colorado.edu>
5024 2001-11-06 Fernando Perez <fperez@colorado.edu>
5022
5025
5023 * Version 0.1.2. Just to keep track of the recent changes.
5026 * Version 0.1.2. Just to keep track of the recent changes.
5024
5027
5025 * Fixed nasty bug in output prompt routine. It used to check 'if
5028 * Fixed nasty bug in output prompt routine. It used to check 'if
5026 arg != None...'. Problem is, this fails if arg implements a
5029 arg != None...'. Problem is, this fails if arg implements a
5027 special comparison (__cmp__) which disallows comparing to
5030 special comparison (__cmp__) which disallows comparing to
5028 None. Found it when trying to use the PhysicalQuantity module from
5031 None. Found it when trying to use the PhysicalQuantity module from
5029 ScientificPython.
5032 ScientificPython.
5030
5033
5031 2001-11-05 Fernando Perez <fperez@colorado.edu>
5034 2001-11-05 Fernando Perez <fperez@colorado.edu>
5032
5035
5033 * Also added dirs. Now the pushd/popd/dirs family functions
5036 * Also added dirs. Now the pushd/popd/dirs family functions
5034 basically like the shell, with the added convenience of going home
5037 basically like the shell, with the added convenience of going home
5035 when called with no args.
5038 when called with no args.
5036
5039
5037 * pushd/popd slightly modified to mimic shell behavior more
5040 * pushd/popd slightly modified to mimic shell behavior more
5038 closely.
5041 closely.
5039
5042
5040 * Added env,pushd,popd from ShellServices as magic functions. I
5043 * Added env,pushd,popd from ShellServices as magic functions. I
5041 think the cleanest will be to port all desired functions from
5044 think the cleanest will be to port all desired functions from
5042 ShellServices as magics and remove ShellServices altogether. This
5045 ShellServices as magics and remove ShellServices altogether. This
5043 will provide a single, clean way of adding functionality
5046 will provide a single, clean way of adding functionality
5044 (shell-type or otherwise) to IP.
5047 (shell-type or otherwise) to IP.
5045
5048
5046 2001-11-04 Fernando Perez <fperez@colorado.edu>
5049 2001-11-04 Fernando Perez <fperez@colorado.edu>
5047
5050
5048 * Added .ipython/ directory to sys.path. This way users can keep
5051 * Added .ipython/ directory to sys.path. This way users can keep
5049 customizations there and access them via import.
5052 customizations there and access them via import.
5050
5053
5051 2001-11-03 Fernando Perez <fperez@colorado.edu>
5054 2001-11-03 Fernando Perez <fperez@colorado.edu>
5052
5055
5053 * Opened version 0.1.1 for new changes.
5056 * Opened version 0.1.1 for new changes.
5054
5057
5055 * Changed version number to 0.1.0: first 'public' release, sent to
5058 * Changed version number to 0.1.0: first 'public' release, sent to
5056 Nathan and Janko.
5059 Nathan and Janko.
5057
5060
5058 * Lots of small fixes and tweaks.
5061 * Lots of small fixes and tweaks.
5059
5062
5060 * Minor changes to whos format. Now strings are shown, snipped if
5063 * Minor changes to whos format. Now strings are shown, snipped if
5061 too long.
5064 too long.
5062
5065
5063 * Changed ShellServices to work on __main__ so they show up in @who
5066 * Changed ShellServices to work on __main__ so they show up in @who
5064
5067
5065 * Help also works with ? at the end of a line:
5068 * Help also works with ? at the end of a line:
5066 ?sin and sin?
5069 ?sin and sin?
5067 both produce the same effect. This is nice, as often I use the
5070 both produce the same effect. This is nice, as often I use the
5068 tab-complete to find the name of a method, but I used to then have
5071 tab-complete to find the name of a method, but I used to then have
5069 to go to the beginning of the line to put a ? if I wanted more
5072 to go to the beginning of the line to put a ? if I wanted more
5070 info. Now I can just add the ? and hit return. Convenient.
5073 info. Now I can just add the ? and hit return. Convenient.
5071
5074
5072 2001-11-02 Fernando Perez <fperez@colorado.edu>
5075 2001-11-02 Fernando Perez <fperez@colorado.edu>
5073
5076
5074 * Python version check (>=2.1) added.
5077 * Python version check (>=2.1) added.
5075
5078
5076 * Added LazyPython documentation. At this point the docs are quite
5079 * Added LazyPython documentation. At this point the docs are quite
5077 a mess. A cleanup is in order.
5080 a mess. A cleanup is in order.
5078
5081
5079 * Auto-installer created. For some bizarre reason, the zipfiles
5082 * Auto-installer created. For some bizarre reason, the zipfiles
5080 module isn't working on my system. So I made a tar version
5083 module isn't working on my system. So I made a tar version
5081 (hopefully the command line options in various systems won't kill
5084 (hopefully the command line options in various systems won't kill
5082 me).
5085 me).
5083
5086
5084 * Fixes to Struct in genutils. Now all dictionary-like methods are
5087 * Fixes to Struct in genutils. Now all dictionary-like methods are
5085 protected (reasonably).
5088 protected (reasonably).
5086
5089
5087 * Added pager function to genutils and changed ? to print usage
5090 * Added pager function to genutils and changed ? to print usage
5088 note through it (it was too long).
5091 note through it (it was too long).
5089
5092
5090 * Added the LazyPython functionality. Works great! I changed the
5093 * Added the LazyPython functionality. Works great! I changed the
5091 auto-quote escape to ';', it's on home row and next to '. But
5094 auto-quote escape to ';', it's on home row and next to '. But
5092 both auto-quote and auto-paren (still /) escapes are command-line
5095 both auto-quote and auto-paren (still /) escapes are command-line
5093 parameters.
5096 parameters.
5094
5097
5095
5098
5096 2001-11-01 Fernando Perez <fperez@colorado.edu>
5099 2001-11-01 Fernando Perez <fperez@colorado.edu>
5097
5100
5098 * Version changed to 0.0.7. Fairly large change: configuration now
5101 * Version changed to 0.0.7. Fairly large change: configuration now
5099 is all stored in a directory, by default .ipython. There, all
5102 is all stored in a directory, by default .ipython. There, all
5100 config files have normal looking names (not .names)
5103 config files have normal looking names (not .names)
5101
5104
5102 * Version 0.0.6 Released first to Lucas and Archie as a test
5105 * Version 0.0.6 Released first to Lucas and Archie as a test
5103 run. Since it's the first 'semi-public' release, change version to
5106 run. Since it's the first 'semi-public' release, change version to
5104 > 0.0.6 for any changes now.
5107 > 0.0.6 for any changes now.
5105
5108
5106 * Stuff I had put in the ipplib.py changelog:
5109 * Stuff I had put in the ipplib.py changelog:
5107
5110
5108 Changes to InteractiveShell:
5111 Changes to InteractiveShell:
5109
5112
5110 - Made the usage message a parameter.
5113 - Made the usage message a parameter.
5111
5114
5112 - Require the name of the shell variable to be given. It's a bit
5115 - Require the name of the shell variable to be given. It's a bit
5113 of a hack, but allows the name 'shell' not to be hardwire in the
5116 of a hack, but allows the name 'shell' not to be hardwire in the
5114 magic (@) handler, which is problematic b/c it requires
5117 magic (@) handler, which is problematic b/c it requires
5115 polluting the global namespace with 'shell'. This in turn is
5118 polluting the global namespace with 'shell'. This in turn is
5116 fragile: if a user redefines a variable called shell, things
5119 fragile: if a user redefines a variable called shell, things
5117 break.
5120 break.
5118
5121
5119 - magic @: all functions available through @ need to be defined
5122 - magic @: all functions available through @ need to be defined
5120 as magic_<name>, even though they can be called simply as
5123 as magic_<name>, even though they can be called simply as
5121 @<name>. This allows the special command @magic to gather
5124 @<name>. This allows the special command @magic to gather
5122 information automatically about all existing magic functions,
5125 information automatically about all existing magic functions,
5123 even if they are run-time user extensions, by parsing the shell
5126 even if they are run-time user extensions, by parsing the shell
5124 instance __dict__ looking for special magic_ names.
5127 instance __dict__ looking for special magic_ names.
5125
5128
5126 - mainloop: added *two* local namespace parameters. This allows
5129 - mainloop: added *two* local namespace parameters. This allows
5127 the class to differentiate between parameters which were there
5130 the class to differentiate between parameters which were there
5128 before and after command line initialization was processed. This
5131 before and after command line initialization was processed. This
5129 way, later @who can show things loaded at startup by the
5132 way, later @who can show things loaded at startup by the
5130 user. This trick was necessary to make session saving/reloading
5133 user. This trick was necessary to make session saving/reloading
5131 really work: ideally after saving/exiting/reloading a session,
5134 really work: ideally after saving/exiting/reloading a session,
5132 *everythin* should look the same, including the output of @who. I
5135 *everythin* should look the same, including the output of @who. I
5133 was only able to make this work with this double namespace
5136 was only able to make this work with this double namespace
5134 trick.
5137 trick.
5135
5138
5136 - added a header to the logfile which allows (almost) full
5139 - added a header to the logfile which allows (almost) full
5137 session restoring.
5140 session restoring.
5138
5141
5139 - prepend lines beginning with @ or !, with a and log
5142 - prepend lines beginning with @ or !, with a and log
5140 them. Why? !lines: may be useful to know what you did @lines:
5143 them. Why? !lines: may be useful to know what you did @lines:
5141 they may affect session state. So when restoring a session, at
5144 they may affect session state. So when restoring a session, at
5142 least inform the user of their presence. I couldn't quite get
5145 least inform the user of their presence. I couldn't quite get
5143 them to properly re-execute, but at least the user is warned.
5146 them to properly re-execute, but at least the user is warned.
5144
5147
5145 * Started ChangeLog.
5148 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now