##// END OF EJS Templates
Fix doctest support: now running scripts that invoke the various doctest...
fperez -
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -1,83 +1,83 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Release data for the IPython project.
2 """Release data for the IPython project.
3
3
4 $Id: Release.py 2446 2007-06-14 22:30:58Z vivainio $"""
4 $Id: Release.py 2602 2007-08-12 22:45:38Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
7 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 #
8 #
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
10 # <n8gray@caltech.edu>
10 # <n8gray@caltech.edu>
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
14 #*****************************************************************************
14 #*****************************************************************************
15
15
16 # Name of the package for release purposes. This is the name which labels
16 # Name of the package for release purposes. This is the name which labels
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
18 name = 'ipython'
18 name = 'ipython'
19
19
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
21 # the new substring. We have to avoid using either dashes or underscores,
21 # the new substring. We have to avoid using either dashes or underscores,
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
23 # bdist_deb does not accept underscores (a Debian convention).
23 # bdist_deb does not accept underscores (a Debian convention).
24
24
25 revision = '2445'
25 revision = '2601'
26
26
27 version = '0.8.2.svn.r' + revision.rstrip('M')
27 version = '0.8.2.svn.r' + revision.rstrip('M')
28
28
29 description = "An enhanced interactive Python shell."
29 description = "An enhanced interactive Python shell."
30
30
31 long_description = \
31 long_description = \
32 """
32 """
33 IPython provides a replacement for the interactive Python interpreter with
33 IPython provides a replacement for the interactive Python interpreter with
34 extra functionality.
34 extra functionality.
35
35
36 Main features:
36 Main features:
37
37
38 * Comprehensive object introspection.
38 * Comprehensive object introspection.
39
39
40 * Input history, persistent across sessions.
40 * Input history, persistent across sessions.
41
41
42 * Caching of output results during a session with automatically generated
42 * Caching of output results during a session with automatically generated
43 references.
43 references.
44
44
45 * Readline based name completion.
45 * Readline based name completion.
46
46
47 * Extensible system of 'magic' commands for controlling the environment and
47 * Extensible system of 'magic' commands for controlling the environment and
48 performing many tasks related either to IPython or the operating system.
48 performing many tasks related either to IPython or the operating system.
49
49
50 * Configuration system with easy switching between different setups (simpler
50 * Configuration system with easy switching between different setups (simpler
51 than changing $PYTHONSTARTUP environment variables every time).
51 than changing $PYTHONSTARTUP environment variables every time).
52
52
53 * Session logging and reloading.
53 * Session logging and reloading.
54
54
55 * Extensible syntax processing for special purpose situations.
55 * Extensible syntax processing for special purpose situations.
56
56
57 * Access to the system shell with user-extensible alias system.
57 * Access to the system shell with user-extensible alias system.
58
58
59 * Easily embeddable in other Python programs.
59 * Easily embeddable in other Python programs.
60
60
61 * Integrated access to the pdb debugger and the Python profiler.
61 * Integrated access to the pdb debugger and the Python profiler.
62
62
63 The latest development version is always available at the IPython subversion
63 The latest development version is always available at the IPython subversion
64 repository_.
64 repository_.
65
65
66 .. _repository: http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev
66 .. _repository: http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev
67 """
67 """
68
68
69 license = 'BSD'
69 license = 'BSD'
70
70
71 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
71 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
72 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
72 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
73 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
73 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
74 'Ville' : ('Ville Vainio','vivainio@gmail.com')
74 'Ville' : ('Ville Vainio','vivainio@gmail.com')
75 }
75 }
76
76
77 url = 'http://ipython.scipy.org'
77 url = 'http://ipython.scipy.org'
78
78
79 download_url = 'http://ipython.scipy.org/dist'
79 download_url = 'http://ipython.scipy.org/dist'
80
80
81 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
81 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
82
82
83 keywords = ['Interactive','Interpreter','Shell']
83 keywords = ['Interactive','Interpreter','Shell']
@@ -1,1850 +1,1874 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 General purpose utilities.
3 General purpose utilities.
4
4
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 these things are also convenient when working at the command line.
6 these things are also convenient when working at the command line.
7
7
8 $Id: genutils.py 2577 2007-08-02 23:50:02Z fperez $"""
8 $Id: genutils.py 2602 2007-08-12 22:45:38Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
11 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
12 #
12 #
13 # Distributed under the terms of the BSD License. The full license is in
13 # Distributed under the terms of the BSD License. The full license is in
14 # the file COPYING, distributed as part of this software.
14 # the file COPYING, distributed as part of this software.
15 #*****************************************************************************
15 #*****************************************************************************
16
16
17 from IPython import Release
17 from IPython import Release
18 __author__ = '%s <%s>' % Release.authors['Fernando']
18 __author__ = '%s <%s>' % Release.authors['Fernando']
19 __license__ = Release.license
19 __license__ = Release.license
20
20
21 #****************************************************************************
21 #****************************************************************************
22 # required modules from the Python standard library
22 # required modules from the Python standard library
23 import __main__
23 import __main__
24 import commands
24 import commands
25 import os
25 import os
26 import re
26 import re
27 import shlex
27 import shlex
28 import shutil
28 import shutil
29 import sys
29 import sys
30 import tempfile
30 import tempfile
31 import time
31 import time
32 import types
32 import types
33 import warnings
33 import warnings
34
34
35 # Other IPython utilities
35 # Other IPython utilities
36 import IPython
36 import IPython
37 from IPython.Itpl import Itpl,itpl,printpl
37 from IPython.Itpl import Itpl,itpl,printpl
38 from IPython import DPyGetOpt, platutils
38 from IPython import DPyGetOpt, platutils
39 from IPython.generics import result_display
39 from IPython.generics import result_display
40 from path import path
40 from path import path
41 if os.name == "nt":
41 if os.name == "nt":
42 from IPython.winconsole import get_console_size
42 from IPython.winconsole import get_console_size
43
43
44 #****************************************************************************
44 #****************************************************************************
45 # Exceptions
45 # Exceptions
46 class Error(Exception):
46 class Error(Exception):
47 """Base class for exceptions in this module."""
47 """Base class for exceptions in this module."""
48 pass
48 pass
49
49
50 #----------------------------------------------------------------------------
50 #----------------------------------------------------------------------------
51 class IOStream:
51 class IOStream:
52 def __init__(self,stream,fallback):
52 def __init__(self,stream,fallback):
53 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
53 if not hasattr(stream,'write') or not hasattr(stream,'flush'):
54 stream = fallback
54 stream = fallback
55 self.stream = stream
55 self.stream = stream
56 self._swrite = stream.write
56 self._swrite = stream.write
57 self.flush = stream.flush
57 self.flush = stream.flush
58
58
59 def write(self,data):
59 def write(self,data):
60 try:
60 try:
61 self._swrite(data)
61 self._swrite(data)
62 except:
62 except:
63 try:
63 try:
64 # print handles some unicode issues which may trip a plain
64 # print handles some unicode issues which may trip a plain
65 # write() call. Attempt to emulate write() by using a
65 # write() call. Attempt to emulate write() by using a
66 # trailing comma
66 # trailing comma
67 print >> self.stream, data,
67 print >> self.stream, data,
68 except:
68 except:
69 # if we get here, something is seriously broken.
69 # if we get here, something is seriously broken.
70 print >> sys.stderr, \
70 print >> sys.stderr, \
71 'ERROR - failed to write data to stream:', self.stream
71 'ERROR - failed to write data to stream:', self.stream
72
72
73 def close(self):
73 def close(self):
74 pass
74 pass
75
75
76
76
77 class IOTerm:
77 class IOTerm:
78 """ Term holds the file or file-like objects for handling I/O operations.
78 """ Term holds the file or file-like objects for handling I/O operations.
79
79
80 These are normally just sys.stdin, sys.stdout and sys.stderr but for
80 These are normally just sys.stdin, sys.stdout and sys.stderr but for
81 Windows they can can replaced to allow editing the strings before they are
81 Windows they can can replaced to allow editing the strings before they are
82 displayed."""
82 displayed."""
83
83
84 # In the future, having IPython channel all its I/O operations through
84 # In the future, having IPython channel all its I/O operations through
85 # this class will make it easier to embed it into other environments which
85 # this class will make it easier to embed it into other environments which
86 # are not a normal terminal (such as a GUI-based shell)
86 # are not a normal terminal (such as a GUI-based shell)
87 def __init__(self,cin=None,cout=None,cerr=None):
87 def __init__(self,cin=None,cout=None,cerr=None):
88 self.cin = IOStream(cin,sys.stdin)
88 self.cin = IOStream(cin,sys.stdin)
89 self.cout = IOStream(cout,sys.stdout)
89 self.cout = IOStream(cout,sys.stdout)
90 self.cerr = IOStream(cerr,sys.stderr)
90 self.cerr = IOStream(cerr,sys.stderr)
91
91
92 # Global variable to be used for all I/O
92 # Global variable to be used for all I/O
93 Term = IOTerm()
93 Term = IOTerm()
94
94
95 import IPython.rlineimpl as readline
95 import IPython.rlineimpl as readline
96 # Remake Term to use the readline i/o facilities
96 # Remake Term to use the readline i/o facilities
97 if sys.platform == 'win32' and readline.have_readline:
97 if sys.platform == 'win32' and readline.have_readline:
98
98
99 Term = IOTerm(cout=readline._outputfile,cerr=readline._outputfile)
99 Term = IOTerm(cout=readline._outputfile,cerr=readline._outputfile)
100
100
101
101
102 #****************************************************************************
102 #****************************************************************************
103 # Generic warning/error printer, used by everything else
103 # Generic warning/error printer, used by everything else
104 def warn(msg,level=2,exit_val=1):
104 def warn(msg,level=2,exit_val=1):
105 """Standard warning printer. Gives formatting consistency.
105 """Standard warning printer. Gives formatting consistency.
106
106
107 Output is sent to Term.cerr (sys.stderr by default).
107 Output is sent to Term.cerr (sys.stderr by default).
108
108
109 Options:
109 Options:
110
110
111 -level(2): allows finer control:
111 -level(2): allows finer control:
112 0 -> Do nothing, dummy function.
112 0 -> Do nothing, dummy function.
113 1 -> Print message.
113 1 -> Print message.
114 2 -> Print 'WARNING:' + message. (Default level).
114 2 -> Print 'WARNING:' + message. (Default level).
115 3 -> Print 'ERROR:' + message.
115 3 -> Print 'ERROR:' + message.
116 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
116 4 -> Print 'FATAL ERROR:' + message and trigger a sys.exit(exit_val).
117
117
118 -exit_val (1): exit value returned by sys.exit() for a level 4
118 -exit_val (1): exit value returned by sys.exit() for a level 4
119 warning. Ignored for all other levels."""
119 warning. Ignored for all other levels."""
120
120
121 if level>0:
121 if level>0:
122 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
122 header = ['','','WARNING: ','ERROR: ','FATAL ERROR: ']
123 print >> Term.cerr, '%s%s' % (header[level],msg)
123 print >> Term.cerr, '%s%s' % (header[level],msg)
124 if level == 4:
124 if level == 4:
125 print >> Term.cerr,'Exiting.\n'
125 print >> Term.cerr,'Exiting.\n'
126 sys.exit(exit_val)
126 sys.exit(exit_val)
127
127
128 def info(msg):
128 def info(msg):
129 """Equivalent to warn(msg,level=1)."""
129 """Equivalent to warn(msg,level=1)."""
130
130
131 warn(msg,level=1)
131 warn(msg,level=1)
132
132
133 def error(msg):
133 def error(msg):
134 """Equivalent to warn(msg,level=3)."""
134 """Equivalent to warn(msg,level=3)."""
135
135
136 warn(msg,level=3)
136 warn(msg,level=3)
137
137
138 def fatal(msg,exit_val=1):
138 def fatal(msg,exit_val=1):
139 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
139 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
140
140
141 warn(msg,exit_val=exit_val,level=4)
141 warn(msg,exit_val=exit_val,level=4)
142
142
143 #---------------------------------------------------------------------------
143 #---------------------------------------------------------------------------
144 # Debugging routines
144 # Debugging routines
145 #
145 #
146 def debugx(expr,pre_msg=''):
146 def debugx(expr,pre_msg=''):
147 """Print the value of an expression from the caller's frame.
147 """Print the value of an expression from the caller's frame.
148
148
149 Takes an expression, evaluates it in the caller's frame and prints both
149 Takes an expression, evaluates it in the caller's frame and prints both
150 the given expression and the resulting value (as well as a debug mark
150 the given expression and the resulting value (as well as a debug mark
151 indicating the name of the calling function. The input must be of a form
151 indicating the name of the calling function. The input must be of a form
152 suitable for eval().
152 suitable for eval().
153
153
154 An optional message can be passed, which will be prepended to the printed
154 An optional message can be passed, which will be prepended to the printed
155 expr->value pair."""
155 expr->value pair."""
156
156
157 cf = sys._getframe(1)
157 cf = sys._getframe(1)
158 print '[DBG:%s] %s%s -> %r' % (cf.f_code.co_name,pre_msg,expr,
158 print '[DBG:%s] %s%s -> %r' % (cf.f_code.co_name,pre_msg,expr,
159 eval(expr,cf.f_globals,cf.f_locals))
159 eval(expr,cf.f_globals,cf.f_locals))
160
160
161 # deactivate it by uncommenting the following line, which makes it a no-op
161 # deactivate it by uncommenting the following line, which makes it a no-op
162 #def debugx(expr,pre_msg=''): pass
162 #def debugx(expr,pre_msg=''): pass
163
163
164 #----------------------------------------------------------------------------
164 #----------------------------------------------------------------------------
165 StringTypes = types.StringTypes
165 StringTypes = types.StringTypes
166
166
167 # Basic timing functionality
167 # Basic timing functionality
168
168
169 # If possible (Unix), use the resource module instead of time.clock()
169 # If possible (Unix), use the resource module instead of time.clock()
170 try:
170 try:
171 import resource
171 import resource
172 def clocku():
172 def clocku():
173 """clocku() -> floating point number
173 """clocku() -> floating point number
174
174
175 Return the *USER* CPU time in seconds since the start of the process.
175 Return the *USER* CPU time in seconds since the start of the process.
176 This is done via a call to resource.getrusage, so it avoids the
176 This is done via a call to resource.getrusage, so it avoids the
177 wraparound problems in time.clock()."""
177 wraparound problems in time.clock()."""
178
178
179 return resource.getrusage(resource.RUSAGE_SELF)[0]
179 return resource.getrusage(resource.RUSAGE_SELF)[0]
180
180
181 def clocks():
181 def clocks():
182 """clocks() -> floating point number
182 """clocks() -> floating point number
183
183
184 Return the *SYSTEM* CPU time in seconds since the start of the process.
184 Return the *SYSTEM* CPU time in seconds since the start of the process.
185 This is done via a call to resource.getrusage, so it avoids the
185 This is done via a call to resource.getrusage, so it avoids the
186 wraparound problems in time.clock()."""
186 wraparound problems in time.clock()."""
187
187
188 return resource.getrusage(resource.RUSAGE_SELF)[1]
188 return resource.getrusage(resource.RUSAGE_SELF)[1]
189
189
190 def clock():
190 def clock():
191 """clock() -> floating point number
191 """clock() -> floating point number
192
192
193 Return the *TOTAL USER+SYSTEM* CPU time in seconds since the start of
193 Return the *TOTAL USER+SYSTEM* CPU time in seconds since the start of
194 the process. This is done via a call to resource.getrusage, so it
194 the process. This is done via a call to resource.getrusage, so it
195 avoids the wraparound problems in time.clock()."""
195 avoids the wraparound problems in time.clock()."""
196
196
197 u,s = resource.getrusage(resource.RUSAGE_SELF)[:2]
197 u,s = resource.getrusage(resource.RUSAGE_SELF)[:2]
198 return u+s
198 return u+s
199
199
200 def clock2():
200 def clock2():
201 """clock2() -> (t_user,t_system)
201 """clock2() -> (t_user,t_system)
202
202
203 Similar to clock(), but return a tuple of user/system times."""
203 Similar to clock(), but return a tuple of user/system times."""
204 return resource.getrusage(resource.RUSAGE_SELF)[:2]
204 return resource.getrusage(resource.RUSAGE_SELF)[:2]
205
205
206 except ImportError:
206 except ImportError:
207 # There is no distinction of user/system time under windows, so we just use
207 # There is no distinction of user/system time under windows, so we just use
208 # time.clock() for everything...
208 # time.clock() for everything...
209 clocku = clocks = clock = time.clock
209 clocku = clocks = clock = time.clock
210 def clock2():
210 def clock2():
211 """Under windows, system CPU time can't be measured.
211 """Under windows, system CPU time can't be measured.
212
212
213 This just returns clock() and zero."""
213 This just returns clock() and zero."""
214 return time.clock(),0.0
214 return time.clock(),0.0
215
215
216 def timings_out(reps,func,*args,**kw):
216 def timings_out(reps,func,*args,**kw):
217 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
217 """timings_out(reps,func,*args,**kw) -> (t_total,t_per_call,output)
218
218
219 Execute a function reps times, return a tuple with the elapsed total
219 Execute a function reps times, return a tuple with the elapsed total
220 CPU time in seconds, the time per call and the function's output.
220 CPU time in seconds, the time per call and the function's output.
221
221
222 Under Unix, the return value is the sum of user+system time consumed by
222 Under Unix, the return value is the sum of user+system time consumed by
223 the process, computed via the resource module. This prevents problems
223 the process, computed via the resource module. This prevents problems
224 related to the wraparound effect which the time.clock() function has.
224 related to the wraparound effect which the time.clock() function has.
225
225
226 Under Windows the return value is in wall clock seconds. See the
226 Under Windows the return value is in wall clock seconds. See the
227 documentation for the time module for more details."""
227 documentation for the time module for more details."""
228
228
229 reps = int(reps)
229 reps = int(reps)
230 assert reps >=1, 'reps must be >= 1'
230 assert reps >=1, 'reps must be >= 1'
231 if reps==1:
231 if reps==1:
232 start = clock()
232 start = clock()
233 out = func(*args,**kw)
233 out = func(*args,**kw)
234 tot_time = clock()-start
234 tot_time = clock()-start
235 else:
235 else:
236 rng = xrange(reps-1) # the last time is executed separately to store output
236 rng = xrange(reps-1) # the last time is executed separately to store output
237 start = clock()
237 start = clock()
238 for dummy in rng: func(*args,**kw)
238 for dummy in rng: func(*args,**kw)
239 out = func(*args,**kw) # one last time
239 out = func(*args,**kw) # one last time
240 tot_time = clock()-start
240 tot_time = clock()-start
241 av_time = tot_time / reps
241 av_time = tot_time / reps
242 return tot_time,av_time,out
242 return tot_time,av_time,out
243
243
244 def timings(reps,func,*args,**kw):
244 def timings(reps,func,*args,**kw):
245 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
245 """timings(reps,func,*args,**kw) -> (t_total,t_per_call)
246
246
247 Execute a function reps times, return a tuple with the elapsed total CPU
247 Execute a function reps times, return a tuple with the elapsed total CPU
248 time in seconds and the time per call. These are just the first two values
248 time in seconds and the time per call. These are just the first two values
249 in timings_out()."""
249 in timings_out()."""
250
250
251 return timings_out(reps,func,*args,**kw)[0:2]
251 return timings_out(reps,func,*args,**kw)[0:2]
252
252
253 def timing(func,*args,**kw):
253 def timing(func,*args,**kw):
254 """timing(func,*args,**kw) -> t_total
254 """timing(func,*args,**kw) -> t_total
255
255
256 Execute a function once, return the elapsed total CPU time in
256 Execute a function once, return the elapsed total CPU time in
257 seconds. This is just the first value in timings_out()."""
257 seconds. This is just the first value in timings_out()."""
258
258
259 return timings_out(1,func,*args,**kw)[0]
259 return timings_out(1,func,*args,**kw)[0]
260
260
261 #****************************************************************************
261 #****************************************************************************
262 # file and system
262 # file and system
263
263
264 def arg_split(s,posix=False):
264 def arg_split(s,posix=False):
265 """Split a command line's arguments in a shell-like manner.
265 """Split a command line's arguments in a shell-like manner.
266
266
267 This is a modified version of the standard library's shlex.split()
267 This is a modified version of the standard library's shlex.split()
268 function, but with a default of posix=False for splitting, so that quotes
268 function, but with a default of posix=False for splitting, so that quotes
269 in inputs are respected."""
269 in inputs are respected."""
270
270
271 # XXX - there may be unicode-related problems here!!! I'm not sure that
271 # XXX - there may be unicode-related problems here!!! I'm not sure that
272 # shlex is truly unicode-safe, so it might be necessary to do
272 # shlex is truly unicode-safe, so it might be necessary to do
273 #
273 #
274 # s = s.encode(sys.stdin.encoding)
274 # s = s.encode(sys.stdin.encoding)
275 #
275 #
276 # first, to ensure that shlex gets a normal string. Input from anyone who
276 # first, to ensure that shlex gets a normal string. Input from anyone who
277 # knows more about unicode and shlex than I would be good to have here...
277 # knows more about unicode and shlex than I would be good to have here...
278 lex = shlex.shlex(s, posix=posix)
278 lex = shlex.shlex(s, posix=posix)
279 lex.whitespace_split = True
279 lex.whitespace_split = True
280 return list(lex)
280 return list(lex)
281
281
282 def system(cmd,verbose=0,debug=0,header=''):
282 def system(cmd,verbose=0,debug=0,header=''):
283 """Execute a system command, return its exit status.
283 """Execute a system command, return its exit status.
284
284
285 Options:
285 Options:
286
286
287 - verbose (0): print the command to be executed.
287 - verbose (0): print the command to be executed.
288
288
289 - debug (0): only print, do not actually execute.
289 - debug (0): only print, do not actually execute.
290
290
291 - header (''): Header to print on screen prior to the executed command (it
291 - header (''): Header to print on screen prior to the executed command (it
292 is only prepended to the command, no newlines are added).
292 is only prepended to the command, no newlines are added).
293
293
294 Note: a stateful version of this function is available through the
294 Note: a stateful version of this function is available through the
295 SystemExec class."""
295 SystemExec class."""
296
296
297 stat = 0
297 stat = 0
298 if verbose or debug: print header+cmd
298 if verbose or debug: print header+cmd
299 sys.stdout.flush()
299 sys.stdout.flush()
300 if not debug: stat = os.system(cmd)
300 if not debug: stat = os.system(cmd)
301 return stat
301 return stat
302
302
303 # This function is used by ipython in a lot of places to make system calls.
303 # This function is used by ipython in a lot of places to make system calls.
304 # We need it to be slightly different under win32, due to the vagaries of
304 # We need it to be slightly different under win32, due to the vagaries of
305 # 'network shares'. A win32 override is below.
305 # 'network shares'. A win32 override is below.
306
306
307 def shell(cmd,verbose=0,debug=0,header=''):
307 def shell(cmd,verbose=0,debug=0,header=''):
308 """Execute a command in the system shell, always return None.
308 """Execute a command in the system shell, always return None.
309
309
310 Options:
310 Options:
311
311
312 - verbose (0): print the command to be executed.
312 - verbose (0): print the command to be executed.
313
313
314 - debug (0): only print, do not actually execute.
314 - debug (0): only print, do not actually execute.
315
315
316 - header (''): Header to print on screen prior to the executed command (it
316 - header (''): Header to print on screen prior to the executed command (it
317 is only prepended to the command, no newlines are added).
317 is only prepended to the command, no newlines are added).
318
318
319 Note: this is similar to genutils.system(), but it returns None so it can
319 Note: this is similar to genutils.system(), but it returns None so it can
320 be conveniently used in interactive loops without getting the return value
320 be conveniently used in interactive loops without getting the return value
321 (typically 0) printed many times."""
321 (typically 0) printed many times."""
322
322
323 stat = 0
323 stat = 0
324 if verbose or debug: print header+cmd
324 if verbose or debug: print header+cmd
325 # flush stdout so we don't mangle python's buffering
325 # flush stdout so we don't mangle python's buffering
326 sys.stdout.flush()
326 sys.stdout.flush()
327
327
328 if not debug:
328 if not debug:
329 platutils.set_term_title("IPy:" + cmd)
329 platutils.set_term_title("IPy:" + cmd)
330 os.system(cmd)
330 os.system(cmd)
331 platutils.set_term_title("IPy:" + os.path.basename(os.getcwd()))
331 platutils.set_term_title("IPy:" + os.path.basename(os.getcwd()))
332
332
333 # override shell() for win32 to deal with network shares
333 # override shell() for win32 to deal with network shares
334 if os.name in ('nt','dos'):
334 if os.name in ('nt','dos'):
335
335
336 shell_ori = shell
336 shell_ori = shell
337
337
338 def shell(cmd,verbose=0,debug=0,header=''):
338 def shell(cmd,verbose=0,debug=0,header=''):
339 if os.getcwd().startswith(r"\\"):
339 if os.getcwd().startswith(r"\\"):
340 path = os.getcwd()
340 path = os.getcwd()
341 # change to c drive (cannot be on UNC-share when issuing os.system,
341 # change to c drive (cannot be on UNC-share when issuing os.system,
342 # as cmd.exe cannot handle UNC addresses)
342 # as cmd.exe cannot handle UNC addresses)
343 os.chdir("c:")
343 os.chdir("c:")
344 # issue pushd to the UNC-share and then run the command
344 # issue pushd to the UNC-share and then run the command
345 try:
345 try:
346 shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
346 shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
347 finally:
347 finally:
348 os.chdir(path)
348 os.chdir(path)
349 else:
349 else:
350 shell_ori(cmd,verbose,debug,header)
350 shell_ori(cmd,verbose,debug,header)
351
351
352 shell.__doc__ = shell_ori.__doc__
352 shell.__doc__ = shell_ori.__doc__
353
353
354 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
354 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
355 """Dummy substitute for perl's backquotes.
355 """Dummy substitute for perl's backquotes.
356
356
357 Executes a command and returns the output.
357 Executes a command and returns the output.
358
358
359 Accepts the same arguments as system(), plus:
359 Accepts the same arguments as system(), plus:
360
360
361 - split(0): if true, the output is returned as a list split on newlines.
361 - split(0): if true, the output is returned as a list split on newlines.
362
362
363 Note: a stateful version of this function is available through the
363 Note: a stateful version of this function is available through the
364 SystemExec class.
364 SystemExec class.
365
365
366 This is pretty much deprecated and rarely used,
366 This is pretty much deprecated and rarely used,
367 genutils.getoutputerror may be what you need.
367 genutils.getoutputerror may be what you need.
368
368
369 """
369 """
370
370
371 if verbose or debug: print header+cmd
371 if verbose or debug: print header+cmd
372 if not debug:
372 if not debug:
373 output = os.popen(cmd).read()
373 output = os.popen(cmd).read()
374 # stipping last \n is here for backwards compat.
374 # stipping last \n is here for backwards compat.
375 if output.endswith('\n'):
375 if output.endswith('\n'):
376 output = output[:-1]
376 output = output[:-1]
377 if split:
377 if split:
378 return output.split('\n')
378 return output.split('\n')
379 else:
379 else:
380 return output
380 return output
381
381
382 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
382 def getoutputerror(cmd,verbose=0,debug=0,header='',split=0):
383 """Return (standard output,standard error) of executing cmd in a shell.
383 """Return (standard output,standard error) of executing cmd in a shell.
384
384
385 Accepts the same arguments as system(), plus:
385 Accepts the same arguments as system(), plus:
386
386
387 - split(0): if true, each of stdout/err is returned as a list split on
387 - split(0): if true, each of stdout/err is returned as a list split on
388 newlines.
388 newlines.
389
389
390 Note: a stateful version of this function is available through the
390 Note: a stateful version of this function is available through the
391 SystemExec class."""
391 SystemExec class."""
392
392
393 if verbose or debug: print header+cmd
393 if verbose or debug: print header+cmd
394 if not cmd:
394 if not cmd:
395 if split:
395 if split:
396 return [],[]
396 return [],[]
397 else:
397 else:
398 return '',''
398 return '',''
399 if not debug:
399 if not debug:
400 pin,pout,perr = os.popen3(cmd)
400 pin,pout,perr = os.popen3(cmd)
401 tout = pout.read().rstrip()
401 tout = pout.read().rstrip()
402 terr = perr.read().rstrip()
402 terr = perr.read().rstrip()
403 pin.close()
403 pin.close()
404 pout.close()
404 pout.close()
405 perr.close()
405 perr.close()
406 if split:
406 if split:
407 return tout.split('\n'),terr.split('\n')
407 return tout.split('\n'),terr.split('\n')
408 else:
408 else:
409 return tout,terr
409 return tout,terr
410
410
411 # for compatibility with older naming conventions
411 # for compatibility with older naming conventions
412 xsys = system
412 xsys = system
413 bq = getoutput
413 bq = getoutput
414
414
415 class SystemExec:
415 class SystemExec:
416 """Access the system and getoutput functions through a stateful interface.
416 """Access the system and getoutput functions through a stateful interface.
417
417
418 Note: here we refer to the system and getoutput functions from this
418 Note: here we refer to the system and getoutput functions from this
419 library, not the ones from the standard python library.
419 library, not the ones from the standard python library.
420
420
421 This class offers the system and getoutput functions as methods, but the
421 This class offers the system and getoutput functions as methods, but the
422 verbose, debug and header parameters can be set for the instance (at
422 verbose, debug and header parameters can be set for the instance (at
423 creation time or later) so that they don't need to be specified on each
423 creation time or later) so that they don't need to be specified on each
424 call.
424 call.
425
425
426 For efficiency reasons, there's no way to override the parameters on a
426 For efficiency reasons, there's no way to override the parameters on a
427 per-call basis other than by setting instance attributes. If you need
427 per-call basis other than by setting instance attributes. If you need
428 local overrides, it's best to directly call system() or getoutput().
428 local overrides, it's best to directly call system() or getoutput().
429
429
430 The following names are provided as alternate options:
430 The following names are provided as alternate options:
431 - xsys: alias to system
431 - xsys: alias to system
432 - bq: alias to getoutput
432 - bq: alias to getoutput
433
433
434 An instance can then be created as:
434 An instance can then be created as:
435 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
435 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
436
436
437 And used as:
437 And used as:
438 >>> sysexec.xsys('pwd')
438 >>> sysexec.xsys('pwd')
439 >>> dirlist = sysexec.bq('ls -l')
439 >>> dirlist = sysexec.bq('ls -l')
440 """
440 """
441
441
442 def __init__(self,verbose=0,debug=0,header='',split=0):
442 def __init__(self,verbose=0,debug=0,header='',split=0):
443 """Specify the instance's values for verbose, debug and header."""
443 """Specify the instance's values for verbose, debug and header."""
444 setattr_list(self,'verbose debug header split')
444 setattr_list(self,'verbose debug header split')
445
445
446 def system(self,cmd):
446 def system(self,cmd):
447 """Stateful interface to system(), with the same keyword parameters."""
447 """Stateful interface to system(), with the same keyword parameters."""
448
448
449 system(cmd,self.verbose,self.debug,self.header)
449 system(cmd,self.verbose,self.debug,self.header)
450
450
451 def shell(self,cmd):
451 def shell(self,cmd):
452 """Stateful interface to shell(), with the same keyword parameters."""
452 """Stateful interface to shell(), with the same keyword parameters."""
453
453
454 shell(cmd,self.verbose,self.debug,self.header)
454 shell(cmd,self.verbose,self.debug,self.header)
455
455
456 xsys = system # alias
456 xsys = system # alias
457
457
458 def getoutput(self,cmd):
458 def getoutput(self,cmd):
459 """Stateful interface to getoutput()."""
459 """Stateful interface to getoutput()."""
460
460
461 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
461 return getoutput(cmd,self.verbose,self.debug,self.header,self.split)
462
462
463 def getoutputerror(self,cmd):
463 def getoutputerror(self,cmd):
464 """Stateful interface to getoutputerror()."""
464 """Stateful interface to getoutputerror()."""
465
465
466 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
466 return getoutputerror(cmd,self.verbose,self.debug,self.header,self.split)
467
467
468 bq = getoutput # alias
468 bq = getoutput # alias
469
469
470 #-----------------------------------------------------------------------------
470 #-----------------------------------------------------------------------------
471 def mutex_opts(dict,ex_op):
471 def mutex_opts(dict,ex_op):
472 """Check for presence of mutually exclusive keys in a dict.
472 """Check for presence of mutually exclusive keys in a dict.
473
473
474 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
474 Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]"""
475 for op1,op2 in ex_op:
475 for op1,op2 in ex_op:
476 if op1 in dict and op2 in dict:
476 if op1 in dict and op2 in dict:
477 raise ValueError,'\n*** ERROR in Arguments *** '\
477 raise ValueError,'\n*** ERROR in Arguments *** '\
478 'Options '+op1+' and '+op2+' are mutually exclusive.'
478 'Options '+op1+' and '+op2+' are mutually exclusive.'
479
479
480 #-----------------------------------------------------------------------------
480 #-----------------------------------------------------------------------------
481 def get_py_filename(name):
481 def get_py_filename(name):
482 """Return a valid python filename in the current directory.
482 """Return a valid python filename in the current directory.
483
483
484 If the given name is not a file, it adds '.py' and searches again.
484 If the given name is not a file, it adds '.py' and searches again.
485 Raises IOError with an informative message if the file isn't found."""
485 Raises IOError with an informative message if the file isn't found."""
486
486
487 name = os.path.expanduser(name)
487 name = os.path.expanduser(name)
488 if not os.path.isfile(name) and not name.endswith('.py'):
488 if not os.path.isfile(name) and not name.endswith('.py'):
489 name += '.py'
489 name += '.py'
490 if os.path.isfile(name):
490 if os.path.isfile(name):
491 return name
491 return name
492 else:
492 else:
493 raise IOError,'File `%s` not found.' % name
493 raise IOError,'File `%s` not found.' % name
494
494
495 #-----------------------------------------------------------------------------
495 #-----------------------------------------------------------------------------
496 def filefind(fname,alt_dirs = None):
496 def filefind(fname,alt_dirs = None):
497 """Return the given filename either in the current directory, if it
497 """Return the given filename either in the current directory, if it
498 exists, or in a specified list of directories.
498 exists, or in a specified list of directories.
499
499
500 ~ expansion is done on all file and directory names.
500 ~ expansion is done on all file and directory names.
501
501
502 Upon an unsuccessful search, raise an IOError exception."""
502 Upon an unsuccessful search, raise an IOError exception."""
503
503
504 if alt_dirs is None:
504 if alt_dirs is None:
505 try:
505 try:
506 alt_dirs = get_home_dir()
506 alt_dirs = get_home_dir()
507 except HomeDirError:
507 except HomeDirError:
508 alt_dirs = os.getcwd()
508 alt_dirs = os.getcwd()
509 search = [fname] + list_strings(alt_dirs)
509 search = [fname] + list_strings(alt_dirs)
510 search = map(os.path.expanduser,search)
510 search = map(os.path.expanduser,search)
511 #print 'search list for',fname,'list:',search # dbg
511 #print 'search list for',fname,'list:',search # dbg
512 fname = search[0]
512 fname = search[0]
513 if os.path.isfile(fname):
513 if os.path.isfile(fname):
514 return fname
514 return fname
515 for direc in search[1:]:
515 for direc in search[1:]:
516 testname = os.path.join(direc,fname)
516 testname = os.path.join(direc,fname)
517 #print 'testname',testname # dbg
517 #print 'testname',testname # dbg
518 if os.path.isfile(testname):
518 if os.path.isfile(testname):
519 return testname
519 return testname
520 raise IOError,'File' + `fname` + \
520 raise IOError,'File' + `fname` + \
521 ' not found in current or supplied directories:' + `alt_dirs`
521 ' not found in current or supplied directories:' + `alt_dirs`
522
522
523 #----------------------------------------------------------------------------
523 #----------------------------------------------------------------------------
524 def file_read(filename):
524 def file_read(filename):
525 """Read a file and close it. Returns the file source."""
525 """Read a file and close it. Returns the file source."""
526 fobj = open(filename,'r');
526 fobj = open(filename,'r');
527 source = fobj.read();
527 source = fobj.read();
528 fobj.close()
528 fobj.close()
529 return source
529 return source
530
530
531 def file_readlines(filename):
531 def file_readlines(filename):
532 """Read a file and close it. Returns the file source using readlines()."""
532 """Read a file and close it. Returns the file source using readlines()."""
533 fobj = open(filename,'r');
533 fobj = open(filename,'r');
534 lines = fobj.readlines();
534 lines = fobj.readlines();
535 fobj.close()
535 fobj.close()
536 return lines
536 return lines
537
537
538 #----------------------------------------------------------------------------
538 #----------------------------------------------------------------------------
539 def target_outdated(target,deps):
539 def target_outdated(target,deps):
540 """Determine whether a target is out of date.
540 """Determine whether a target is out of date.
541
541
542 target_outdated(target,deps) -> 1/0
542 target_outdated(target,deps) -> 1/0
543
543
544 deps: list of filenames which MUST exist.
544 deps: list of filenames which MUST exist.
545 target: single filename which may or may not exist.
545 target: single filename which may or may not exist.
546
546
547 If target doesn't exist or is older than any file listed in deps, return
547 If target doesn't exist or is older than any file listed in deps, return
548 true, otherwise return false.
548 true, otherwise return false.
549 """
549 """
550 try:
550 try:
551 target_time = os.path.getmtime(target)
551 target_time = os.path.getmtime(target)
552 except os.error:
552 except os.error:
553 return 1
553 return 1
554 for dep in deps:
554 for dep in deps:
555 dep_time = os.path.getmtime(dep)
555 dep_time = os.path.getmtime(dep)
556 if dep_time > target_time:
556 if dep_time > target_time:
557 #print "For target",target,"Dep failed:",dep # dbg
557 #print "For target",target,"Dep failed:",dep # dbg
558 #print "times (dep,tar):",dep_time,target_time # dbg
558 #print "times (dep,tar):",dep_time,target_time # dbg
559 return 1
559 return 1
560 return 0
560 return 0
561
561
562 #-----------------------------------------------------------------------------
562 #-----------------------------------------------------------------------------
563 def target_update(target,deps,cmd):
563 def target_update(target,deps,cmd):
564 """Update a target with a given command given a list of dependencies.
564 """Update a target with a given command given a list of dependencies.
565
565
566 target_update(target,deps,cmd) -> runs cmd if target is outdated.
566 target_update(target,deps,cmd) -> runs cmd if target is outdated.
567
567
568 This is just a wrapper around target_outdated() which calls the given
568 This is just a wrapper around target_outdated() which calls the given
569 command if target is outdated."""
569 command if target is outdated."""
570
570
571 if target_outdated(target,deps):
571 if target_outdated(target,deps):
572 xsys(cmd)
572 xsys(cmd)
573
573
574 #----------------------------------------------------------------------------
574 #----------------------------------------------------------------------------
575 def unquote_ends(istr):
575 def unquote_ends(istr):
576 """Remove a single pair of quotes from the endpoints of a string."""
576 """Remove a single pair of quotes from the endpoints of a string."""
577
577
578 if not istr:
578 if not istr:
579 return istr
579 return istr
580 if (istr[0]=="'" and istr[-1]=="'") or \
580 if (istr[0]=="'" and istr[-1]=="'") or \
581 (istr[0]=='"' and istr[-1]=='"'):
581 (istr[0]=='"' and istr[-1]=='"'):
582 return istr[1:-1]
582 return istr[1:-1]
583 else:
583 else:
584 return istr
584 return istr
585
585
586 #----------------------------------------------------------------------------
586 #----------------------------------------------------------------------------
587 def process_cmdline(argv,names=[],defaults={},usage=''):
587 def process_cmdline(argv,names=[],defaults={},usage=''):
588 """ Process command-line options and arguments.
588 """ Process command-line options and arguments.
589
589
590 Arguments:
590 Arguments:
591
591
592 - argv: list of arguments, typically sys.argv.
592 - argv: list of arguments, typically sys.argv.
593
593
594 - names: list of option names. See DPyGetOpt docs for details on options
594 - names: list of option names. See DPyGetOpt docs for details on options
595 syntax.
595 syntax.
596
596
597 - defaults: dict of default values.
597 - defaults: dict of default values.
598
598
599 - usage: optional usage notice to print if a wrong argument is passed.
599 - usage: optional usage notice to print if a wrong argument is passed.
600
600
601 Return a dict of options and a list of free arguments."""
601 Return a dict of options and a list of free arguments."""
602
602
603 getopt = DPyGetOpt.DPyGetOpt()
603 getopt = DPyGetOpt.DPyGetOpt()
604 getopt.setIgnoreCase(0)
604 getopt.setIgnoreCase(0)
605 getopt.parseConfiguration(names)
605 getopt.parseConfiguration(names)
606
606
607 try:
607 try:
608 getopt.processArguments(argv)
608 getopt.processArguments(argv)
609 except:
609 except:
610 print usage
610 print usage
611 warn(`sys.exc_value`,level=4)
611 warn(`sys.exc_value`,level=4)
612
612
613 defaults.update(getopt.optionValues)
613 defaults.update(getopt.optionValues)
614 args = getopt.freeValues
614 args = getopt.freeValues
615
615
616 return defaults,args
616 return defaults,args
617
617
618 #----------------------------------------------------------------------------
618 #----------------------------------------------------------------------------
619 def optstr2types(ostr):
619 def optstr2types(ostr):
620 """Convert a string of option names to a dict of type mappings.
620 """Convert a string of option names to a dict of type mappings.
621
621
622 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
622 optstr2types(str) -> {None:'string_opts',int:'int_opts',float:'float_opts'}
623
623
624 This is used to get the types of all the options in a string formatted
624 This is used to get the types of all the options in a string formatted
625 with the conventions of DPyGetOpt. The 'type' None is used for options
625 with the conventions of DPyGetOpt. The 'type' None is used for options
626 which are strings (they need no further conversion). This function's main
626 which are strings (they need no further conversion). This function's main
627 use is to get a typemap for use with read_dict().
627 use is to get a typemap for use with read_dict().
628 """
628 """
629
629
630 typeconv = {None:'',int:'',float:''}
630 typeconv = {None:'',int:'',float:''}
631 typemap = {'s':None,'i':int,'f':float}
631 typemap = {'s':None,'i':int,'f':float}
632 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
632 opt_re = re.compile(r'([\w]*)([^:=]*:?=?)([sif]?)')
633
633
634 for w in ostr.split():
634 for w in ostr.split():
635 oname,alias,otype = opt_re.match(w).groups()
635 oname,alias,otype = opt_re.match(w).groups()
636 if otype == '' or alias == '!': # simple switches are integers too
636 if otype == '' or alias == '!': # simple switches are integers too
637 otype = 'i'
637 otype = 'i'
638 typeconv[typemap[otype]] += oname + ' '
638 typeconv[typemap[otype]] += oname + ' '
639 return typeconv
639 return typeconv
640
640
641 #----------------------------------------------------------------------------
641 #----------------------------------------------------------------------------
642 def read_dict(filename,type_conv=None,**opt):
642 def read_dict(filename,type_conv=None,**opt):
643
643
644 """Read a dictionary of key=value pairs from an input file, optionally
644 """Read a dictionary of key=value pairs from an input file, optionally
645 performing conversions on the resulting values.
645 performing conversions on the resulting values.
646
646
647 read_dict(filename,type_conv,**opt) -> dict
647 read_dict(filename,type_conv,**opt) -> dict
648
648
649 Only one value per line is accepted, the format should be
649 Only one value per line is accepted, the format should be
650 # optional comments are ignored
650 # optional comments are ignored
651 key value\n
651 key value\n
652
652
653 Args:
653 Args:
654
654
655 - type_conv: A dictionary specifying which keys need to be converted to
655 - type_conv: A dictionary specifying which keys need to be converted to
656 which types. By default all keys are read as strings. This dictionary
656 which types. By default all keys are read as strings. This dictionary
657 should have as its keys valid conversion functions for strings
657 should have as its keys valid conversion functions for strings
658 (int,long,float,complex, or your own). The value for each key
658 (int,long,float,complex, or your own). The value for each key
659 (converter) should be a whitespace separated string containing the names
659 (converter) should be a whitespace separated string containing the names
660 of all the entries in the file to be converted using that function. For
660 of all the entries in the file to be converted using that function. For
661 keys to be left alone, use None as the conversion function (only needed
661 keys to be left alone, use None as the conversion function (only needed
662 with purge=1, see below).
662 with purge=1, see below).
663
663
664 - opt: dictionary with extra options as below (default in parens)
664 - opt: dictionary with extra options as below (default in parens)
665
665
666 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
666 purge(0): if set to 1, all keys *not* listed in type_conv are purged out
667 of the dictionary to be returned. If purge is going to be used, the
667 of the dictionary to be returned. If purge is going to be used, the
668 set of keys to be left as strings also has to be explicitly specified
668 set of keys to be left as strings also has to be explicitly specified
669 using the (non-existent) conversion function None.
669 using the (non-existent) conversion function None.
670
670
671 fs(None): field separator. This is the key/value separator to be used
671 fs(None): field separator. This is the key/value separator to be used
672 when parsing the file. The None default means any whitespace [behavior
672 when parsing the file. The None default means any whitespace [behavior
673 of string.split()].
673 of string.split()].
674
674
675 strip(0): if 1, strip string values of leading/trailinig whitespace.
675 strip(0): if 1, strip string values of leading/trailinig whitespace.
676
676
677 warn(1): warning level if requested keys are not found in file.
677 warn(1): warning level if requested keys are not found in file.
678 - 0: silently ignore.
678 - 0: silently ignore.
679 - 1: inform but proceed.
679 - 1: inform but proceed.
680 - 2: raise KeyError exception.
680 - 2: raise KeyError exception.
681
681
682 no_empty(0): if 1, remove keys with whitespace strings as a value.
682 no_empty(0): if 1, remove keys with whitespace strings as a value.
683
683
684 unique([]): list of keys (or space separated string) which can't be
684 unique([]): list of keys (or space separated string) which can't be
685 repeated. If one such key is found in the file, each new instance
685 repeated. If one such key is found in the file, each new instance
686 overwrites the previous one. For keys not listed here, the behavior is
686 overwrites the previous one. For keys not listed here, the behavior is
687 to make a list of all appearances.
687 to make a list of all appearances.
688
688
689 Example:
689 Example:
690 If the input file test.ini has:
690 If the input file test.ini has:
691 i 3
691 i 3
692 x 4.5
692 x 4.5
693 y 5.5
693 y 5.5
694 s hi ho
694 s hi ho
695 Then:
695 Then:
696
696
697 >>> type_conv={int:'i',float:'x',None:'s'}
697 >>> type_conv={int:'i',float:'x',None:'s'}
698 >>> read_dict('test.ini')
698 >>> read_dict('test.ini')
699 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
699 {'i': '3', 's': 'hi ho', 'x': '4.5', 'y': '5.5'}
700 >>> read_dict('test.ini',type_conv)
700 >>> read_dict('test.ini',type_conv)
701 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
701 {'i': 3, 's': 'hi ho', 'x': 4.5, 'y': '5.5'}
702 >>> read_dict('test.ini',type_conv,purge=1)
702 >>> read_dict('test.ini',type_conv,purge=1)
703 {'i': 3, 's': 'hi ho', 'x': 4.5}
703 {'i': 3, 's': 'hi ho', 'x': 4.5}
704 """
704 """
705
705
706 # starting config
706 # starting config
707 opt.setdefault('purge',0)
707 opt.setdefault('purge',0)
708 opt.setdefault('fs',None) # field sep defaults to any whitespace
708 opt.setdefault('fs',None) # field sep defaults to any whitespace
709 opt.setdefault('strip',0)
709 opt.setdefault('strip',0)
710 opt.setdefault('warn',1)
710 opt.setdefault('warn',1)
711 opt.setdefault('no_empty',0)
711 opt.setdefault('no_empty',0)
712 opt.setdefault('unique','')
712 opt.setdefault('unique','')
713 if type(opt['unique']) in StringTypes:
713 if type(opt['unique']) in StringTypes:
714 unique_keys = qw(opt['unique'])
714 unique_keys = qw(opt['unique'])
715 elif type(opt['unique']) in (types.TupleType,types.ListType):
715 elif type(opt['unique']) in (types.TupleType,types.ListType):
716 unique_keys = opt['unique']
716 unique_keys = opt['unique']
717 else:
717 else:
718 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
718 raise ValueError, 'Unique keys must be given as a string, List or Tuple'
719
719
720 dict = {}
720 dict = {}
721 # first read in table of values as strings
721 # first read in table of values as strings
722 file = open(filename,'r')
722 file = open(filename,'r')
723 for line in file.readlines():
723 for line in file.readlines():
724 line = line.strip()
724 line = line.strip()
725 if len(line) and line[0]=='#': continue
725 if len(line) and line[0]=='#': continue
726 if len(line)>0:
726 if len(line)>0:
727 lsplit = line.split(opt['fs'],1)
727 lsplit = line.split(opt['fs'],1)
728 try:
728 try:
729 key,val = lsplit
729 key,val = lsplit
730 except ValueError:
730 except ValueError:
731 key,val = lsplit[0],''
731 key,val = lsplit[0],''
732 key = key.strip()
732 key = key.strip()
733 if opt['strip']: val = val.strip()
733 if opt['strip']: val = val.strip()
734 if val == "''" or val == '""': val = ''
734 if val == "''" or val == '""': val = ''
735 if opt['no_empty'] and (val=='' or val.isspace()):
735 if opt['no_empty'] and (val=='' or val.isspace()):
736 continue
736 continue
737 # if a key is found more than once in the file, build a list
737 # if a key is found more than once in the file, build a list
738 # unless it's in the 'unique' list. In that case, last found in file
738 # unless it's in the 'unique' list. In that case, last found in file
739 # takes precedence. User beware.
739 # takes precedence. User beware.
740 try:
740 try:
741 if dict[key] and key in unique_keys:
741 if dict[key] and key in unique_keys:
742 dict[key] = val
742 dict[key] = val
743 elif type(dict[key]) is types.ListType:
743 elif type(dict[key]) is types.ListType:
744 dict[key].append(val)
744 dict[key].append(val)
745 else:
745 else:
746 dict[key] = [dict[key],val]
746 dict[key] = [dict[key],val]
747 except KeyError:
747 except KeyError:
748 dict[key] = val
748 dict[key] = val
749 # purge if requested
749 # purge if requested
750 if opt['purge']:
750 if opt['purge']:
751 accepted_keys = qwflat(type_conv.values())
751 accepted_keys = qwflat(type_conv.values())
752 for key in dict.keys():
752 for key in dict.keys():
753 if key in accepted_keys: continue
753 if key in accepted_keys: continue
754 del(dict[key])
754 del(dict[key])
755 # now convert if requested
755 # now convert if requested
756 if type_conv==None: return dict
756 if type_conv==None: return dict
757 conversions = type_conv.keys()
757 conversions = type_conv.keys()
758 try: conversions.remove(None)
758 try: conversions.remove(None)
759 except: pass
759 except: pass
760 for convert in conversions:
760 for convert in conversions:
761 for val in qw(type_conv[convert]):
761 for val in qw(type_conv[convert]):
762 try:
762 try:
763 dict[val] = convert(dict[val])
763 dict[val] = convert(dict[val])
764 except KeyError,e:
764 except KeyError,e:
765 if opt['warn'] == 0:
765 if opt['warn'] == 0:
766 pass
766 pass
767 elif opt['warn'] == 1:
767 elif opt['warn'] == 1:
768 print >>sys.stderr, 'Warning: key',val,\
768 print >>sys.stderr, 'Warning: key',val,\
769 'not found in file',filename
769 'not found in file',filename
770 elif opt['warn'] == 2:
770 elif opt['warn'] == 2:
771 raise KeyError,e
771 raise KeyError,e
772 else:
772 else:
773 raise ValueError,'Warning level must be 0,1 or 2'
773 raise ValueError,'Warning level must be 0,1 or 2'
774
774
775 return dict
775 return dict
776
776
777 #----------------------------------------------------------------------------
777 #----------------------------------------------------------------------------
778 def flag_calls(func):
778 def flag_calls(func):
779 """Wrap a function to detect and flag when it gets called.
779 """Wrap a function to detect and flag when it gets called.
780
780
781 This is a decorator which takes a function and wraps it in a function with
781 This is a decorator which takes a function and wraps it in a function with
782 a 'called' attribute. wrapper.called is initialized to False.
782 a 'called' attribute. wrapper.called is initialized to False.
783
783
784 The wrapper.called attribute is set to False right before each call to the
784 The wrapper.called attribute is set to False right before each call to the
785 wrapped function, so if the call fails it remains False. After the call
785 wrapped function, so if the call fails it remains False. After the call
786 completes, wrapper.called is set to True and the output is returned.
786 completes, wrapper.called is set to True and the output is returned.
787
787
788 Testing for truth in wrapper.called allows you to determine if a call to
788 Testing for truth in wrapper.called allows you to determine if a call to
789 func() was attempted and succeeded."""
789 func() was attempted and succeeded."""
790
790
791 def wrapper(*args,**kw):
791 def wrapper(*args,**kw):
792 wrapper.called = False
792 wrapper.called = False
793 out = func(*args,**kw)
793 out = func(*args,**kw)
794 wrapper.called = True
794 wrapper.called = True
795 return out
795 return out
796
796
797 wrapper.called = False
797 wrapper.called = False
798 wrapper.__doc__ = func.__doc__
798 wrapper.__doc__ = func.__doc__
799 return wrapper
799 return wrapper
800
800
801 #----------------------------------------------------------------------------
801 #----------------------------------------------------------------------------
802 def dhook_wrap(func,*a,**k):
803 """Wrap a function call in a sys.displayhook controller.
804
805 Returns a wrapper around func which calls func, with all its arguments and
806 keywords unmodified, using the default sys.displayhook. Since IPython
807 modifies sys.displayhook, it breaks the behavior of certain systems that
808 rely on the default behavior, notably doctest.
809 """
810
811 def f(*a,**k):
812
813 dhook_s = sys.displayhook
814 sys.displayhook = sys.__displayhook__
815 try:
816 out = func(*a,**k)
817 finally:
818 sys.displayhook = dhook_s
819
820 return out
821
822 f.__doc__ = func.__doc__
823 return f
824
825 #----------------------------------------------------------------------------
802 class HomeDirError(Error):
826 class HomeDirError(Error):
803 pass
827 pass
804
828
805 def get_home_dir():
829 def get_home_dir():
806 """Return the closest possible equivalent to a 'home' directory.
830 """Return the closest possible equivalent to a 'home' directory.
807
831
808 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
832 We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.
809
833
810 Currently only Posix and NT are implemented, a HomeDirError exception is
834 Currently only Posix and NT are implemented, a HomeDirError exception is
811 raised for all other OSes. """
835 raised for all other OSes. """
812
836
813 isdir = os.path.isdir
837 isdir = os.path.isdir
814 env = os.environ
838 env = os.environ
815
839
816 # first, check py2exe distribution root directory for _ipython.
840 # first, check py2exe distribution root directory for _ipython.
817 # This overrides all. Normally does not exist.
841 # This overrides all. Normally does not exist.
818
842
819 if '\\library.zip\\' in IPython.__file__.lower():
843 if '\\library.zip\\' in IPython.__file__.lower():
820 root, rest = IPython.__file__.lower().split('library.zip')
844 root, rest = IPython.__file__.lower().split('library.zip')
821 if isdir(root + '_ipython'):
845 if isdir(root + '_ipython'):
822 os.environ["IPYKITROOT"] = root.rstrip('\\')
846 os.environ["IPYKITROOT"] = root.rstrip('\\')
823 return root
847 return root
824
848
825 try:
849 try:
826 homedir = env['HOME']
850 homedir = env['HOME']
827 if not isdir(homedir):
851 if not isdir(homedir):
828 # in case a user stuck some string which does NOT resolve to a
852 # in case a user stuck some string which does NOT resolve to a
829 # valid path, it's as good as if we hadn't foud it
853 # valid path, it's as good as if we hadn't foud it
830 raise KeyError
854 raise KeyError
831 return homedir
855 return homedir
832 except KeyError:
856 except KeyError:
833 if os.name == 'posix':
857 if os.name == 'posix':
834 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
858 raise HomeDirError,'undefined $HOME, IPython can not proceed.'
835 elif os.name == 'nt':
859 elif os.name == 'nt':
836 # For some strange reason, win9x returns 'nt' for os.name.
860 # For some strange reason, win9x returns 'nt' for os.name.
837 try:
861 try:
838 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
862 homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH'])
839 if not isdir(homedir):
863 if not isdir(homedir):
840 homedir = os.path.join(env['USERPROFILE'])
864 homedir = os.path.join(env['USERPROFILE'])
841 if not isdir(homedir):
865 if not isdir(homedir):
842 raise HomeDirError
866 raise HomeDirError
843 return homedir
867 return homedir
844 except:
868 except:
845 try:
869 try:
846 # Use the registry to get the 'My Documents' folder.
870 # Use the registry to get the 'My Documents' folder.
847 import _winreg as wreg
871 import _winreg as wreg
848 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
872 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
849 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
873 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
850 homedir = wreg.QueryValueEx(key,'Personal')[0]
874 homedir = wreg.QueryValueEx(key,'Personal')[0]
851 key.Close()
875 key.Close()
852 if not isdir(homedir):
876 if not isdir(homedir):
853 e = ('Invalid "Personal" folder registry key '
877 e = ('Invalid "Personal" folder registry key '
854 'typically "My Documents".\n'
878 'typically "My Documents".\n'
855 'Value: %s\n'
879 'Value: %s\n'
856 'This is not a valid directory on your system.' %
880 'This is not a valid directory on your system.' %
857 homedir)
881 homedir)
858 raise HomeDirError(e)
882 raise HomeDirError(e)
859 return homedir
883 return homedir
860 except HomeDirError:
884 except HomeDirError:
861 raise
885 raise
862 except:
886 except:
863 return 'C:\\'
887 return 'C:\\'
864 elif os.name == 'dos':
888 elif os.name == 'dos':
865 # Desperate, may do absurd things in classic MacOS. May work under DOS.
889 # Desperate, may do absurd things in classic MacOS. May work under DOS.
866 return 'C:\\'
890 return 'C:\\'
867 else:
891 else:
868 raise HomeDirError,'support for your operating system not implemented.'
892 raise HomeDirError,'support for your operating system not implemented.'
869
893
870 #****************************************************************************
894 #****************************************************************************
871 # strings and text
895 # strings and text
872
896
873 class LSString(str):
897 class LSString(str):
874 """String derivative with a special access attributes.
898 """String derivative with a special access attributes.
875
899
876 These are normal strings, but with the special attributes:
900 These are normal strings, but with the special attributes:
877
901
878 .l (or .list) : value as list (split on newlines).
902 .l (or .list) : value as list (split on newlines).
879 .n (or .nlstr): original value (the string itself).
903 .n (or .nlstr): original value (the string itself).
880 .s (or .spstr): value as whitespace-separated string.
904 .s (or .spstr): value as whitespace-separated string.
881 .p (or .paths): list of path objects
905 .p (or .paths): list of path objects
882
906
883 Any values which require transformations are computed only once and
907 Any values which require transformations are computed only once and
884 cached.
908 cached.
885
909
886 Such strings are very useful to efficiently interact with the shell, which
910 Such strings are very useful to efficiently interact with the shell, which
887 typically only understands whitespace-separated options for commands."""
911 typically only understands whitespace-separated options for commands."""
888
912
889 def get_list(self):
913 def get_list(self):
890 try:
914 try:
891 return self.__list
915 return self.__list
892 except AttributeError:
916 except AttributeError:
893 self.__list = self.split('\n')
917 self.__list = self.split('\n')
894 return self.__list
918 return self.__list
895
919
896 l = list = property(get_list)
920 l = list = property(get_list)
897
921
898 def get_spstr(self):
922 def get_spstr(self):
899 try:
923 try:
900 return self.__spstr
924 return self.__spstr
901 except AttributeError:
925 except AttributeError:
902 self.__spstr = self.replace('\n',' ')
926 self.__spstr = self.replace('\n',' ')
903 return self.__spstr
927 return self.__spstr
904
928
905 s = spstr = property(get_spstr)
929 s = spstr = property(get_spstr)
906
930
907 def get_nlstr(self):
931 def get_nlstr(self):
908 return self
932 return self
909
933
910 n = nlstr = property(get_nlstr)
934 n = nlstr = property(get_nlstr)
911
935
912 def get_paths(self):
936 def get_paths(self):
913 try:
937 try:
914 return self.__paths
938 return self.__paths
915 except AttributeError:
939 except AttributeError:
916 self.__paths = [path(p) for p in self.split('\n') if os.path.exists(p)]
940 self.__paths = [path(p) for p in self.split('\n') if os.path.exists(p)]
917 return self.__paths
941 return self.__paths
918
942
919 p = paths = property(get_paths)
943 p = paths = property(get_paths)
920
944
921 def print_lsstring(arg):
945 def print_lsstring(arg):
922 """ Prettier (non-repr-like) and more informative printer for LSString """
946 """ Prettier (non-repr-like) and more informative printer for LSString """
923 print "LSString (.p, .n, .l, .s available). Value:"
947 print "LSString (.p, .n, .l, .s available). Value:"
924 print arg
948 print arg
925
949
926 print_lsstring = result_display.when_type(LSString)(print_lsstring)
950 print_lsstring = result_display.when_type(LSString)(print_lsstring)
927
951
928 #----------------------------------------------------------------------------
952 #----------------------------------------------------------------------------
929 class SList(list):
953 class SList(list):
930 """List derivative with a special access attributes.
954 """List derivative with a special access attributes.
931
955
932 These are normal lists, but with the special attributes:
956 These are normal lists, but with the special attributes:
933
957
934 .l (or .list) : value as list (the list itself).
958 .l (or .list) : value as list (the list itself).
935 .n (or .nlstr): value as a string, joined on newlines.
959 .n (or .nlstr): value as a string, joined on newlines.
936 .s (or .spstr): value as a string, joined on spaces.
960 .s (or .spstr): value as a string, joined on spaces.
937 .p (or .paths): list of path objects
961 .p (or .paths): list of path objects
938
962
939 Any values which require transformations are computed only once and
963 Any values which require transformations are computed only once and
940 cached."""
964 cached."""
941
965
942 def get_list(self):
966 def get_list(self):
943 return self
967 return self
944
968
945 l = list = property(get_list)
969 l = list = property(get_list)
946
970
947 def get_spstr(self):
971 def get_spstr(self):
948 try:
972 try:
949 return self.__spstr
973 return self.__spstr
950 except AttributeError:
974 except AttributeError:
951 self.__spstr = ' '.join(self)
975 self.__spstr = ' '.join(self)
952 return self.__spstr
976 return self.__spstr
953
977
954 s = spstr = property(get_spstr)
978 s = spstr = property(get_spstr)
955
979
956 def get_nlstr(self):
980 def get_nlstr(self):
957 try:
981 try:
958 return self.__nlstr
982 return self.__nlstr
959 except AttributeError:
983 except AttributeError:
960 self.__nlstr = '\n'.join(self)
984 self.__nlstr = '\n'.join(self)
961 return self.__nlstr
985 return self.__nlstr
962
986
963 n = nlstr = property(get_nlstr)
987 n = nlstr = property(get_nlstr)
964
988
965 def get_paths(self):
989 def get_paths(self):
966 try:
990 try:
967 return self.__paths
991 return self.__paths
968 except AttributeError:
992 except AttributeError:
969 self.__paths = [path(p) for p in self if os.path.exists(p)]
993 self.__paths = [path(p) for p in self if os.path.exists(p)]
970 return self.__paths
994 return self.__paths
971
995
972 p = paths = property(get_paths)
996 p = paths = property(get_paths)
973
997
974 #----------------------------------------------------------------------------
998 #----------------------------------------------------------------------------
975 def esc_quotes(strng):
999 def esc_quotes(strng):
976 """Return the input string with single and double quotes escaped out"""
1000 """Return the input string with single and double quotes escaped out"""
977
1001
978 return strng.replace('"','\\"').replace("'","\\'")
1002 return strng.replace('"','\\"').replace("'","\\'")
979
1003
980 #----------------------------------------------------------------------------
1004 #----------------------------------------------------------------------------
981 def make_quoted_expr(s):
1005 def make_quoted_expr(s):
982 """Return string s in appropriate quotes, using raw string if possible.
1006 """Return string s in appropriate quotes, using raw string if possible.
983
1007
984 Effectively this turns string: cd \ao\ao\
1008 Effectively this turns string: cd \ao\ao\
985 to: r"cd \ao\ao\_"[:-1]
1009 to: r"cd \ao\ao\_"[:-1]
986
1010
987 Note the use of raw string and padding at the end to allow trailing backslash.
1011 Note the use of raw string and padding at the end to allow trailing backslash.
988
1012
989 """
1013 """
990
1014
991 tail = ''
1015 tail = ''
992 tailpadding = ''
1016 tailpadding = ''
993 raw = ''
1017 raw = ''
994 if "\\" in s:
1018 if "\\" in s:
995 raw = 'r'
1019 raw = 'r'
996 if s.endswith('\\'):
1020 if s.endswith('\\'):
997 tail = '[:-1]'
1021 tail = '[:-1]'
998 tailpadding = '_'
1022 tailpadding = '_'
999 if '"' not in s:
1023 if '"' not in s:
1000 quote = '"'
1024 quote = '"'
1001 elif "'" not in s:
1025 elif "'" not in s:
1002 quote = "'"
1026 quote = "'"
1003 elif '"""' not in s and not s.endswith('"'):
1027 elif '"""' not in s and not s.endswith('"'):
1004 quote = '"""'
1028 quote = '"""'
1005 elif "'''" not in s and not s.endswith("'"):
1029 elif "'''" not in s and not s.endswith("'"):
1006 quote = "'''"
1030 quote = "'''"
1007 else:
1031 else:
1008 # give up, backslash-escaped string will do
1032 # give up, backslash-escaped string will do
1009 return '"%s"' % esc_quotes(s)
1033 return '"%s"' % esc_quotes(s)
1010 res = itpl("$raw$quote$s$tailpadding$quote$tail")
1034 res = itpl("$raw$quote$s$tailpadding$quote$tail")
1011 return res
1035 return res
1012
1036
1013
1037
1014 #----------------------------------------------------------------------------
1038 #----------------------------------------------------------------------------
1015 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
1039 def raw_input_multi(header='', ps1='==> ', ps2='..> ',terminate_str = '.'):
1016 """Take multiple lines of input.
1040 """Take multiple lines of input.
1017
1041
1018 A list with each line of input as a separate element is returned when a
1042 A list with each line of input as a separate element is returned when a
1019 termination string is entered (defaults to a single '.'). Input can also
1043 termination string is entered (defaults to a single '.'). Input can also
1020 terminate via EOF (^D in Unix, ^Z-RET in Windows).
1044 terminate via EOF (^D in Unix, ^Z-RET in Windows).
1021
1045
1022 Lines of input which end in \\ are joined into single entries (and a
1046 Lines of input which end in \\ are joined into single entries (and a
1023 secondary continuation prompt is issued as long as the user terminates
1047 secondary continuation prompt is issued as long as the user terminates
1024 lines with \\). This allows entering very long strings which are still
1048 lines with \\). This allows entering very long strings which are still
1025 meant to be treated as single entities.
1049 meant to be treated as single entities.
1026 """
1050 """
1027
1051
1028 try:
1052 try:
1029 if header:
1053 if header:
1030 header += '\n'
1054 header += '\n'
1031 lines = [raw_input(header + ps1)]
1055 lines = [raw_input(header + ps1)]
1032 except EOFError:
1056 except EOFError:
1033 return []
1057 return []
1034 terminate = [terminate_str]
1058 terminate = [terminate_str]
1035 try:
1059 try:
1036 while lines[-1:] != terminate:
1060 while lines[-1:] != terminate:
1037 new_line = raw_input(ps1)
1061 new_line = raw_input(ps1)
1038 while new_line.endswith('\\'):
1062 while new_line.endswith('\\'):
1039 new_line = new_line[:-1] + raw_input(ps2)
1063 new_line = new_line[:-1] + raw_input(ps2)
1040 lines.append(new_line)
1064 lines.append(new_line)
1041
1065
1042 return lines[:-1] # don't return the termination command
1066 return lines[:-1] # don't return the termination command
1043 except EOFError:
1067 except EOFError:
1044 print
1068 print
1045 return lines
1069 return lines
1046
1070
1047 #----------------------------------------------------------------------------
1071 #----------------------------------------------------------------------------
1048 def raw_input_ext(prompt='', ps2='... '):
1072 def raw_input_ext(prompt='', ps2='... '):
1049 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
1073 """Similar to raw_input(), but accepts extended lines if input ends with \\."""
1050
1074
1051 line = raw_input(prompt)
1075 line = raw_input(prompt)
1052 while line.endswith('\\'):
1076 while line.endswith('\\'):
1053 line = line[:-1] + raw_input(ps2)
1077 line = line[:-1] + raw_input(ps2)
1054 return line
1078 return line
1055
1079
1056 #----------------------------------------------------------------------------
1080 #----------------------------------------------------------------------------
1057 def ask_yes_no(prompt,default=None):
1081 def ask_yes_no(prompt,default=None):
1058 """Asks a question and returns a boolean (y/n) answer.
1082 """Asks a question and returns a boolean (y/n) answer.
1059
1083
1060 If default is given (one of 'y','n'), it is used if the user input is
1084 If default is given (one of 'y','n'), it is used if the user input is
1061 empty. Otherwise the question is repeated until an answer is given.
1085 empty. Otherwise the question is repeated until an answer is given.
1062
1086
1063 An EOF is treated as the default answer. If there is no default, an
1087 An EOF is treated as the default answer. If there is no default, an
1064 exception is raised to prevent infinite loops.
1088 exception is raised to prevent infinite loops.
1065
1089
1066 Valid answers are: y/yes/n/no (match is not case sensitive)."""
1090 Valid answers are: y/yes/n/no (match is not case sensitive)."""
1067
1091
1068 answers = {'y':True,'n':False,'yes':True,'no':False}
1092 answers = {'y':True,'n':False,'yes':True,'no':False}
1069 ans = None
1093 ans = None
1070 while ans not in answers.keys():
1094 while ans not in answers.keys():
1071 try:
1095 try:
1072 ans = raw_input(prompt+' ').lower()
1096 ans = raw_input(prompt+' ').lower()
1073 if not ans: # response was an empty string
1097 if not ans: # response was an empty string
1074 ans = default
1098 ans = default
1075 except KeyboardInterrupt:
1099 except KeyboardInterrupt:
1076 pass
1100 pass
1077 except EOFError:
1101 except EOFError:
1078 if default in answers.keys():
1102 if default in answers.keys():
1079 ans = default
1103 ans = default
1080 print
1104 print
1081 else:
1105 else:
1082 raise
1106 raise
1083
1107
1084 return answers[ans]
1108 return answers[ans]
1085
1109
1086 #----------------------------------------------------------------------------
1110 #----------------------------------------------------------------------------
1087 def marquee(txt='',width=78,mark='*'):
1111 def marquee(txt='',width=78,mark='*'):
1088 """Return the input string centered in a 'marquee'."""
1112 """Return the input string centered in a 'marquee'."""
1089 if not txt:
1113 if not txt:
1090 return (mark*width)[:width]
1114 return (mark*width)[:width]
1091 nmark = (width-len(txt)-2)/len(mark)/2
1115 nmark = (width-len(txt)-2)/len(mark)/2
1092 if nmark < 0: nmark =0
1116 if nmark < 0: nmark =0
1093 marks = mark*nmark
1117 marks = mark*nmark
1094 return '%s %s %s' % (marks,txt,marks)
1118 return '%s %s %s' % (marks,txt,marks)
1095
1119
1096 #----------------------------------------------------------------------------
1120 #----------------------------------------------------------------------------
1097 class EvalDict:
1121 class EvalDict:
1098 """
1122 """
1099 Emulate a dict which evaluates its contents in the caller's frame.
1123 Emulate a dict which evaluates its contents in the caller's frame.
1100
1124
1101 Usage:
1125 Usage:
1102 >>>number = 19
1126 >>>number = 19
1103 >>>text = "python"
1127 >>>text = "python"
1104 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1128 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1105 """
1129 """
1106
1130
1107 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
1131 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
1108 # modified (shorter) version of:
1132 # modified (shorter) version of:
1109 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
1133 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018 by
1110 # Skip Montanaro (skip@pobox.com).
1134 # Skip Montanaro (skip@pobox.com).
1111
1135
1112 def __getitem__(self, name):
1136 def __getitem__(self, name):
1113 frame = sys._getframe(1)
1137 frame = sys._getframe(1)
1114 return eval(name, frame.f_globals, frame.f_locals)
1138 return eval(name, frame.f_globals, frame.f_locals)
1115
1139
1116 EvalString = EvalDict # for backwards compatibility
1140 EvalString = EvalDict # for backwards compatibility
1117 #----------------------------------------------------------------------------
1141 #----------------------------------------------------------------------------
1118 def qw(words,flat=0,sep=None,maxsplit=-1):
1142 def qw(words,flat=0,sep=None,maxsplit=-1):
1119 """Similar to Perl's qw() operator, but with some more options.
1143 """Similar to Perl's qw() operator, but with some more options.
1120
1144
1121 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1145 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1122
1146
1123 words can also be a list itself, and with flat=1, the output will be
1147 words can also be a list itself, and with flat=1, the output will be
1124 recursively flattened. Examples:
1148 recursively flattened. Examples:
1125
1149
1126 >>> qw('1 2')
1150 >>> qw('1 2')
1127 ['1', '2']
1151 ['1', '2']
1128 >>> qw(['a b','1 2',['m n','p q']])
1152 >>> qw(['a b','1 2',['m n','p q']])
1129 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1153 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1130 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1154 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1131 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
1155 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
1132
1156
1133 if type(words) in StringTypes:
1157 if type(words) in StringTypes:
1134 return [word.strip() for word in words.split(sep,maxsplit)
1158 return [word.strip() for word in words.split(sep,maxsplit)
1135 if word and not word.isspace() ]
1159 if word and not word.isspace() ]
1136 if flat:
1160 if flat:
1137 return flatten(map(qw,words,[1]*len(words)))
1161 return flatten(map(qw,words,[1]*len(words)))
1138 return map(qw,words)
1162 return map(qw,words)
1139
1163
1140 #----------------------------------------------------------------------------
1164 #----------------------------------------------------------------------------
1141 def qwflat(words,sep=None,maxsplit=-1):
1165 def qwflat(words,sep=None,maxsplit=-1):
1142 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
1166 """Calls qw(words) in flat mode. It's just a convenient shorthand."""
1143 return qw(words,1,sep,maxsplit)
1167 return qw(words,1,sep,maxsplit)
1144
1168
1145 #----------------------------------------------------------------------------
1169 #----------------------------------------------------------------------------
1146 def qw_lol(indata):
1170 def qw_lol(indata):
1147 """qw_lol('a b') -> [['a','b']],
1171 """qw_lol('a b') -> [['a','b']],
1148 otherwise it's just a call to qw().
1172 otherwise it's just a call to qw().
1149
1173
1150 We need this to make sure the modules_some keys *always* end up as a
1174 We need this to make sure the modules_some keys *always* end up as a
1151 list of lists."""
1175 list of lists."""
1152
1176
1153 if type(indata) in StringTypes:
1177 if type(indata) in StringTypes:
1154 return [qw(indata)]
1178 return [qw(indata)]
1155 else:
1179 else:
1156 return qw(indata)
1180 return qw(indata)
1157
1181
1158 #-----------------------------------------------------------------------------
1182 #-----------------------------------------------------------------------------
1159 def list_strings(arg):
1183 def list_strings(arg):
1160 """Always return a list of strings, given a string or list of strings
1184 """Always return a list of strings, given a string or list of strings
1161 as input."""
1185 as input."""
1162
1186
1163 if type(arg) in StringTypes: return [arg]
1187 if type(arg) in StringTypes: return [arg]
1164 else: return arg
1188 else: return arg
1165
1189
1166 #----------------------------------------------------------------------------
1190 #----------------------------------------------------------------------------
1167 def grep(pat,list,case=1):
1191 def grep(pat,list,case=1):
1168 """Simple minded grep-like function.
1192 """Simple minded grep-like function.
1169 grep(pat,list) returns occurrences of pat in list, None on failure.
1193 grep(pat,list) returns occurrences of pat in list, None on failure.
1170
1194
1171 It only does simple string matching, with no support for regexps. Use the
1195 It only does simple string matching, with no support for regexps. Use the
1172 option case=0 for case-insensitive matching."""
1196 option case=0 for case-insensitive matching."""
1173
1197
1174 # This is pretty crude. At least it should implement copying only references
1198 # This is pretty crude. At least it should implement copying only references
1175 # to the original data in case it's big. Now it copies the data for output.
1199 # to the original data in case it's big. Now it copies the data for output.
1176 out=[]
1200 out=[]
1177 if case:
1201 if case:
1178 for term in list:
1202 for term in list:
1179 if term.find(pat)>-1: out.append(term)
1203 if term.find(pat)>-1: out.append(term)
1180 else:
1204 else:
1181 lpat=pat.lower()
1205 lpat=pat.lower()
1182 for term in list:
1206 for term in list:
1183 if term.lower().find(lpat)>-1: out.append(term)
1207 if term.lower().find(lpat)>-1: out.append(term)
1184
1208
1185 if len(out): return out
1209 if len(out): return out
1186 else: return None
1210 else: return None
1187
1211
1188 #----------------------------------------------------------------------------
1212 #----------------------------------------------------------------------------
1189 def dgrep(pat,*opts):
1213 def dgrep(pat,*opts):
1190 """Return grep() on dir()+dir(__builtins__).
1214 """Return grep() on dir()+dir(__builtins__).
1191
1215
1192 A very common use of grep() when working interactively."""
1216 A very common use of grep() when working interactively."""
1193
1217
1194 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
1218 return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts)
1195
1219
1196 #----------------------------------------------------------------------------
1220 #----------------------------------------------------------------------------
1197 def idgrep(pat):
1221 def idgrep(pat):
1198 """Case-insensitive dgrep()"""
1222 """Case-insensitive dgrep()"""
1199
1223
1200 return dgrep(pat,0)
1224 return dgrep(pat,0)
1201
1225
1202 #----------------------------------------------------------------------------
1226 #----------------------------------------------------------------------------
1203 def igrep(pat,list):
1227 def igrep(pat,list):
1204 """Synonym for case-insensitive grep."""
1228 """Synonym for case-insensitive grep."""
1205
1229
1206 return grep(pat,list,case=0)
1230 return grep(pat,list,case=0)
1207
1231
1208 #----------------------------------------------------------------------------
1232 #----------------------------------------------------------------------------
1209 def indent(str,nspaces=4,ntabs=0):
1233 def indent(str,nspaces=4,ntabs=0):
1210 """Indent a string a given number of spaces or tabstops.
1234 """Indent a string a given number of spaces or tabstops.
1211
1235
1212 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
1236 indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.
1213 """
1237 """
1214 if str is None:
1238 if str is None:
1215 return
1239 return
1216 ind = '\t'*ntabs+' '*nspaces
1240 ind = '\t'*ntabs+' '*nspaces
1217 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
1241 outstr = '%s%s' % (ind,str.replace(os.linesep,os.linesep+ind))
1218 if outstr.endswith(os.linesep+ind):
1242 if outstr.endswith(os.linesep+ind):
1219 return outstr[:-len(ind)]
1243 return outstr[:-len(ind)]
1220 else:
1244 else:
1221 return outstr
1245 return outstr
1222
1246
1223 #-----------------------------------------------------------------------------
1247 #-----------------------------------------------------------------------------
1224 def native_line_ends(filename,backup=1):
1248 def native_line_ends(filename,backup=1):
1225 """Convert (in-place) a file to line-ends native to the current OS.
1249 """Convert (in-place) a file to line-ends native to the current OS.
1226
1250
1227 If the optional backup argument is given as false, no backup of the
1251 If the optional backup argument is given as false, no backup of the
1228 original file is left. """
1252 original file is left. """
1229
1253
1230 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1254 backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'}
1231
1255
1232 bak_filename = filename + backup_suffixes[os.name]
1256 bak_filename = filename + backup_suffixes[os.name]
1233
1257
1234 original = open(filename).read()
1258 original = open(filename).read()
1235 shutil.copy2(filename,bak_filename)
1259 shutil.copy2(filename,bak_filename)
1236 try:
1260 try:
1237 new = open(filename,'wb')
1261 new = open(filename,'wb')
1238 new.write(os.linesep.join(original.splitlines()))
1262 new.write(os.linesep.join(original.splitlines()))
1239 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1263 new.write(os.linesep) # ALWAYS put an eol at the end of the file
1240 new.close()
1264 new.close()
1241 except:
1265 except:
1242 os.rename(bak_filename,filename)
1266 os.rename(bak_filename,filename)
1243 if not backup:
1267 if not backup:
1244 try:
1268 try:
1245 os.remove(bak_filename)
1269 os.remove(bak_filename)
1246 except:
1270 except:
1247 pass
1271 pass
1248
1272
1249 #----------------------------------------------------------------------------
1273 #----------------------------------------------------------------------------
1250 def get_pager_cmd(pager_cmd = None):
1274 def get_pager_cmd(pager_cmd = None):
1251 """Return a pager command.
1275 """Return a pager command.
1252
1276
1253 Makes some attempts at finding an OS-correct one."""
1277 Makes some attempts at finding an OS-correct one."""
1254
1278
1255 if os.name == 'posix':
1279 if os.name == 'posix':
1256 default_pager_cmd = 'less -r' # -r for color control sequences
1280 default_pager_cmd = 'less -r' # -r for color control sequences
1257 elif os.name in ['nt','dos']:
1281 elif os.name in ['nt','dos']:
1258 default_pager_cmd = 'type'
1282 default_pager_cmd = 'type'
1259
1283
1260 if pager_cmd is None:
1284 if pager_cmd is None:
1261 try:
1285 try:
1262 pager_cmd = os.environ['PAGER']
1286 pager_cmd = os.environ['PAGER']
1263 except:
1287 except:
1264 pager_cmd = default_pager_cmd
1288 pager_cmd = default_pager_cmd
1265 return pager_cmd
1289 return pager_cmd
1266
1290
1267 #-----------------------------------------------------------------------------
1291 #-----------------------------------------------------------------------------
1268 def get_pager_start(pager,start):
1292 def get_pager_start(pager,start):
1269 """Return the string for paging files with an offset.
1293 """Return the string for paging files with an offset.
1270
1294
1271 This is the '+N' argument which less and more (under Unix) accept.
1295 This is the '+N' argument which less and more (under Unix) accept.
1272 """
1296 """
1273
1297
1274 if pager in ['less','more']:
1298 if pager in ['less','more']:
1275 if start:
1299 if start:
1276 start_string = '+' + str(start)
1300 start_string = '+' + str(start)
1277 else:
1301 else:
1278 start_string = ''
1302 start_string = ''
1279 else:
1303 else:
1280 start_string = ''
1304 start_string = ''
1281 return start_string
1305 return start_string
1282
1306
1283 #----------------------------------------------------------------------------
1307 #----------------------------------------------------------------------------
1284 # (X)emacs on W32 doesn't like to be bypassed with msvcrt.getch()
1308 # (X)emacs on W32 doesn't like to be bypassed with msvcrt.getch()
1285 if os.name == 'nt' and os.environ.get('TERM','dumb') != 'emacs':
1309 if os.name == 'nt' and os.environ.get('TERM','dumb') != 'emacs':
1286 import msvcrt
1310 import msvcrt
1287 def page_more():
1311 def page_more():
1288 """ Smart pausing between pages
1312 """ Smart pausing between pages
1289
1313
1290 @return: True if need print more lines, False if quit
1314 @return: True if need print more lines, False if quit
1291 """
1315 """
1292 Term.cout.write('---Return to continue, q to quit--- ')
1316 Term.cout.write('---Return to continue, q to quit--- ')
1293 ans = msvcrt.getch()
1317 ans = msvcrt.getch()
1294 if ans in ("q", "Q"):
1318 if ans in ("q", "Q"):
1295 result = False
1319 result = False
1296 else:
1320 else:
1297 result = True
1321 result = True
1298 Term.cout.write("\b"*37 + " "*37 + "\b"*37)
1322 Term.cout.write("\b"*37 + " "*37 + "\b"*37)
1299 return result
1323 return result
1300 else:
1324 else:
1301 def page_more():
1325 def page_more():
1302 ans = raw_input('---Return to continue, q to quit--- ')
1326 ans = raw_input('---Return to continue, q to quit--- ')
1303 if ans.lower().startswith('q'):
1327 if ans.lower().startswith('q'):
1304 return False
1328 return False
1305 else:
1329 else:
1306 return True
1330 return True
1307
1331
1308 esc_re = re.compile(r"(\x1b[^m]+m)")
1332 esc_re = re.compile(r"(\x1b[^m]+m)")
1309
1333
1310 def page_dumb(strng,start=0,screen_lines=25):
1334 def page_dumb(strng,start=0,screen_lines=25):
1311 """Very dumb 'pager' in Python, for when nothing else works.
1335 """Very dumb 'pager' in Python, for when nothing else works.
1312
1336
1313 Only moves forward, same interface as page(), except for pager_cmd and
1337 Only moves forward, same interface as page(), except for pager_cmd and
1314 mode."""
1338 mode."""
1315
1339
1316 out_ln = strng.splitlines()[start:]
1340 out_ln = strng.splitlines()[start:]
1317 screens = chop(out_ln,screen_lines-1)
1341 screens = chop(out_ln,screen_lines-1)
1318 if len(screens) == 1:
1342 if len(screens) == 1:
1319 print >>Term.cout, os.linesep.join(screens[0])
1343 print >>Term.cout, os.linesep.join(screens[0])
1320 else:
1344 else:
1321 last_escape = ""
1345 last_escape = ""
1322 for scr in screens[0:-1]:
1346 for scr in screens[0:-1]:
1323 hunk = os.linesep.join(scr)
1347 hunk = os.linesep.join(scr)
1324 print >>Term.cout, last_escape + hunk
1348 print >>Term.cout, last_escape + hunk
1325 if not page_more():
1349 if not page_more():
1326 return
1350 return
1327 esc_list = esc_re.findall(hunk)
1351 esc_list = esc_re.findall(hunk)
1328 if len(esc_list) > 0:
1352 if len(esc_list) > 0:
1329 last_escape = esc_list[-1]
1353 last_escape = esc_list[-1]
1330 print >>Term.cout, last_escape + os.linesep.join(screens[-1])
1354 print >>Term.cout, last_escape + os.linesep.join(screens[-1])
1331
1355
1332 #----------------------------------------------------------------------------
1356 #----------------------------------------------------------------------------
1333 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1357 def page(strng,start=0,screen_lines=0,pager_cmd = None):
1334 """Print a string, piping through a pager after a certain length.
1358 """Print a string, piping through a pager after a certain length.
1335
1359
1336 The screen_lines parameter specifies the number of *usable* lines of your
1360 The screen_lines parameter specifies the number of *usable* lines of your
1337 terminal screen (total lines minus lines you need to reserve to show other
1361 terminal screen (total lines minus lines you need to reserve to show other
1338 information).
1362 information).
1339
1363
1340 If you set screen_lines to a number <=0, page() will try to auto-determine
1364 If you set screen_lines to a number <=0, page() will try to auto-determine
1341 your screen size and will only use up to (screen_size+screen_lines) for
1365 your screen size and will only use up to (screen_size+screen_lines) for
1342 printing, paging after that. That is, if you want auto-detection but need
1366 printing, paging after that. That is, if you want auto-detection but need
1343 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1367 to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
1344 auto-detection without any lines reserved simply use screen_lines = 0.
1368 auto-detection without any lines reserved simply use screen_lines = 0.
1345
1369
1346 If a string won't fit in the allowed lines, it is sent through the
1370 If a string won't fit in the allowed lines, it is sent through the
1347 specified pager command. If none given, look for PAGER in the environment,
1371 specified pager command. If none given, look for PAGER in the environment,
1348 and ultimately default to less.
1372 and ultimately default to less.
1349
1373
1350 If no system pager works, the string is sent through a 'dumb pager'
1374 If no system pager works, the string is sent through a 'dumb pager'
1351 written in python, very simplistic.
1375 written in python, very simplistic.
1352 """
1376 """
1353
1377
1354 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1378 # Ugly kludge, but calling curses.initscr() flat out crashes in emacs
1355 TERM = os.environ.get('TERM','dumb')
1379 TERM = os.environ.get('TERM','dumb')
1356 if TERM in ['dumb','emacs'] and os.name != 'nt':
1380 if TERM in ['dumb','emacs'] and os.name != 'nt':
1357 print strng
1381 print strng
1358 return
1382 return
1359 # chop off the topmost part of the string we don't want to see
1383 # chop off the topmost part of the string we don't want to see
1360 str_lines = strng.split(os.linesep)[start:]
1384 str_lines = strng.split(os.linesep)[start:]
1361 str_toprint = os.linesep.join(str_lines)
1385 str_toprint = os.linesep.join(str_lines)
1362 num_newlines = len(str_lines)
1386 num_newlines = len(str_lines)
1363 len_str = len(str_toprint)
1387 len_str = len(str_toprint)
1364
1388
1365 # Dumb heuristics to guesstimate number of on-screen lines the string
1389 # Dumb heuristics to guesstimate number of on-screen lines the string
1366 # takes. Very basic, but good enough for docstrings in reasonable
1390 # takes. Very basic, but good enough for docstrings in reasonable
1367 # terminals. If someone later feels like refining it, it's not hard.
1391 # terminals. If someone later feels like refining it, it's not hard.
1368 numlines = max(num_newlines,int(len_str/80)+1)
1392 numlines = max(num_newlines,int(len_str/80)+1)
1369
1393
1370 if os.name == "nt":
1394 if os.name == "nt":
1371 screen_lines_def = get_console_size(defaulty=25)[1]
1395 screen_lines_def = get_console_size(defaulty=25)[1]
1372 else:
1396 else:
1373 screen_lines_def = 25 # default value if we can't auto-determine
1397 screen_lines_def = 25 # default value if we can't auto-determine
1374
1398
1375 # auto-determine screen size
1399 # auto-determine screen size
1376 if screen_lines <= 0:
1400 if screen_lines <= 0:
1377 if TERM=='xterm':
1401 if TERM=='xterm':
1378 try:
1402 try:
1379 import curses
1403 import curses
1380 if hasattr(curses,'initscr'):
1404 if hasattr(curses,'initscr'):
1381 use_curses = 1
1405 use_curses = 1
1382 else:
1406 else:
1383 use_curses = 0
1407 use_curses = 0
1384 except ImportError:
1408 except ImportError:
1385 use_curses = 0
1409 use_curses = 0
1386 else:
1410 else:
1387 # curses causes problems on many terminals other than xterm.
1411 # curses causes problems on many terminals other than xterm.
1388 use_curses = 0
1412 use_curses = 0
1389 if use_curses:
1413 if use_curses:
1390 scr = curses.initscr()
1414 scr = curses.initscr()
1391 screen_lines_real,screen_cols = scr.getmaxyx()
1415 screen_lines_real,screen_cols = scr.getmaxyx()
1392 curses.endwin()
1416 curses.endwin()
1393 screen_lines += screen_lines_real
1417 screen_lines += screen_lines_real
1394 #print '***Screen size:',screen_lines_real,'lines x',\
1418 #print '***Screen size:',screen_lines_real,'lines x',\
1395 #screen_cols,'columns.' # dbg
1419 #screen_cols,'columns.' # dbg
1396 else:
1420 else:
1397 screen_lines += screen_lines_def
1421 screen_lines += screen_lines_def
1398
1422
1399 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1423 #print 'numlines',numlines,'screenlines',screen_lines # dbg
1400 if numlines <= screen_lines :
1424 if numlines <= screen_lines :
1401 #print '*** normal print' # dbg
1425 #print '*** normal print' # dbg
1402 print >>Term.cout, str_toprint
1426 print >>Term.cout, str_toprint
1403 else:
1427 else:
1404 # Try to open pager and default to internal one if that fails.
1428 # Try to open pager and default to internal one if that fails.
1405 # All failure modes are tagged as 'retval=1', to match the return
1429 # All failure modes are tagged as 'retval=1', to match the return
1406 # value of a failed system command. If any intermediate attempt
1430 # value of a failed system command. If any intermediate attempt
1407 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1431 # sets retval to 1, at the end we resort to our own page_dumb() pager.
1408 pager_cmd = get_pager_cmd(pager_cmd)
1432 pager_cmd = get_pager_cmd(pager_cmd)
1409 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1433 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1410 if os.name == 'nt':
1434 if os.name == 'nt':
1411 if pager_cmd.startswith('type'):
1435 if pager_cmd.startswith('type'):
1412 # The default WinXP 'type' command is failing on complex strings.
1436 # The default WinXP 'type' command is failing on complex strings.
1413 retval = 1
1437 retval = 1
1414 else:
1438 else:
1415 tmpname = tempfile.mktemp('.txt')
1439 tmpname = tempfile.mktemp('.txt')
1416 tmpfile = file(tmpname,'wt')
1440 tmpfile = file(tmpname,'wt')
1417 tmpfile.write(strng)
1441 tmpfile.write(strng)
1418 tmpfile.close()
1442 tmpfile.close()
1419 cmd = "%s < %s" % (pager_cmd,tmpname)
1443 cmd = "%s < %s" % (pager_cmd,tmpname)
1420 if os.system(cmd):
1444 if os.system(cmd):
1421 retval = 1
1445 retval = 1
1422 else:
1446 else:
1423 retval = None
1447 retval = None
1424 os.remove(tmpname)
1448 os.remove(tmpname)
1425 else:
1449 else:
1426 try:
1450 try:
1427 retval = None
1451 retval = None
1428 # if I use popen4, things hang. No idea why.
1452 # if I use popen4, things hang. No idea why.
1429 #pager,shell_out = os.popen4(pager_cmd)
1453 #pager,shell_out = os.popen4(pager_cmd)
1430 pager = os.popen(pager_cmd,'w')
1454 pager = os.popen(pager_cmd,'w')
1431 pager.write(strng)
1455 pager.write(strng)
1432 pager.close()
1456 pager.close()
1433 retval = pager.close() # success returns None
1457 retval = pager.close() # success returns None
1434 except IOError,msg: # broken pipe when user quits
1458 except IOError,msg: # broken pipe when user quits
1435 if msg.args == (32,'Broken pipe'):
1459 if msg.args == (32,'Broken pipe'):
1436 retval = None
1460 retval = None
1437 else:
1461 else:
1438 retval = 1
1462 retval = 1
1439 except OSError:
1463 except OSError:
1440 # Other strange problems, sometimes seen in Win2k/cygwin
1464 # Other strange problems, sometimes seen in Win2k/cygwin
1441 retval = 1
1465 retval = 1
1442 if retval is not None:
1466 if retval is not None:
1443 page_dumb(strng,screen_lines=screen_lines)
1467 page_dumb(strng,screen_lines=screen_lines)
1444
1468
1445 #----------------------------------------------------------------------------
1469 #----------------------------------------------------------------------------
1446 def page_file(fname,start = 0, pager_cmd = None):
1470 def page_file(fname,start = 0, pager_cmd = None):
1447 """Page a file, using an optional pager command and starting line.
1471 """Page a file, using an optional pager command and starting line.
1448 """
1472 """
1449
1473
1450 pager_cmd = get_pager_cmd(pager_cmd)
1474 pager_cmd = get_pager_cmd(pager_cmd)
1451 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1475 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
1452
1476
1453 try:
1477 try:
1454 if os.environ['TERM'] in ['emacs','dumb']:
1478 if os.environ['TERM'] in ['emacs','dumb']:
1455 raise EnvironmentError
1479 raise EnvironmentError
1456 xsys(pager_cmd + ' ' + fname)
1480 xsys(pager_cmd + ' ' + fname)
1457 except:
1481 except:
1458 try:
1482 try:
1459 if start > 0:
1483 if start > 0:
1460 start -= 1
1484 start -= 1
1461 page(open(fname).read(),start)
1485 page(open(fname).read(),start)
1462 except:
1486 except:
1463 print 'Unable to show file',`fname`
1487 print 'Unable to show file',`fname`
1464
1488
1465 #----------------------------------------------------------------------------
1489 #----------------------------------------------------------------------------
1466 def snip_print(str,width = 75,print_full = 0,header = ''):
1490 def snip_print(str,width = 75,print_full = 0,header = ''):
1467 """Print a string snipping the midsection to fit in width.
1491 """Print a string snipping the midsection to fit in width.
1468
1492
1469 print_full: mode control:
1493 print_full: mode control:
1470 - 0: only snip long strings
1494 - 0: only snip long strings
1471 - 1: send to page() directly.
1495 - 1: send to page() directly.
1472 - 2: snip long strings and ask for full length viewing with page()
1496 - 2: snip long strings and ask for full length viewing with page()
1473 Return 1 if snipping was necessary, 0 otherwise."""
1497 Return 1 if snipping was necessary, 0 otherwise."""
1474
1498
1475 if print_full == 1:
1499 if print_full == 1:
1476 page(header+str)
1500 page(header+str)
1477 return 0
1501 return 0
1478
1502
1479 print header,
1503 print header,
1480 if len(str) < width:
1504 if len(str) < width:
1481 print str
1505 print str
1482 snip = 0
1506 snip = 0
1483 else:
1507 else:
1484 whalf = int((width -5)/2)
1508 whalf = int((width -5)/2)
1485 print str[:whalf] + ' <...> ' + str[-whalf:]
1509 print str[:whalf] + ' <...> ' + str[-whalf:]
1486 snip = 1
1510 snip = 1
1487 if snip and print_full == 2:
1511 if snip and print_full == 2:
1488 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1512 if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y':
1489 page(str)
1513 page(str)
1490 return snip
1514 return snip
1491
1515
1492 #****************************************************************************
1516 #****************************************************************************
1493 # lists, dicts and structures
1517 # lists, dicts and structures
1494
1518
1495 def belong(candidates,checklist):
1519 def belong(candidates,checklist):
1496 """Check whether a list of items appear in a given list of options.
1520 """Check whether a list of items appear in a given list of options.
1497
1521
1498 Returns a list of 1 and 0, one for each candidate given."""
1522 Returns a list of 1 and 0, one for each candidate given."""
1499
1523
1500 return [x in checklist for x in candidates]
1524 return [x in checklist for x in candidates]
1501
1525
1502 #----------------------------------------------------------------------------
1526 #----------------------------------------------------------------------------
1503 def uniq_stable(elems):
1527 def uniq_stable(elems):
1504 """uniq_stable(elems) -> list
1528 """uniq_stable(elems) -> list
1505
1529
1506 Return from an iterable, a list of all the unique elements in the input,
1530 Return from an iterable, a list of all the unique elements in the input,
1507 but maintaining the order in which they first appear.
1531 but maintaining the order in which they first appear.
1508
1532
1509 A naive solution to this problem which just makes a dictionary with the
1533 A naive solution to this problem which just makes a dictionary with the
1510 elements as keys fails to respect the stability condition, since
1534 elements as keys fails to respect the stability condition, since
1511 dictionaries are unsorted by nature.
1535 dictionaries are unsorted by nature.
1512
1536
1513 Note: All elements in the input must be valid dictionary keys for this
1537 Note: All elements in the input must be valid dictionary keys for this
1514 routine to work, as it internally uses a dictionary for efficiency
1538 routine to work, as it internally uses a dictionary for efficiency
1515 reasons."""
1539 reasons."""
1516
1540
1517 unique = []
1541 unique = []
1518 unique_dict = {}
1542 unique_dict = {}
1519 for nn in elems:
1543 for nn in elems:
1520 if nn not in unique_dict:
1544 if nn not in unique_dict:
1521 unique.append(nn)
1545 unique.append(nn)
1522 unique_dict[nn] = None
1546 unique_dict[nn] = None
1523 return unique
1547 return unique
1524
1548
1525 #----------------------------------------------------------------------------
1549 #----------------------------------------------------------------------------
1526 class NLprinter:
1550 class NLprinter:
1527 """Print an arbitrarily nested list, indicating index numbers.
1551 """Print an arbitrarily nested list, indicating index numbers.
1528
1552
1529 An instance of this class called nlprint is available and callable as a
1553 An instance of this class called nlprint is available and callable as a
1530 function.
1554 function.
1531
1555
1532 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1556 nlprint(list,indent=' ',sep=': ') -> prints indenting each level by 'indent'
1533 and using 'sep' to separate the index from the value. """
1557 and using 'sep' to separate the index from the value. """
1534
1558
1535 def __init__(self):
1559 def __init__(self):
1536 self.depth = 0
1560 self.depth = 0
1537
1561
1538 def __call__(self,lst,pos='',**kw):
1562 def __call__(self,lst,pos='',**kw):
1539 """Prints the nested list numbering levels."""
1563 """Prints the nested list numbering levels."""
1540 kw.setdefault('indent',' ')
1564 kw.setdefault('indent',' ')
1541 kw.setdefault('sep',': ')
1565 kw.setdefault('sep',': ')
1542 kw.setdefault('start',0)
1566 kw.setdefault('start',0)
1543 kw.setdefault('stop',len(lst))
1567 kw.setdefault('stop',len(lst))
1544 # we need to remove start and stop from kw so they don't propagate
1568 # we need to remove start and stop from kw so they don't propagate
1545 # into a recursive call for a nested list.
1569 # into a recursive call for a nested list.
1546 start = kw['start']; del kw['start']
1570 start = kw['start']; del kw['start']
1547 stop = kw['stop']; del kw['stop']
1571 stop = kw['stop']; del kw['stop']
1548 if self.depth == 0 and 'header' in kw.keys():
1572 if self.depth == 0 and 'header' in kw.keys():
1549 print kw['header']
1573 print kw['header']
1550
1574
1551 for idx in range(start,stop):
1575 for idx in range(start,stop):
1552 elem = lst[idx]
1576 elem = lst[idx]
1553 if type(elem)==type([]):
1577 if type(elem)==type([]):
1554 self.depth += 1
1578 self.depth += 1
1555 self.__call__(elem,itpl('$pos$idx,'),**kw)
1579 self.__call__(elem,itpl('$pos$idx,'),**kw)
1556 self.depth -= 1
1580 self.depth -= 1
1557 else:
1581 else:
1558 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1582 printpl(kw['indent']*self.depth+'$pos$idx$kw["sep"]$elem')
1559
1583
1560 nlprint = NLprinter()
1584 nlprint = NLprinter()
1561 #----------------------------------------------------------------------------
1585 #----------------------------------------------------------------------------
1562 def all_belong(candidates,checklist):
1586 def all_belong(candidates,checklist):
1563 """Check whether a list of items ALL appear in a given list of options.
1587 """Check whether a list of items ALL appear in a given list of options.
1564
1588
1565 Returns a single 1 or 0 value."""
1589 Returns a single 1 or 0 value."""
1566
1590
1567 return 1-(0 in [x in checklist for x in candidates])
1591 return 1-(0 in [x in checklist for x in candidates])
1568
1592
1569 #----------------------------------------------------------------------------
1593 #----------------------------------------------------------------------------
1570 def sort_compare(lst1,lst2,inplace = 1):
1594 def sort_compare(lst1,lst2,inplace = 1):
1571 """Sort and compare two lists.
1595 """Sort and compare two lists.
1572
1596
1573 By default it does it in place, thus modifying the lists. Use inplace = 0
1597 By default it does it in place, thus modifying the lists. Use inplace = 0
1574 to avoid that (at the cost of temporary copy creation)."""
1598 to avoid that (at the cost of temporary copy creation)."""
1575 if not inplace:
1599 if not inplace:
1576 lst1 = lst1[:]
1600 lst1 = lst1[:]
1577 lst2 = lst2[:]
1601 lst2 = lst2[:]
1578 lst1.sort(); lst2.sort()
1602 lst1.sort(); lst2.sort()
1579 return lst1 == lst2
1603 return lst1 == lst2
1580
1604
1581 #----------------------------------------------------------------------------
1605 #----------------------------------------------------------------------------
1582 def mkdict(**kwargs):
1606 def mkdict(**kwargs):
1583 """Return a dict from a keyword list.
1607 """Return a dict from a keyword list.
1584
1608
1585 It's just syntactic sugar for making ditcionary creation more convenient:
1609 It's just syntactic sugar for making ditcionary creation more convenient:
1586 # the standard way
1610 # the standard way
1587 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1611 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1588 # a cleaner way
1612 # a cleaner way
1589 >>>data = dict(red=1, green=2, blue=3)
1613 >>>data = dict(red=1, green=2, blue=3)
1590
1614
1591 If you need more than this, look at the Struct() class."""
1615 If you need more than this, look at the Struct() class."""
1592
1616
1593 return kwargs
1617 return kwargs
1594
1618
1595 #----------------------------------------------------------------------------
1619 #----------------------------------------------------------------------------
1596 def list2dict(lst):
1620 def list2dict(lst):
1597 """Takes a list of (key,value) pairs and turns it into a dict."""
1621 """Takes a list of (key,value) pairs and turns it into a dict."""
1598
1622
1599 dic = {}
1623 dic = {}
1600 for k,v in lst: dic[k] = v
1624 for k,v in lst: dic[k] = v
1601 return dic
1625 return dic
1602
1626
1603 #----------------------------------------------------------------------------
1627 #----------------------------------------------------------------------------
1604 def list2dict2(lst,default=''):
1628 def list2dict2(lst,default=''):
1605 """Takes a list and turns it into a dict.
1629 """Takes a list and turns it into a dict.
1606 Much slower than list2dict, but more versatile. This version can take
1630 Much slower than list2dict, but more versatile. This version can take
1607 lists with sublists of arbitrary length (including sclars)."""
1631 lists with sublists of arbitrary length (including sclars)."""
1608
1632
1609 dic = {}
1633 dic = {}
1610 for elem in lst:
1634 for elem in lst:
1611 if type(elem) in (types.ListType,types.TupleType):
1635 if type(elem) in (types.ListType,types.TupleType):
1612 size = len(elem)
1636 size = len(elem)
1613 if size == 0:
1637 if size == 0:
1614 pass
1638 pass
1615 elif size == 1:
1639 elif size == 1:
1616 dic[elem] = default
1640 dic[elem] = default
1617 else:
1641 else:
1618 k,v = elem[0], elem[1:]
1642 k,v = elem[0], elem[1:]
1619 if len(v) == 1: v = v[0]
1643 if len(v) == 1: v = v[0]
1620 dic[k] = v
1644 dic[k] = v
1621 else:
1645 else:
1622 dic[elem] = default
1646 dic[elem] = default
1623 return dic
1647 return dic
1624
1648
1625 #----------------------------------------------------------------------------
1649 #----------------------------------------------------------------------------
1626 def flatten(seq):
1650 def flatten(seq):
1627 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1651 """Flatten a list of lists (NOT recursive, only works for 2d lists)."""
1628
1652
1629 return [x for subseq in seq for x in subseq]
1653 return [x for subseq in seq for x in subseq]
1630
1654
1631 #----------------------------------------------------------------------------
1655 #----------------------------------------------------------------------------
1632 def get_slice(seq,start=0,stop=None,step=1):
1656 def get_slice(seq,start=0,stop=None,step=1):
1633 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1657 """Get a slice of a sequence with variable step. Specify start,stop,step."""
1634 if stop == None:
1658 if stop == None:
1635 stop = len(seq)
1659 stop = len(seq)
1636 item = lambda i: seq[i]
1660 item = lambda i: seq[i]
1637 return map(item,xrange(start,stop,step))
1661 return map(item,xrange(start,stop,step))
1638
1662
1639 #----------------------------------------------------------------------------
1663 #----------------------------------------------------------------------------
1640 def chop(seq,size):
1664 def chop(seq,size):
1641 """Chop a sequence into chunks of the given size."""
1665 """Chop a sequence into chunks of the given size."""
1642 chunk = lambda i: seq[i:i+size]
1666 chunk = lambda i: seq[i:i+size]
1643 return map(chunk,xrange(0,len(seq),size))
1667 return map(chunk,xrange(0,len(seq),size))
1644
1668
1645 #----------------------------------------------------------------------------
1669 #----------------------------------------------------------------------------
1646 # with is a keyword as of python 2.5, so this function is renamed to withobj
1670 # with is a keyword as of python 2.5, so this function is renamed to withobj
1647 # from its old 'with' name.
1671 # from its old 'with' name.
1648 def with_obj(object, **args):
1672 def with_obj(object, **args):
1649 """Set multiple attributes for an object, similar to Pascal's with.
1673 """Set multiple attributes for an object, similar to Pascal's with.
1650
1674
1651 Example:
1675 Example:
1652 with_obj(jim,
1676 with_obj(jim,
1653 born = 1960,
1677 born = 1960,
1654 haircolour = 'Brown',
1678 haircolour = 'Brown',
1655 eyecolour = 'Green')
1679 eyecolour = 'Green')
1656
1680
1657 Credit: Greg Ewing, in
1681 Credit: Greg Ewing, in
1658 http://mail.python.org/pipermail/python-list/2001-May/040703.html.
1682 http://mail.python.org/pipermail/python-list/2001-May/040703.html.
1659
1683
1660 NOTE: up until IPython 0.7.2, this was called simply 'with', but 'with'
1684 NOTE: up until IPython 0.7.2, this was called simply 'with', but 'with'
1661 has become a keyword for Python 2.5, so we had to rename it."""
1685 has become a keyword for Python 2.5, so we had to rename it."""
1662
1686
1663 object.__dict__.update(args)
1687 object.__dict__.update(args)
1664
1688
1665 #----------------------------------------------------------------------------
1689 #----------------------------------------------------------------------------
1666 def setattr_list(obj,alist,nspace = None):
1690 def setattr_list(obj,alist,nspace = None):
1667 """Set a list of attributes for an object taken from a namespace.
1691 """Set a list of attributes for an object taken from a namespace.
1668
1692
1669 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1693 setattr_list(obj,alist,nspace) -> sets in obj all the attributes listed in
1670 alist with their values taken from nspace, which must be a dict (something
1694 alist with their values taken from nspace, which must be a dict (something
1671 like locals() will often do) If nspace isn't given, locals() of the
1695 like locals() will often do) If nspace isn't given, locals() of the
1672 *caller* is used, so in most cases you can omit it.
1696 *caller* is used, so in most cases you can omit it.
1673
1697
1674 Note that alist can be given as a string, which will be automatically
1698 Note that alist can be given as a string, which will be automatically
1675 split into a list on whitespace. If given as a list, it must be a list of
1699 split into a list on whitespace. If given as a list, it must be a list of
1676 *strings* (the variable names themselves), not of variables."""
1700 *strings* (the variable names themselves), not of variables."""
1677
1701
1678 # this grabs the local variables from the *previous* call frame -- that is
1702 # this grabs the local variables from the *previous* call frame -- that is
1679 # the locals from the function that called setattr_list().
1703 # the locals from the function that called setattr_list().
1680 # - snipped from weave.inline()
1704 # - snipped from weave.inline()
1681 if nspace is None:
1705 if nspace is None:
1682 call_frame = sys._getframe().f_back
1706 call_frame = sys._getframe().f_back
1683 nspace = call_frame.f_locals
1707 nspace = call_frame.f_locals
1684
1708
1685 if type(alist) in StringTypes:
1709 if type(alist) in StringTypes:
1686 alist = alist.split()
1710 alist = alist.split()
1687 for attr in alist:
1711 for attr in alist:
1688 val = eval(attr,nspace)
1712 val = eval(attr,nspace)
1689 setattr(obj,attr,val)
1713 setattr(obj,attr,val)
1690
1714
1691 #----------------------------------------------------------------------------
1715 #----------------------------------------------------------------------------
1692 def getattr_list(obj,alist,*args):
1716 def getattr_list(obj,alist,*args):
1693 """getattr_list(obj,alist[, default]) -> attribute list.
1717 """getattr_list(obj,alist[, default]) -> attribute list.
1694
1718
1695 Get a list of named attributes for an object. When a default argument is
1719 Get a list of named attributes for an object. When a default argument is
1696 given, it is returned when the attribute doesn't exist; without it, an
1720 given, it is returned when the attribute doesn't exist; without it, an
1697 exception is raised in that case.
1721 exception is raised in that case.
1698
1722
1699 Note that alist can be given as a string, which will be automatically
1723 Note that alist can be given as a string, which will be automatically
1700 split into a list on whitespace. If given as a list, it must be a list of
1724 split into a list on whitespace. If given as a list, it must be a list of
1701 *strings* (the variable names themselves), not of variables."""
1725 *strings* (the variable names themselves), not of variables."""
1702
1726
1703 if type(alist) in StringTypes:
1727 if type(alist) in StringTypes:
1704 alist = alist.split()
1728 alist = alist.split()
1705 if args:
1729 if args:
1706 if len(args)==1:
1730 if len(args)==1:
1707 default = args[0]
1731 default = args[0]
1708 return map(lambda attr: getattr(obj,attr,default),alist)
1732 return map(lambda attr: getattr(obj,attr,default),alist)
1709 else:
1733 else:
1710 raise ValueError,'getattr_list() takes only one optional argument'
1734 raise ValueError,'getattr_list() takes only one optional argument'
1711 else:
1735 else:
1712 return map(lambda attr: getattr(obj,attr),alist)
1736 return map(lambda attr: getattr(obj,attr),alist)
1713
1737
1714 #----------------------------------------------------------------------------
1738 #----------------------------------------------------------------------------
1715 def map_method(method,object_list,*argseq,**kw):
1739 def map_method(method,object_list,*argseq,**kw):
1716 """map_method(method,object_list,*args,**kw) -> list
1740 """map_method(method,object_list,*args,**kw) -> list
1717
1741
1718 Return a list of the results of applying the methods to the items of the
1742 Return a list of the results of applying the methods to the items of the
1719 argument sequence(s). If more than one sequence is given, the method is
1743 argument sequence(s). If more than one sequence is given, the method is
1720 called with an argument list consisting of the corresponding item of each
1744 called with an argument list consisting of the corresponding item of each
1721 sequence. All sequences must be of the same length.
1745 sequence. All sequences must be of the same length.
1722
1746
1723 Keyword arguments are passed verbatim to all objects called.
1747 Keyword arguments are passed verbatim to all objects called.
1724
1748
1725 This is Python code, so it's not nearly as fast as the builtin map()."""
1749 This is Python code, so it's not nearly as fast as the builtin map()."""
1726
1750
1727 out_list = []
1751 out_list = []
1728 idx = 0
1752 idx = 0
1729 for object in object_list:
1753 for object in object_list:
1730 try:
1754 try:
1731 handler = getattr(object, method)
1755 handler = getattr(object, method)
1732 except AttributeError:
1756 except AttributeError:
1733 out_list.append(None)
1757 out_list.append(None)
1734 else:
1758 else:
1735 if argseq:
1759 if argseq:
1736 args = map(lambda lst:lst[idx],argseq)
1760 args = map(lambda lst:lst[idx],argseq)
1737 #print 'ob',object,'hand',handler,'ar',args # dbg
1761 #print 'ob',object,'hand',handler,'ar',args # dbg
1738 out_list.append(handler(args,**kw))
1762 out_list.append(handler(args,**kw))
1739 else:
1763 else:
1740 out_list.append(handler(**kw))
1764 out_list.append(handler(**kw))
1741 idx += 1
1765 idx += 1
1742 return out_list
1766 return out_list
1743
1767
1744 #----------------------------------------------------------------------------
1768 #----------------------------------------------------------------------------
1745 def get_class_members(cls):
1769 def get_class_members(cls):
1746 ret = dir(cls)
1770 ret = dir(cls)
1747 if hasattr(cls,'__bases__'):
1771 if hasattr(cls,'__bases__'):
1748 for base in cls.__bases__:
1772 for base in cls.__bases__:
1749 ret.extend(get_class_members(base))
1773 ret.extend(get_class_members(base))
1750 return ret
1774 return ret
1751
1775
1752 #----------------------------------------------------------------------------
1776 #----------------------------------------------------------------------------
1753 def dir2(obj):
1777 def dir2(obj):
1754 """dir2(obj) -> list of strings
1778 """dir2(obj) -> list of strings
1755
1779
1756 Extended version of the Python builtin dir(), which does a few extra
1780 Extended version of the Python builtin dir(), which does a few extra
1757 checks, and supports common objects with unusual internals that confuse
1781 checks, and supports common objects with unusual internals that confuse
1758 dir(), such as Traits and PyCrust.
1782 dir(), such as Traits and PyCrust.
1759
1783
1760 This version is guaranteed to return only a list of true strings, whereas
1784 This version is guaranteed to return only a list of true strings, whereas
1761 dir() returns anything that objects inject into themselves, even if they
1785 dir() returns anything that objects inject into themselves, even if they
1762 are later not really valid for attribute access (many extension libraries
1786 are later not really valid for attribute access (many extension libraries
1763 have such bugs).
1787 have such bugs).
1764 """
1788 """
1765
1789
1766 # Start building the attribute list via dir(), and then complete it
1790 # Start building the attribute list via dir(), and then complete it
1767 # with a few extra special-purpose calls.
1791 # with a few extra special-purpose calls.
1768 words = dir(obj)
1792 words = dir(obj)
1769
1793
1770 if hasattr(obj,'__class__'):
1794 if hasattr(obj,'__class__'):
1771 words.append('__class__')
1795 words.append('__class__')
1772 words.extend(get_class_members(obj.__class__))
1796 words.extend(get_class_members(obj.__class__))
1773 #if '__base__' in words: 1/0
1797 #if '__base__' in words: 1/0
1774
1798
1775 # Some libraries (such as traits) may introduce duplicates, we want to
1799 # Some libraries (such as traits) may introduce duplicates, we want to
1776 # track and clean this up if it happens
1800 # track and clean this up if it happens
1777 may_have_dupes = False
1801 may_have_dupes = False
1778
1802
1779 # this is the 'dir' function for objects with Enthought's traits
1803 # this is the 'dir' function for objects with Enthought's traits
1780 if hasattr(obj, 'trait_names'):
1804 if hasattr(obj, 'trait_names'):
1781 try:
1805 try:
1782 words.extend(obj.trait_names())
1806 words.extend(obj.trait_names())
1783 may_have_dupes = True
1807 may_have_dupes = True
1784 except TypeError:
1808 except TypeError:
1785 # This will happen if `obj` is a class and not an instance.
1809 # This will happen if `obj` is a class and not an instance.
1786 pass
1810 pass
1787
1811
1788 # Support for PyCrust-style _getAttributeNames magic method.
1812 # Support for PyCrust-style _getAttributeNames magic method.
1789 if hasattr(obj, '_getAttributeNames'):
1813 if hasattr(obj, '_getAttributeNames'):
1790 try:
1814 try:
1791 words.extend(obj._getAttributeNames())
1815 words.extend(obj._getAttributeNames())
1792 may_have_dupes = True
1816 may_have_dupes = True
1793 except TypeError:
1817 except TypeError:
1794 # `obj` is a class and not an instance. Ignore
1818 # `obj` is a class and not an instance. Ignore
1795 # this error.
1819 # this error.
1796 pass
1820 pass
1797
1821
1798 if may_have_dupes:
1822 if may_have_dupes:
1799 # eliminate possible duplicates, as some traits may also
1823 # eliminate possible duplicates, as some traits may also
1800 # appear as normal attributes in the dir() call.
1824 # appear as normal attributes in the dir() call.
1801 words = list(set(words))
1825 words = list(set(words))
1802 words.sort()
1826 words.sort()
1803
1827
1804 # filter out non-string attributes which may be stuffed by dir() calls
1828 # filter out non-string attributes which may be stuffed by dir() calls
1805 # and poor coding in third-party modules
1829 # and poor coding in third-party modules
1806 return [w for w in words if isinstance(w, basestring)]
1830 return [w for w in words if isinstance(w, basestring)]
1807
1831
1808 #----------------------------------------------------------------------------
1832 #----------------------------------------------------------------------------
1809 def import_fail_info(mod_name,fns=None):
1833 def import_fail_info(mod_name,fns=None):
1810 """Inform load failure for a module."""
1834 """Inform load failure for a module."""
1811
1835
1812 if fns == None:
1836 if fns == None:
1813 warn("Loading of %s failed.\n" % (mod_name,))
1837 warn("Loading of %s failed.\n" % (mod_name,))
1814 else:
1838 else:
1815 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
1839 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
1816
1840
1817 #----------------------------------------------------------------------------
1841 #----------------------------------------------------------------------------
1818 # Proposed popitem() extension, written as a method
1842 # Proposed popitem() extension, written as a method
1819
1843
1820
1844
1821 class NotGiven: pass
1845 class NotGiven: pass
1822
1846
1823 def popkey(dct,key,default=NotGiven):
1847 def popkey(dct,key,default=NotGiven):
1824 """Return dct[key] and delete dct[key].
1848 """Return dct[key] and delete dct[key].
1825
1849
1826 If default is given, return it if dct[key] doesn't exist, otherwise raise
1850 If default is given, return it if dct[key] doesn't exist, otherwise raise
1827 KeyError. """
1851 KeyError. """
1828
1852
1829 try:
1853 try:
1830 val = dct[key]
1854 val = dct[key]
1831 except KeyError:
1855 except KeyError:
1832 if default is NotGiven:
1856 if default is NotGiven:
1833 raise
1857 raise
1834 else:
1858 else:
1835 return default
1859 return default
1836 else:
1860 else:
1837 del dct[key]
1861 del dct[key]
1838 return val
1862 return val
1839
1863
1840 def wrap_deprecated(func, suggest = '<nothing>'):
1864 def wrap_deprecated(func, suggest = '<nothing>'):
1841 def newFunc(*args, **kwargs):
1865 def newFunc(*args, **kwargs):
1842 warnings.warn("Call to deprecated function %s, use %s instead" %
1866 warnings.warn("Call to deprecated function %s, use %s instead" %
1843 ( func.__name__, suggest),
1867 ( func.__name__, suggest),
1844 category=DeprecationWarning,
1868 category=DeprecationWarning,
1845 stacklevel = 2)
1869 stacklevel = 2)
1846 return func(*args, **kwargs)
1870 return func(*args, **kwargs)
1847 return newFunc
1871 return newFunc
1848
1872
1849 #*************************** end of file <genutils.py> **********************
1873 #*************************** end of file <genutils.py> **********************
1850
1874
@@ -1,2489 +1,2498 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 2596 2007-08-08 11:41:01Z vivainio $
9 $Id: iplib.py 2602 2007-08-12 22:45:38Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import doctest
44 import exceptions
45 import exceptions
45 import glob
46 import glob
46 import inspect
47 import inspect
47 import keyword
48 import keyword
48 import new
49 import new
49 import os
50 import os
50 import pydoc
51 import pydoc
51 import re
52 import re
52 import shutil
53 import shutil
53 import string
54 import string
54 import sys
55 import sys
55 import tempfile
56 import tempfile
56 import traceback
57 import traceback
57 import types
58 import types
58 import pickleshare
59 import pickleshare
59 from sets import Set
60 from sets import Set
60 from pprint import pprint, pformat
61 from pprint import pprint, pformat
61
62
62 # IPython's own modules
63 # IPython's own modules
63 #import IPython
64 #import IPython
64 from IPython import Debugger,OInspect,PyColorize,ultraTB
65 from IPython import Debugger,OInspect,PyColorize,ultraTB
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.FakeModule import FakeModule
67 from IPython.FakeModule import FakeModule
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Logger import Logger
69 from IPython.Logger import Logger
69 from IPython.Magic import Magic
70 from IPython.Magic import Magic
70 from IPython.Prompts import CachedOutput
71 from IPython.Prompts import CachedOutput
71 from IPython.ipstruct import Struct
72 from IPython.ipstruct import Struct
72 from IPython.background_jobs import BackgroundJobManager
73 from IPython.background_jobs import BackgroundJobManager
73 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.genutils import *
75 from IPython.genutils import *
75 from IPython.strdispatch import StrDispatch
76 from IPython.strdispatch import StrDispatch
76 import IPython.ipapi
77 import IPython.ipapi
77 import IPython.history
78 import IPython.history
78 import IPython.prefilter as prefilter
79 import IPython.prefilter as prefilter
79 import IPython.shadowns
80 import IPython.shadowns
80 # Globals
81 # Globals
81
82
82 # store the builtin raw_input globally, and use this always, in case user code
83 # store the builtin raw_input globally, and use this always, in case user code
83 # overwrites it (like wx.py.PyShell does)
84 # overwrites it (like wx.py.PyShell does)
84 raw_input_original = raw_input
85 raw_input_original = raw_input
85
86
86 # compiled regexps for autoindent management
87 # compiled regexps for autoindent management
87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88
89
89
90
90 #****************************************************************************
91 #****************************************************************************
91 # Some utility function definitions
92 # Some utility function definitions
92
93
93 ini_spaces_re = re.compile(r'^(\s+)')
94 ini_spaces_re = re.compile(r'^(\s+)')
94
95
95 def num_ini_spaces(strng):
96 def num_ini_spaces(strng):
96 """Return the number of initial spaces in a string"""
97 """Return the number of initial spaces in a string"""
97
98
98 ini_spaces = ini_spaces_re.match(strng)
99 ini_spaces = ini_spaces_re.match(strng)
99 if ini_spaces:
100 if ini_spaces:
100 return ini_spaces.end()
101 return ini_spaces.end()
101 else:
102 else:
102 return 0
103 return 0
103
104
104 def softspace(file, newvalue):
105 def softspace(file, newvalue):
105 """Copied from code.py, to remove the dependency"""
106 """Copied from code.py, to remove the dependency"""
106
107
107 oldvalue = 0
108 oldvalue = 0
108 try:
109 try:
109 oldvalue = file.softspace
110 oldvalue = file.softspace
110 except AttributeError:
111 except AttributeError:
111 pass
112 pass
112 try:
113 try:
113 file.softspace = newvalue
114 file.softspace = newvalue
114 except (AttributeError, TypeError):
115 except (AttributeError, TypeError):
115 # "attribute-less object" or "read-only attributes"
116 # "attribute-less object" or "read-only attributes"
116 pass
117 pass
117 return oldvalue
118 return oldvalue
118
119
119
120
120 #****************************************************************************
121 #****************************************************************************
121 # Local use exceptions
122 # Local use exceptions
122 class SpaceInInput(exceptions.Exception): pass
123 class SpaceInInput(exceptions.Exception): pass
123
124
124
125
125 #****************************************************************************
126 #****************************************************************************
126 # Local use classes
127 # Local use classes
127 class Bunch: pass
128 class Bunch: pass
128
129
129 class Undefined: pass
130 class Undefined: pass
130
131
131 class Quitter(object):
132 class Quitter(object):
132 """Simple class to handle exit, similar to Python 2.5's.
133 """Simple class to handle exit, similar to Python 2.5's.
133
134
134 It handles exiting in an ipython-safe manner, which the one in Python 2.5
135 It handles exiting in an ipython-safe manner, which the one in Python 2.5
135 doesn't do (obviously, since it doesn't know about ipython)."""
136 doesn't do (obviously, since it doesn't know about ipython)."""
136
137
137 def __init__(self,shell,name):
138 def __init__(self,shell,name):
138 self.shell = shell
139 self.shell = shell
139 self.name = name
140 self.name = name
140
141
141 def __repr__(self):
142 def __repr__(self):
142 return 'Type %s() to exit.' % self.name
143 return 'Type %s() to exit.' % self.name
143 __str__ = __repr__
144 __str__ = __repr__
144
145
145 def __call__(self):
146 def __call__(self):
146 self.shell.exit()
147 self.shell.exit()
147
148
148 class InputList(list):
149 class InputList(list):
149 """Class to store user input.
150 """Class to store user input.
150
151
151 It's basically a list, but slices return a string instead of a list, thus
152 It's basically a list, but slices return a string instead of a list, thus
152 allowing things like (assuming 'In' is an instance):
153 allowing things like (assuming 'In' is an instance):
153
154
154 exec In[4:7]
155 exec In[4:7]
155
156
156 or
157 or
157
158
158 exec In[5:9] + In[14] + In[21:25]"""
159 exec In[5:9] + In[14] + In[21:25]"""
159
160
160 def __getslice__(self,i,j):
161 def __getslice__(self,i,j):
161 return ''.join(list.__getslice__(self,i,j))
162 return ''.join(list.__getslice__(self,i,j))
162
163
163 class SyntaxTB(ultraTB.ListTB):
164 class SyntaxTB(ultraTB.ListTB):
164 """Extension which holds some state: the last exception value"""
165 """Extension which holds some state: the last exception value"""
165
166
166 def __init__(self,color_scheme = 'NoColor'):
167 def __init__(self,color_scheme = 'NoColor'):
167 ultraTB.ListTB.__init__(self,color_scheme)
168 ultraTB.ListTB.__init__(self,color_scheme)
168 self.last_syntax_error = None
169 self.last_syntax_error = None
169
170
170 def __call__(self, etype, value, elist):
171 def __call__(self, etype, value, elist):
171 self.last_syntax_error = value
172 self.last_syntax_error = value
172 ultraTB.ListTB.__call__(self,etype,value,elist)
173 ultraTB.ListTB.__call__(self,etype,value,elist)
173
174
174 def clear_err_state(self):
175 def clear_err_state(self):
175 """Return the current error state and clear it"""
176 """Return the current error state and clear it"""
176 e = self.last_syntax_error
177 e = self.last_syntax_error
177 self.last_syntax_error = None
178 self.last_syntax_error = None
178 return e
179 return e
179
180
180 #****************************************************************************
181 #****************************************************************************
181 # Main IPython class
182 # Main IPython class
182
183
183 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
184 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
184 # until a full rewrite is made. I've cleaned all cross-class uses of
185 # until a full rewrite is made. I've cleaned all cross-class uses of
185 # attributes and methods, but too much user code out there relies on the
186 # attributes and methods, but too much user code out there relies on the
186 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
187 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
187 #
188 #
188 # But at least now, all the pieces have been separated and we could, in
189 # But at least now, all the pieces have been separated and we could, in
189 # principle, stop using the mixin. This will ease the transition to the
190 # principle, stop using the mixin. This will ease the transition to the
190 # chainsaw branch.
191 # chainsaw branch.
191
192
192 # For reference, the following is the list of 'self.foo' uses in the Magic
193 # For reference, the following is the list of 'self.foo' uses in the Magic
193 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
194 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
194 # class, to prevent clashes.
195 # class, to prevent clashes.
195
196
196 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
197 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
197 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
198 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
198 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
199 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
199 # 'self.value']
200 # 'self.value']
200
201
201 class InteractiveShell(object,Magic):
202 class InteractiveShell(object,Magic):
202 """An enhanced console for Python."""
203 """An enhanced console for Python."""
203
204
204 # class attribute to indicate whether the class supports threads or not.
205 # class attribute to indicate whether the class supports threads or not.
205 # Subclasses with thread support should override this as needed.
206 # Subclasses with thread support should override this as needed.
206 isthreaded = False
207 isthreaded = False
207
208
208 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
209 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
209 user_ns = None,user_global_ns=None,banner2='',
210 user_ns = None,user_global_ns=None,banner2='',
210 custom_exceptions=((),None),embedded=False):
211 custom_exceptions=((),None),embedded=False):
211
212
212 # log system
213 # log system
213 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
214 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
214
215
215 # some minimal strict typechecks. For some core data structures, I
216 # some minimal strict typechecks. For some core data structures, I
216 # want actual basic python types, not just anything that looks like
217 # want actual basic python types, not just anything that looks like
217 # one. This is especially true for namespaces.
218 # one. This is especially true for namespaces.
218 for ns in (user_ns,user_global_ns):
219 for ns in (user_ns,user_global_ns):
219 if ns is not None and type(ns) != types.DictType:
220 if ns is not None and type(ns) != types.DictType:
220 raise TypeError,'namespace must be a dictionary'
221 raise TypeError,'namespace must be a dictionary'
221
222
222 # Job manager (for jobs run as background threads)
223 # Job manager (for jobs run as background threads)
223 self.jobs = BackgroundJobManager()
224 self.jobs = BackgroundJobManager()
224
225
225 # Store the actual shell's name
226 # Store the actual shell's name
226 self.name = name
227 self.name = name
227
228
228 # 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
229 # global/local namespaces need to be handled differently in that case
230 # global/local namespaces need to be handled differently in that case
230 self.embedded = embedded
231 self.embedded = embedded
231 if embedded:
232 if embedded:
232 # Control variable so users can, from within the embedded instance,
233 # Control variable so users can, from within the embedded instance,
233 # permanently deactivate it.
234 # permanently deactivate it.
234 self.embedded_active = True
235 self.embedded_active = True
235
236
236 # command compiler
237 # command compiler
237 self.compile = codeop.CommandCompiler()
238 self.compile = codeop.CommandCompiler()
238
239
239 # User input buffer
240 # User input buffer
240 self.buffer = []
241 self.buffer = []
241
242
242 # Default name given in compilation of code
243 # Default name given in compilation of code
243 self.filename = '<ipython console>'
244 self.filename = '<ipython console>'
244
245
245 # Install our own quitter instead of the builtins. For python2.3-2.4,
246 # Install our own quitter instead of the builtins. For python2.3-2.4,
246 # this brings in behavior like 2.5, and for 2.5 it's identical.
247 # this brings in behavior like 2.5, and for 2.5 it's identical.
247 __builtin__.exit = Quitter(self,'exit')
248 __builtin__.exit = Quitter(self,'exit')
248 __builtin__.quit = Quitter(self,'quit')
249 __builtin__.quit = Quitter(self,'quit')
249
250
250 # Make an empty namespace, which extension writers can rely on both
251 # Make an empty namespace, which extension writers can rely on both
251 # existing and NEVER being used by ipython itself. This gives them a
252 # existing and NEVER being used by ipython itself. This gives them a
252 # convenient location for storing additional information and state
253 # convenient location for storing additional information and state
253 # their extensions may require, without fear of collisions with other
254 # their extensions may require, without fear of collisions with other
254 # ipython names that may develop later.
255 # ipython names that may develop later.
255 self.meta = Struct()
256 self.meta = Struct()
256
257
257 # Create the namespace where the user will operate. user_ns is
258 # Create the namespace where the user will operate. user_ns is
258 # normally the only one used, and it is passed to the exec calls as
259 # normally the only one used, and it is passed to the exec calls as
259 # the locals argument. But we do carry a user_global_ns namespace
260 # the locals argument. But we do carry a user_global_ns namespace
260 # given as the exec 'globals' argument, This is useful in embedding
261 # given as the exec 'globals' argument, This is useful in embedding
261 # situations where the ipython shell opens in a context where the
262 # situations where the ipython shell opens in a context where the
262 # distinction between locals and globals is meaningful.
263 # distinction between locals and globals is meaningful.
263
264
264 # FIXME. For some strange reason, __builtins__ is showing up at user
265 # FIXME. For some strange reason, __builtins__ is showing up at user
265 # level as a dict instead of a module. This is a manual fix, but I
266 # level as a dict instead of a module. This is a manual fix, but I
266 # should really track down where the problem is coming from. Alex
267 # should really track down where the problem is coming from. Alex
267 # Schmolck reported this problem first.
268 # Schmolck reported this problem first.
268
269
269 # A useful post by Alex Martelli on this topic:
270 # A useful post by Alex Martelli on this topic:
270 # Re: inconsistent value from __builtins__
271 # Re: inconsistent value from __builtins__
271 # Von: Alex Martelli <aleaxit@yahoo.com>
272 # Von: Alex Martelli <aleaxit@yahoo.com>
272 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
273 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
273 # Gruppen: comp.lang.python
274 # Gruppen: comp.lang.python
274
275
275 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
276 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
276 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
277 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
277 # > <type 'dict'>
278 # > <type 'dict'>
278 # > >>> print type(__builtins__)
279 # > >>> print type(__builtins__)
279 # > <type 'module'>
280 # > <type 'module'>
280 # > Is this difference in return value intentional?
281 # > Is this difference in return value intentional?
281
282
282 # Well, it's documented that '__builtins__' can be either a dictionary
283 # Well, it's documented that '__builtins__' can be either a dictionary
283 # or a module, and it's been that way for a long time. Whether it's
284 # or a module, and it's been that way for a long time. Whether it's
284 # intentional (or sensible), I don't know. In any case, the idea is
285 # intentional (or sensible), I don't know. In any case, the idea is
285 # that if you need to access the built-in namespace directly, you
286 # that if you need to access the built-in namespace directly, you
286 # should start with "import __builtin__" (note, no 's') which will
287 # should start with "import __builtin__" (note, no 's') which will
287 # definitely give you a module. Yeah, it's somewhat confusing:-(.
288 # definitely give you a module. Yeah, it's somewhat confusing:-(.
288
289
289 # These routines return properly built dicts as needed by the rest of
290 # These routines return properly built dicts as needed by the rest of
290 # the code, and can also be used by extension writers to generate
291 # the code, and can also be used by extension writers to generate
291 # properly initialized namespaces.
292 # properly initialized namespaces.
292 user_ns = IPython.ipapi.make_user_ns(user_ns)
293 user_ns = IPython.ipapi.make_user_ns(user_ns)
293 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
294 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
294
295
295 # Assign namespaces
296 # Assign namespaces
296 # This is the namespace where all normal user variables live
297 # This is the namespace where all normal user variables live
297 self.user_ns = user_ns
298 self.user_ns = user_ns
298 # Embedded instances require a separate namespace for globals.
299 # Embedded instances require a separate namespace for globals.
299 # Normally this one is unused by non-embedded instances.
300 # Normally this one is unused by non-embedded instances.
300 self.user_global_ns = user_global_ns
301 self.user_global_ns = user_global_ns
301 # A namespace to keep track of internal data structures to prevent
302 # A namespace to keep track of internal data structures to prevent
302 # them from cluttering user-visible stuff. Will be updated later
303 # them from cluttering user-visible stuff. Will be updated later
303 self.internal_ns = {}
304 self.internal_ns = {}
304
305
305 # Namespace of system aliases. Each entry in the alias
306 # Namespace of system aliases. Each entry in the alias
306 # table must be a 2-tuple of the form (N,name), where N is the number
307 # table must be a 2-tuple of the form (N,name), where N is the number
307 # of positional arguments of the alias.
308 # of positional arguments of the alias.
308 self.alias_table = {}
309 self.alias_table = {}
309
310
310 # A table holding all the namespaces IPython deals with, so that
311 # A table holding all the namespaces IPython deals with, so that
311 # introspection facilities can search easily.
312 # introspection facilities can search easily.
312 self.ns_table = {'user':user_ns,
313 self.ns_table = {'user':user_ns,
313 'user_global':user_global_ns,
314 'user_global':user_global_ns,
314 'alias':self.alias_table,
315 'alias':self.alias_table,
315 'internal':self.internal_ns,
316 'internal':self.internal_ns,
316 'builtin':__builtin__.__dict__
317 'builtin':__builtin__.__dict__
317 }
318 }
318
319
319 # The user namespace MUST have a pointer to the shell itself.
320 # The user namespace MUST have a pointer to the shell itself.
320 self.user_ns[name] = self
321 self.user_ns[name] = self
321
322
322 # We need to insert into sys.modules something that looks like a
323 # We need to insert into sys.modules something that looks like a
323 # module but which accesses the IPython namespace, for shelve and
324 # module but which accesses the IPython namespace, for shelve and
324 # pickle to work interactively. Normally they rely on getting
325 # pickle to work interactively. Normally they rely on getting
325 # everything out of __main__, but for embedding purposes each IPython
326 # everything out of __main__, but for embedding purposes each IPython
326 # instance has its own private namespace, so we can't go shoving
327 # instance has its own private namespace, so we can't go shoving
327 # everything into __main__.
328 # everything into __main__.
328
329
329 # note, however, that we should only do this for non-embedded
330 # note, however, that we should only do this for non-embedded
330 # ipythons, which really mimic the __main__.__dict__ with their own
331 # ipythons, which really mimic the __main__.__dict__ with their own
331 # namespace. Embedded instances, on the other hand, should not do
332 # namespace. Embedded instances, on the other hand, should not do
332 # this because they need to manage the user local/global namespaces
333 # this because they need to manage the user local/global namespaces
333 # only, but they live within a 'normal' __main__ (meaning, they
334 # only, but they live within a 'normal' __main__ (meaning, they
334 # shouldn't overtake the execution environment of the script they're
335 # shouldn't overtake the execution environment of the script they're
335 # embedded in).
336 # embedded in).
336
337
337 if not embedded:
338 if not embedded:
338 try:
339 try:
339 main_name = self.user_ns['__name__']
340 main_name = self.user_ns['__name__']
340 except KeyError:
341 except KeyError:
341 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
342 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
342 else:
343 else:
343 #print "pickle hack in place" # dbg
344 #print "pickle hack in place" # dbg
344 #print 'main_name:',main_name # dbg
345 #print 'main_name:',main_name # dbg
345 sys.modules[main_name] = FakeModule(self.user_ns)
346 sys.modules[main_name] = FakeModule(self.user_ns)
346
347
347 # List of input with multi-line handling.
348 # List of input with multi-line handling.
348 # Fill its zero entry, user counter starts at 1
349 # Fill its zero entry, user counter starts at 1
349 self.input_hist = InputList(['\n'])
350 self.input_hist = InputList(['\n'])
350 # This one will hold the 'raw' input history, without any
351 # This one will hold the 'raw' input history, without any
351 # pre-processing. This will allow users to retrieve the input just as
352 # pre-processing. This will allow users to retrieve the input just as
352 # it was exactly typed in by the user, with %hist -r.
353 # it was exactly typed in by the user, with %hist -r.
353 self.input_hist_raw = InputList(['\n'])
354 self.input_hist_raw = InputList(['\n'])
354
355
355 # list of visited directories
356 # list of visited directories
356 try:
357 try:
357 self.dir_hist = [os.getcwd()]
358 self.dir_hist = [os.getcwd()]
358 except OSError:
359 except OSError:
359 self.dir_hist = []
360 self.dir_hist = []
360
361
361 # dict of output history
362 # dict of output history
362 self.output_hist = {}
363 self.output_hist = {}
363
364
364 # Get system encoding at startup time. Certain terminals (like Emacs
365 # Get system encoding at startup time. Certain terminals (like Emacs
365 # under Win32 have it set to None, and we need to have a known valid
366 # under Win32 have it set to None, and we need to have a known valid
366 # encoding to use in the raw_input() method
367 # encoding to use in the raw_input() method
367 self.stdin_encoding = sys.stdin.encoding or 'ascii'
368 self.stdin_encoding = sys.stdin.encoding or 'ascii'
368
369
369 # dict of things NOT to alias (keywords, builtins and some magics)
370 # dict of things NOT to alias (keywords, builtins and some magics)
370 no_alias = {}
371 no_alias = {}
371 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
372 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
372 for key in keyword.kwlist + no_alias_magics:
373 for key in keyword.kwlist + no_alias_magics:
373 no_alias[key] = 1
374 no_alias[key] = 1
374 no_alias.update(__builtin__.__dict__)
375 no_alias.update(__builtin__.__dict__)
375 self.no_alias = no_alias
376 self.no_alias = no_alias
376
377
377 # make global variables for user access to these
378 # make global variables for user access to these
378 self.user_ns['_ih'] = self.input_hist
379 self.user_ns['_ih'] = self.input_hist
379 self.user_ns['_oh'] = self.output_hist
380 self.user_ns['_oh'] = self.output_hist
380 self.user_ns['_dh'] = self.dir_hist
381 self.user_ns['_dh'] = self.dir_hist
381
382
382 # user aliases to input and output histories
383 # user aliases to input and output histories
383 self.user_ns['In'] = self.input_hist
384 self.user_ns['In'] = self.input_hist
384 self.user_ns['Out'] = self.output_hist
385 self.user_ns['Out'] = self.output_hist
385
386
386 self.user_ns['_sh'] = IPython.shadowns
387 self.user_ns['_sh'] = IPython.shadowns
387 # Object variable to store code object waiting execution. This is
388 # Object variable to store code object waiting execution. This is
388 # used mainly by the multithreaded shells, but it can come in handy in
389 # used mainly by the multithreaded shells, but it can come in handy in
389 # other situations. No need to use a Queue here, since it's a single
390 # other situations. No need to use a Queue here, since it's a single
390 # item which gets cleared once run.
391 # item which gets cleared once run.
391 self.code_to_run = None
392 self.code_to_run = None
392
393
393 # escapes for automatic behavior on the command line
394 # escapes for automatic behavior on the command line
394 self.ESC_SHELL = '!'
395 self.ESC_SHELL = '!'
395 self.ESC_SH_CAP = '!!'
396 self.ESC_SH_CAP = '!!'
396 self.ESC_HELP = '?'
397 self.ESC_HELP = '?'
397 self.ESC_MAGIC = '%'
398 self.ESC_MAGIC = '%'
398 self.ESC_QUOTE = ','
399 self.ESC_QUOTE = ','
399 self.ESC_QUOTE2 = ';'
400 self.ESC_QUOTE2 = ';'
400 self.ESC_PAREN = '/'
401 self.ESC_PAREN = '/'
401
402
402 # And their associated handlers
403 # And their associated handlers
403 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
404 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
404 self.ESC_QUOTE : self.handle_auto,
405 self.ESC_QUOTE : self.handle_auto,
405 self.ESC_QUOTE2 : self.handle_auto,
406 self.ESC_QUOTE2 : self.handle_auto,
406 self.ESC_MAGIC : self.handle_magic,
407 self.ESC_MAGIC : self.handle_magic,
407 self.ESC_HELP : self.handle_help,
408 self.ESC_HELP : self.handle_help,
408 self.ESC_SHELL : self.handle_shell_escape,
409 self.ESC_SHELL : self.handle_shell_escape,
409 self.ESC_SH_CAP : self.handle_shell_escape,
410 self.ESC_SH_CAP : self.handle_shell_escape,
410 }
411 }
411
412
412 # class initializations
413 # class initializations
413 Magic.__init__(self,self)
414 Magic.__init__(self,self)
414
415
415 # Python source parser/formatter for syntax highlighting
416 # Python source parser/formatter for syntax highlighting
416 pyformat = PyColorize.Parser().format
417 pyformat = PyColorize.Parser().format
417 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
418 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
418
419
419 # hooks holds pointers used for user-side customizations
420 # hooks holds pointers used for user-side customizations
420 self.hooks = Struct()
421 self.hooks = Struct()
421
422
422 self.strdispatchers = {}
423 self.strdispatchers = {}
423
424
424 # Set all default hooks, defined in the IPython.hooks module.
425 # Set all default hooks, defined in the IPython.hooks module.
425 hooks = IPython.hooks
426 hooks = IPython.hooks
426 for hook_name in hooks.__all__:
427 for hook_name in hooks.__all__:
427 # default hooks have priority 100, i.e. low; user hooks should have
428 # default hooks have priority 100, i.e. low; user hooks should have
428 # 0-100 priority
429 # 0-100 priority
429 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
430 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
430 #print "bound hook",hook_name
431 #print "bound hook",hook_name
431
432
432 # Flag to mark unconditional exit
433 # Flag to mark unconditional exit
433 self.exit_now = False
434 self.exit_now = False
434
435
435 self.usage_min = """\
436 self.usage_min = """\
436 An enhanced console for Python.
437 An enhanced console for Python.
437 Some of its features are:
438 Some of its features are:
438 - Readline support if the readline library is present.
439 - Readline support if the readline library is present.
439 - Tab completion in the local namespace.
440 - Tab completion in the local namespace.
440 - Logging of input, see command-line options.
441 - Logging of input, see command-line options.
441 - System shell escape via ! , eg !ls.
442 - System shell escape via ! , eg !ls.
442 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
443 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
443 - Keeps track of locally defined variables via %who, %whos.
444 - Keeps track of locally defined variables via %who, %whos.
444 - Show object information with a ? eg ?x or x? (use ?? for more info).
445 - Show object information with a ? eg ?x or x? (use ?? for more info).
445 """
446 """
446 if usage: self.usage = usage
447 if usage: self.usage = usage
447 else: self.usage = self.usage_min
448 else: self.usage = self.usage_min
448
449
449 # Storage
450 # Storage
450 self.rc = rc # This will hold all configuration information
451 self.rc = rc # This will hold all configuration information
451 self.pager = 'less'
452 self.pager = 'less'
452 # temporary files used for various purposes. Deleted at exit.
453 # temporary files used for various purposes. Deleted at exit.
453 self.tempfiles = []
454 self.tempfiles = []
454
455
455 # Keep track of readline usage (later set by init_readline)
456 # Keep track of readline usage (later set by init_readline)
456 self.has_readline = False
457 self.has_readline = False
457
458
458 # template for logfile headers. It gets resolved at runtime by the
459 # template for logfile headers. It gets resolved at runtime by the
459 # logstart method.
460 # logstart method.
460 self.loghead_tpl = \
461 self.loghead_tpl = \
461 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
462 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
462 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
463 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
463 #log# opts = %s
464 #log# opts = %s
464 #log# args = %s
465 #log# args = %s
465 #log# It is safe to make manual edits below here.
466 #log# It is safe to make manual edits below here.
466 #log#-----------------------------------------------------------------------
467 #log#-----------------------------------------------------------------------
467 """
468 """
468 # for pushd/popd management
469 # for pushd/popd management
469 try:
470 try:
470 self.home_dir = get_home_dir()
471 self.home_dir = get_home_dir()
471 except HomeDirError,msg:
472 except HomeDirError,msg:
472 fatal(msg)
473 fatal(msg)
473
474
474 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
475 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
475
476
476 # Functions to call the underlying shell.
477 # Functions to call the underlying shell.
477
478
478 # The first is similar to os.system, but it doesn't return a value,
479 # The first is similar to os.system, but it doesn't return a value,
479 # and it allows interpolation of variables in the user's namespace.
480 # and it allows interpolation of variables in the user's namespace.
480 self.system = lambda cmd: \
481 self.system = lambda cmd: \
481 shell(self.var_expand(cmd,depth=2),
482 shell(self.var_expand(cmd,depth=2),
482 header=self.rc.system_header,
483 header=self.rc.system_header,
483 verbose=self.rc.system_verbose)
484 verbose=self.rc.system_verbose)
484
485
485 # These are for getoutput and getoutputerror:
486 # These are for getoutput and getoutputerror:
486 self.getoutput = lambda cmd: \
487 self.getoutput = lambda cmd: \
487 getoutput(self.var_expand(cmd,depth=2),
488 getoutput(self.var_expand(cmd,depth=2),
488 header=self.rc.system_header,
489 header=self.rc.system_header,
489 verbose=self.rc.system_verbose)
490 verbose=self.rc.system_verbose)
490
491
491 self.getoutputerror = lambda cmd: \
492 self.getoutputerror = lambda cmd: \
492 getoutputerror(self.var_expand(cmd,depth=2),
493 getoutputerror(self.var_expand(cmd,depth=2),
493 header=self.rc.system_header,
494 header=self.rc.system_header,
494 verbose=self.rc.system_verbose)
495 verbose=self.rc.system_verbose)
495
496
496
497
497 # keep track of where we started running (mainly for crash post-mortem)
498 # keep track of where we started running (mainly for crash post-mortem)
498 self.starting_dir = os.getcwd()
499 self.starting_dir = os.getcwd()
499
500
500 # Various switches which can be set
501 # Various switches which can be set
501 self.CACHELENGTH = 5000 # this is cheap, it's just text
502 self.CACHELENGTH = 5000 # this is cheap, it's just text
502 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
503 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
503 self.banner2 = banner2
504 self.banner2 = banner2
504
505
505 # TraceBack handlers:
506 # TraceBack handlers:
506
507
507 # Syntax error handler.
508 # Syntax error handler.
508 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
509 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
509
510
510 # The interactive one is initialized with an offset, meaning we always
511 # The interactive one is initialized with an offset, meaning we always
511 # want to remove the topmost item in the traceback, which is our own
512 # want to remove the topmost item in the traceback, which is our own
512 # internal code. Valid modes: ['Plain','Context','Verbose']
513 # internal code. Valid modes: ['Plain','Context','Verbose']
513 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
514 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
514 color_scheme='NoColor',
515 color_scheme='NoColor',
515 tb_offset = 1)
516 tb_offset = 1)
516
517
517 # IPython itself shouldn't crash. This will produce a detailed
518 # IPython itself shouldn't crash. This will produce a detailed
518 # post-mortem if it does. But we only install the crash handler for
519 # post-mortem if it does. But we only install the crash handler for
519 # non-threaded shells, the threaded ones use a normal verbose reporter
520 # non-threaded shells, the threaded ones use a normal verbose reporter
520 # and lose the crash handler. This is because exceptions in the main
521 # and lose the crash handler. This is because exceptions in the main
521 # thread (such as in GUI code) propagate directly to sys.excepthook,
522 # thread (such as in GUI code) propagate directly to sys.excepthook,
522 # and there's no point in printing crash dumps for every user exception.
523 # and there's no point in printing crash dumps for every user exception.
523 if self.isthreaded:
524 if self.isthreaded:
524 ipCrashHandler = ultraTB.FormattedTB()
525 ipCrashHandler = ultraTB.FormattedTB()
525 else:
526 else:
526 from IPython import CrashHandler
527 from IPython import CrashHandler
527 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
528 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
528 self.set_crash_handler(ipCrashHandler)
529 self.set_crash_handler(ipCrashHandler)
529
530
530 # and add any custom exception handlers the user may have specified
531 # and add any custom exception handlers the user may have specified
531 self.set_custom_exc(*custom_exceptions)
532 self.set_custom_exc(*custom_exceptions)
532
533
533 # indentation management
534 # indentation management
534 self.autoindent = False
535 self.autoindent = False
535 self.indent_current_nsp = 0
536 self.indent_current_nsp = 0
536
537
537 # Make some aliases automatically
538 # Make some aliases automatically
538 # Prepare list of shell aliases to auto-define
539 # Prepare list of shell aliases to auto-define
539 if os.name == 'posix':
540 if os.name == 'posix':
540 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
541 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
541 'mv mv -i','rm rm -i','cp cp -i',
542 'mv mv -i','rm rm -i','cp cp -i',
542 'cat cat','less less','clear clear',
543 'cat cat','less less','clear clear',
543 # a better ls
544 # a better ls
544 'ls ls -F',
545 'ls ls -F',
545 # long ls
546 # long ls
546 'll ls -lF')
547 'll ls -lF')
547 # Extra ls aliases with color, which need special treatment on BSD
548 # Extra ls aliases with color, which need special treatment on BSD
548 # variants
549 # variants
549 ls_extra = ( # color ls
550 ls_extra = ( # color ls
550 'lc ls -F -o --color',
551 'lc ls -F -o --color',
551 # ls normal files only
552 # ls normal files only
552 'lf ls -F -o --color %l | grep ^-',
553 'lf ls -F -o --color %l | grep ^-',
553 # ls symbolic links
554 # ls symbolic links
554 'lk ls -F -o --color %l | grep ^l',
555 'lk ls -F -o --color %l | grep ^l',
555 # directories or links to directories,
556 # directories or links to directories,
556 'ldir ls -F -o --color %l | grep /$',
557 'ldir ls -F -o --color %l | grep /$',
557 # things which are executable
558 # things which are executable
558 'lx ls -F -o --color %l | grep ^-..x',
559 'lx ls -F -o --color %l | grep ^-..x',
559 )
560 )
560 # The BSDs don't ship GNU ls, so they don't understand the
561 # The BSDs don't ship GNU ls, so they don't understand the
561 # --color switch out of the box
562 # --color switch out of the box
562 if 'bsd' in sys.platform:
563 if 'bsd' in sys.platform:
563 ls_extra = ( # ls normal files only
564 ls_extra = ( # ls normal files only
564 'lf ls -lF | grep ^-',
565 'lf ls -lF | grep ^-',
565 # ls symbolic links
566 # ls symbolic links
566 'lk ls -lF | grep ^l',
567 'lk ls -lF | grep ^l',
567 # directories or links to directories,
568 # directories or links to directories,
568 'ldir ls -lF | grep /$',
569 'ldir ls -lF | grep /$',
569 # things which are executable
570 # things which are executable
570 'lx ls -lF | grep ^-..x',
571 'lx ls -lF | grep ^-..x',
571 )
572 )
572 auto_alias = auto_alias + ls_extra
573 auto_alias = auto_alias + ls_extra
573 elif os.name in ['nt','dos']:
574 elif os.name in ['nt','dos']:
574 auto_alias = ('dir dir /on', 'ls dir /on',
575 auto_alias = ('dir dir /on', 'ls dir /on',
575 'ddir dir /ad /on', 'ldir dir /ad /on',
576 'ddir dir /ad /on', 'ldir dir /ad /on',
576 'mkdir mkdir','rmdir rmdir','echo echo',
577 'mkdir mkdir','rmdir rmdir','echo echo',
577 'ren ren','cls cls','copy copy')
578 'ren ren','cls cls','copy copy')
578 else:
579 else:
579 auto_alias = ()
580 auto_alias = ()
580 self.auto_alias = [s.split(None,1) for s in auto_alias]
581 self.auto_alias = [s.split(None,1) for s in auto_alias]
581 # Call the actual (public) initializer
582 # Call the actual (public) initializer
582 self.init_auto_alias()
583 self.init_auto_alias()
583
584
584 # Produce a public API instance
585 # Produce a public API instance
585 self.api = IPython.ipapi.IPApi(self)
586 self.api = IPython.ipapi.IPApi(self)
586
587
587 # track which builtins we add, so we can clean up later
588 # track which builtins we add, so we can clean up later
588 self.builtins_added = {}
589 self.builtins_added = {}
589 # This method will add the necessary builtins for operation, but
590 # This method will add the necessary builtins for operation, but
590 # tracking what it did via the builtins_added dict.
591 # tracking what it did via the builtins_added dict.
591 self.add_builtins()
592 self.add_builtins()
592
593
593 # end __init__
594 # end __init__
594
595
595 def var_expand(self,cmd,depth=0):
596 def var_expand(self,cmd,depth=0):
596 """Expand python variables in a string.
597 """Expand python variables in a string.
597
598
598 The depth argument indicates how many frames above the caller should
599 The depth argument indicates how many frames above the caller should
599 be walked to look for the local namespace where to expand variables.
600 be walked to look for the local namespace where to expand variables.
600
601
601 The global namespace for expansion is always the user's interactive
602 The global namespace for expansion is always the user's interactive
602 namespace.
603 namespace.
603 """
604 """
604
605
605 return str(ItplNS(cmd.replace('#','\#'),
606 return str(ItplNS(cmd.replace('#','\#'),
606 self.user_ns, # globals
607 self.user_ns, # globals
607 # Skip our own frame in searching for locals:
608 # Skip our own frame in searching for locals:
608 sys._getframe(depth+1).f_locals # locals
609 sys._getframe(depth+1).f_locals # locals
609 ))
610 ))
610
611
611 def pre_config_initialization(self):
612 def pre_config_initialization(self):
612 """Pre-configuration init method
613 """Pre-configuration init method
613
614
614 This is called before the configuration files are processed to
615 This is called before the configuration files are processed to
615 prepare the services the config files might need.
616 prepare the services the config files might need.
616
617
617 self.rc already has reasonable default values at this point.
618 self.rc already has reasonable default values at this point.
618 """
619 """
619 rc = self.rc
620 rc = self.rc
620 try:
621 try:
621 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
622 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
622 except exceptions.UnicodeDecodeError:
623 except exceptions.UnicodeDecodeError:
623 print "Your ipythondir can't be decoded to unicode!"
624 print "Your ipythondir can't be decoded to unicode!"
624 print "Please set HOME environment variable to something that"
625 print "Please set HOME environment variable to something that"
625 print r"only has ASCII characters, e.g. c:\home"
626 print r"only has ASCII characters, e.g. c:\home"
626 print "Now it is",rc.ipythondir
627 print "Now it is",rc.ipythondir
627 sys.exit()
628 sys.exit()
628 self.shadowhist = IPython.history.ShadowHist(self.db)
629 self.shadowhist = IPython.history.ShadowHist(self.db)
629
630
630
631
631 def post_config_initialization(self):
632 def post_config_initialization(self):
632 """Post configuration init method
633 """Post configuration init method
633
634
634 This is called after the configuration files have been processed to
635 This is called after the configuration files have been processed to
635 'finalize' the initialization."""
636 'finalize' the initialization."""
636
637
637 rc = self.rc
638 rc = self.rc
638
639
639 # Object inspector
640 # Object inspector
640 self.inspector = OInspect.Inspector(OInspect.InspectColors,
641 self.inspector = OInspect.Inspector(OInspect.InspectColors,
641 PyColorize.ANSICodeColors,
642 PyColorize.ANSICodeColors,
642 'NoColor',
643 'NoColor',
643 rc.object_info_string_level)
644 rc.object_info_string_level)
644
645
645 self.rl_next_input = None
646 self.rl_next_input = None
646 self.rl_do_indent = False
647 self.rl_do_indent = False
647 # Load readline proper
648 # Load readline proper
648 if rc.readline:
649 if rc.readline:
649 self.init_readline()
650 self.init_readline()
650
651
651
652
652 # local shortcut, this is used a LOT
653 # local shortcut, this is used a LOT
653 self.log = self.logger.log
654 self.log = self.logger.log
654
655
655 # Initialize cache, set in/out prompts and printing system
656 # Initialize cache, set in/out prompts and printing system
656 self.outputcache = CachedOutput(self,
657 self.outputcache = CachedOutput(self,
657 rc.cache_size,
658 rc.cache_size,
658 rc.pprint,
659 rc.pprint,
659 input_sep = rc.separate_in,
660 input_sep = rc.separate_in,
660 output_sep = rc.separate_out,
661 output_sep = rc.separate_out,
661 output_sep2 = rc.separate_out2,
662 output_sep2 = rc.separate_out2,
662 ps1 = rc.prompt_in1,
663 ps1 = rc.prompt_in1,
663 ps2 = rc.prompt_in2,
664 ps2 = rc.prompt_in2,
664 ps_out = rc.prompt_out,
665 ps_out = rc.prompt_out,
665 pad_left = rc.prompts_pad_left)
666 pad_left = rc.prompts_pad_left)
666
667
667 # user may have over-ridden the default print hook:
668 # user may have over-ridden the default print hook:
668 try:
669 try:
669 self.outputcache.__class__.display = self.hooks.display
670 self.outputcache.__class__.display = self.hooks.display
670 except AttributeError:
671 except AttributeError:
671 pass
672 pass
672
673
673 # I don't like assigning globally to sys, because it means when
674 # I don't like assigning globally to sys, because it means when
674 # embedding instances, each embedded instance overrides the previous
675 # embedding instances, each embedded instance overrides the previous
675 # choice. But sys.displayhook seems to be called internally by exec,
676 # choice. But sys.displayhook seems to be called internally by exec,
676 # so I don't see a way around it. We first save the original and then
677 # so I don't see a way around it. We first save the original and then
677 # overwrite it.
678 # overwrite it.
678 self.sys_displayhook = sys.displayhook
679 self.sys_displayhook = sys.displayhook
679 sys.displayhook = self.outputcache
680 sys.displayhook = self.outputcache
680
681
682 # Monkeypatch doctest so that its core test runner method is protected
683 # from IPython's modified displayhook. Doctest expects the default
684 # displayhook behavior deep down, so our modification breaks it
685 # completely. For this reason, a hard monkeypatch seems like a
686 # reasonable solution rather than asking users to manually use a
687 # different doctest runner when under IPython.
688 doctest.DocTestRunner.run = dhook_wrap(doctest.DocTestRunner.run)
689
681 # Set user colors (don't do it in the constructor above so that it
690 # Set user colors (don't do it in the constructor above so that it
682 # doesn't crash if colors option is invalid)
691 # doesn't crash if colors option is invalid)
683 self.magic_colors(rc.colors)
692 self.magic_colors(rc.colors)
684
693
685 # Set calling of pdb on exceptions
694 # Set calling of pdb on exceptions
686 self.call_pdb = rc.pdb
695 self.call_pdb = rc.pdb
687
696
688 # Load user aliases
697 # Load user aliases
689 for alias in rc.alias:
698 for alias in rc.alias:
690 self.magic_alias(alias)
699 self.magic_alias(alias)
691 self.hooks.late_startup_hook()
700 self.hooks.late_startup_hook()
692
701
693 batchrun = False
702 batchrun = False
694 for batchfile in [path(arg) for arg in self.rc.args
703 for batchfile in [path(arg) for arg in self.rc.args
695 if arg.lower().endswith('.ipy')]:
704 if arg.lower().endswith('.ipy')]:
696 if not batchfile.isfile():
705 if not batchfile.isfile():
697 print "No such batch file:", batchfile
706 print "No such batch file:", batchfile
698 continue
707 continue
699 self.api.runlines(batchfile.text())
708 self.api.runlines(batchfile.text())
700 batchrun = True
709 batchrun = True
701 if batchrun:
710 if batchrun:
702 self.exit_now = True
711 self.exit_now = True
703
712
704 def add_builtins(self):
713 def add_builtins(self):
705 """Store ipython references into the builtin namespace.
714 """Store ipython references into the builtin namespace.
706
715
707 Some parts of ipython operate via builtins injected here, which hold a
716 Some parts of ipython operate via builtins injected here, which hold a
708 reference to IPython itself."""
717 reference to IPython itself."""
709
718
710 # TODO: deprecate all except _ip; 'jobs' should be installed
719 # TODO: deprecate all except _ip; 'jobs' should be installed
711 # by an extension and the rest are under _ip, ipalias is redundant
720 # by an extension and the rest are under _ip, ipalias is redundant
712 builtins_new = dict(__IPYTHON__ = self,
721 builtins_new = dict(__IPYTHON__ = self,
713 ip_set_hook = self.set_hook,
722 ip_set_hook = self.set_hook,
714 jobs = self.jobs,
723 jobs = self.jobs,
715 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
724 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
716 ipalias = wrap_deprecated(self.ipalias),
725 ipalias = wrap_deprecated(self.ipalias),
717 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
726 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
718 _ip = self.api
727 _ip = self.api
719 )
728 )
720 for biname,bival in builtins_new.items():
729 for biname,bival in builtins_new.items():
721 try:
730 try:
722 # store the orignal value so we can restore it
731 # store the orignal value so we can restore it
723 self.builtins_added[biname] = __builtin__.__dict__[biname]
732 self.builtins_added[biname] = __builtin__.__dict__[biname]
724 except KeyError:
733 except KeyError:
725 # or mark that it wasn't defined, and we'll just delete it at
734 # or mark that it wasn't defined, and we'll just delete it at
726 # cleanup
735 # cleanup
727 self.builtins_added[biname] = Undefined
736 self.builtins_added[biname] = Undefined
728 __builtin__.__dict__[biname] = bival
737 __builtin__.__dict__[biname] = bival
729
738
730 # Keep in the builtins a flag for when IPython is active. We set it
739 # Keep in the builtins a flag for when IPython is active. We set it
731 # with setdefault so that multiple nested IPythons don't clobber one
740 # with setdefault so that multiple nested IPythons don't clobber one
732 # another. Each will increase its value by one upon being activated,
741 # another. Each will increase its value by one upon being activated,
733 # which also gives us a way to determine the nesting level.
742 # which also gives us a way to determine the nesting level.
734 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
743 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
735
744
736 def clean_builtins(self):
745 def clean_builtins(self):
737 """Remove any builtins which might have been added by add_builtins, or
746 """Remove any builtins which might have been added by add_builtins, or
738 restore overwritten ones to their previous values."""
747 restore overwritten ones to their previous values."""
739 for biname,bival in self.builtins_added.items():
748 for biname,bival in self.builtins_added.items():
740 if bival is Undefined:
749 if bival is Undefined:
741 del __builtin__.__dict__[biname]
750 del __builtin__.__dict__[biname]
742 else:
751 else:
743 __builtin__.__dict__[biname] = bival
752 __builtin__.__dict__[biname] = bival
744 self.builtins_added.clear()
753 self.builtins_added.clear()
745
754
746 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
755 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
747 """set_hook(name,hook) -> sets an internal IPython hook.
756 """set_hook(name,hook) -> sets an internal IPython hook.
748
757
749 IPython exposes some of its internal API as user-modifiable hooks. By
758 IPython exposes some of its internal API as user-modifiable hooks. By
750 adding your function to one of these hooks, you can modify IPython's
759 adding your function to one of these hooks, you can modify IPython's
751 behavior to call at runtime your own routines."""
760 behavior to call at runtime your own routines."""
752
761
753 # At some point in the future, this should validate the hook before it
762 # At some point in the future, this should validate the hook before it
754 # accepts it. Probably at least check that the hook takes the number
763 # accepts it. Probably at least check that the hook takes the number
755 # of args it's supposed to.
764 # of args it's supposed to.
756
765
757 f = new.instancemethod(hook,self,self.__class__)
766 f = new.instancemethod(hook,self,self.__class__)
758
767
759 # check if the hook is for strdispatcher first
768 # check if the hook is for strdispatcher first
760 if str_key is not None:
769 if str_key is not None:
761 sdp = self.strdispatchers.get(name, StrDispatch())
770 sdp = self.strdispatchers.get(name, StrDispatch())
762 sdp.add_s(str_key, f, priority )
771 sdp.add_s(str_key, f, priority )
763 self.strdispatchers[name] = sdp
772 self.strdispatchers[name] = sdp
764 return
773 return
765 if re_key is not None:
774 if re_key is not None:
766 sdp = self.strdispatchers.get(name, StrDispatch())
775 sdp = self.strdispatchers.get(name, StrDispatch())
767 sdp.add_re(re.compile(re_key), f, priority )
776 sdp.add_re(re.compile(re_key), f, priority )
768 self.strdispatchers[name] = sdp
777 self.strdispatchers[name] = sdp
769 return
778 return
770
779
771 dp = getattr(self.hooks, name, None)
780 dp = getattr(self.hooks, name, None)
772 if name not in IPython.hooks.__all__:
781 if name not in IPython.hooks.__all__:
773 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
782 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
774 if not dp:
783 if not dp:
775 dp = IPython.hooks.CommandChainDispatcher()
784 dp = IPython.hooks.CommandChainDispatcher()
776
785
777 try:
786 try:
778 dp.add(f,priority)
787 dp.add(f,priority)
779 except AttributeError:
788 except AttributeError:
780 # it was not commandchain, plain old func - replace
789 # it was not commandchain, plain old func - replace
781 dp = f
790 dp = f
782
791
783 setattr(self.hooks,name, dp)
792 setattr(self.hooks,name, dp)
784
793
785
794
786 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
795 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
787
796
788 def set_crash_handler(self,crashHandler):
797 def set_crash_handler(self,crashHandler):
789 """Set the IPython crash handler.
798 """Set the IPython crash handler.
790
799
791 This must be a callable with a signature suitable for use as
800 This must be a callable with a signature suitable for use as
792 sys.excepthook."""
801 sys.excepthook."""
793
802
794 # Install the given crash handler as the Python exception hook
803 # Install the given crash handler as the Python exception hook
795 sys.excepthook = crashHandler
804 sys.excepthook = crashHandler
796
805
797 # The instance will store a pointer to this, so that runtime code
806 # The instance will store a pointer to this, so that runtime code
798 # (such as magics) can access it. This is because during the
807 # (such as magics) can access it. This is because during the
799 # read-eval loop, it gets temporarily overwritten (to deal with GUI
808 # read-eval loop, it gets temporarily overwritten (to deal with GUI
800 # frameworks).
809 # frameworks).
801 self.sys_excepthook = sys.excepthook
810 self.sys_excepthook = sys.excepthook
802
811
803
812
804 def set_custom_exc(self,exc_tuple,handler):
813 def set_custom_exc(self,exc_tuple,handler):
805 """set_custom_exc(exc_tuple,handler)
814 """set_custom_exc(exc_tuple,handler)
806
815
807 Set a custom exception handler, which will be called if any of the
816 Set a custom exception handler, which will be called if any of the
808 exceptions in exc_tuple occur in the mainloop (specifically, in the
817 exceptions in exc_tuple occur in the mainloop (specifically, in the
809 runcode() method.
818 runcode() method.
810
819
811 Inputs:
820 Inputs:
812
821
813 - exc_tuple: a *tuple* of valid exceptions to call the defined
822 - exc_tuple: a *tuple* of valid exceptions to call the defined
814 handler for. It is very important that you use a tuple, and NOT A
823 handler for. It is very important that you use a tuple, and NOT A
815 LIST here, because of the way Python's except statement works. If
824 LIST here, because of the way Python's except statement works. If
816 you only want to trap a single exception, use a singleton tuple:
825 you only want to trap a single exception, use a singleton tuple:
817
826
818 exc_tuple == (MyCustomException,)
827 exc_tuple == (MyCustomException,)
819
828
820 - handler: this must be defined as a function with the following
829 - handler: this must be defined as a function with the following
821 basic interface: def my_handler(self,etype,value,tb).
830 basic interface: def my_handler(self,etype,value,tb).
822
831
823 This will be made into an instance method (via new.instancemethod)
832 This will be made into an instance method (via new.instancemethod)
824 of IPython itself, and it will be called if any of the exceptions
833 of IPython itself, and it will be called if any of the exceptions
825 listed in the exc_tuple are caught. If the handler is None, an
834 listed in the exc_tuple are caught. If the handler is None, an
826 internal basic one is used, which just prints basic info.
835 internal basic one is used, which just prints basic info.
827
836
828 WARNING: by putting in your own exception handler into IPython's main
837 WARNING: by putting in your own exception handler into IPython's main
829 execution loop, you run a very good chance of nasty crashes. This
838 execution loop, you run a very good chance of nasty crashes. This
830 facility should only be used if you really know what you are doing."""
839 facility should only be used if you really know what you are doing."""
831
840
832 assert type(exc_tuple)==type(()) , \
841 assert type(exc_tuple)==type(()) , \
833 "The custom exceptions must be given AS A TUPLE."
842 "The custom exceptions must be given AS A TUPLE."
834
843
835 def dummy_handler(self,etype,value,tb):
844 def dummy_handler(self,etype,value,tb):
836 print '*** Simple custom exception handler ***'
845 print '*** Simple custom exception handler ***'
837 print 'Exception type :',etype
846 print 'Exception type :',etype
838 print 'Exception value:',value
847 print 'Exception value:',value
839 print 'Traceback :',tb
848 print 'Traceback :',tb
840 print 'Source code :','\n'.join(self.buffer)
849 print 'Source code :','\n'.join(self.buffer)
841
850
842 if handler is None: handler = dummy_handler
851 if handler is None: handler = dummy_handler
843
852
844 self.CustomTB = new.instancemethod(handler,self,self.__class__)
853 self.CustomTB = new.instancemethod(handler,self,self.__class__)
845 self.custom_exceptions = exc_tuple
854 self.custom_exceptions = exc_tuple
846
855
847 def set_custom_completer(self,completer,pos=0):
856 def set_custom_completer(self,completer,pos=0):
848 """set_custom_completer(completer,pos=0)
857 """set_custom_completer(completer,pos=0)
849
858
850 Adds a new custom completer function.
859 Adds a new custom completer function.
851
860
852 The position argument (defaults to 0) is the index in the completers
861 The position argument (defaults to 0) is the index in the completers
853 list where you want the completer to be inserted."""
862 list where you want the completer to be inserted."""
854
863
855 newcomp = new.instancemethod(completer,self.Completer,
864 newcomp = new.instancemethod(completer,self.Completer,
856 self.Completer.__class__)
865 self.Completer.__class__)
857 self.Completer.matchers.insert(pos,newcomp)
866 self.Completer.matchers.insert(pos,newcomp)
858
867
859 def set_completer(self):
868 def set_completer(self):
860 """reset readline's completer to be our own."""
869 """reset readline's completer to be our own."""
861 self.readline.set_completer(self.Completer.complete)
870 self.readline.set_completer(self.Completer.complete)
862
871
863 def _get_call_pdb(self):
872 def _get_call_pdb(self):
864 return self._call_pdb
873 return self._call_pdb
865
874
866 def _set_call_pdb(self,val):
875 def _set_call_pdb(self,val):
867
876
868 if val not in (0,1,False,True):
877 if val not in (0,1,False,True):
869 raise ValueError,'new call_pdb value must be boolean'
878 raise ValueError,'new call_pdb value must be boolean'
870
879
871 # store value in instance
880 # store value in instance
872 self._call_pdb = val
881 self._call_pdb = val
873
882
874 # notify the actual exception handlers
883 # notify the actual exception handlers
875 self.InteractiveTB.call_pdb = val
884 self.InteractiveTB.call_pdb = val
876 if self.isthreaded:
885 if self.isthreaded:
877 try:
886 try:
878 self.sys_excepthook.call_pdb = val
887 self.sys_excepthook.call_pdb = val
879 except:
888 except:
880 warn('Failed to activate pdb for threaded exception handler')
889 warn('Failed to activate pdb for threaded exception handler')
881
890
882 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
891 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
883 'Control auto-activation of pdb at exceptions')
892 'Control auto-activation of pdb at exceptions')
884
893
885
894
886 # These special functions get installed in the builtin namespace, to
895 # These special functions get installed in the builtin namespace, to
887 # provide programmatic (pure python) access to magics, aliases and system
896 # provide programmatic (pure python) access to magics, aliases and system
888 # calls. This is important for logging, user scripting, and more.
897 # calls. This is important for logging, user scripting, and more.
889
898
890 # We are basically exposing, via normal python functions, the three
899 # We are basically exposing, via normal python functions, the three
891 # mechanisms in which ipython offers special call modes (magics for
900 # mechanisms in which ipython offers special call modes (magics for
892 # internal control, aliases for direct system access via pre-selected
901 # internal control, aliases for direct system access via pre-selected
893 # names, and !cmd for calling arbitrary system commands).
902 # names, and !cmd for calling arbitrary system commands).
894
903
895 def ipmagic(self,arg_s):
904 def ipmagic(self,arg_s):
896 """Call a magic function by name.
905 """Call a magic function by name.
897
906
898 Input: a string containing the name of the magic function to call and any
907 Input: a string containing the name of the magic function to call and any
899 additional arguments to be passed to the magic.
908 additional arguments to be passed to the magic.
900
909
901 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
910 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
902 prompt:
911 prompt:
903
912
904 In[1]: %name -opt foo bar
913 In[1]: %name -opt foo bar
905
914
906 To call a magic without arguments, simply use ipmagic('name').
915 To call a magic without arguments, simply use ipmagic('name').
907
916
908 This provides a proper Python function to call IPython's magics in any
917 This provides a proper Python function to call IPython's magics in any
909 valid Python code you can type at the interpreter, including loops and
918 valid Python code you can type at the interpreter, including loops and
910 compound statements. It is added by IPython to the Python builtin
919 compound statements. It is added by IPython to the Python builtin
911 namespace upon initialization."""
920 namespace upon initialization."""
912
921
913 args = arg_s.split(' ',1)
922 args = arg_s.split(' ',1)
914 magic_name = args[0]
923 magic_name = args[0]
915 magic_name = magic_name.lstrip(self.ESC_MAGIC)
924 magic_name = magic_name.lstrip(self.ESC_MAGIC)
916
925
917 try:
926 try:
918 magic_args = args[1]
927 magic_args = args[1]
919 except IndexError:
928 except IndexError:
920 magic_args = ''
929 magic_args = ''
921 fn = getattr(self,'magic_'+magic_name,None)
930 fn = getattr(self,'magic_'+magic_name,None)
922 if fn is None:
931 if fn is None:
923 error("Magic function `%s` not found." % magic_name)
932 error("Magic function `%s` not found." % magic_name)
924 else:
933 else:
925 magic_args = self.var_expand(magic_args,1)
934 magic_args = self.var_expand(magic_args,1)
926 return fn(magic_args)
935 return fn(magic_args)
927
936
928 def ipalias(self,arg_s):
937 def ipalias(self,arg_s):
929 """Call an alias by name.
938 """Call an alias by name.
930
939
931 Input: a string containing the name of the alias to call and any
940 Input: a string containing the name of the alias to call and any
932 additional arguments to be passed to the magic.
941 additional arguments to be passed to the magic.
933
942
934 ipalias('name -opt foo bar') is equivalent to typing at the ipython
943 ipalias('name -opt foo bar') is equivalent to typing at the ipython
935 prompt:
944 prompt:
936
945
937 In[1]: name -opt foo bar
946 In[1]: name -opt foo bar
938
947
939 To call an alias without arguments, simply use ipalias('name').
948 To call an alias without arguments, simply use ipalias('name').
940
949
941 This provides a proper Python function to call IPython's aliases in any
950 This provides a proper Python function to call IPython's aliases in any
942 valid Python code you can type at the interpreter, including loops and
951 valid Python code you can type at the interpreter, including loops and
943 compound statements. It is added by IPython to the Python builtin
952 compound statements. It is added by IPython to the Python builtin
944 namespace upon initialization."""
953 namespace upon initialization."""
945
954
946 args = arg_s.split(' ',1)
955 args = arg_s.split(' ',1)
947 alias_name = args[0]
956 alias_name = args[0]
948 try:
957 try:
949 alias_args = args[1]
958 alias_args = args[1]
950 except IndexError:
959 except IndexError:
951 alias_args = ''
960 alias_args = ''
952 if alias_name in self.alias_table:
961 if alias_name in self.alias_table:
953 self.call_alias(alias_name,alias_args)
962 self.call_alias(alias_name,alias_args)
954 else:
963 else:
955 error("Alias `%s` not found." % alias_name)
964 error("Alias `%s` not found." % alias_name)
956
965
957 def ipsystem(self,arg_s):
966 def ipsystem(self,arg_s):
958 """Make a system call, using IPython."""
967 """Make a system call, using IPython."""
959
968
960 self.system(arg_s)
969 self.system(arg_s)
961
970
962 def complete(self,text):
971 def complete(self,text):
963 """Return a sorted list of all possible completions on text.
972 """Return a sorted list of all possible completions on text.
964
973
965 Inputs:
974 Inputs:
966
975
967 - text: a string of text to be completed on.
976 - text: a string of text to be completed on.
968
977
969 This is a wrapper around the completion mechanism, similar to what
978 This is a wrapper around the completion mechanism, similar to what
970 readline does at the command line when the TAB key is hit. By
979 readline does at the command line when the TAB key is hit. By
971 exposing it as a method, it can be used by other non-readline
980 exposing it as a method, it can be used by other non-readline
972 environments (such as GUIs) for text completion.
981 environments (such as GUIs) for text completion.
973
982
974 Simple usage example:
983 Simple usage example:
975
984
976 In [1]: x = 'hello'
985 In [1]: x = 'hello'
977
986
978 In [2]: __IP.complete('x.l')
987 In [2]: __IP.complete('x.l')
979 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
988 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
980
989
981 complete = self.Completer.complete
990 complete = self.Completer.complete
982 state = 0
991 state = 0
983 # use a dict so we get unique keys, since ipyhton's multiple
992 # use a dict so we get unique keys, since ipyhton's multiple
984 # completers can return duplicates. When we make 2.4 a requirement,
993 # completers can return duplicates. When we make 2.4 a requirement,
985 # start using sets instead, which are faster.
994 # start using sets instead, which are faster.
986 comps = {}
995 comps = {}
987 while True:
996 while True:
988 newcomp = complete(text,state,line_buffer=text)
997 newcomp = complete(text,state,line_buffer=text)
989 if newcomp is None:
998 if newcomp is None:
990 break
999 break
991 comps[newcomp] = 1
1000 comps[newcomp] = 1
992 state += 1
1001 state += 1
993 outcomps = comps.keys()
1002 outcomps = comps.keys()
994 outcomps.sort()
1003 outcomps.sort()
995 return outcomps
1004 return outcomps
996
1005
997 def set_completer_frame(self, frame=None):
1006 def set_completer_frame(self, frame=None):
998 if frame:
1007 if frame:
999 self.Completer.namespace = frame.f_locals
1008 self.Completer.namespace = frame.f_locals
1000 self.Completer.global_namespace = frame.f_globals
1009 self.Completer.global_namespace = frame.f_globals
1001 else:
1010 else:
1002 self.Completer.namespace = self.user_ns
1011 self.Completer.namespace = self.user_ns
1003 self.Completer.global_namespace = self.user_global_ns
1012 self.Completer.global_namespace = self.user_global_ns
1004
1013
1005 def init_auto_alias(self):
1014 def init_auto_alias(self):
1006 """Define some aliases automatically.
1015 """Define some aliases automatically.
1007
1016
1008 These are ALL parameter-less aliases"""
1017 These are ALL parameter-less aliases"""
1009
1018
1010 for alias,cmd in self.auto_alias:
1019 for alias,cmd in self.auto_alias:
1011 self.alias_table[alias] = (0,cmd)
1020 self.alias_table[alias] = (0,cmd)
1012
1021
1013 def alias_table_validate(self,verbose=0):
1022 def alias_table_validate(self,verbose=0):
1014 """Update information about the alias table.
1023 """Update information about the alias table.
1015
1024
1016 In particular, make sure no Python keywords/builtins are in it."""
1025 In particular, make sure no Python keywords/builtins are in it."""
1017
1026
1018 no_alias = self.no_alias
1027 no_alias = self.no_alias
1019 for k in self.alias_table.keys():
1028 for k in self.alias_table.keys():
1020 if k in no_alias:
1029 if k in no_alias:
1021 del self.alias_table[k]
1030 del self.alias_table[k]
1022 if verbose:
1031 if verbose:
1023 print ("Deleting alias <%s>, it's a Python "
1032 print ("Deleting alias <%s>, it's a Python "
1024 "keyword or builtin." % k)
1033 "keyword or builtin." % k)
1025
1034
1026 def set_autoindent(self,value=None):
1035 def set_autoindent(self,value=None):
1027 """Set the autoindent flag, checking for readline support.
1036 """Set the autoindent flag, checking for readline support.
1028
1037
1029 If called with no arguments, it acts as a toggle."""
1038 If called with no arguments, it acts as a toggle."""
1030
1039
1031 if not self.has_readline:
1040 if not self.has_readline:
1032 if os.name == 'posix':
1041 if os.name == 'posix':
1033 warn("The auto-indent feature requires the readline library")
1042 warn("The auto-indent feature requires the readline library")
1034 self.autoindent = 0
1043 self.autoindent = 0
1035 return
1044 return
1036 if value is None:
1045 if value is None:
1037 self.autoindent = not self.autoindent
1046 self.autoindent = not self.autoindent
1038 else:
1047 else:
1039 self.autoindent = value
1048 self.autoindent = value
1040
1049
1041 def rc_set_toggle(self,rc_field,value=None):
1050 def rc_set_toggle(self,rc_field,value=None):
1042 """Set or toggle a field in IPython's rc config. structure.
1051 """Set or toggle a field in IPython's rc config. structure.
1043
1052
1044 If called with no arguments, it acts as a toggle.
1053 If called with no arguments, it acts as a toggle.
1045
1054
1046 If called with a non-existent field, the resulting AttributeError
1055 If called with a non-existent field, the resulting AttributeError
1047 exception will propagate out."""
1056 exception will propagate out."""
1048
1057
1049 rc_val = getattr(self.rc,rc_field)
1058 rc_val = getattr(self.rc,rc_field)
1050 if value is None:
1059 if value is None:
1051 value = not rc_val
1060 value = not rc_val
1052 setattr(self.rc,rc_field,value)
1061 setattr(self.rc,rc_field,value)
1053
1062
1054 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1063 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1055 """Install the user configuration directory.
1064 """Install the user configuration directory.
1056
1065
1057 Can be called when running for the first time or to upgrade the user's
1066 Can be called when running for the first time or to upgrade the user's
1058 .ipython/ directory with the mode parameter. Valid modes are 'install'
1067 .ipython/ directory with the mode parameter. Valid modes are 'install'
1059 and 'upgrade'."""
1068 and 'upgrade'."""
1060
1069
1061 def wait():
1070 def wait():
1062 try:
1071 try:
1063 raw_input("Please press <RETURN> to start IPython.")
1072 raw_input("Please press <RETURN> to start IPython.")
1064 except EOFError:
1073 except EOFError:
1065 print >> Term.cout
1074 print >> Term.cout
1066 print '*'*70
1075 print '*'*70
1067
1076
1068 cwd = os.getcwd() # remember where we started
1077 cwd = os.getcwd() # remember where we started
1069 glb = glob.glob
1078 glb = glob.glob
1070 print '*'*70
1079 print '*'*70
1071 if mode == 'install':
1080 if mode == 'install':
1072 print \
1081 print \
1073 """Welcome to IPython. I will try to create a personal configuration directory
1082 """Welcome to IPython. I will try to create a personal configuration directory
1074 where you can customize many aspects of IPython's functionality in:\n"""
1083 where you can customize many aspects of IPython's functionality in:\n"""
1075 else:
1084 else:
1076 print 'I am going to upgrade your configuration in:'
1085 print 'I am going to upgrade your configuration in:'
1077
1086
1078 print ipythondir
1087 print ipythondir
1079
1088
1080 rcdirend = os.path.join('IPython','UserConfig')
1089 rcdirend = os.path.join('IPython','UserConfig')
1081 cfg = lambda d: os.path.join(d,rcdirend)
1090 cfg = lambda d: os.path.join(d,rcdirend)
1082 try:
1091 try:
1083 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1092 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1084 except IOError:
1093 except IOError:
1085 warning = """
1094 warning = """
1086 Installation error. IPython's directory was not found.
1095 Installation error. IPython's directory was not found.
1087
1096
1088 Check the following:
1097 Check the following:
1089
1098
1090 The ipython/IPython directory should be in a directory belonging to your
1099 The ipython/IPython directory should be in a directory belonging to your
1091 PYTHONPATH environment variable (that is, it should be in a directory
1100 PYTHONPATH environment variable (that is, it should be in a directory
1092 belonging to sys.path). You can copy it explicitly there or just link to it.
1101 belonging to sys.path). You can copy it explicitly there or just link to it.
1093
1102
1094 IPython will proceed with builtin defaults.
1103 IPython will proceed with builtin defaults.
1095 """
1104 """
1096 warn(warning)
1105 warn(warning)
1097 wait()
1106 wait()
1098 return
1107 return
1099
1108
1100 if mode == 'install':
1109 if mode == 'install':
1101 try:
1110 try:
1102 shutil.copytree(rcdir,ipythondir)
1111 shutil.copytree(rcdir,ipythondir)
1103 os.chdir(ipythondir)
1112 os.chdir(ipythondir)
1104 rc_files = glb("ipythonrc*")
1113 rc_files = glb("ipythonrc*")
1105 for rc_file in rc_files:
1114 for rc_file in rc_files:
1106 os.rename(rc_file,rc_file+rc_suffix)
1115 os.rename(rc_file,rc_file+rc_suffix)
1107 except:
1116 except:
1108 warning = """
1117 warning = """
1109
1118
1110 There was a problem with the installation:
1119 There was a problem with the installation:
1111 %s
1120 %s
1112 Try to correct it or contact the developers if you think it's a bug.
1121 Try to correct it or contact the developers if you think it's a bug.
1113 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1122 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1114 warn(warning)
1123 warn(warning)
1115 wait()
1124 wait()
1116 return
1125 return
1117
1126
1118 elif mode == 'upgrade':
1127 elif mode == 'upgrade':
1119 try:
1128 try:
1120 os.chdir(ipythondir)
1129 os.chdir(ipythondir)
1121 except:
1130 except:
1122 print """
1131 print """
1123 Can not upgrade: changing to directory %s failed. Details:
1132 Can not upgrade: changing to directory %s failed. Details:
1124 %s
1133 %s
1125 """ % (ipythondir,sys.exc_info()[1])
1134 """ % (ipythondir,sys.exc_info()[1])
1126 wait()
1135 wait()
1127 return
1136 return
1128 else:
1137 else:
1129 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1138 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1130 for new_full_path in sources:
1139 for new_full_path in sources:
1131 new_filename = os.path.basename(new_full_path)
1140 new_filename = os.path.basename(new_full_path)
1132 if new_filename.startswith('ipythonrc'):
1141 if new_filename.startswith('ipythonrc'):
1133 new_filename = new_filename + rc_suffix
1142 new_filename = new_filename + rc_suffix
1134 # The config directory should only contain files, skip any
1143 # The config directory should only contain files, skip any
1135 # directories which may be there (like CVS)
1144 # directories which may be there (like CVS)
1136 if os.path.isdir(new_full_path):
1145 if os.path.isdir(new_full_path):
1137 continue
1146 continue
1138 if os.path.exists(new_filename):
1147 if os.path.exists(new_filename):
1139 old_file = new_filename+'.old'
1148 old_file = new_filename+'.old'
1140 if os.path.exists(old_file):
1149 if os.path.exists(old_file):
1141 os.remove(old_file)
1150 os.remove(old_file)
1142 os.rename(new_filename,old_file)
1151 os.rename(new_filename,old_file)
1143 shutil.copy(new_full_path,new_filename)
1152 shutil.copy(new_full_path,new_filename)
1144 else:
1153 else:
1145 raise ValueError,'unrecognized mode for install:',`mode`
1154 raise ValueError,'unrecognized mode for install:',`mode`
1146
1155
1147 # Fix line-endings to those native to each platform in the config
1156 # Fix line-endings to those native to each platform in the config
1148 # directory.
1157 # directory.
1149 try:
1158 try:
1150 os.chdir(ipythondir)
1159 os.chdir(ipythondir)
1151 except:
1160 except:
1152 print """
1161 print """
1153 Problem: changing to directory %s failed.
1162 Problem: changing to directory %s failed.
1154 Details:
1163 Details:
1155 %s
1164 %s
1156
1165
1157 Some configuration files may have incorrect line endings. This should not
1166 Some configuration files may have incorrect line endings. This should not
1158 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1167 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1159 wait()
1168 wait()
1160 else:
1169 else:
1161 for fname in glb('ipythonrc*'):
1170 for fname in glb('ipythonrc*'):
1162 try:
1171 try:
1163 native_line_ends(fname,backup=0)
1172 native_line_ends(fname,backup=0)
1164 except IOError:
1173 except IOError:
1165 pass
1174 pass
1166
1175
1167 if mode == 'install':
1176 if mode == 'install':
1168 print """
1177 print """
1169 Successful installation!
1178 Successful installation!
1170
1179
1171 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1180 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1172 IPython manual (there are both HTML and PDF versions supplied with the
1181 IPython manual (there are both HTML and PDF versions supplied with the
1173 distribution) to make sure that your system environment is properly configured
1182 distribution) to make sure that your system environment is properly configured
1174 to take advantage of IPython's features.
1183 to take advantage of IPython's features.
1175
1184
1176 Important note: the configuration system has changed! The old system is
1185 Important note: the configuration system has changed! The old system is
1177 still in place, but its setting may be partly overridden by the settings in
1186 still in place, but its setting may be partly overridden by the settings in
1178 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1187 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1179 if some of the new settings bother you.
1188 if some of the new settings bother you.
1180
1189
1181 """
1190 """
1182 else:
1191 else:
1183 print """
1192 print """
1184 Successful upgrade!
1193 Successful upgrade!
1185
1194
1186 All files in your directory:
1195 All files in your directory:
1187 %(ipythondir)s
1196 %(ipythondir)s
1188 which would have been overwritten by the upgrade were backed up with a .old
1197 which would have been overwritten by the upgrade were backed up with a .old
1189 extension. If you had made particular customizations in those files you may
1198 extension. If you had made particular customizations in those files you may
1190 want to merge them back into the new files.""" % locals()
1199 want to merge them back into the new files.""" % locals()
1191 wait()
1200 wait()
1192 os.chdir(cwd)
1201 os.chdir(cwd)
1193 # end user_setup()
1202 # end user_setup()
1194
1203
1195 def atexit_operations(self):
1204 def atexit_operations(self):
1196 """This will be executed at the time of exit.
1205 """This will be executed at the time of exit.
1197
1206
1198 Saving of persistent data should be performed here. """
1207 Saving of persistent data should be performed here. """
1199
1208
1200 #print '*** IPython exit cleanup ***' # dbg
1209 #print '*** IPython exit cleanup ***' # dbg
1201 # input history
1210 # input history
1202 self.savehist()
1211 self.savehist()
1203
1212
1204 # Cleanup all tempfiles left around
1213 # Cleanup all tempfiles left around
1205 for tfile in self.tempfiles:
1214 for tfile in self.tempfiles:
1206 try:
1215 try:
1207 os.unlink(tfile)
1216 os.unlink(tfile)
1208 except OSError:
1217 except OSError:
1209 pass
1218 pass
1210
1219
1211 self.hooks.shutdown_hook()
1220 self.hooks.shutdown_hook()
1212
1221
1213 def savehist(self):
1222 def savehist(self):
1214 """Save input history to a file (via readline library)."""
1223 """Save input history to a file (via readline library)."""
1215 try:
1224 try:
1216 self.readline.write_history_file(self.histfile)
1225 self.readline.write_history_file(self.histfile)
1217 except:
1226 except:
1218 print 'Unable to save IPython command history to file: ' + \
1227 print 'Unable to save IPython command history to file: ' + \
1219 `self.histfile`
1228 `self.histfile`
1220
1229
1221 def reloadhist(self):
1230 def reloadhist(self):
1222 """Reload the input history from disk file."""
1231 """Reload the input history from disk file."""
1223
1232
1224 if self.has_readline:
1233 if self.has_readline:
1225 self.readline.clear_history()
1234 self.readline.clear_history()
1226 self.readline.read_history_file(self.shell.histfile)
1235 self.readline.read_history_file(self.shell.histfile)
1227
1236
1228 def history_saving_wrapper(self, func):
1237 def history_saving_wrapper(self, func):
1229 """ Wrap func for readline history saving
1238 """ Wrap func for readline history saving
1230
1239
1231 Convert func into callable that saves & restores
1240 Convert func into callable that saves & restores
1232 history around the call """
1241 history around the call """
1233
1242
1234 if not self.has_readline:
1243 if not self.has_readline:
1235 return func
1244 return func
1236
1245
1237 def wrapper():
1246 def wrapper():
1238 self.savehist()
1247 self.savehist()
1239 try:
1248 try:
1240 func()
1249 func()
1241 finally:
1250 finally:
1242 readline.read_history_file(self.histfile)
1251 readline.read_history_file(self.histfile)
1243 return wrapper
1252 return wrapper
1244
1253
1245
1254
1246 def pre_readline(self):
1255 def pre_readline(self):
1247 """readline hook to be used at the start of each line.
1256 """readline hook to be used at the start of each line.
1248
1257
1249 Currently it handles auto-indent only."""
1258 Currently it handles auto-indent only."""
1250
1259
1251 #debugx('self.indent_current_nsp','pre_readline:')
1260 #debugx('self.indent_current_nsp','pre_readline:')
1252
1261
1253 if self.rl_do_indent:
1262 if self.rl_do_indent:
1254 self.readline.insert_text(self.indent_current_str())
1263 self.readline.insert_text(self.indent_current_str())
1255 if self.rl_next_input is not None:
1264 if self.rl_next_input is not None:
1256 self.readline.insert_text(self.rl_next_input)
1265 self.readline.insert_text(self.rl_next_input)
1257 self.rl_next_input = None
1266 self.rl_next_input = None
1258
1267
1259 def init_readline(self):
1268 def init_readline(self):
1260 """Command history completion/saving/reloading."""
1269 """Command history completion/saving/reloading."""
1261
1270
1262 import IPython.rlineimpl as readline
1271 import IPython.rlineimpl as readline
1263 if not readline.have_readline:
1272 if not readline.have_readline:
1264 self.has_readline = 0
1273 self.has_readline = 0
1265 self.readline = None
1274 self.readline = None
1266 # no point in bugging windows users with this every time:
1275 # no point in bugging windows users with this every time:
1267 warn('Readline services not available on this platform.')
1276 warn('Readline services not available on this platform.')
1268 else:
1277 else:
1269 sys.modules['readline'] = readline
1278 sys.modules['readline'] = readline
1270 import atexit
1279 import atexit
1271 from IPython.completer import IPCompleter
1280 from IPython.completer import IPCompleter
1272 self.Completer = IPCompleter(self,
1281 self.Completer = IPCompleter(self,
1273 self.user_ns,
1282 self.user_ns,
1274 self.user_global_ns,
1283 self.user_global_ns,
1275 self.rc.readline_omit__names,
1284 self.rc.readline_omit__names,
1276 self.alias_table)
1285 self.alias_table)
1277 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1286 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1278 self.strdispatchers['complete_command'] = sdisp
1287 self.strdispatchers['complete_command'] = sdisp
1279 self.Completer.custom_completers = sdisp
1288 self.Completer.custom_completers = sdisp
1280 # Platform-specific configuration
1289 # Platform-specific configuration
1281 if os.name == 'nt':
1290 if os.name == 'nt':
1282 self.readline_startup_hook = readline.set_pre_input_hook
1291 self.readline_startup_hook = readline.set_pre_input_hook
1283 else:
1292 else:
1284 self.readline_startup_hook = readline.set_startup_hook
1293 self.readline_startup_hook = readline.set_startup_hook
1285
1294
1286 # Load user's initrc file (readline config)
1295 # Load user's initrc file (readline config)
1287 inputrc_name = os.environ.get('INPUTRC')
1296 inputrc_name = os.environ.get('INPUTRC')
1288 if inputrc_name is None:
1297 if inputrc_name is None:
1289 home_dir = get_home_dir()
1298 home_dir = get_home_dir()
1290 if home_dir is not None:
1299 if home_dir is not None:
1291 inputrc_name = os.path.join(home_dir,'.inputrc')
1300 inputrc_name = os.path.join(home_dir,'.inputrc')
1292 if os.path.isfile(inputrc_name):
1301 if os.path.isfile(inputrc_name):
1293 try:
1302 try:
1294 readline.read_init_file(inputrc_name)
1303 readline.read_init_file(inputrc_name)
1295 except:
1304 except:
1296 warn('Problems reading readline initialization file <%s>'
1305 warn('Problems reading readline initialization file <%s>'
1297 % inputrc_name)
1306 % inputrc_name)
1298
1307
1299 self.has_readline = 1
1308 self.has_readline = 1
1300 self.readline = readline
1309 self.readline = readline
1301 # save this in sys so embedded copies can restore it properly
1310 # save this in sys so embedded copies can restore it properly
1302 sys.ipcompleter = self.Completer.complete
1311 sys.ipcompleter = self.Completer.complete
1303 self.set_completer()
1312 self.set_completer()
1304
1313
1305 # Configure readline according to user's prefs
1314 # Configure readline according to user's prefs
1306 for rlcommand in self.rc.readline_parse_and_bind:
1315 for rlcommand in self.rc.readline_parse_and_bind:
1307 readline.parse_and_bind(rlcommand)
1316 readline.parse_and_bind(rlcommand)
1308
1317
1309 # remove some chars from the delimiters list
1318 # remove some chars from the delimiters list
1310 delims = readline.get_completer_delims()
1319 delims = readline.get_completer_delims()
1311 delims = delims.translate(string._idmap,
1320 delims = delims.translate(string._idmap,
1312 self.rc.readline_remove_delims)
1321 self.rc.readline_remove_delims)
1313 readline.set_completer_delims(delims)
1322 readline.set_completer_delims(delims)
1314 # otherwise we end up with a monster history after a while:
1323 # otherwise we end up with a monster history after a while:
1315 readline.set_history_length(1000)
1324 readline.set_history_length(1000)
1316 try:
1325 try:
1317 #print '*** Reading readline history' # dbg
1326 #print '*** Reading readline history' # dbg
1318 readline.read_history_file(self.histfile)
1327 readline.read_history_file(self.histfile)
1319 except IOError:
1328 except IOError:
1320 pass # It doesn't exist yet.
1329 pass # It doesn't exist yet.
1321
1330
1322 atexit.register(self.atexit_operations)
1331 atexit.register(self.atexit_operations)
1323 del atexit
1332 del atexit
1324
1333
1325 # Configure auto-indent for all platforms
1334 # Configure auto-indent for all platforms
1326 self.set_autoindent(self.rc.autoindent)
1335 self.set_autoindent(self.rc.autoindent)
1327
1336
1328 def ask_yes_no(self,prompt,default=True):
1337 def ask_yes_no(self,prompt,default=True):
1329 if self.rc.quiet:
1338 if self.rc.quiet:
1330 return True
1339 return True
1331 return ask_yes_no(prompt,default)
1340 return ask_yes_no(prompt,default)
1332
1341
1333 def _should_recompile(self,e):
1342 def _should_recompile(self,e):
1334 """Utility routine for edit_syntax_error"""
1343 """Utility routine for edit_syntax_error"""
1335
1344
1336 if e.filename in ('<ipython console>','<input>','<string>',
1345 if e.filename in ('<ipython console>','<input>','<string>',
1337 '<console>','<BackgroundJob compilation>',
1346 '<console>','<BackgroundJob compilation>',
1338 None):
1347 None):
1339
1348
1340 return False
1349 return False
1341 try:
1350 try:
1342 if (self.rc.autoedit_syntax and
1351 if (self.rc.autoedit_syntax and
1343 not self.ask_yes_no('Return to editor to correct syntax error? '
1352 not self.ask_yes_no('Return to editor to correct syntax error? '
1344 '[Y/n] ','y')):
1353 '[Y/n] ','y')):
1345 return False
1354 return False
1346 except EOFError:
1355 except EOFError:
1347 return False
1356 return False
1348
1357
1349 def int0(x):
1358 def int0(x):
1350 try:
1359 try:
1351 return int(x)
1360 return int(x)
1352 except TypeError:
1361 except TypeError:
1353 return 0
1362 return 0
1354 # always pass integer line and offset values to editor hook
1363 # always pass integer line and offset values to editor hook
1355 self.hooks.fix_error_editor(e.filename,
1364 self.hooks.fix_error_editor(e.filename,
1356 int0(e.lineno),int0(e.offset),e.msg)
1365 int0(e.lineno),int0(e.offset),e.msg)
1357 return True
1366 return True
1358
1367
1359 def edit_syntax_error(self):
1368 def edit_syntax_error(self):
1360 """The bottom half of the syntax error handler called in the main loop.
1369 """The bottom half of the syntax error handler called in the main loop.
1361
1370
1362 Loop until syntax error is fixed or user cancels.
1371 Loop until syntax error is fixed or user cancels.
1363 """
1372 """
1364
1373
1365 while self.SyntaxTB.last_syntax_error:
1374 while self.SyntaxTB.last_syntax_error:
1366 # copy and clear last_syntax_error
1375 # copy and clear last_syntax_error
1367 err = self.SyntaxTB.clear_err_state()
1376 err = self.SyntaxTB.clear_err_state()
1368 if not self._should_recompile(err):
1377 if not self._should_recompile(err):
1369 return
1378 return
1370 try:
1379 try:
1371 # may set last_syntax_error again if a SyntaxError is raised
1380 # may set last_syntax_error again if a SyntaxError is raised
1372 self.safe_execfile(err.filename,self.user_ns)
1381 self.safe_execfile(err.filename,self.user_ns)
1373 except:
1382 except:
1374 self.showtraceback()
1383 self.showtraceback()
1375 else:
1384 else:
1376 try:
1385 try:
1377 f = file(err.filename)
1386 f = file(err.filename)
1378 try:
1387 try:
1379 sys.displayhook(f.read())
1388 sys.displayhook(f.read())
1380 finally:
1389 finally:
1381 f.close()
1390 f.close()
1382 except:
1391 except:
1383 self.showtraceback()
1392 self.showtraceback()
1384
1393
1385 def showsyntaxerror(self, filename=None):
1394 def showsyntaxerror(self, filename=None):
1386 """Display the syntax error that just occurred.
1395 """Display the syntax error that just occurred.
1387
1396
1388 This doesn't display a stack trace because there isn't one.
1397 This doesn't display a stack trace because there isn't one.
1389
1398
1390 If a filename is given, it is stuffed in the exception instead
1399 If a filename is given, it is stuffed in the exception instead
1391 of what was there before (because Python's parser always uses
1400 of what was there before (because Python's parser always uses
1392 "<string>" when reading from a string).
1401 "<string>" when reading from a string).
1393 """
1402 """
1394 etype, value, last_traceback = sys.exc_info()
1403 etype, value, last_traceback = sys.exc_info()
1395
1404
1396 # See note about these variables in showtraceback() below
1405 # See note about these variables in showtraceback() below
1397 sys.last_type = etype
1406 sys.last_type = etype
1398 sys.last_value = value
1407 sys.last_value = value
1399 sys.last_traceback = last_traceback
1408 sys.last_traceback = last_traceback
1400
1409
1401 if filename and etype is SyntaxError:
1410 if filename and etype is SyntaxError:
1402 # Work hard to stuff the correct filename in the exception
1411 # Work hard to stuff the correct filename in the exception
1403 try:
1412 try:
1404 msg, (dummy_filename, lineno, offset, line) = value
1413 msg, (dummy_filename, lineno, offset, line) = value
1405 except:
1414 except:
1406 # Not the format we expect; leave it alone
1415 # Not the format we expect; leave it alone
1407 pass
1416 pass
1408 else:
1417 else:
1409 # Stuff in the right filename
1418 # Stuff in the right filename
1410 try:
1419 try:
1411 # Assume SyntaxError is a class exception
1420 # Assume SyntaxError is a class exception
1412 value = SyntaxError(msg, (filename, lineno, offset, line))
1421 value = SyntaxError(msg, (filename, lineno, offset, line))
1413 except:
1422 except:
1414 # If that failed, assume SyntaxError is a string
1423 # If that failed, assume SyntaxError is a string
1415 value = msg, (filename, lineno, offset, line)
1424 value = msg, (filename, lineno, offset, line)
1416 self.SyntaxTB(etype,value,[])
1425 self.SyntaxTB(etype,value,[])
1417
1426
1418 def debugger(self,force=False):
1427 def debugger(self,force=False):
1419 """Call the pydb/pdb debugger.
1428 """Call the pydb/pdb debugger.
1420
1429
1421 Keywords:
1430 Keywords:
1422
1431
1423 - force(False): by default, this routine checks the instance call_pdb
1432 - force(False): by default, this routine checks the instance call_pdb
1424 flag and does not actually invoke the debugger if the flag is false.
1433 flag and does not actually invoke the debugger if the flag is false.
1425 The 'force' option forces the debugger to activate even if the flag
1434 The 'force' option forces the debugger to activate even if the flag
1426 is false.
1435 is false.
1427 """
1436 """
1428
1437
1429 if not (force or self.call_pdb):
1438 if not (force or self.call_pdb):
1430 return
1439 return
1431
1440
1432 if not hasattr(sys,'last_traceback'):
1441 if not hasattr(sys,'last_traceback'):
1433 error('No traceback has been produced, nothing to debug.')
1442 error('No traceback has been produced, nothing to debug.')
1434 return
1443 return
1435
1444
1436 # use pydb if available
1445 # use pydb if available
1437 if Debugger.has_pydb:
1446 if Debugger.has_pydb:
1438 from pydb import pm
1447 from pydb import pm
1439 else:
1448 else:
1440 # fallback to our internal debugger
1449 # fallback to our internal debugger
1441 pm = lambda : self.InteractiveTB.debugger(force=True)
1450 pm = lambda : self.InteractiveTB.debugger(force=True)
1442 self.history_saving_wrapper(pm)()
1451 self.history_saving_wrapper(pm)()
1443
1452
1444 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1453 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1445 """Display the exception that just occurred.
1454 """Display the exception that just occurred.
1446
1455
1447 If nothing is known about the exception, this is the method which
1456 If nothing is known about the exception, this is the method which
1448 should be used throughout the code for presenting user tracebacks,
1457 should be used throughout the code for presenting user tracebacks,
1449 rather than directly invoking the InteractiveTB object.
1458 rather than directly invoking the InteractiveTB object.
1450
1459
1451 A specific showsyntaxerror() also exists, but this method can take
1460 A specific showsyntaxerror() also exists, but this method can take
1452 care of calling it if needed, so unless you are explicitly catching a
1461 care of calling it if needed, so unless you are explicitly catching a
1453 SyntaxError exception, don't try to analyze the stack manually and
1462 SyntaxError exception, don't try to analyze the stack manually and
1454 simply call this method."""
1463 simply call this method."""
1455
1464
1456
1465
1457 # Though this won't be called by syntax errors in the input line,
1466 # Though this won't be called by syntax errors in the input line,
1458 # there may be SyntaxError cases whith imported code.
1467 # there may be SyntaxError cases whith imported code.
1459
1468
1460
1469
1461 if exc_tuple is None:
1470 if exc_tuple is None:
1462 etype, value, tb = sys.exc_info()
1471 etype, value, tb = sys.exc_info()
1463 else:
1472 else:
1464 etype, value, tb = exc_tuple
1473 etype, value, tb = exc_tuple
1465
1474
1466 if etype is SyntaxError:
1475 if etype is SyntaxError:
1467 self.showsyntaxerror(filename)
1476 self.showsyntaxerror(filename)
1468 else:
1477 else:
1469 # WARNING: these variables are somewhat deprecated and not
1478 # WARNING: these variables are somewhat deprecated and not
1470 # necessarily safe to use in a threaded environment, but tools
1479 # necessarily safe to use in a threaded environment, but tools
1471 # like pdb depend on their existence, so let's set them. If we
1480 # like pdb depend on their existence, so let's set them. If we
1472 # find problems in the field, we'll need to revisit their use.
1481 # find problems in the field, we'll need to revisit their use.
1473 sys.last_type = etype
1482 sys.last_type = etype
1474 sys.last_value = value
1483 sys.last_value = value
1475 sys.last_traceback = tb
1484 sys.last_traceback = tb
1476
1485
1477 if etype in self.custom_exceptions:
1486 if etype in self.custom_exceptions:
1478 self.CustomTB(etype,value,tb)
1487 self.CustomTB(etype,value,tb)
1479 else:
1488 else:
1480 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1489 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1481 if self.InteractiveTB.call_pdb and self.has_readline:
1490 if self.InteractiveTB.call_pdb and self.has_readline:
1482 # pdb mucks up readline, fix it back
1491 # pdb mucks up readline, fix it back
1483 self.set_completer()
1492 self.set_completer()
1484
1493
1485
1494
1486 def mainloop(self,banner=None):
1495 def mainloop(self,banner=None):
1487 """Creates the local namespace and starts the mainloop.
1496 """Creates the local namespace and starts the mainloop.
1488
1497
1489 If an optional banner argument is given, it will override the
1498 If an optional banner argument is given, it will override the
1490 internally created default banner."""
1499 internally created default banner."""
1491
1500
1492 if self.rc.c: # Emulate Python's -c option
1501 if self.rc.c: # Emulate Python's -c option
1493 self.exec_init_cmd()
1502 self.exec_init_cmd()
1494 if banner is None:
1503 if banner is None:
1495 if not self.rc.banner:
1504 if not self.rc.banner:
1496 banner = ''
1505 banner = ''
1497 # banner is string? Use it directly!
1506 # banner is string? Use it directly!
1498 elif isinstance(self.rc.banner,basestring):
1507 elif isinstance(self.rc.banner,basestring):
1499 banner = self.rc.banner
1508 banner = self.rc.banner
1500 else:
1509 else:
1501 banner = self.BANNER+self.banner2
1510 banner = self.BANNER+self.banner2
1502
1511
1503 self.interact(banner)
1512 self.interact(banner)
1504
1513
1505 def exec_init_cmd(self):
1514 def exec_init_cmd(self):
1506 """Execute a command given at the command line.
1515 """Execute a command given at the command line.
1507
1516
1508 This emulates Python's -c option."""
1517 This emulates Python's -c option."""
1509
1518
1510 #sys.argv = ['-c']
1519 #sys.argv = ['-c']
1511 self.push(self.prefilter(self.rc.c, False))
1520 self.push(self.prefilter(self.rc.c, False))
1512 self.exit_now = True
1521 self.exit_now = True
1513
1522
1514 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1523 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1515 """Embeds IPython into a running python program.
1524 """Embeds IPython into a running python program.
1516
1525
1517 Input:
1526 Input:
1518
1527
1519 - header: An optional header message can be specified.
1528 - header: An optional header message can be specified.
1520
1529
1521 - local_ns, global_ns: working namespaces. If given as None, the
1530 - local_ns, global_ns: working namespaces. If given as None, the
1522 IPython-initialized one is updated with __main__.__dict__, so that
1531 IPython-initialized one is updated with __main__.__dict__, so that
1523 program variables become visible but user-specific configuration
1532 program variables become visible but user-specific configuration
1524 remains possible.
1533 remains possible.
1525
1534
1526 - stack_depth: specifies how many levels in the stack to go to
1535 - stack_depth: specifies how many levels in the stack to go to
1527 looking for namespaces (when local_ns and global_ns are None). This
1536 looking for namespaces (when local_ns and global_ns are None). This
1528 allows an intermediate caller to make sure that this function gets
1537 allows an intermediate caller to make sure that this function gets
1529 the namespace from the intended level in the stack. By default (0)
1538 the namespace from the intended level in the stack. By default (0)
1530 it will get its locals and globals from the immediate caller.
1539 it will get its locals and globals from the immediate caller.
1531
1540
1532 Warning: it's possible to use this in a program which is being run by
1541 Warning: it's possible to use this in a program which is being run by
1533 IPython itself (via %run), but some funny things will happen (a few
1542 IPython itself (via %run), but some funny things will happen (a few
1534 globals get overwritten). In the future this will be cleaned up, as
1543 globals get overwritten). In the future this will be cleaned up, as
1535 there is no fundamental reason why it can't work perfectly."""
1544 there is no fundamental reason why it can't work perfectly."""
1536
1545
1537 # Get locals and globals from caller
1546 # Get locals and globals from caller
1538 if local_ns is None or global_ns is None:
1547 if local_ns is None or global_ns is None:
1539 call_frame = sys._getframe(stack_depth).f_back
1548 call_frame = sys._getframe(stack_depth).f_back
1540
1549
1541 if local_ns is None:
1550 if local_ns is None:
1542 local_ns = call_frame.f_locals
1551 local_ns = call_frame.f_locals
1543 if global_ns is None:
1552 if global_ns is None:
1544 global_ns = call_frame.f_globals
1553 global_ns = call_frame.f_globals
1545
1554
1546 # Update namespaces and fire up interpreter
1555 # Update namespaces and fire up interpreter
1547
1556
1548 # The global one is easy, we can just throw it in
1557 # The global one is easy, we can just throw it in
1549 self.user_global_ns = global_ns
1558 self.user_global_ns = global_ns
1550
1559
1551 # but the user/local one is tricky: ipython needs it to store internal
1560 # but the user/local one is tricky: ipython needs it to store internal
1552 # data, but we also need the locals. We'll copy locals in the user
1561 # data, but we also need the locals. We'll copy locals in the user
1553 # one, but will track what got copied so we can delete them at exit.
1562 # one, but will track what got copied so we can delete them at exit.
1554 # This is so that a later embedded call doesn't see locals from a
1563 # This is so that a later embedded call doesn't see locals from a
1555 # previous call (which most likely existed in a separate scope).
1564 # previous call (which most likely existed in a separate scope).
1556 local_varnames = local_ns.keys()
1565 local_varnames = local_ns.keys()
1557 self.user_ns.update(local_ns)
1566 self.user_ns.update(local_ns)
1558
1567
1559 # Patch for global embedding to make sure that things don't overwrite
1568 # Patch for global embedding to make sure that things don't overwrite
1560 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1569 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1561 # FIXME. Test this a bit more carefully (the if.. is new)
1570 # FIXME. Test this a bit more carefully (the if.. is new)
1562 if local_ns is None and global_ns is None:
1571 if local_ns is None and global_ns is None:
1563 self.user_global_ns.update(__main__.__dict__)
1572 self.user_global_ns.update(__main__.__dict__)
1564
1573
1565 # make sure the tab-completer has the correct frame information, so it
1574 # make sure the tab-completer has the correct frame information, so it
1566 # actually completes using the frame's locals/globals
1575 # actually completes using the frame's locals/globals
1567 self.set_completer_frame()
1576 self.set_completer_frame()
1568
1577
1569 # before activating the interactive mode, we need to make sure that
1578 # before activating the interactive mode, we need to make sure that
1570 # all names in the builtin namespace needed by ipython point to
1579 # all names in the builtin namespace needed by ipython point to
1571 # ourselves, and not to other instances.
1580 # ourselves, and not to other instances.
1572 self.add_builtins()
1581 self.add_builtins()
1573
1582
1574 self.interact(header)
1583 self.interact(header)
1575
1584
1576 # now, purge out the user namespace from anything we might have added
1585 # now, purge out the user namespace from anything we might have added
1577 # from the caller's local namespace
1586 # from the caller's local namespace
1578 delvar = self.user_ns.pop
1587 delvar = self.user_ns.pop
1579 for var in local_varnames:
1588 for var in local_varnames:
1580 delvar(var,None)
1589 delvar(var,None)
1581 # and clean builtins we may have overridden
1590 # and clean builtins we may have overridden
1582 self.clean_builtins()
1591 self.clean_builtins()
1583
1592
1584 def interact(self, banner=None):
1593 def interact(self, banner=None):
1585 """Closely emulate the interactive Python console.
1594 """Closely emulate the interactive Python console.
1586
1595
1587 The optional banner argument specify the banner to print
1596 The optional banner argument specify the banner to print
1588 before the first interaction; by default it prints a banner
1597 before the first interaction; by default it prints a banner
1589 similar to the one printed by the real Python interpreter,
1598 similar to the one printed by the real Python interpreter,
1590 followed by the current class name in parentheses (so as not
1599 followed by the current class name in parentheses (so as not
1591 to confuse this with the real interpreter -- since it's so
1600 to confuse this with the real interpreter -- since it's so
1592 close!).
1601 close!).
1593
1602
1594 """
1603 """
1595
1604
1596 if self.exit_now:
1605 if self.exit_now:
1597 # batch run -> do not interact
1606 # batch run -> do not interact
1598 return
1607 return
1599 cprt = 'Type "copyright", "credits" or "license" for more information.'
1608 cprt = 'Type "copyright", "credits" or "license" for more information.'
1600 if banner is None:
1609 if banner is None:
1601 self.write("Python %s on %s\n%s\n(%s)\n" %
1610 self.write("Python %s on %s\n%s\n(%s)\n" %
1602 (sys.version, sys.platform, cprt,
1611 (sys.version, sys.platform, cprt,
1603 self.__class__.__name__))
1612 self.__class__.__name__))
1604 else:
1613 else:
1605 self.write(banner)
1614 self.write(banner)
1606
1615
1607 more = 0
1616 more = 0
1608
1617
1609 # Mark activity in the builtins
1618 # Mark activity in the builtins
1610 __builtin__.__dict__['__IPYTHON__active'] += 1
1619 __builtin__.__dict__['__IPYTHON__active'] += 1
1611
1620
1612 if readline.have_readline:
1621 if readline.have_readline:
1613 self.readline_startup_hook(self.pre_readline)
1622 self.readline_startup_hook(self.pre_readline)
1614 # exit_now is set by a call to %Exit or %Quit
1623 # exit_now is set by a call to %Exit or %Quit
1615
1624
1616 while not self.exit_now:
1625 while not self.exit_now:
1617 if more:
1626 if more:
1618 prompt = self.hooks.generate_prompt(True)
1627 prompt = self.hooks.generate_prompt(True)
1619 if self.autoindent:
1628 if self.autoindent:
1620 self.rl_do_indent = True
1629 self.rl_do_indent = True
1621
1630
1622 else:
1631 else:
1623 prompt = self.hooks.generate_prompt(False)
1632 prompt = self.hooks.generate_prompt(False)
1624 try:
1633 try:
1625 line = self.raw_input(prompt,more)
1634 line = self.raw_input(prompt,more)
1626 if self.exit_now:
1635 if self.exit_now:
1627 # quick exit on sys.std[in|out] close
1636 # quick exit on sys.std[in|out] close
1628 break
1637 break
1629 if self.autoindent:
1638 if self.autoindent:
1630 self.rl_do_indent = False
1639 self.rl_do_indent = False
1631
1640
1632 except KeyboardInterrupt:
1641 except KeyboardInterrupt:
1633 self.write('\nKeyboardInterrupt\n')
1642 self.write('\nKeyboardInterrupt\n')
1634 self.resetbuffer()
1643 self.resetbuffer()
1635 # keep cache in sync with the prompt counter:
1644 # keep cache in sync with the prompt counter:
1636 self.outputcache.prompt_count -= 1
1645 self.outputcache.prompt_count -= 1
1637
1646
1638 if self.autoindent:
1647 if self.autoindent:
1639 self.indent_current_nsp = 0
1648 self.indent_current_nsp = 0
1640 more = 0
1649 more = 0
1641 except EOFError:
1650 except EOFError:
1642 if self.autoindent:
1651 if self.autoindent:
1643 self.rl_do_indent = False
1652 self.rl_do_indent = False
1644 self.readline_startup_hook(None)
1653 self.readline_startup_hook(None)
1645 self.write('\n')
1654 self.write('\n')
1646 self.exit()
1655 self.exit()
1647 except bdb.BdbQuit:
1656 except bdb.BdbQuit:
1648 warn('The Python debugger has exited with a BdbQuit exception.\n'
1657 warn('The Python debugger has exited with a BdbQuit exception.\n'
1649 'Because of how pdb handles the stack, it is impossible\n'
1658 'Because of how pdb handles the stack, it is impossible\n'
1650 'for IPython to properly format this particular exception.\n'
1659 'for IPython to properly format this particular exception.\n'
1651 'IPython will resume normal operation.')
1660 'IPython will resume normal operation.')
1652 except:
1661 except:
1653 # exceptions here are VERY RARE, but they can be triggered
1662 # exceptions here are VERY RARE, but they can be triggered
1654 # asynchronously by signal handlers, for example.
1663 # asynchronously by signal handlers, for example.
1655 self.showtraceback()
1664 self.showtraceback()
1656 else:
1665 else:
1657 more = self.push(line)
1666 more = self.push(line)
1658 if (self.SyntaxTB.last_syntax_error and
1667 if (self.SyntaxTB.last_syntax_error and
1659 self.rc.autoedit_syntax):
1668 self.rc.autoedit_syntax):
1660 self.edit_syntax_error()
1669 self.edit_syntax_error()
1661
1670
1662 # We are off again...
1671 # We are off again...
1663 __builtin__.__dict__['__IPYTHON__active'] -= 1
1672 __builtin__.__dict__['__IPYTHON__active'] -= 1
1664
1673
1665 def excepthook(self, etype, value, tb):
1674 def excepthook(self, etype, value, tb):
1666 """One more defense for GUI apps that call sys.excepthook.
1675 """One more defense for GUI apps that call sys.excepthook.
1667
1676
1668 GUI frameworks like wxPython trap exceptions and call
1677 GUI frameworks like wxPython trap exceptions and call
1669 sys.excepthook themselves. I guess this is a feature that
1678 sys.excepthook themselves. I guess this is a feature that
1670 enables them to keep running after exceptions that would
1679 enables them to keep running after exceptions that would
1671 otherwise kill their mainloop. This is a bother for IPython
1680 otherwise kill their mainloop. This is a bother for IPython
1672 which excepts to catch all of the program exceptions with a try:
1681 which excepts to catch all of the program exceptions with a try:
1673 except: statement.
1682 except: statement.
1674
1683
1675 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1684 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1676 any app directly invokes sys.excepthook, it will look to the user like
1685 any app directly invokes sys.excepthook, it will look to the user like
1677 IPython crashed. In order to work around this, we can disable the
1686 IPython crashed. In order to work around this, we can disable the
1678 CrashHandler and replace it with this excepthook instead, which prints a
1687 CrashHandler and replace it with this excepthook instead, which prints a
1679 regular traceback using our InteractiveTB. In this fashion, apps which
1688 regular traceback using our InteractiveTB. In this fashion, apps which
1680 call sys.excepthook will generate a regular-looking exception from
1689 call sys.excepthook will generate a regular-looking exception from
1681 IPython, and the CrashHandler will only be triggered by real IPython
1690 IPython, and the CrashHandler will only be triggered by real IPython
1682 crashes.
1691 crashes.
1683
1692
1684 This hook should be used sparingly, only in places which are not likely
1693 This hook should be used sparingly, only in places which are not likely
1685 to be true IPython errors.
1694 to be true IPython errors.
1686 """
1695 """
1687 self.showtraceback((etype,value,tb),tb_offset=0)
1696 self.showtraceback((etype,value,tb),tb_offset=0)
1688
1697
1689 def expand_aliases(self,fn,rest):
1698 def expand_aliases(self,fn,rest):
1690 """ Expand multiple levels of aliases:
1699 """ Expand multiple levels of aliases:
1691
1700
1692 if:
1701 if:
1693
1702
1694 alias foo bar /tmp
1703 alias foo bar /tmp
1695 alias baz foo
1704 alias baz foo
1696
1705
1697 then:
1706 then:
1698
1707
1699 baz huhhahhei -> bar /tmp huhhahhei
1708 baz huhhahhei -> bar /tmp huhhahhei
1700
1709
1701 """
1710 """
1702 line = fn + " " + rest
1711 line = fn + " " + rest
1703
1712
1704 done = Set()
1713 done = Set()
1705 while 1:
1714 while 1:
1706 pre,fn,rest = prefilter.splitUserInput(line,
1715 pre,fn,rest = prefilter.splitUserInput(line,
1707 prefilter.shell_line_split)
1716 prefilter.shell_line_split)
1708 if fn in self.alias_table:
1717 if fn in self.alias_table:
1709 if fn in done:
1718 if fn in done:
1710 warn("Cyclic alias definition, repeated '%s'" % fn)
1719 warn("Cyclic alias definition, repeated '%s'" % fn)
1711 return ""
1720 return ""
1712 done.add(fn)
1721 done.add(fn)
1713
1722
1714 l2 = self.transform_alias(fn,rest)
1723 l2 = self.transform_alias(fn,rest)
1715 # dir -> dir
1724 # dir -> dir
1716 # print "alias",line, "->",l2 #dbg
1725 # print "alias",line, "->",l2 #dbg
1717 if l2 == line:
1726 if l2 == line:
1718 break
1727 break
1719 # ls -> ls -F should not recurse forever
1728 # ls -> ls -F should not recurse forever
1720 if l2.split(None,1)[0] == line.split(None,1)[0]:
1729 if l2.split(None,1)[0] == line.split(None,1)[0]:
1721 line = l2
1730 line = l2
1722 break
1731 break
1723
1732
1724 line=l2
1733 line=l2
1725
1734
1726
1735
1727 # print "al expand to",line #dbg
1736 # print "al expand to",line #dbg
1728 else:
1737 else:
1729 break
1738 break
1730
1739
1731 return line
1740 return line
1732
1741
1733 def transform_alias(self, alias,rest=''):
1742 def transform_alias(self, alias,rest=''):
1734 """ Transform alias to system command string.
1743 """ Transform alias to system command string.
1735 """
1744 """
1736 nargs,cmd = self.alias_table[alias]
1745 nargs,cmd = self.alias_table[alias]
1737 if ' ' in cmd and os.path.isfile(cmd):
1746 if ' ' in cmd and os.path.isfile(cmd):
1738 cmd = '"%s"' % cmd
1747 cmd = '"%s"' % cmd
1739
1748
1740 # Expand the %l special to be the user's input line
1749 # Expand the %l special to be the user's input line
1741 if cmd.find('%l') >= 0:
1750 if cmd.find('%l') >= 0:
1742 cmd = cmd.replace('%l',rest)
1751 cmd = cmd.replace('%l',rest)
1743 rest = ''
1752 rest = ''
1744 if nargs==0:
1753 if nargs==0:
1745 # Simple, argument-less aliases
1754 # Simple, argument-less aliases
1746 cmd = '%s %s' % (cmd,rest)
1755 cmd = '%s %s' % (cmd,rest)
1747 else:
1756 else:
1748 # Handle aliases with positional arguments
1757 # Handle aliases with positional arguments
1749 args = rest.split(None,nargs)
1758 args = rest.split(None,nargs)
1750 if len(args)< nargs:
1759 if len(args)< nargs:
1751 error('Alias <%s> requires %s arguments, %s given.' %
1760 error('Alias <%s> requires %s arguments, %s given.' %
1752 (alias,nargs,len(args)))
1761 (alias,nargs,len(args)))
1753 return None
1762 return None
1754 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1763 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1755 # Now call the macro, evaluating in the user's namespace
1764 # Now call the macro, evaluating in the user's namespace
1756 #print 'new command: <%r>' % cmd # dbg
1765 #print 'new command: <%r>' % cmd # dbg
1757 return cmd
1766 return cmd
1758
1767
1759 def call_alias(self,alias,rest=''):
1768 def call_alias(self,alias,rest=''):
1760 """Call an alias given its name and the rest of the line.
1769 """Call an alias given its name and the rest of the line.
1761
1770
1762 This is only used to provide backwards compatibility for users of
1771 This is only used to provide backwards compatibility for users of
1763 ipalias(), use of which is not recommended for anymore."""
1772 ipalias(), use of which is not recommended for anymore."""
1764
1773
1765 # Now call the macro, evaluating in the user's namespace
1774 # Now call the macro, evaluating in the user's namespace
1766 cmd = self.transform_alias(alias, rest)
1775 cmd = self.transform_alias(alias, rest)
1767 try:
1776 try:
1768 self.system(cmd)
1777 self.system(cmd)
1769 except:
1778 except:
1770 self.showtraceback()
1779 self.showtraceback()
1771
1780
1772 def indent_current_str(self):
1781 def indent_current_str(self):
1773 """return the current level of indentation as a string"""
1782 """return the current level of indentation as a string"""
1774 return self.indent_current_nsp * ' '
1783 return self.indent_current_nsp * ' '
1775
1784
1776 def autoindent_update(self,line):
1785 def autoindent_update(self,line):
1777 """Keep track of the indent level."""
1786 """Keep track of the indent level."""
1778
1787
1779 #debugx('line')
1788 #debugx('line')
1780 #debugx('self.indent_current_nsp')
1789 #debugx('self.indent_current_nsp')
1781 if self.autoindent:
1790 if self.autoindent:
1782 if line:
1791 if line:
1783 inisp = num_ini_spaces(line)
1792 inisp = num_ini_spaces(line)
1784 if inisp < self.indent_current_nsp:
1793 if inisp < self.indent_current_nsp:
1785 self.indent_current_nsp = inisp
1794 self.indent_current_nsp = inisp
1786
1795
1787 if line[-1] == ':':
1796 if line[-1] == ':':
1788 self.indent_current_nsp += 4
1797 self.indent_current_nsp += 4
1789 elif dedent_re.match(line):
1798 elif dedent_re.match(line):
1790 self.indent_current_nsp -= 4
1799 self.indent_current_nsp -= 4
1791 else:
1800 else:
1792 self.indent_current_nsp = 0
1801 self.indent_current_nsp = 0
1793 def runlines(self,lines):
1802 def runlines(self,lines):
1794 """Run a string of one or more lines of source.
1803 """Run a string of one or more lines of source.
1795
1804
1796 This method is capable of running a string containing multiple source
1805 This method is capable of running a string containing multiple source
1797 lines, as if they had been entered at the IPython prompt. Since it
1806 lines, as if they had been entered at the IPython prompt. Since it
1798 exposes IPython's processing machinery, the given strings can contain
1807 exposes IPython's processing machinery, the given strings can contain
1799 magic calls (%magic), special shell access (!cmd), etc."""
1808 magic calls (%magic), special shell access (!cmd), etc."""
1800
1809
1801 # We must start with a clean buffer, in case this is run from an
1810 # We must start with a clean buffer, in case this is run from an
1802 # interactive IPython session (via a magic, for example).
1811 # interactive IPython session (via a magic, for example).
1803 self.resetbuffer()
1812 self.resetbuffer()
1804 lines = lines.split('\n')
1813 lines = lines.split('\n')
1805 more = 0
1814 more = 0
1806
1815
1807 for line in lines:
1816 for line in lines:
1808 # skip blank lines so we don't mess up the prompt counter, but do
1817 # skip blank lines so we don't mess up the prompt counter, but do
1809 # NOT skip even a blank line if we are in a code block (more is
1818 # NOT skip even a blank line if we are in a code block (more is
1810 # true)
1819 # true)
1811
1820
1812
1821
1813 if line or more:
1822 if line or more:
1814 # push to raw history, so hist line numbers stay in sync
1823 # push to raw history, so hist line numbers stay in sync
1815 self.input_hist_raw.append("# " + line + "\n")
1824 self.input_hist_raw.append("# " + line + "\n")
1816 more = self.push(self.prefilter(line,more))
1825 more = self.push(self.prefilter(line,more))
1817 # IPython's runsource returns None if there was an error
1826 # IPython's runsource returns None if there was an error
1818 # compiling the code. This allows us to stop processing right
1827 # compiling the code. This allows us to stop processing right
1819 # away, so the user gets the error message at the right place.
1828 # away, so the user gets the error message at the right place.
1820 if more is None:
1829 if more is None:
1821 break
1830 break
1822 else:
1831 else:
1823 self.input_hist_raw.append("\n")
1832 self.input_hist_raw.append("\n")
1824 # final newline in case the input didn't have it, so that the code
1833 # final newline in case the input didn't have it, so that the code
1825 # actually does get executed
1834 # actually does get executed
1826 if more:
1835 if more:
1827 self.push('\n')
1836 self.push('\n')
1828
1837
1829 def runsource(self, source, filename='<input>', symbol='single'):
1838 def runsource(self, source, filename='<input>', symbol='single'):
1830 """Compile and run some source in the interpreter.
1839 """Compile and run some source in the interpreter.
1831
1840
1832 Arguments are as for compile_command().
1841 Arguments are as for compile_command().
1833
1842
1834 One several things can happen:
1843 One several things can happen:
1835
1844
1836 1) The input is incorrect; compile_command() raised an
1845 1) The input is incorrect; compile_command() raised an
1837 exception (SyntaxError or OverflowError). A syntax traceback
1846 exception (SyntaxError or OverflowError). A syntax traceback
1838 will be printed by calling the showsyntaxerror() method.
1847 will be printed by calling the showsyntaxerror() method.
1839
1848
1840 2) The input is incomplete, and more input is required;
1849 2) The input is incomplete, and more input is required;
1841 compile_command() returned None. Nothing happens.
1850 compile_command() returned None. Nothing happens.
1842
1851
1843 3) The input is complete; compile_command() returned a code
1852 3) The input is complete; compile_command() returned a code
1844 object. The code is executed by calling self.runcode() (which
1853 object. The code is executed by calling self.runcode() (which
1845 also handles run-time exceptions, except for SystemExit).
1854 also handles run-time exceptions, except for SystemExit).
1846
1855
1847 The return value is:
1856 The return value is:
1848
1857
1849 - True in case 2
1858 - True in case 2
1850
1859
1851 - False in the other cases, unless an exception is raised, where
1860 - False in the other cases, unless an exception is raised, where
1852 None is returned instead. This can be used by external callers to
1861 None is returned instead. This can be used by external callers to
1853 know whether to continue feeding input or not.
1862 know whether to continue feeding input or not.
1854
1863
1855 The return value can be used to decide whether to use sys.ps1 or
1864 The return value can be used to decide whether to use sys.ps1 or
1856 sys.ps2 to prompt the next line."""
1865 sys.ps2 to prompt the next line."""
1857
1866
1858 # if the source code has leading blanks, add 'if 1:\n' to it
1867 # if the source code has leading blanks, add 'if 1:\n' to it
1859 # this allows execution of indented pasted code. It is tempting
1868 # this allows execution of indented pasted code. It is tempting
1860 # to add '\n' at the end of source to run commands like ' a=1'
1869 # to add '\n' at the end of source to run commands like ' a=1'
1861 # directly, but this fails for more complicated scenarios
1870 # directly, but this fails for more complicated scenarios
1862 if source[:1] in [' ', '\t']:
1871 if source[:1] in [' ', '\t']:
1863 source = 'if 1:\n%s' % source
1872 source = 'if 1:\n%s' % source
1864
1873
1865 try:
1874 try:
1866 code = self.compile(source,filename,symbol)
1875 code = self.compile(source,filename,symbol)
1867 except (OverflowError, SyntaxError, ValueError):
1876 except (OverflowError, SyntaxError, ValueError):
1868 # Case 1
1877 # Case 1
1869 self.showsyntaxerror(filename)
1878 self.showsyntaxerror(filename)
1870 return None
1879 return None
1871
1880
1872 if code is None:
1881 if code is None:
1873 # Case 2
1882 # Case 2
1874 return True
1883 return True
1875
1884
1876 # Case 3
1885 # Case 3
1877 # We store the code object so that threaded shells and
1886 # We store the code object so that threaded shells and
1878 # custom exception handlers can access all this info if needed.
1887 # custom exception handlers can access all this info if needed.
1879 # The source corresponding to this can be obtained from the
1888 # The source corresponding to this can be obtained from the
1880 # buffer attribute as '\n'.join(self.buffer).
1889 # buffer attribute as '\n'.join(self.buffer).
1881 self.code_to_run = code
1890 self.code_to_run = code
1882 # now actually execute the code object
1891 # now actually execute the code object
1883 if self.runcode(code) == 0:
1892 if self.runcode(code) == 0:
1884 return False
1893 return False
1885 else:
1894 else:
1886 return None
1895 return None
1887
1896
1888 def runcode(self,code_obj):
1897 def runcode(self,code_obj):
1889 """Execute a code object.
1898 """Execute a code object.
1890
1899
1891 When an exception occurs, self.showtraceback() is called to display a
1900 When an exception occurs, self.showtraceback() is called to display a
1892 traceback.
1901 traceback.
1893
1902
1894 Return value: a flag indicating whether the code to be run completed
1903 Return value: a flag indicating whether the code to be run completed
1895 successfully:
1904 successfully:
1896
1905
1897 - 0: successful execution.
1906 - 0: successful execution.
1898 - 1: an error occurred.
1907 - 1: an error occurred.
1899 """
1908 """
1900
1909
1901 # Set our own excepthook in case the user code tries to call it
1910 # Set our own excepthook in case the user code tries to call it
1902 # directly, so that the IPython crash handler doesn't get triggered
1911 # directly, so that the IPython crash handler doesn't get triggered
1903 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1912 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1904
1913
1905 # we save the original sys.excepthook in the instance, in case config
1914 # we save the original sys.excepthook in the instance, in case config
1906 # code (such as magics) needs access to it.
1915 # code (such as magics) needs access to it.
1907 self.sys_excepthook = old_excepthook
1916 self.sys_excepthook = old_excepthook
1908 outflag = 1 # happens in more places, so it's easier as default
1917 outflag = 1 # happens in more places, so it's easier as default
1909 try:
1918 try:
1910 try:
1919 try:
1911 # Embedded instances require separate global/local namespaces
1920 # Embedded instances require separate global/local namespaces
1912 # so they can see both the surrounding (local) namespace and
1921 # so they can see both the surrounding (local) namespace and
1913 # the module-level globals when called inside another function.
1922 # the module-level globals when called inside another function.
1914 if self.embedded:
1923 if self.embedded:
1915 exec code_obj in self.user_global_ns, self.user_ns
1924 exec code_obj in self.user_global_ns, self.user_ns
1916 # Normal (non-embedded) instances should only have a single
1925 # Normal (non-embedded) instances should only have a single
1917 # namespace for user code execution, otherwise functions won't
1926 # namespace for user code execution, otherwise functions won't
1918 # see interactive top-level globals.
1927 # see interactive top-level globals.
1919 else:
1928 else:
1920 exec code_obj in self.user_ns
1929 exec code_obj in self.user_ns
1921 finally:
1930 finally:
1922 # Reset our crash handler in place
1931 # Reset our crash handler in place
1923 sys.excepthook = old_excepthook
1932 sys.excepthook = old_excepthook
1924 except SystemExit:
1933 except SystemExit:
1925 self.resetbuffer()
1934 self.resetbuffer()
1926 self.showtraceback()
1935 self.showtraceback()
1927 warn("Type %exit or %quit to exit IPython "
1936 warn("Type %exit or %quit to exit IPython "
1928 "(%Exit or %Quit do so unconditionally).",level=1)
1937 "(%Exit or %Quit do so unconditionally).",level=1)
1929 except self.custom_exceptions:
1938 except self.custom_exceptions:
1930 etype,value,tb = sys.exc_info()
1939 etype,value,tb = sys.exc_info()
1931 self.CustomTB(etype,value,tb)
1940 self.CustomTB(etype,value,tb)
1932 except:
1941 except:
1933 self.showtraceback()
1942 self.showtraceback()
1934 else:
1943 else:
1935 outflag = 0
1944 outflag = 0
1936 if softspace(sys.stdout, 0):
1945 if softspace(sys.stdout, 0):
1937 print
1946 print
1938 # Flush out code object which has been run (and source)
1947 # Flush out code object which has been run (and source)
1939 self.code_to_run = None
1948 self.code_to_run = None
1940 return outflag
1949 return outflag
1941
1950
1942 def push(self, line):
1951 def push(self, line):
1943 """Push a line to the interpreter.
1952 """Push a line to the interpreter.
1944
1953
1945 The line should not have a trailing newline; it may have
1954 The line should not have a trailing newline; it may have
1946 internal newlines. The line is appended to a buffer and the
1955 internal newlines. The line is appended to a buffer and the
1947 interpreter's runsource() method is called with the
1956 interpreter's runsource() method is called with the
1948 concatenated contents of the buffer as source. If this
1957 concatenated contents of the buffer as source. If this
1949 indicates that the command was executed or invalid, the buffer
1958 indicates that the command was executed or invalid, the buffer
1950 is reset; otherwise, the command is incomplete, and the buffer
1959 is reset; otherwise, the command is incomplete, and the buffer
1951 is left as it was after the line was appended. The return
1960 is left as it was after the line was appended. The return
1952 value is 1 if more input is required, 0 if the line was dealt
1961 value is 1 if more input is required, 0 if the line was dealt
1953 with in some way (this is the same as runsource()).
1962 with in some way (this is the same as runsource()).
1954 """
1963 """
1955
1964
1956 # autoindent management should be done here, and not in the
1965 # autoindent management should be done here, and not in the
1957 # interactive loop, since that one is only seen by keyboard input. We
1966 # interactive loop, since that one is only seen by keyboard input. We
1958 # need this done correctly even for code run via runlines (which uses
1967 # need this done correctly even for code run via runlines (which uses
1959 # push).
1968 # push).
1960
1969
1961 #print 'push line: <%s>' % line # dbg
1970 #print 'push line: <%s>' % line # dbg
1962 for subline in line.splitlines():
1971 for subline in line.splitlines():
1963 self.autoindent_update(subline)
1972 self.autoindent_update(subline)
1964 self.buffer.append(line)
1973 self.buffer.append(line)
1965 more = self.runsource('\n'.join(self.buffer), self.filename)
1974 more = self.runsource('\n'.join(self.buffer), self.filename)
1966 if not more:
1975 if not more:
1967 self.resetbuffer()
1976 self.resetbuffer()
1968 return more
1977 return more
1969
1978
1970 def split_user_input(self, line):
1979 def split_user_input(self, line):
1971 # This is really a hold-over to support ipapi and some extensions
1980 # This is really a hold-over to support ipapi and some extensions
1972 return prefilter.splitUserInput(line)
1981 return prefilter.splitUserInput(line)
1973
1982
1974 def resetbuffer(self):
1983 def resetbuffer(self):
1975 """Reset the input buffer."""
1984 """Reset the input buffer."""
1976 self.buffer[:] = []
1985 self.buffer[:] = []
1977
1986
1978 def raw_input(self,prompt='',continue_prompt=False):
1987 def raw_input(self,prompt='',continue_prompt=False):
1979 """Write a prompt and read a line.
1988 """Write a prompt and read a line.
1980
1989
1981 The returned line does not include the trailing newline.
1990 The returned line does not include the trailing newline.
1982 When the user enters the EOF key sequence, EOFError is raised.
1991 When the user enters the EOF key sequence, EOFError is raised.
1983
1992
1984 Optional inputs:
1993 Optional inputs:
1985
1994
1986 - prompt(''): a string to be printed to prompt the user.
1995 - prompt(''): a string to be printed to prompt the user.
1987
1996
1988 - continue_prompt(False): whether this line is the first one or a
1997 - continue_prompt(False): whether this line is the first one or a
1989 continuation in a sequence of inputs.
1998 continuation in a sequence of inputs.
1990 """
1999 """
1991
2000
1992 # Code run by the user may have modified the readline completer state.
2001 # Code run by the user may have modified the readline completer state.
1993 # We must ensure that our completer is back in place.
2002 # We must ensure that our completer is back in place.
1994 if self.has_readline:
2003 if self.has_readline:
1995 self.set_completer()
2004 self.set_completer()
1996
2005
1997 try:
2006 try:
1998 line = raw_input_original(prompt).decode(self.stdin_encoding)
2007 line = raw_input_original(prompt).decode(self.stdin_encoding)
1999 except ValueError:
2008 except ValueError:
2000 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
2009 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
2001 " or sys.stdout.close()!\nExiting IPython!")
2010 " or sys.stdout.close()!\nExiting IPython!")
2002 self.exit_now = True
2011 self.exit_now = True
2003 return ""
2012 return ""
2004
2013
2005 # Try to be reasonably smart about not re-indenting pasted input more
2014 # Try to be reasonably smart about not re-indenting pasted input more
2006 # than necessary. We do this by trimming out the auto-indent initial
2015 # than necessary. We do this by trimming out the auto-indent initial
2007 # spaces, if the user's actual input started itself with whitespace.
2016 # spaces, if the user's actual input started itself with whitespace.
2008 #debugx('self.buffer[-1]')
2017 #debugx('self.buffer[-1]')
2009
2018
2010 if self.autoindent:
2019 if self.autoindent:
2011 if num_ini_spaces(line) > self.indent_current_nsp:
2020 if num_ini_spaces(line) > self.indent_current_nsp:
2012 line = line[self.indent_current_nsp:]
2021 line = line[self.indent_current_nsp:]
2013 self.indent_current_nsp = 0
2022 self.indent_current_nsp = 0
2014
2023
2015 # store the unfiltered input before the user has any chance to modify
2024 # store the unfiltered input before the user has any chance to modify
2016 # it.
2025 # it.
2017 if line.strip():
2026 if line.strip():
2018 if continue_prompt:
2027 if continue_prompt:
2019 self.input_hist_raw[-1] += '%s\n' % line
2028 self.input_hist_raw[-1] += '%s\n' % line
2020 if self.has_readline: # and some config option is set?
2029 if self.has_readline: # and some config option is set?
2021 try:
2030 try:
2022 histlen = self.readline.get_current_history_length()
2031 histlen = self.readline.get_current_history_length()
2023 newhist = self.input_hist_raw[-1].rstrip()
2032 newhist = self.input_hist_raw[-1].rstrip()
2024 self.readline.remove_history_item(histlen-1)
2033 self.readline.remove_history_item(histlen-1)
2025 self.readline.replace_history_item(histlen-2,newhist)
2034 self.readline.replace_history_item(histlen-2,newhist)
2026 except AttributeError:
2035 except AttributeError:
2027 pass # re{move,place}_history_item are new in 2.4.
2036 pass # re{move,place}_history_item are new in 2.4.
2028 else:
2037 else:
2029 self.input_hist_raw.append('%s\n' % line)
2038 self.input_hist_raw.append('%s\n' % line)
2030 # only entries starting at first column go to shadow history
2039 # only entries starting at first column go to shadow history
2031 if line.lstrip() == line:
2040 if line.lstrip() == line:
2032 self.shadowhist.add(line.strip())
2041 self.shadowhist.add(line.strip())
2033 else:
2042 else:
2034 self.input_hist_raw.append('\n')
2043 self.input_hist_raw.append('\n')
2035 try:
2044 try:
2036 lineout = self.prefilter(line,continue_prompt)
2045 lineout = self.prefilter(line,continue_prompt)
2037 except:
2046 except:
2038 # blanket except, in case a user-defined prefilter crashes, so it
2047 # blanket except, in case a user-defined prefilter crashes, so it
2039 # can't take all of ipython with it.
2048 # can't take all of ipython with it.
2040 self.showtraceback()
2049 self.showtraceback()
2041 return ''
2050 return ''
2042 else:
2051 else:
2043 return lineout
2052 return lineout
2044
2053
2045 def _prefilter(self, line, continue_prompt):
2054 def _prefilter(self, line, continue_prompt):
2046 """Calls different preprocessors, depending on the form of line."""
2055 """Calls different preprocessors, depending on the form of line."""
2047
2056
2048 # All handlers *must* return a value, even if it's blank ('').
2057 # All handlers *must* return a value, even if it's blank ('').
2049
2058
2050 # Lines are NOT logged here. Handlers should process the line as
2059 # Lines are NOT logged here. Handlers should process the line as
2051 # needed, update the cache AND log it (so that the input cache array
2060 # needed, update the cache AND log it (so that the input cache array
2052 # stays synced).
2061 # stays synced).
2053
2062
2054 #.....................................................................
2063 #.....................................................................
2055 # Code begins
2064 # Code begins
2056
2065
2057 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2066 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2058
2067
2059 # save the line away in case we crash, so the post-mortem handler can
2068 # save the line away in case we crash, so the post-mortem handler can
2060 # record it
2069 # record it
2061 self._last_input_line = line
2070 self._last_input_line = line
2062
2071
2063 #print '***line: <%s>' % line # dbg
2072 #print '***line: <%s>' % line # dbg
2064
2073
2065 if not line:
2074 if not line:
2066 # Return immediately on purely empty lines, so that if the user
2075 # Return immediately on purely empty lines, so that if the user
2067 # previously typed some whitespace that started a continuation
2076 # previously typed some whitespace that started a continuation
2068 # prompt, he can break out of that loop with just an empty line.
2077 # prompt, he can break out of that loop with just an empty line.
2069 # This is how the default python prompt works.
2078 # This is how the default python prompt works.
2070
2079
2071 # Only return if the accumulated input buffer was just whitespace!
2080 # Only return if the accumulated input buffer was just whitespace!
2072 if ''.join(self.buffer).isspace():
2081 if ''.join(self.buffer).isspace():
2073 self.buffer[:] = []
2082 self.buffer[:] = []
2074 return ''
2083 return ''
2075
2084
2076 line_info = prefilter.LineInfo(line, continue_prompt)
2085 line_info = prefilter.LineInfo(line, continue_prompt)
2077
2086
2078 # the input history needs to track even empty lines
2087 # the input history needs to track even empty lines
2079 stripped = line.strip()
2088 stripped = line.strip()
2080
2089
2081 if not stripped:
2090 if not stripped:
2082 if not continue_prompt:
2091 if not continue_prompt:
2083 self.outputcache.prompt_count -= 1
2092 self.outputcache.prompt_count -= 1
2084 return self.handle_normal(line_info)
2093 return self.handle_normal(line_info)
2085
2094
2086 # print '***cont',continue_prompt # dbg
2095 # print '***cont',continue_prompt # dbg
2087 # special handlers are only allowed for single line statements
2096 # special handlers are only allowed for single line statements
2088 if continue_prompt and not self.rc.multi_line_specials:
2097 if continue_prompt and not self.rc.multi_line_specials:
2089 return self.handle_normal(line_info)
2098 return self.handle_normal(line_info)
2090
2099
2091
2100
2092 # See whether any pre-existing handler can take care of it
2101 # See whether any pre-existing handler can take care of it
2093 rewritten = self.hooks.input_prefilter(stripped)
2102 rewritten = self.hooks.input_prefilter(stripped)
2094 if rewritten != stripped: # ok, some prefilter did something
2103 if rewritten != stripped: # ok, some prefilter did something
2095 rewritten = line_info.pre + rewritten # add indentation
2104 rewritten = line_info.pre + rewritten # add indentation
2096 return self.handle_normal(prefilter.LineInfo(rewritten,
2105 return self.handle_normal(prefilter.LineInfo(rewritten,
2097 continue_prompt))
2106 continue_prompt))
2098
2107
2099 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2108 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2100
2109
2101 return prefilter.prefilter(line_info, self)
2110 return prefilter.prefilter(line_info, self)
2102
2111
2103
2112
2104 def _prefilter_dumb(self, line, continue_prompt):
2113 def _prefilter_dumb(self, line, continue_prompt):
2105 """simple prefilter function, for debugging"""
2114 """simple prefilter function, for debugging"""
2106 return self.handle_normal(line,continue_prompt)
2115 return self.handle_normal(line,continue_prompt)
2107
2116
2108
2117
2109 def multiline_prefilter(self, line, continue_prompt):
2118 def multiline_prefilter(self, line, continue_prompt):
2110 """ Run _prefilter for each line of input
2119 """ Run _prefilter for each line of input
2111
2120
2112 Covers cases where there are multiple lines in the user entry,
2121 Covers cases where there are multiple lines in the user entry,
2113 which is the case when the user goes back to a multiline history
2122 which is the case when the user goes back to a multiline history
2114 entry and presses enter.
2123 entry and presses enter.
2115
2124
2116 """
2125 """
2117 out = []
2126 out = []
2118 for l in line.rstrip('\n').split('\n'):
2127 for l in line.rstrip('\n').split('\n'):
2119 out.append(self._prefilter(l, continue_prompt))
2128 out.append(self._prefilter(l, continue_prompt))
2120 return '\n'.join(out)
2129 return '\n'.join(out)
2121
2130
2122 # Set the default prefilter() function (this can be user-overridden)
2131 # Set the default prefilter() function (this can be user-overridden)
2123 prefilter = multiline_prefilter
2132 prefilter = multiline_prefilter
2124
2133
2125 def handle_normal(self,line_info):
2134 def handle_normal(self,line_info):
2126 """Handle normal input lines. Use as a template for handlers."""
2135 """Handle normal input lines. Use as a template for handlers."""
2127
2136
2128 # With autoindent on, we need some way to exit the input loop, and I
2137 # With autoindent on, we need some way to exit the input loop, and I
2129 # don't want to force the user to have to backspace all the way to
2138 # don't want to force the user to have to backspace all the way to
2130 # clear the line. The rule will be in this case, that either two
2139 # clear the line. The rule will be in this case, that either two
2131 # lines of pure whitespace in a row, or a line of pure whitespace but
2140 # lines of pure whitespace in a row, or a line of pure whitespace but
2132 # of a size different to the indent level, will exit the input loop.
2141 # of a size different to the indent level, will exit the input loop.
2133 line = line_info.line
2142 line = line_info.line
2134 continue_prompt = line_info.continue_prompt
2143 continue_prompt = line_info.continue_prompt
2135
2144
2136 if (continue_prompt and self.autoindent and line.isspace() and
2145 if (continue_prompt and self.autoindent and line.isspace() and
2137 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2146 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2138 (self.buffer[-1]).isspace() )):
2147 (self.buffer[-1]).isspace() )):
2139 line = ''
2148 line = ''
2140
2149
2141 self.log(line,line,continue_prompt)
2150 self.log(line,line,continue_prompt)
2142 return line
2151 return line
2143
2152
2144 def handle_alias(self,line_info):
2153 def handle_alias(self,line_info):
2145 """Handle alias input lines. """
2154 """Handle alias input lines. """
2146 tgt = self.alias_table[line_info.iFun]
2155 tgt = self.alias_table[line_info.iFun]
2147 # print "=>",tgt #dbg
2156 # print "=>",tgt #dbg
2148 if callable(tgt):
2157 if callable(tgt):
2149 line_out = "_sh." + line_info.iFun + '(r"""' + line_info.theRest + '""")'
2158 line_out = "_sh." + line_info.iFun + '(r"""' + line_info.theRest + '""")'
2150 else:
2159 else:
2151 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2160 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2152
2161
2153 # pre is needed, because it carries the leading whitespace. Otherwise
2162 # pre is needed, because it carries the leading whitespace. Otherwise
2154 # aliases won't work in indented sections.
2163 # aliases won't work in indented sections.
2155 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2164 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2156 make_quoted_expr( transformed ))
2165 make_quoted_expr( transformed ))
2157
2166
2158 self.log(line_info.line,line_out,line_info.continue_prompt)
2167 self.log(line_info.line,line_out,line_info.continue_prompt)
2159 #print 'line out:',line_out # dbg
2168 #print 'line out:',line_out # dbg
2160 return line_out
2169 return line_out
2161
2170
2162 def handle_shell_escape(self, line_info):
2171 def handle_shell_escape(self, line_info):
2163 """Execute the line in a shell, empty return value"""
2172 """Execute the line in a shell, empty return value"""
2164 #print 'line in :', `line` # dbg
2173 #print 'line in :', `line` # dbg
2165 line = line_info.line
2174 line = line_info.line
2166 if line.lstrip().startswith('!!'):
2175 if line.lstrip().startswith('!!'):
2167 # rewrite LineInfo's line, iFun and theRest to properly hold the
2176 # rewrite LineInfo's line, iFun and theRest to properly hold the
2168 # call to %sx and the actual command to be executed, so
2177 # call to %sx and the actual command to be executed, so
2169 # handle_magic can work correctly. Note that this works even if
2178 # handle_magic can work correctly. Note that this works even if
2170 # the line is indented, so it handles multi_line_specials
2179 # the line is indented, so it handles multi_line_specials
2171 # properly.
2180 # properly.
2172 new_rest = line.lstrip()[2:]
2181 new_rest = line.lstrip()[2:]
2173 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2182 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2174 line_info.iFun = 'sx'
2183 line_info.iFun = 'sx'
2175 line_info.theRest = new_rest
2184 line_info.theRest = new_rest
2176 return self.handle_magic(line_info)
2185 return self.handle_magic(line_info)
2177 else:
2186 else:
2178 cmd = line.lstrip().lstrip('!')
2187 cmd = line.lstrip().lstrip('!')
2179 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2188 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2180 make_quoted_expr(cmd))
2189 make_quoted_expr(cmd))
2181 # update cache/log and return
2190 # update cache/log and return
2182 self.log(line,line_out,line_info.continue_prompt)
2191 self.log(line,line_out,line_info.continue_prompt)
2183 return line_out
2192 return line_out
2184
2193
2185 def handle_magic(self, line_info):
2194 def handle_magic(self, line_info):
2186 """Execute magic functions."""
2195 """Execute magic functions."""
2187 iFun = line_info.iFun
2196 iFun = line_info.iFun
2188 theRest = line_info.theRest
2197 theRest = line_info.theRest
2189 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2198 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2190 make_quoted_expr(iFun + " " + theRest))
2199 make_quoted_expr(iFun + " " + theRest))
2191 self.log(line_info.line,cmd,line_info.continue_prompt)
2200 self.log(line_info.line,cmd,line_info.continue_prompt)
2192 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2201 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2193 return cmd
2202 return cmd
2194
2203
2195 def handle_auto(self, line_info):
2204 def handle_auto(self, line_info):
2196 """Hande lines which can be auto-executed, quoting if requested."""
2205 """Hande lines which can be auto-executed, quoting if requested."""
2197
2206
2198 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2207 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2199 line = line_info.line
2208 line = line_info.line
2200 iFun = line_info.iFun
2209 iFun = line_info.iFun
2201 theRest = line_info.theRest
2210 theRest = line_info.theRest
2202 pre = line_info.pre
2211 pre = line_info.pre
2203 continue_prompt = line_info.continue_prompt
2212 continue_prompt = line_info.continue_prompt
2204 obj = line_info.ofind(self)['obj']
2213 obj = line_info.ofind(self)['obj']
2205
2214
2206 # This should only be active for single-line input!
2215 # This should only be active for single-line input!
2207 if continue_prompt:
2216 if continue_prompt:
2208 self.log(line,line,continue_prompt)
2217 self.log(line,line,continue_prompt)
2209 return line
2218 return line
2210
2219
2211 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2220 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2212 auto_rewrite = True
2221 auto_rewrite = True
2213
2222
2214 if pre == self.ESC_QUOTE:
2223 if pre == self.ESC_QUOTE:
2215 # Auto-quote splitting on whitespace
2224 # Auto-quote splitting on whitespace
2216 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2225 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2217 elif pre == self.ESC_QUOTE2:
2226 elif pre == self.ESC_QUOTE2:
2218 # Auto-quote whole string
2227 # Auto-quote whole string
2219 newcmd = '%s("%s")' % (iFun,theRest)
2228 newcmd = '%s("%s")' % (iFun,theRest)
2220 elif pre == self.ESC_PAREN:
2229 elif pre == self.ESC_PAREN:
2221 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2230 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2222 else:
2231 else:
2223 # Auto-paren.
2232 # Auto-paren.
2224 # We only apply it to argument-less calls if the autocall
2233 # We only apply it to argument-less calls if the autocall
2225 # parameter is set to 2. We only need to check that autocall is <
2234 # parameter is set to 2. We only need to check that autocall is <
2226 # 2, since this function isn't called unless it's at least 1.
2235 # 2, since this function isn't called unless it's at least 1.
2227 if not theRest and (self.rc.autocall < 2) and not force_auto:
2236 if not theRest and (self.rc.autocall < 2) and not force_auto:
2228 newcmd = '%s %s' % (iFun,theRest)
2237 newcmd = '%s %s' % (iFun,theRest)
2229 auto_rewrite = False
2238 auto_rewrite = False
2230 else:
2239 else:
2231 if not force_auto and theRest.startswith('['):
2240 if not force_auto and theRest.startswith('['):
2232 if hasattr(obj,'__getitem__'):
2241 if hasattr(obj,'__getitem__'):
2233 # Don't autocall in this case: item access for an object
2242 # Don't autocall in this case: item access for an object
2234 # which is BOTH callable and implements __getitem__.
2243 # which is BOTH callable and implements __getitem__.
2235 newcmd = '%s %s' % (iFun,theRest)
2244 newcmd = '%s %s' % (iFun,theRest)
2236 auto_rewrite = False
2245 auto_rewrite = False
2237 else:
2246 else:
2238 # if the object doesn't support [] access, go ahead and
2247 # if the object doesn't support [] access, go ahead and
2239 # autocall
2248 # autocall
2240 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2249 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2241 elif theRest.endswith(';'):
2250 elif theRest.endswith(';'):
2242 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2251 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2243 else:
2252 else:
2244 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2253 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2245
2254
2246 if auto_rewrite:
2255 if auto_rewrite:
2247 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2256 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2248
2257
2249 try:
2258 try:
2250 # plain ascii works better w/ pyreadline, on some machines, so
2259 # plain ascii works better w/ pyreadline, on some machines, so
2251 # we use it and only print uncolored rewrite if we have unicode
2260 # we use it and only print uncolored rewrite if we have unicode
2252 rw = str(rw)
2261 rw = str(rw)
2253 print >>Term.cout, rw
2262 print >>Term.cout, rw
2254 except UnicodeEncodeError:
2263 except UnicodeEncodeError:
2255 print "-------------->" + newcmd
2264 print "-------------->" + newcmd
2256
2265
2257 # log what is now valid Python, not the actual user input (without the
2266 # log what is now valid Python, not the actual user input (without the
2258 # final newline)
2267 # final newline)
2259 self.log(line,newcmd,continue_prompt)
2268 self.log(line,newcmd,continue_prompt)
2260 return newcmd
2269 return newcmd
2261
2270
2262 def handle_help(self, line_info):
2271 def handle_help(self, line_info):
2263 """Try to get some help for the object.
2272 """Try to get some help for the object.
2264
2273
2265 obj? or ?obj -> basic information.
2274 obj? or ?obj -> basic information.
2266 obj?? or ??obj -> more details.
2275 obj?? or ??obj -> more details.
2267 """
2276 """
2268
2277
2269 line = line_info.line
2278 line = line_info.line
2270 # We need to make sure that we don't process lines which would be
2279 # We need to make sure that we don't process lines which would be
2271 # otherwise valid python, such as "x=1 # what?"
2280 # otherwise valid python, such as "x=1 # what?"
2272 try:
2281 try:
2273 codeop.compile_command(line)
2282 codeop.compile_command(line)
2274 except SyntaxError:
2283 except SyntaxError:
2275 # We should only handle as help stuff which is NOT valid syntax
2284 # We should only handle as help stuff which is NOT valid syntax
2276 if line[0]==self.ESC_HELP:
2285 if line[0]==self.ESC_HELP:
2277 line = line[1:]
2286 line = line[1:]
2278 elif line[-1]==self.ESC_HELP:
2287 elif line[-1]==self.ESC_HELP:
2279 line = line[:-1]
2288 line = line[:-1]
2280 self.log(line,'#?'+line,line_info.continue_prompt)
2289 self.log(line,'#?'+line,line_info.continue_prompt)
2281 if line:
2290 if line:
2282 #print 'line:<%r>' % line # dbg
2291 #print 'line:<%r>' % line # dbg
2283 self.magic_pinfo(line)
2292 self.magic_pinfo(line)
2284 else:
2293 else:
2285 page(self.usage,screen_lines=self.rc.screen_length)
2294 page(self.usage,screen_lines=self.rc.screen_length)
2286 return '' # Empty string is needed here!
2295 return '' # Empty string is needed here!
2287 except:
2296 except:
2288 # Pass any other exceptions through to the normal handler
2297 # Pass any other exceptions through to the normal handler
2289 return self.handle_normal(line_info)
2298 return self.handle_normal(line_info)
2290 else:
2299 else:
2291 # If the code compiles ok, we should handle it normally
2300 # If the code compiles ok, we should handle it normally
2292 return self.handle_normal(line_info)
2301 return self.handle_normal(line_info)
2293
2302
2294 def getapi(self):
2303 def getapi(self):
2295 """ Get an IPApi object for this shell instance
2304 """ Get an IPApi object for this shell instance
2296
2305
2297 Getting an IPApi object is always preferable to accessing the shell
2306 Getting an IPApi object is always preferable to accessing the shell
2298 directly, but this holds true especially for extensions.
2307 directly, but this holds true especially for extensions.
2299
2308
2300 It should always be possible to implement an extension with IPApi
2309 It should always be possible to implement an extension with IPApi
2301 alone. If not, contact maintainer to request an addition.
2310 alone. If not, contact maintainer to request an addition.
2302
2311
2303 """
2312 """
2304 return self.api
2313 return self.api
2305
2314
2306 def handle_emacs(self, line_info):
2315 def handle_emacs(self, line_info):
2307 """Handle input lines marked by python-mode."""
2316 """Handle input lines marked by python-mode."""
2308
2317
2309 # Currently, nothing is done. Later more functionality can be added
2318 # Currently, nothing is done. Later more functionality can be added
2310 # here if needed.
2319 # here if needed.
2311
2320
2312 # The input cache shouldn't be updated
2321 # The input cache shouldn't be updated
2313 return line_info.line
2322 return line_info.line
2314
2323
2315
2324
2316 def mktempfile(self,data=None):
2325 def mktempfile(self,data=None):
2317 """Make a new tempfile and return its filename.
2326 """Make a new tempfile and return its filename.
2318
2327
2319 This makes a call to tempfile.mktemp, but it registers the created
2328 This makes a call to tempfile.mktemp, but it registers the created
2320 filename internally so ipython cleans it up at exit time.
2329 filename internally so ipython cleans it up at exit time.
2321
2330
2322 Optional inputs:
2331 Optional inputs:
2323
2332
2324 - data(None): if data is given, it gets written out to the temp file
2333 - data(None): if data is given, it gets written out to the temp file
2325 immediately, and the file is closed again."""
2334 immediately, and the file is closed again."""
2326
2335
2327 filename = tempfile.mktemp('.py','ipython_edit_')
2336 filename = tempfile.mktemp('.py','ipython_edit_')
2328 self.tempfiles.append(filename)
2337 self.tempfiles.append(filename)
2329
2338
2330 if data:
2339 if data:
2331 tmp_file = open(filename,'w')
2340 tmp_file = open(filename,'w')
2332 tmp_file.write(data)
2341 tmp_file.write(data)
2333 tmp_file.close()
2342 tmp_file.close()
2334 return filename
2343 return filename
2335
2344
2336 def write(self,data):
2345 def write(self,data):
2337 """Write a string to the default output"""
2346 """Write a string to the default output"""
2338 Term.cout.write(data)
2347 Term.cout.write(data)
2339
2348
2340 def write_err(self,data):
2349 def write_err(self,data):
2341 """Write a string to the default error output"""
2350 """Write a string to the default error output"""
2342 Term.cerr.write(data)
2351 Term.cerr.write(data)
2343
2352
2344 def exit(self):
2353 def exit(self):
2345 """Handle interactive exit.
2354 """Handle interactive exit.
2346
2355
2347 This method sets the exit_now attribute."""
2356 This method sets the exit_now attribute."""
2348
2357
2349 if self.rc.confirm_exit:
2358 if self.rc.confirm_exit:
2350 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2359 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2351 self.exit_now = True
2360 self.exit_now = True
2352 else:
2361 else:
2353 self.exit_now = True
2362 self.exit_now = True
2354
2363
2355 def safe_execfile(self,fname,*where,**kw):
2364 def safe_execfile(self,fname,*where,**kw):
2356 """A safe version of the builtin execfile().
2365 """A safe version of the builtin execfile().
2357
2366
2358 This version will never throw an exception, and knows how to handle
2367 This version will never throw an exception, and knows how to handle
2359 ipython logs as well."""
2368 ipython logs as well."""
2360
2369
2361 def syspath_cleanup():
2370 def syspath_cleanup():
2362 """Internal cleanup routine for sys.path."""
2371 """Internal cleanup routine for sys.path."""
2363 if add_dname:
2372 if add_dname:
2364 try:
2373 try:
2365 sys.path.remove(dname)
2374 sys.path.remove(dname)
2366 except ValueError:
2375 except ValueError:
2367 # For some reason the user has already removed it, ignore.
2376 # For some reason the user has already removed it, ignore.
2368 pass
2377 pass
2369
2378
2370 fname = os.path.expanduser(fname)
2379 fname = os.path.expanduser(fname)
2371
2380
2372 # Find things also in current directory. This is needed to mimic the
2381 # Find things also in current directory. This is needed to mimic the
2373 # behavior of running a script from the system command line, where
2382 # behavior of running a script from the system command line, where
2374 # Python inserts the script's directory into sys.path
2383 # Python inserts the script's directory into sys.path
2375 dname = os.path.dirname(os.path.abspath(fname))
2384 dname = os.path.dirname(os.path.abspath(fname))
2376 add_dname = False
2385 add_dname = False
2377 if dname not in sys.path:
2386 if dname not in sys.path:
2378 sys.path.insert(0,dname)
2387 sys.path.insert(0,dname)
2379 add_dname = True
2388 add_dname = True
2380
2389
2381 try:
2390 try:
2382 xfile = open(fname)
2391 xfile = open(fname)
2383 except:
2392 except:
2384 print >> Term.cerr, \
2393 print >> Term.cerr, \
2385 'Could not open file <%s> for safe execution.' % fname
2394 'Could not open file <%s> for safe execution.' % fname
2386 syspath_cleanup()
2395 syspath_cleanup()
2387 return None
2396 return None
2388
2397
2389 kw.setdefault('islog',0)
2398 kw.setdefault('islog',0)
2390 kw.setdefault('quiet',1)
2399 kw.setdefault('quiet',1)
2391 kw.setdefault('exit_ignore',0)
2400 kw.setdefault('exit_ignore',0)
2392 first = xfile.readline()
2401 first = xfile.readline()
2393 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2402 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2394 xfile.close()
2403 xfile.close()
2395 # line by line execution
2404 # line by line execution
2396 if first.startswith(loghead) or kw['islog']:
2405 if first.startswith(loghead) or kw['islog']:
2397 print 'Loading log file <%s> one line at a time...' % fname
2406 print 'Loading log file <%s> one line at a time...' % fname
2398 if kw['quiet']:
2407 if kw['quiet']:
2399 stdout_save = sys.stdout
2408 stdout_save = sys.stdout
2400 sys.stdout = StringIO.StringIO()
2409 sys.stdout = StringIO.StringIO()
2401 try:
2410 try:
2402 globs,locs = where[0:2]
2411 globs,locs = where[0:2]
2403 except:
2412 except:
2404 try:
2413 try:
2405 globs = locs = where[0]
2414 globs = locs = where[0]
2406 except:
2415 except:
2407 globs = locs = globals()
2416 globs = locs = globals()
2408 badblocks = []
2417 badblocks = []
2409
2418
2410 # we also need to identify indented blocks of code when replaying
2419 # we also need to identify indented blocks of code when replaying
2411 # logs and put them together before passing them to an exec
2420 # logs and put them together before passing them to an exec
2412 # statement. This takes a bit of regexp and look-ahead work in the
2421 # statement. This takes a bit of regexp and look-ahead work in the
2413 # file. It's easiest if we swallow the whole thing in memory
2422 # file. It's easiest if we swallow the whole thing in memory
2414 # first, and manually walk through the lines list moving the
2423 # first, and manually walk through the lines list moving the
2415 # counter ourselves.
2424 # counter ourselves.
2416 indent_re = re.compile('\s+\S')
2425 indent_re = re.compile('\s+\S')
2417 xfile = open(fname)
2426 xfile = open(fname)
2418 filelines = xfile.readlines()
2427 filelines = xfile.readlines()
2419 xfile.close()
2428 xfile.close()
2420 nlines = len(filelines)
2429 nlines = len(filelines)
2421 lnum = 0
2430 lnum = 0
2422 while lnum < nlines:
2431 while lnum < nlines:
2423 line = filelines[lnum]
2432 line = filelines[lnum]
2424 lnum += 1
2433 lnum += 1
2425 # don't re-insert logger status info into cache
2434 # don't re-insert logger status info into cache
2426 if line.startswith('#log#'):
2435 if line.startswith('#log#'):
2427 continue
2436 continue
2428 else:
2437 else:
2429 # build a block of code (maybe a single line) for execution
2438 # build a block of code (maybe a single line) for execution
2430 block = line
2439 block = line
2431 try:
2440 try:
2432 next = filelines[lnum] # lnum has already incremented
2441 next = filelines[lnum] # lnum has already incremented
2433 except:
2442 except:
2434 next = None
2443 next = None
2435 while next and indent_re.match(next):
2444 while next and indent_re.match(next):
2436 block += next
2445 block += next
2437 lnum += 1
2446 lnum += 1
2438 try:
2447 try:
2439 next = filelines[lnum]
2448 next = filelines[lnum]
2440 except:
2449 except:
2441 next = None
2450 next = None
2442 # now execute the block of one or more lines
2451 # now execute the block of one or more lines
2443 try:
2452 try:
2444 exec block in globs,locs
2453 exec block in globs,locs
2445 except SystemExit:
2454 except SystemExit:
2446 pass
2455 pass
2447 except:
2456 except:
2448 badblocks.append(block.rstrip())
2457 badblocks.append(block.rstrip())
2449 if kw['quiet']: # restore stdout
2458 if kw['quiet']: # restore stdout
2450 sys.stdout.close()
2459 sys.stdout.close()
2451 sys.stdout = stdout_save
2460 sys.stdout = stdout_save
2452 print 'Finished replaying log file <%s>' % fname
2461 print 'Finished replaying log file <%s>' % fname
2453 if badblocks:
2462 if badblocks:
2454 print >> sys.stderr, ('\nThe following lines/blocks in file '
2463 print >> sys.stderr, ('\nThe following lines/blocks in file '
2455 '<%s> reported errors:' % fname)
2464 '<%s> reported errors:' % fname)
2456
2465
2457 for badline in badblocks:
2466 for badline in badblocks:
2458 print >> sys.stderr, badline
2467 print >> sys.stderr, badline
2459 else: # regular file execution
2468 else: # regular file execution
2460 try:
2469 try:
2461 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2470 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2462 # Work around a bug in Python for Windows. The bug was
2471 # Work around a bug in Python for Windows. The bug was
2463 # fixed in in Python 2.5 r54159 and 54158, but that's still
2472 # fixed in in Python 2.5 r54159 and 54158, but that's still
2464 # SVN Python as of March/07. For details, see:
2473 # SVN Python as of March/07. For details, see:
2465 # http://projects.scipy.org/ipython/ipython/ticket/123
2474 # http://projects.scipy.org/ipython/ipython/ticket/123
2466 try:
2475 try:
2467 globs,locs = where[0:2]
2476 globs,locs = where[0:2]
2468 except:
2477 except:
2469 try:
2478 try:
2470 globs = locs = where[0]
2479 globs = locs = where[0]
2471 except:
2480 except:
2472 globs = locs = globals()
2481 globs = locs = globals()
2473 exec file(fname) in globs,locs
2482 exec file(fname) in globs,locs
2474 else:
2483 else:
2475 execfile(fname,*where)
2484 execfile(fname,*where)
2476 except SyntaxError:
2485 except SyntaxError:
2477 self.showsyntaxerror()
2486 self.showsyntaxerror()
2478 warn('Failure executing file: <%s>' % fname)
2487 warn('Failure executing file: <%s>' % fname)
2479 except SystemExit,status:
2488 except SystemExit,status:
2480 if not kw['exit_ignore']:
2489 if not kw['exit_ignore']:
2481 self.showtraceback()
2490 self.showtraceback()
2482 warn('Failure executing file: <%s>' % fname)
2491 warn('Failure executing file: <%s>' % fname)
2483 except:
2492 except:
2484 self.showtraceback()
2493 self.showtraceback()
2485 warn('Failure executing file: <%s>' % fname)
2494 warn('Failure executing file: <%s>' % fname)
2486
2495
2487 syspath_cleanup()
2496 syspath_cleanup()
2488
2497
2489 #************************* end of file <iplib.py> *****************************
2498 #************************* end of file <iplib.py> *****************************
@@ -1,6965 +1,6971 b''
1 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4 fix problems with doctests failing when run inside IPython due to
5 IPython's modifications of sys.displayhook.
6
1 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
7 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
2
8
3 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
9 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
4 a string with names.
10 a string with names.
5
11
6 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
12 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
7
13
8 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
14 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
9 magic to toggle on/off the doctest pasting support without having
15 magic to toggle on/off the doctest pasting support without having
10 to leave a session to switch to a separate profile.
16 to leave a session to switch to a separate profile.
11
17
12 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
18 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
13
19
14 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
20 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
15 introduce a blank line between inputs, to conform to doctest
21 introduce a blank line between inputs, to conform to doctest
16 requirements.
22 requirements.
17
23
18 * IPython/OInspect.py (Inspector.pinfo): fix another part where
24 * IPython/OInspect.py (Inspector.pinfo): fix another part where
19 auto-generated docstrings for new-style classes were showing up.
25 auto-generated docstrings for new-style classes were showing up.
20
26
21 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
27 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
22
28
23 * api_changes: Add new file to track backward-incompatible
29 * api_changes: Add new file to track backward-incompatible
24 user-visible changes.
30 user-visible changes.
25
31
26 2007-08-06 Ville Vainio <vivainio@gmail.com>
32 2007-08-06 Ville Vainio <vivainio@gmail.com>
27
33
28 * ipmaker.py: fix bug where user_config_ns didn't exist at all
34 * ipmaker.py: fix bug where user_config_ns didn't exist at all
29 before all the config files were handled.
35 before all the config files were handled.
30
36
31 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
37 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
32
38
33 * IPython/irunner.py (RunnerFactory): Add new factory class for
39 * IPython/irunner.py (RunnerFactory): Add new factory class for
34 creating reusable runners based on filenames.
40 creating reusable runners based on filenames.
35
41
36 * IPython/Extensions/ipy_profile_doctest.py: New profile for
42 * IPython/Extensions/ipy_profile_doctest.py: New profile for
37 doctest support. It sets prompts/exceptions as similar to
43 doctest support. It sets prompts/exceptions as similar to
38 standard Python as possible, so that ipython sessions in this
44 standard Python as possible, so that ipython sessions in this
39 profile can be easily pasted as doctests with minimal
45 profile can be easily pasted as doctests with minimal
40 modifications. It also enables pasting of doctests from external
46 modifications. It also enables pasting of doctests from external
41 sources (even if they have leading whitespace), so that you can
47 sources (even if they have leading whitespace), so that you can
42 rerun doctests from existing sources.
48 rerun doctests from existing sources.
43
49
44 * IPython/iplib.py (_prefilter): fix a buglet where after entering
50 * IPython/iplib.py (_prefilter): fix a buglet where after entering
45 some whitespace, the prompt would become a continuation prompt
51 some whitespace, the prompt would become a continuation prompt
46 with no way of exiting it other than Ctrl-C. This fix brings us
52 with no way of exiting it other than Ctrl-C. This fix brings us
47 into conformity with how the default python prompt works.
53 into conformity with how the default python prompt works.
48
54
49 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
55 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
50 Add support for pasting not only lines that start with '>>>', but
56 Add support for pasting not only lines that start with '>>>', but
51 also with ' >>>'. That is, arbitrary whitespace can now precede
57 also with ' >>>'. That is, arbitrary whitespace can now precede
52 the prompts. This makes the system useful for pasting doctests
58 the prompts. This makes the system useful for pasting doctests
53 from docstrings back into a normal session.
59 from docstrings back into a normal session.
54
60
55 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
61 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
56
62
57 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
63 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
58 r1357, which had killed multiple invocations of an embedded
64 r1357, which had killed multiple invocations of an embedded
59 ipython (this means that example-embed has been broken for over 1
65 ipython (this means that example-embed has been broken for over 1
60 year!!!). Rather than possibly breaking the batch stuff for which
66 year!!!). Rather than possibly breaking the batch stuff for which
61 the code in iplib.py/interact was introduced, I worked around the
67 the code in iplib.py/interact was introduced, I worked around the
62 problem in the embedding class in Shell.py. We really need a
68 problem in the embedding class in Shell.py. We really need a
63 bloody test suite for this code, I'm sick of finding stuff that
69 bloody test suite for this code, I'm sick of finding stuff that
64 used to work breaking left and right every time I use an old
70 used to work breaking left and right every time I use an old
65 feature I hadn't touched in a few months.
71 feature I hadn't touched in a few months.
66 (kill_embedded): Add a new magic that only shows up in embedded
72 (kill_embedded): Add a new magic that only shows up in embedded
67 mode, to allow users to permanently deactivate an embedded instance.
73 mode, to allow users to permanently deactivate an embedded instance.
68
74
69 2007-08-01 Ville Vainio <vivainio@gmail.com>
75 2007-08-01 Ville Vainio <vivainio@gmail.com>
70
76
71 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
77 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
72 history gets out of sync on runlines (e.g. when running macros).
78 history gets out of sync on runlines (e.g. when running macros).
73
79
74 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
80 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
75
81
76 * IPython/Magic.py (magic_colors): fix win32-related error message
82 * IPython/Magic.py (magic_colors): fix win32-related error message
77 that could appear under *nix when readline was missing. Patch by
83 that could appear under *nix when readline was missing. Patch by
78 Scott Jackson, closes #175.
84 Scott Jackson, closes #175.
79
85
80 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
86 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
81
87
82 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
88 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
83 completer that it traits-aware, so that traits objects don't show
89 completer that it traits-aware, so that traits objects don't show
84 all of their internal attributes all the time.
90 all of their internal attributes all the time.
85
91
86 * IPython/genutils.py (dir2): moved this code from inside
92 * IPython/genutils.py (dir2): moved this code from inside
87 completer.py to expose it publicly, so I could use it in the
93 completer.py to expose it publicly, so I could use it in the
88 wildcards bugfix.
94 wildcards bugfix.
89
95
90 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
96 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
91 Stefan with Traits.
97 Stefan with Traits.
92
98
93 * IPython/completer.py (Completer.attr_matches): change internal
99 * IPython/completer.py (Completer.attr_matches): change internal
94 var name from 'object' to 'obj', since 'object' is now a builtin
100 var name from 'object' to 'obj', since 'object' is now a builtin
95 and this can lead to weird bugs if reusing this code elsewhere.
101 and this can lead to weird bugs if reusing this code elsewhere.
96
102
97 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
103 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
98
104
99 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
105 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
100 'foo?' and update the code to prevent printing of default
106 'foo?' and update the code to prevent printing of default
101 docstrings that started appearing after I added support for
107 docstrings that started appearing after I added support for
102 new-style classes. The approach I'm using isn't ideal (I just
108 new-style classes. The approach I'm using isn't ideal (I just
103 special-case those strings) but I'm not sure how to more robustly
109 special-case those strings) but I'm not sure how to more robustly
104 differentiate between truly user-written strings and Python's
110 differentiate between truly user-written strings and Python's
105 automatic ones.
111 automatic ones.
106
112
107 2007-07-09 Ville Vainio <vivainio@gmail.com>
113 2007-07-09 Ville Vainio <vivainio@gmail.com>
108
114
109 * completer.py: Applied Matthew Neeley's patch:
115 * completer.py: Applied Matthew Neeley's patch:
110 Dynamic attributes from trait_names and _getAttributeNames are added
116 Dynamic attributes from trait_names and _getAttributeNames are added
111 to the list of tab completions, but when this happens, the attribute
117 to the list of tab completions, but when this happens, the attribute
112 list is turned into a set, so the attributes are unordered when
118 list is turned into a set, so the attributes are unordered when
113 printed, which makes it hard to find the right completion. This patch
119 printed, which makes it hard to find the right completion. This patch
114 turns this set back into a list and sort it.
120 turns this set back into a list and sort it.
115
121
116 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
122 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
117
123
118 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
124 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
119 classes in various inspector functions.
125 classes in various inspector functions.
120
126
121 2007-06-28 Ville Vainio <vivainio@gmail.com>
127 2007-06-28 Ville Vainio <vivainio@gmail.com>
122
128
123 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
129 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
124 Implement "shadow" namespace, and callable aliases that reside there.
130 Implement "shadow" namespace, and callable aliases that reside there.
125 Use them by:
131 Use them by:
126
132
127 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
133 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
128
134
129 foo hello world
135 foo hello world
130 (gets translated to:)
136 (gets translated to:)
131 _sh.foo(r"""hello world""")
137 _sh.foo(r"""hello world""")
132
138
133 In practice, this kind of alias can take the role of a magic function
139 In practice, this kind of alias can take the role of a magic function
134
140
135 * New generic inspect_object, called on obj? and obj??
141 * New generic inspect_object, called on obj? and obj??
136
142
137 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
143 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
138
144
139 * IPython/ultraTB.py (findsource): fix a problem with
145 * IPython/ultraTB.py (findsource): fix a problem with
140 inspect.getfile that can cause crashes during traceback construction.
146 inspect.getfile that can cause crashes during traceback construction.
141
147
142 2007-06-14 Ville Vainio <vivainio@gmail.com>
148 2007-06-14 Ville Vainio <vivainio@gmail.com>
143
149
144 * iplib.py (handle_auto): Try to use ascii for printing "--->"
150 * iplib.py (handle_auto): Try to use ascii for printing "--->"
145 autocall rewrite indication, becausesometimes unicode fails to print
151 autocall rewrite indication, becausesometimes unicode fails to print
146 properly (and you get ' - - - '). Use plain uncoloured ---> for
152 properly (and you get ' - - - '). Use plain uncoloured ---> for
147 unicode.
153 unicode.
148
154
149 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
155 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
150
156
151 . pickleshare 'hash' commands (hget, hset, hcompress,
157 . pickleshare 'hash' commands (hget, hset, hcompress,
152 hdict) for efficient shadow history storage.
158 hdict) for efficient shadow history storage.
153
159
154 2007-06-13 Ville Vainio <vivainio@gmail.com>
160 2007-06-13 Ville Vainio <vivainio@gmail.com>
155
161
156 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
162 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
157 Added kw arg 'interactive', tell whether vars should be visible
163 Added kw arg 'interactive', tell whether vars should be visible
158 with %whos.
164 with %whos.
159
165
160 2007-06-11 Ville Vainio <vivainio@gmail.com>
166 2007-06-11 Ville Vainio <vivainio@gmail.com>
161
167
162 * pspersistence.py, Magic.py, iplib.py: directory history now saved
168 * pspersistence.py, Magic.py, iplib.py: directory history now saved
163 to db
169 to db
164
170
165 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
171 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
166 Also, it exits IPython immediately after evaluating the command (just like
172 Also, it exits IPython immediately after evaluating the command (just like
167 std python)
173 std python)
168
174
169 2007-06-05 Walter Doerwald <walter@livinglogic.de>
175 2007-06-05 Walter Doerwald <walter@livinglogic.de>
170
176
171 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
177 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
172 Python string and captures the output. (Idea and original patch by
178 Python string and captures the output. (Idea and original patch by
173 St�fan van der Walt)
179 St�fan van der Walt)
174
180
175 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
181 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
176
182
177 * IPython/ultraTB.py (VerboseTB.text): update printing of
183 * IPython/ultraTB.py (VerboseTB.text): update printing of
178 exception types for Python 2.5 (now all exceptions in the stdlib
184 exception types for Python 2.5 (now all exceptions in the stdlib
179 are new-style classes).
185 are new-style classes).
180
186
181 2007-05-31 Walter Doerwald <walter@livinglogic.de>
187 2007-05-31 Walter Doerwald <walter@livinglogic.de>
182
188
183 * IPython/Extensions/igrid.py: Add new commands refresh and
189 * IPython/Extensions/igrid.py: Add new commands refresh and
184 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
190 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
185 the iterator once (refresh) or after every x seconds (refresh_timer).
191 the iterator once (refresh) or after every x seconds (refresh_timer).
186 Add a working implementation of "searchexpression", where the text
192 Add a working implementation of "searchexpression", where the text
187 entered is not the text to search for, but an expression that must
193 entered is not the text to search for, but an expression that must
188 be true. Added display of shortcuts to the menu. Added commands "pickinput"
194 be true. Added display of shortcuts to the menu. Added commands "pickinput"
189 and "pickinputattr" that put the object or attribute under the cursor
195 and "pickinputattr" that put the object or attribute under the cursor
190 in the input line. Split the statusbar to be able to display the currently
196 in the input line. Split the statusbar to be able to display the currently
191 active refresh interval. (Patch by Nik Tautenhahn)
197 active refresh interval. (Patch by Nik Tautenhahn)
192
198
193 2007-05-29 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
199 2007-05-29 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
194
200
195 * fixing set_term_title to use ctypes as default
201 * fixing set_term_title to use ctypes as default
196
202
197 * fixing set_term_title fallback to work when curent dir
203 * fixing set_term_title fallback to work when curent dir
198 is on a windows network share
204 is on a windows network share
199
205
200 2007-05-28 Ville Vainio <vivainio@gmail.com>
206 2007-05-28 Ville Vainio <vivainio@gmail.com>
201
207
202 * %cpaste: strip + with > from left (diffs).
208 * %cpaste: strip + with > from left (diffs).
203
209
204 * iplib.py: Fix crash when readline not installed
210 * iplib.py: Fix crash when readline not installed
205
211
206 2007-05-26 Ville Vainio <vivainio@gmail.com>
212 2007-05-26 Ville Vainio <vivainio@gmail.com>
207
213
208 * generics.py: intruduce easy to extend result_display generic
214 * generics.py: intruduce easy to extend result_display generic
209 function (using simplegeneric.py).
215 function (using simplegeneric.py).
210
216
211 * Fixed the append functionality of %set.
217 * Fixed the append functionality of %set.
212
218
213 2007-05-25 Ville Vainio <vivainio@gmail.com>
219 2007-05-25 Ville Vainio <vivainio@gmail.com>
214
220
215 * New magic: %rep (fetch / run old commands from history)
221 * New magic: %rep (fetch / run old commands from history)
216
222
217 * New extension: mglob (%mglob magic), for powerful glob / find /filter
223 * New extension: mglob (%mglob magic), for powerful glob / find /filter
218 like functionality
224 like functionality
219
225
220 % maghistory.py: %hist -g PATTERM greps the history for pattern
226 % maghistory.py: %hist -g PATTERM greps the history for pattern
221
227
222 2007-05-24 Walter Doerwald <walter@livinglogic.de>
228 2007-05-24 Walter Doerwald <walter@livinglogic.de>
223
229
224 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
230 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
225 browse the IPython input history
231 browse the IPython input history
226
232
227 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
233 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
228 (mapped to "i") can be used to put the object under the curser in the input
234 (mapped to "i") can be used to put the object under the curser in the input
229 line. pickinputattr (mapped to "I") does the same for the attribute under
235 line. pickinputattr (mapped to "I") does the same for the attribute under
230 the cursor.
236 the cursor.
231
237
232 2007-05-24 Ville Vainio <vivainio@gmail.com>
238 2007-05-24 Ville Vainio <vivainio@gmail.com>
233
239
234 * Grand magic cleansing (changeset [2380]):
240 * Grand magic cleansing (changeset [2380]):
235
241
236 * Introduce ipy_legacy.py where the following magics were
242 * Introduce ipy_legacy.py where the following magics were
237 moved:
243 moved:
238
244
239 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
245 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
240
246
241 If you need them, either use default profile or "import ipy_legacy"
247 If you need them, either use default profile or "import ipy_legacy"
242 in your ipy_user_conf.py
248 in your ipy_user_conf.py
243
249
244 * Move sh and scipy profile to Extensions from UserConfig. this implies
250 * Move sh and scipy profile to Extensions from UserConfig. this implies
245 you should not edit them, but you don't need to run %upgrade when
251 you should not edit them, but you don't need to run %upgrade when
246 upgrading IPython anymore.
252 upgrading IPython anymore.
247
253
248 * %hist/%history now operates in "raw" mode by default. To get the old
254 * %hist/%history now operates in "raw" mode by default. To get the old
249 behaviour, run '%hist -n' (native mode).
255 behaviour, run '%hist -n' (native mode).
250
256
251 * split ipy_stock_completers.py to ipy_stock_completers.py and
257 * split ipy_stock_completers.py to ipy_stock_completers.py and
252 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
258 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
253 installed as default.
259 installed as default.
254
260
255 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
261 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
256 handling.
262 handling.
257
263
258 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
264 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
259 input if readline is available.
265 input if readline is available.
260
266
261 2007-05-23 Ville Vainio <vivainio@gmail.com>
267 2007-05-23 Ville Vainio <vivainio@gmail.com>
262
268
263 * macro.py: %store uses __getstate__ properly
269 * macro.py: %store uses __getstate__ properly
264
270
265 * exesetup.py: added new setup script for creating
271 * exesetup.py: added new setup script for creating
266 standalone IPython executables with py2exe (i.e.
272 standalone IPython executables with py2exe (i.e.
267 no python installation required).
273 no python installation required).
268
274
269 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
275 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
270 its place.
276 its place.
271
277
272 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
278 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
273
279
274 2007-05-21 Ville Vainio <vivainio@gmail.com>
280 2007-05-21 Ville Vainio <vivainio@gmail.com>
275
281
276 * platutil_win32.py (set_term_title): handle
282 * platutil_win32.py (set_term_title): handle
277 failure of 'title' system call properly.
283 failure of 'title' system call properly.
278
284
279 2007-05-17 Walter Doerwald <walter@livinglogic.de>
285 2007-05-17 Walter Doerwald <walter@livinglogic.de>
280
286
281 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
287 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
282 (Bug detected by Paul Mueller).
288 (Bug detected by Paul Mueller).
283
289
284 2007-05-16 Ville Vainio <vivainio@gmail.com>
290 2007-05-16 Ville Vainio <vivainio@gmail.com>
285
291
286 * ipy_profile_sci.py, ipython_win_post_install.py: Create
292 * ipy_profile_sci.py, ipython_win_post_install.py: Create
287 new "sci" profile, effectively a modern version of the old
293 new "sci" profile, effectively a modern version of the old
288 "scipy" profile (which is now slated for deprecation).
294 "scipy" profile (which is now slated for deprecation).
289
295
290 2007-05-15 Ville Vainio <vivainio@gmail.com>
296 2007-05-15 Ville Vainio <vivainio@gmail.com>
291
297
292 * pycolorize.py, pycolor.1: Paul Mueller's patches that
298 * pycolorize.py, pycolor.1: Paul Mueller's patches that
293 make pycolorize read input from stdin when run without arguments.
299 make pycolorize read input from stdin when run without arguments.
294
300
295 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
301 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
296
302
297 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
303 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
298 it in sh profile (instead of ipy_system_conf.py).
304 it in sh profile (instead of ipy_system_conf.py).
299
305
300 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
306 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
301 aliases are now lower case on windows (MyCommand.exe => mycommand).
307 aliases are now lower case on windows (MyCommand.exe => mycommand).
302
308
303 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
309 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
304 Macros are now callable objects that inherit from ipapi.IPyAutocall,
310 Macros are now callable objects that inherit from ipapi.IPyAutocall,
305 i.e. get autocalled regardless of system autocall setting.
311 i.e. get autocalled regardless of system autocall setting.
306
312
307 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
313 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
308
314
309 * IPython/rlineimpl.py: check for clear_history in readline and
315 * IPython/rlineimpl.py: check for clear_history in readline and
310 make it a dummy no-op if not available. This function isn't
316 make it a dummy no-op if not available. This function isn't
311 guaranteed to be in the API and appeared in Python 2.4, so we need
317 guaranteed to be in the API and appeared in Python 2.4, so we need
312 to check it ourselves. Also, clean up this file quite a bit.
318 to check it ourselves. Also, clean up this file quite a bit.
313
319
314 * ipython.1: update man page and full manual with information
320 * ipython.1: update man page and full manual with information
315 about threads (remove outdated warning). Closes #151.
321 about threads (remove outdated warning). Closes #151.
316
322
317 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
323 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
318
324
319 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
325 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
320 in trunk (note that this made it into the 0.8.1 release already,
326 in trunk (note that this made it into the 0.8.1 release already,
321 but the changelogs didn't get coordinated). Many thanks to Gael
327 but the changelogs didn't get coordinated). Many thanks to Gael
322 Varoquaux <gael.varoquaux-AT-normalesup.org>
328 Varoquaux <gael.varoquaux-AT-normalesup.org>
323
329
324 2007-05-09 *** Released version 0.8.1
330 2007-05-09 *** Released version 0.8.1
325
331
326 2007-05-10 Walter Doerwald <walter@livinglogic.de>
332 2007-05-10 Walter Doerwald <walter@livinglogic.de>
327
333
328 * IPython/Extensions/igrid.py: Incorporate html help into
334 * IPython/Extensions/igrid.py: Incorporate html help into
329 the module, so we don't have to search for the file.
335 the module, so we don't have to search for the file.
330
336
331 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
337 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
332
338
333 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
339 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
334
340
335 2007-04-30 Ville Vainio <vivainio@gmail.com>
341 2007-04-30 Ville Vainio <vivainio@gmail.com>
336
342
337 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
343 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
338 user has illegal (non-ascii) home directory name
344 user has illegal (non-ascii) home directory name
339
345
340 2007-04-27 Ville Vainio <vivainio@gmail.com>
346 2007-04-27 Ville Vainio <vivainio@gmail.com>
341
347
342 * platutils_win32.py: implement set_term_title for windows
348 * platutils_win32.py: implement set_term_title for windows
343
349
344 * Update version number
350 * Update version number
345
351
346 * ipy_profile_sh.py: more informative prompt (2 dir levels)
352 * ipy_profile_sh.py: more informative prompt (2 dir levels)
347
353
348 2007-04-26 Walter Doerwald <walter@livinglogic.de>
354 2007-04-26 Walter Doerwald <walter@livinglogic.de>
349
355
350 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
356 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
351 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
357 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
352 bug discovered by Ville).
358 bug discovered by Ville).
353
359
354 2007-04-26 Ville Vainio <vivainio@gmail.com>
360 2007-04-26 Ville Vainio <vivainio@gmail.com>
355
361
356 * Extensions/ipy_completers.py: Olivier's module completer now
362 * Extensions/ipy_completers.py: Olivier's module completer now
357 saves the list of root modules if it takes > 4 secs on the first run.
363 saves the list of root modules if it takes > 4 secs on the first run.
358
364
359 * Magic.py (%rehashx): %rehashx now clears the completer cache
365 * Magic.py (%rehashx): %rehashx now clears the completer cache
360
366
361
367
362 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
368 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
363
369
364 * ipython.el: fix incorrect color scheme, reported by Stefan.
370 * ipython.el: fix incorrect color scheme, reported by Stefan.
365 Closes #149.
371 Closes #149.
366
372
367 * IPython/PyColorize.py (Parser.format2): fix state-handling
373 * IPython/PyColorize.py (Parser.format2): fix state-handling
368 logic. I still don't like how that code handles state, but at
374 logic. I still don't like how that code handles state, but at
369 least now it should be correct, if inelegant. Closes #146.
375 least now it should be correct, if inelegant. Closes #146.
370
376
371 2007-04-25 Ville Vainio <vivainio@gmail.com>
377 2007-04-25 Ville Vainio <vivainio@gmail.com>
372
378
373 * Extensions/ipy_which.py: added extension for %which magic, works
379 * Extensions/ipy_which.py: added extension for %which magic, works
374 a lot like unix 'which' but also finds and expands aliases, and
380 a lot like unix 'which' but also finds and expands aliases, and
375 allows wildcards.
381 allows wildcards.
376
382
377 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
383 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
378 as opposed to returning nothing.
384 as opposed to returning nothing.
379
385
380 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
386 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
381 ipy_stock_completers on default profile, do import on sh profile.
387 ipy_stock_completers on default profile, do import on sh profile.
382
388
383 2007-04-22 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
389 2007-04-22 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
384
390
385 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
391 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
386 like ipython.py foo.py which raised a IndexError.
392 like ipython.py foo.py which raised a IndexError.
387
393
388 2007-04-21 Ville Vainio <vivainio@gmail.com>
394 2007-04-21 Ville Vainio <vivainio@gmail.com>
389
395
390 * Extensions/ipy_extutil.py: added extension to manage other ipython
396 * Extensions/ipy_extutil.py: added extension to manage other ipython
391 extensions. Now only supports 'ls' == list extensions.
397 extensions. Now only supports 'ls' == list extensions.
392
398
393 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
399 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
394
400
395 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
401 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
396 would prevent use of the exception system outside of a running
402 would prevent use of the exception system outside of a running
397 IPython instance.
403 IPython instance.
398
404
399 2007-04-20 Ville Vainio <vivainio@gmail.com>
405 2007-04-20 Ville Vainio <vivainio@gmail.com>
400
406
401 * Extensions/ipy_render.py: added extension for easy
407 * Extensions/ipy_render.py: added extension for easy
402 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
408 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
403 'Iptl' template notation,
409 'Iptl' template notation,
404
410
405 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
411 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
406 safer & faster 'import' completer.
412 safer & faster 'import' completer.
407
413
408 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
414 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
409 and _ip.defalias(name, command).
415 and _ip.defalias(name, command).
410
416
411 * Extensions/ipy_exportdb.py: New extension for exporting all the
417 * Extensions/ipy_exportdb.py: New extension for exporting all the
412 %store'd data in a portable format (normal ipapi calls like
418 %store'd data in a portable format (normal ipapi calls like
413 defmacro() etc.)
419 defmacro() etc.)
414
420
415 2007-04-19 Ville Vainio <vivainio@gmail.com>
421 2007-04-19 Ville Vainio <vivainio@gmail.com>
416
422
417 * upgrade_dir.py: skip junk files like *.pyc
423 * upgrade_dir.py: skip junk files like *.pyc
418
424
419 * Release.py: version number to 0.8.1
425 * Release.py: version number to 0.8.1
420
426
421 2007-04-18 Ville Vainio <vivainio@gmail.com>
427 2007-04-18 Ville Vainio <vivainio@gmail.com>
422
428
423 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
429 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
424 and later on win32.
430 and later on win32.
425
431
426 2007-04-16 Ville Vainio <vivainio@gmail.com>
432 2007-04-16 Ville Vainio <vivainio@gmail.com>
427
433
428 * iplib.py (showtraceback): Do not crash when running w/o readline.
434 * iplib.py (showtraceback): Do not crash when running w/o readline.
429
435
430 2007-04-12 Walter Doerwald <walter@livinglogic.de>
436 2007-04-12 Walter Doerwald <walter@livinglogic.de>
431
437
432 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
438 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
433 sorted (case sensitive with files and dirs mixed).
439 sorted (case sensitive with files and dirs mixed).
434
440
435 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
441 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
436
442
437 * IPython/Release.py (version): Open trunk for 0.8.1 development.
443 * IPython/Release.py (version): Open trunk for 0.8.1 development.
438
444
439 2007-04-10 *** Released version 0.8.0
445 2007-04-10 *** Released version 0.8.0
440
446
441 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
447 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
442
448
443 * Tag 0.8.0 for release.
449 * Tag 0.8.0 for release.
444
450
445 * IPython/iplib.py (reloadhist): add API function to cleanly
451 * IPython/iplib.py (reloadhist): add API function to cleanly
446 reload the readline history, which was growing inappropriately on
452 reload the readline history, which was growing inappropriately on
447 every %run call.
453 every %run call.
448
454
449 * win32_manual_post_install.py (run): apply last part of Nicolas
455 * win32_manual_post_install.py (run): apply last part of Nicolas
450 Pernetty's patch (I'd accidentally applied it in a different
456 Pernetty's patch (I'd accidentally applied it in a different
451 directory and this particular file didn't get patched).
457 directory and this particular file didn't get patched).
452
458
453 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
459 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
454
460
455 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
461 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
456 find the main thread id and use the proper API call. Thanks to
462 find the main thread id and use the proper API call. Thanks to
457 Stefan for the fix.
463 Stefan for the fix.
458
464
459 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
465 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
460 unit tests to reflect fixed ticket #52, and add more tests sent by
466 unit tests to reflect fixed ticket #52, and add more tests sent by
461 him.
467 him.
462
468
463 * IPython/iplib.py (raw_input): restore the readline completer
469 * IPython/iplib.py (raw_input): restore the readline completer
464 state on every input, in case third-party code messed it up.
470 state on every input, in case third-party code messed it up.
465 (_prefilter): revert recent addition of early-escape checks which
471 (_prefilter): revert recent addition of early-escape checks which
466 prevent many valid alias calls from working.
472 prevent many valid alias calls from working.
467
473
468 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
474 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
469 flag for sigint handler so we don't run a full signal() call on
475 flag for sigint handler so we don't run a full signal() call on
470 each runcode access.
476 each runcode access.
471
477
472 * IPython/Magic.py (magic_whos): small improvement to diagnostic
478 * IPython/Magic.py (magic_whos): small improvement to diagnostic
473 message.
479 message.
474
480
475 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
481 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
476
482
477 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
483 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
478 asynchronous exceptions working, i.e., Ctrl-C can actually
484 asynchronous exceptions working, i.e., Ctrl-C can actually
479 interrupt long-running code in the multithreaded shells.
485 interrupt long-running code in the multithreaded shells.
480
486
481 This is using Tomer Filiba's great ctypes-based trick:
487 This is using Tomer Filiba's great ctypes-based trick:
482 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
488 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
483 this in the past, but hadn't been able to make it work before. So
489 this in the past, but hadn't been able to make it work before. So
484 far it looks like it's actually running, but this needs more
490 far it looks like it's actually running, but this needs more
485 testing. If it really works, I'll be *very* happy, and we'll owe
491 testing. If it really works, I'll be *very* happy, and we'll owe
486 a huge thank you to Tomer. My current implementation is ugly,
492 a huge thank you to Tomer. My current implementation is ugly,
487 hackish and uses nasty globals, but I don't want to try and clean
493 hackish and uses nasty globals, but I don't want to try and clean
488 anything up until we know if it actually works.
494 anything up until we know if it actually works.
489
495
490 NOTE: this feature needs ctypes to work. ctypes is included in
496 NOTE: this feature needs ctypes to work. ctypes is included in
491 Python2.5, but 2.4 users will need to manually install it. This
497 Python2.5, but 2.4 users will need to manually install it. This
492 feature makes multi-threaded shells so much more usable that it's
498 feature makes multi-threaded shells so much more usable that it's
493 a minor price to pay (ctypes is very easy to install, already a
499 a minor price to pay (ctypes is very easy to install, already a
494 requirement for win32 and available in major linux distros).
500 requirement for win32 and available in major linux distros).
495
501
496 2007-04-04 Ville Vainio <vivainio@gmail.com>
502 2007-04-04 Ville Vainio <vivainio@gmail.com>
497
503
498 * Extensions/ipy_completers.py, ipy_stock_completers.py:
504 * Extensions/ipy_completers.py, ipy_stock_completers.py:
499 Moved implementations of 'bundled' completers to ipy_completers.py,
505 Moved implementations of 'bundled' completers to ipy_completers.py,
500 they are only enabled in ipy_stock_completers.py.
506 they are only enabled in ipy_stock_completers.py.
501
507
502 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
508 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
503
509
504 * IPython/PyColorize.py (Parser.format2): Fix identation of
510 * IPython/PyColorize.py (Parser.format2): Fix identation of
505 colorzied output and return early if color scheme is NoColor, to
511 colorzied output and return early if color scheme is NoColor, to
506 avoid unnecessary and expensive tokenization. Closes #131.
512 avoid unnecessary and expensive tokenization. Closes #131.
507
513
508 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
514 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
509
515
510 * IPython/Debugger.py: disable the use of pydb version 1.17. It
516 * IPython/Debugger.py: disable the use of pydb version 1.17. It
511 has a critical bug (a missing import that makes post-mortem not
517 has a critical bug (a missing import that makes post-mortem not
512 work at all). Unfortunately as of this time, this is the version
518 work at all). Unfortunately as of this time, this is the version
513 shipped with Ubuntu Edgy, so quite a few people have this one. I
519 shipped with Ubuntu Edgy, so quite a few people have this one. I
514 hope Edgy will update to a more recent package.
520 hope Edgy will update to a more recent package.
515
521
516 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
522 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
517
523
518 * IPython/iplib.py (_prefilter): close #52, second part of a patch
524 * IPython/iplib.py (_prefilter): close #52, second part of a patch
519 set by Stefan (only the first part had been applied before).
525 set by Stefan (only the first part had been applied before).
520
526
521 * IPython/Extensions/ipy_stock_completers.py (module_completer):
527 * IPython/Extensions/ipy_stock_completers.py (module_completer):
522 remove usage of the dangerous pkgutil.walk_packages(). See
528 remove usage of the dangerous pkgutil.walk_packages(). See
523 details in comments left in the code.
529 details in comments left in the code.
524
530
525 * IPython/Magic.py (magic_whos): add support for numpy arrays
531 * IPython/Magic.py (magic_whos): add support for numpy arrays
526 similar to what we had for Numeric.
532 similar to what we had for Numeric.
527
533
528 * IPython/completer.py (IPCompleter.complete): extend the
534 * IPython/completer.py (IPCompleter.complete): extend the
529 complete() call API to support completions by other mechanisms
535 complete() call API to support completions by other mechanisms
530 than readline. Closes #109.
536 than readline. Closes #109.
531
537
532 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
538 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
533 protect against a bug in Python's execfile(). Closes #123.
539 protect against a bug in Python's execfile(). Closes #123.
534
540
535 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
541 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
536
542
537 * IPython/iplib.py (split_user_input): ensure that when splitting
543 * IPython/iplib.py (split_user_input): ensure that when splitting
538 user input, the part that can be treated as a python name is pure
544 user input, the part that can be treated as a python name is pure
539 ascii (Python identifiers MUST be pure ascii). Part of the
545 ascii (Python identifiers MUST be pure ascii). Part of the
540 ongoing Unicode support work.
546 ongoing Unicode support work.
541
547
542 * IPython/Prompts.py (prompt_specials_color): Add \N for the
548 * IPython/Prompts.py (prompt_specials_color): Add \N for the
543 actual prompt number, without any coloring. This allows users to
549 actual prompt number, without any coloring. This allows users to
544 produce numbered prompts with their own colors. Added after a
550 produce numbered prompts with their own colors. Added after a
545 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
551 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
546
552
547 2007-03-31 Walter Doerwald <walter@livinglogic.de>
553 2007-03-31 Walter Doerwald <walter@livinglogic.de>
548
554
549 * IPython/Extensions/igrid.py: Map the return key
555 * IPython/Extensions/igrid.py: Map the return key
550 to enter() and shift-return to enterattr().
556 to enter() and shift-return to enterattr().
551
557
552 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
558 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
553
559
554 * IPython/Magic.py (magic_psearch): add unicode support by
560 * IPython/Magic.py (magic_psearch): add unicode support by
555 encoding to ascii the input, since this routine also only deals
561 encoding to ascii the input, since this routine also only deals
556 with valid Python names. Fixes a bug reported by Stefan.
562 with valid Python names. Fixes a bug reported by Stefan.
557
563
558 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
564 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
559
565
560 * IPython/Magic.py (_inspect): convert unicode input into ascii
566 * IPython/Magic.py (_inspect): convert unicode input into ascii
561 before trying to evaluate it as a Python identifier. This fixes a
567 before trying to evaluate it as a Python identifier. This fixes a
562 problem that the new unicode support had introduced when analyzing
568 problem that the new unicode support had introduced when analyzing
563 long definition lines for functions.
569 long definition lines for functions.
564
570
565 2007-03-24 Walter Doerwald <walter@livinglogic.de>
571 2007-03-24 Walter Doerwald <walter@livinglogic.de>
566
572
567 * IPython/Extensions/igrid.py: Fix picking. Using
573 * IPython/Extensions/igrid.py: Fix picking. Using
568 igrid with wxPython 2.6 and -wthread should work now.
574 igrid with wxPython 2.6 and -wthread should work now.
569 igrid.display() simply tries to create a frame without
575 igrid.display() simply tries to create a frame without
570 an application. Only if this fails an application is created.
576 an application. Only if this fails an application is created.
571
577
572 2007-03-23 Walter Doerwald <walter@livinglogic.de>
578 2007-03-23 Walter Doerwald <walter@livinglogic.de>
573
579
574 * IPython/Extensions/path.py: Updated to version 2.2.
580 * IPython/Extensions/path.py: Updated to version 2.2.
575
581
576 2007-03-23 Ville Vainio <vivainio@gmail.com>
582 2007-03-23 Ville Vainio <vivainio@gmail.com>
577
583
578 * iplib.py: recursive alias expansion now works better, so that
584 * iplib.py: recursive alias expansion now works better, so that
579 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
585 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
580 doesn't trip up the process, if 'd' has been aliased to 'ls'.
586 doesn't trip up the process, if 'd' has been aliased to 'ls'.
581
587
582 * Extensions/ipy_gnuglobal.py added, provides %global magic
588 * Extensions/ipy_gnuglobal.py added, provides %global magic
583 for users of http://www.gnu.org/software/global
589 for users of http://www.gnu.org/software/global
584
590
585 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
591 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
586 Closes #52. Patch by Stefan van der Walt.
592 Closes #52. Patch by Stefan van der Walt.
587
593
588 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
594 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
589
595
590 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
596 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
591 respect the __file__ attribute when using %run. Thanks to a bug
597 respect the __file__ attribute when using %run. Thanks to a bug
592 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
598 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
593
599
594 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
600 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
595
601
596 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
602 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
597 input. Patch sent by Stefan.
603 input. Patch sent by Stefan.
598
604
599 2007-03-20 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
605 2007-03-20 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
600 * IPython/Extensions/ipy_stock_completer.py
606 * IPython/Extensions/ipy_stock_completer.py
601 shlex_split, fix bug in shlex_split. len function
607 shlex_split, fix bug in shlex_split. len function
602 call was missing an if statement. Caused shlex_split to
608 call was missing an if statement. Caused shlex_split to
603 sometimes return "" as last element.
609 sometimes return "" as last element.
604
610
605 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
611 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
606
612
607 * IPython/completer.py
613 * IPython/completer.py
608 (IPCompleter.file_matches.single_dir_expand): fix a problem
614 (IPCompleter.file_matches.single_dir_expand): fix a problem
609 reported by Stefan, where directories containign a single subdir
615 reported by Stefan, where directories containign a single subdir
610 would be completed too early.
616 would be completed too early.
611
617
612 * IPython/Shell.py (_load_pylab): Make the execution of 'from
618 * IPython/Shell.py (_load_pylab): Make the execution of 'from
613 pylab import *' when -pylab is given be optional. A new flag,
619 pylab import *' when -pylab is given be optional. A new flag,
614 pylab_import_all controls this behavior, the default is True for
620 pylab_import_all controls this behavior, the default is True for
615 backwards compatibility.
621 backwards compatibility.
616
622
617 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
623 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
618 modified) R. Bernstein's patch for fully syntax highlighted
624 modified) R. Bernstein's patch for fully syntax highlighted
619 tracebacks. The functionality is also available under ultraTB for
625 tracebacks. The functionality is also available under ultraTB for
620 non-ipython users (someone using ultraTB but outside an ipython
626 non-ipython users (someone using ultraTB but outside an ipython
621 session). They can select the color scheme by setting the
627 session). They can select the color scheme by setting the
622 module-level global DEFAULT_SCHEME. The highlight functionality
628 module-level global DEFAULT_SCHEME. The highlight functionality
623 also works when debugging.
629 also works when debugging.
624
630
625 * IPython/genutils.py (IOStream.close): small patch by
631 * IPython/genutils.py (IOStream.close): small patch by
626 R. Bernstein for improved pydb support.
632 R. Bernstein for improved pydb support.
627
633
628 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
634 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
629 DaveS <davls@telus.net> to improve support of debugging under
635 DaveS <davls@telus.net> to improve support of debugging under
630 NTEmacs, including improved pydb behavior.
636 NTEmacs, including improved pydb behavior.
631
637
632 * IPython/Magic.py (magic_prun): Fix saving of profile info for
638 * IPython/Magic.py (magic_prun): Fix saving of profile info for
633 Python 2.5, where the stats object API changed a little. Thanks
639 Python 2.5, where the stats object API changed a little. Thanks
634 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
640 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
635
641
636 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
642 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
637 Pernetty's patch to improve support for (X)Emacs under Win32.
643 Pernetty's patch to improve support for (X)Emacs under Win32.
638
644
639 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
645 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
640
646
641 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
647 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
642 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
648 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
643 a report by Nik Tautenhahn.
649 a report by Nik Tautenhahn.
644
650
645 2007-03-16 Walter Doerwald <walter@livinglogic.de>
651 2007-03-16 Walter Doerwald <walter@livinglogic.de>
646
652
647 * setup.py: Add the igrid help files to the list of data files
653 * setup.py: Add the igrid help files to the list of data files
648 to be installed alongside igrid.
654 to be installed alongside igrid.
649 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
655 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
650 Show the input object of the igrid browser as the window tile.
656 Show the input object of the igrid browser as the window tile.
651 Show the object the cursor is on in the statusbar.
657 Show the object the cursor is on in the statusbar.
652
658
653 2007-03-15 Ville Vainio <vivainio@gmail.com>
659 2007-03-15 Ville Vainio <vivainio@gmail.com>
654
660
655 * Extensions/ipy_stock_completers.py: Fixed exception
661 * Extensions/ipy_stock_completers.py: Fixed exception
656 on mismatching quotes in %run completer. Patch by
662 on mismatching quotes in %run completer. Patch by
657 J�rgen Stenarson. Closes #127.
663 J�rgen Stenarson. Closes #127.
658
664
659 2007-03-14 Ville Vainio <vivainio@gmail.com>
665 2007-03-14 Ville Vainio <vivainio@gmail.com>
660
666
661 * Extensions/ext_rehashdir.py: Do not do auto_alias
667 * Extensions/ext_rehashdir.py: Do not do auto_alias
662 in %rehashdir, it clobbers %store'd aliases.
668 in %rehashdir, it clobbers %store'd aliases.
663
669
664 * UserConfig/ipy_profile_sh.py: envpersist.py extension
670 * UserConfig/ipy_profile_sh.py: envpersist.py extension
665 (beefed up %env) imported for sh profile.
671 (beefed up %env) imported for sh profile.
666
672
667 2007-03-10 Walter Doerwald <walter@livinglogic.de>
673 2007-03-10 Walter Doerwald <walter@livinglogic.de>
668
674
669 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
675 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
670 as the default browser.
676 as the default browser.
671 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
677 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
672 As igrid displays all attributes it ever encounters, fetch() (which has
678 As igrid displays all attributes it ever encounters, fetch() (which has
673 been renamed to _fetch()) doesn't have to recalculate the display attributes
679 been renamed to _fetch()) doesn't have to recalculate the display attributes
674 every time a new item is fetched. This should speed up scrolling.
680 every time a new item is fetched. This should speed up scrolling.
675
681
676 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
682 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
677
683
678 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
684 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
679 Schmolck's recently reported tab-completion bug (my previous one
685 Schmolck's recently reported tab-completion bug (my previous one
680 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
686 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
681
687
682 2007-03-09 Walter Doerwald <walter@livinglogic.de>
688 2007-03-09 Walter Doerwald <walter@livinglogic.de>
683
689
684 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
690 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
685 Close help window if exiting igrid.
691 Close help window if exiting igrid.
686
692
687 2007-03-02 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
693 2007-03-02 J�rgen Stenarson <jorgen.stenarson@bostream.nu>
688
694
689 * IPython/Extensions/ipy_defaults.py: Check if readline is available
695 * IPython/Extensions/ipy_defaults.py: Check if readline is available
690 before calling functions from readline.
696 before calling functions from readline.
691
697
692 2007-03-02 Walter Doerwald <walter@livinglogic.de>
698 2007-03-02 Walter Doerwald <walter@livinglogic.de>
693
699
694 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
700 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
695 igrid is a wxPython-based display object for ipipe. If your system has
701 igrid is a wxPython-based display object for ipipe. If your system has
696 wx installed igrid will be the default display. Without wx ipipe falls
702 wx installed igrid will be the default display. Without wx ipipe falls
697 back to ibrowse (which needs curses). If no curses is installed ipipe
703 back to ibrowse (which needs curses). If no curses is installed ipipe
698 falls back to idump.
704 falls back to idump.
699
705
700 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
706 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
701
707
702 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
708 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
703 my changes from yesterday, they introduced bugs. Will reactivate
709 my changes from yesterday, they introduced bugs. Will reactivate
704 once I get a correct solution, which will be much easier thanks to
710 once I get a correct solution, which will be much easier thanks to
705 Dan Milstein's new prefilter test suite.
711 Dan Milstein's new prefilter test suite.
706
712
707 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
713 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
708
714
709 * IPython/iplib.py (split_user_input): fix input splitting so we
715 * IPython/iplib.py (split_user_input): fix input splitting so we
710 don't attempt attribute accesses on things that can't possibly be
716 don't attempt attribute accesses on things that can't possibly be
711 valid Python attributes. After a bug report by Alex Schmolck.
717 valid Python attributes. After a bug report by Alex Schmolck.
712 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
718 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
713 %magic with explicit % prefix.
719 %magic with explicit % prefix.
714
720
715 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
721 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
716
722
717 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
723 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
718 avoid a DeprecationWarning from GTK.
724 avoid a DeprecationWarning from GTK.
719
725
720 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
726 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
721
727
722 * IPython/genutils.py (clock): I modified clock() to return total
728 * IPython/genutils.py (clock): I modified clock() to return total
723 time, user+system. This is a more commonly needed metric. I also
729 time, user+system. This is a more commonly needed metric. I also
724 introduced the new clocku/clocks to get only user/system time if
730 introduced the new clocku/clocks to get only user/system time if
725 one wants those instead.
731 one wants those instead.
726
732
727 ***WARNING: API CHANGE*** clock() used to return only user time,
733 ***WARNING: API CHANGE*** clock() used to return only user time,
728 so if you want exactly the same results as before, use clocku
734 so if you want exactly the same results as before, use clocku
729 instead.
735 instead.
730
736
731 2007-02-22 Ville Vainio <vivainio@gmail.com>
737 2007-02-22 Ville Vainio <vivainio@gmail.com>
732
738
733 * IPython/Extensions/ipy_p4.py: Extension for improved
739 * IPython/Extensions/ipy_p4.py: Extension for improved
734 p4 (perforce version control system) experience.
740 p4 (perforce version control system) experience.
735 Adds %p4 magic with p4 command completion and
741 Adds %p4 magic with p4 command completion and
736 automatic -G argument (marshall output as python dict)
742 automatic -G argument (marshall output as python dict)
737
743
738 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
744 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
739
745
740 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
746 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
741 stop marks.
747 stop marks.
742 (ClearingMixin): a simple mixin to easily make a Demo class clear
748 (ClearingMixin): a simple mixin to easily make a Demo class clear
743 the screen in between blocks and have empty marquees. The
749 the screen in between blocks and have empty marquees. The
744 ClearDemo and ClearIPDemo classes that use it are included.
750 ClearDemo and ClearIPDemo classes that use it are included.
745
751
746 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
752 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
747
753
748 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
754 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
749 protect against exceptions at Python shutdown time. Patch
755 protect against exceptions at Python shutdown time. Patch
750 sumbmitted to upstream.
756 sumbmitted to upstream.
751
757
752 2007-02-14 Walter Doerwald <walter@livinglogic.de>
758 2007-02-14 Walter Doerwald <walter@livinglogic.de>
753
759
754 * IPython/Extensions/ibrowse.py: If entering the first object level
760 * IPython/Extensions/ibrowse.py: If entering the first object level
755 (i.e. the object for which the browser has been started) fails,
761 (i.e. the object for which the browser has been started) fails,
756 now the error is raised directly (aborting the browser) instead of
762 now the error is raised directly (aborting the browser) instead of
757 running into an empty levels list later.
763 running into an empty levels list later.
758
764
759 2007-02-03 Walter Doerwald <walter@livinglogic.de>
765 2007-02-03 Walter Doerwald <walter@livinglogic.de>
760
766
761 * IPython/Extensions/ipipe.py: Add an xrepr implementation
767 * IPython/Extensions/ipipe.py: Add an xrepr implementation
762 for the noitem object.
768 for the noitem object.
763
769
764 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
770 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
765
771
766 * IPython/completer.py (Completer.attr_matches): Fix small
772 * IPython/completer.py (Completer.attr_matches): Fix small
767 tab-completion bug with Enthought Traits objects with units.
773 tab-completion bug with Enthought Traits objects with units.
768 Thanks to a bug report by Tom Denniston
774 Thanks to a bug report by Tom Denniston
769 <tom.denniston-AT-alum.dartmouth.org>.
775 <tom.denniston-AT-alum.dartmouth.org>.
770
776
771 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
777 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
772
778
773 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
779 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
774 bug where only .ipy or .py would be completed. Once the first
780 bug where only .ipy or .py would be completed. Once the first
775 argument to %run has been given, all completions are valid because
781 argument to %run has been given, all completions are valid because
776 they are the arguments to the script, which may well be non-python
782 they are the arguments to the script, which may well be non-python
777 filenames.
783 filenames.
778
784
779 * IPython/irunner.py (InteractiveRunner.run_source): major updates
785 * IPython/irunner.py (InteractiveRunner.run_source): major updates
780 to irunner to allow it to correctly support real doctesting of
786 to irunner to allow it to correctly support real doctesting of
781 out-of-process ipython code.
787 out-of-process ipython code.
782
788
783 * IPython/Magic.py (magic_cd): Make the setting of the terminal
789 * IPython/Magic.py (magic_cd): Make the setting of the terminal
784 title an option (-noterm_title) because it completely breaks
790 title an option (-noterm_title) because it completely breaks
785 doctesting.
791 doctesting.
786
792
787 * IPython/demo.py: fix IPythonDemo class that was not actually working.
793 * IPython/demo.py: fix IPythonDemo class that was not actually working.
788
794
789 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
795 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
790
796
791 * IPython/irunner.py (main): fix small bug where extensions were
797 * IPython/irunner.py (main): fix small bug where extensions were
792 not being correctly recognized.
798 not being correctly recognized.
793
799
794 2007-01-23 Walter Doerwald <walter@livinglogic.de>
800 2007-01-23 Walter Doerwald <walter@livinglogic.de>
795
801
796 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
802 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
797 a string containing a single line yields the string itself as the
803 a string containing a single line yields the string itself as the
798 only item.
804 only item.
799
805
800 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
806 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
801 object if it's the same as the one on the last level (This avoids
807 object if it's the same as the one on the last level (This avoids
802 infinite recursion for one line strings).
808 infinite recursion for one line strings).
803
809
804 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
810 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
805
811
806 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
812 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
807 all output streams before printing tracebacks. This ensures that
813 all output streams before printing tracebacks. This ensures that
808 user output doesn't end up interleaved with traceback output.
814 user output doesn't end up interleaved with traceback output.
809
815
810 2007-01-10 Ville Vainio <vivainio@gmail.com>
816 2007-01-10 Ville Vainio <vivainio@gmail.com>
811
817
812 * Extensions/envpersist.py: Turbocharged %env that remembers
818 * Extensions/envpersist.py: Turbocharged %env that remembers
813 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
819 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
814 "%env VISUAL=jed".
820 "%env VISUAL=jed".
815
821
816 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
822 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
817
823
818 * IPython/iplib.py (showtraceback): ensure that we correctly call
824 * IPython/iplib.py (showtraceback): ensure that we correctly call
819 custom handlers in all cases (some with pdb were slipping through,
825 custom handlers in all cases (some with pdb were slipping through,
820 but I'm not exactly sure why).
826 but I'm not exactly sure why).
821
827
822 * IPython/Debugger.py (Tracer.__init__): added new class to
828 * IPython/Debugger.py (Tracer.__init__): added new class to
823 support set_trace-like usage of IPython's enhanced debugger.
829 support set_trace-like usage of IPython's enhanced debugger.
824
830
825 2006-12-24 Ville Vainio <vivainio@gmail.com>
831 2006-12-24 Ville Vainio <vivainio@gmail.com>
826
832
827 * ipmaker.py: more informative message when ipy_user_conf
833 * ipmaker.py: more informative message when ipy_user_conf
828 import fails (suggest running %upgrade).
834 import fails (suggest running %upgrade).
829
835
830 * tools/run_ipy_in_profiler.py: Utility to see where
836 * tools/run_ipy_in_profiler.py: Utility to see where
831 the time during IPython startup is spent.
837 the time during IPython startup is spent.
832
838
833 2006-12-20 Ville Vainio <vivainio@gmail.com>
839 2006-12-20 Ville Vainio <vivainio@gmail.com>
834
840
835 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
841 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
836
842
837 * ipapi.py: Add new ipapi method, expand_alias.
843 * ipapi.py: Add new ipapi method, expand_alias.
838
844
839 * Release.py: Bump up version to 0.7.4.svn
845 * Release.py: Bump up version to 0.7.4.svn
840
846
841 2006-12-17 Ville Vainio <vivainio@gmail.com>
847 2006-12-17 Ville Vainio <vivainio@gmail.com>
842
848
843 * Extensions/jobctrl.py: Fixed &cmd arg arg...
849 * Extensions/jobctrl.py: Fixed &cmd arg arg...
844 to work properly on posix too
850 to work properly on posix too
845
851
846 * Release.py: Update revnum (version is still just 0.7.3).
852 * Release.py: Update revnum (version is still just 0.7.3).
847
853
848 2006-12-15 Ville Vainio <vivainio@gmail.com>
854 2006-12-15 Ville Vainio <vivainio@gmail.com>
849
855
850 * scripts/ipython_win_post_install: create ipython.py in
856 * scripts/ipython_win_post_install: create ipython.py in
851 prefix + "/scripts".
857 prefix + "/scripts".
852
858
853 * Release.py: Update version to 0.7.3.
859 * Release.py: Update version to 0.7.3.
854
860
855 2006-12-14 Ville Vainio <vivainio@gmail.com>
861 2006-12-14 Ville Vainio <vivainio@gmail.com>
856
862
857 * scripts/ipython_win_post_install: Overwrite old shortcuts
863 * scripts/ipython_win_post_install: Overwrite old shortcuts
858 if they already exist
864 if they already exist
859
865
860 * Release.py: release 0.7.3rc2
866 * Release.py: release 0.7.3rc2
861
867
862 2006-12-13 Ville Vainio <vivainio@gmail.com>
868 2006-12-13 Ville Vainio <vivainio@gmail.com>
863
869
864 * Branch and update Release.py for 0.7.3rc1
870 * Branch and update Release.py for 0.7.3rc1
865
871
866 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
872 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
867
873
868 * IPython/Shell.py (IPShellWX): update for current WX naming
874 * IPython/Shell.py (IPShellWX): update for current WX naming
869 conventions, to avoid a deprecation warning with current WX
875 conventions, to avoid a deprecation warning with current WX
870 versions. Thanks to a report by Danny Shevitz.
876 versions. Thanks to a report by Danny Shevitz.
871
877
872 2006-12-12 Ville Vainio <vivainio@gmail.com>
878 2006-12-12 Ville Vainio <vivainio@gmail.com>
873
879
874 * ipmaker.py: apply david cournapeau's patch to make
880 * ipmaker.py: apply david cournapeau's patch to make
875 import_some work properly even when ipythonrc does
881 import_some work properly even when ipythonrc does
876 import_some on empty list (it was an old bug!).
882 import_some on empty list (it was an old bug!).
877
883
878 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
884 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
879 Add deprecation note to ipythonrc and a url to wiki
885 Add deprecation note to ipythonrc and a url to wiki
880 in ipy_user_conf.py
886 in ipy_user_conf.py
881
887
882
888
883 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
889 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
884 as if it was typed on IPython command prompt, i.e.
890 as if it was typed on IPython command prompt, i.e.
885 as IPython script.
891 as IPython script.
886
892
887 * example-magic.py, magic_grepl.py: remove outdated examples
893 * example-magic.py, magic_grepl.py: remove outdated examples
888
894
889 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
895 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
890
896
891 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
897 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
892 is called before any exception has occurred.
898 is called before any exception has occurred.
893
899
894 2006-12-08 Ville Vainio <vivainio@gmail.com>
900 2006-12-08 Ville Vainio <vivainio@gmail.com>
895
901
896 * Extensions/ipy_stock_completers.py: fix cd completer
902 * Extensions/ipy_stock_completers.py: fix cd completer
897 to translate /'s to \'s again.
903 to translate /'s to \'s again.
898
904
899 * completer.py: prevent traceback on file completions w/
905 * completer.py: prevent traceback on file completions w/
900 backslash.
906 backslash.
901
907
902 * Release.py: Update release number to 0.7.3b3 for release
908 * Release.py: Update release number to 0.7.3b3 for release
903
909
904 2006-12-07 Ville Vainio <vivainio@gmail.com>
910 2006-12-07 Ville Vainio <vivainio@gmail.com>
905
911
906 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
912 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
907 while executing external code. Provides more shell-like behaviour
913 while executing external code. Provides more shell-like behaviour
908 and overall better response to ctrl + C / ctrl + break.
914 and overall better response to ctrl + C / ctrl + break.
909
915
910 * tools/make_tarball.py: new script to create tarball straight from svn
916 * tools/make_tarball.py: new script to create tarball straight from svn
911 (setup.py sdist doesn't work on win32).
917 (setup.py sdist doesn't work on win32).
912
918
913 * Extensions/ipy_stock_completers.py: fix cd completer to give up
919 * Extensions/ipy_stock_completers.py: fix cd completer to give up
914 on dirnames with spaces and use the default completer instead.
920 on dirnames with spaces and use the default completer instead.
915
921
916 * Revision.py: Change version to 0.7.3b2 for release.
922 * Revision.py: Change version to 0.7.3b2 for release.
917
923
918 2006-12-05 Ville Vainio <vivainio@gmail.com>
924 2006-12-05 Ville Vainio <vivainio@gmail.com>
919
925
920 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
926 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
921 pydb patch 4 (rm debug printing, py 2.5 checking)
927 pydb patch 4 (rm debug printing, py 2.5 checking)
922
928
923 2006-11-30 Walter Doerwald <walter@livinglogic.de>
929 2006-11-30 Walter Doerwald <walter@livinglogic.de>
924 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
930 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
925 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
931 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
926 "refreshfind" (mapped to "R") does the same but tries to go back to the same
932 "refreshfind" (mapped to "R") does the same but tries to go back to the same
927 object the cursor was on before the refresh. The command "markrange" is
933 object the cursor was on before the refresh. The command "markrange" is
928 mapped to "%" now.
934 mapped to "%" now.
929 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
935 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
930
936
931 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
937 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
932
938
933 * IPython/Magic.py (magic_debug): new %debug magic to activate the
939 * IPython/Magic.py (magic_debug): new %debug magic to activate the
934 interactive debugger on the last traceback, without having to call
940 interactive debugger on the last traceback, without having to call
935 %pdb and rerun your code. Made minor changes in various modules,
941 %pdb and rerun your code. Made minor changes in various modules,
936 should automatically recognize pydb if available.
942 should automatically recognize pydb if available.
937
943
938 2006-11-28 Ville Vainio <vivainio@gmail.com>
944 2006-11-28 Ville Vainio <vivainio@gmail.com>
939
945
940 * completer.py: If the text start with !, show file completions
946 * completer.py: If the text start with !, show file completions
941 properly. This helps when trying to complete command name
947 properly. This helps when trying to complete command name
942 for shell escapes.
948 for shell escapes.
943
949
944 2006-11-27 Ville Vainio <vivainio@gmail.com>
950 2006-11-27 Ville Vainio <vivainio@gmail.com>
945
951
946 * ipy_stock_completers.py: bzr completer submitted by Stefan van
952 * ipy_stock_completers.py: bzr completer submitted by Stefan van
947 der Walt. Clean up svn and hg completers by using a common
953 der Walt. Clean up svn and hg completers by using a common
948 vcs_completer.
954 vcs_completer.
949
955
950 2006-11-26 Ville Vainio <vivainio@gmail.com>
956 2006-11-26 Ville Vainio <vivainio@gmail.com>
951
957
952 * Remove ipconfig and %config; you should use _ip.options structure
958 * Remove ipconfig and %config; you should use _ip.options structure
953 directly instead!
959 directly instead!
954
960
955 * genutils.py: add wrap_deprecated function for deprecating callables
961 * genutils.py: add wrap_deprecated function for deprecating callables
956
962
957 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
963 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
958 _ip.system instead. ipalias is redundant.
964 _ip.system instead. ipalias is redundant.
959
965
960 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
966 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
961 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
967 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
962 explicit.
968 explicit.
963
969
964 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
970 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
965 completer. Try it by entering 'hg ' and pressing tab.
971 completer. Try it by entering 'hg ' and pressing tab.
966
972
967 * macro.py: Give Macro a useful __repr__ method
973 * macro.py: Give Macro a useful __repr__ method
968
974
969 * Magic.py: %whos abbreviates the typename of Macro for brevity.
975 * Magic.py: %whos abbreviates the typename of Macro for brevity.
970
976
971 2006-11-24 Walter Doerwald <walter@livinglogic.de>
977 2006-11-24 Walter Doerwald <walter@livinglogic.de>
972 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
978 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
973 we don't get a duplicate ipipe module, where registration of the xrepr
979 we don't get a duplicate ipipe module, where registration of the xrepr
974 implementation for Text is useless.
980 implementation for Text is useless.
975
981
976 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
982 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
977
983
978 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
984 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
979
985
980 2006-11-24 Ville Vainio <vivainio@gmail.com>
986 2006-11-24 Ville Vainio <vivainio@gmail.com>
981
987
982 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
988 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
983 try to use "cProfile" instead of the slower pure python
989 try to use "cProfile" instead of the slower pure python
984 "profile"
990 "profile"
985
991
986 2006-11-23 Ville Vainio <vivainio@gmail.com>
992 2006-11-23 Ville Vainio <vivainio@gmail.com>
987
993
988 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
994 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
989 Qt+IPython+Designer link in documentation.
995 Qt+IPython+Designer link in documentation.
990
996
991 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
997 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
992 correct Pdb object to %pydb.
998 correct Pdb object to %pydb.
993
999
994
1000
995 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1001 2006-11-22 Walter Doerwald <walter@livinglogic.de>
996 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1002 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
997 generic xrepr(), otherwise the list implementation would kick in.
1003 generic xrepr(), otherwise the list implementation would kick in.
998
1004
999 2006-11-21 Ville Vainio <vivainio@gmail.com>
1005 2006-11-21 Ville Vainio <vivainio@gmail.com>
1000
1006
1001 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1007 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1002 with one from UserConfig.
1008 with one from UserConfig.
1003
1009
1004 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1010 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1005 it was missing which broke the sh profile.
1011 it was missing which broke the sh profile.
1006
1012
1007 * completer.py: file completer now uses explicit '/' instead
1013 * completer.py: file completer now uses explicit '/' instead
1008 of os.path.join, expansion of 'foo' was broken on win32
1014 of os.path.join, expansion of 'foo' was broken on win32
1009 if there was one directory with name 'foobar'.
1015 if there was one directory with name 'foobar'.
1010
1016
1011 * A bunch of patches from Kirill Smelkov:
1017 * A bunch of patches from Kirill Smelkov:
1012
1018
1013 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1019 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1014
1020
1015 * [patch 7/9] Implement %page -r (page in raw mode) -
1021 * [patch 7/9] Implement %page -r (page in raw mode) -
1016
1022
1017 * [patch 5/9] ScientificPython webpage has moved
1023 * [patch 5/9] ScientificPython webpage has moved
1018
1024
1019 * [patch 4/9] The manual mentions %ds, should be %dhist
1025 * [patch 4/9] The manual mentions %ds, should be %dhist
1020
1026
1021 * [patch 3/9] Kill old bits from %prun doc.
1027 * [patch 3/9] Kill old bits from %prun doc.
1022
1028
1023 * [patch 1/9] Fix typos here and there.
1029 * [patch 1/9] Fix typos here and there.
1024
1030
1025 2006-11-08 Ville Vainio <vivainio@gmail.com>
1031 2006-11-08 Ville Vainio <vivainio@gmail.com>
1026
1032
1027 * completer.py (attr_matches): catch all exceptions raised
1033 * completer.py (attr_matches): catch all exceptions raised
1028 by eval of expr with dots.
1034 by eval of expr with dots.
1029
1035
1030 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1036 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1031
1037
1032 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1038 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1033 input if it starts with whitespace. This allows you to paste
1039 input if it starts with whitespace. This allows you to paste
1034 indented input from any editor without manually having to type in
1040 indented input from any editor without manually having to type in
1035 the 'if 1:', which is convenient when working interactively.
1041 the 'if 1:', which is convenient when working interactively.
1036 Slightly modifed version of a patch by Bo Peng
1042 Slightly modifed version of a patch by Bo Peng
1037 <bpeng-AT-rice.edu>.
1043 <bpeng-AT-rice.edu>.
1038
1044
1039 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1045 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1040
1046
1041 * IPython/irunner.py (main): modified irunner so it automatically
1047 * IPython/irunner.py (main): modified irunner so it automatically
1042 recognizes the right runner to use based on the extension (.py for
1048 recognizes the right runner to use based on the extension (.py for
1043 python, .ipy for ipython and .sage for sage).
1049 python, .ipy for ipython and .sage for sage).
1044
1050
1045 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1051 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1046 visible in ipapi as ip.config(), to programatically control the
1052 visible in ipapi as ip.config(), to programatically control the
1047 internal rc object. There's an accompanying %config magic for
1053 internal rc object. There's an accompanying %config magic for
1048 interactive use, which has been enhanced to match the
1054 interactive use, which has been enhanced to match the
1049 funtionality in ipconfig.
1055 funtionality in ipconfig.
1050
1056
1051 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1057 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1052 so it's not just a toggle, it now takes an argument. Add support
1058 so it's not just a toggle, it now takes an argument. Add support
1053 for a customizable header when making system calls, as the new
1059 for a customizable header when making system calls, as the new
1054 system_header variable in the ipythonrc file.
1060 system_header variable in the ipythonrc file.
1055
1061
1056 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1062 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1057
1063
1058 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1064 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1059 generic functions (using Philip J. Eby's simplegeneric package).
1065 generic functions (using Philip J. Eby's simplegeneric package).
1060 This makes it possible to customize the display of third-party classes
1066 This makes it possible to customize the display of third-party classes
1061 without having to monkeypatch them. xiter() no longer supports a mode
1067 without having to monkeypatch them. xiter() no longer supports a mode
1062 argument and the XMode class has been removed. The same functionality can
1068 argument and the XMode class has been removed. The same functionality can
1063 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1069 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1064 One consequence of the switch to generic functions is that xrepr() and
1070 One consequence of the switch to generic functions is that xrepr() and
1065 xattrs() implementation must define the default value for the mode
1071 xattrs() implementation must define the default value for the mode
1066 argument themselves and xattrs() implementations must return real
1072 argument themselves and xattrs() implementations must return real
1067 descriptors.
1073 descriptors.
1068
1074
1069 * IPython/external: This new subpackage will contain all third-party
1075 * IPython/external: This new subpackage will contain all third-party
1070 packages that are bundled with IPython. (The first one is simplegeneric).
1076 packages that are bundled with IPython. (The first one is simplegeneric).
1071
1077
1072 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1078 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1073 directory which as been dropped in r1703.
1079 directory which as been dropped in r1703.
1074
1080
1075 * IPython/Extensions/ipipe.py (iless): Fixed.
1081 * IPython/Extensions/ipipe.py (iless): Fixed.
1076
1082
1077 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1083 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1078
1084
1079 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1085 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1080
1086
1081 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1087 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1082 handling in variable expansion so that shells and magics recognize
1088 handling in variable expansion so that shells and magics recognize
1083 function local scopes correctly. Bug reported by Brian.
1089 function local scopes correctly. Bug reported by Brian.
1084
1090
1085 * scripts/ipython: remove the very first entry in sys.path which
1091 * scripts/ipython: remove the very first entry in sys.path which
1086 Python auto-inserts for scripts, so that sys.path under IPython is
1092 Python auto-inserts for scripts, so that sys.path under IPython is
1087 as similar as possible to that under plain Python.
1093 as similar as possible to that under plain Python.
1088
1094
1089 * IPython/completer.py (IPCompleter.file_matches): Fix
1095 * IPython/completer.py (IPCompleter.file_matches): Fix
1090 tab-completion so that quotes are not closed unless the completion
1096 tab-completion so that quotes are not closed unless the completion
1091 is unambiguous. After a request by Stefan. Minor cleanups in
1097 is unambiguous. After a request by Stefan. Minor cleanups in
1092 ipy_stock_completers.
1098 ipy_stock_completers.
1093
1099
1094 2006-11-02 Ville Vainio <vivainio@gmail.com>
1100 2006-11-02 Ville Vainio <vivainio@gmail.com>
1095
1101
1096 * ipy_stock_completers.py: Add %run and %cd completers.
1102 * ipy_stock_completers.py: Add %run and %cd completers.
1097
1103
1098 * completer.py: Try running custom completer for both
1104 * completer.py: Try running custom completer for both
1099 "foo" and "%foo" if the command is just "foo". Ignore case
1105 "foo" and "%foo" if the command is just "foo". Ignore case
1100 when filtering possible completions.
1106 when filtering possible completions.
1101
1107
1102 * UserConfig/ipy_user_conf.py: install stock completers as default
1108 * UserConfig/ipy_user_conf.py: install stock completers as default
1103
1109
1104 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1110 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1105 simplified readline history save / restore through a wrapper
1111 simplified readline history save / restore through a wrapper
1106 function
1112 function
1107
1113
1108
1114
1109 2006-10-31 Ville Vainio <vivainio@gmail.com>
1115 2006-10-31 Ville Vainio <vivainio@gmail.com>
1110
1116
1111 * strdispatch.py, completer.py, ipy_stock_completers.py:
1117 * strdispatch.py, completer.py, ipy_stock_completers.py:
1112 Allow str_key ("command") in completer hooks. Implement
1118 Allow str_key ("command") in completer hooks. Implement
1113 trivial completer for 'import' (stdlib modules only). Rename
1119 trivial completer for 'import' (stdlib modules only). Rename
1114 ipy_linux_package_managers.py to ipy_stock_completers.py.
1120 ipy_linux_package_managers.py to ipy_stock_completers.py.
1115 SVN completer.
1121 SVN completer.
1116
1122
1117 * Extensions/ledit.py: %magic line editor for easily and
1123 * Extensions/ledit.py: %magic line editor for easily and
1118 incrementally manipulating lists of strings. The magic command
1124 incrementally manipulating lists of strings. The magic command
1119 name is %led.
1125 name is %led.
1120
1126
1121 2006-10-30 Ville Vainio <vivainio@gmail.com>
1127 2006-10-30 Ville Vainio <vivainio@gmail.com>
1122
1128
1123 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1129 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1124 Bernsteins's patches for pydb integration.
1130 Bernsteins's patches for pydb integration.
1125 http://bashdb.sourceforge.net/pydb/
1131 http://bashdb.sourceforge.net/pydb/
1126
1132
1127 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1133 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1128 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1134 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1129 custom completer hook to allow the users to implement their own
1135 custom completer hook to allow the users to implement their own
1130 completers. See ipy_linux_package_managers.py for example. The
1136 completers. See ipy_linux_package_managers.py for example. The
1131 hook name is 'complete_command'.
1137 hook name is 'complete_command'.
1132
1138
1133 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1139 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1134
1140
1135 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1141 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1136 Numeric leftovers.
1142 Numeric leftovers.
1137
1143
1138 * ipython.el (py-execute-region): apply Stefan's patch to fix
1144 * ipython.el (py-execute-region): apply Stefan's patch to fix
1139 garbled results if the python shell hasn't been previously started.
1145 garbled results if the python shell hasn't been previously started.
1140
1146
1141 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1147 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1142 pretty generic function and useful for other things.
1148 pretty generic function and useful for other things.
1143
1149
1144 * IPython/OInspect.py (getsource): Add customizable source
1150 * IPython/OInspect.py (getsource): Add customizable source
1145 extractor. After a request/patch form W. Stein (SAGE).
1151 extractor. After a request/patch form W. Stein (SAGE).
1146
1152
1147 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1153 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1148 window size to a more reasonable value from what pexpect does,
1154 window size to a more reasonable value from what pexpect does,
1149 since their choice causes wrapping bugs with long input lines.
1155 since their choice causes wrapping bugs with long input lines.
1150
1156
1151 2006-10-28 Ville Vainio <vivainio@gmail.com>
1157 2006-10-28 Ville Vainio <vivainio@gmail.com>
1152
1158
1153 * Magic.py (%run): Save and restore the readline history from
1159 * Magic.py (%run): Save and restore the readline history from
1154 file around %run commands to prevent side effects from
1160 file around %run commands to prevent side effects from
1155 %runned programs that might use readline (e.g. pydb).
1161 %runned programs that might use readline (e.g. pydb).
1156
1162
1157 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1163 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1158 invoking the pydb enhanced debugger.
1164 invoking the pydb enhanced debugger.
1159
1165
1160 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1166 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1161
1167
1162 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1168 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1163 call the base class method and propagate the return value to
1169 call the base class method and propagate the return value to
1164 ifile. This is now done by path itself.
1170 ifile. This is now done by path itself.
1165
1171
1166 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1172 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1167
1173
1168 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1174 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1169 api: set_crash_handler(), to expose the ability to change the
1175 api: set_crash_handler(), to expose the ability to change the
1170 internal crash handler.
1176 internal crash handler.
1171
1177
1172 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1178 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1173 the various parameters of the crash handler so that apps using
1179 the various parameters of the crash handler so that apps using
1174 IPython as their engine can customize crash handling. Ipmlemented
1180 IPython as their engine can customize crash handling. Ipmlemented
1175 at the request of SAGE.
1181 at the request of SAGE.
1176
1182
1177 2006-10-14 Ville Vainio <vivainio@gmail.com>
1183 2006-10-14 Ville Vainio <vivainio@gmail.com>
1178
1184
1179 * Magic.py, ipython.el: applied first "safe" part of Rocky
1185 * Magic.py, ipython.el: applied first "safe" part of Rocky
1180 Bernstein's patch set for pydb integration.
1186 Bernstein's patch set for pydb integration.
1181
1187
1182 * Magic.py (%unalias, %alias): %store'd aliases can now be
1188 * Magic.py (%unalias, %alias): %store'd aliases can now be
1183 removed with '%unalias'. %alias w/o args now shows most
1189 removed with '%unalias'. %alias w/o args now shows most
1184 interesting (stored / manually defined) aliases last
1190 interesting (stored / manually defined) aliases last
1185 where they catch the eye w/o scrolling.
1191 where they catch the eye w/o scrolling.
1186
1192
1187 * Magic.py (%rehashx), ext_rehashdir.py: files with
1193 * Magic.py (%rehashx), ext_rehashdir.py: files with
1188 'py' extension are always considered executable, even
1194 'py' extension are always considered executable, even
1189 when not in PATHEXT environment variable.
1195 when not in PATHEXT environment variable.
1190
1196
1191 2006-10-12 Ville Vainio <vivainio@gmail.com>
1197 2006-10-12 Ville Vainio <vivainio@gmail.com>
1192
1198
1193 * jobctrl.py: Add new "jobctrl" extension for spawning background
1199 * jobctrl.py: Add new "jobctrl" extension for spawning background
1194 processes with "&find /". 'import jobctrl' to try it out. Requires
1200 processes with "&find /". 'import jobctrl' to try it out. Requires
1195 'subprocess' module, standard in python 2.4+.
1201 'subprocess' module, standard in python 2.4+.
1196
1202
1197 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1203 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1198 so if foo -> bar and bar -> baz, then foo -> baz.
1204 so if foo -> bar and bar -> baz, then foo -> baz.
1199
1205
1200 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1206 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1201
1207
1202 * IPython/Magic.py (Magic.parse_options): add a new posix option
1208 * IPython/Magic.py (Magic.parse_options): add a new posix option
1203 to allow parsing of input args in magics that doesn't strip quotes
1209 to allow parsing of input args in magics that doesn't strip quotes
1204 (if posix=False). This also closes %timeit bug reported by
1210 (if posix=False). This also closes %timeit bug reported by
1205 Stefan.
1211 Stefan.
1206
1212
1207 2006-10-03 Ville Vainio <vivainio@gmail.com>
1213 2006-10-03 Ville Vainio <vivainio@gmail.com>
1208
1214
1209 * iplib.py (raw_input, interact): Return ValueError catching for
1215 * iplib.py (raw_input, interact): Return ValueError catching for
1210 raw_input. Fixes infinite loop for sys.stdin.close() or
1216 raw_input. Fixes infinite loop for sys.stdin.close() or
1211 sys.stdout.close().
1217 sys.stdout.close().
1212
1218
1213 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1219 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1214
1220
1215 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1221 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1216 to help in handling doctests. irunner is now pretty useful for
1222 to help in handling doctests. irunner is now pretty useful for
1217 running standalone scripts and simulate a full interactive session
1223 running standalone scripts and simulate a full interactive session
1218 in a format that can be then pasted as a doctest.
1224 in a format that can be then pasted as a doctest.
1219
1225
1220 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1226 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1221 on top of the default (useless) ones. This also fixes the nasty
1227 on top of the default (useless) ones. This also fixes the nasty
1222 way in which 2.5's Quitter() exits (reverted [1785]).
1228 way in which 2.5's Quitter() exits (reverted [1785]).
1223
1229
1224 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1230 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1225 2.5.
1231 2.5.
1226
1232
1227 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1233 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1228 color scheme is updated as well when color scheme is changed
1234 color scheme is updated as well when color scheme is changed
1229 interactively.
1235 interactively.
1230
1236
1231 2006-09-27 Ville Vainio <vivainio@gmail.com>
1237 2006-09-27 Ville Vainio <vivainio@gmail.com>
1232
1238
1233 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1239 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1234 infinite loop and just exit. It's a hack, but will do for a while.
1240 infinite loop and just exit. It's a hack, but will do for a while.
1235
1241
1236 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1242 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1237
1243
1238 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1244 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1239 the constructor, this makes it possible to get a list of only directories
1245 the constructor, this makes it possible to get a list of only directories
1240 or only files.
1246 or only files.
1241
1247
1242 2006-08-12 Ville Vainio <vivainio@gmail.com>
1248 2006-08-12 Ville Vainio <vivainio@gmail.com>
1243
1249
1244 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1250 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1245 they broke unittest
1251 they broke unittest
1246
1252
1247 2006-08-11 Ville Vainio <vivainio@gmail.com>
1253 2006-08-11 Ville Vainio <vivainio@gmail.com>
1248
1254
1249 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1255 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1250 by resolving issue properly, i.e. by inheriting FakeModule
1256 by resolving issue properly, i.e. by inheriting FakeModule
1251 from types.ModuleType. Pickling ipython interactive data
1257 from types.ModuleType. Pickling ipython interactive data
1252 should still work as usual (testing appreciated).
1258 should still work as usual (testing appreciated).
1253
1259
1254 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1260 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1255
1261
1256 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1262 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1257 running under python 2.3 with code from 2.4 to fix a bug with
1263 running under python 2.3 with code from 2.4 to fix a bug with
1258 help(). Reported by the Debian maintainers, Norbert Tretkowski
1264 help(). Reported by the Debian maintainers, Norbert Tretkowski
1259 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1265 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1260 <afayolle-AT-debian.org>.
1266 <afayolle-AT-debian.org>.
1261
1267
1262 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1268 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1263
1269
1264 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1270 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1265 (which was displaying "quit" twice).
1271 (which was displaying "quit" twice).
1266
1272
1267 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1273 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1268
1274
1269 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1275 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1270 the mode argument).
1276 the mode argument).
1271
1277
1272 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1278 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1273
1279
1274 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1280 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1275 not running under IPython.
1281 not running under IPython.
1276
1282
1277 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1283 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1278 and make it iterable (iterating over the attribute itself). Add two new
1284 and make it iterable (iterating over the attribute itself). Add two new
1279 magic strings for __xattrs__(): If the string starts with "-", the attribute
1285 magic strings for __xattrs__(): If the string starts with "-", the attribute
1280 will not be displayed in ibrowse's detail view (but it can still be
1286 will not be displayed in ibrowse's detail view (but it can still be
1281 iterated over). This makes it possible to add attributes that are large
1287 iterated over). This makes it possible to add attributes that are large
1282 lists or generator methods to the detail view. Replace magic attribute names
1288 lists or generator methods to the detail view. Replace magic attribute names
1283 and _attrname() and _getattr() with "descriptors": For each type of magic
1289 and _attrname() and _getattr() with "descriptors": For each type of magic
1284 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1290 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1285 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1291 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1286 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1292 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1287 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1293 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1288 are still supported.
1294 are still supported.
1289
1295
1290 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1296 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1291 fails in ibrowse.fetch(), the exception object is added as the last item
1297 fails in ibrowse.fetch(), the exception object is added as the last item
1292 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1298 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1293 a generator throws an exception midway through execution.
1299 a generator throws an exception midway through execution.
1294
1300
1295 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1301 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1296 encoding into methods.
1302 encoding into methods.
1297
1303
1298 2006-07-26 Ville Vainio <vivainio@gmail.com>
1304 2006-07-26 Ville Vainio <vivainio@gmail.com>
1299
1305
1300 * iplib.py: history now stores multiline input as single
1306 * iplib.py: history now stores multiline input as single
1301 history entries. Patch by Jorgen Cederlof.
1307 history entries. Patch by Jorgen Cederlof.
1302
1308
1303 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1309 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1304
1310
1305 * IPython/Extensions/ibrowse.py: Make cursor visible over
1311 * IPython/Extensions/ibrowse.py: Make cursor visible over
1306 non existing attributes.
1312 non existing attributes.
1307
1313
1308 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1314 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1309
1315
1310 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1316 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1311 error output of the running command doesn't mess up the screen.
1317 error output of the running command doesn't mess up the screen.
1312
1318
1313 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1319 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1314
1320
1315 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1321 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1316 argument. This sorts the items themselves.
1322 argument. This sorts the items themselves.
1317
1323
1318 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1324 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1319
1325
1320 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1326 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1321 Compile expression strings into code objects. This should speed
1327 Compile expression strings into code objects. This should speed
1322 up ifilter and friends somewhat.
1328 up ifilter and friends somewhat.
1323
1329
1324 2006-07-08 Ville Vainio <vivainio@gmail.com>
1330 2006-07-08 Ville Vainio <vivainio@gmail.com>
1325
1331
1326 * Magic.py: %cpaste now strips > from the beginning of lines
1332 * Magic.py: %cpaste now strips > from the beginning of lines
1327 to ease pasting quoted code from emails. Contributed by
1333 to ease pasting quoted code from emails. Contributed by
1328 Stefan van der Walt.
1334 Stefan van der Walt.
1329
1335
1330 2006-06-29 Ville Vainio <vivainio@gmail.com>
1336 2006-06-29 Ville Vainio <vivainio@gmail.com>
1331
1337
1332 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1338 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1333 mode, patch contributed by Darren Dale. NEEDS TESTING!
1339 mode, patch contributed by Darren Dale. NEEDS TESTING!
1334
1340
1335 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1341 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1336
1342
1337 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1343 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1338 a blue background. Fix fetching new display rows when the browser
1344 a blue background. Fix fetching new display rows when the browser
1339 scrolls more than a screenful (e.g. by using the goto command).
1345 scrolls more than a screenful (e.g. by using the goto command).
1340
1346
1341 2006-06-27 Ville Vainio <vivainio@gmail.com>
1347 2006-06-27 Ville Vainio <vivainio@gmail.com>
1342
1348
1343 * Magic.py (_inspect, _ofind) Apply David Huard's
1349 * Magic.py (_inspect, _ofind) Apply David Huard's
1344 patch for displaying the correct docstring for 'property'
1350 patch for displaying the correct docstring for 'property'
1345 attributes.
1351 attributes.
1346
1352
1347 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1353 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1348
1354
1349 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1355 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1350 commands into the methods implementing them.
1356 commands into the methods implementing them.
1351
1357
1352 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1358 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1353
1359
1354 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1360 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1355 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1361 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1356 autoindent support was authored by Jin Liu.
1362 autoindent support was authored by Jin Liu.
1357
1363
1358 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1364 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1359
1365
1360 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1366 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1361 for keymaps with a custom class that simplifies handling.
1367 for keymaps with a custom class that simplifies handling.
1362
1368
1363 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1369 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1364
1370
1365 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1371 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1366 resizing. This requires Python 2.5 to work.
1372 resizing. This requires Python 2.5 to work.
1367
1373
1368 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1374 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1369
1375
1370 * IPython/Extensions/ibrowse.py: Add two new commands to
1376 * IPython/Extensions/ibrowse.py: Add two new commands to
1371 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1377 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1372 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1378 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1373 attributes again. Remapped the help command to "?". Display
1379 attributes again. Remapped the help command to "?". Display
1374 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1380 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1375 as keys for the "home" and "end" commands. Add three new commands
1381 as keys for the "home" and "end" commands. Add three new commands
1376 to the input mode for "find" and friends: "delend" (CTRL-K)
1382 to the input mode for "find" and friends: "delend" (CTRL-K)
1377 deletes to the end of line. "incsearchup" searches upwards in the
1383 deletes to the end of line. "incsearchup" searches upwards in the
1378 command history for an input that starts with the text before the cursor.
1384 command history for an input that starts with the text before the cursor.
1379 "incsearchdown" does the same downwards. Removed a bogus mapping of
1385 "incsearchdown" does the same downwards. Removed a bogus mapping of
1380 the x key to "delete".
1386 the x key to "delete".
1381
1387
1382 2006-06-15 Ville Vainio <vivainio@gmail.com>
1388 2006-06-15 Ville Vainio <vivainio@gmail.com>
1383
1389
1384 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1390 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1385 used to create prompts dynamically, instead of the "old" way of
1391 used to create prompts dynamically, instead of the "old" way of
1386 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1392 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1387 way still works (it's invoked by the default hook), of course.
1393 way still works (it's invoked by the default hook), of course.
1388
1394
1389 * Prompts.py: added generate_output_prompt hook for altering output
1395 * Prompts.py: added generate_output_prompt hook for altering output
1390 prompt
1396 prompt
1391
1397
1392 * Release.py: Changed version string to 0.7.3.svn.
1398 * Release.py: Changed version string to 0.7.3.svn.
1393
1399
1394 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1400 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1395
1401
1396 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1402 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1397 the call to fetch() always tries to fetch enough data for at least one
1403 the call to fetch() always tries to fetch enough data for at least one
1398 full screen. This makes it possible to simply call moveto(0,0,True) in
1404 full screen. This makes it possible to simply call moveto(0,0,True) in
1399 the constructor. Fix typos and removed the obsolete goto attribute.
1405 the constructor. Fix typos and removed the obsolete goto attribute.
1400
1406
1401 2006-06-12 Ville Vainio <vivainio@gmail.com>
1407 2006-06-12 Ville Vainio <vivainio@gmail.com>
1402
1408
1403 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1409 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1404 allowing $variable interpolation within multiline statements,
1410 allowing $variable interpolation within multiline statements,
1405 though so far only with "sh" profile for a testing period.
1411 though so far only with "sh" profile for a testing period.
1406 The patch also enables splitting long commands with \ but it
1412 The patch also enables splitting long commands with \ but it
1407 doesn't work properly yet.
1413 doesn't work properly yet.
1408
1414
1409 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1415 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1410
1416
1411 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1417 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1412 input history and the position of the cursor in the input history for
1418 input history and the position of the cursor in the input history for
1413 the find, findbackwards and goto command.
1419 the find, findbackwards and goto command.
1414
1420
1415 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1421 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1416
1422
1417 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1423 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1418 implements the basic functionality of browser commands that require
1424 implements the basic functionality of browser commands that require
1419 input. Reimplement the goto, find and findbackwards commands as
1425 input. Reimplement the goto, find and findbackwards commands as
1420 subclasses of _CommandInput. Add an input history and keymaps to those
1426 subclasses of _CommandInput. Add an input history and keymaps to those
1421 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1427 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1422 execute commands.
1428 execute commands.
1423
1429
1424 2006-06-07 Ville Vainio <vivainio@gmail.com>
1430 2006-06-07 Ville Vainio <vivainio@gmail.com>
1425
1431
1426 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1432 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1427 running the batch files instead of leaving the session open.
1433 running the batch files instead of leaving the session open.
1428
1434
1429 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1435 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1430
1436
1431 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1437 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1432 the original fix was incomplete. Patch submitted by W. Maier.
1438 the original fix was incomplete. Patch submitted by W. Maier.
1433
1439
1434 2006-06-07 Ville Vainio <vivainio@gmail.com>
1440 2006-06-07 Ville Vainio <vivainio@gmail.com>
1435
1441
1436 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1442 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1437 Confirmation prompts can be supressed by 'quiet' option.
1443 Confirmation prompts can be supressed by 'quiet' option.
1438 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1444 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1439
1445
1440 2006-06-06 *** Released version 0.7.2
1446 2006-06-06 *** Released version 0.7.2
1441
1447
1442 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1448 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1443
1449
1444 * IPython/Release.py (version): Made 0.7.2 final for release.
1450 * IPython/Release.py (version): Made 0.7.2 final for release.
1445 Repo tagged and release cut.
1451 Repo tagged and release cut.
1446
1452
1447 2006-06-05 Ville Vainio <vivainio@gmail.com>
1453 2006-06-05 Ville Vainio <vivainio@gmail.com>
1448
1454
1449 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1455 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1450 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1456 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1451
1457
1452 * upgrade_dir.py: try import 'path' module a bit harder
1458 * upgrade_dir.py: try import 'path' module a bit harder
1453 (for %upgrade)
1459 (for %upgrade)
1454
1460
1455 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1461 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1456
1462
1457 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1463 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1458 instead of looping 20 times.
1464 instead of looping 20 times.
1459
1465
1460 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1466 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1461 correctly at initialization time. Bug reported by Krishna Mohan
1467 correctly at initialization time. Bug reported by Krishna Mohan
1462 Gundu <gkmohan-AT-gmail.com> on the user list.
1468 Gundu <gkmohan-AT-gmail.com> on the user list.
1463
1469
1464 * IPython/Release.py (version): Mark 0.7.2 version to start
1470 * IPython/Release.py (version): Mark 0.7.2 version to start
1465 testing for release on 06/06.
1471 testing for release on 06/06.
1466
1472
1467 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1473 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1468
1474
1469 * scripts/irunner: thin script interface so users don't have to
1475 * scripts/irunner: thin script interface so users don't have to
1470 find the module and call it as an executable, since modules rarely
1476 find the module and call it as an executable, since modules rarely
1471 live in people's PATH.
1477 live in people's PATH.
1472
1478
1473 * IPython/irunner.py (InteractiveRunner.__init__): added
1479 * IPython/irunner.py (InteractiveRunner.__init__): added
1474 delaybeforesend attribute to control delays with newer versions of
1480 delaybeforesend attribute to control delays with newer versions of
1475 pexpect. Thanks to detailed help from pexpect's author, Noah
1481 pexpect. Thanks to detailed help from pexpect's author, Noah
1476 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1482 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1477 correctly (it works in NoColor mode).
1483 correctly (it works in NoColor mode).
1478
1484
1479 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1485 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1480 SAGE list, from improper log() calls.
1486 SAGE list, from improper log() calls.
1481
1487
1482 2006-05-31 Ville Vainio <vivainio@gmail.com>
1488 2006-05-31 Ville Vainio <vivainio@gmail.com>
1483
1489
1484 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1490 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1485 with args in parens to work correctly with dirs that have spaces.
1491 with args in parens to work correctly with dirs that have spaces.
1486
1492
1487 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1493 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1488
1494
1489 * IPython/Logger.py (Logger.logstart): add option to log raw input
1495 * IPython/Logger.py (Logger.logstart): add option to log raw input
1490 instead of the processed one. A -r flag was added to the
1496 instead of the processed one. A -r flag was added to the
1491 %logstart magic used for controlling logging.
1497 %logstart magic used for controlling logging.
1492
1498
1493 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1499 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1494
1500
1495 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1501 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1496 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1502 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1497 recognize the option. After a bug report by Will Maier. This
1503 recognize the option. After a bug report by Will Maier. This
1498 closes #64 (will do it after confirmation from W. Maier).
1504 closes #64 (will do it after confirmation from W. Maier).
1499
1505
1500 * IPython/irunner.py: New module to run scripts as if manually
1506 * IPython/irunner.py: New module to run scripts as if manually
1501 typed into an interactive environment, based on pexpect. After a
1507 typed into an interactive environment, based on pexpect. After a
1502 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1508 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1503 ipython-user list. Simple unittests in the tests/ directory.
1509 ipython-user list. Simple unittests in the tests/ directory.
1504
1510
1505 * tools/release: add Will Maier, OpenBSD port maintainer, to
1511 * tools/release: add Will Maier, OpenBSD port maintainer, to
1506 recepients list. We are now officially part of the OpenBSD ports:
1512 recepients list. We are now officially part of the OpenBSD ports:
1507 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1513 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1508 work.
1514 work.
1509
1515
1510 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1516 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1511
1517
1512 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1518 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1513 so that it doesn't break tkinter apps.
1519 so that it doesn't break tkinter apps.
1514
1520
1515 * IPython/iplib.py (_prefilter): fix bug where aliases would
1521 * IPython/iplib.py (_prefilter): fix bug where aliases would
1516 shadow variables when autocall was fully off. Reported by SAGE
1522 shadow variables when autocall was fully off. Reported by SAGE
1517 author William Stein.
1523 author William Stein.
1518
1524
1519 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1525 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1520 at what detail level strings are computed when foo? is requested.
1526 at what detail level strings are computed when foo? is requested.
1521 This allows users to ask for example that the string form of an
1527 This allows users to ask for example that the string form of an
1522 object is only computed when foo?? is called, or even never, by
1528 object is only computed when foo?? is called, or even never, by
1523 setting the object_info_string_level >= 2 in the configuration
1529 setting the object_info_string_level >= 2 in the configuration
1524 file. This new option has been added and documented. After a
1530 file. This new option has been added and documented. After a
1525 request by SAGE to be able to control the printing of very large
1531 request by SAGE to be able to control the printing of very large
1526 objects more easily.
1532 objects more easily.
1527
1533
1528 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1534 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1529
1535
1530 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1536 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1531 from sys.argv, to be 100% consistent with how Python itself works
1537 from sys.argv, to be 100% consistent with how Python itself works
1532 (as seen for example with python -i file.py). After a bug report
1538 (as seen for example with python -i file.py). After a bug report
1533 by Jeffrey Collins.
1539 by Jeffrey Collins.
1534
1540
1535 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1541 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1536 nasty bug which was preventing custom namespaces with -pylab,
1542 nasty bug which was preventing custom namespaces with -pylab,
1537 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1543 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1538 compatibility (long gone from mpl).
1544 compatibility (long gone from mpl).
1539
1545
1540 * IPython/ipapi.py (make_session): name change: create->make. We
1546 * IPython/ipapi.py (make_session): name change: create->make. We
1541 use make in other places (ipmaker,...), it's shorter and easier to
1547 use make in other places (ipmaker,...), it's shorter and easier to
1542 type and say, etc. I'm trying to clean things before 0.7.2 so
1548 type and say, etc. I'm trying to clean things before 0.7.2 so
1543 that I can keep things stable wrt to ipapi in the chainsaw branch.
1549 that I can keep things stable wrt to ipapi in the chainsaw branch.
1544
1550
1545 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1551 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1546 python-mode recognizes our debugger mode. Add support for
1552 python-mode recognizes our debugger mode. Add support for
1547 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1553 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1548 <m.liu.jin-AT-gmail.com> originally written by
1554 <m.liu.jin-AT-gmail.com> originally written by
1549 doxgen-AT-newsmth.net (with minor modifications for xemacs
1555 doxgen-AT-newsmth.net (with minor modifications for xemacs
1550 compatibility)
1556 compatibility)
1551
1557
1552 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1558 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1553 tracebacks when walking the stack so that the stack tracking system
1559 tracebacks when walking the stack so that the stack tracking system
1554 in emacs' python-mode can identify the frames correctly.
1560 in emacs' python-mode can identify the frames correctly.
1555
1561
1556 * IPython/ipmaker.py (make_IPython): make the internal (and
1562 * IPython/ipmaker.py (make_IPython): make the internal (and
1557 default config) autoedit_syntax value false by default. Too many
1563 default config) autoedit_syntax value false by default. Too many
1558 users have complained to me (both on and off-list) about problems
1564 users have complained to me (both on and off-list) about problems
1559 with this option being on by default, so I'm making it default to
1565 with this option being on by default, so I'm making it default to
1560 off. It can still be enabled by anyone via the usual mechanisms.
1566 off. It can still be enabled by anyone via the usual mechanisms.
1561
1567
1562 * IPython/completer.py (Completer.attr_matches): add support for
1568 * IPython/completer.py (Completer.attr_matches): add support for
1563 PyCrust-style _getAttributeNames magic method. Patch contributed
1569 PyCrust-style _getAttributeNames magic method. Patch contributed
1564 by <mscott-AT-goldenspud.com>. Closes #50.
1570 by <mscott-AT-goldenspud.com>. Closes #50.
1565
1571
1566 * IPython/iplib.py (InteractiveShell.__init__): remove the
1572 * IPython/iplib.py (InteractiveShell.__init__): remove the
1567 deletion of exit/quit from __builtin__, which can break
1573 deletion of exit/quit from __builtin__, which can break
1568 third-party tools like the Zope debugging console. The
1574 third-party tools like the Zope debugging console. The
1569 %exit/%quit magics remain. In general, it's probably a good idea
1575 %exit/%quit magics remain. In general, it's probably a good idea
1570 not to delete anything from __builtin__, since we never know what
1576 not to delete anything from __builtin__, since we never know what
1571 that will break. In any case, python now (for 2.5) will support
1577 that will break. In any case, python now (for 2.5) will support
1572 'real' exit/quit, so this issue is moot. Closes #55.
1578 'real' exit/quit, so this issue is moot. Closes #55.
1573
1579
1574 * IPython/genutils.py (with_obj): rename the 'with' function to
1580 * IPython/genutils.py (with_obj): rename the 'with' function to
1575 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1581 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1576 becomes a language keyword. Closes #53.
1582 becomes a language keyword. Closes #53.
1577
1583
1578 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1584 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1579 __file__ attribute to this so it fools more things into thinking
1585 __file__ attribute to this so it fools more things into thinking
1580 it is a real module. Closes #59.
1586 it is a real module. Closes #59.
1581
1587
1582 * IPython/Magic.py (magic_edit): add -n option to open the editor
1588 * IPython/Magic.py (magic_edit): add -n option to open the editor
1583 at a specific line number. After a patch by Stefan van der Walt.
1589 at a specific line number. After a patch by Stefan van der Walt.
1584
1590
1585 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1591 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1586
1592
1587 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1593 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1588 reason the file could not be opened. After automatic crash
1594 reason the file could not be opened. After automatic crash
1589 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1595 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1590 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1596 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1591 (_should_recompile): Don't fire editor if using %bg, since there
1597 (_should_recompile): Don't fire editor if using %bg, since there
1592 is no file in the first place. From the same report as above.
1598 is no file in the first place. From the same report as above.
1593 (raw_input): protect against faulty third-party prefilters. After
1599 (raw_input): protect against faulty third-party prefilters. After
1594 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1600 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1595 while running under SAGE.
1601 while running under SAGE.
1596
1602
1597 2006-05-23 Ville Vainio <vivainio@gmail.com>
1603 2006-05-23 Ville Vainio <vivainio@gmail.com>
1598
1604
1599 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1605 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1600 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1606 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1601 now returns None (again), unless dummy is specifically allowed by
1607 now returns None (again), unless dummy is specifically allowed by
1602 ipapi.get(allow_dummy=True).
1608 ipapi.get(allow_dummy=True).
1603
1609
1604 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1610 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1605
1611
1606 * IPython: remove all 2.2-compatibility objects and hacks from
1612 * IPython: remove all 2.2-compatibility objects and hacks from
1607 everywhere, since we only support 2.3 at this point. Docs
1613 everywhere, since we only support 2.3 at this point. Docs
1608 updated.
1614 updated.
1609
1615
1610 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1616 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1611 Anything requiring extra validation can be turned into a Python
1617 Anything requiring extra validation can be turned into a Python
1612 property in the future. I used a property for the db one b/c
1618 property in the future. I used a property for the db one b/c
1613 there was a nasty circularity problem with the initialization
1619 there was a nasty circularity problem with the initialization
1614 order, which right now I don't have time to clean up.
1620 order, which right now I don't have time to clean up.
1615
1621
1616 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1622 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1617 another locking bug reported by Jorgen. I'm not 100% sure though,
1623 another locking bug reported by Jorgen. I'm not 100% sure though,
1618 so more testing is needed...
1624 so more testing is needed...
1619
1625
1620 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1626 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1621
1627
1622 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1628 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1623 local variables from any routine in user code (typically executed
1629 local variables from any routine in user code (typically executed
1624 with %run) directly into the interactive namespace. Very useful
1630 with %run) directly into the interactive namespace. Very useful
1625 when doing complex debugging.
1631 when doing complex debugging.
1626 (IPythonNotRunning): Changed the default None object to a dummy
1632 (IPythonNotRunning): Changed the default None object to a dummy
1627 whose attributes can be queried as well as called without
1633 whose attributes can be queried as well as called without
1628 exploding, to ease writing code which works transparently both in
1634 exploding, to ease writing code which works transparently both in
1629 and out of ipython and uses some of this API.
1635 and out of ipython and uses some of this API.
1630
1636
1631 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1637 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1632
1638
1633 * IPython/hooks.py (result_display): Fix the fact that our display
1639 * IPython/hooks.py (result_display): Fix the fact that our display
1634 hook was using str() instead of repr(), as the default python
1640 hook was using str() instead of repr(), as the default python
1635 console does. This had gone unnoticed b/c it only happened if
1641 console does. This had gone unnoticed b/c it only happened if
1636 %Pprint was off, but the inconsistency was there.
1642 %Pprint was off, but the inconsistency was there.
1637
1643
1638 2006-05-15 Ville Vainio <vivainio@gmail.com>
1644 2006-05-15 Ville Vainio <vivainio@gmail.com>
1639
1645
1640 * Oinspect.py: Only show docstring for nonexisting/binary files
1646 * Oinspect.py: Only show docstring for nonexisting/binary files
1641 when doing object??, closing ticket #62
1647 when doing object??, closing ticket #62
1642
1648
1643 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1649 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1644
1650
1645 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1651 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1646 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1652 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1647 was being released in a routine which hadn't checked if it had
1653 was being released in a routine which hadn't checked if it had
1648 been the one to acquire it.
1654 been the one to acquire it.
1649
1655
1650 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1656 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1651
1657
1652 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1658 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1653
1659
1654 2006-04-11 Ville Vainio <vivainio@gmail.com>
1660 2006-04-11 Ville Vainio <vivainio@gmail.com>
1655
1661
1656 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1662 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1657 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1663 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1658 prefilters, allowing stuff like magics and aliases in the file.
1664 prefilters, allowing stuff like magics and aliases in the file.
1659
1665
1660 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1666 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1661 added. Supported now are "%clear in" and "%clear out" (clear input and
1667 added. Supported now are "%clear in" and "%clear out" (clear input and
1662 output history, respectively). Also fixed CachedOutput.flush to
1668 output history, respectively). Also fixed CachedOutput.flush to
1663 properly flush the output cache.
1669 properly flush the output cache.
1664
1670
1665 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1671 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1666 half-success (and fail explicitly).
1672 half-success (and fail explicitly).
1667
1673
1668 2006-03-28 Ville Vainio <vivainio@gmail.com>
1674 2006-03-28 Ville Vainio <vivainio@gmail.com>
1669
1675
1670 * iplib.py: Fix quoting of aliases so that only argless ones
1676 * iplib.py: Fix quoting of aliases so that only argless ones
1671 are quoted
1677 are quoted
1672
1678
1673 2006-03-28 Ville Vainio <vivainio@gmail.com>
1679 2006-03-28 Ville Vainio <vivainio@gmail.com>
1674
1680
1675 * iplib.py: Quote aliases with spaces in the name.
1681 * iplib.py: Quote aliases with spaces in the name.
1676 "c:\program files\blah\bin" is now legal alias target.
1682 "c:\program files\blah\bin" is now legal alias target.
1677
1683
1678 * ext_rehashdir.py: Space no longer allowed as arg
1684 * ext_rehashdir.py: Space no longer allowed as arg
1679 separator, since space is legal in path names.
1685 separator, since space is legal in path names.
1680
1686
1681 2006-03-16 Ville Vainio <vivainio@gmail.com>
1687 2006-03-16 Ville Vainio <vivainio@gmail.com>
1682
1688
1683 * upgrade_dir.py: Take path.py from Extensions, correcting
1689 * upgrade_dir.py: Take path.py from Extensions, correcting
1684 %upgrade magic
1690 %upgrade magic
1685
1691
1686 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1692 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1687
1693
1688 * hooks.py: Only enclose editor binary in quotes if legal and
1694 * hooks.py: Only enclose editor binary in quotes if legal and
1689 necessary (space in the name, and is an existing file). Fixes a bug
1695 necessary (space in the name, and is an existing file). Fixes a bug
1690 reported by Zachary Pincus.
1696 reported by Zachary Pincus.
1691
1697
1692 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1698 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1693
1699
1694 * Manual: thanks to a tip on proper color handling for Emacs, by
1700 * Manual: thanks to a tip on proper color handling for Emacs, by
1695 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1701 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1696
1702
1697 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1703 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1698 by applying the provided patch. Thanks to Liu Jin
1704 by applying the provided patch. Thanks to Liu Jin
1699 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1705 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1700 XEmacs/Linux, I'm trusting the submitter that it actually helps
1706 XEmacs/Linux, I'm trusting the submitter that it actually helps
1701 under win32/GNU Emacs. Will revisit if any problems are reported.
1707 under win32/GNU Emacs. Will revisit if any problems are reported.
1702
1708
1703 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1709 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1704
1710
1705 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1711 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1706 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1712 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1707
1713
1708 2006-03-12 Ville Vainio <vivainio@gmail.com>
1714 2006-03-12 Ville Vainio <vivainio@gmail.com>
1709
1715
1710 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1716 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1711 Torsten Marek.
1717 Torsten Marek.
1712
1718
1713 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1719 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1714
1720
1715 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1721 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1716 line ranges works again.
1722 line ranges works again.
1717
1723
1718 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1724 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1719
1725
1720 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1726 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1721 and friends, after a discussion with Zach Pincus on ipython-user.
1727 and friends, after a discussion with Zach Pincus on ipython-user.
1722 I'm not 100% sure, but after thinking about it quite a bit, it may
1728 I'm not 100% sure, but after thinking about it quite a bit, it may
1723 be OK. Testing with the multithreaded shells didn't reveal any
1729 be OK. Testing with the multithreaded shells didn't reveal any
1724 problems, but let's keep an eye out.
1730 problems, but let's keep an eye out.
1725
1731
1726 In the process, I fixed a few things which were calling
1732 In the process, I fixed a few things which were calling
1727 self.InteractiveTB() directly (like safe_execfile), which is a
1733 self.InteractiveTB() directly (like safe_execfile), which is a
1728 mistake: ALL exception reporting should be done by calling
1734 mistake: ALL exception reporting should be done by calling
1729 self.showtraceback(), which handles state and tab-completion and
1735 self.showtraceback(), which handles state and tab-completion and
1730 more.
1736 more.
1731
1737
1732 2006-03-01 Ville Vainio <vivainio@gmail.com>
1738 2006-03-01 Ville Vainio <vivainio@gmail.com>
1733
1739
1734 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1740 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1735 To use, do "from ipipe import *".
1741 To use, do "from ipipe import *".
1736
1742
1737 2006-02-24 Ville Vainio <vivainio@gmail.com>
1743 2006-02-24 Ville Vainio <vivainio@gmail.com>
1738
1744
1739 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1745 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1740 "cleanly" and safely than the older upgrade mechanism.
1746 "cleanly" and safely than the older upgrade mechanism.
1741
1747
1742 2006-02-21 Ville Vainio <vivainio@gmail.com>
1748 2006-02-21 Ville Vainio <vivainio@gmail.com>
1743
1749
1744 * Magic.py: %save works again.
1750 * Magic.py: %save works again.
1745
1751
1746 2006-02-15 Ville Vainio <vivainio@gmail.com>
1752 2006-02-15 Ville Vainio <vivainio@gmail.com>
1747
1753
1748 * Magic.py: %Pprint works again
1754 * Magic.py: %Pprint works again
1749
1755
1750 * Extensions/ipy_sane_defaults.py: Provide everything provided
1756 * Extensions/ipy_sane_defaults.py: Provide everything provided
1751 in default ipythonrc, to make it possible to have a completely empty
1757 in default ipythonrc, to make it possible to have a completely empty
1752 ipythonrc (and thus completely rc-file free configuration)
1758 ipythonrc (and thus completely rc-file free configuration)
1753
1759
1754 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1760 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1755
1761
1756 * IPython/hooks.py (editor): quote the call to the editor command,
1762 * IPython/hooks.py (editor): quote the call to the editor command,
1757 to allow commands with spaces in them. Problem noted by watching
1763 to allow commands with spaces in them. Problem noted by watching
1758 Ian Oswald's video about textpad under win32 at
1764 Ian Oswald's video about textpad under win32 at
1759 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1765 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1760
1766
1761 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1767 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1762 describing magics (we haven't used @ for a loong time).
1768 describing magics (we haven't used @ for a loong time).
1763
1769
1764 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1770 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1765 contributed by marienz to close
1771 contributed by marienz to close
1766 http://www.scipy.net/roundup/ipython/issue53.
1772 http://www.scipy.net/roundup/ipython/issue53.
1767
1773
1768 2006-02-10 Ville Vainio <vivainio@gmail.com>
1774 2006-02-10 Ville Vainio <vivainio@gmail.com>
1769
1775
1770 * genutils.py: getoutput now works in win32 too
1776 * genutils.py: getoutput now works in win32 too
1771
1777
1772 * completer.py: alias and magic completion only invoked
1778 * completer.py: alias and magic completion only invoked
1773 at the first "item" in the line, to avoid "cd %store"
1779 at the first "item" in the line, to avoid "cd %store"
1774 nonsense.
1780 nonsense.
1775
1781
1776 2006-02-09 Ville Vainio <vivainio@gmail.com>
1782 2006-02-09 Ville Vainio <vivainio@gmail.com>
1777
1783
1778 * test/*: Added a unit testing framework (finally).
1784 * test/*: Added a unit testing framework (finally).
1779 '%run runtests.py' to run test_*.
1785 '%run runtests.py' to run test_*.
1780
1786
1781 * ipapi.py: Exposed runlines and set_custom_exc
1787 * ipapi.py: Exposed runlines and set_custom_exc
1782
1788
1783 2006-02-07 Ville Vainio <vivainio@gmail.com>
1789 2006-02-07 Ville Vainio <vivainio@gmail.com>
1784
1790
1785 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1791 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1786 instead use "f(1 2)" as before.
1792 instead use "f(1 2)" as before.
1787
1793
1788 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1794 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1789
1795
1790 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1796 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1791 facilities, for demos processed by the IPython input filter
1797 facilities, for demos processed by the IPython input filter
1792 (IPythonDemo), and for running a script one-line-at-a-time as a
1798 (IPythonDemo), and for running a script one-line-at-a-time as a
1793 demo, both for pure Python (LineDemo) and for IPython-processed
1799 demo, both for pure Python (LineDemo) and for IPython-processed
1794 input (IPythonLineDemo). After a request by Dave Kohel, from the
1800 input (IPythonLineDemo). After a request by Dave Kohel, from the
1795 SAGE team.
1801 SAGE team.
1796 (Demo.edit): added an edit() method to the demo objects, to edit
1802 (Demo.edit): added an edit() method to the demo objects, to edit
1797 the in-memory copy of the last executed block.
1803 the in-memory copy of the last executed block.
1798
1804
1799 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1805 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1800 processing to %edit, %macro and %save. These commands can now be
1806 processing to %edit, %macro and %save. These commands can now be
1801 invoked on the unprocessed input as it was typed by the user
1807 invoked on the unprocessed input as it was typed by the user
1802 (without any prefilters applied). After requests by the SAGE team
1808 (without any prefilters applied). After requests by the SAGE team
1803 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1809 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1804
1810
1805 2006-02-01 Ville Vainio <vivainio@gmail.com>
1811 2006-02-01 Ville Vainio <vivainio@gmail.com>
1806
1812
1807 * setup.py, eggsetup.py: easy_install ipython==dev works
1813 * setup.py, eggsetup.py: easy_install ipython==dev works
1808 correctly now (on Linux)
1814 correctly now (on Linux)
1809
1815
1810 * ipy_user_conf,ipmaker: user config changes, removed spurious
1816 * ipy_user_conf,ipmaker: user config changes, removed spurious
1811 warnings
1817 warnings
1812
1818
1813 * iplib: if rc.banner is string, use it as is.
1819 * iplib: if rc.banner is string, use it as is.
1814
1820
1815 * Magic: %pycat accepts a string argument and pages it's contents.
1821 * Magic: %pycat accepts a string argument and pages it's contents.
1816
1822
1817
1823
1818 2006-01-30 Ville Vainio <vivainio@gmail.com>
1824 2006-01-30 Ville Vainio <vivainio@gmail.com>
1819
1825
1820 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1826 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1821 Now %store and bookmarks work through PickleShare, meaning that
1827 Now %store and bookmarks work through PickleShare, meaning that
1822 concurrent access is possible and all ipython sessions see the
1828 concurrent access is possible and all ipython sessions see the
1823 same database situation all the time, instead of snapshot of
1829 same database situation all the time, instead of snapshot of
1824 the situation when the session was started. Hence, %bookmark
1830 the situation when the session was started. Hence, %bookmark
1825 results are immediately accessible from othes sessions. The database
1831 results are immediately accessible from othes sessions. The database
1826 is also available for use by user extensions. See:
1832 is also available for use by user extensions. See:
1827 http://www.python.org/pypi/pickleshare
1833 http://www.python.org/pypi/pickleshare
1828
1834
1829 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1835 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1830
1836
1831 * aliases can now be %store'd
1837 * aliases can now be %store'd
1832
1838
1833 * path.py moved to Extensions so that pickleshare does not need
1839 * path.py moved to Extensions so that pickleshare does not need
1834 IPython-specific import. Extensions added to pythonpath right
1840 IPython-specific import. Extensions added to pythonpath right
1835 at __init__.
1841 at __init__.
1836
1842
1837 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1843 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1838 called with _ip.system and the pre-transformed command string.
1844 called with _ip.system and the pre-transformed command string.
1839
1845
1840 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1846 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1841
1847
1842 * IPython/iplib.py (interact): Fix that we were not catching
1848 * IPython/iplib.py (interact): Fix that we were not catching
1843 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1849 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1844 logic here had to change, but it's fixed now.
1850 logic here had to change, but it's fixed now.
1845
1851
1846 2006-01-29 Ville Vainio <vivainio@gmail.com>
1852 2006-01-29 Ville Vainio <vivainio@gmail.com>
1847
1853
1848 * iplib.py: Try to import pyreadline on Windows.
1854 * iplib.py: Try to import pyreadline on Windows.
1849
1855
1850 2006-01-27 Ville Vainio <vivainio@gmail.com>
1856 2006-01-27 Ville Vainio <vivainio@gmail.com>
1851
1857
1852 * iplib.py: Expose ipapi as _ip in builtin namespace.
1858 * iplib.py: Expose ipapi as _ip in builtin namespace.
1853 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1859 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1854 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1860 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1855 syntax now produce _ip.* variant of the commands.
1861 syntax now produce _ip.* variant of the commands.
1856
1862
1857 * "_ip.options().autoedit_syntax = 2" automatically throws
1863 * "_ip.options().autoedit_syntax = 2" automatically throws
1858 user to editor for syntax error correction without prompting.
1864 user to editor for syntax error correction without prompting.
1859
1865
1860 2006-01-27 Ville Vainio <vivainio@gmail.com>
1866 2006-01-27 Ville Vainio <vivainio@gmail.com>
1861
1867
1862 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1868 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1863 'ipython' at argv[0]) executed through command line.
1869 'ipython' at argv[0]) executed through command line.
1864 NOTE: this DEPRECATES calling ipython with multiple scripts
1870 NOTE: this DEPRECATES calling ipython with multiple scripts
1865 ("ipython a.py b.py c.py")
1871 ("ipython a.py b.py c.py")
1866
1872
1867 * iplib.py, hooks.py: Added configurable input prefilter,
1873 * iplib.py, hooks.py: Added configurable input prefilter,
1868 named 'input_prefilter'. See ext_rescapture.py for example
1874 named 'input_prefilter'. See ext_rescapture.py for example
1869 usage.
1875 usage.
1870
1876
1871 * ext_rescapture.py, Magic.py: Better system command output capture
1877 * ext_rescapture.py, Magic.py: Better system command output capture
1872 through 'var = !ls' (deprecates user-visible %sc). Same notation
1878 through 'var = !ls' (deprecates user-visible %sc). Same notation
1873 applies for magics, 'var = %alias' assigns alias list to var.
1879 applies for magics, 'var = %alias' assigns alias list to var.
1874
1880
1875 * ipapi.py: added meta() for accessing extension-usable data store.
1881 * ipapi.py: added meta() for accessing extension-usable data store.
1876
1882
1877 * iplib.py: added InteractiveShell.getapi(). New magics should be
1883 * iplib.py: added InteractiveShell.getapi(). New magics should be
1878 written doing self.getapi() instead of using the shell directly.
1884 written doing self.getapi() instead of using the shell directly.
1879
1885
1880 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1886 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1881 %store foo >> ~/myfoo.txt to store variables to files (in clean
1887 %store foo >> ~/myfoo.txt to store variables to files (in clean
1882 textual form, not a restorable pickle).
1888 textual form, not a restorable pickle).
1883
1889
1884 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1890 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1885
1891
1886 * usage.py, Magic.py: added %quickref
1892 * usage.py, Magic.py: added %quickref
1887
1893
1888 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1894 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1889
1895
1890 * GetoptErrors when invoking magics etc. with wrong args
1896 * GetoptErrors when invoking magics etc. with wrong args
1891 are now more helpful:
1897 are now more helpful:
1892 GetoptError: option -l not recognized (allowed: "qb" )
1898 GetoptError: option -l not recognized (allowed: "qb" )
1893
1899
1894 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1900 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1895
1901
1896 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1902 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1897 computationally intensive blocks don't appear to stall the demo.
1903 computationally intensive blocks don't appear to stall the demo.
1898
1904
1899 2006-01-24 Ville Vainio <vivainio@gmail.com>
1905 2006-01-24 Ville Vainio <vivainio@gmail.com>
1900
1906
1901 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1907 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1902 value to manipulate resulting history entry.
1908 value to manipulate resulting history entry.
1903
1909
1904 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1910 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1905 to instance methods of IPApi class, to make extending an embedded
1911 to instance methods of IPApi class, to make extending an embedded
1906 IPython feasible. See ext_rehashdir.py for example usage.
1912 IPython feasible. See ext_rehashdir.py for example usage.
1907
1913
1908 * Merged 1071-1076 from branches/0.7.1
1914 * Merged 1071-1076 from branches/0.7.1
1909
1915
1910
1916
1911 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1917 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1912
1918
1913 * tools/release (daystamp): Fix build tools to use the new
1919 * tools/release (daystamp): Fix build tools to use the new
1914 eggsetup.py script to build lightweight eggs.
1920 eggsetup.py script to build lightweight eggs.
1915
1921
1916 * Applied changesets 1062 and 1064 before 0.7.1 release.
1922 * Applied changesets 1062 and 1064 before 0.7.1 release.
1917
1923
1918 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1924 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1919 see the raw input history (without conversions like %ls ->
1925 see the raw input history (without conversions like %ls ->
1920 ipmagic("ls")). After a request from W. Stein, SAGE
1926 ipmagic("ls")). After a request from W. Stein, SAGE
1921 (http://modular.ucsd.edu/sage) developer. This information is
1927 (http://modular.ucsd.edu/sage) developer. This information is
1922 stored in the input_hist_raw attribute of the IPython instance, so
1928 stored in the input_hist_raw attribute of the IPython instance, so
1923 developers can access it if needed (it's an InputList instance).
1929 developers can access it if needed (it's an InputList instance).
1924
1930
1925 * Versionstring = 0.7.2.svn
1931 * Versionstring = 0.7.2.svn
1926
1932
1927 * eggsetup.py: A separate script for constructing eggs, creates
1933 * eggsetup.py: A separate script for constructing eggs, creates
1928 proper launch scripts even on Windows (an .exe file in
1934 proper launch scripts even on Windows (an .exe file in
1929 \python24\scripts).
1935 \python24\scripts).
1930
1936
1931 * ipapi.py: launch_new_instance, launch entry point needed for the
1937 * ipapi.py: launch_new_instance, launch entry point needed for the
1932 egg.
1938 egg.
1933
1939
1934 2006-01-23 Ville Vainio <vivainio@gmail.com>
1940 2006-01-23 Ville Vainio <vivainio@gmail.com>
1935
1941
1936 * Added %cpaste magic for pasting python code
1942 * Added %cpaste magic for pasting python code
1937
1943
1938 2006-01-22 Ville Vainio <vivainio@gmail.com>
1944 2006-01-22 Ville Vainio <vivainio@gmail.com>
1939
1945
1940 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1946 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1941
1947
1942 * Versionstring = 0.7.2.svn
1948 * Versionstring = 0.7.2.svn
1943
1949
1944 * eggsetup.py: A separate script for constructing eggs, creates
1950 * eggsetup.py: A separate script for constructing eggs, creates
1945 proper launch scripts even on Windows (an .exe file in
1951 proper launch scripts even on Windows (an .exe file in
1946 \python24\scripts).
1952 \python24\scripts).
1947
1953
1948 * ipapi.py: launch_new_instance, launch entry point needed for the
1954 * ipapi.py: launch_new_instance, launch entry point needed for the
1949 egg.
1955 egg.
1950
1956
1951 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1957 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1952
1958
1953 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1959 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1954 %pfile foo would print the file for foo even if it was a binary.
1960 %pfile foo would print the file for foo even if it was a binary.
1955 Now, extensions '.so' and '.dll' are skipped.
1961 Now, extensions '.so' and '.dll' are skipped.
1956
1962
1957 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1963 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1958 bug, where macros would fail in all threaded modes. I'm not 100%
1964 bug, where macros would fail in all threaded modes. I'm not 100%
1959 sure, so I'm going to put out an rc instead of making a release
1965 sure, so I'm going to put out an rc instead of making a release
1960 today, and wait for feedback for at least a few days.
1966 today, and wait for feedback for at least a few days.
1961
1967
1962 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1968 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1963 it...) the handling of pasting external code with autoindent on.
1969 it...) the handling of pasting external code with autoindent on.
1964 To get out of a multiline input, the rule will appear for most
1970 To get out of a multiline input, the rule will appear for most
1965 users unchanged: two blank lines or change the indent level
1971 users unchanged: two blank lines or change the indent level
1966 proposed by IPython. But there is a twist now: you can
1972 proposed by IPython. But there is a twist now: you can
1967 add/subtract only *one or two spaces*. If you add/subtract three
1973 add/subtract only *one or two spaces*. If you add/subtract three
1968 or more (unless you completely delete the line), IPython will
1974 or more (unless you completely delete the line), IPython will
1969 accept that line, and you'll need to enter a second one of pure
1975 accept that line, and you'll need to enter a second one of pure
1970 whitespace. I know it sounds complicated, but I can't find a
1976 whitespace. I know it sounds complicated, but I can't find a
1971 different solution that covers all the cases, with the right
1977 different solution that covers all the cases, with the right
1972 heuristics. Hopefully in actual use, nobody will really notice
1978 heuristics. Hopefully in actual use, nobody will really notice
1973 all these strange rules and things will 'just work'.
1979 all these strange rules and things will 'just work'.
1974
1980
1975 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1981 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1976
1982
1977 * IPython/iplib.py (interact): catch exceptions which can be
1983 * IPython/iplib.py (interact): catch exceptions which can be
1978 triggered asynchronously by signal handlers. Thanks to an
1984 triggered asynchronously by signal handlers. Thanks to an
1979 automatic crash report, submitted by Colin Kingsley
1985 automatic crash report, submitted by Colin Kingsley
1980 <tercel-AT-gentoo.org>.
1986 <tercel-AT-gentoo.org>.
1981
1987
1982 2006-01-20 Ville Vainio <vivainio@gmail.com>
1988 2006-01-20 Ville Vainio <vivainio@gmail.com>
1983
1989
1984 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1990 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1985 (%rehashdir, very useful, try it out) of how to extend ipython
1991 (%rehashdir, very useful, try it out) of how to extend ipython
1986 with new magics. Also added Extensions dir to pythonpath to make
1992 with new magics. Also added Extensions dir to pythonpath to make
1987 importing extensions easy.
1993 importing extensions easy.
1988
1994
1989 * %store now complains when trying to store interactively declared
1995 * %store now complains when trying to store interactively declared
1990 classes / instances of those classes.
1996 classes / instances of those classes.
1991
1997
1992 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1998 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1993 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1999 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1994 if they exist, and ipy_user_conf.py with some defaults is created for
2000 if they exist, and ipy_user_conf.py with some defaults is created for
1995 the user.
2001 the user.
1996
2002
1997 * Startup rehashing done by the config file, not InterpreterExec.
2003 * Startup rehashing done by the config file, not InterpreterExec.
1998 This means system commands are available even without selecting the
2004 This means system commands are available even without selecting the
1999 pysh profile. It's the sensible default after all.
2005 pysh profile. It's the sensible default after all.
2000
2006
2001 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2007 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2002
2008
2003 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2009 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2004 multiline code with autoindent on working. But I am really not
2010 multiline code with autoindent on working. But I am really not
2005 sure, so this needs more testing. Will commit a debug-enabled
2011 sure, so this needs more testing. Will commit a debug-enabled
2006 version for now, while I test it some more, so that Ville and
2012 version for now, while I test it some more, so that Ville and
2007 others may also catch any problems. Also made
2013 others may also catch any problems. Also made
2008 self.indent_current_str() a method, to ensure that there's no
2014 self.indent_current_str() a method, to ensure that there's no
2009 chance of the indent space count and the corresponding string
2015 chance of the indent space count and the corresponding string
2010 falling out of sync. All code needing the string should just call
2016 falling out of sync. All code needing the string should just call
2011 the method.
2017 the method.
2012
2018
2013 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2019 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2014
2020
2015 * IPython/Magic.py (magic_edit): fix check for when users don't
2021 * IPython/Magic.py (magic_edit): fix check for when users don't
2016 save their output files, the try/except was in the wrong section.
2022 save their output files, the try/except was in the wrong section.
2017
2023
2018 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2024 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2019
2025
2020 * IPython/Magic.py (magic_run): fix __file__ global missing from
2026 * IPython/Magic.py (magic_run): fix __file__ global missing from
2021 script's namespace when executed via %run. After a report by
2027 script's namespace when executed via %run. After a report by
2022 Vivian.
2028 Vivian.
2023
2029
2024 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2030 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2025 when using python 2.4. The parent constructor changed in 2.4, and
2031 when using python 2.4. The parent constructor changed in 2.4, and
2026 we need to track it directly (we can't call it, as it messes up
2032 we need to track it directly (we can't call it, as it messes up
2027 readline and tab-completion inside our pdb would stop working).
2033 readline and tab-completion inside our pdb would stop working).
2028 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2034 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2029
2035
2030 2006-01-16 Ville Vainio <vivainio@gmail.com>
2036 2006-01-16 Ville Vainio <vivainio@gmail.com>
2031
2037
2032 * Ipython/magic.py: Reverted back to old %edit functionality
2038 * Ipython/magic.py: Reverted back to old %edit functionality
2033 that returns file contents on exit.
2039 that returns file contents on exit.
2034
2040
2035 * IPython/path.py: Added Jason Orendorff's "path" module to
2041 * IPython/path.py: Added Jason Orendorff's "path" module to
2036 IPython tree, http://www.jorendorff.com/articles/python/path/.
2042 IPython tree, http://www.jorendorff.com/articles/python/path/.
2037 You can get path objects conveniently through %sc, and !!, e.g.:
2043 You can get path objects conveniently through %sc, and !!, e.g.:
2038 sc files=ls
2044 sc files=ls
2039 for p in files.paths: # or files.p
2045 for p in files.paths: # or files.p
2040 print p,p.mtime
2046 print p,p.mtime
2041
2047
2042 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2048 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2043 now work again without considering the exclusion regexp -
2049 now work again without considering the exclusion regexp -
2044 hence, things like ',foo my/path' turn to 'foo("my/path")'
2050 hence, things like ',foo my/path' turn to 'foo("my/path")'
2045 instead of syntax error.
2051 instead of syntax error.
2046
2052
2047
2053
2048 2006-01-14 Ville Vainio <vivainio@gmail.com>
2054 2006-01-14 Ville Vainio <vivainio@gmail.com>
2049
2055
2050 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2056 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2051 ipapi decorators for python 2.4 users, options() provides access to rc
2057 ipapi decorators for python 2.4 users, options() provides access to rc
2052 data.
2058 data.
2053
2059
2054 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2060 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2055 as path separators (even on Linux ;-). Space character after
2061 as path separators (even on Linux ;-). Space character after
2056 backslash (as yielded by tab completer) is still space;
2062 backslash (as yielded by tab completer) is still space;
2057 "%cd long\ name" works as expected.
2063 "%cd long\ name" works as expected.
2058
2064
2059 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2065 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2060 as "chain of command", with priority. API stays the same,
2066 as "chain of command", with priority. API stays the same,
2061 TryNext exception raised by a hook function signals that
2067 TryNext exception raised by a hook function signals that
2062 current hook failed and next hook should try handling it, as
2068 current hook failed and next hook should try handling it, as
2063 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
2069 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
2064 requested configurable display hook, which is now implemented.
2070 requested configurable display hook, which is now implemented.
2065
2071
2066 2006-01-13 Ville Vainio <vivainio@gmail.com>
2072 2006-01-13 Ville Vainio <vivainio@gmail.com>
2067
2073
2068 * IPython/platutils*.py: platform specific utility functions,
2074 * IPython/platutils*.py: platform specific utility functions,
2069 so far only set_term_title is implemented (change terminal
2075 so far only set_term_title is implemented (change terminal
2070 label in windowing systems). %cd now changes the title to
2076 label in windowing systems). %cd now changes the title to
2071 current dir.
2077 current dir.
2072
2078
2073 * IPython/Release.py: Added myself to "authors" list,
2079 * IPython/Release.py: Added myself to "authors" list,
2074 had to create new files.
2080 had to create new files.
2075
2081
2076 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2082 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2077 shell escape; not a known bug but had potential to be one in the
2083 shell escape; not a known bug but had potential to be one in the
2078 future.
2084 future.
2079
2085
2080 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2086 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2081 extension API for IPython! See the module for usage example. Fix
2087 extension API for IPython! See the module for usage example. Fix
2082 OInspect for docstring-less magic functions.
2088 OInspect for docstring-less magic functions.
2083
2089
2084
2090
2085 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2091 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2086
2092
2087 * IPython/iplib.py (raw_input): temporarily deactivate all
2093 * IPython/iplib.py (raw_input): temporarily deactivate all
2088 attempts at allowing pasting of code with autoindent on. It
2094 attempts at allowing pasting of code with autoindent on. It
2089 introduced bugs (reported by Prabhu) and I can't seem to find a
2095 introduced bugs (reported by Prabhu) and I can't seem to find a
2090 robust combination which works in all cases. Will have to revisit
2096 robust combination which works in all cases. Will have to revisit
2091 later.
2097 later.
2092
2098
2093 * IPython/genutils.py: remove isspace() function. We've dropped
2099 * IPython/genutils.py: remove isspace() function. We've dropped
2094 2.2 compatibility, so it's OK to use the string method.
2100 2.2 compatibility, so it's OK to use the string method.
2095
2101
2096 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2102 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2097
2103
2098 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2104 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2099 matching what NOT to autocall on, to include all python binary
2105 matching what NOT to autocall on, to include all python binary
2100 operators (including things like 'and', 'or', 'is' and 'in').
2106 operators (including things like 'and', 'or', 'is' and 'in').
2101 Prompted by a bug report on 'foo & bar', but I realized we had
2107 Prompted by a bug report on 'foo & bar', but I realized we had
2102 many more potential bug cases with other operators. The regexp is
2108 many more potential bug cases with other operators. The regexp is
2103 self.re_exclude_auto, it's fairly commented.
2109 self.re_exclude_auto, it's fairly commented.
2104
2110
2105 2006-01-12 Ville Vainio <vivainio@gmail.com>
2111 2006-01-12 Ville Vainio <vivainio@gmail.com>
2106
2112
2107 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2113 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2108 Prettified and hardened string/backslash quoting with ipsystem(),
2114 Prettified and hardened string/backslash quoting with ipsystem(),
2109 ipalias() and ipmagic(). Now even \ characters are passed to
2115 ipalias() and ipmagic(). Now even \ characters are passed to
2110 %magics, !shell escapes and aliases exactly as they are in the
2116 %magics, !shell escapes and aliases exactly as they are in the
2111 ipython command line. Should improve backslash experience,
2117 ipython command line. Should improve backslash experience,
2112 particularly in Windows (path delimiter for some commands that
2118 particularly in Windows (path delimiter for some commands that
2113 won't understand '/'), but Unix benefits as well (regexps). %cd
2119 won't understand '/'), but Unix benefits as well (regexps). %cd
2114 magic still doesn't support backslash path delimiters, though. Also
2120 magic still doesn't support backslash path delimiters, though. Also
2115 deleted all pretense of supporting multiline command strings in
2121 deleted all pretense of supporting multiline command strings in
2116 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2122 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2117
2123
2118 * doc/build_doc_instructions.txt added. Documentation on how to
2124 * doc/build_doc_instructions.txt added. Documentation on how to
2119 use doc/update_manual.py, added yesterday. Both files contributed
2125 use doc/update_manual.py, added yesterday. Both files contributed
2120 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2126 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2121 doc/*.sh for deprecation at a later date.
2127 doc/*.sh for deprecation at a later date.
2122
2128
2123 * /ipython.py Added ipython.py to root directory for
2129 * /ipython.py Added ipython.py to root directory for
2124 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2130 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2125 ipython.py) and development convenience (no need to keep doing
2131 ipython.py) and development convenience (no need to keep doing
2126 "setup.py install" between changes).
2132 "setup.py install" between changes).
2127
2133
2128 * Made ! and !! shell escapes work (again) in multiline expressions:
2134 * Made ! and !! shell escapes work (again) in multiline expressions:
2129 if 1:
2135 if 1:
2130 !ls
2136 !ls
2131 !!ls
2137 !!ls
2132
2138
2133 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2139 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2134
2140
2135 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2141 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2136 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2142 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2137 module in case-insensitive installation. Was causing crashes
2143 module in case-insensitive installation. Was causing crashes
2138 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2144 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2139
2145
2140 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2146 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2141 <marienz-AT-gentoo.org>, closes
2147 <marienz-AT-gentoo.org>, closes
2142 http://www.scipy.net/roundup/ipython/issue51.
2148 http://www.scipy.net/roundup/ipython/issue51.
2143
2149
2144 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2150 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2145
2151
2146 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2152 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2147 problem of excessive CPU usage under *nix and keyboard lag under
2153 problem of excessive CPU usage under *nix and keyboard lag under
2148 win32.
2154 win32.
2149
2155
2150 2006-01-10 *** Released version 0.7.0
2156 2006-01-10 *** Released version 0.7.0
2151
2157
2152 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2158 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2153
2159
2154 * IPython/Release.py (revision): tag version number to 0.7.0,
2160 * IPython/Release.py (revision): tag version number to 0.7.0,
2155 ready for release.
2161 ready for release.
2156
2162
2157 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2163 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2158 it informs the user of the name of the temp. file used. This can
2164 it informs the user of the name of the temp. file used. This can
2159 help if you decide later to reuse that same file, so you know
2165 help if you decide later to reuse that same file, so you know
2160 where to copy the info from.
2166 where to copy the info from.
2161
2167
2162 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2168 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2163
2169
2164 * setup_bdist_egg.py: little script to build an egg. Added
2170 * setup_bdist_egg.py: little script to build an egg. Added
2165 support in the release tools as well.
2171 support in the release tools as well.
2166
2172
2167 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2173 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2168
2174
2169 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2175 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2170 version selection (new -wxversion command line and ipythonrc
2176 version selection (new -wxversion command line and ipythonrc
2171 parameter). Patch contributed by Arnd Baecker
2177 parameter). Patch contributed by Arnd Baecker
2172 <arnd.baecker-AT-web.de>.
2178 <arnd.baecker-AT-web.de>.
2173
2179
2174 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2180 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2175 embedded instances, for variables defined at the interactive
2181 embedded instances, for variables defined at the interactive
2176 prompt of the embedded ipython. Reported by Arnd.
2182 prompt of the embedded ipython. Reported by Arnd.
2177
2183
2178 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2184 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2179 it can be used as a (stateful) toggle, or with a direct parameter.
2185 it can be used as a (stateful) toggle, or with a direct parameter.
2180
2186
2181 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2187 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2182 could be triggered in certain cases and cause the traceback
2188 could be triggered in certain cases and cause the traceback
2183 printer not to work.
2189 printer not to work.
2184
2190
2185 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2191 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2186
2192
2187 * IPython/iplib.py (_should_recompile): Small fix, closes
2193 * IPython/iplib.py (_should_recompile): Small fix, closes
2188 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2194 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2189
2195
2190 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2196 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2191
2197
2192 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2198 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2193 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2199 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2194 Moad for help with tracking it down.
2200 Moad for help with tracking it down.
2195
2201
2196 * IPython/iplib.py (handle_auto): fix autocall handling for
2202 * IPython/iplib.py (handle_auto): fix autocall handling for
2197 objects which support BOTH __getitem__ and __call__ (so that f [x]
2203 objects which support BOTH __getitem__ and __call__ (so that f [x]
2198 is left alone, instead of becoming f([x]) automatically).
2204 is left alone, instead of becoming f([x]) automatically).
2199
2205
2200 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2206 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2201 Ville's patch.
2207 Ville's patch.
2202
2208
2203 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2209 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2204
2210
2205 * IPython/iplib.py (handle_auto): changed autocall semantics to
2211 * IPython/iplib.py (handle_auto): changed autocall semantics to
2206 include 'smart' mode, where the autocall transformation is NOT
2212 include 'smart' mode, where the autocall transformation is NOT
2207 applied if there are no arguments on the line. This allows you to
2213 applied if there are no arguments on the line. This allows you to
2208 just type 'foo' if foo is a callable to see its internal form,
2214 just type 'foo' if foo is a callable to see its internal form,
2209 instead of having it called with no arguments (typically a
2215 instead of having it called with no arguments (typically a
2210 mistake). The old 'full' autocall still exists: for that, you
2216 mistake). The old 'full' autocall still exists: for that, you
2211 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2217 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2212
2218
2213 * IPython/completer.py (Completer.attr_matches): add
2219 * IPython/completer.py (Completer.attr_matches): add
2214 tab-completion support for Enthoughts' traits. After a report by
2220 tab-completion support for Enthoughts' traits. After a report by
2215 Arnd and a patch by Prabhu.
2221 Arnd and a patch by Prabhu.
2216
2222
2217 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2223 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2218
2224
2219 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2225 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2220 Schmolck's patch to fix inspect.getinnerframes().
2226 Schmolck's patch to fix inspect.getinnerframes().
2221
2227
2222 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2228 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2223 for embedded instances, regarding handling of namespaces and items
2229 for embedded instances, regarding handling of namespaces and items
2224 added to the __builtin__ one. Multiple embedded instances and
2230 added to the __builtin__ one. Multiple embedded instances and
2225 recursive embeddings should work better now (though I'm not sure
2231 recursive embeddings should work better now (though I'm not sure
2226 I've got all the corner cases fixed, that code is a bit of a brain
2232 I've got all the corner cases fixed, that code is a bit of a brain
2227 twister).
2233 twister).
2228
2234
2229 * IPython/Magic.py (magic_edit): added support to edit in-memory
2235 * IPython/Magic.py (magic_edit): added support to edit in-memory
2230 macros (automatically creates the necessary temp files). %edit
2236 macros (automatically creates the necessary temp files). %edit
2231 also doesn't return the file contents anymore, it's just noise.
2237 also doesn't return the file contents anymore, it's just noise.
2232
2238
2233 * IPython/completer.py (Completer.attr_matches): revert change to
2239 * IPython/completer.py (Completer.attr_matches): revert change to
2234 complete only on attributes listed in __all__. I realized it
2240 complete only on attributes listed in __all__. I realized it
2235 cripples the tab-completion system as a tool for exploring the
2241 cripples the tab-completion system as a tool for exploring the
2236 internals of unknown libraries (it renders any non-__all__
2242 internals of unknown libraries (it renders any non-__all__
2237 attribute off-limits). I got bit by this when trying to see
2243 attribute off-limits). I got bit by this when trying to see
2238 something inside the dis module.
2244 something inside the dis module.
2239
2245
2240 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2246 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2241
2247
2242 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2248 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2243 namespace for users and extension writers to hold data in. This
2249 namespace for users and extension writers to hold data in. This
2244 follows the discussion in
2250 follows the discussion in
2245 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2251 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2246
2252
2247 * IPython/completer.py (IPCompleter.complete): small patch to help
2253 * IPython/completer.py (IPCompleter.complete): small patch to help
2248 tab-completion under Emacs, after a suggestion by John Barnard
2254 tab-completion under Emacs, after a suggestion by John Barnard
2249 <barnarj-AT-ccf.org>.
2255 <barnarj-AT-ccf.org>.
2250
2256
2251 * IPython/Magic.py (Magic.extract_input_slices): added support for
2257 * IPython/Magic.py (Magic.extract_input_slices): added support for
2252 the slice notation in magics to use N-M to represent numbers N...M
2258 the slice notation in magics to use N-M to represent numbers N...M
2253 (closed endpoints). This is used by %macro and %save.
2259 (closed endpoints). This is used by %macro and %save.
2254
2260
2255 * IPython/completer.py (Completer.attr_matches): for modules which
2261 * IPython/completer.py (Completer.attr_matches): for modules which
2256 define __all__, complete only on those. After a patch by Jeffrey
2262 define __all__, complete only on those. After a patch by Jeffrey
2257 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2263 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2258 speed up this routine.
2264 speed up this routine.
2259
2265
2260 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2266 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2261 don't know if this is the end of it, but the behavior now is
2267 don't know if this is the end of it, but the behavior now is
2262 certainly much more correct. Note that coupled with macros,
2268 certainly much more correct. Note that coupled with macros,
2263 slightly surprising (at first) behavior may occur: a macro will in
2269 slightly surprising (at first) behavior may occur: a macro will in
2264 general expand to multiple lines of input, so upon exiting, the
2270 general expand to multiple lines of input, so upon exiting, the
2265 in/out counters will both be bumped by the corresponding amount
2271 in/out counters will both be bumped by the corresponding amount
2266 (as if the macro's contents had been typed interactively). Typing
2272 (as if the macro's contents had been typed interactively). Typing
2267 %hist will reveal the intermediate (silently processed) lines.
2273 %hist will reveal the intermediate (silently processed) lines.
2268
2274
2269 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2275 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2270 pickle to fail (%run was overwriting __main__ and not restoring
2276 pickle to fail (%run was overwriting __main__ and not restoring
2271 it, but pickle relies on __main__ to operate).
2277 it, but pickle relies on __main__ to operate).
2272
2278
2273 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2279 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2274 using properties, but forgot to make the main InteractiveShell
2280 using properties, but forgot to make the main InteractiveShell
2275 class a new-style class. Properties fail silently, and
2281 class a new-style class. Properties fail silently, and
2276 mysteriously, with old-style class (getters work, but
2282 mysteriously, with old-style class (getters work, but
2277 setters don't do anything).
2283 setters don't do anything).
2278
2284
2279 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2285 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2280
2286
2281 * IPython/Magic.py (magic_history): fix history reporting bug (I
2287 * IPython/Magic.py (magic_history): fix history reporting bug (I
2282 know some nasties are still there, I just can't seem to find a
2288 know some nasties are still there, I just can't seem to find a
2283 reproducible test case to track them down; the input history is
2289 reproducible test case to track them down; the input history is
2284 falling out of sync...)
2290 falling out of sync...)
2285
2291
2286 * IPython/iplib.py (handle_shell_escape): fix bug where both
2292 * IPython/iplib.py (handle_shell_escape): fix bug where both
2287 aliases and system accesses where broken for indented code (such
2293 aliases and system accesses where broken for indented code (such
2288 as loops).
2294 as loops).
2289
2295
2290 * IPython/genutils.py (shell): fix small but critical bug for
2296 * IPython/genutils.py (shell): fix small but critical bug for
2291 win32 system access.
2297 win32 system access.
2292
2298
2293 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2299 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2294
2300
2295 * IPython/iplib.py (showtraceback): remove use of the
2301 * IPython/iplib.py (showtraceback): remove use of the
2296 sys.last_{type/value/traceback} structures, which are non
2302 sys.last_{type/value/traceback} structures, which are non
2297 thread-safe.
2303 thread-safe.
2298 (_prefilter): change control flow to ensure that we NEVER
2304 (_prefilter): change control flow to ensure that we NEVER
2299 introspect objects when autocall is off. This will guarantee that
2305 introspect objects when autocall is off. This will guarantee that
2300 having an input line of the form 'x.y', where access to attribute
2306 having an input line of the form 'x.y', where access to attribute
2301 'y' has side effects, doesn't trigger the side effect TWICE. It
2307 'y' has side effects, doesn't trigger the side effect TWICE. It
2302 is important to note that, with autocall on, these side effects
2308 is important to note that, with autocall on, these side effects
2303 can still happen.
2309 can still happen.
2304 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2310 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2305 trio. IPython offers these three kinds of special calls which are
2311 trio. IPython offers these three kinds of special calls which are
2306 not python code, and it's a good thing to have their call method
2312 not python code, and it's a good thing to have their call method
2307 be accessible as pure python functions (not just special syntax at
2313 be accessible as pure python functions (not just special syntax at
2308 the command line). It gives us a better internal implementation
2314 the command line). It gives us a better internal implementation
2309 structure, as well as exposing these for user scripting more
2315 structure, as well as exposing these for user scripting more
2310 cleanly.
2316 cleanly.
2311
2317
2312 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2318 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2313 file. Now that they'll be more likely to be used with the
2319 file. Now that they'll be more likely to be used with the
2314 persistance system (%store), I want to make sure their module path
2320 persistance system (%store), I want to make sure their module path
2315 doesn't change in the future, so that we don't break things for
2321 doesn't change in the future, so that we don't break things for
2316 users' persisted data.
2322 users' persisted data.
2317
2323
2318 * IPython/iplib.py (autoindent_update): move indentation
2324 * IPython/iplib.py (autoindent_update): move indentation
2319 management into the _text_ processing loop, not the keyboard
2325 management into the _text_ processing loop, not the keyboard
2320 interactive one. This is necessary to correctly process non-typed
2326 interactive one. This is necessary to correctly process non-typed
2321 multiline input (such as macros).
2327 multiline input (such as macros).
2322
2328
2323 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2329 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2324 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2330 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2325 which was producing problems in the resulting manual.
2331 which was producing problems in the resulting manual.
2326 (magic_whos): improve reporting of instances (show their class,
2332 (magic_whos): improve reporting of instances (show their class,
2327 instead of simply printing 'instance' which isn't terribly
2333 instead of simply printing 'instance' which isn't terribly
2328 informative).
2334 informative).
2329
2335
2330 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2336 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2331 (minor mods) to support network shares under win32.
2337 (minor mods) to support network shares under win32.
2332
2338
2333 * IPython/winconsole.py (get_console_size): add new winconsole
2339 * IPython/winconsole.py (get_console_size): add new winconsole
2334 module and fixes to page_dumb() to improve its behavior under
2340 module and fixes to page_dumb() to improve its behavior under
2335 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2341 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2336
2342
2337 * IPython/Magic.py (Macro): simplified Macro class to just
2343 * IPython/Magic.py (Macro): simplified Macro class to just
2338 subclass list. We've had only 2.2 compatibility for a very long
2344 subclass list. We've had only 2.2 compatibility for a very long
2339 time, yet I was still avoiding subclassing the builtin types. No
2345 time, yet I was still avoiding subclassing the builtin types. No
2340 more (I'm also starting to use properties, though I won't shift to
2346 more (I'm also starting to use properties, though I won't shift to
2341 2.3-specific features quite yet).
2347 2.3-specific features quite yet).
2342 (magic_store): added Ville's patch for lightweight variable
2348 (magic_store): added Ville's patch for lightweight variable
2343 persistence, after a request on the user list by Matt Wilkie
2349 persistence, after a request on the user list by Matt Wilkie
2344 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2350 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2345 details.
2351 details.
2346
2352
2347 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2353 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2348 changed the default logfile name from 'ipython.log' to
2354 changed the default logfile name from 'ipython.log' to
2349 'ipython_log.py'. These logs are real python files, and now that
2355 'ipython_log.py'. These logs are real python files, and now that
2350 we have much better multiline support, people are more likely to
2356 we have much better multiline support, people are more likely to
2351 want to use them as such. Might as well name them correctly.
2357 want to use them as such. Might as well name them correctly.
2352
2358
2353 * IPython/Magic.py: substantial cleanup. While we can't stop
2359 * IPython/Magic.py: substantial cleanup. While we can't stop
2354 using magics as mixins, due to the existing customizations 'out
2360 using magics as mixins, due to the existing customizations 'out
2355 there' which rely on the mixin naming conventions, at least I
2361 there' which rely on the mixin naming conventions, at least I
2356 cleaned out all cross-class name usage. So once we are OK with
2362 cleaned out all cross-class name usage. So once we are OK with
2357 breaking compatibility, the two systems can be separated.
2363 breaking compatibility, the two systems can be separated.
2358
2364
2359 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2365 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2360 anymore, and the class is a fair bit less hideous as well. New
2366 anymore, and the class is a fair bit less hideous as well. New
2361 features were also introduced: timestamping of input, and logging
2367 features were also introduced: timestamping of input, and logging
2362 of output results. These are user-visible with the -t and -o
2368 of output results. These are user-visible with the -t and -o
2363 options to %logstart. Closes
2369 options to %logstart. Closes
2364 http://www.scipy.net/roundup/ipython/issue11 and a request by
2370 http://www.scipy.net/roundup/ipython/issue11 and a request by
2365 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2371 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2366
2372
2367 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2373 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2368
2374
2369 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2375 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2370 better handle backslashes in paths. See the thread 'More Windows
2376 better handle backslashes in paths. See the thread 'More Windows
2371 questions part 2 - \/ characters revisited' on the iypthon user
2377 questions part 2 - \/ characters revisited' on the iypthon user
2372 list:
2378 list:
2373 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2379 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2374
2380
2375 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2381 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2376
2382
2377 (InteractiveShell.__init__): change threaded shells to not use the
2383 (InteractiveShell.__init__): change threaded shells to not use the
2378 ipython crash handler. This was causing more problems than not,
2384 ipython crash handler. This was causing more problems than not,
2379 as exceptions in the main thread (GUI code, typically) would
2385 as exceptions in the main thread (GUI code, typically) would
2380 always show up as a 'crash', when they really weren't.
2386 always show up as a 'crash', when they really weren't.
2381
2387
2382 The colors and exception mode commands (%colors/%xmode) have been
2388 The colors and exception mode commands (%colors/%xmode) have been
2383 synchronized to also take this into account, so users can get
2389 synchronized to also take this into account, so users can get
2384 verbose exceptions for their threaded code as well. I also added
2390 verbose exceptions for their threaded code as well. I also added
2385 support for activating pdb inside this exception handler as well,
2391 support for activating pdb inside this exception handler as well,
2386 so now GUI authors can use IPython's enhanced pdb at runtime.
2392 so now GUI authors can use IPython's enhanced pdb at runtime.
2387
2393
2388 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2394 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2389 true by default, and add it to the shipped ipythonrc file. Since
2395 true by default, and add it to the shipped ipythonrc file. Since
2390 this asks the user before proceeding, I think it's OK to make it
2396 this asks the user before proceeding, I think it's OK to make it
2391 true by default.
2397 true by default.
2392
2398
2393 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2399 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2394 of the previous special-casing of input in the eval loop. I think
2400 of the previous special-casing of input in the eval loop. I think
2395 this is cleaner, as they really are commands and shouldn't have
2401 this is cleaner, as they really are commands and shouldn't have
2396 a special role in the middle of the core code.
2402 a special role in the middle of the core code.
2397
2403
2398 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2404 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2399
2405
2400 * IPython/iplib.py (edit_syntax_error): added support for
2406 * IPython/iplib.py (edit_syntax_error): added support for
2401 automatically reopening the editor if the file had a syntax error
2407 automatically reopening the editor if the file had a syntax error
2402 in it. Thanks to scottt who provided the patch at:
2408 in it. Thanks to scottt who provided the patch at:
2403 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2409 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2404 version committed).
2410 version committed).
2405
2411
2406 * IPython/iplib.py (handle_normal): add suport for multi-line
2412 * IPython/iplib.py (handle_normal): add suport for multi-line
2407 input with emtpy lines. This fixes
2413 input with emtpy lines. This fixes
2408 http://www.scipy.net/roundup/ipython/issue43 and a similar
2414 http://www.scipy.net/roundup/ipython/issue43 and a similar
2409 discussion on the user list.
2415 discussion on the user list.
2410
2416
2411 WARNING: a behavior change is necessarily introduced to support
2417 WARNING: a behavior change is necessarily introduced to support
2412 blank lines: now a single blank line with whitespace does NOT
2418 blank lines: now a single blank line with whitespace does NOT
2413 break the input loop, which means that when autoindent is on, by
2419 break the input loop, which means that when autoindent is on, by
2414 default hitting return on the next (indented) line does NOT exit.
2420 default hitting return on the next (indented) line does NOT exit.
2415
2421
2416 Instead, to exit a multiline input you can either have:
2422 Instead, to exit a multiline input you can either have:
2417
2423
2418 - TWO whitespace lines (just hit return again), or
2424 - TWO whitespace lines (just hit return again), or
2419 - a single whitespace line of a different length than provided
2425 - a single whitespace line of a different length than provided
2420 by the autoindent (add or remove a space).
2426 by the autoindent (add or remove a space).
2421
2427
2422 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2428 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2423 module to better organize all readline-related functionality.
2429 module to better organize all readline-related functionality.
2424 I've deleted FlexCompleter and put all completion clases here.
2430 I've deleted FlexCompleter and put all completion clases here.
2425
2431
2426 * IPython/iplib.py (raw_input): improve indentation management.
2432 * IPython/iplib.py (raw_input): improve indentation management.
2427 It is now possible to paste indented code with autoindent on, and
2433 It is now possible to paste indented code with autoindent on, and
2428 the code is interpreted correctly (though it still looks bad on
2434 the code is interpreted correctly (though it still looks bad on
2429 screen, due to the line-oriented nature of ipython).
2435 screen, due to the line-oriented nature of ipython).
2430 (MagicCompleter.complete): change behavior so that a TAB key on an
2436 (MagicCompleter.complete): change behavior so that a TAB key on an
2431 otherwise empty line actually inserts a tab, instead of completing
2437 otherwise empty line actually inserts a tab, instead of completing
2432 on the entire global namespace. This makes it easier to use the
2438 on the entire global namespace. This makes it easier to use the
2433 TAB key for indentation. After a request by Hans Meine
2439 TAB key for indentation. After a request by Hans Meine
2434 <hans_meine-AT-gmx.net>
2440 <hans_meine-AT-gmx.net>
2435 (_prefilter): add support so that typing plain 'exit' or 'quit'
2441 (_prefilter): add support so that typing plain 'exit' or 'quit'
2436 does a sensible thing. Originally I tried to deviate as little as
2442 does a sensible thing. Originally I tried to deviate as little as
2437 possible from the default python behavior, but even that one may
2443 possible from the default python behavior, but even that one may
2438 change in this direction (thread on python-dev to that effect).
2444 change in this direction (thread on python-dev to that effect).
2439 Regardless, ipython should do the right thing even if CPython's
2445 Regardless, ipython should do the right thing even if CPython's
2440 '>>>' prompt doesn't.
2446 '>>>' prompt doesn't.
2441 (InteractiveShell): removed subclassing code.InteractiveConsole
2447 (InteractiveShell): removed subclassing code.InteractiveConsole
2442 class. By now we'd overridden just about all of its methods: I've
2448 class. By now we'd overridden just about all of its methods: I've
2443 copied the remaining two over, and now ipython is a standalone
2449 copied the remaining two over, and now ipython is a standalone
2444 class. This will provide a clearer picture for the chainsaw
2450 class. This will provide a clearer picture for the chainsaw
2445 branch refactoring.
2451 branch refactoring.
2446
2452
2447 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2453 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2448
2454
2449 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2455 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2450 failures for objects which break when dir() is called on them.
2456 failures for objects which break when dir() is called on them.
2451
2457
2452 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2458 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2453 distinct local and global namespaces in the completer API. This
2459 distinct local and global namespaces in the completer API. This
2454 change allows us to properly handle completion with distinct
2460 change allows us to properly handle completion with distinct
2455 scopes, including in embedded instances (this had never really
2461 scopes, including in embedded instances (this had never really
2456 worked correctly).
2462 worked correctly).
2457
2463
2458 Note: this introduces a change in the constructor for
2464 Note: this introduces a change in the constructor for
2459 MagicCompleter, as a new global_namespace parameter is now the
2465 MagicCompleter, as a new global_namespace parameter is now the
2460 second argument (the others were bumped one position).
2466 second argument (the others were bumped one position).
2461
2467
2462 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2468 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2463
2469
2464 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2470 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2465 embedded instances (which can be done now thanks to Vivian's
2471 embedded instances (which can be done now thanks to Vivian's
2466 frame-handling fixes for pdb).
2472 frame-handling fixes for pdb).
2467 (InteractiveShell.__init__): Fix namespace handling problem in
2473 (InteractiveShell.__init__): Fix namespace handling problem in
2468 embedded instances. We were overwriting __main__ unconditionally,
2474 embedded instances. We were overwriting __main__ unconditionally,
2469 and this should only be done for 'full' (non-embedded) IPython;
2475 and this should only be done for 'full' (non-embedded) IPython;
2470 embedded instances must respect the caller's __main__. Thanks to
2476 embedded instances must respect the caller's __main__. Thanks to
2471 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2477 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2472
2478
2473 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2479 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2474
2480
2475 * setup.py: added download_url to setup(). This registers the
2481 * setup.py: added download_url to setup(). This registers the
2476 download address at PyPI, which is not only useful to humans
2482 download address at PyPI, which is not only useful to humans
2477 browsing the site, but is also picked up by setuptools (the Eggs
2483 browsing the site, but is also picked up by setuptools (the Eggs
2478 machinery). Thanks to Ville and R. Kern for the info/discussion
2484 machinery). Thanks to Ville and R. Kern for the info/discussion
2479 on this.
2485 on this.
2480
2486
2481 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2487 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2482
2488
2483 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2489 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2484 This brings a lot of nice functionality to the pdb mode, which now
2490 This brings a lot of nice functionality to the pdb mode, which now
2485 has tab-completion, syntax highlighting, and better stack handling
2491 has tab-completion, syntax highlighting, and better stack handling
2486 than before. Many thanks to Vivian De Smedt
2492 than before. Many thanks to Vivian De Smedt
2487 <vivian-AT-vdesmedt.com> for the original patches.
2493 <vivian-AT-vdesmedt.com> for the original patches.
2488
2494
2489 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2495 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2490
2496
2491 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2497 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2492 sequence to consistently accept the banner argument. The
2498 sequence to consistently accept the banner argument. The
2493 inconsistency was tripping SAGE, thanks to Gary Zablackis
2499 inconsistency was tripping SAGE, thanks to Gary Zablackis
2494 <gzabl-AT-yahoo.com> for the report.
2500 <gzabl-AT-yahoo.com> for the report.
2495
2501
2496 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2502 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2497
2503
2498 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2504 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2499 Fix bug where a naked 'alias' call in the ipythonrc file would
2505 Fix bug where a naked 'alias' call in the ipythonrc file would
2500 cause a crash. Bug reported by Jorgen Stenarson.
2506 cause a crash. Bug reported by Jorgen Stenarson.
2501
2507
2502 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2508 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2503
2509
2504 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2510 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2505 startup time.
2511 startup time.
2506
2512
2507 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2513 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2508 instances had introduced a bug with globals in normal code. Now
2514 instances had introduced a bug with globals in normal code. Now
2509 it's working in all cases.
2515 it's working in all cases.
2510
2516
2511 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2517 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2512 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2518 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2513 has been introduced to set the default case sensitivity of the
2519 has been introduced to set the default case sensitivity of the
2514 searches. Users can still select either mode at runtime on a
2520 searches. Users can still select either mode at runtime on a
2515 per-search basis.
2521 per-search basis.
2516
2522
2517 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2523 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2518
2524
2519 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2525 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2520 attributes in wildcard searches for subclasses. Modified version
2526 attributes in wildcard searches for subclasses. Modified version
2521 of a patch by Jorgen.
2527 of a patch by Jorgen.
2522
2528
2523 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2529 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2524
2530
2525 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2531 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2526 embedded instances. I added a user_global_ns attribute to the
2532 embedded instances. I added a user_global_ns attribute to the
2527 InteractiveShell class to handle this.
2533 InteractiveShell class to handle this.
2528
2534
2529 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2535 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2530
2536
2531 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2537 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2532 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2538 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2533 (reported under win32, but may happen also in other platforms).
2539 (reported under win32, but may happen also in other platforms).
2534 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2540 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2535
2541
2536 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2542 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2537
2543
2538 * IPython/Magic.py (magic_psearch): new support for wildcard
2544 * IPython/Magic.py (magic_psearch): new support for wildcard
2539 patterns. Now, typing ?a*b will list all names which begin with a
2545 patterns. Now, typing ?a*b will list all names which begin with a
2540 and end in b, for example. The %psearch magic has full
2546 and end in b, for example. The %psearch magic has full
2541 docstrings. Many thanks to Jörgen Stenarson
2547 docstrings. Many thanks to Jörgen Stenarson
2542 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2548 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2543 implementing this functionality.
2549 implementing this functionality.
2544
2550
2545 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2551 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2546
2552
2547 * Manual: fixed long-standing annoyance of double-dashes (as in
2553 * Manual: fixed long-standing annoyance of double-dashes (as in
2548 --prefix=~, for example) being stripped in the HTML version. This
2554 --prefix=~, for example) being stripped in the HTML version. This
2549 is a latex2html bug, but a workaround was provided. Many thanks
2555 is a latex2html bug, but a workaround was provided. Many thanks
2550 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2556 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2551 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2557 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2552 rolling. This seemingly small issue had tripped a number of users
2558 rolling. This seemingly small issue had tripped a number of users
2553 when first installing, so I'm glad to see it gone.
2559 when first installing, so I'm glad to see it gone.
2554
2560
2555 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2561 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2556
2562
2557 * IPython/Extensions/numeric_formats.py: fix missing import,
2563 * IPython/Extensions/numeric_formats.py: fix missing import,
2558 reported by Stephen Walton.
2564 reported by Stephen Walton.
2559
2565
2560 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2566 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2561
2567
2562 * IPython/demo.py: finish demo module, fully documented now.
2568 * IPython/demo.py: finish demo module, fully documented now.
2563
2569
2564 * IPython/genutils.py (file_read): simple little utility to read a
2570 * IPython/genutils.py (file_read): simple little utility to read a
2565 file and ensure it's closed afterwards.
2571 file and ensure it's closed afterwards.
2566
2572
2567 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2573 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2568
2574
2569 * IPython/demo.py (Demo.__init__): added support for individually
2575 * IPython/demo.py (Demo.__init__): added support for individually
2570 tagging blocks for automatic execution.
2576 tagging blocks for automatic execution.
2571
2577
2572 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2578 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2573 syntax-highlighted python sources, requested by John.
2579 syntax-highlighted python sources, requested by John.
2574
2580
2575 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2581 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2576
2582
2577 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2583 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2578 finishing.
2584 finishing.
2579
2585
2580 * IPython/genutils.py (shlex_split): moved from Magic to here,
2586 * IPython/genutils.py (shlex_split): moved from Magic to here,
2581 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2587 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2582
2588
2583 * IPython/demo.py (Demo.__init__): added support for silent
2589 * IPython/demo.py (Demo.__init__): added support for silent
2584 blocks, improved marks as regexps, docstrings written.
2590 blocks, improved marks as regexps, docstrings written.
2585 (Demo.__init__): better docstring, added support for sys.argv.
2591 (Demo.__init__): better docstring, added support for sys.argv.
2586
2592
2587 * IPython/genutils.py (marquee): little utility used by the demo
2593 * IPython/genutils.py (marquee): little utility used by the demo
2588 code, handy in general.
2594 code, handy in general.
2589
2595
2590 * IPython/demo.py (Demo.__init__): new class for interactive
2596 * IPython/demo.py (Demo.__init__): new class for interactive
2591 demos. Not documented yet, I just wrote it in a hurry for
2597 demos. Not documented yet, I just wrote it in a hurry for
2592 scipy'05. Will docstring later.
2598 scipy'05. Will docstring later.
2593
2599
2594 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2600 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2595
2601
2596 * IPython/Shell.py (sigint_handler): Drastic simplification which
2602 * IPython/Shell.py (sigint_handler): Drastic simplification which
2597 also seems to make Ctrl-C work correctly across threads! This is
2603 also seems to make Ctrl-C work correctly across threads! This is
2598 so simple, that I can't beleive I'd missed it before. Needs more
2604 so simple, that I can't beleive I'd missed it before. Needs more
2599 testing, though.
2605 testing, though.
2600 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2606 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2601 like this before...
2607 like this before...
2602
2608
2603 * IPython/genutils.py (get_home_dir): add protection against
2609 * IPython/genutils.py (get_home_dir): add protection against
2604 non-dirs in win32 registry.
2610 non-dirs in win32 registry.
2605
2611
2606 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2612 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2607 bug where dict was mutated while iterating (pysh crash).
2613 bug where dict was mutated while iterating (pysh crash).
2608
2614
2609 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2615 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2610
2616
2611 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2617 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2612 spurious newlines added by this routine. After a report by
2618 spurious newlines added by this routine. After a report by
2613 F. Mantegazza.
2619 F. Mantegazza.
2614
2620
2615 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2621 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2616
2622
2617 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2623 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2618 calls. These were a leftover from the GTK 1.x days, and can cause
2624 calls. These were a leftover from the GTK 1.x days, and can cause
2619 problems in certain cases (after a report by John Hunter).
2625 problems in certain cases (after a report by John Hunter).
2620
2626
2621 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2627 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2622 os.getcwd() fails at init time. Thanks to patch from David Remahl
2628 os.getcwd() fails at init time. Thanks to patch from David Remahl
2623 <chmod007-AT-mac.com>.
2629 <chmod007-AT-mac.com>.
2624 (InteractiveShell.__init__): prevent certain special magics from
2630 (InteractiveShell.__init__): prevent certain special magics from
2625 being shadowed by aliases. Closes
2631 being shadowed by aliases. Closes
2626 http://www.scipy.net/roundup/ipython/issue41.
2632 http://www.scipy.net/roundup/ipython/issue41.
2627
2633
2628 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2634 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2629
2635
2630 * IPython/iplib.py (InteractiveShell.complete): Added new
2636 * IPython/iplib.py (InteractiveShell.complete): Added new
2631 top-level completion method to expose the completion mechanism
2637 top-level completion method to expose the completion mechanism
2632 beyond readline-based environments.
2638 beyond readline-based environments.
2633
2639
2634 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2640 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2635
2641
2636 * tools/ipsvnc (svnversion): fix svnversion capture.
2642 * tools/ipsvnc (svnversion): fix svnversion capture.
2637
2643
2638 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2644 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2639 attribute to self, which was missing. Before, it was set by a
2645 attribute to self, which was missing. Before, it was set by a
2640 routine which in certain cases wasn't being called, so the
2646 routine which in certain cases wasn't being called, so the
2641 instance could end up missing the attribute. This caused a crash.
2647 instance could end up missing the attribute. This caused a crash.
2642 Closes http://www.scipy.net/roundup/ipython/issue40.
2648 Closes http://www.scipy.net/roundup/ipython/issue40.
2643
2649
2644 2005-08-16 Fernando Perez <fperez@colorado.edu>
2650 2005-08-16 Fernando Perez <fperez@colorado.edu>
2645
2651
2646 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2652 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2647 contains non-string attribute. Closes
2653 contains non-string attribute. Closes
2648 http://www.scipy.net/roundup/ipython/issue38.
2654 http://www.scipy.net/roundup/ipython/issue38.
2649
2655
2650 2005-08-14 Fernando Perez <fperez@colorado.edu>
2656 2005-08-14 Fernando Perez <fperez@colorado.edu>
2651
2657
2652 * tools/ipsvnc: Minor improvements, to add changeset info.
2658 * tools/ipsvnc: Minor improvements, to add changeset info.
2653
2659
2654 2005-08-12 Fernando Perez <fperez@colorado.edu>
2660 2005-08-12 Fernando Perez <fperez@colorado.edu>
2655
2661
2656 * IPython/iplib.py (runsource): remove self.code_to_run_src
2662 * IPython/iplib.py (runsource): remove self.code_to_run_src
2657 attribute. I realized this is nothing more than
2663 attribute. I realized this is nothing more than
2658 '\n'.join(self.buffer), and having the same data in two different
2664 '\n'.join(self.buffer), and having the same data in two different
2659 places is just asking for synchronization bugs. This may impact
2665 places is just asking for synchronization bugs. This may impact
2660 people who have custom exception handlers, so I need to warn
2666 people who have custom exception handlers, so I need to warn
2661 ipython-dev about it (F. Mantegazza may use them).
2667 ipython-dev about it (F. Mantegazza may use them).
2662
2668
2663 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2669 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2664
2670
2665 * IPython/genutils.py: fix 2.2 compatibility (generators)
2671 * IPython/genutils.py: fix 2.2 compatibility (generators)
2666
2672
2667 2005-07-18 Fernando Perez <fperez@colorado.edu>
2673 2005-07-18 Fernando Perez <fperez@colorado.edu>
2668
2674
2669 * IPython/genutils.py (get_home_dir): fix to help users with
2675 * IPython/genutils.py (get_home_dir): fix to help users with
2670 invalid $HOME under win32.
2676 invalid $HOME under win32.
2671
2677
2672 2005-07-17 Fernando Perez <fperez@colorado.edu>
2678 2005-07-17 Fernando Perez <fperez@colorado.edu>
2673
2679
2674 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2680 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2675 some old hacks and clean up a bit other routines; code should be
2681 some old hacks and clean up a bit other routines; code should be
2676 simpler and a bit faster.
2682 simpler and a bit faster.
2677
2683
2678 * IPython/iplib.py (interact): removed some last-resort attempts
2684 * IPython/iplib.py (interact): removed some last-resort attempts
2679 to survive broken stdout/stderr. That code was only making it
2685 to survive broken stdout/stderr. That code was only making it
2680 harder to abstract out the i/o (necessary for gui integration),
2686 harder to abstract out the i/o (necessary for gui integration),
2681 and the crashes it could prevent were extremely rare in practice
2687 and the crashes it could prevent were extremely rare in practice
2682 (besides being fully user-induced in a pretty violent manner).
2688 (besides being fully user-induced in a pretty violent manner).
2683
2689
2684 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2690 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2685 Nothing major yet, but the code is simpler to read; this should
2691 Nothing major yet, but the code is simpler to read; this should
2686 make it easier to do more serious modifications in the future.
2692 make it easier to do more serious modifications in the future.
2687
2693
2688 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2694 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2689 which broke in .15 (thanks to a report by Ville).
2695 which broke in .15 (thanks to a report by Ville).
2690
2696
2691 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2697 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2692 be quite correct, I know next to nothing about unicode). This
2698 be quite correct, I know next to nothing about unicode). This
2693 will allow unicode strings to be used in prompts, amongst other
2699 will allow unicode strings to be used in prompts, amongst other
2694 cases. It also will prevent ipython from crashing when unicode
2700 cases. It also will prevent ipython from crashing when unicode
2695 shows up unexpectedly in many places. If ascii encoding fails, we
2701 shows up unexpectedly in many places. If ascii encoding fails, we
2696 assume utf_8. Currently the encoding is not a user-visible
2702 assume utf_8. Currently the encoding is not a user-visible
2697 setting, though it could be made so if there is demand for it.
2703 setting, though it could be made so if there is demand for it.
2698
2704
2699 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2705 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2700
2706
2701 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2707 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2702
2708
2703 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2709 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2704
2710
2705 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2711 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2706 code can work transparently for 2.2/2.3.
2712 code can work transparently for 2.2/2.3.
2707
2713
2708 2005-07-16 Fernando Perez <fperez@colorado.edu>
2714 2005-07-16 Fernando Perez <fperez@colorado.edu>
2709
2715
2710 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2716 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2711 out of the color scheme table used for coloring exception
2717 out of the color scheme table used for coloring exception
2712 tracebacks. This allows user code to add new schemes at runtime.
2718 tracebacks. This allows user code to add new schemes at runtime.
2713 This is a minimally modified version of the patch at
2719 This is a minimally modified version of the patch at
2714 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2720 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2715 for the contribution.
2721 for the contribution.
2716
2722
2717 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2723 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2718 slightly modified version of the patch in
2724 slightly modified version of the patch in
2719 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2725 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2720 to remove the previous try/except solution (which was costlier).
2726 to remove the previous try/except solution (which was costlier).
2721 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2727 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2722
2728
2723 2005-06-08 Fernando Perez <fperez@colorado.edu>
2729 2005-06-08 Fernando Perez <fperez@colorado.edu>
2724
2730
2725 * IPython/iplib.py (write/write_err): Add methods to abstract all
2731 * IPython/iplib.py (write/write_err): Add methods to abstract all
2726 I/O a bit more.
2732 I/O a bit more.
2727
2733
2728 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2734 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2729 warning, reported by Aric Hagberg, fix by JD Hunter.
2735 warning, reported by Aric Hagberg, fix by JD Hunter.
2730
2736
2731 2005-06-02 *** Released version 0.6.15
2737 2005-06-02 *** Released version 0.6.15
2732
2738
2733 2005-06-01 Fernando Perez <fperez@colorado.edu>
2739 2005-06-01 Fernando Perez <fperez@colorado.edu>
2734
2740
2735 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2741 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2736 tab-completion of filenames within open-quoted strings. Note that
2742 tab-completion of filenames within open-quoted strings. Note that
2737 this requires that in ~/.ipython/ipythonrc, users change the
2743 this requires that in ~/.ipython/ipythonrc, users change the
2738 readline delimiters configuration to read:
2744 readline delimiters configuration to read:
2739
2745
2740 readline_remove_delims -/~
2746 readline_remove_delims -/~
2741
2747
2742
2748
2743 2005-05-31 *** Released version 0.6.14
2749 2005-05-31 *** Released version 0.6.14
2744
2750
2745 2005-05-29 Fernando Perez <fperez@colorado.edu>
2751 2005-05-29 Fernando Perez <fperez@colorado.edu>
2746
2752
2747 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2753 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2748 with files not on the filesystem. Reported by Eliyahu Sandler
2754 with files not on the filesystem. Reported by Eliyahu Sandler
2749 <eli@gondolin.net>
2755 <eli@gondolin.net>
2750
2756
2751 2005-05-22 Fernando Perez <fperez@colorado.edu>
2757 2005-05-22 Fernando Perez <fperez@colorado.edu>
2752
2758
2753 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2759 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2754 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2760 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2755
2761
2756 2005-05-19 Fernando Perez <fperez@colorado.edu>
2762 2005-05-19 Fernando Perez <fperez@colorado.edu>
2757
2763
2758 * IPython/iplib.py (safe_execfile): close a file which could be
2764 * IPython/iplib.py (safe_execfile): close a file which could be
2759 left open (causing problems in win32, which locks open files).
2765 left open (causing problems in win32, which locks open files).
2760 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2766 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2761
2767
2762 2005-05-18 Fernando Perez <fperez@colorado.edu>
2768 2005-05-18 Fernando Perez <fperez@colorado.edu>
2763
2769
2764 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2770 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2765 keyword arguments correctly to safe_execfile().
2771 keyword arguments correctly to safe_execfile().
2766
2772
2767 2005-05-13 Fernando Perez <fperez@colorado.edu>
2773 2005-05-13 Fernando Perez <fperez@colorado.edu>
2768
2774
2769 * ipython.1: Added info about Qt to manpage, and threads warning
2775 * ipython.1: Added info about Qt to manpage, and threads warning
2770 to usage page (invoked with --help).
2776 to usage page (invoked with --help).
2771
2777
2772 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2778 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2773 new matcher (it goes at the end of the priority list) to do
2779 new matcher (it goes at the end of the priority list) to do
2774 tab-completion on named function arguments. Submitted by George
2780 tab-completion on named function arguments. Submitted by George
2775 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2781 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2776 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2782 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2777 for more details.
2783 for more details.
2778
2784
2779 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2785 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2780 SystemExit exceptions in the script being run. Thanks to a report
2786 SystemExit exceptions in the script being run. Thanks to a report
2781 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2787 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2782 producing very annoying behavior when running unit tests.
2788 producing very annoying behavior when running unit tests.
2783
2789
2784 2005-05-12 Fernando Perez <fperez@colorado.edu>
2790 2005-05-12 Fernando Perez <fperez@colorado.edu>
2785
2791
2786 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2792 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2787 which I'd broken (again) due to a changed regexp. In the process,
2793 which I'd broken (again) due to a changed regexp. In the process,
2788 added ';' as an escape to auto-quote the whole line without
2794 added ';' as an escape to auto-quote the whole line without
2789 splitting its arguments. Thanks to a report by Jerry McRae
2795 splitting its arguments. Thanks to a report by Jerry McRae
2790 <qrs0xyc02-AT-sneakemail.com>.
2796 <qrs0xyc02-AT-sneakemail.com>.
2791
2797
2792 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2798 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2793 possible crashes caused by a TokenError. Reported by Ed Schofield
2799 possible crashes caused by a TokenError. Reported by Ed Schofield
2794 <schofield-AT-ftw.at>.
2800 <schofield-AT-ftw.at>.
2795
2801
2796 2005-05-06 Fernando Perez <fperez@colorado.edu>
2802 2005-05-06 Fernando Perez <fperez@colorado.edu>
2797
2803
2798 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2804 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2799
2805
2800 2005-04-29 Fernando Perez <fperez@colorado.edu>
2806 2005-04-29 Fernando Perez <fperez@colorado.edu>
2801
2807
2802 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2808 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2803 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2809 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2804 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2810 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2805 which provides support for Qt interactive usage (similar to the
2811 which provides support for Qt interactive usage (similar to the
2806 existing one for WX and GTK). This had been often requested.
2812 existing one for WX and GTK). This had been often requested.
2807
2813
2808 2005-04-14 *** Released version 0.6.13
2814 2005-04-14 *** Released version 0.6.13
2809
2815
2810 2005-04-08 Fernando Perez <fperez@colorado.edu>
2816 2005-04-08 Fernando Perez <fperez@colorado.edu>
2811
2817
2812 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2818 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2813 from _ofind, which gets called on almost every input line. Now,
2819 from _ofind, which gets called on almost every input line. Now,
2814 we only try to get docstrings if they are actually going to be
2820 we only try to get docstrings if they are actually going to be
2815 used (the overhead of fetching unnecessary docstrings can be
2821 used (the overhead of fetching unnecessary docstrings can be
2816 noticeable for certain objects, such as Pyro proxies).
2822 noticeable for certain objects, such as Pyro proxies).
2817
2823
2818 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2824 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2819 for completers. For some reason I had been passing them the state
2825 for completers. For some reason I had been passing them the state
2820 variable, which completers never actually need, and was in
2826 variable, which completers never actually need, and was in
2821 conflict with the rlcompleter API. Custom completers ONLY need to
2827 conflict with the rlcompleter API. Custom completers ONLY need to
2822 take the text parameter.
2828 take the text parameter.
2823
2829
2824 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2830 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2825 work correctly in pysh. I've also moved all the logic which used
2831 work correctly in pysh. I've also moved all the logic which used
2826 to be in pysh.py here, which will prevent problems with future
2832 to be in pysh.py here, which will prevent problems with future
2827 upgrades. However, this time I must warn users to update their
2833 upgrades. However, this time I must warn users to update their
2828 pysh profile to include the line
2834 pysh profile to include the line
2829
2835
2830 import_all IPython.Extensions.InterpreterExec
2836 import_all IPython.Extensions.InterpreterExec
2831
2837
2832 because otherwise things won't work for them. They MUST also
2838 because otherwise things won't work for them. They MUST also
2833 delete pysh.py and the line
2839 delete pysh.py and the line
2834
2840
2835 execfile pysh.py
2841 execfile pysh.py
2836
2842
2837 from their ipythonrc-pysh.
2843 from their ipythonrc-pysh.
2838
2844
2839 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2845 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2840 robust in the face of objects whose dir() returns non-strings
2846 robust in the face of objects whose dir() returns non-strings
2841 (which it shouldn't, but some broken libs like ITK do). Thanks to
2847 (which it shouldn't, but some broken libs like ITK do). Thanks to
2842 a patch by John Hunter (implemented differently, though). Also
2848 a patch by John Hunter (implemented differently, though). Also
2843 minor improvements by using .extend instead of + on lists.
2849 minor improvements by using .extend instead of + on lists.
2844
2850
2845 * pysh.py:
2851 * pysh.py:
2846
2852
2847 2005-04-06 Fernando Perez <fperez@colorado.edu>
2853 2005-04-06 Fernando Perez <fperez@colorado.edu>
2848
2854
2849 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2855 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2850 by default, so that all users benefit from it. Those who don't
2856 by default, so that all users benefit from it. Those who don't
2851 want it can still turn it off.
2857 want it can still turn it off.
2852
2858
2853 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2859 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2854 config file, I'd forgotten about this, so users were getting it
2860 config file, I'd forgotten about this, so users were getting it
2855 off by default.
2861 off by default.
2856
2862
2857 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2863 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2858 consistency. Now magics can be called in multiline statements,
2864 consistency. Now magics can be called in multiline statements,
2859 and python variables can be expanded in magic calls via $var.
2865 and python variables can be expanded in magic calls via $var.
2860 This makes the magic system behave just like aliases or !system
2866 This makes the magic system behave just like aliases or !system
2861 calls.
2867 calls.
2862
2868
2863 2005-03-28 Fernando Perez <fperez@colorado.edu>
2869 2005-03-28 Fernando Perez <fperez@colorado.edu>
2864
2870
2865 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2871 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2866 expensive string additions for building command. Add support for
2872 expensive string additions for building command. Add support for
2867 trailing ';' when autocall is used.
2873 trailing ';' when autocall is used.
2868
2874
2869 2005-03-26 Fernando Perez <fperez@colorado.edu>
2875 2005-03-26 Fernando Perez <fperez@colorado.edu>
2870
2876
2871 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2877 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2872 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2878 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2873 ipython.el robust against prompts with any number of spaces
2879 ipython.el robust against prompts with any number of spaces
2874 (including 0) after the ':' character.
2880 (including 0) after the ':' character.
2875
2881
2876 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2882 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2877 continuation prompt, which misled users to think the line was
2883 continuation prompt, which misled users to think the line was
2878 already indented. Closes debian Bug#300847, reported to me by
2884 already indented. Closes debian Bug#300847, reported to me by
2879 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2885 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2880
2886
2881 2005-03-23 Fernando Perez <fperez@colorado.edu>
2887 2005-03-23 Fernando Perez <fperez@colorado.edu>
2882
2888
2883 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2889 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2884 properly aligned if they have embedded newlines.
2890 properly aligned if they have embedded newlines.
2885
2891
2886 * IPython/iplib.py (runlines): Add a public method to expose
2892 * IPython/iplib.py (runlines): Add a public method to expose
2887 IPython's code execution machinery, so that users can run strings
2893 IPython's code execution machinery, so that users can run strings
2888 as if they had been typed at the prompt interactively.
2894 as if they had been typed at the prompt interactively.
2889 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2895 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2890 methods which can call the system shell, but with python variable
2896 methods which can call the system shell, but with python variable
2891 expansion. The three such methods are: __IPYTHON__.system,
2897 expansion. The three such methods are: __IPYTHON__.system,
2892 .getoutput and .getoutputerror. These need to be documented in a
2898 .getoutput and .getoutputerror. These need to be documented in a
2893 'public API' section (to be written) of the manual.
2899 'public API' section (to be written) of the manual.
2894
2900
2895 2005-03-20 Fernando Perez <fperez@colorado.edu>
2901 2005-03-20 Fernando Perez <fperez@colorado.edu>
2896
2902
2897 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2903 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2898 for custom exception handling. This is quite powerful, and it
2904 for custom exception handling. This is quite powerful, and it
2899 allows for user-installable exception handlers which can trap
2905 allows for user-installable exception handlers which can trap
2900 custom exceptions at runtime and treat them separately from
2906 custom exceptions at runtime and treat them separately from
2901 IPython's default mechanisms. At the request of Frédéric
2907 IPython's default mechanisms. At the request of Frédéric
2902 Mantegazza <mantegazza-AT-ill.fr>.
2908 Mantegazza <mantegazza-AT-ill.fr>.
2903 (InteractiveShell.set_custom_completer): public API function to
2909 (InteractiveShell.set_custom_completer): public API function to
2904 add new completers at runtime.
2910 add new completers at runtime.
2905
2911
2906 2005-03-19 Fernando Perez <fperez@colorado.edu>
2912 2005-03-19 Fernando Perez <fperez@colorado.edu>
2907
2913
2908 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2914 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2909 allow objects which provide their docstrings via non-standard
2915 allow objects which provide their docstrings via non-standard
2910 mechanisms (like Pyro proxies) to still be inspected by ipython's
2916 mechanisms (like Pyro proxies) to still be inspected by ipython's
2911 ? system.
2917 ? system.
2912
2918
2913 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2919 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2914 automatic capture system. I tried quite hard to make it work
2920 automatic capture system. I tried quite hard to make it work
2915 reliably, and simply failed. I tried many combinations with the
2921 reliably, and simply failed. I tried many combinations with the
2916 subprocess module, but eventually nothing worked in all needed
2922 subprocess module, but eventually nothing worked in all needed
2917 cases (not blocking stdin for the child, duplicating stdout
2923 cases (not blocking stdin for the child, duplicating stdout
2918 without blocking, etc). The new %sc/%sx still do capture to these
2924 without blocking, etc). The new %sc/%sx still do capture to these
2919 magical list/string objects which make shell use much more
2925 magical list/string objects which make shell use much more
2920 conveninent, so not all is lost.
2926 conveninent, so not all is lost.
2921
2927
2922 XXX - FIX MANUAL for the change above!
2928 XXX - FIX MANUAL for the change above!
2923
2929
2924 (runsource): I copied code.py's runsource() into ipython to modify
2930 (runsource): I copied code.py's runsource() into ipython to modify
2925 it a bit. Now the code object and source to be executed are
2931 it a bit. Now the code object and source to be executed are
2926 stored in ipython. This makes this info accessible to third-party
2932 stored in ipython. This makes this info accessible to third-party
2927 tools, like custom exception handlers. After a request by Frédéric
2933 tools, like custom exception handlers. After a request by Frédéric
2928 Mantegazza <mantegazza-AT-ill.fr>.
2934 Mantegazza <mantegazza-AT-ill.fr>.
2929
2935
2930 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2936 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2931 history-search via readline (like C-p/C-n). I'd wanted this for a
2937 history-search via readline (like C-p/C-n). I'd wanted this for a
2932 long time, but only recently found out how to do it. For users
2938 long time, but only recently found out how to do it. For users
2933 who already have their ipythonrc files made and want this, just
2939 who already have their ipythonrc files made and want this, just
2934 add:
2940 add:
2935
2941
2936 readline_parse_and_bind "\e[A": history-search-backward
2942 readline_parse_and_bind "\e[A": history-search-backward
2937 readline_parse_and_bind "\e[B": history-search-forward
2943 readline_parse_and_bind "\e[B": history-search-forward
2938
2944
2939 2005-03-18 Fernando Perez <fperez@colorado.edu>
2945 2005-03-18 Fernando Perez <fperez@colorado.edu>
2940
2946
2941 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2947 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2942 LSString and SList classes which allow transparent conversions
2948 LSString and SList classes which allow transparent conversions
2943 between list mode and whitespace-separated string.
2949 between list mode and whitespace-separated string.
2944 (magic_r): Fix recursion problem in %r.
2950 (magic_r): Fix recursion problem in %r.
2945
2951
2946 * IPython/genutils.py (LSString): New class to be used for
2952 * IPython/genutils.py (LSString): New class to be used for
2947 automatic storage of the results of all alias/system calls in _o
2953 automatic storage of the results of all alias/system calls in _o
2948 and _e (stdout/err). These provide a .l/.list attribute which
2954 and _e (stdout/err). These provide a .l/.list attribute which
2949 does automatic splitting on newlines. This means that for most
2955 does automatic splitting on newlines. This means that for most
2950 uses, you'll never need to do capturing of output with %sc/%sx
2956 uses, you'll never need to do capturing of output with %sc/%sx
2951 anymore, since ipython keeps this always done for you. Note that
2957 anymore, since ipython keeps this always done for you. Note that
2952 only the LAST results are stored, the _o/e variables are
2958 only the LAST results are stored, the _o/e variables are
2953 overwritten on each call. If you need to save their contents
2959 overwritten on each call. If you need to save their contents
2954 further, simply bind them to any other name.
2960 further, simply bind them to any other name.
2955
2961
2956 2005-03-17 Fernando Perez <fperez@colorado.edu>
2962 2005-03-17 Fernando Perez <fperez@colorado.edu>
2957
2963
2958 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2964 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2959 prompt namespace handling.
2965 prompt namespace handling.
2960
2966
2961 2005-03-16 Fernando Perez <fperez@colorado.edu>
2967 2005-03-16 Fernando Perez <fperez@colorado.edu>
2962
2968
2963 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2969 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2964 classic prompts to be '>>> ' (final space was missing, and it
2970 classic prompts to be '>>> ' (final space was missing, and it
2965 trips the emacs python mode).
2971 trips the emacs python mode).
2966 (BasePrompt.__str__): Added safe support for dynamic prompt
2972 (BasePrompt.__str__): Added safe support for dynamic prompt
2967 strings. Now you can set your prompt string to be '$x', and the
2973 strings. Now you can set your prompt string to be '$x', and the
2968 value of x will be printed from your interactive namespace. The
2974 value of x will be printed from your interactive namespace. The
2969 interpolation syntax includes the full Itpl support, so
2975 interpolation syntax includes the full Itpl support, so
2970 ${foo()+x+bar()} is a valid prompt string now, and the function
2976 ${foo()+x+bar()} is a valid prompt string now, and the function
2971 calls will be made at runtime.
2977 calls will be made at runtime.
2972
2978
2973 2005-03-15 Fernando Perez <fperez@colorado.edu>
2979 2005-03-15 Fernando Perez <fperez@colorado.edu>
2974
2980
2975 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2981 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2976 avoid name clashes in pylab. %hist still works, it just forwards
2982 avoid name clashes in pylab. %hist still works, it just forwards
2977 the call to %history.
2983 the call to %history.
2978
2984
2979 2005-03-02 *** Released version 0.6.12
2985 2005-03-02 *** Released version 0.6.12
2980
2986
2981 2005-03-02 Fernando Perez <fperez@colorado.edu>
2987 2005-03-02 Fernando Perez <fperez@colorado.edu>
2982
2988
2983 * IPython/iplib.py (handle_magic): log magic calls properly as
2989 * IPython/iplib.py (handle_magic): log magic calls properly as
2984 ipmagic() function calls.
2990 ipmagic() function calls.
2985
2991
2986 * IPython/Magic.py (magic_time): Improved %time to support
2992 * IPython/Magic.py (magic_time): Improved %time to support
2987 statements and provide wall-clock as well as CPU time.
2993 statements and provide wall-clock as well as CPU time.
2988
2994
2989 2005-02-27 Fernando Perez <fperez@colorado.edu>
2995 2005-02-27 Fernando Perez <fperez@colorado.edu>
2990
2996
2991 * IPython/hooks.py: New hooks module, to expose user-modifiable
2997 * IPython/hooks.py: New hooks module, to expose user-modifiable
2992 IPython functionality in a clean manner. For now only the editor
2998 IPython functionality in a clean manner. For now only the editor
2993 hook is actually written, and other thigns which I intend to turn
2999 hook is actually written, and other thigns which I intend to turn
2994 into proper hooks aren't yet there. The display and prefilter
3000 into proper hooks aren't yet there. The display and prefilter
2995 stuff, for example, should be hooks. But at least now the
3001 stuff, for example, should be hooks. But at least now the
2996 framework is in place, and the rest can be moved here with more
3002 framework is in place, and the rest can be moved here with more
2997 time later. IPython had had a .hooks variable for a long time for
3003 time later. IPython had had a .hooks variable for a long time for
2998 this purpose, but I'd never actually used it for anything.
3004 this purpose, but I'd never actually used it for anything.
2999
3005
3000 2005-02-26 Fernando Perez <fperez@colorado.edu>
3006 2005-02-26 Fernando Perez <fperez@colorado.edu>
3001
3007
3002 * IPython/ipmaker.py (make_IPython): make the default ipython
3008 * IPython/ipmaker.py (make_IPython): make the default ipython
3003 directory be called _ipython under win32, to follow more the
3009 directory be called _ipython under win32, to follow more the
3004 naming peculiarities of that platform (where buggy software like
3010 naming peculiarities of that platform (where buggy software like
3005 Visual Sourcesafe breaks with .named directories). Reported by
3011 Visual Sourcesafe breaks with .named directories). Reported by
3006 Ville Vainio.
3012 Ville Vainio.
3007
3013
3008 2005-02-23 Fernando Perez <fperez@colorado.edu>
3014 2005-02-23 Fernando Perez <fperez@colorado.edu>
3009
3015
3010 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3016 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3011 auto_aliases for win32 which were causing problems. Users can
3017 auto_aliases for win32 which were causing problems. Users can
3012 define the ones they personally like.
3018 define the ones they personally like.
3013
3019
3014 2005-02-21 Fernando Perez <fperez@colorado.edu>
3020 2005-02-21 Fernando Perez <fperez@colorado.edu>
3015
3021
3016 * IPython/Magic.py (magic_time): new magic to time execution of
3022 * IPython/Magic.py (magic_time): new magic to time execution of
3017 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3023 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3018
3024
3019 2005-02-19 Fernando Perez <fperez@colorado.edu>
3025 2005-02-19 Fernando Perez <fperez@colorado.edu>
3020
3026
3021 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3027 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3022 into keys (for prompts, for example).
3028 into keys (for prompts, for example).
3023
3029
3024 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3030 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3025 prompts in case users want them. This introduces a small behavior
3031 prompts in case users want them. This introduces a small behavior
3026 change: ipython does not automatically add a space to all prompts
3032 change: ipython does not automatically add a space to all prompts
3027 anymore. To get the old prompts with a space, users should add it
3033 anymore. To get the old prompts with a space, users should add it
3028 manually to their ipythonrc file, so for example prompt_in1 should
3034 manually to their ipythonrc file, so for example prompt_in1 should
3029 now read 'In [\#]: ' instead of 'In [\#]:'.
3035 now read 'In [\#]: ' instead of 'In [\#]:'.
3030 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3036 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3031 file) to control left-padding of secondary prompts.
3037 file) to control left-padding of secondary prompts.
3032
3038
3033 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3039 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3034 the profiler can't be imported. Fix for Debian, which removed
3040 the profiler can't be imported. Fix for Debian, which removed
3035 profile.py because of License issues. I applied a slightly
3041 profile.py because of License issues. I applied a slightly
3036 modified version of the original Debian patch at
3042 modified version of the original Debian patch at
3037 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3043 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3038
3044
3039 2005-02-17 Fernando Perez <fperez@colorado.edu>
3045 2005-02-17 Fernando Perez <fperez@colorado.edu>
3040
3046
3041 * IPython/genutils.py (native_line_ends): Fix bug which would
3047 * IPython/genutils.py (native_line_ends): Fix bug which would
3042 cause improper line-ends under win32 b/c I was not opening files
3048 cause improper line-ends under win32 b/c I was not opening files
3043 in binary mode. Bug report and fix thanks to Ville.
3049 in binary mode. Bug report and fix thanks to Ville.
3044
3050
3045 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3051 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3046 trying to catch spurious foo[1] autocalls. My fix actually broke
3052 trying to catch spurious foo[1] autocalls. My fix actually broke
3047 ',/' autoquote/call with explicit escape (bad regexp).
3053 ',/' autoquote/call with explicit escape (bad regexp).
3048
3054
3049 2005-02-15 *** Released version 0.6.11
3055 2005-02-15 *** Released version 0.6.11
3050
3056
3051 2005-02-14 Fernando Perez <fperez@colorado.edu>
3057 2005-02-14 Fernando Perez <fperez@colorado.edu>
3052
3058
3053 * IPython/background_jobs.py: New background job management
3059 * IPython/background_jobs.py: New background job management
3054 subsystem. This is implemented via a new set of classes, and
3060 subsystem. This is implemented via a new set of classes, and
3055 IPython now provides a builtin 'jobs' object for background job
3061 IPython now provides a builtin 'jobs' object for background job
3056 execution. A convenience %bg magic serves as a lightweight
3062 execution. A convenience %bg magic serves as a lightweight
3057 frontend for starting the more common type of calls. This was
3063 frontend for starting the more common type of calls. This was
3058 inspired by discussions with B. Granger and the BackgroundCommand
3064 inspired by discussions with B. Granger and the BackgroundCommand
3059 class described in the book Python Scripting for Computational
3065 class described in the book Python Scripting for Computational
3060 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3066 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3061 (although ultimately no code from this text was used, as IPython's
3067 (although ultimately no code from this text was used, as IPython's
3062 system is a separate implementation).
3068 system is a separate implementation).
3063
3069
3064 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3070 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3065 to control the completion of single/double underscore names
3071 to control the completion of single/double underscore names
3066 separately. As documented in the example ipytonrc file, the
3072 separately. As documented in the example ipytonrc file, the
3067 readline_omit__names variable can now be set to 2, to omit even
3073 readline_omit__names variable can now be set to 2, to omit even
3068 single underscore names. Thanks to a patch by Brian Wong
3074 single underscore names. Thanks to a patch by Brian Wong
3069 <BrianWong-AT-AirgoNetworks.Com>.
3075 <BrianWong-AT-AirgoNetworks.Com>.
3070 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3076 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3071 be autocalled as foo([1]) if foo were callable. A problem for
3077 be autocalled as foo([1]) if foo were callable. A problem for
3072 things which are both callable and implement __getitem__.
3078 things which are both callable and implement __getitem__.
3073 (init_readline): Fix autoindentation for win32. Thanks to a patch
3079 (init_readline): Fix autoindentation for win32. Thanks to a patch
3074 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3080 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3075
3081
3076 2005-02-12 Fernando Perez <fperez@colorado.edu>
3082 2005-02-12 Fernando Perez <fperez@colorado.edu>
3077
3083
3078 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3084 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3079 which I had written long ago to sort out user error messages which
3085 which I had written long ago to sort out user error messages which
3080 may occur during startup. This seemed like a good idea initially,
3086 may occur during startup. This seemed like a good idea initially,
3081 but it has proven a disaster in retrospect. I don't want to
3087 but it has proven a disaster in retrospect. I don't want to
3082 change much code for now, so my fix is to set the internal 'debug'
3088 change much code for now, so my fix is to set the internal 'debug'
3083 flag to true everywhere, whose only job was precisely to control
3089 flag to true everywhere, whose only job was precisely to control
3084 this subsystem. This closes issue 28 (as well as avoiding all
3090 this subsystem. This closes issue 28 (as well as avoiding all
3085 sorts of strange hangups which occur from time to time).
3091 sorts of strange hangups which occur from time to time).
3086
3092
3087 2005-02-07 Fernando Perez <fperez@colorado.edu>
3093 2005-02-07 Fernando Perez <fperez@colorado.edu>
3088
3094
3089 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3095 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3090 previous call produced a syntax error.
3096 previous call produced a syntax error.
3091
3097
3092 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3098 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3093 classes without constructor.
3099 classes without constructor.
3094
3100
3095 2005-02-06 Fernando Perez <fperez@colorado.edu>
3101 2005-02-06 Fernando Perez <fperez@colorado.edu>
3096
3102
3097 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3103 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3098 completions with the results of each matcher, so we return results
3104 completions with the results of each matcher, so we return results
3099 to the user from all namespaces. This breaks with ipython
3105 to the user from all namespaces. This breaks with ipython
3100 tradition, but I think it's a nicer behavior. Now you get all
3106 tradition, but I think it's a nicer behavior. Now you get all
3101 possible completions listed, from all possible namespaces (python,
3107 possible completions listed, from all possible namespaces (python,
3102 filesystem, magics...) After a request by John Hunter
3108 filesystem, magics...) After a request by John Hunter
3103 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3109 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3104
3110
3105 2005-02-05 Fernando Perez <fperez@colorado.edu>
3111 2005-02-05 Fernando Perez <fperez@colorado.edu>
3106
3112
3107 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3113 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3108 the call had quote characters in it (the quotes were stripped).
3114 the call had quote characters in it (the quotes were stripped).
3109
3115
3110 2005-01-31 Fernando Perez <fperez@colorado.edu>
3116 2005-01-31 Fernando Perez <fperez@colorado.edu>
3111
3117
3112 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3118 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3113 Itpl.itpl() to make the code more robust against psyco
3119 Itpl.itpl() to make the code more robust against psyco
3114 optimizations.
3120 optimizations.
3115
3121
3116 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3122 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3117 of causing an exception. Quicker, cleaner.
3123 of causing an exception. Quicker, cleaner.
3118
3124
3119 2005-01-28 Fernando Perez <fperez@colorado.edu>
3125 2005-01-28 Fernando Perez <fperez@colorado.edu>
3120
3126
3121 * scripts/ipython_win_post_install.py (install): hardcode
3127 * scripts/ipython_win_post_install.py (install): hardcode
3122 sys.prefix+'python.exe' as the executable path. It turns out that
3128 sys.prefix+'python.exe' as the executable path. It turns out that
3123 during the post-installation run, sys.executable resolves to the
3129 during the post-installation run, sys.executable resolves to the
3124 name of the binary installer! I should report this as a distutils
3130 name of the binary installer! I should report this as a distutils
3125 bug, I think. I updated the .10 release with this tiny fix, to
3131 bug, I think. I updated the .10 release with this tiny fix, to
3126 avoid annoying the lists further.
3132 avoid annoying the lists further.
3127
3133
3128 2005-01-27 *** Released version 0.6.10
3134 2005-01-27 *** Released version 0.6.10
3129
3135
3130 2005-01-27 Fernando Perez <fperez@colorado.edu>
3136 2005-01-27 Fernando Perez <fperez@colorado.edu>
3131
3137
3132 * IPython/numutils.py (norm): Added 'inf' as optional name for
3138 * IPython/numutils.py (norm): Added 'inf' as optional name for
3133 L-infinity norm, included references to mathworld.com for vector
3139 L-infinity norm, included references to mathworld.com for vector
3134 norm definitions.
3140 norm definitions.
3135 (amin/amax): added amin/amax for array min/max. Similar to what
3141 (amin/amax): added amin/amax for array min/max. Similar to what
3136 pylab ships with after the recent reorganization of names.
3142 pylab ships with after the recent reorganization of names.
3137 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3143 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3138
3144
3139 * ipython.el: committed Alex's recent fixes and improvements.
3145 * ipython.el: committed Alex's recent fixes and improvements.
3140 Tested with python-mode from CVS, and it looks excellent. Since
3146 Tested with python-mode from CVS, and it looks excellent. Since
3141 python-mode hasn't released anything in a while, I'm temporarily
3147 python-mode hasn't released anything in a while, I'm temporarily
3142 putting a copy of today's CVS (v 4.70) of python-mode in:
3148 putting a copy of today's CVS (v 4.70) of python-mode in:
3143 http://ipython.scipy.org/tmp/python-mode.el
3149 http://ipython.scipy.org/tmp/python-mode.el
3144
3150
3145 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3151 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3146 sys.executable for the executable name, instead of assuming it's
3152 sys.executable for the executable name, instead of assuming it's
3147 called 'python.exe' (the post-installer would have produced broken
3153 called 'python.exe' (the post-installer would have produced broken
3148 setups on systems with a differently named python binary).
3154 setups on systems with a differently named python binary).
3149
3155
3150 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3156 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3151 references to os.linesep, to make the code more
3157 references to os.linesep, to make the code more
3152 platform-independent. This is also part of the win32 coloring
3158 platform-independent. This is also part of the win32 coloring
3153 fixes.
3159 fixes.
3154
3160
3155 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3161 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3156 lines, which actually cause coloring bugs because the length of
3162 lines, which actually cause coloring bugs because the length of
3157 the line is very difficult to correctly compute with embedded
3163 the line is very difficult to correctly compute with embedded
3158 escapes. This was the source of all the coloring problems under
3164 escapes. This was the source of all the coloring problems under
3159 Win32. I think that _finally_, Win32 users have a properly
3165 Win32. I think that _finally_, Win32 users have a properly
3160 working ipython in all respects. This would never have happened
3166 working ipython in all respects. This would never have happened
3161 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3167 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3162
3168
3163 2005-01-26 *** Released version 0.6.9
3169 2005-01-26 *** Released version 0.6.9
3164
3170
3165 2005-01-25 Fernando Perez <fperez@colorado.edu>
3171 2005-01-25 Fernando Perez <fperez@colorado.edu>
3166
3172
3167 * setup.py: finally, we have a true Windows installer, thanks to
3173 * setup.py: finally, we have a true Windows installer, thanks to
3168 the excellent work of Viktor Ransmayr
3174 the excellent work of Viktor Ransmayr
3169 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3175 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3170 Windows users. The setup routine is quite a bit cleaner thanks to
3176 Windows users. The setup routine is quite a bit cleaner thanks to
3171 this, and the post-install script uses the proper functions to
3177 this, and the post-install script uses the proper functions to
3172 allow a clean de-installation using the standard Windows Control
3178 allow a clean de-installation using the standard Windows Control
3173 Panel.
3179 Panel.
3174
3180
3175 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3181 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3176 environment variable under all OSes (including win32) if
3182 environment variable under all OSes (including win32) if
3177 available. This will give consistency to win32 users who have set
3183 available. This will give consistency to win32 users who have set
3178 this variable for any reason. If os.environ['HOME'] fails, the
3184 this variable for any reason. If os.environ['HOME'] fails, the
3179 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3185 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3180
3186
3181 2005-01-24 Fernando Perez <fperez@colorado.edu>
3187 2005-01-24 Fernando Perez <fperez@colorado.edu>
3182
3188
3183 * IPython/numutils.py (empty_like): add empty_like(), similar to
3189 * IPython/numutils.py (empty_like): add empty_like(), similar to
3184 zeros_like() but taking advantage of the new empty() Numeric routine.
3190 zeros_like() but taking advantage of the new empty() Numeric routine.
3185
3191
3186 2005-01-23 *** Released version 0.6.8
3192 2005-01-23 *** Released version 0.6.8
3187
3193
3188 2005-01-22 Fernando Perez <fperez@colorado.edu>
3194 2005-01-22 Fernando Perez <fperez@colorado.edu>
3189
3195
3190 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3196 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3191 automatic show() calls. After discussing things with JDH, it
3197 automatic show() calls. After discussing things with JDH, it
3192 turns out there are too many corner cases where this can go wrong.
3198 turns out there are too many corner cases where this can go wrong.
3193 It's best not to try to be 'too smart', and simply have ipython
3199 It's best not to try to be 'too smart', and simply have ipython
3194 reproduce as much as possible the default behavior of a normal
3200 reproduce as much as possible the default behavior of a normal
3195 python shell.
3201 python shell.
3196
3202
3197 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3203 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3198 line-splitting regexp and _prefilter() to avoid calling getattr()
3204 line-splitting regexp and _prefilter() to avoid calling getattr()
3199 on assignments. This closes
3205 on assignments. This closes
3200 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3206 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3201 readline uses getattr(), so a simple <TAB> keypress is still
3207 readline uses getattr(), so a simple <TAB> keypress is still
3202 enough to trigger getattr() calls on an object.
3208 enough to trigger getattr() calls on an object.
3203
3209
3204 2005-01-21 Fernando Perez <fperez@colorado.edu>
3210 2005-01-21 Fernando Perez <fperez@colorado.edu>
3205
3211
3206 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3212 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3207 docstring under pylab so it doesn't mask the original.
3213 docstring under pylab so it doesn't mask the original.
3208
3214
3209 2005-01-21 *** Released version 0.6.7
3215 2005-01-21 *** Released version 0.6.7
3210
3216
3211 2005-01-21 Fernando Perez <fperez@colorado.edu>
3217 2005-01-21 Fernando Perez <fperez@colorado.edu>
3212
3218
3213 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3219 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3214 signal handling for win32 users in multithreaded mode.
3220 signal handling for win32 users in multithreaded mode.
3215
3221
3216 2005-01-17 Fernando Perez <fperez@colorado.edu>
3222 2005-01-17 Fernando Perez <fperez@colorado.edu>
3217
3223
3218 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3224 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3219 instances with no __init__. After a crash report by Norbert Nemec
3225 instances with no __init__. After a crash report by Norbert Nemec
3220 <Norbert-AT-nemec-online.de>.
3226 <Norbert-AT-nemec-online.de>.
3221
3227
3222 2005-01-14 Fernando Perez <fperez@colorado.edu>
3228 2005-01-14 Fernando Perez <fperez@colorado.edu>
3223
3229
3224 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3230 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3225 names for verbose exceptions, when multiple dotted names and the
3231 names for verbose exceptions, when multiple dotted names and the
3226 'parent' object were present on the same line.
3232 'parent' object were present on the same line.
3227
3233
3228 2005-01-11 Fernando Perez <fperez@colorado.edu>
3234 2005-01-11 Fernando Perez <fperez@colorado.edu>
3229
3235
3230 * IPython/genutils.py (flag_calls): new utility to trap and flag
3236 * IPython/genutils.py (flag_calls): new utility to trap and flag
3231 calls in functions. I need it to clean up matplotlib support.
3237 calls in functions. I need it to clean up matplotlib support.
3232 Also removed some deprecated code in genutils.
3238 Also removed some deprecated code in genutils.
3233
3239
3234 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3240 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3235 that matplotlib scripts called with %run, which don't call show()
3241 that matplotlib scripts called with %run, which don't call show()
3236 themselves, still have their plotting windows open.
3242 themselves, still have their plotting windows open.
3237
3243
3238 2005-01-05 Fernando Perez <fperez@colorado.edu>
3244 2005-01-05 Fernando Perez <fperez@colorado.edu>
3239
3245
3240 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3246 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3241 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3247 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3242
3248
3243 2004-12-19 Fernando Perez <fperez@colorado.edu>
3249 2004-12-19 Fernando Perez <fperez@colorado.edu>
3244
3250
3245 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3251 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3246 parent_runcode, which was an eyesore. The same result can be
3252 parent_runcode, which was an eyesore. The same result can be
3247 obtained with Python's regular superclass mechanisms.
3253 obtained with Python's regular superclass mechanisms.
3248
3254
3249 2004-12-17 Fernando Perez <fperez@colorado.edu>
3255 2004-12-17 Fernando Perez <fperez@colorado.edu>
3250
3256
3251 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3257 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3252 reported by Prabhu.
3258 reported by Prabhu.
3253 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3259 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3254 sys.stderr) instead of explicitly calling sys.stderr. This helps
3260 sys.stderr) instead of explicitly calling sys.stderr. This helps
3255 maintain our I/O abstractions clean, for future GUI embeddings.
3261 maintain our I/O abstractions clean, for future GUI embeddings.
3256
3262
3257 * IPython/genutils.py (info): added new utility for sys.stderr
3263 * IPython/genutils.py (info): added new utility for sys.stderr
3258 unified info message handling (thin wrapper around warn()).
3264 unified info message handling (thin wrapper around warn()).
3259
3265
3260 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3266 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3261 composite (dotted) names on verbose exceptions.
3267 composite (dotted) names on verbose exceptions.
3262 (VerboseTB.nullrepr): harden against another kind of errors which
3268 (VerboseTB.nullrepr): harden against another kind of errors which
3263 Python's inspect module can trigger, and which were crashing
3269 Python's inspect module can trigger, and which were crashing
3264 IPython. Thanks to a report by Marco Lombardi
3270 IPython. Thanks to a report by Marco Lombardi
3265 <mlombard-AT-ma010192.hq.eso.org>.
3271 <mlombard-AT-ma010192.hq.eso.org>.
3266
3272
3267 2004-12-13 *** Released version 0.6.6
3273 2004-12-13 *** Released version 0.6.6
3268
3274
3269 2004-12-12 Fernando Perez <fperez@colorado.edu>
3275 2004-12-12 Fernando Perez <fperez@colorado.edu>
3270
3276
3271 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3277 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3272 generated by pygtk upon initialization if it was built without
3278 generated by pygtk upon initialization if it was built without
3273 threads (for matplotlib users). After a crash reported by
3279 threads (for matplotlib users). After a crash reported by
3274 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3280 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3275
3281
3276 * IPython/ipmaker.py (make_IPython): fix small bug in the
3282 * IPython/ipmaker.py (make_IPython): fix small bug in the
3277 import_some parameter for multiple imports.
3283 import_some parameter for multiple imports.
3278
3284
3279 * IPython/iplib.py (ipmagic): simplified the interface of
3285 * IPython/iplib.py (ipmagic): simplified the interface of
3280 ipmagic() to take a single string argument, just as it would be
3286 ipmagic() to take a single string argument, just as it would be
3281 typed at the IPython cmd line.
3287 typed at the IPython cmd line.
3282 (ipalias): Added new ipalias() with an interface identical to
3288 (ipalias): Added new ipalias() with an interface identical to
3283 ipmagic(). This completes exposing a pure python interface to the
3289 ipmagic(). This completes exposing a pure python interface to the
3284 alias and magic system, which can be used in loops or more complex
3290 alias and magic system, which can be used in loops or more complex
3285 code where IPython's automatic line mangling is not active.
3291 code where IPython's automatic line mangling is not active.
3286
3292
3287 * IPython/genutils.py (timing): changed interface of timing to
3293 * IPython/genutils.py (timing): changed interface of timing to
3288 simply run code once, which is the most common case. timings()
3294 simply run code once, which is the most common case. timings()
3289 remains unchanged, for the cases where you want multiple runs.
3295 remains unchanged, for the cases where you want multiple runs.
3290
3296
3291 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3297 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3292 bug where Python2.2 crashes with exec'ing code which does not end
3298 bug where Python2.2 crashes with exec'ing code which does not end
3293 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3299 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3294 before.
3300 before.
3295
3301
3296 2004-12-10 Fernando Perez <fperez@colorado.edu>
3302 2004-12-10 Fernando Perez <fperez@colorado.edu>
3297
3303
3298 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3304 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3299 -t to -T, to accomodate the new -t flag in %run (the %run and
3305 -t to -T, to accomodate the new -t flag in %run (the %run and
3300 %prun options are kind of intermixed, and it's not easy to change
3306 %prun options are kind of intermixed, and it's not easy to change
3301 this with the limitations of python's getopt).
3307 this with the limitations of python's getopt).
3302
3308
3303 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3309 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3304 the execution of scripts. It's not as fine-tuned as timeit.py,
3310 the execution of scripts. It's not as fine-tuned as timeit.py,
3305 but it works from inside ipython (and under 2.2, which lacks
3311 but it works from inside ipython (and under 2.2, which lacks
3306 timeit.py). Optionally a number of runs > 1 can be given for
3312 timeit.py). Optionally a number of runs > 1 can be given for
3307 timing very short-running code.
3313 timing very short-running code.
3308
3314
3309 * IPython/genutils.py (uniq_stable): new routine which returns a
3315 * IPython/genutils.py (uniq_stable): new routine which returns a
3310 list of unique elements in any iterable, but in stable order of
3316 list of unique elements in any iterable, but in stable order of
3311 appearance. I needed this for the ultraTB fixes, and it's a handy
3317 appearance. I needed this for the ultraTB fixes, and it's a handy
3312 utility.
3318 utility.
3313
3319
3314 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3320 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3315 dotted names in Verbose exceptions. This had been broken since
3321 dotted names in Verbose exceptions. This had been broken since
3316 the very start, now x.y will properly be printed in a Verbose
3322 the very start, now x.y will properly be printed in a Verbose
3317 traceback, instead of x being shown and y appearing always as an
3323 traceback, instead of x being shown and y appearing always as an
3318 'undefined global'. Getting this to work was a bit tricky,
3324 'undefined global'. Getting this to work was a bit tricky,
3319 because by default python tokenizers are stateless. Saved by
3325 because by default python tokenizers are stateless. Saved by
3320 python's ability to easily add a bit of state to an arbitrary
3326 python's ability to easily add a bit of state to an arbitrary
3321 function (without needing to build a full-blown callable object).
3327 function (without needing to build a full-blown callable object).
3322
3328
3323 Also big cleanup of this code, which had horrendous runtime
3329 Also big cleanup of this code, which had horrendous runtime
3324 lookups of zillions of attributes for colorization. Moved all
3330 lookups of zillions of attributes for colorization. Moved all
3325 this code into a few templates, which make it cleaner and quicker.
3331 this code into a few templates, which make it cleaner and quicker.
3326
3332
3327 Printout quality was also improved for Verbose exceptions: one
3333 Printout quality was also improved for Verbose exceptions: one
3328 variable per line, and memory addresses are printed (this can be
3334 variable per line, and memory addresses are printed (this can be
3329 quite handy in nasty debugging situations, which is what Verbose
3335 quite handy in nasty debugging situations, which is what Verbose
3330 is for).
3336 is for).
3331
3337
3332 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3338 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3333 the command line as scripts to be loaded by embedded instances.
3339 the command line as scripts to be loaded by embedded instances.
3334 Doing so has the potential for an infinite recursion if there are
3340 Doing so has the potential for an infinite recursion if there are
3335 exceptions thrown in the process. This fixes a strange crash
3341 exceptions thrown in the process. This fixes a strange crash
3336 reported by Philippe MULLER <muller-AT-irit.fr>.
3342 reported by Philippe MULLER <muller-AT-irit.fr>.
3337
3343
3338 2004-12-09 Fernando Perez <fperez@colorado.edu>
3344 2004-12-09 Fernando Perez <fperez@colorado.edu>
3339
3345
3340 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3346 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3341 to reflect new names in matplotlib, which now expose the
3347 to reflect new names in matplotlib, which now expose the
3342 matlab-compatible interface via a pylab module instead of the
3348 matlab-compatible interface via a pylab module instead of the
3343 'matlab' name. The new code is backwards compatible, so users of
3349 'matlab' name. The new code is backwards compatible, so users of
3344 all matplotlib versions are OK. Patch by J. Hunter.
3350 all matplotlib versions are OK. Patch by J. Hunter.
3345
3351
3346 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3352 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3347 of __init__ docstrings for instances (class docstrings are already
3353 of __init__ docstrings for instances (class docstrings are already
3348 automatically printed). Instances with customized docstrings
3354 automatically printed). Instances with customized docstrings
3349 (indep. of the class) are also recognized and all 3 separate
3355 (indep. of the class) are also recognized and all 3 separate
3350 docstrings are printed (instance, class, constructor). After some
3356 docstrings are printed (instance, class, constructor). After some
3351 comments/suggestions by J. Hunter.
3357 comments/suggestions by J. Hunter.
3352
3358
3353 2004-12-05 Fernando Perez <fperez@colorado.edu>
3359 2004-12-05 Fernando Perez <fperez@colorado.edu>
3354
3360
3355 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3361 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3356 warnings when tab-completion fails and triggers an exception.
3362 warnings when tab-completion fails and triggers an exception.
3357
3363
3358 2004-12-03 Fernando Perez <fperez@colorado.edu>
3364 2004-12-03 Fernando Perez <fperez@colorado.edu>
3359
3365
3360 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3366 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3361 be triggered when using 'run -p'. An incorrect option flag was
3367 be triggered when using 'run -p'. An incorrect option flag was
3362 being set ('d' instead of 'D').
3368 being set ('d' instead of 'D').
3363 (manpage): fix missing escaped \- sign.
3369 (manpage): fix missing escaped \- sign.
3364
3370
3365 2004-11-30 *** Released version 0.6.5
3371 2004-11-30 *** Released version 0.6.5
3366
3372
3367 2004-11-30 Fernando Perez <fperez@colorado.edu>
3373 2004-11-30 Fernando Perez <fperez@colorado.edu>
3368
3374
3369 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3375 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3370 setting with -d option.
3376 setting with -d option.
3371
3377
3372 * setup.py (docfiles): Fix problem where the doc glob I was using
3378 * setup.py (docfiles): Fix problem where the doc glob I was using
3373 was COMPLETELY BROKEN. It was giving the right files by pure
3379 was COMPLETELY BROKEN. It was giving the right files by pure
3374 accident, but failed once I tried to include ipython.el. Note:
3380 accident, but failed once I tried to include ipython.el. Note:
3375 glob() does NOT allow you to do exclusion on multiple endings!
3381 glob() does NOT allow you to do exclusion on multiple endings!
3376
3382
3377 2004-11-29 Fernando Perez <fperez@colorado.edu>
3383 2004-11-29 Fernando Perez <fperez@colorado.edu>
3378
3384
3379 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3385 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3380 the manpage as the source. Better formatting & consistency.
3386 the manpage as the source. Better formatting & consistency.
3381
3387
3382 * IPython/Magic.py (magic_run): Added new -d option, to run
3388 * IPython/Magic.py (magic_run): Added new -d option, to run
3383 scripts under the control of the python pdb debugger. Note that
3389 scripts under the control of the python pdb debugger. Note that
3384 this required changing the %prun option -d to -D, to avoid a clash
3390 this required changing the %prun option -d to -D, to avoid a clash
3385 (since %run must pass options to %prun, and getopt is too dumb to
3391 (since %run must pass options to %prun, and getopt is too dumb to
3386 handle options with string values with embedded spaces). Thanks
3392 handle options with string values with embedded spaces). Thanks
3387 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3393 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3388 (magic_who_ls): added type matching to %who and %whos, so that one
3394 (magic_who_ls): added type matching to %who and %whos, so that one
3389 can filter their output to only include variables of certain
3395 can filter their output to only include variables of certain
3390 types. Another suggestion by Matthew.
3396 types. Another suggestion by Matthew.
3391 (magic_whos): Added memory summaries in kb and Mb for arrays.
3397 (magic_whos): Added memory summaries in kb and Mb for arrays.
3392 (magic_who): Improve formatting (break lines every 9 vars).
3398 (magic_who): Improve formatting (break lines every 9 vars).
3393
3399
3394 2004-11-28 Fernando Perez <fperez@colorado.edu>
3400 2004-11-28 Fernando Perez <fperez@colorado.edu>
3395
3401
3396 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3402 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3397 cache when empty lines were present.
3403 cache when empty lines were present.
3398
3404
3399 2004-11-24 Fernando Perez <fperez@colorado.edu>
3405 2004-11-24 Fernando Perez <fperez@colorado.edu>
3400
3406
3401 * IPython/usage.py (__doc__): document the re-activated threading
3407 * IPython/usage.py (__doc__): document the re-activated threading
3402 options for WX and GTK.
3408 options for WX and GTK.
3403
3409
3404 2004-11-23 Fernando Perez <fperez@colorado.edu>
3410 2004-11-23 Fernando Perez <fperez@colorado.edu>
3405
3411
3406 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3412 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3407 the -wthread and -gthread options, along with a new -tk one to try
3413 the -wthread and -gthread options, along with a new -tk one to try
3408 and coordinate Tk threading with wx/gtk. The tk support is very
3414 and coordinate Tk threading with wx/gtk. The tk support is very
3409 platform dependent, since it seems to require Tcl and Tk to be
3415 platform dependent, since it seems to require Tcl and Tk to be
3410 built with threads (Fedora1/2 appears NOT to have it, but in
3416 built with threads (Fedora1/2 appears NOT to have it, but in
3411 Prabhu's Debian boxes it works OK). But even with some Tk
3417 Prabhu's Debian boxes it works OK). But even with some Tk
3412 limitations, this is a great improvement.
3418 limitations, this is a great improvement.
3413
3419
3414 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3420 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3415 info in user prompts. Patch by Prabhu.
3421 info in user prompts. Patch by Prabhu.
3416
3422
3417 2004-11-18 Fernando Perez <fperez@colorado.edu>
3423 2004-11-18 Fernando Perez <fperez@colorado.edu>
3418
3424
3419 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3425 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3420 EOFErrors and bail, to avoid infinite loops if a non-terminating
3426 EOFErrors and bail, to avoid infinite loops if a non-terminating
3421 file is fed into ipython. Patch submitted in issue 19 by user,
3427 file is fed into ipython. Patch submitted in issue 19 by user,
3422 many thanks.
3428 many thanks.
3423
3429
3424 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3430 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3425 autoquote/parens in continuation prompts, which can cause lots of
3431 autoquote/parens in continuation prompts, which can cause lots of
3426 problems. Closes roundup issue 20.
3432 problems. Closes roundup issue 20.
3427
3433
3428 2004-11-17 Fernando Perez <fperez@colorado.edu>
3434 2004-11-17 Fernando Perez <fperez@colorado.edu>
3429
3435
3430 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3436 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3431 reported as debian bug #280505. I'm not sure my local changelog
3437 reported as debian bug #280505. I'm not sure my local changelog
3432 entry has the proper debian format (Jack?).
3438 entry has the proper debian format (Jack?).
3433
3439
3434 2004-11-08 *** Released version 0.6.4
3440 2004-11-08 *** Released version 0.6.4
3435
3441
3436 2004-11-08 Fernando Perez <fperez@colorado.edu>
3442 2004-11-08 Fernando Perez <fperez@colorado.edu>
3437
3443
3438 * IPython/iplib.py (init_readline): Fix exit message for Windows
3444 * IPython/iplib.py (init_readline): Fix exit message for Windows
3439 when readline is active. Thanks to a report by Eric Jones
3445 when readline is active. Thanks to a report by Eric Jones
3440 <eric-AT-enthought.com>.
3446 <eric-AT-enthought.com>.
3441
3447
3442 2004-11-07 Fernando Perez <fperez@colorado.edu>
3448 2004-11-07 Fernando Perez <fperez@colorado.edu>
3443
3449
3444 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3450 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3445 sometimes seen by win2k/cygwin users.
3451 sometimes seen by win2k/cygwin users.
3446
3452
3447 2004-11-06 Fernando Perez <fperez@colorado.edu>
3453 2004-11-06 Fernando Perez <fperez@colorado.edu>
3448
3454
3449 * IPython/iplib.py (interact): Change the handling of %Exit from
3455 * IPython/iplib.py (interact): Change the handling of %Exit from
3450 trying to propagate a SystemExit to an internal ipython flag.
3456 trying to propagate a SystemExit to an internal ipython flag.
3451 This is less elegant than using Python's exception mechanism, but
3457 This is less elegant than using Python's exception mechanism, but
3452 I can't get that to work reliably with threads, so under -pylab
3458 I can't get that to work reliably with threads, so under -pylab
3453 %Exit was hanging IPython. Cross-thread exception handling is
3459 %Exit was hanging IPython. Cross-thread exception handling is
3454 really a bitch. Thaks to a bug report by Stephen Walton
3460 really a bitch. Thaks to a bug report by Stephen Walton
3455 <stephen.walton-AT-csun.edu>.
3461 <stephen.walton-AT-csun.edu>.
3456
3462
3457 2004-11-04 Fernando Perez <fperez@colorado.edu>
3463 2004-11-04 Fernando Perez <fperez@colorado.edu>
3458
3464
3459 * IPython/iplib.py (raw_input_original): store a pointer to the
3465 * IPython/iplib.py (raw_input_original): store a pointer to the
3460 true raw_input to harden against code which can modify it
3466 true raw_input to harden against code which can modify it
3461 (wx.py.PyShell does this and would otherwise crash ipython).
3467 (wx.py.PyShell does this and would otherwise crash ipython).
3462 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3468 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3463
3469
3464 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3470 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3465 Ctrl-C problem, which does not mess up the input line.
3471 Ctrl-C problem, which does not mess up the input line.
3466
3472
3467 2004-11-03 Fernando Perez <fperez@colorado.edu>
3473 2004-11-03 Fernando Perez <fperez@colorado.edu>
3468
3474
3469 * IPython/Release.py: Changed licensing to BSD, in all files.
3475 * IPython/Release.py: Changed licensing to BSD, in all files.
3470 (name): lowercase name for tarball/RPM release.
3476 (name): lowercase name for tarball/RPM release.
3471
3477
3472 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3478 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3473 use throughout ipython.
3479 use throughout ipython.
3474
3480
3475 * IPython/Magic.py (Magic._ofind): Switch to using the new
3481 * IPython/Magic.py (Magic._ofind): Switch to using the new
3476 OInspect.getdoc() function.
3482 OInspect.getdoc() function.
3477
3483
3478 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3484 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3479 of the line currently being canceled via Ctrl-C. It's extremely
3485 of the line currently being canceled via Ctrl-C. It's extremely
3480 ugly, but I don't know how to do it better (the problem is one of
3486 ugly, but I don't know how to do it better (the problem is one of
3481 handling cross-thread exceptions).
3487 handling cross-thread exceptions).
3482
3488
3483 2004-10-28 Fernando Perez <fperez@colorado.edu>
3489 2004-10-28 Fernando Perez <fperez@colorado.edu>
3484
3490
3485 * IPython/Shell.py (signal_handler): add signal handlers to trap
3491 * IPython/Shell.py (signal_handler): add signal handlers to trap
3486 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3492 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3487 report by Francesc Alted.
3493 report by Francesc Alted.
3488
3494
3489 2004-10-21 Fernando Perez <fperez@colorado.edu>
3495 2004-10-21 Fernando Perez <fperez@colorado.edu>
3490
3496
3491 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3497 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3492 to % for pysh syntax extensions.
3498 to % for pysh syntax extensions.
3493
3499
3494 2004-10-09 Fernando Perez <fperez@colorado.edu>
3500 2004-10-09 Fernando Perez <fperez@colorado.edu>
3495
3501
3496 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3502 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3497 arrays to print a more useful summary, without calling str(arr).
3503 arrays to print a more useful summary, without calling str(arr).
3498 This avoids the problem of extremely lengthy computations which
3504 This avoids the problem of extremely lengthy computations which
3499 occur if arr is large, and appear to the user as a system lockup
3505 occur if arr is large, and appear to the user as a system lockup
3500 with 100% cpu activity. After a suggestion by Kristian Sandberg
3506 with 100% cpu activity. After a suggestion by Kristian Sandberg
3501 <Kristian.Sandberg@colorado.edu>.
3507 <Kristian.Sandberg@colorado.edu>.
3502 (Magic.__init__): fix bug in global magic escapes not being
3508 (Magic.__init__): fix bug in global magic escapes not being
3503 correctly set.
3509 correctly set.
3504
3510
3505 2004-10-08 Fernando Perez <fperez@colorado.edu>
3511 2004-10-08 Fernando Perez <fperez@colorado.edu>
3506
3512
3507 * IPython/Magic.py (__license__): change to absolute imports of
3513 * IPython/Magic.py (__license__): change to absolute imports of
3508 ipython's own internal packages, to start adapting to the absolute
3514 ipython's own internal packages, to start adapting to the absolute
3509 import requirement of PEP-328.
3515 import requirement of PEP-328.
3510
3516
3511 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3517 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3512 files, and standardize author/license marks through the Release
3518 files, and standardize author/license marks through the Release
3513 module instead of having per/file stuff (except for files with
3519 module instead of having per/file stuff (except for files with
3514 particular licenses, like the MIT/PSF-licensed codes).
3520 particular licenses, like the MIT/PSF-licensed codes).
3515
3521
3516 * IPython/Debugger.py: remove dead code for python 2.1
3522 * IPython/Debugger.py: remove dead code for python 2.1
3517
3523
3518 2004-10-04 Fernando Perez <fperez@colorado.edu>
3524 2004-10-04 Fernando Perez <fperez@colorado.edu>
3519
3525
3520 * IPython/iplib.py (ipmagic): New function for accessing magics
3526 * IPython/iplib.py (ipmagic): New function for accessing magics
3521 via a normal python function call.
3527 via a normal python function call.
3522
3528
3523 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3529 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3524 from '@' to '%', to accomodate the new @decorator syntax of python
3530 from '@' to '%', to accomodate the new @decorator syntax of python
3525 2.4.
3531 2.4.
3526
3532
3527 2004-09-29 Fernando Perez <fperez@colorado.edu>
3533 2004-09-29 Fernando Perez <fperez@colorado.edu>
3528
3534
3529 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3535 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3530 matplotlib.use to prevent running scripts which try to switch
3536 matplotlib.use to prevent running scripts which try to switch
3531 interactive backends from within ipython. This will just crash
3537 interactive backends from within ipython. This will just crash
3532 the python interpreter, so we can't allow it (but a detailed error
3538 the python interpreter, so we can't allow it (but a detailed error
3533 is given to the user).
3539 is given to the user).
3534
3540
3535 2004-09-28 Fernando Perez <fperez@colorado.edu>
3541 2004-09-28 Fernando Perez <fperez@colorado.edu>
3536
3542
3537 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3543 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3538 matplotlib-related fixes so that using @run with non-matplotlib
3544 matplotlib-related fixes so that using @run with non-matplotlib
3539 scripts doesn't pop up spurious plot windows. This requires
3545 scripts doesn't pop up spurious plot windows. This requires
3540 matplotlib >= 0.63, where I had to make some changes as well.
3546 matplotlib >= 0.63, where I had to make some changes as well.
3541
3547
3542 * IPython/ipmaker.py (make_IPython): update version requirement to
3548 * IPython/ipmaker.py (make_IPython): update version requirement to
3543 python 2.2.
3549 python 2.2.
3544
3550
3545 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3551 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3546 banner arg for embedded customization.
3552 banner arg for embedded customization.
3547
3553
3548 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3554 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3549 explicit uses of __IP as the IPython's instance name. Now things
3555 explicit uses of __IP as the IPython's instance name. Now things
3550 are properly handled via the shell.name value. The actual code
3556 are properly handled via the shell.name value. The actual code
3551 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3557 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3552 is much better than before. I'll clean things completely when the
3558 is much better than before. I'll clean things completely when the
3553 magic stuff gets a real overhaul.
3559 magic stuff gets a real overhaul.
3554
3560
3555 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3561 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3556 minor changes to debian dir.
3562 minor changes to debian dir.
3557
3563
3558 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3564 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3559 pointer to the shell itself in the interactive namespace even when
3565 pointer to the shell itself in the interactive namespace even when
3560 a user-supplied dict is provided. This is needed for embedding
3566 a user-supplied dict is provided. This is needed for embedding
3561 purposes (found by tests with Michel Sanner).
3567 purposes (found by tests with Michel Sanner).
3562
3568
3563 2004-09-27 Fernando Perez <fperez@colorado.edu>
3569 2004-09-27 Fernando Perez <fperez@colorado.edu>
3564
3570
3565 * IPython/UserConfig/ipythonrc: remove []{} from
3571 * IPython/UserConfig/ipythonrc: remove []{} from
3566 readline_remove_delims, so that things like [modname.<TAB> do
3572 readline_remove_delims, so that things like [modname.<TAB> do
3567 proper completion. This disables [].TAB, but that's a less common
3573 proper completion. This disables [].TAB, but that's a less common
3568 case than module names in list comprehensions, for example.
3574 case than module names in list comprehensions, for example.
3569 Thanks to a report by Andrea Riciputi.
3575 Thanks to a report by Andrea Riciputi.
3570
3576
3571 2004-09-09 Fernando Perez <fperez@colorado.edu>
3577 2004-09-09 Fernando Perez <fperez@colorado.edu>
3572
3578
3573 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3579 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3574 blocking problems in win32 and osx. Fix by John.
3580 blocking problems in win32 and osx. Fix by John.
3575
3581
3576 2004-09-08 Fernando Perez <fperez@colorado.edu>
3582 2004-09-08 Fernando Perez <fperez@colorado.edu>
3577
3583
3578 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3584 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3579 for Win32 and OSX. Fix by John Hunter.
3585 for Win32 and OSX. Fix by John Hunter.
3580
3586
3581 2004-08-30 *** Released version 0.6.3
3587 2004-08-30 *** Released version 0.6.3
3582
3588
3583 2004-08-30 Fernando Perez <fperez@colorado.edu>
3589 2004-08-30 Fernando Perez <fperez@colorado.edu>
3584
3590
3585 * setup.py (isfile): Add manpages to list of dependent files to be
3591 * setup.py (isfile): Add manpages to list of dependent files to be
3586 updated.
3592 updated.
3587
3593
3588 2004-08-27 Fernando Perez <fperez@colorado.edu>
3594 2004-08-27 Fernando Perez <fperez@colorado.edu>
3589
3595
3590 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3596 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3591 for now. They don't really work with standalone WX/GTK code
3597 for now. They don't really work with standalone WX/GTK code
3592 (though matplotlib IS working fine with both of those backends).
3598 (though matplotlib IS working fine with both of those backends).
3593 This will neeed much more testing. I disabled most things with
3599 This will neeed much more testing. I disabled most things with
3594 comments, so turning it back on later should be pretty easy.
3600 comments, so turning it back on later should be pretty easy.
3595
3601
3596 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3602 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3597 autocalling of expressions like r'foo', by modifying the line
3603 autocalling of expressions like r'foo', by modifying the line
3598 split regexp. Closes
3604 split regexp. Closes
3599 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3605 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3600 Riley <ipythonbugs-AT-sabi.net>.
3606 Riley <ipythonbugs-AT-sabi.net>.
3601 (InteractiveShell.mainloop): honor --nobanner with banner
3607 (InteractiveShell.mainloop): honor --nobanner with banner
3602 extensions.
3608 extensions.
3603
3609
3604 * IPython/Shell.py: Significant refactoring of all classes, so
3610 * IPython/Shell.py: Significant refactoring of all classes, so
3605 that we can really support ALL matplotlib backends and threading
3611 that we can really support ALL matplotlib backends and threading
3606 models (John spotted a bug with Tk which required this). Now we
3612 models (John spotted a bug with Tk which required this). Now we
3607 should support single-threaded, WX-threads and GTK-threads, both
3613 should support single-threaded, WX-threads and GTK-threads, both
3608 for generic code and for matplotlib.
3614 for generic code and for matplotlib.
3609
3615
3610 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3616 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3611 -pylab, to simplify things for users. Will also remove the pylab
3617 -pylab, to simplify things for users. Will also remove the pylab
3612 profile, since now all of matplotlib configuration is directly
3618 profile, since now all of matplotlib configuration is directly
3613 handled here. This also reduces startup time.
3619 handled here. This also reduces startup time.
3614
3620
3615 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3621 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3616 shell wasn't being correctly called. Also in IPShellWX.
3622 shell wasn't being correctly called. Also in IPShellWX.
3617
3623
3618 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3624 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3619 fine-tune banner.
3625 fine-tune banner.
3620
3626
3621 * IPython/numutils.py (spike): Deprecate these spike functions,
3627 * IPython/numutils.py (spike): Deprecate these spike functions,
3622 delete (long deprecated) gnuplot_exec handler.
3628 delete (long deprecated) gnuplot_exec handler.
3623
3629
3624 2004-08-26 Fernando Perez <fperez@colorado.edu>
3630 2004-08-26 Fernando Perez <fperez@colorado.edu>
3625
3631
3626 * ipython.1: Update for threading options, plus some others which
3632 * ipython.1: Update for threading options, plus some others which
3627 were missing.
3633 were missing.
3628
3634
3629 * IPython/ipmaker.py (__call__): Added -wthread option for
3635 * IPython/ipmaker.py (__call__): Added -wthread option for
3630 wxpython thread handling. Make sure threading options are only
3636 wxpython thread handling. Make sure threading options are only
3631 valid at the command line.
3637 valid at the command line.
3632
3638
3633 * scripts/ipython: moved shell selection into a factory function
3639 * scripts/ipython: moved shell selection into a factory function
3634 in Shell.py, to keep the starter script to a minimum.
3640 in Shell.py, to keep the starter script to a minimum.
3635
3641
3636 2004-08-25 Fernando Perez <fperez@colorado.edu>
3642 2004-08-25 Fernando Perez <fperez@colorado.edu>
3637
3643
3638 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3644 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3639 John. Along with some recent changes he made to matplotlib, the
3645 John. Along with some recent changes he made to matplotlib, the
3640 next versions of both systems should work very well together.
3646 next versions of both systems should work very well together.
3641
3647
3642 2004-08-24 Fernando Perez <fperez@colorado.edu>
3648 2004-08-24 Fernando Perez <fperez@colorado.edu>
3643
3649
3644 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3650 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3645 tried to switch the profiling to using hotshot, but I'm getting
3651 tried to switch the profiling to using hotshot, but I'm getting
3646 strange errors from prof.runctx() there. I may be misreading the
3652 strange errors from prof.runctx() there. I may be misreading the
3647 docs, but it looks weird. For now the profiling code will
3653 docs, but it looks weird. For now the profiling code will
3648 continue to use the standard profiler.
3654 continue to use the standard profiler.
3649
3655
3650 2004-08-23 Fernando Perez <fperez@colorado.edu>
3656 2004-08-23 Fernando Perez <fperez@colorado.edu>
3651
3657
3652 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3658 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3653 threaded shell, by John Hunter. It's not quite ready yet, but
3659 threaded shell, by John Hunter. It's not quite ready yet, but
3654 close.
3660 close.
3655
3661
3656 2004-08-22 Fernando Perez <fperez@colorado.edu>
3662 2004-08-22 Fernando Perez <fperez@colorado.edu>
3657
3663
3658 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3664 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3659 in Magic and ultraTB.
3665 in Magic and ultraTB.
3660
3666
3661 * ipython.1: document threading options in manpage.
3667 * ipython.1: document threading options in manpage.
3662
3668
3663 * scripts/ipython: Changed name of -thread option to -gthread,
3669 * scripts/ipython: Changed name of -thread option to -gthread,
3664 since this is GTK specific. I want to leave the door open for a
3670 since this is GTK specific. I want to leave the door open for a
3665 -wthread option for WX, which will most likely be necessary. This
3671 -wthread option for WX, which will most likely be necessary. This
3666 change affects usage and ipmaker as well.
3672 change affects usage and ipmaker as well.
3667
3673
3668 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3674 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3669 handle the matplotlib shell issues. Code by John Hunter
3675 handle the matplotlib shell issues. Code by John Hunter
3670 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3676 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3671 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3677 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3672 broken (and disabled for end users) for now, but it puts the
3678 broken (and disabled for end users) for now, but it puts the
3673 infrastructure in place.
3679 infrastructure in place.
3674
3680
3675 2004-08-21 Fernando Perez <fperez@colorado.edu>
3681 2004-08-21 Fernando Perez <fperez@colorado.edu>
3676
3682
3677 * ipythonrc-pylab: Add matplotlib support.
3683 * ipythonrc-pylab: Add matplotlib support.
3678
3684
3679 * matplotlib_config.py: new files for matplotlib support, part of
3685 * matplotlib_config.py: new files for matplotlib support, part of
3680 the pylab profile.
3686 the pylab profile.
3681
3687
3682 * IPython/usage.py (__doc__): documented the threading options.
3688 * IPython/usage.py (__doc__): documented the threading options.
3683
3689
3684 2004-08-20 Fernando Perez <fperez@colorado.edu>
3690 2004-08-20 Fernando Perez <fperez@colorado.edu>
3685
3691
3686 * ipython: Modified the main calling routine to handle the -thread
3692 * ipython: Modified the main calling routine to handle the -thread
3687 and -mpthread options. This needs to be done as a top-level hack,
3693 and -mpthread options. This needs to be done as a top-level hack,
3688 because it determines which class to instantiate for IPython
3694 because it determines which class to instantiate for IPython
3689 itself.
3695 itself.
3690
3696
3691 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3697 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3692 classes to support multithreaded GTK operation without blocking,
3698 classes to support multithreaded GTK operation without blocking,
3693 and matplotlib with all backends. This is a lot of still very
3699 and matplotlib with all backends. This is a lot of still very
3694 experimental code, and threads are tricky. So it may still have a
3700 experimental code, and threads are tricky. So it may still have a
3695 few rough edges... This code owes a lot to
3701 few rough edges... This code owes a lot to
3696 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3702 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3697 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3703 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3698 to John Hunter for all the matplotlib work.
3704 to John Hunter for all the matplotlib work.
3699
3705
3700 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3706 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3701 options for gtk thread and matplotlib support.
3707 options for gtk thread and matplotlib support.
3702
3708
3703 2004-08-16 Fernando Perez <fperez@colorado.edu>
3709 2004-08-16 Fernando Perez <fperez@colorado.edu>
3704
3710
3705 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3711 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3706 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3712 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3707 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3713 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3708
3714
3709 2004-08-11 Fernando Perez <fperez@colorado.edu>
3715 2004-08-11 Fernando Perez <fperez@colorado.edu>
3710
3716
3711 * setup.py (isfile): Fix build so documentation gets updated for
3717 * setup.py (isfile): Fix build so documentation gets updated for
3712 rpms (it was only done for .tgz builds).
3718 rpms (it was only done for .tgz builds).
3713
3719
3714 2004-08-10 Fernando Perez <fperez@colorado.edu>
3720 2004-08-10 Fernando Perez <fperez@colorado.edu>
3715
3721
3716 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3722 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3717
3723
3718 * iplib.py : Silence syntax error exceptions in tab-completion.
3724 * iplib.py : Silence syntax error exceptions in tab-completion.
3719
3725
3720 2004-08-05 Fernando Perez <fperez@colorado.edu>
3726 2004-08-05 Fernando Perez <fperez@colorado.edu>
3721
3727
3722 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3728 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3723 'color off' mark for continuation prompts. This was causing long
3729 'color off' mark for continuation prompts. This was causing long
3724 continuation lines to mis-wrap.
3730 continuation lines to mis-wrap.
3725
3731
3726 2004-08-01 Fernando Perez <fperez@colorado.edu>
3732 2004-08-01 Fernando Perez <fperez@colorado.edu>
3727
3733
3728 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3734 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3729 for building ipython to be a parameter. All this is necessary
3735 for building ipython to be a parameter. All this is necessary
3730 right now to have a multithreaded version, but this insane
3736 right now to have a multithreaded version, but this insane
3731 non-design will be cleaned up soon. For now, it's a hack that
3737 non-design will be cleaned up soon. For now, it's a hack that
3732 works.
3738 works.
3733
3739
3734 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3740 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3735 args in various places. No bugs so far, but it's a dangerous
3741 args in various places. No bugs so far, but it's a dangerous
3736 practice.
3742 practice.
3737
3743
3738 2004-07-31 Fernando Perez <fperez@colorado.edu>
3744 2004-07-31 Fernando Perez <fperez@colorado.edu>
3739
3745
3740 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3746 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3741 fix completion of files with dots in their names under most
3747 fix completion of files with dots in their names under most
3742 profiles (pysh was OK because the completion order is different).
3748 profiles (pysh was OK because the completion order is different).
3743
3749
3744 2004-07-27 Fernando Perez <fperez@colorado.edu>
3750 2004-07-27 Fernando Perez <fperez@colorado.edu>
3745
3751
3746 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3752 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3747 keywords manually, b/c the one in keyword.py was removed in python
3753 keywords manually, b/c the one in keyword.py was removed in python
3748 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3754 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3749 This is NOT a bug under python 2.3 and earlier.
3755 This is NOT a bug under python 2.3 and earlier.
3750
3756
3751 2004-07-26 Fernando Perez <fperez@colorado.edu>
3757 2004-07-26 Fernando Perez <fperez@colorado.edu>
3752
3758
3753 * IPython/ultraTB.py (VerboseTB.text): Add another
3759 * IPython/ultraTB.py (VerboseTB.text): Add another
3754 linecache.checkcache() call to try to prevent inspect.py from
3760 linecache.checkcache() call to try to prevent inspect.py from
3755 crashing under python 2.3. I think this fixes
3761 crashing under python 2.3. I think this fixes
3756 http://www.scipy.net/roundup/ipython/issue17.
3762 http://www.scipy.net/roundup/ipython/issue17.
3757
3763
3758 2004-07-26 *** Released version 0.6.2
3764 2004-07-26 *** Released version 0.6.2
3759
3765
3760 2004-07-26 Fernando Perez <fperez@colorado.edu>
3766 2004-07-26 Fernando Perez <fperez@colorado.edu>
3761
3767
3762 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3768 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3763 fail for any number.
3769 fail for any number.
3764 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3770 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3765 empty bookmarks.
3771 empty bookmarks.
3766
3772
3767 2004-07-26 *** Released version 0.6.1
3773 2004-07-26 *** Released version 0.6.1
3768
3774
3769 2004-07-26 Fernando Perez <fperez@colorado.edu>
3775 2004-07-26 Fernando Perez <fperez@colorado.edu>
3770
3776
3771 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3777 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3772
3778
3773 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3779 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3774 escaping '()[]{}' in filenames.
3780 escaping '()[]{}' in filenames.
3775
3781
3776 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3782 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3777 Python 2.2 users who lack a proper shlex.split.
3783 Python 2.2 users who lack a proper shlex.split.
3778
3784
3779 2004-07-19 Fernando Perez <fperez@colorado.edu>
3785 2004-07-19 Fernando Perez <fperez@colorado.edu>
3780
3786
3781 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3787 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3782 for reading readline's init file. I follow the normal chain:
3788 for reading readline's init file. I follow the normal chain:
3783 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3789 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3784 report by Mike Heeter. This closes
3790 report by Mike Heeter. This closes
3785 http://www.scipy.net/roundup/ipython/issue16.
3791 http://www.scipy.net/roundup/ipython/issue16.
3786
3792
3787 2004-07-18 Fernando Perez <fperez@colorado.edu>
3793 2004-07-18 Fernando Perez <fperez@colorado.edu>
3788
3794
3789 * IPython/iplib.py (__init__): Add better handling of '\' under
3795 * IPython/iplib.py (__init__): Add better handling of '\' under
3790 Win32 for filenames. After a patch by Ville.
3796 Win32 for filenames. After a patch by Ville.
3791
3797
3792 2004-07-17 Fernando Perez <fperez@colorado.edu>
3798 2004-07-17 Fernando Perez <fperez@colorado.edu>
3793
3799
3794 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3800 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3795 autocalling would be triggered for 'foo is bar' if foo is
3801 autocalling would be triggered for 'foo is bar' if foo is
3796 callable. I also cleaned up the autocall detection code to use a
3802 callable. I also cleaned up the autocall detection code to use a
3797 regexp, which is faster. Bug reported by Alexander Schmolck.
3803 regexp, which is faster. Bug reported by Alexander Schmolck.
3798
3804
3799 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3805 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3800 '?' in them would confuse the help system. Reported by Alex
3806 '?' in them would confuse the help system. Reported by Alex
3801 Schmolck.
3807 Schmolck.
3802
3808
3803 2004-07-16 Fernando Perez <fperez@colorado.edu>
3809 2004-07-16 Fernando Perez <fperez@colorado.edu>
3804
3810
3805 * IPython/GnuplotInteractive.py (__all__): added plot2.
3811 * IPython/GnuplotInteractive.py (__all__): added plot2.
3806
3812
3807 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3813 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3808 plotting dictionaries, lists or tuples of 1d arrays.
3814 plotting dictionaries, lists or tuples of 1d arrays.
3809
3815
3810 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3816 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3811 optimizations.
3817 optimizations.
3812
3818
3813 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3819 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3814 the information which was there from Janko's original IPP code:
3820 the information which was there from Janko's original IPP code:
3815
3821
3816 03.05.99 20:53 porto.ifm.uni-kiel.de
3822 03.05.99 20:53 porto.ifm.uni-kiel.de
3817 --Started changelog.
3823 --Started changelog.
3818 --make clear do what it say it does
3824 --make clear do what it say it does
3819 --added pretty output of lines from inputcache
3825 --added pretty output of lines from inputcache
3820 --Made Logger a mixin class, simplifies handling of switches
3826 --Made Logger a mixin class, simplifies handling of switches
3821 --Added own completer class. .string<TAB> expands to last history
3827 --Added own completer class. .string<TAB> expands to last history
3822 line which starts with string. The new expansion is also present
3828 line which starts with string. The new expansion is also present
3823 with Ctrl-r from the readline library. But this shows, who this
3829 with Ctrl-r from the readline library. But this shows, who this
3824 can be done for other cases.
3830 can be done for other cases.
3825 --Added convention that all shell functions should accept a
3831 --Added convention that all shell functions should accept a
3826 parameter_string This opens the door for different behaviour for
3832 parameter_string This opens the door for different behaviour for
3827 each function. @cd is a good example of this.
3833 each function. @cd is a good example of this.
3828
3834
3829 04.05.99 12:12 porto.ifm.uni-kiel.de
3835 04.05.99 12:12 porto.ifm.uni-kiel.de
3830 --added logfile rotation
3836 --added logfile rotation
3831 --added new mainloop method which freezes first the namespace
3837 --added new mainloop method which freezes first the namespace
3832
3838
3833 07.05.99 21:24 porto.ifm.uni-kiel.de
3839 07.05.99 21:24 porto.ifm.uni-kiel.de
3834 --added the docreader classes. Now there is a help system.
3840 --added the docreader classes. Now there is a help system.
3835 -This is only a first try. Currently it's not easy to put new
3841 -This is only a first try. Currently it's not easy to put new
3836 stuff in the indices. But this is the way to go. Info would be
3842 stuff in the indices. But this is the way to go. Info would be
3837 better, but HTML is every where and not everybody has an info
3843 better, but HTML is every where and not everybody has an info
3838 system installed and it's not so easy to change html-docs to info.
3844 system installed and it's not so easy to change html-docs to info.
3839 --added global logfile option
3845 --added global logfile option
3840 --there is now a hook for object inspection method pinfo needs to
3846 --there is now a hook for object inspection method pinfo needs to
3841 be provided for this. Can be reached by two '??'.
3847 be provided for this. Can be reached by two '??'.
3842
3848
3843 08.05.99 20:51 porto.ifm.uni-kiel.de
3849 08.05.99 20:51 porto.ifm.uni-kiel.de
3844 --added a README
3850 --added a README
3845 --bug in rc file. Something has changed so functions in the rc
3851 --bug in rc file. Something has changed so functions in the rc
3846 file need to reference the shell and not self. Not clear if it's a
3852 file need to reference the shell and not self. Not clear if it's a
3847 bug or feature.
3853 bug or feature.
3848 --changed rc file for new behavior
3854 --changed rc file for new behavior
3849
3855
3850 2004-07-15 Fernando Perez <fperez@colorado.edu>
3856 2004-07-15 Fernando Perez <fperez@colorado.edu>
3851
3857
3852 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3858 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3853 cache was falling out of sync in bizarre manners when multi-line
3859 cache was falling out of sync in bizarre manners when multi-line
3854 input was present. Minor optimizations and cleanup.
3860 input was present. Minor optimizations and cleanup.
3855
3861
3856 (Logger): Remove old Changelog info for cleanup. This is the
3862 (Logger): Remove old Changelog info for cleanup. This is the
3857 information which was there from Janko's original code:
3863 information which was there from Janko's original code:
3858
3864
3859 Changes to Logger: - made the default log filename a parameter
3865 Changes to Logger: - made the default log filename a parameter
3860
3866
3861 - put a check for lines beginning with !@? in log(). Needed
3867 - put a check for lines beginning with !@? in log(). Needed
3862 (even if the handlers properly log their lines) for mid-session
3868 (even if the handlers properly log their lines) for mid-session
3863 logging activation to work properly. Without this, lines logged
3869 logging activation to work properly. Without this, lines logged
3864 in mid session, which get read from the cache, would end up
3870 in mid session, which get read from the cache, would end up
3865 'bare' (with !@? in the open) in the log. Now they are caught
3871 'bare' (with !@? in the open) in the log. Now they are caught
3866 and prepended with a #.
3872 and prepended with a #.
3867
3873
3868 * IPython/iplib.py (InteractiveShell.init_readline): added check
3874 * IPython/iplib.py (InteractiveShell.init_readline): added check
3869 in case MagicCompleter fails to be defined, so we don't crash.
3875 in case MagicCompleter fails to be defined, so we don't crash.
3870
3876
3871 2004-07-13 Fernando Perez <fperez@colorado.edu>
3877 2004-07-13 Fernando Perez <fperez@colorado.edu>
3872
3878
3873 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3879 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3874 of EPS if the requested filename ends in '.eps'.
3880 of EPS if the requested filename ends in '.eps'.
3875
3881
3876 2004-07-04 Fernando Perez <fperez@colorado.edu>
3882 2004-07-04 Fernando Perez <fperez@colorado.edu>
3877
3883
3878 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3884 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3879 escaping of quotes when calling the shell.
3885 escaping of quotes when calling the shell.
3880
3886
3881 2004-07-02 Fernando Perez <fperez@colorado.edu>
3887 2004-07-02 Fernando Perez <fperez@colorado.edu>
3882
3888
3883 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3889 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3884 gettext not working because we were clobbering '_'. Fixes
3890 gettext not working because we were clobbering '_'. Fixes
3885 http://www.scipy.net/roundup/ipython/issue6.
3891 http://www.scipy.net/roundup/ipython/issue6.
3886
3892
3887 2004-07-01 Fernando Perez <fperez@colorado.edu>
3893 2004-07-01 Fernando Perez <fperez@colorado.edu>
3888
3894
3889 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3895 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3890 into @cd. Patch by Ville.
3896 into @cd. Patch by Ville.
3891
3897
3892 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3898 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3893 new function to store things after ipmaker runs. Patch by Ville.
3899 new function to store things after ipmaker runs. Patch by Ville.
3894 Eventually this will go away once ipmaker is removed and the class
3900 Eventually this will go away once ipmaker is removed and the class
3895 gets cleaned up, but for now it's ok. Key functionality here is
3901 gets cleaned up, but for now it's ok. Key functionality here is
3896 the addition of the persistent storage mechanism, a dict for
3902 the addition of the persistent storage mechanism, a dict for
3897 keeping data across sessions (for now just bookmarks, but more can
3903 keeping data across sessions (for now just bookmarks, but more can
3898 be implemented later).
3904 be implemented later).
3899
3905
3900 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3906 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3901 persistent across sections. Patch by Ville, I modified it
3907 persistent across sections. Patch by Ville, I modified it
3902 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3908 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3903 added a '-l' option to list all bookmarks.
3909 added a '-l' option to list all bookmarks.
3904
3910
3905 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3911 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3906 center for cleanup. Registered with atexit.register(). I moved
3912 center for cleanup. Registered with atexit.register(). I moved
3907 here the old exit_cleanup(). After a patch by Ville.
3913 here the old exit_cleanup(). After a patch by Ville.
3908
3914
3909 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3915 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3910 characters in the hacked shlex_split for python 2.2.
3916 characters in the hacked shlex_split for python 2.2.
3911
3917
3912 * IPython/iplib.py (file_matches): more fixes to filenames with
3918 * IPython/iplib.py (file_matches): more fixes to filenames with
3913 whitespace in them. It's not perfect, but limitations in python's
3919 whitespace in them. It's not perfect, but limitations in python's
3914 readline make it impossible to go further.
3920 readline make it impossible to go further.
3915
3921
3916 2004-06-29 Fernando Perez <fperez@colorado.edu>
3922 2004-06-29 Fernando Perez <fperez@colorado.edu>
3917
3923
3918 * IPython/iplib.py (file_matches): escape whitespace correctly in
3924 * IPython/iplib.py (file_matches): escape whitespace correctly in
3919 filename completions. Bug reported by Ville.
3925 filename completions. Bug reported by Ville.
3920
3926
3921 2004-06-28 Fernando Perez <fperez@colorado.edu>
3927 2004-06-28 Fernando Perez <fperez@colorado.edu>
3922
3928
3923 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3929 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3924 the history file will be called 'history-PROFNAME' (or just
3930 the history file will be called 'history-PROFNAME' (or just
3925 'history' if no profile is loaded). I was getting annoyed at
3931 'history' if no profile is loaded). I was getting annoyed at
3926 getting my Numerical work history clobbered by pysh sessions.
3932 getting my Numerical work history clobbered by pysh sessions.
3927
3933
3928 * IPython/iplib.py (InteractiveShell.__init__): Internal
3934 * IPython/iplib.py (InteractiveShell.__init__): Internal
3929 getoutputerror() function so that we can honor the system_verbose
3935 getoutputerror() function so that we can honor the system_verbose
3930 flag for _all_ system calls. I also added escaping of #
3936 flag for _all_ system calls. I also added escaping of #
3931 characters here to avoid confusing Itpl.
3937 characters here to avoid confusing Itpl.
3932
3938
3933 * IPython/Magic.py (shlex_split): removed call to shell in
3939 * IPython/Magic.py (shlex_split): removed call to shell in
3934 parse_options and replaced it with shlex.split(). The annoying
3940 parse_options and replaced it with shlex.split(). The annoying
3935 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3941 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3936 to backport it from 2.3, with several frail hacks (the shlex
3942 to backport it from 2.3, with several frail hacks (the shlex
3937 module is rather limited in 2.2). Thanks to a suggestion by Ville
3943 module is rather limited in 2.2). Thanks to a suggestion by Ville
3938 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3944 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3939 problem.
3945 problem.
3940
3946
3941 (Magic.magic_system_verbose): new toggle to print the actual
3947 (Magic.magic_system_verbose): new toggle to print the actual
3942 system calls made by ipython. Mainly for debugging purposes.
3948 system calls made by ipython. Mainly for debugging purposes.
3943
3949
3944 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3950 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3945 doesn't support persistence. Reported (and fix suggested) by
3951 doesn't support persistence. Reported (and fix suggested) by
3946 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3952 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3947
3953
3948 2004-06-26 Fernando Perez <fperez@colorado.edu>
3954 2004-06-26 Fernando Perez <fperez@colorado.edu>
3949
3955
3950 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3956 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3951 continue prompts.
3957 continue prompts.
3952
3958
3953 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3959 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3954 function (basically a big docstring) and a few more things here to
3960 function (basically a big docstring) and a few more things here to
3955 speedup startup. pysh.py is now very lightweight. We want because
3961 speedup startup. pysh.py is now very lightweight. We want because
3956 it gets execfile'd, while InterpreterExec gets imported, so
3962 it gets execfile'd, while InterpreterExec gets imported, so
3957 byte-compilation saves time.
3963 byte-compilation saves time.
3958
3964
3959 2004-06-25 Fernando Perez <fperez@colorado.edu>
3965 2004-06-25 Fernando Perez <fperez@colorado.edu>
3960
3966
3961 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3967 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3962 -NUM', which was recently broken.
3968 -NUM', which was recently broken.
3963
3969
3964 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3970 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3965 in multi-line input (but not !!, which doesn't make sense there).
3971 in multi-line input (but not !!, which doesn't make sense there).
3966
3972
3967 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3973 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3968 It's just too useful, and people can turn it off in the less
3974 It's just too useful, and people can turn it off in the less
3969 common cases where it's a problem.
3975 common cases where it's a problem.
3970
3976
3971 2004-06-24 Fernando Perez <fperez@colorado.edu>
3977 2004-06-24 Fernando Perez <fperez@colorado.edu>
3972
3978
3973 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3979 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3974 special syntaxes (like alias calling) is now allied in multi-line
3980 special syntaxes (like alias calling) is now allied in multi-line
3975 input. This is still _very_ experimental, but it's necessary for
3981 input. This is still _very_ experimental, but it's necessary for
3976 efficient shell usage combining python looping syntax with system
3982 efficient shell usage combining python looping syntax with system
3977 calls. For now it's restricted to aliases, I don't think it
3983 calls. For now it's restricted to aliases, I don't think it
3978 really even makes sense to have this for magics.
3984 really even makes sense to have this for magics.
3979
3985
3980 2004-06-23 Fernando Perez <fperez@colorado.edu>
3986 2004-06-23 Fernando Perez <fperez@colorado.edu>
3981
3987
3982 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3988 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3983 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3989 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3984
3990
3985 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3991 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3986 extensions under Windows (after code sent by Gary Bishop). The
3992 extensions under Windows (after code sent by Gary Bishop). The
3987 extensions considered 'executable' are stored in IPython's rc
3993 extensions considered 'executable' are stored in IPython's rc
3988 structure as win_exec_ext.
3994 structure as win_exec_ext.
3989
3995
3990 * IPython/genutils.py (shell): new function, like system() but
3996 * IPython/genutils.py (shell): new function, like system() but
3991 without return value. Very useful for interactive shell work.
3997 without return value. Very useful for interactive shell work.
3992
3998
3993 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3999 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3994 delete aliases.
4000 delete aliases.
3995
4001
3996 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4002 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3997 sure that the alias table doesn't contain python keywords.
4003 sure that the alias table doesn't contain python keywords.
3998
4004
3999 2004-06-21 Fernando Perez <fperez@colorado.edu>
4005 2004-06-21 Fernando Perez <fperez@colorado.edu>
4000
4006
4001 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4007 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4002 non-existent items are found in $PATH. Reported by Thorsten.
4008 non-existent items are found in $PATH. Reported by Thorsten.
4003
4009
4004 2004-06-20 Fernando Perez <fperez@colorado.edu>
4010 2004-06-20 Fernando Perez <fperez@colorado.edu>
4005
4011
4006 * IPython/iplib.py (complete): modified the completer so that the
4012 * IPython/iplib.py (complete): modified the completer so that the
4007 order of priorities can be easily changed at runtime.
4013 order of priorities can be easily changed at runtime.
4008
4014
4009 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4015 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4010 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4016 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4011
4017
4012 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4018 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4013 expand Python variables prepended with $ in all system calls. The
4019 expand Python variables prepended with $ in all system calls. The
4014 same was done to InteractiveShell.handle_shell_escape. Now all
4020 same was done to InteractiveShell.handle_shell_escape. Now all
4015 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4021 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4016 expansion of python variables and expressions according to the
4022 expansion of python variables and expressions according to the
4017 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4023 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4018
4024
4019 Though PEP-215 has been rejected, a similar (but simpler) one
4025 Though PEP-215 has been rejected, a similar (but simpler) one
4020 seems like it will go into Python 2.4, PEP-292 -
4026 seems like it will go into Python 2.4, PEP-292 -
4021 http://www.python.org/peps/pep-0292.html.
4027 http://www.python.org/peps/pep-0292.html.
4022
4028
4023 I'll keep the full syntax of PEP-215, since IPython has since the
4029 I'll keep the full syntax of PEP-215, since IPython has since the
4024 start used Ka-Ping Yee's reference implementation discussed there
4030 start used Ka-Ping Yee's reference implementation discussed there
4025 (Itpl), and I actually like the powerful semantics it offers.
4031 (Itpl), and I actually like the powerful semantics it offers.
4026
4032
4027 In order to access normal shell variables, the $ has to be escaped
4033 In order to access normal shell variables, the $ has to be escaped
4028 via an extra $. For example:
4034 via an extra $. For example:
4029
4035
4030 In [7]: PATH='a python variable'
4036 In [7]: PATH='a python variable'
4031
4037
4032 In [8]: !echo $PATH
4038 In [8]: !echo $PATH
4033 a python variable
4039 a python variable
4034
4040
4035 In [9]: !echo $$PATH
4041 In [9]: !echo $$PATH
4036 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4042 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4037
4043
4038 (Magic.parse_options): escape $ so the shell doesn't evaluate
4044 (Magic.parse_options): escape $ so the shell doesn't evaluate
4039 things prematurely.
4045 things prematurely.
4040
4046
4041 * IPython/iplib.py (InteractiveShell.call_alias): added the
4047 * IPython/iplib.py (InteractiveShell.call_alias): added the
4042 ability for aliases to expand python variables via $.
4048 ability for aliases to expand python variables via $.
4043
4049
4044 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4050 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4045 system, now there's a @rehash/@rehashx pair of magics. These work
4051 system, now there's a @rehash/@rehashx pair of magics. These work
4046 like the csh rehash command, and can be invoked at any time. They
4052 like the csh rehash command, and can be invoked at any time. They
4047 build a table of aliases to everything in the user's $PATH
4053 build a table of aliases to everything in the user's $PATH
4048 (@rehash uses everything, @rehashx is slower but only adds
4054 (@rehash uses everything, @rehashx is slower but only adds
4049 executable files). With this, the pysh.py-based shell profile can
4055 executable files). With this, the pysh.py-based shell profile can
4050 now simply call rehash upon startup, and full access to all
4056 now simply call rehash upon startup, and full access to all
4051 programs in the user's path is obtained.
4057 programs in the user's path is obtained.
4052
4058
4053 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4059 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4054 functionality is now fully in place. I removed the old dynamic
4060 functionality is now fully in place. I removed the old dynamic
4055 code generation based approach, in favor of a much lighter one
4061 code generation based approach, in favor of a much lighter one
4056 based on a simple dict. The advantage is that this allows me to
4062 based on a simple dict. The advantage is that this allows me to
4057 now have thousands of aliases with negligible cost (unthinkable
4063 now have thousands of aliases with negligible cost (unthinkable
4058 with the old system).
4064 with the old system).
4059
4065
4060 2004-06-19 Fernando Perez <fperez@colorado.edu>
4066 2004-06-19 Fernando Perez <fperez@colorado.edu>
4061
4067
4062 * IPython/iplib.py (__init__): extended MagicCompleter class to
4068 * IPython/iplib.py (__init__): extended MagicCompleter class to
4063 also complete (last in priority) on user aliases.
4069 also complete (last in priority) on user aliases.
4064
4070
4065 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4071 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4066 call to eval.
4072 call to eval.
4067 (ItplNS.__init__): Added a new class which functions like Itpl,
4073 (ItplNS.__init__): Added a new class which functions like Itpl,
4068 but allows configuring the namespace for the evaluation to occur
4074 but allows configuring the namespace for the evaluation to occur
4069 in.
4075 in.
4070
4076
4071 2004-06-18 Fernando Perez <fperez@colorado.edu>
4077 2004-06-18 Fernando Perez <fperez@colorado.edu>
4072
4078
4073 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4079 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4074 better message when 'exit' or 'quit' are typed (a common newbie
4080 better message when 'exit' or 'quit' are typed (a common newbie
4075 confusion).
4081 confusion).
4076
4082
4077 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4083 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4078 check for Windows users.
4084 check for Windows users.
4079
4085
4080 * IPython/iplib.py (InteractiveShell.user_setup): removed
4086 * IPython/iplib.py (InteractiveShell.user_setup): removed
4081 disabling of colors for Windows. I'll test at runtime and issue a
4087 disabling of colors for Windows. I'll test at runtime and issue a
4082 warning if Gary's readline isn't found, as to nudge users to
4088 warning if Gary's readline isn't found, as to nudge users to
4083 download it.
4089 download it.
4084
4090
4085 2004-06-16 Fernando Perez <fperez@colorado.edu>
4091 2004-06-16 Fernando Perez <fperez@colorado.edu>
4086
4092
4087 * IPython/genutils.py (Stream.__init__): changed to print errors
4093 * IPython/genutils.py (Stream.__init__): changed to print errors
4088 to sys.stderr. I had a circular dependency here. Now it's
4094 to sys.stderr. I had a circular dependency here. Now it's
4089 possible to run ipython as IDLE's shell (consider this pre-alpha,
4095 possible to run ipython as IDLE's shell (consider this pre-alpha,
4090 since true stdout things end up in the starting terminal instead
4096 since true stdout things end up in the starting terminal instead
4091 of IDLE's out).
4097 of IDLE's out).
4092
4098
4093 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4099 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4094 users who haven't # updated their prompt_in2 definitions. Remove
4100 users who haven't # updated their prompt_in2 definitions. Remove
4095 eventually.
4101 eventually.
4096 (multiple_replace): added credit to original ASPN recipe.
4102 (multiple_replace): added credit to original ASPN recipe.
4097
4103
4098 2004-06-15 Fernando Perez <fperez@colorado.edu>
4104 2004-06-15 Fernando Perez <fperez@colorado.edu>
4099
4105
4100 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4106 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4101 list of auto-defined aliases.
4107 list of auto-defined aliases.
4102
4108
4103 2004-06-13 Fernando Perez <fperez@colorado.edu>
4109 2004-06-13 Fernando Perez <fperez@colorado.edu>
4104
4110
4105 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4111 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4106 install was really requested (so setup.py can be used for other
4112 install was really requested (so setup.py can be used for other
4107 things under Windows).
4113 things under Windows).
4108
4114
4109 2004-06-10 Fernando Perez <fperez@colorado.edu>
4115 2004-06-10 Fernando Perez <fperez@colorado.edu>
4110
4116
4111 * IPython/Logger.py (Logger.create_log): Manually remove any old
4117 * IPython/Logger.py (Logger.create_log): Manually remove any old
4112 backup, since os.remove may fail under Windows. Fixes bug
4118 backup, since os.remove may fail under Windows. Fixes bug
4113 reported by Thorsten.
4119 reported by Thorsten.
4114
4120
4115 2004-06-09 Fernando Perez <fperez@colorado.edu>
4121 2004-06-09 Fernando Perez <fperez@colorado.edu>
4116
4122
4117 * examples/example-embed.py: fixed all references to %n (replaced
4123 * examples/example-embed.py: fixed all references to %n (replaced
4118 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4124 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4119 for all examples and the manual as well.
4125 for all examples and the manual as well.
4120
4126
4121 2004-06-08 Fernando Perez <fperez@colorado.edu>
4127 2004-06-08 Fernando Perez <fperez@colorado.edu>
4122
4128
4123 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4129 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4124 alignment and color management. All 3 prompt subsystems now
4130 alignment and color management. All 3 prompt subsystems now
4125 inherit from BasePrompt.
4131 inherit from BasePrompt.
4126
4132
4127 * tools/release: updates for windows installer build and tag rpms
4133 * tools/release: updates for windows installer build and tag rpms
4128 with python version (since paths are fixed).
4134 with python version (since paths are fixed).
4129
4135
4130 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4136 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4131 which will become eventually obsolete. Also fixed the default
4137 which will become eventually obsolete. Also fixed the default
4132 prompt_in2 to use \D, so at least new users start with the correct
4138 prompt_in2 to use \D, so at least new users start with the correct
4133 defaults.
4139 defaults.
4134 WARNING: Users with existing ipythonrc files will need to apply
4140 WARNING: Users with existing ipythonrc files will need to apply
4135 this fix manually!
4141 this fix manually!
4136
4142
4137 * setup.py: make windows installer (.exe). This is finally the
4143 * setup.py: make windows installer (.exe). This is finally the
4138 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4144 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4139 which I hadn't included because it required Python 2.3 (or recent
4145 which I hadn't included because it required Python 2.3 (or recent
4140 distutils).
4146 distutils).
4141
4147
4142 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4148 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4143 usage of new '\D' escape.
4149 usage of new '\D' escape.
4144
4150
4145 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4151 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4146 lacks os.getuid())
4152 lacks os.getuid())
4147 (CachedOutput.set_colors): Added the ability to turn coloring
4153 (CachedOutput.set_colors): Added the ability to turn coloring
4148 on/off with @colors even for manually defined prompt colors. It
4154 on/off with @colors even for manually defined prompt colors. It
4149 uses a nasty global, but it works safely and via the generic color
4155 uses a nasty global, but it works safely and via the generic color
4150 handling mechanism.
4156 handling mechanism.
4151 (Prompt2.__init__): Introduced new escape '\D' for continuation
4157 (Prompt2.__init__): Introduced new escape '\D' for continuation
4152 prompts. It represents the counter ('\#') as dots.
4158 prompts. It represents the counter ('\#') as dots.
4153 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4159 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4154 need to update their ipythonrc files and replace '%n' with '\D' in
4160 need to update their ipythonrc files and replace '%n' with '\D' in
4155 their prompt_in2 settings everywhere. Sorry, but there's
4161 their prompt_in2 settings everywhere. Sorry, but there's
4156 otherwise no clean way to get all prompts to properly align. The
4162 otherwise no clean way to get all prompts to properly align. The
4157 ipythonrc shipped with IPython has been updated.
4163 ipythonrc shipped with IPython has been updated.
4158
4164
4159 2004-06-07 Fernando Perez <fperez@colorado.edu>
4165 2004-06-07 Fernando Perez <fperez@colorado.edu>
4160
4166
4161 * setup.py (isfile): Pass local_icons option to latex2html, so the
4167 * setup.py (isfile): Pass local_icons option to latex2html, so the
4162 resulting HTML file is self-contained. Thanks to
4168 resulting HTML file is self-contained. Thanks to
4163 dryice-AT-liu.com.cn for the tip.
4169 dryice-AT-liu.com.cn for the tip.
4164
4170
4165 * pysh.py: I created a new profile 'shell', which implements a
4171 * pysh.py: I created a new profile 'shell', which implements a
4166 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4172 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4167 system shell, nor will it become one anytime soon. It's mainly
4173 system shell, nor will it become one anytime soon. It's mainly
4168 meant to illustrate the use of the new flexible bash-like prompts.
4174 meant to illustrate the use of the new flexible bash-like prompts.
4169 I guess it could be used by hardy souls for true shell management,
4175 I guess it could be used by hardy souls for true shell management,
4170 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4176 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4171 profile. This uses the InterpreterExec extension provided by
4177 profile. This uses the InterpreterExec extension provided by
4172 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4178 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4173
4179
4174 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4180 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4175 auto-align itself with the length of the previous input prompt
4181 auto-align itself with the length of the previous input prompt
4176 (taking into account the invisible color escapes).
4182 (taking into account the invisible color escapes).
4177 (CachedOutput.__init__): Large restructuring of this class. Now
4183 (CachedOutput.__init__): Large restructuring of this class. Now
4178 all three prompts (primary1, primary2, output) are proper objects,
4184 all three prompts (primary1, primary2, output) are proper objects,
4179 managed by the 'parent' CachedOutput class. The code is still a
4185 managed by the 'parent' CachedOutput class. The code is still a
4180 bit hackish (all prompts share state via a pointer to the cache),
4186 bit hackish (all prompts share state via a pointer to the cache),
4181 but it's overall far cleaner than before.
4187 but it's overall far cleaner than before.
4182
4188
4183 * IPython/genutils.py (getoutputerror): modified to add verbose,
4189 * IPython/genutils.py (getoutputerror): modified to add verbose,
4184 debug and header options. This makes the interface of all getout*
4190 debug and header options. This makes the interface of all getout*
4185 functions uniform.
4191 functions uniform.
4186 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4192 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4187
4193
4188 * IPython/Magic.py (Magic.default_option): added a function to
4194 * IPython/Magic.py (Magic.default_option): added a function to
4189 allow registering default options for any magic command. This
4195 allow registering default options for any magic command. This
4190 makes it easy to have profiles which customize the magics globally
4196 makes it easy to have profiles which customize the magics globally
4191 for a certain use. The values set through this function are
4197 for a certain use. The values set through this function are
4192 picked up by the parse_options() method, which all magics should
4198 picked up by the parse_options() method, which all magics should
4193 use to parse their options.
4199 use to parse their options.
4194
4200
4195 * IPython/genutils.py (warn): modified the warnings framework to
4201 * IPython/genutils.py (warn): modified the warnings framework to
4196 use the Term I/O class. I'm trying to slowly unify all of
4202 use the Term I/O class. I'm trying to slowly unify all of
4197 IPython's I/O operations to pass through Term.
4203 IPython's I/O operations to pass through Term.
4198
4204
4199 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4205 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4200 the secondary prompt to correctly match the length of the primary
4206 the secondary prompt to correctly match the length of the primary
4201 one for any prompt. Now multi-line code will properly line up
4207 one for any prompt. Now multi-line code will properly line up
4202 even for path dependent prompts, such as the new ones available
4208 even for path dependent prompts, such as the new ones available
4203 via the prompt_specials.
4209 via the prompt_specials.
4204
4210
4205 2004-06-06 Fernando Perez <fperez@colorado.edu>
4211 2004-06-06 Fernando Perez <fperez@colorado.edu>
4206
4212
4207 * IPython/Prompts.py (prompt_specials): Added the ability to have
4213 * IPython/Prompts.py (prompt_specials): Added the ability to have
4208 bash-like special sequences in the prompts, which get
4214 bash-like special sequences in the prompts, which get
4209 automatically expanded. Things like hostname, current working
4215 automatically expanded. Things like hostname, current working
4210 directory and username are implemented already, but it's easy to
4216 directory and username are implemented already, but it's easy to
4211 add more in the future. Thanks to a patch by W.J. van der Laan
4217 add more in the future. Thanks to a patch by W.J. van der Laan
4212 <gnufnork-AT-hetdigitalegat.nl>
4218 <gnufnork-AT-hetdigitalegat.nl>
4213 (prompt_specials): Added color support for prompt strings, so
4219 (prompt_specials): Added color support for prompt strings, so
4214 users can define arbitrary color setups for their prompts.
4220 users can define arbitrary color setups for their prompts.
4215
4221
4216 2004-06-05 Fernando Perez <fperez@colorado.edu>
4222 2004-06-05 Fernando Perez <fperez@colorado.edu>
4217
4223
4218 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4224 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4219 code to load Gary Bishop's readline and configure it
4225 code to load Gary Bishop's readline and configure it
4220 automatically. Thanks to Gary for help on this.
4226 automatically. Thanks to Gary for help on this.
4221
4227
4222 2004-06-01 Fernando Perez <fperez@colorado.edu>
4228 2004-06-01 Fernando Perez <fperez@colorado.edu>
4223
4229
4224 * IPython/Logger.py (Logger.create_log): fix bug for logging
4230 * IPython/Logger.py (Logger.create_log): fix bug for logging
4225 with no filename (previous fix was incomplete).
4231 with no filename (previous fix was incomplete).
4226
4232
4227 2004-05-25 Fernando Perez <fperez@colorado.edu>
4233 2004-05-25 Fernando Perez <fperez@colorado.edu>
4228
4234
4229 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4235 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4230 parens would get passed to the shell.
4236 parens would get passed to the shell.
4231
4237
4232 2004-05-20 Fernando Perez <fperez@colorado.edu>
4238 2004-05-20 Fernando Perez <fperez@colorado.edu>
4233
4239
4234 * IPython/Magic.py (Magic.magic_prun): changed default profile
4240 * IPython/Magic.py (Magic.magic_prun): changed default profile
4235 sort order to 'time' (the more common profiling need).
4241 sort order to 'time' (the more common profiling need).
4236
4242
4237 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4243 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4238 so that source code shown is guaranteed in sync with the file on
4244 so that source code shown is guaranteed in sync with the file on
4239 disk (also changed in psource). Similar fix to the one for
4245 disk (also changed in psource). Similar fix to the one for
4240 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4246 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4241 <yann.ledu-AT-noos.fr>.
4247 <yann.ledu-AT-noos.fr>.
4242
4248
4243 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4249 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4244 with a single option would not be correctly parsed. Closes
4250 with a single option would not be correctly parsed. Closes
4245 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4251 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4246 introduced in 0.6.0 (on 2004-05-06).
4252 introduced in 0.6.0 (on 2004-05-06).
4247
4253
4248 2004-05-13 *** Released version 0.6.0
4254 2004-05-13 *** Released version 0.6.0
4249
4255
4250 2004-05-13 Fernando Perez <fperez@colorado.edu>
4256 2004-05-13 Fernando Perez <fperez@colorado.edu>
4251
4257
4252 * debian/: Added debian/ directory to CVS, so that debian support
4258 * debian/: Added debian/ directory to CVS, so that debian support
4253 is publicly accessible. The debian package is maintained by Jack
4259 is publicly accessible. The debian package is maintained by Jack
4254 Moffit <jack-AT-xiph.org>.
4260 Moffit <jack-AT-xiph.org>.
4255
4261
4256 * Documentation: included the notes about an ipython-based system
4262 * Documentation: included the notes about an ipython-based system
4257 shell (the hypothetical 'pysh') into the new_design.pdf document,
4263 shell (the hypothetical 'pysh') into the new_design.pdf document,
4258 so that these ideas get distributed to users along with the
4264 so that these ideas get distributed to users along with the
4259 official documentation.
4265 official documentation.
4260
4266
4261 2004-05-10 Fernando Perez <fperez@colorado.edu>
4267 2004-05-10 Fernando Perez <fperez@colorado.edu>
4262
4268
4263 * IPython/Logger.py (Logger.create_log): fix recently introduced
4269 * IPython/Logger.py (Logger.create_log): fix recently introduced
4264 bug (misindented line) where logstart would fail when not given an
4270 bug (misindented line) where logstart would fail when not given an
4265 explicit filename.
4271 explicit filename.
4266
4272
4267 2004-05-09 Fernando Perez <fperez@colorado.edu>
4273 2004-05-09 Fernando Perez <fperez@colorado.edu>
4268
4274
4269 * IPython/Magic.py (Magic.parse_options): skip system call when
4275 * IPython/Magic.py (Magic.parse_options): skip system call when
4270 there are no options to look for. Faster, cleaner for the common
4276 there are no options to look for. Faster, cleaner for the common
4271 case.
4277 case.
4272
4278
4273 * Documentation: many updates to the manual: describing Windows
4279 * Documentation: many updates to the manual: describing Windows
4274 support better, Gnuplot updates, credits, misc small stuff. Also
4280 support better, Gnuplot updates, credits, misc small stuff. Also
4275 updated the new_design doc a bit.
4281 updated the new_design doc a bit.
4276
4282
4277 2004-05-06 *** Released version 0.6.0.rc1
4283 2004-05-06 *** Released version 0.6.0.rc1
4278
4284
4279 2004-05-06 Fernando Perez <fperez@colorado.edu>
4285 2004-05-06 Fernando Perez <fperez@colorado.edu>
4280
4286
4281 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4287 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4282 operations to use the vastly more efficient list/''.join() method.
4288 operations to use the vastly more efficient list/''.join() method.
4283 (FormattedTB.text): Fix
4289 (FormattedTB.text): Fix
4284 http://www.scipy.net/roundup/ipython/issue12 - exception source
4290 http://www.scipy.net/roundup/ipython/issue12 - exception source
4285 extract not updated after reload. Thanks to Mike Salib
4291 extract not updated after reload. Thanks to Mike Salib
4286 <msalib-AT-mit.edu> for pinning the source of the problem.
4292 <msalib-AT-mit.edu> for pinning the source of the problem.
4287 Fortunately, the solution works inside ipython and doesn't require
4293 Fortunately, the solution works inside ipython and doesn't require
4288 any changes to python proper.
4294 any changes to python proper.
4289
4295
4290 * IPython/Magic.py (Magic.parse_options): Improved to process the
4296 * IPython/Magic.py (Magic.parse_options): Improved to process the
4291 argument list as a true shell would (by actually using the
4297 argument list as a true shell would (by actually using the
4292 underlying system shell). This way, all @magics automatically get
4298 underlying system shell). This way, all @magics automatically get
4293 shell expansion for variables. Thanks to a comment by Alex
4299 shell expansion for variables. Thanks to a comment by Alex
4294 Schmolck.
4300 Schmolck.
4295
4301
4296 2004-04-04 Fernando Perez <fperez@colorado.edu>
4302 2004-04-04 Fernando Perez <fperez@colorado.edu>
4297
4303
4298 * IPython/iplib.py (InteractiveShell.interact): Added a special
4304 * IPython/iplib.py (InteractiveShell.interact): Added a special
4299 trap for a debugger quit exception, which is basically impossible
4305 trap for a debugger quit exception, which is basically impossible
4300 to handle by normal mechanisms, given what pdb does to the stack.
4306 to handle by normal mechanisms, given what pdb does to the stack.
4301 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4307 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4302
4308
4303 2004-04-03 Fernando Perez <fperez@colorado.edu>
4309 2004-04-03 Fernando Perez <fperez@colorado.edu>
4304
4310
4305 * IPython/genutils.py (Term): Standardized the names of the Term
4311 * IPython/genutils.py (Term): Standardized the names of the Term
4306 class streams to cin/cout/cerr, following C++ naming conventions
4312 class streams to cin/cout/cerr, following C++ naming conventions
4307 (I can't use in/out/err because 'in' is not a valid attribute
4313 (I can't use in/out/err because 'in' is not a valid attribute
4308 name).
4314 name).
4309
4315
4310 * IPython/iplib.py (InteractiveShell.interact): don't increment
4316 * IPython/iplib.py (InteractiveShell.interact): don't increment
4311 the prompt if there's no user input. By Daniel 'Dang' Griffith
4317 the prompt if there's no user input. By Daniel 'Dang' Griffith
4312 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4318 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4313 Francois Pinard.
4319 Francois Pinard.
4314
4320
4315 2004-04-02 Fernando Perez <fperez@colorado.edu>
4321 2004-04-02 Fernando Perez <fperez@colorado.edu>
4316
4322
4317 * IPython/genutils.py (Stream.__init__): Modified to survive at
4323 * IPython/genutils.py (Stream.__init__): Modified to survive at
4318 least importing in contexts where stdin/out/err aren't true file
4324 least importing in contexts where stdin/out/err aren't true file
4319 objects, such as PyCrust (they lack fileno() and mode). However,
4325 objects, such as PyCrust (they lack fileno() and mode). However,
4320 the recovery facilities which rely on these things existing will
4326 the recovery facilities which rely on these things existing will
4321 not work.
4327 not work.
4322
4328
4323 2004-04-01 Fernando Perez <fperez@colorado.edu>
4329 2004-04-01 Fernando Perez <fperez@colorado.edu>
4324
4330
4325 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4331 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4326 use the new getoutputerror() function, so it properly
4332 use the new getoutputerror() function, so it properly
4327 distinguishes stdout/err.
4333 distinguishes stdout/err.
4328
4334
4329 * IPython/genutils.py (getoutputerror): added a function to
4335 * IPython/genutils.py (getoutputerror): added a function to
4330 capture separately the standard output and error of a command.
4336 capture separately the standard output and error of a command.
4331 After a comment from dang on the mailing lists. This code is
4337 After a comment from dang on the mailing lists. This code is
4332 basically a modified version of commands.getstatusoutput(), from
4338 basically a modified version of commands.getstatusoutput(), from
4333 the standard library.
4339 the standard library.
4334
4340
4335 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4341 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4336 '!!' as a special syntax (shorthand) to access @sx.
4342 '!!' as a special syntax (shorthand) to access @sx.
4337
4343
4338 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4344 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4339 command and return its output as a list split on '\n'.
4345 command and return its output as a list split on '\n'.
4340
4346
4341 2004-03-31 Fernando Perez <fperez@colorado.edu>
4347 2004-03-31 Fernando Perez <fperez@colorado.edu>
4342
4348
4343 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4349 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4344 method to dictionaries used as FakeModule instances if they lack
4350 method to dictionaries used as FakeModule instances if they lack
4345 it. At least pydoc in python2.3 breaks for runtime-defined
4351 it. At least pydoc in python2.3 breaks for runtime-defined
4346 functions without this hack. At some point I need to _really_
4352 functions without this hack. At some point I need to _really_
4347 understand what FakeModule is doing, because it's a gross hack.
4353 understand what FakeModule is doing, because it's a gross hack.
4348 But it solves Arnd's problem for now...
4354 But it solves Arnd's problem for now...
4349
4355
4350 2004-02-27 Fernando Perez <fperez@colorado.edu>
4356 2004-02-27 Fernando Perez <fperez@colorado.edu>
4351
4357
4352 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4358 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4353 mode would behave erratically. Also increased the number of
4359 mode would behave erratically. Also increased the number of
4354 possible logs in rotate mod to 999. Thanks to Rod Holland
4360 possible logs in rotate mod to 999. Thanks to Rod Holland
4355 <rhh@StructureLABS.com> for the report and fixes.
4361 <rhh@StructureLABS.com> for the report and fixes.
4356
4362
4357 2004-02-26 Fernando Perez <fperez@colorado.edu>
4363 2004-02-26 Fernando Perez <fperez@colorado.edu>
4358
4364
4359 * IPython/genutils.py (page): Check that the curses module really
4365 * IPython/genutils.py (page): Check that the curses module really
4360 has the initscr attribute before trying to use it. For some
4366 has the initscr attribute before trying to use it. For some
4361 reason, the Solaris curses module is missing this. I think this
4367 reason, the Solaris curses module is missing this. I think this
4362 should be considered a Solaris python bug, but I'm not sure.
4368 should be considered a Solaris python bug, but I'm not sure.
4363
4369
4364 2004-01-17 Fernando Perez <fperez@colorado.edu>
4370 2004-01-17 Fernando Perez <fperez@colorado.edu>
4365
4371
4366 * IPython/genutils.py (Stream.__init__): Changes to try to make
4372 * IPython/genutils.py (Stream.__init__): Changes to try to make
4367 ipython robust against stdin/out/err being closed by the user.
4373 ipython robust against stdin/out/err being closed by the user.
4368 This is 'user error' (and blocks a normal python session, at least
4374 This is 'user error' (and blocks a normal python session, at least
4369 the stdout case). However, Ipython should be able to survive such
4375 the stdout case). However, Ipython should be able to survive such
4370 instances of abuse as gracefully as possible. To simplify the
4376 instances of abuse as gracefully as possible. To simplify the
4371 coding and maintain compatibility with Gary Bishop's Term
4377 coding and maintain compatibility with Gary Bishop's Term
4372 contributions, I've made use of classmethods for this. I think
4378 contributions, I've made use of classmethods for this. I think
4373 this introduces a dependency on python 2.2.
4379 this introduces a dependency on python 2.2.
4374
4380
4375 2004-01-13 Fernando Perez <fperez@colorado.edu>
4381 2004-01-13 Fernando Perez <fperez@colorado.edu>
4376
4382
4377 * IPython/numutils.py (exp_safe): simplified the code a bit and
4383 * IPython/numutils.py (exp_safe): simplified the code a bit and
4378 removed the need for importing the kinds module altogether.
4384 removed the need for importing the kinds module altogether.
4379
4385
4380 2004-01-06 Fernando Perez <fperez@colorado.edu>
4386 2004-01-06 Fernando Perez <fperez@colorado.edu>
4381
4387
4382 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4388 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4383 a magic function instead, after some community feedback. No
4389 a magic function instead, after some community feedback. No
4384 special syntax will exist for it, but its name is deliberately
4390 special syntax will exist for it, but its name is deliberately
4385 very short.
4391 very short.
4386
4392
4387 2003-12-20 Fernando Perez <fperez@colorado.edu>
4393 2003-12-20 Fernando Perez <fperez@colorado.edu>
4388
4394
4389 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4395 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4390 new functionality, to automagically assign the result of a shell
4396 new functionality, to automagically assign the result of a shell
4391 command to a variable. I'll solicit some community feedback on
4397 command to a variable. I'll solicit some community feedback on
4392 this before making it permanent.
4398 this before making it permanent.
4393
4399
4394 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4400 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4395 requested about callables for which inspect couldn't obtain a
4401 requested about callables for which inspect couldn't obtain a
4396 proper argspec. Thanks to a crash report sent by Etienne
4402 proper argspec. Thanks to a crash report sent by Etienne
4397 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4403 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4398
4404
4399 2003-12-09 Fernando Perez <fperez@colorado.edu>
4405 2003-12-09 Fernando Perez <fperez@colorado.edu>
4400
4406
4401 * IPython/genutils.py (page): patch for the pager to work across
4407 * IPython/genutils.py (page): patch for the pager to work across
4402 various versions of Windows. By Gary Bishop.
4408 various versions of Windows. By Gary Bishop.
4403
4409
4404 2003-12-04 Fernando Perez <fperez@colorado.edu>
4410 2003-12-04 Fernando Perez <fperez@colorado.edu>
4405
4411
4406 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4412 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4407 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4413 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4408 While I tested this and it looks ok, there may still be corner
4414 While I tested this and it looks ok, there may still be corner
4409 cases I've missed.
4415 cases I've missed.
4410
4416
4411 2003-12-01 Fernando Perez <fperez@colorado.edu>
4417 2003-12-01 Fernando Perez <fperez@colorado.edu>
4412
4418
4413 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4419 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4414 where a line like 'p,q=1,2' would fail because the automagic
4420 where a line like 'p,q=1,2' would fail because the automagic
4415 system would be triggered for @p.
4421 system would be triggered for @p.
4416
4422
4417 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4423 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4418 cleanups, code unmodified.
4424 cleanups, code unmodified.
4419
4425
4420 * IPython/genutils.py (Term): added a class for IPython to handle
4426 * IPython/genutils.py (Term): added a class for IPython to handle
4421 output. In most cases it will just be a proxy for stdout/err, but
4427 output. In most cases it will just be a proxy for stdout/err, but
4422 having this allows modifications to be made for some platforms,
4428 having this allows modifications to be made for some platforms,
4423 such as handling color escapes under Windows. All of this code
4429 such as handling color escapes under Windows. All of this code
4424 was contributed by Gary Bishop, with minor modifications by me.
4430 was contributed by Gary Bishop, with minor modifications by me.
4425 The actual changes affect many files.
4431 The actual changes affect many files.
4426
4432
4427 2003-11-30 Fernando Perez <fperez@colorado.edu>
4433 2003-11-30 Fernando Perez <fperez@colorado.edu>
4428
4434
4429 * IPython/iplib.py (file_matches): new completion code, courtesy
4435 * IPython/iplib.py (file_matches): new completion code, courtesy
4430 of Jeff Collins. This enables filename completion again under
4436 of Jeff Collins. This enables filename completion again under
4431 python 2.3, which disabled it at the C level.
4437 python 2.3, which disabled it at the C level.
4432
4438
4433 2003-11-11 Fernando Perez <fperez@colorado.edu>
4439 2003-11-11 Fernando Perez <fperez@colorado.edu>
4434
4440
4435 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4441 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4436 for Numeric.array(map(...)), but often convenient.
4442 for Numeric.array(map(...)), but often convenient.
4437
4443
4438 2003-11-05 Fernando Perez <fperez@colorado.edu>
4444 2003-11-05 Fernando Perez <fperez@colorado.edu>
4439
4445
4440 * IPython/numutils.py (frange): Changed a call from int() to
4446 * IPython/numutils.py (frange): Changed a call from int() to
4441 int(round()) to prevent a problem reported with arange() in the
4447 int(round()) to prevent a problem reported with arange() in the
4442 numpy list.
4448 numpy list.
4443
4449
4444 2003-10-06 Fernando Perez <fperez@colorado.edu>
4450 2003-10-06 Fernando Perez <fperez@colorado.edu>
4445
4451
4446 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4452 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4447 prevent crashes if sys lacks an argv attribute (it happens with
4453 prevent crashes if sys lacks an argv attribute (it happens with
4448 embedded interpreters which build a bare-bones sys module).
4454 embedded interpreters which build a bare-bones sys module).
4449 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4455 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4450
4456
4451 2003-09-24 Fernando Perez <fperez@colorado.edu>
4457 2003-09-24 Fernando Perez <fperez@colorado.edu>
4452
4458
4453 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4459 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4454 to protect against poorly written user objects where __getattr__
4460 to protect against poorly written user objects where __getattr__
4455 raises exceptions other than AttributeError. Thanks to a bug
4461 raises exceptions other than AttributeError. Thanks to a bug
4456 report by Oliver Sander <osander-AT-gmx.de>.
4462 report by Oliver Sander <osander-AT-gmx.de>.
4457
4463
4458 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4464 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4459 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4465 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4460
4466
4461 2003-09-09 Fernando Perez <fperez@colorado.edu>
4467 2003-09-09 Fernando Perez <fperez@colorado.edu>
4462
4468
4463 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4469 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4464 unpacking a list whith a callable as first element would
4470 unpacking a list whith a callable as first element would
4465 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4471 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4466 Collins.
4472 Collins.
4467
4473
4468 2003-08-25 *** Released version 0.5.0
4474 2003-08-25 *** Released version 0.5.0
4469
4475
4470 2003-08-22 Fernando Perez <fperez@colorado.edu>
4476 2003-08-22 Fernando Perez <fperez@colorado.edu>
4471
4477
4472 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4478 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4473 improperly defined user exceptions. Thanks to feedback from Mark
4479 improperly defined user exceptions. Thanks to feedback from Mark
4474 Russell <mrussell-AT-verio.net>.
4480 Russell <mrussell-AT-verio.net>.
4475
4481
4476 2003-08-20 Fernando Perez <fperez@colorado.edu>
4482 2003-08-20 Fernando Perez <fperez@colorado.edu>
4477
4483
4478 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4484 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4479 printing so that it would print multi-line string forms starting
4485 printing so that it would print multi-line string forms starting
4480 with a new line. This way the formatting is better respected for
4486 with a new line. This way the formatting is better respected for
4481 objects which work hard to make nice string forms.
4487 objects which work hard to make nice string forms.
4482
4488
4483 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4489 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4484 autocall would overtake data access for objects with both
4490 autocall would overtake data access for objects with both
4485 __getitem__ and __call__.
4491 __getitem__ and __call__.
4486
4492
4487 2003-08-19 *** Released version 0.5.0-rc1
4493 2003-08-19 *** Released version 0.5.0-rc1
4488
4494
4489 2003-08-19 Fernando Perez <fperez@colorado.edu>
4495 2003-08-19 Fernando Perez <fperez@colorado.edu>
4490
4496
4491 * IPython/deep_reload.py (load_tail): single tiny change here
4497 * IPython/deep_reload.py (load_tail): single tiny change here
4492 seems to fix the long-standing bug of dreload() failing to work
4498 seems to fix the long-standing bug of dreload() failing to work
4493 for dotted names. But this module is pretty tricky, so I may have
4499 for dotted names. But this module is pretty tricky, so I may have
4494 missed some subtlety. Needs more testing!.
4500 missed some subtlety. Needs more testing!.
4495
4501
4496 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4502 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4497 exceptions which have badly implemented __str__ methods.
4503 exceptions which have badly implemented __str__ methods.
4498 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4504 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4499 which I've been getting reports about from Python 2.3 users. I
4505 which I've been getting reports about from Python 2.3 users. I
4500 wish I had a simple test case to reproduce the problem, so I could
4506 wish I had a simple test case to reproduce the problem, so I could
4501 either write a cleaner workaround or file a bug report if
4507 either write a cleaner workaround or file a bug report if
4502 necessary.
4508 necessary.
4503
4509
4504 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4510 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4505 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4511 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4506 a bug report by Tjabo Kloppenburg.
4512 a bug report by Tjabo Kloppenburg.
4507
4513
4508 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4514 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4509 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4515 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4510 seems rather unstable. Thanks to a bug report by Tjabo
4516 seems rather unstable. Thanks to a bug report by Tjabo
4511 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4517 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4512
4518
4513 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4519 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4514 this out soon because of the critical fixes in the inner loop for
4520 this out soon because of the critical fixes in the inner loop for
4515 generators.
4521 generators.
4516
4522
4517 * IPython/Magic.py (Magic.getargspec): removed. This (and
4523 * IPython/Magic.py (Magic.getargspec): removed. This (and
4518 _get_def) have been obsoleted by OInspect for a long time, I
4524 _get_def) have been obsoleted by OInspect for a long time, I
4519 hadn't noticed that they were dead code.
4525 hadn't noticed that they were dead code.
4520 (Magic._ofind): restored _ofind functionality for a few literals
4526 (Magic._ofind): restored _ofind functionality for a few literals
4521 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4527 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4522 for things like "hello".capitalize?, since that would require a
4528 for things like "hello".capitalize?, since that would require a
4523 potentially dangerous eval() again.
4529 potentially dangerous eval() again.
4524
4530
4525 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4531 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4526 logic a bit more to clean up the escapes handling and minimize the
4532 logic a bit more to clean up the escapes handling and minimize the
4527 use of _ofind to only necessary cases. The interactive 'feel' of
4533 use of _ofind to only necessary cases. The interactive 'feel' of
4528 IPython should have improved quite a bit with the changes in
4534 IPython should have improved quite a bit with the changes in
4529 _prefilter and _ofind (besides being far safer than before).
4535 _prefilter and _ofind (besides being far safer than before).
4530
4536
4531 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4537 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4532 obscure, never reported). Edit would fail to find the object to
4538 obscure, never reported). Edit would fail to find the object to
4533 edit under some circumstances.
4539 edit under some circumstances.
4534 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4540 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4535 which were causing double-calling of generators. Those eval calls
4541 which were causing double-calling of generators. Those eval calls
4536 were _very_ dangerous, since code with side effects could be
4542 were _very_ dangerous, since code with side effects could be
4537 triggered. As they say, 'eval is evil'... These were the
4543 triggered. As they say, 'eval is evil'... These were the
4538 nastiest evals in IPython. Besides, _ofind is now far simpler,
4544 nastiest evals in IPython. Besides, _ofind is now far simpler,
4539 and it should also be quite a bit faster. Its use of inspect is
4545 and it should also be quite a bit faster. Its use of inspect is
4540 also safer, so perhaps some of the inspect-related crashes I've
4546 also safer, so perhaps some of the inspect-related crashes I've
4541 seen lately with Python 2.3 might be taken care of. That will
4547 seen lately with Python 2.3 might be taken care of. That will
4542 need more testing.
4548 need more testing.
4543
4549
4544 2003-08-17 Fernando Perez <fperez@colorado.edu>
4550 2003-08-17 Fernando Perez <fperez@colorado.edu>
4545
4551
4546 * IPython/iplib.py (InteractiveShell._prefilter): significant
4552 * IPython/iplib.py (InteractiveShell._prefilter): significant
4547 simplifications to the logic for handling user escapes. Faster
4553 simplifications to the logic for handling user escapes. Faster
4548 and simpler code.
4554 and simpler code.
4549
4555
4550 2003-08-14 Fernando Perez <fperez@colorado.edu>
4556 2003-08-14 Fernando Perez <fperez@colorado.edu>
4551
4557
4552 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4558 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4553 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4559 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4554 but it should be quite a bit faster. And the recursive version
4560 but it should be quite a bit faster. And the recursive version
4555 generated O(log N) intermediate storage for all rank>1 arrays,
4561 generated O(log N) intermediate storage for all rank>1 arrays,
4556 even if they were contiguous.
4562 even if they were contiguous.
4557 (l1norm): Added this function.
4563 (l1norm): Added this function.
4558 (norm): Added this function for arbitrary norms (including
4564 (norm): Added this function for arbitrary norms (including
4559 l-infinity). l1 and l2 are still special cases for convenience
4565 l-infinity). l1 and l2 are still special cases for convenience
4560 and speed.
4566 and speed.
4561
4567
4562 2003-08-03 Fernando Perez <fperez@colorado.edu>
4568 2003-08-03 Fernando Perez <fperez@colorado.edu>
4563
4569
4564 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4570 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4565 exceptions, which now raise PendingDeprecationWarnings in Python
4571 exceptions, which now raise PendingDeprecationWarnings in Python
4566 2.3. There were some in Magic and some in Gnuplot2.
4572 2.3. There were some in Magic and some in Gnuplot2.
4567
4573
4568 2003-06-30 Fernando Perez <fperez@colorado.edu>
4574 2003-06-30 Fernando Perez <fperez@colorado.edu>
4569
4575
4570 * IPython/genutils.py (page): modified to call curses only for
4576 * IPython/genutils.py (page): modified to call curses only for
4571 terminals where TERM=='xterm'. After problems under many other
4577 terminals where TERM=='xterm'. After problems under many other
4572 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4578 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4573
4579
4574 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4580 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4575 would be triggered when readline was absent. This was just an old
4581 would be triggered when readline was absent. This was just an old
4576 debugging statement I'd forgotten to take out.
4582 debugging statement I'd forgotten to take out.
4577
4583
4578 2003-06-20 Fernando Perez <fperez@colorado.edu>
4584 2003-06-20 Fernando Perez <fperez@colorado.edu>
4579
4585
4580 * IPython/genutils.py (clock): modified to return only user time
4586 * IPython/genutils.py (clock): modified to return only user time
4581 (not counting system time), after a discussion on scipy. While
4587 (not counting system time), after a discussion on scipy. While
4582 system time may be a useful quantity occasionally, it may much
4588 system time may be a useful quantity occasionally, it may much
4583 more easily be skewed by occasional swapping or other similar
4589 more easily be skewed by occasional swapping or other similar
4584 activity.
4590 activity.
4585
4591
4586 2003-06-05 Fernando Perez <fperez@colorado.edu>
4592 2003-06-05 Fernando Perez <fperez@colorado.edu>
4587
4593
4588 * IPython/numutils.py (identity): new function, for building
4594 * IPython/numutils.py (identity): new function, for building
4589 arbitrary rank Kronecker deltas (mostly backwards compatible with
4595 arbitrary rank Kronecker deltas (mostly backwards compatible with
4590 Numeric.identity)
4596 Numeric.identity)
4591
4597
4592 2003-06-03 Fernando Perez <fperez@colorado.edu>
4598 2003-06-03 Fernando Perez <fperez@colorado.edu>
4593
4599
4594 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4600 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4595 arguments passed to magics with spaces, to allow trailing '\' to
4601 arguments passed to magics with spaces, to allow trailing '\' to
4596 work normally (mainly for Windows users).
4602 work normally (mainly for Windows users).
4597
4603
4598 2003-05-29 Fernando Perez <fperez@colorado.edu>
4604 2003-05-29 Fernando Perez <fperez@colorado.edu>
4599
4605
4600 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4606 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4601 instead of pydoc.help. This fixes a bizarre behavior where
4607 instead of pydoc.help. This fixes a bizarre behavior where
4602 printing '%s' % locals() would trigger the help system. Now
4608 printing '%s' % locals() would trigger the help system. Now
4603 ipython behaves like normal python does.
4609 ipython behaves like normal python does.
4604
4610
4605 Note that if one does 'from pydoc import help', the bizarre
4611 Note that if one does 'from pydoc import help', the bizarre
4606 behavior returns, but this will also happen in normal python, so
4612 behavior returns, but this will also happen in normal python, so
4607 it's not an ipython bug anymore (it has to do with how pydoc.help
4613 it's not an ipython bug anymore (it has to do with how pydoc.help
4608 is implemented).
4614 is implemented).
4609
4615
4610 2003-05-22 Fernando Perez <fperez@colorado.edu>
4616 2003-05-22 Fernando Perez <fperez@colorado.edu>
4611
4617
4612 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4618 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4613 return [] instead of None when nothing matches, also match to end
4619 return [] instead of None when nothing matches, also match to end
4614 of line. Patch by Gary Bishop.
4620 of line. Patch by Gary Bishop.
4615
4621
4616 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4622 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4617 protection as before, for files passed on the command line. This
4623 protection as before, for files passed on the command line. This
4618 prevents the CrashHandler from kicking in if user files call into
4624 prevents the CrashHandler from kicking in if user files call into
4619 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4625 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4620 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4626 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4621
4627
4622 2003-05-20 *** Released version 0.4.0
4628 2003-05-20 *** Released version 0.4.0
4623
4629
4624 2003-05-20 Fernando Perez <fperez@colorado.edu>
4630 2003-05-20 Fernando Perez <fperez@colorado.edu>
4625
4631
4626 * setup.py: added support for manpages. It's a bit hackish b/c of
4632 * setup.py: added support for manpages. It's a bit hackish b/c of
4627 a bug in the way the bdist_rpm distutils target handles gzipped
4633 a bug in the way the bdist_rpm distutils target handles gzipped
4628 manpages, but it works. After a patch by Jack.
4634 manpages, but it works. After a patch by Jack.
4629
4635
4630 2003-05-19 Fernando Perez <fperez@colorado.edu>
4636 2003-05-19 Fernando Perez <fperez@colorado.edu>
4631
4637
4632 * IPython/numutils.py: added a mockup of the kinds module, since
4638 * IPython/numutils.py: added a mockup of the kinds module, since
4633 it was recently removed from Numeric. This way, numutils will
4639 it was recently removed from Numeric. This way, numutils will
4634 work for all users even if they are missing kinds.
4640 work for all users even if they are missing kinds.
4635
4641
4636 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4642 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4637 failure, which can occur with SWIG-wrapped extensions. After a
4643 failure, which can occur with SWIG-wrapped extensions. After a
4638 crash report from Prabhu.
4644 crash report from Prabhu.
4639
4645
4640 2003-05-16 Fernando Perez <fperez@colorado.edu>
4646 2003-05-16 Fernando Perez <fperez@colorado.edu>
4641
4647
4642 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4648 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4643 protect ipython from user code which may call directly
4649 protect ipython from user code which may call directly
4644 sys.excepthook (this looks like an ipython crash to the user, even
4650 sys.excepthook (this looks like an ipython crash to the user, even
4645 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4651 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4646 This is especially important to help users of WxWindows, but may
4652 This is especially important to help users of WxWindows, but may
4647 also be useful in other cases.
4653 also be useful in other cases.
4648
4654
4649 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4655 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4650 an optional tb_offset to be specified, and to preserve exception
4656 an optional tb_offset to be specified, and to preserve exception
4651 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4657 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4652
4658
4653 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4659 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4654
4660
4655 2003-05-15 Fernando Perez <fperez@colorado.edu>
4661 2003-05-15 Fernando Perez <fperez@colorado.edu>
4656
4662
4657 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4663 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4658 installing for a new user under Windows.
4664 installing for a new user under Windows.
4659
4665
4660 2003-05-12 Fernando Perez <fperez@colorado.edu>
4666 2003-05-12 Fernando Perez <fperez@colorado.edu>
4661
4667
4662 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4668 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4663 handler for Emacs comint-based lines. Currently it doesn't do
4669 handler for Emacs comint-based lines. Currently it doesn't do
4664 much (but importantly, it doesn't update the history cache). In
4670 much (but importantly, it doesn't update the history cache). In
4665 the future it may be expanded if Alex needs more functionality
4671 the future it may be expanded if Alex needs more functionality
4666 there.
4672 there.
4667
4673
4668 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4674 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4669 info to crash reports.
4675 info to crash reports.
4670
4676
4671 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4677 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4672 just like Python's -c. Also fixed crash with invalid -color
4678 just like Python's -c. Also fixed crash with invalid -color
4673 option value at startup. Thanks to Will French
4679 option value at startup. Thanks to Will French
4674 <wfrench-AT-bestweb.net> for the bug report.
4680 <wfrench-AT-bestweb.net> for the bug report.
4675
4681
4676 2003-05-09 Fernando Perez <fperez@colorado.edu>
4682 2003-05-09 Fernando Perez <fperez@colorado.edu>
4677
4683
4678 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4684 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4679 to EvalDict (it's a mapping, after all) and simplified its code
4685 to EvalDict (it's a mapping, after all) and simplified its code
4680 quite a bit, after a nice discussion on c.l.py where Gustavo
4686 quite a bit, after a nice discussion on c.l.py where Gustavo
4681 Córdova <gcordova-AT-sismex.com> suggested the new version.
4687 Córdova <gcordova-AT-sismex.com> suggested the new version.
4682
4688
4683 2003-04-30 Fernando Perez <fperez@colorado.edu>
4689 2003-04-30 Fernando Perez <fperez@colorado.edu>
4684
4690
4685 * IPython/genutils.py (timings_out): modified it to reduce its
4691 * IPython/genutils.py (timings_out): modified it to reduce its
4686 overhead in the common reps==1 case.
4692 overhead in the common reps==1 case.
4687
4693
4688 2003-04-29 Fernando Perez <fperez@colorado.edu>
4694 2003-04-29 Fernando Perez <fperez@colorado.edu>
4689
4695
4690 * IPython/genutils.py (timings_out): Modified to use the resource
4696 * IPython/genutils.py (timings_out): Modified to use the resource
4691 module, which avoids the wraparound problems of time.clock().
4697 module, which avoids the wraparound problems of time.clock().
4692
4698
4693 2003-04-17 *** Released version 0.2.15pre4
4699 2003-04-17 *** Released version 0.2.15pre4
4694
4700
4695 2003-04-17 Fernando Perez <fperez@colorado.edu>
4701 2003-04-17 Fernando Perez <fperez@colorado.edu>
4696
4702
4697 * setup.py (scriptfiles): Split windows-specific stuff over to a
4703 * setup.py (scriptfiles): Split windows-specific stuff over to a
4698 separate file, in an attempt to have a Windows GUI installer.
4704 separate file, in an attempt to have a Windows GUI installer.
4699 That didn't work, but part of the groundwork is done.
4705 That didn't work, but part of the groundwork is done.
4700
4706
4701 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4707 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4702 indent/unindent with 4 spaces. Particularly useful in combination
4708 indent/unindent with 4 spaces. Particularly useful in combination
4703 with the new auto-indent option.
4709 with the new auto-indent option.
4704
4710
4705 2003-04-16 Fernando Perez <fperez@colorado.edu>
4711 2003-04-16 Fernando Perez <fperez@colorado.edu>
4706
4712
4707 * IPython/Magic.py: various replacements of self.rc for
4713 * IPython/Magic.py: various replacements of self.rc for
4708 self.shell.rc. A lot more remains to be done to fully disentangle
4714 self.shell.rc. A lot more remains to be done to fully disentangle
4709 this class from the main Shell class.
4715 this class from the main Shell class.
4710
4716
4711 * IPython/GnuplotRuntime.py: added checks for mouse support so
4717 * IPython/GnuplotRuntime.py: added checks for mouse support so
4712 that we don't try to enable it if the current gnuplot doesn't
4718 that we don't try to enable it if the current gnuplot doesn't
4713 really support it. Also added checks so that we don't try to
4719 really support it. Also added checks so that we don't try to
4714 enable persist under Windows (where Gnuplot doesn't recognize the
4720 enable persist under Windows (where Gnuplot doesn't recognize the
4715 option).
4721 option).
4716
4722
4717 * IPython/iplib.py (InteractiveShell.interact): Added optional
4723 * IPython/iplib.py (InteractiveShell.interact): Added optional
4718 auto-indenting code, after a patch by King C. Shu
4724 auto-indenting code, after a patch by King C. Shu
4719 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4725 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4720 get along well with pasting indented code. If I ever figure out
4726 get along well with pasting indented code. If I ever figure out
4721 how to make that part go well, it will become on by default.
4727 how to make that part go well, it will become on by default.
4722
4728
4723 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4729 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4724 crash ipython if there was an unmatched '%' in the user's prompt
4730 crash ipython if there was an unmatched '%' in the user's prompt
4725 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4731 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4726
4732
4727 * IPython/iplib.py (InteractiveShell.interact): removed the
4733 * IPython/iplib.py (InteractiveShell.interact): removed the
4728 ability to ask the user whether he wants to crash or not at the
4734 ability to ask the user whether he wants to crash or not at the
4729 'last line' exception handler. Calling functions at that point
4735 'last line' exception handler. Calling functions at that point
4730 changes the stack, and the error reports would have incorrect
4736 changes the stack, and the error reports would have incorrect
4731 tracebacks.
4737 tracebacks.
4732
4738
4733 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4739 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4734 pass through a peger a pretty-printed form of any object. After a
4740 pass through a peger a pretty-printed form of any object. After a
4735 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4741 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4736
4742
4737 2003-04-14 Fernando Perez <fperez@colorado.edu>
4743 2003-04-14 Fernando Perez <fperez@colorado.edu>
4738
4744
4739 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4745 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4740 all files in ~ would be modified at first install (instead of
4746 all files in ~ would be modified at first install (instead of
4741 ~/.ipython). This could be potentially disastrous, as the
4747 ~/.ipython). This could be potentially disastrous, as the
4742 modification (make line-endings native) could damage binary files.
4748 modification (make line-endings native) could damage binary files.
4743
4749
4744 2003-04-10 Fernando Perez <fperez@colorado.edu>
4750 2003-04-10 Fernando Perez <fperez@colorado.edu>
4745
4751
4746 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4752 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4747 handle only lines which are invalid python. This now means that
4753 handle only lines which are invalid python. This now means that
4748 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4754 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4749 for the bug report.
4755 for the bug report.
4750
4756
4751 2003-04-01 Fernando Perez <fperez@colorado.edu>
4757 2003-04-01 Fernando Perez <fperez@colorado.edu>
4752
4758
4753 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4759 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4754 where failing to set sys.last_traceback would crash pdb.pm().
4760 where failing to set sys.last_traceback would crash pdb.pm().
4755 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4761 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4756 report.
4762 report.
4757
4763
4758 2003-03-25 Fernando Perez <fperez@colorado.edu>
4764 2003-03-25 Fernando Perez <fperez@colorado.edu>
4759
4765
4760 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4766 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4761 before printing it (it had a lot of spurious blank lines at the
4767 before printing it (it had a lot of spurious blank lines at the
4762 end).
4768 end).
4763
4769
4764 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4770 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4765 output would be sent 21 times! Obviously people don't use this
4771 output would be sent 21 times! Obviously people don't use this
4766 too often, or I would have heard about it.
4772 too often, or I would have heard about it.
4767
4773
4768 2003-03-24 Fernando Perez <fperez@colorado.edu>
4774 2003-03-24 Fernando Perez <fperez@colorado.edu>
4769
4775
4770 * setup.py (scriptfiles): renamed the data_files parameter from
4776 * setup.py (scriptfiles): renamed the data_files parameter from
4771 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4777 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4772 for the patch.
4778 for the patch.
4773
4779
4774 2003-03-20 Fernando Perez <fperez@colorado.edu>
4780 2003-03-20 Fernando Perez <fperez@colorado.edu>
4775
4781
4776 * IPython/genutils.py (error): added error() and fatal()
4782 * IPython/genutils.py (error): added error() and fatal()
4777 functions.
4783 functions.
4778
4784
4779 2003-03-18 *** Released version 0.2.15pre3
4785 2003-03-18 *** Released version 0.2.15pre3
4780
4786
4781 2003-03-18 Fernando Perez <fperez@colorado.edu>
4787 2003-03-18 Fernando Perez <fperez@colorado.edu>
4782
4788
4783 * setupext/install_data_ext.py
4789 * setupext/install_data_ext.py
4784 (install_data_ext.initialize_options): Class contributed by Jack
4790 (install_data_ext.initialize_options): Class contributed by Jack
4785 Moffit for fixing the old distutils hack. He is sending this to
4791 Moffit for fixing the old distutils hack. He is sending this to
4786 the distutils folks so in the future we may not need it as a
4792 the distutils folks so in the future we may not need it as a
4787 private fix.
4793 private fix.
4788
4794
4789 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4795 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4790 changes for Debian packaging. See his patch for full details.
4796 changes for Debian packaging. See his patch for full details.
4791 The old distutils hack of making the ipythonrc* files carry a
4797 The old distutils hack of making the ipythonrc* files carry a
4792 bogus .py extension is gone, at last. Examples were moved to a
4798 bogus .py extension is gone, at last. Examples were moved to a
4793 separate subdir under doc/, and the separate executable scripts
4799 separate subdir under doc/, and the separate executable scripts
4794 now live in their own directory. Overall a great cleanup. The
4800 now live in their own directory. Overall a great cleanup. The
4795 manual was updated to use the new files, and setup.py has been
4801 manual was updated to use the new files, and setup.py has been
4796 fixed for this setup.
4802 fixed for this setup.
4797
4803
4798 * IPython/PyColorize.py (Parser.usage): made non-executable and
4804 * IPython/PyColorize.py (Parser.usage): made non-executable and
4799 created a pycolor wrapper around it to be included as a script.
4805 created a pycolor wrapper around it to be included as a script.
4800
4806
4801 2003-03-12 *** Released version 0.2.15pre2
4807 2003-03-12 *** Released version 0.2.15pre2
4802
4808
4803 2003-03-12 Fernando Perez <fperez@colorado.edu>
4809 2003-03-12 Fernando Perez <fperez@colorado.edu>
4804
4810
4805 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4811 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4806 long-standing problem with garbage characters in some terminals.
4812 long-standing problem with garbage characters in some terminals.
4807 The issue was really that the \001 and \002 escapes must _only_ be
4813 The issue was really that the \001 and \002 escapes must _only_ be
4808 passed to input prompts (which call readline), but _never_ to
4814 passed to input prompts (which call readline), but _never_ to
4809 normal text to be printed on screen. I changed ColorANSI to have
4815 normal text to be printed on screen. I changed ColorANSI to have
4810 two classes: TermColors and InputTermColors, each with the
4816 two classes: TermColors and InputTermColors, each with the
4811 appropriate escapes for input prompts or normal text. The code in
4817 appropriate escapes for input prompts or normal text. The code in
4812 Prompts.py got slightly more complicated, but this very old and
4818 Prompts.py got slightly more complicated, but this very old and
4813 annoying bug is finally fixed.
4819 annoying bug is finally fixed.
4814
4820
4815 All the credit for nailing down the real origin of this problem
4821 All the credit for nailing down the real origin of this problem
4816 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4822 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4817 *Many* thanks to him for spending quite a bit of effort on this.
4823 *Many* thanks to him for spending quite a bit of effort on this.
4818
4824
4819 2003-03-05 *** Released version 0.2.15pre1
4825 2003-03-05 *** Released version 0.2.15pre1
4820
4826
4821 2003-03-03 Fernando Perez <fperez@colorado.edu>
4827 2003-03-03 Fernando Perez <fperez@colorado.edu>
4822
4828
4823 * IPython/FakeModule.py: Moved the former _FakeModule to a
4829 * IPython/FakeModule.py: Moved the former _FakeModule to a
4824 separate file, because it's also needed by Magic (to fix a similar
4830 separate file, because it's also needed by Magic (to fix a similar
4825 pickle-related issue in @run).
4831 pickle-related issue in @run).
4826
4832
4827 2003-03-02 Fernando Perez <fperez@colorado.edu>
4833 2003-03-02 Fernando Perez <fperez@colorado.edu>
4828
4834
4829 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4835 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4830 the autocall option at runtime.
4836 the autocall option at runtime.
4831 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4837 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4832 across Magic.py to start separating Magic from InteractiveShell.
4838 across Magic.py to start separating Magic from InteractiveShell.
4833 (Magic._ofind): Fixed to return proper namespace for dotted
4839 (Magic._ofind): Fixed to return proper namespace for dotted
4834 names. Before, a dotted name would always return 'not currently
4840 names. Before, a dotted name would always return 'not currently
4835 defined', because it would find the 'parent'. s.x would be found,
4841 defined', because it would find the 'parent'. s.x would be found,
4836 but since 'x' isn't defined by itself, it would get confused.
4842 but since 'x' isn't defined by itself, it would get confused.
4837 (Magic.magic_run): Fixed pickling problems reported by Ralf
4843 (Magic.magic_run): Fixed pickling problems reported by Ralf
4838 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4844 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4839 that I'd used when Mike Heeter reported similar issues at the
4845 that I'd used when Mike Heeter reported similar issues at the
4840 top-level, but now for @run. It boils down to injecting the
4846 top-level, but now for @run. It boils down to injecting the
4841 namespace where code is being executed with something that looks
4847 namespace where code is being executed with something that looks
4842 enough like a module to fool pickle.dump(). Since a pickle stores
4848 enough like a module to fool pickle.dump(). Since a pickle stores
4843 a named reference to the importing module, we need this for
4849 a named reference to the importing module, we need this for
4844 pickles to save something sensible.
4850 pickles to save something sensible.
4845
4851
4846 * IPython/ipmaker.py (make_IPython): added an autocall option.
4852 * IPython/ipmaker.py (make_IPython): added an autocall option.
4847
4853
4848 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4854 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4849 the auto-eval code. Now autocalling is an option, and the code is
4855 the auto-eval code. Now autocalling is an option, and the code is
4850 also vastly safer. There is no more eval() involved at all.
4856 also vastly safer. There is no more eval() involved at all.
4851
4857
4852 2003-03-01 Fernando Perez <fperez@colorado.edu>
4858 2003-03-01 Fernando Perez <fperez@colorado.edu>
4853
4859
4854 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4860 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4855 dict with named keys instead of a tuple.
4861 dict with named keys instead of a tuple.
4856
4862
4857 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4863 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4858
4864
4859 * setup.py (make_shortcut): Fixed message about directories
4865 * setup.py (make_shortcut): Fixed message about directories
4860 created during Windows installation (the directories were ok, just
4866 created during Windows installation (the directories were ok, just
4861 the printed message was misleading). Thanks to Chris Liechti
4867 the printed message was misleading). Thanks to Chris Liechti
4862 <cliechti-AT-gmx.net> for the heads up.
4868 <cliechti-AT-gmx.net> for the heads up.
4863
4869
4864 2003-02-21 Fernando Perez <fperez@colorado.edu>
4870 2003-02-21 Fernando Perez <fperez@colorado.edu>
4865
4871
4866 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4872 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4867 of ValueError exception when checking for auto-execution. This
4873 of ValueError exception when checking for auto-execution. This
4868 one is raised by things like Numeric arrays arr.flat when the
4874 one is raised by things like Numeric arrays arr.flat when the
4869 array is non-contiguous.
4875 array is non-contiguous.
4870
4876
4871 2003-01-31 Fernando Perez <fperez@colorado.edu>
4877 2003-01-31 Fernando Perez <fperez@colorado.edu>
4872
4878
4873 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4879 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4874 not return any value at all (even though the command would get
4880 not return any value at all (even though the command would get
4875 executed).
4881 executed).
4876 (xsys): Flush stdout right after printing the command to ensure
4882 (xsys): Flush stdout right after printing the command to ensure
4877 proper ordering of commands and command output in the total
4883 proper ordering of commands and command output in the total
4878 output.
4884 output.
4879 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4885 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4880 system/getoutput as defaults. The old ones are kept for
4886 system/getoutput as defaults. The old ones are kept for
4881 compatibility reasons, so no code which uses this library needs
4887 compatibility reasons, so no code which uses this library needs
4882 changing.
4888 changing.
4883
4889
4884 2003-01-27 *** Released version 0.2.14
4890 2003-01-27 *** Released version 0.2.14
4885
4891
4886 2003-01-25 Fernando Perez <fperez@colorado.edu>
4892 2003-01-25 Fernando Perez <fperez@colorado.edu>
4887
4893
4888 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4894 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4889 functions defined in previous edit sessions could not be re-edited
4895 functions defined in previous edit sessions could not be re-edited
4890 (because the temp files were immediately removed). Now temp files
4896 (because the temp files were immediately removed). Now temp files
4891 are removed only at IPython's exit.
4897 are removed only at IPython's exit.
4892 (Magic.magic_run): Improved @run to perform shell-like expansions
4898 (Magic.magic_run): Improved @run to perform shell-like expansions
4893 on its arguments (~users and $VARS). With this, @run becomes more
4899 on its arguments (~users and $VARS). With this, @run becomes more
4894 like a normal command-line.
4900 like a normal command-line.
4895
4901
4896 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4902 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4897 bugs related to embedding and cleaned up that code. A fairly
4903 bugs related to embedding and cleaned up that code. A fairly
4898 important one was the impossibility to access the global namespace
4904 important one was the impossibility to access the global namespace
4899 through the embedded IPython (only local variables were visible).
4905 through the embedded IPython (only local variables were visible).
4900
4906
4901 2003-01-14 Fernando Perez <fperez@colorado.edu>
4907 2003-01-14 Fernando Perez <fperez@colorado.edu>
4902
4908
4903 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4909 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4904 auto-calling to be a bit more conservative. Now it doesn't get
4910 auto-calling to be a bit more conservative. Now it doesn't get
4905 triggered if any of '!=()<>' are in the rest of the input line, to
4911 triggered if any of '!=()<>' are in the rest of the input line, to
4906 allow comparing callables. Thanks to Alex for the heads up.
4912 allow comparing callables. Thanks to Alex for the heads up.
4907
4913
4908 2003-01-07 Fernando Perez <fperez@colorado.edu>
4914 2003-01-07 Fernando Perez <fperez@colorado.edu>
4909
4915
4910 * IPython/genutils.py (page): fixed estimation of the number of
4916 * IPython/genutils.py (page): fixed estimation of the number of
4911 lines in a string to be paged to simply count newlines. This
4917 lines in a string to be paged to simply count newlines. This
4912 prevents over-guessing due to embedded escape sequences. A better
4918 prevents over-guessing due to embedded escape sequences. A better
4913 long-term solution would involve stripping out the control chars
4919 long-term solution would involve stripping out the control chars
4914 for the count, but it's potentially so expensive I just don't
4920 for the count, but it's potentially so expensive I just don't
4915 think it's worth doing.
4921 think it's worth doing.
4916
4922
4917 2002-12-19 *** Released version 0.2.14pre50
4923 2002-12-19 *** Released version 0.2.14pre50
4918
4924
4919 2002-12-19 Fernando Perez <fperez@colorado.edu>
4925 2002-12-19 Fernando Perez <fperez@colorado.edu>
4920
4926
4921 * tools/release (version): Changed release scripts to inform
4927 * tools/release (version): Changed release scripts to inform
4922 Andrea and build a NEWS file with a list of recent changes.
4928 Andrea and build a NEWS file with a list of recent changes.
4923
4929
4924 * IPython/ColorANSI.py (__all__): changed terminal detection
4930 * IPython/ColorANSI.py (__all__): changed terminal detection
4925 code. Seems to work better for xterms without breaking
4931 code. Seems to work better for xterms without breaking
4926 konsole. Will need more testing to determine if WinXP and Mac OSX
4932 konsole. Will need more testing to determine if WinXP and Mac OSX
4927 also work ok.
4933 also work ok.
4928
4934
4929 2002-12-18 *** Released version 0.2.14pre49
4935 2002-12-18 *** Released version 0.2.14pre49
4930
4936
4931 2002-12-18 Fernando Perez <fperez@colorado.edu>
4937 2002-12-18 Fernando Perez <fperez@colorado.edu>
4932
4938
4933 * Docs: added new info about Mac OSX, from Andrea.
4939 * Docs: added new info about Mac OSX, from Andrea.
4934
4940
4935 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4941 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4936 allow direct plotting of python strings whose format is the same
4942 allow direct plotting of python strings whose format is the same
4937 of gnuplot data files.
4943 of gnuplot data files.
4938
4944
4939 2002-12-16 Fernando Perez <fperez@colorado.edu>
4945 2002-12-16 Fernando Perez <fperez@colorado.edu>
4940
4946
4941 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4947 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4942 value of exit question to be acknowledged.
4948 value of exit question to be acknowledged.
4943
4949
4944 2002-12-03 Fernando Perez <fperez@colorado.edu>
4950 2002-12-03 Fernando Perez <fperez@colorado.edu>
4945
4951
4946 * IPython/ipmaker.py: removed generators, which had been added
4952 * IPython/ipmaker.py: removed generators, which had been added
4947 by mistake in an earlier debugging run. This was causing trouble
4953 by mistake in an earlier debugging run. This was causing trouble
4948 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4954 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4949 for pointing this out.
4955 for pointing this out.
4950
4956
4951 2002-11-17 Fernando Perez <fperez@colorado.edu>
4957 2002-11-17 Fernando Perez <fperez@colorado.edu>
4952
4958
4953 * Manual: updated the Gnuplot section.
4959 * Manual: updated the Gnuplot section.
4954
4960
4955 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4961 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4956 a much better split of what goes in Runtime and what goes in
4962 a much better split of what goes in Runtime and what goes in
4957 Interactive.
4963 Interactive.
4958
4964
4959 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4965 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4960 being imported from iplib.
4966 being imported from iplib.
4961
4967
4962 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4968 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4963 for command-passing. Now the global Gnuplot instance is called
4969 for command-passing. Now the global Gnuplot instance is called
4964 'gp' instead of 'g', which was really a far too fragile and
4970 'gp' instead of 'g', which was really a far too fragile and
4965 common name.
4971 common name.
4966
4972
4967 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4973 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4968 bounding boxes generated by Gnuplot for square plots.
4974 bounding boxes generated by Gnuplot for square plots.
4969
4975
4970 * IPython/genutils.py (popkey): new function added. I should
4976 * IPython/genutils.py (popkey): new function added. I should
4971 suggest this on c.l.py as a dict method, it seems useful.
4977 suggest this on c.l.py as a dict method, it seems useful.
4972
4978
4973 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4979 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4974 to transparently handle PostScript generation. MUCH better than
4980 to transparently handle PostScript generation. MUCH better than
4975 the previous plot_eps/replot_eps (which I removed now). The code
4981 the previous plot_eps/replot_eps (which I removed now). The code
4976 is also fairly clean and well documented now (including
4982 is also fairly clean and well documented now (including
4977 docstrings).
4983 docstrings).
4978
4984
4979 2002-11-13 Fernando Perez <fperez@colorado.edu>
4985 2002-11-13 Fernando Perez <fperez@colorado.edu>
4980
4986
4981 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4987 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4982 (inconsistent with options).
4988 (inconsistent with options).
4983
4989
4984 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4990 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4985 manually disabled, I don't know why. Fixed it.
4991 manually disabled, I don't know why. Fixed it.
4986 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4992 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4987 eps output.
4993 eps output.
4988
4994
4989 2002-11-12 Fernando Perez <fperez@colorado.edu>
4995 2002-11-12 Fernando Perez <fperez@colorado.edu>
4990
4996
4991 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4997 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4992 don't propagate up to caller. Fixes crash reported by François
4998 don't propagate up to caller. Fixes crash reported by François
4993 Pinard.
4999 Pinard.
4994
5000
4995 2002-11-09 Fernando Perez <fperez@colorado.edu>
5001 2002-11-09 Fernando Perez <fperez@colorado.edu>
4996
5002
4997 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5003 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4998 history file for new users.
5004 history file for new users.
4999 (make_IPython): fixed bug where initial install would leave the
5005 (make_IPython): fixed bug where initial install would leave the
5000 user running in the .ipython dir.
5006 user running in the .ipython dir.
5001 (make_IPython): fixed bug where config dir .ipython would be
5007 (make_IPython): fixed bug where config dir .ipython would be
5002 created regardless of the given -ipythondir option. Thanks to Cory
5008 created regardless of the given -ipythondir option. Thanks to Cory
5003 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5009 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5004
5010
5005 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5011 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5006 type confirmations. Will need to use it in all of IPython's code
5012 type confirmations. Will need to use it in all of IPython's code
5007 consistently.
5013 consistently.
5008
5014
5009 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5015 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5010 context to print 31 lines instead of the default 5. This will make
5016 context to print 31 lines instead of the default 5. This will make
5011 the crash reports extremely detailed in case the problem is in
5017 the crash reports extremely detailed in case the problem is in
5012 libraries I don't have access to.
5018 libraries I don't have access to.
5013
5019
5014 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5020 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5015 line of defense' code to still crash, but giving users fair
5021 line of defense' code to still crash, but giving users fair
5016 warning. I don't want internal errors to go unreported: if there's
5022 warning. I don't want internal errors to go unreported: if there's
5017 an internal problem, IPython should crash and generate a full
5023 an internal problem, IPython should crash and generate a full
5018 report.
5024 report.
5019
5025
5020 2002-11-08 Fernando Perez <fperez@colorado.edu>
5026 2002-11-08 Fernando Perez <fperez@colorado.edu>
5021
5027
5022 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5028 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5023 otherwise uncaught exceptions which can appear if people set
5029 otherwise uncaught exceptions which can appear if people set
5024 sys.stdout to something badly broken. Thanks to a crash report
5030 sys.stdout to something badly broken. Thanks to a crash report
5025 from henni-AT-mail.brainbot.com.
5031 from henni-AT-mail.brainbot.com.
5026
5032
5027 2002-11-04 Fernando Perez <fperez@colorado.edu>
5033 2002-11-04 Fernando Perez <fperez@colorado.edu>
5028
5034
5029 * IPython/iplib.py (InteractiveShell.interact): added
5035 * IPython/iplib.py (InteractiveShell.interact): added
5030 __IPYTHON__active to the builtins. It's a flag which goes on when
5036 __IPYTHON__active to the builtins. It's a flag which goes on when
5031 the interaction starts and goes off again when it stops. This
5037 the interaction starts and goes off again when it stops. This
5032 allows embedding code to detect being inside IPython. Before this
5038 allows embedding code to detect being inside IPython. Before this
5033 was done via __IPYTHON__, but that only shows that an IPython
5039 was done via __IPYTHON__, but that only shows that an IPython
5034 instance has been created.
5040 instance has been created.
5035
5041
5036 * IPython/Magic.py (Magic.magic_env): I realized that in a
5042 * IPython/Magic.py (Magic.magic_env): I realized that in a
5037 UserDict, instance.data holds the data as a normal dict. So I
5043 UserDict, instance.data holds the data as a normal dict. So I
5038 modified @env to return os.environ.data instead of rebuilding a
5044 modified @env to return os.environ.data instead of rebuilding a
5039 dict by hand.
5045 dict by hand.
5040
5046
5041 2002-11-02 Fernando Perez <fperez@colorado.edu>
5047 2002-11-02 Fernando Perez <fperez@colorado.edu>
5042
5048
5043 * IPython/genutils.py (warn): changed so that level 1 prints no
5049 * IPython/genutils.py (warn): changed so that level 1 prints no
5044 header. Level 2 is now the default (with 'WARNING' header, as
5050 header. Level 2 is now the default (with 'WARNING' header, as
5045 before). I think I tracked all places where changes were needed in
5051 before). I think I tracked all places where changes were needed in
5046 IPython, but outside code using the old level numbering may have
5052 IPython, but outside code using the old level numbering may have
5047 broken.
5053 broken.
5048
5054
5049 * IPython/iplib.py (InteractiveShell.runcode): added this to
5055 * IPython/iplib.py (InteractiveShell.runcode): added this to
5050 handle the tracebacks in SystemExit traps correctly. The previous
5056 handle the tracebacks in SystemExit traps correctly. The previous
5051 code (through interact) was printing more of the stack than
5057 code (through interact) was printing more of the stack than
5052 necessary, showing IPython internal code to the user.
5058 necessary, showing IPython internal code to the user.
5053
5059
5054 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5060 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5055 default. Now that the default at the confirmation prompt is yes,
5061 default. Now that the default at the confirmation prompt is yes,
5056 it's not so intrusive. François' argument that ipython sessions
5062 it's not so intrusive. François' argument that ipython sessions
5057 tend to be complex enough not to lose them from an accidental C-d,
5063 tend to be complex enough not to lose them from an accidental C-d,
5058 is a valid one.
5064 is a valid one.
5059
5065
5060 * IPython/iplib.py (InteractiveShell.interact): added a
5066 * IPython/iplib.py (InteractiveShell.interact): added a
5061 showtraceback() call to the SystemExit trap, and modified the exit
5067 showtraceback() call to the SystemExit trap, and modified the exit
5062 confirmation to have yes as the default.
5068 confirmation to have yes as the default.
5063
5069
5064 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5070 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5065 this file. It's been gone from the code for a long time, this was
5071 this file. It's been gone from the code for a long time, this was
5066 simply leftover junk.
5072 simply leftover junk.
5067
5073
5068 2002-11-01 Fernando Perez <fperez@colorado.edu>
5074 2002-11-01 Fernando Perez <fperez@colorado.edu>
5069
5075
5070 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5076 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5071 added. If set, IPython now traps EOF and asks for
5077 added. If set, IPython now traps EOF and asks for
5072 confirmation. After a request by François Pinard.
5078 confirmation. After a request by François Pinard.
5073
5079
5074 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5080 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5075 of @abort, and with a new (better) mechanism for handling the
5081 of @abort, and with a new (better) mechanism for handling the
5076 exceptions.
5082 exceptions.
5077
5083
5078 2002-10-27 Fernando Perez <fperez@colorado.edu>
5084 2002-10-27 Fernando Perez <fperez@colorado.edu>
5079
5085
5080 * IPython/usage.py (__doc__): updated the --help information and
5086 * IPython/usage.py (__doc__): updated the --help information and
5081 the ipythonrc file to indicate that -log generates
5087 the ipythonrc file to indicate that -log generates
5082 ./ipython.log. Also fixed the corresponding info in @logstart.
5088 ./ipython.log. Also fixed the corresponding info in @logstart.
5083 This and several other fixes in the manuals thanks to reports by
5089 This and several other fixes in the manuals thanks to reports by
5084 François Pinard <pinard-AT-iro.umontreal.ca>.
5090 François Pinard <pinard-AT-iro.umontreal.ca>.
5085
5091
5086 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5092 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5087 refer to @logstart (instead of @log, which doesn't exist).
5093 refer to @logstart (instead of @log, which doesn't exist).
5088
5094
5089 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5095 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5090 AttributeError crash. Thanks to Christopher Armstrong
5096 AttributeError crash. Thanks to Christopher Armstrong
5091 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5097 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5092 introduced recently (in 0.2.14pre37) with the fix to the eval
5098 introduced recently (in 0.2.14pre37) with the fix to the eval
5093 problem mentioned below.
5099 problem mentioned below.
5094
5100
5095 2002-10-17 Fernando Perez <fperez@colorado.edu>
5101 2002-10-17 Fernando Perez <fperez@colorado.edu>
5096
5102
5097 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5103 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5098 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5104 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5099
5105
5100 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5106 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5101 this function to fix a problem reported by Alex Schmolck. He saw
5107 this function to fix a problem reported by Alex Schmolck. He saw
5102 it with list comprehensions and generators, which were getting
5108 it with list comprehensions and generators, which were getting
5103 called twice. The real problem was an 'eval' call in testing for
5109 called twice. The real problem was an 'eval' call in testing for
5104 automagic which was evaluating the input line silently.
5110 automagic which was evaluating the input line silently.
5105
5111
5106 This is a potentially very nasty bug, if the input has side
5112 This is a potentially very nasty bug, if the input has side
5107 effects which must not be repeated. The code is much cleaner now,
5113 effects which must not be repeated. The code is much cleaner now,
5108 without any blanket 'except' left and with a regexp test for
5114 without any blanket 'except' left and with a regexp test for
5109 actual function names.
5115 actual function names.
5110
5116
5111 But an eval remains, which I'm not fully comfortable with. I just
5117 But an eval remains, which I'm not fully comfortable with. I just
5112 don't know how to find out if an expression could be a callable in
5118 don't know how to find out if an expression could be a callable in
5113 the user's namespace without doing an eval on the string. However
5119 the user's namespace without doing an eval on the string. However
5114 that string is now much more strictly checked so that no code
5120 that string is now much more strictly checked so that no code
5115 slips by, so the eval should only happen for things that can
5121 slips by, so the eval should only happen for things that can
5116 really be only function/method names.
5122 really be only function/method names.
5117
5123
5118 2002-10-15 Fernando Perez <fperez@colorado.edu>
5124 2002-10-15 Fernando Perez <fperez@colorado.edu>
5119
5125
5120 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5126 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5121 OSX information to main manual, removed README_Mac_OSX file from
5127 OSX information to main manual, removed README_Mac_OSX file from
5122 distribution. Also updated credits for recent additions.
5128 distribution. Also updated credits for recent additions.
5123
5129
5124 2002-10-10 Fernando Perez <fperez@colorado.edu>
5130 2002-10-10 Fernando Perez <fperez@colorado.edu>
5125
5131
5126 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5132 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5127 terminal-related issues. Many thanks to Andrea Riciputi
5133 terminal-related issues. Many thanks to Andrea Riciputi
5128 <andrea.riciputi-AT-libero.it> for writing it.
5134 <andrea.riciputi-AT-libero.it> for writing it.
5129
5135
5130 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5136 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5131 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5137 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5132
5138
5133 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5139 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5134 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5140 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5135 <syver-en-AT-online.no> who both submitted patches for this problem.
5141 <syver-en-AT-online.no> who both submitted patches for this problem.
5136
5142
5137 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5143 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5138 global embedding to make sure that things don't overwrite user
5144 global embedding to make sure that things don't overwrite user
5139 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5145 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5140
5146
5141 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5147 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5142 compatibility. Thanks to Hayden Callow
5148 compatibility. Thanks to Hayden Callow
5143 <h.callow-AT-elec.canterbury.ac.nz>
5149 <h.callow-AT-elec.canterbury.ac.nz>
5144
5150
5145 2002-10-04 Fernando Perez <fperez@colorado.edu>
5151 2002-10-04 Fernando Perez <fperez@colorado.edu>
5146
5152
5147 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5153 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5148 Gnuplot.File objects.
5154 Gnuplot.File objects.
5149
5155
5150 2002-07-23 Fernando Perez <fperez@colorado.edu>
5156 2002-07-23 Fernando Perez <fperez@colorado.edu>
5151
5157
5152 * IPython/genutils.py (timing): Added timings() and timing() for
5158 * IPython/genutils.py (timing): Added timings() and timing() for
5153 quick access to the most commonly needed data, the execution
5159 quick access to the most commonly needed data, the execution
5154 times. Old timing() renamed to timings_out().
5160 times. Old timing() renamed to timings_out().
5155
5161
5156 2002-07-18 Fernando Perez <fperez@colorado.edu>
5162 2002-07-18 Fernando Perez <fperez@colorado.edu>
5157
5163
5158 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5164 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5159 bug with nested instances disrupting the parent's tab completion.
5165 bug with nested instances disrupting the parent's tab completion.
5160
5166
5161 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5167 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5162 all_completions code to begin the emacs integration.
5168 all_completions code to begin the emacs integration.
5163
5169
5164 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5170 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5165 argument to allow titling individual arrays when plotting.
5171 argument to allow titling individual arrays when plotting.
5166
5172
5167 2002-07-15 Fernando Perez <fperez@colorado.edu>
5173 2002-07-15 Fernando Perez <fperez@colorado.edu>
5168
5174
5169 * setup.py (make_shortcut): changed to retrieve the value of
5175 * setup.py (make_shortcut): changed to retrieve the value of
5170 'Program Files' directory from the registry (this value changes in
5176 'Program Files' directory from the registry (this value changes in
5171 non-english versions of Windows). Thanks to Thomas Fanslau
5177 non-english versions of Windows). Thanks to Thomas Fanslau
5172 <tfanslau-AT-gmx.de> for the report.
5178 <tfanslau-AT-gmx.de> for the report.
5173
5179
5174 2002-07-10 Fernando Perez <fperez@colorado.edu>
5180 2002-07-10 Fernando Perez <fperez@colorado.edu>
5175
5181
5176 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5182 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5177 a bug in pdb, which crashes if a line with only whitespace is
5183 a bug in pdb, which crashes if a line with only whitespace is
5178 entered. Bug report submitted to sourceforge.
5184 entered. Bug report submitted to sourceforge.
5179
5185
5180 2002-07-09 Fernando Perez <fperez@colorado.edu>
5186 2002-07-09 Fernando Perez <fperez@colorado.edu>
5181
5187
5182 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5188 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5183 reporting exceptions (it's a bug in inspect.py, I just set a
5189 reporting exceptions (it's a bug in inspect.py, I just set a
5184 workaround).
5190 workaround).
5185
5191
5186 2002-07-08 Fernando Perez <fperez@colorado.edu>
5192 2002-07-08 Fernando Perez <fperez@colorado.edu>
5187
5193
5188 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5194 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5189 __IPYTHON__ in __builtins__ to show up in user_ns.
5195 __IPYTHON__ in __builtins__ to show up in user_ns.
5190
5196
5191 2002-07-03 Fernando Perez <fperez@colorado.edu>
5197 2002-07-03 Fernando Perez <fperez@colorado.edu>
5192
5198
5193 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5199 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5194 name from @gp_set_instance to @gp_set_default.
5200 name from @gp_set_instance to @gp_set_default.
5195
5201
5196 * IPython/ipmaker.py (make_IPython): default editor value set to
5202 * IPython/ipmaker.py (make_IPython): default editor value set to
5197 '0' (a string), to match the rc file. Otherwise will crash when
5203 '0' (a string), to match the rc file. Otherwise will crash when
5198 .strip() is called on it.
5204 .strip() is called on it.
5199
5205
5200
5206
5201 2002-06-28 Fernando Perez <fperez@colorado.edu>
5207 2002-06-28 Fernando Perez <fperez@colorado.edu>
5202
5208
5203 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5209 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5204 of files in current directory when a file is executed via
5210 of files in current directory when a file is executed via
5205 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5211 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5206
5212
5207 * setup.py (manfiles): fix for rpm builds, submitted by RA
5213 * setup.py (manfiles): fix for rpm builds, submitted by RA
5208 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5214 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5209
5215
5210 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5216 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5211 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5217 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5212 string!). A. Schmolck caught this one.
5218 string!). A. Schmolck caught this one.
5213
5219
5214 2002-06-27 Fernando Perez <fperez@colorado.edu>
5220 2002-06-27 Fernando Perez <fperez@colorado.edu>
5215
5221
5216 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5222 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5217 defined files at the cmd line. __name__ wasn't being set to
5223 defined files at the cmd line. __name__ wasn't being set to
5218 __main__.
5224 __main__.
5219
5225
5220 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5226 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5221 regular lists and tuples besides Numeric arrays.
5227 regular lists and tuples besides Numeric arrays.
5222
5228
5223 * IPython/Prompts.py (CachedOutput.__call__): Added output
5229 * IPython/Prompts.py (CachedOutput.__call__): Added output
5224 supression for input ending with ';'. Similar to Mathematica and
5230 supression for input ending with ';'. Similar to Mathematica and
5225 Matlab. The _* vars and Out[] list are still updated, just like
5231 Matlab. The _* vars and Out[] list are still updated, just like
5226 Mathematica behaves.
5232 Mathematica behaves.
5227
5233
5228 2002-06-25 Fernando Perez <fperez@colorado.edu>
5234 2002-06-25 Fernando Perez <fperez@colorado.edu>
5229
5235
5230 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5236 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5231 .ini extensions for profiels under Windows.
5237 .ini extensions for profiels under Windows.
5232
5238
5233 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5239 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5234 string form. Fix contributed by Alexander Schmolck
5240 string form. Fix contributed by Alexander Schmolck
5235 <a.schmolck-AT-gmx.net>
5241 <a.schmolck-AT-gmx.net>
5236
5242
5237 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5243 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5238 pre-configured Gnuplot instance.
5244 pre-configured Gnuplot instance.
5239
5245
5240 2002-06-21 Fernando Perez <fperez@colorado.edu>
5246 2002-06-21 Fernando Perez <fperez@colorado.edu>
5241
5247
5242 * IPython/numutils.py (exp_safe): new function, works around the
5248 * IPython/numutils.py (exp_safe): new function, works around the
5243 underflow problems in Numeric.
5249 underflow problems in Numeric.
5244 (log2): New fn. Safe log in base 2: returns exact integer answer
5250 (log2): New fn. Safe log in base 2: returns exact integer answer
5245 for exact integer powers of 2.
5251 for exact integer powers of 2.
5246
5252
5247 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5253 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5248 properly.
5254 properly.
5249
5255
5250 2002-06-20 Fernando Perez <fperez@colorado.edu>
5256 2002-06-20 Fernando Perez <fperez@colorado.edu>
5251
5257
5252 * IPython/genutils.py (timing): new function like
5258 * IPython/genutils.py (timing): new function like
5253 Mathematica's. Similar to time_test, but returns more info.
5259 Mathematica's. Similar to time_test, but returns more info.
5254
5260
5255 2002-06-18 Fernando Perez <fperez@colorado.edu>
5261 2002-06-18 Fernando Perez <fperez@colorado.edu>
5256
5262
5257 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5263 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5258 according to Mike Heeter's suggestions.
5264 according to Mike Heeter's suggestions.
5259
5265
5260 2002-06-16 Fernando Perez <fperez@colorado.edu>
5266 2002-06-16 Fernando Perez <fperez@colorado.edu>
5261
5267
5262 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5268 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5263 system. GnuplotMagic is gone as a user-directory option. New files
5269 system. GnuplotMagic is gone as a user-directory option. New files
5264 make it easier to use all the gnuplot stuff both from external
5270 make it easier to use all the gnuplot stuff both from external
5265 programs as well as from IPython. Had to rewrite part of
5271 programs as well as from IPython. Had to rewrite part of
5266 hardcopy() b/c of a strange bug: often the ps files simply don't
5272 hardcopy() b/c of a strange bug: often the ps files simply don't
5267 get created, and require a repeat of the command (often several
5273 get created, and require a repeat of the command (often several
5268 times).
5274 times).
5269
5275
5270 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5276 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5271 resolve output channel at call time, so that if sys.stderr has
5277 resolve output channel at call time, so that if sys.stderr has
5272 been redirected by user this gets honored.
5278 been redirected by user this gets honored.
5273
5279
5274 2002-06-13 Fernando Perez <fperez@colorado.edu>
5280 2002-06-13 Fernando Perez <fperez@colorado.edu>
5275
5281
5276 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5282 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5277 IPShell. Kept a copy with the old names to avoid breaking people's
5283 IPShell. Kept a copy with the old names to avoid breaking people's
5278 embedded code.
5284 embedded code.
5279
5285
5280 * IPython/ipython: simplified it to the bare minimum after
5286 * IPython/ipython: simplified it to the bare minimum after
5281 Holger's suggestions. Added info about how to use it in
5287 Holger's suggestions. Added info about how to use it in
5282 PYTHONSTARTUP.
5288 PYTHONSTARTUP.
5283
5289
5284 * IPython/Shell.py (IPythonShell): changed the options passing
5290 * IPython/Shell.py (IPythonShell): changed the options passing
5285 from a string with funky %s replacements to a straight list. Maybe
5291 from a string with funky %s replacements to a straight list. Maybe
5286 a bit more typing, but it follows sys.argv conventions, so there's
5292 a bit more typing, but it follows sys.argv conventions, so there's
5287 less special-casing to remember.
5293 less special-casing to remember.
5288
5294
5289 2002-06-12 Fernando Perez <fperez@colorado.edu>
5295 2002-06-12 Fernando Perez <fperez@colorado.edu>
5290
5296
5291 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5297 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5292 command. Thanks to a suggestion by Mike Heeter.
5298 command. Thanks to a suggestion by Mike Heeter.
5293 (Magic.magic_pfile): added behavior to look at filenames if given
5299 (Magic.magic_pfile): added behavior to look at filenames if given
5294 arg is not a defined object.
5300 arg is not a defined object.
5295 (Magic.magic_save): New @save function to save code snippets. Also
5301 (Magic.magic_save): New @save function to save code snippets. Also
5296 a Mike Heeter idea.
5302 a Mike Heeter idea.
5297
5303
5298 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5304 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5299 plot() and replot(). Much more convenient now, especially for
5305 plot() and replot(). Much more convenient now, especially for
5300 interactive use.
5306 interactive use.
5301
5307
5302 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5308 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5303 filenames.
5309 filenames.
5304
5310
5305 2002-06-02 Fernando Perez <fperez@colorado.edu>
5311 2002-06-02 Fernando Perez <fperez@colorado.edu>
5306
5312
5307 * IPython/Struct.py (Struct.__init__): modified to admit
5313 * IPython/Struct.py (Struct.__init__): modified to admit
5308 initialization via another struct.
5314 initialization via another struct.
5309
5315
5310 * IPython/genutils.py (SystemExec.__init__): New stateful
5316 * IPython/genutils.py (SystemExec.__init__): New stateful
5311 interface to xsys and bq. Useful for writing system scripts.
5317 interface to xsys and bq. Useful for writing system scripts.
5312
5318
5313 2002-05-30 Fernando Perez <fperez@colorado.edu>
5319 2002-05-30 Fernando Perez <fperez@colorado.edu>
5314
5320
5315 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5321 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5316 documents. This will make the user download smaller (it's getting
5322 documents. This will make the user download smaller (it's getting
5317 too big).
5323 too big).
5318
5324
5319 2002-05-29 Fernando Perez <fperez@colorado.edu>
5325 2002-05-29 Fernando Perez <fperez@colorado.edu>
5320
5326
5321 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5327 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5322 fix problems with shelve and pickle. Seems to work, but I don't
5328 fix problems with shelve and pickle. Seems to work, but I don't
5323 know if corner cases break it. Thanks to Mike Heeter
5329 know if corner cases break it. Thanks to Mike Heeter
5324 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5330 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5325
5331
5326 2002-05-24 Fernando Perez <fperez@colorado.edu>
5332 2002-05-24 Fernando Perez <fperez@colorado.edu>
5327
5333
5328 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5334 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5329 macros having broken.
5335 macros having broken.
5330
5336
5331 2002-05-21 Fernando Perez <fperez@colorado.edu>
5337 2002-05-21 Fernando Perez <fperez@colorado.edu>
5332
5338
5333 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5339 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5334 introduced logging bug: all history before logging started was
5340 introduced logging bug: all history before logging started was
5335 being written one character per line! This came from the redesign
5341 being written one character per line! This came from the redesign
5336 of the input history as a special list which slices to strings,
5342 of the input history as a special list which slices to strings,
5337 not to lists.
5343 not to lists.
5338
5344
5339 2002-05-20 Fernando Perez <fperez@colorado.edu>
5345 2002-05-20 Fernando Perez <fperez@colorado.edu>
5340
5346
5341 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5347 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5342 be an attribute of all classes in this module. The design of these
5348 be an attribute of all classes in this module. The design of these
5343 classes needs some serious overhauling.
5349 classes needs some serious overhauling.
5344
5350
5345 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5351 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5346 which was ignoring '_' in option names.
5352 which was ignoring '_' in option names.
5347
5353
5348 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5354 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5349 'Verbose_novars' to 'Context' and made it the new default. It's a
5355 'Verbose_novars' to 'Context' and made it the new default. It's a
5350 bit more readable and also safer than verbose.
5356 bit more readable and also safer than verbose.
5351
5357
5352 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5358 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5353 triple-quoted strings.
5359 triple-quoted strings.
5354
5360
5355 * IPython/OInspect.py (__all__): new module exposing the object
5361 * IPython/OInspect.py (__all__): new module exposing the object
5356 introspection facilities. Now the corresponding magics are dummy
5362 introspection facilities. Now the corresponding magics are dummy
5357 wrappers around this. Having this module will make it much easier
5363 wrappers around this. Having this module will make it much easier
5358 to put these functions into our modified pdb.
5364 to put these functions into our modified pdb.
5359 This new object inspector system uses the new colorizing module,
5365 This new object inspector system uses the new colorizing module,
5360 so source code and other things are nicely syntax highlighted.
5366 so source code and other things are nicely syntax highlighted.
5361
5367
5362 2002-05-18 Fernando Perez <fperez@colorado.edu>
5368 2002-05-18 Fernando Perez <fperez@colorado.edu>
5363
5369
5364 * IPython/ColorANSI.py: Split the coloring tools into a separate
5370 * IPython/ColorANSI.py: Split the coloring tools into a separate
5365 module so I can use them in other code easier (they were part of
5371 module so I can use them in other code easier (they were part of
5366 ultraTB).
5372 ultraTB).
5367
5373
5368 2002-05-17 Fernando Perez <fperez@colorado.edu>
5374 2002-05-17 Fernando Perez <fperez@colorado.edu>
5369
5375
5370 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5376 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5371 fixed it to set the global 'g' also to the called instance, as
5377 fixed it to set the global 'g' also to the called instance, as
5372 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5378 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5373 user's 'g' variables).
5379 user's 'g' variables).
5374
5380
5375 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5381 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5376 global variables (aliases to _ih,_oh) so that users which expect
5382 global variables (aliases to _ih,_oh) so that users which expect
5377 In[5] or Out[7] to work aren't unpleasantly surprised.
5383 In[5] or Out[7] to work aren't unpleasantly surprised.
5378 (InputList.__getslice__): new class to allow executing slices of
5384 (InputList.__getslice__): new class to allow executing slices of
5379 input history directly. Very simple class, complements the use of
5385 input history directly. Very simple class, complements the use of
5380 macros.
5386 macros.
5381
5387
5382 2002-05-16 Fernando Perez <fperez@colorado.edu>
5388 2002-05-16 Fernando Perez <fperez@colorado.edu>
5383
5389
5384 * setup.py (docdirbase): make doc directory be just doc/IPython
5390 * setup.py (docdirbase): make doc directory be just doc/IPython
5385 without version numbers, it will reduce clutter for users.
5391 without version numbers, it will reduce clutter for users.
5386
5392
5387 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5393 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5388 execfile call to prevent possible memory leak. See for details:
5394 execfile call to prevent possible memory leak. See for details:
5389 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5395 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5390
5396
5391 2002-05-15 Fernando Perez <fperez@colorado.edu>
5397 2002-05-15 Fernando Perez <fperez@colorado.edu>
5392
5398
5393 * IPython/Magic.py (Magic.magic_psource): made the object
5399 * IPython/Magic.py (Magic.magic_psource): made the object
5394 introspection names be more standard: pdoc, pdef, pfile and
5400 introspection names be more standard: pdoc, pdef, pfile and
5395 psource. They all print/page their output, and it makes
5401 psource. They all print/page their output, and it makes
5396 remembering them easier. Kept old names for compatibility as
5402 remembering them easier. Kept old names for compatibility as
5397 aliases.
5403 aliases.
5398
5404
5399 2002-05-14 Fernando Perez <fperez@colorado.edu>
5405 2002-05-14 Fernando Perez <fperez@colorado.edu>
5400
5406
5401 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5407 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5402 what the mouse problem was. The trick is to use gnuplot with temp
5408 what the mouse problem was. The trick is to use gnuplot with temp
5403 files and NOT with pipes (for data communication), because having
5409 files and NOT with pipes (for data communication), because having
5404 both pipes and the mouse on is bad news.
5410 both pipes and the mouse on is bad news.
5405
5411
5406 2002-05-13 Fernando Perez <fperez@colorado.edu>
5412 2002-05-13 Fernando Perez <fperez@colorado.edu>
5407
5413
5408 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5414 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5409 bug. Information would be reported about builtins even when
5415 bug. Information would be reported about builtins even when
5410 user-defined functions overrode them.
5416 user-defined functions overrode them.
5411
5417
5412 2002-05-11 Fernando Perez <fperez@colorado.edu>
5418 2002-05-11 Fernando Perez <fperez@colorado.edu>
5413
5419
5414 * IPython/__init__.py (__all__): removed FlexCompleter from
5420 * IPython/__init__.py (__all__): removed FlexCompleter from
5415 __all__ so that things don't fail in platforms without readline.
5421 __all__ so that things don't fail in platforms without readline.
5416
5422
5417 2002-05-10 Fernando Perez <fperez@colorado.edu>
5423 2002-05-10 Fernando Perez <fperez@colorado.edu>
5418
5424
5419 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5425 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5420 it requires Numeric, effectively making Numeric a dependency for
5426 it requires Numeric, effectively making Numeric a dependency for
5421 IPython.
5427 IPython.
5422
5428
5423 * Released 0.2.13
5429 * Released 0.2.13
5424
5430
5425 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5431 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5426 profiler interface. Now all the major options from the profiler
5432 profiler interface. Now all the major options from the profiler
5427 module are directly supported in IPython, both for single
5433 module are directly supported in IPython, both for single
5428 expressions (@prun) and for full programs (@run -p).
5434 expressions (@prun) and for full programs (@run -p).
5429
5435
5430 2002-05-09 Fernando Perez <fperez@colorado.edu>
5436 2002-05-09 Fernando Perez <fperez@colorado.edu>
5431
5437
5432 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5438 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5433 magic properly formatted for screen.
5439 magic properly formatted for screen.
5434
5440
5435 * setup.py (make_shortcut): Changed things to put pdf version in
5441 * setup.py (make_shortcut): Changed things to put pdf version in
5436 doc/ instead of doc/manual (had to change lyxport a bit).
5442 doc/ instead of doc/manual (had to change lyxport a bit).
5437
5443
5438 * IPython/Magic.py (Profile.string_stats): made profile runs go
5444 * IPython/Magic.py (Profile.string_stats): made profile runs go
5439 through pager (they are long and a pager allows searching, saving,
5445 through pager (they are long and a pager allows searching, saving,
5440 etc.)
5446 etc.)
5441
5447
5442 2002-05-08 Fernando Perez <fperez@colorado.edu>
5448 2002-05-08 Fernando Perez <fperez@colorado.edu>
5443
5449
5444 * Released 0.2.12
5450 * Released 0.2.12
5445
5451
5446 2002-05-06 Fernando Perez <fperez@colorado.edu>
5452 2002-05-06 Fernando Perez <fperez@colorado.edu>
5447
5453
5448 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5454 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5449 introduced); 'hist n1 n2' was broken.
5455 introduced); 'hist n1 n2' was broken.
5450 (Magic.magic_pdb): added optional on/off arguments to @pdb
5456 (Magic.magic_pdb): added optional on/off arguments to @pdb
5451 (Magic.magic_run): added option -i to @run, which executes code in
5457 (Magic.magic_run): added option -i to @run, which executes code in
5452 the IPython namespace instead of a clean one. Also added @irun as
5458 the IPython namespace instead of a clean one. Also added @irun as
5453 an alias to @run -i.
5459 an alias to @run -i.
5454
5460
5455 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5461 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5456 fixed (it didn't really do anything, the namespaces were wrong).
5462 fixed (it didn't really do anything, the namespaces were wrong).
5457
5463
5458 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5464 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5459
5465
5460 * IPython/__init__.py (__all__): Fixed package namespace, now
5466 * IPython/__init__.py (__all__): Fixed package namespace, now
5461 'import IPython' does give access to IPython.<all> as
5467 'import IPython' does give access to IPython.<all> as
5462 expected. Also renamed __release__ to Release.
5468 expected. Also renamed __release__ to Release.
5463
5469
5464 * IPython/Debugger.py (__license__): created new Pdb class which
5470 * IPython/Debugger.py (__license__): created new Pdb class which
5465 functions like a drop-in for the normal pdb.Pdb but does NOT
5471 functions like a drop-in for the normal pdb.Pdb but does NOT
5466 import readline by default. This way it doesn't muck up IPython's
5472 import readline by default. This way it doesn't muck up IPython's
5467 readline handling, and now tab-completion finally works in the
5473 readline handling, and now tab-completion finally works in the
5468 debugger -- sort of. It completes things globally visible, but the
5474 debugger -- sort of. It completes things globally visible, but the
5469 completer doesn't track the stack as pdb walks it. That's a bit
5475 completer doesn't track the stack as pdb walks it. That's a bit
5470 tricky, and I'll have to implement it later.
5476 tricky, and I'll have to implement it later.
5471
5477
5472 2002-05-05 Fernando Perez <fperez@colorado.edu>
5478 2002-05-05 Fernando Perez <fperez@colorado.edu>
5473
5479
5474 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5480 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5475 magic docstrings when printed via ? (explicit \'s were being
5481 magic docstrings when printed via ? (explicit \'s were being
5476 printed).
5482 printed).
5477
5483
5478 * IPython/ipmaker.py (make_IPython): fixed namespace
5484 * IPython/ipmaker.py (make_IPython): fixed namespace
5479 identification bug. Now variables loaded via logs or command-line
5485 identification bug. Now variables loaded via logs or command-line
5480 files are recognized in the interactive namespace by @who.
5486 files are recognized in the interactive namespace by @who.
5481
5487
5482 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5488 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5483 log replay system stemming from the string form of Structs.
5489 log replay system stemming from the string form of Structs.
5484
5490
5485 * IPython/Magic.py (Macro.__init__): improved macros to properly
5491 * IPython/Magic.py (Macro.__init__): improved macros to properly
5486 handle magic commands in them.
5492 handle magic commands in them.
5487 (Magic.magic_logstart): usernames are now expanded so 'logstart
5493 (Magic.magic_logstart): usernames are now expanded so 'logstart
5488 ~/mylog' now works.
5494 ~/mylog' now works.
5489
5495
5490 * IPython/iplib.py (complete): fixed bug where paths starting with
5496 * IPython/iplib.py (complete): fixed bug where paths starting with
5491 '/' would be completed as magic names.
5497 '/' would be completed as magic names.
5492
5498
5493 2002-05-04 Fernando Perez <fperez@colorado.edu>
5499 2002-05-04 Fernando Perez <fperez@colorado.edu>
5494
5500
5495 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5501 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5496 allow running full programs under the profiler's control.
5502 allow running full programs under the profiler's control.
5497
5503
5498 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5504 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5499 mode to report exceptions verbosely but without formatting
5505 mode to report exceptions verbosely but without formatting
5500 variables. This addresses the issue of ipython 'freezing' (it's
5506 variables. This addresses the issue of ipython 'freezing' (it's
5501 not frozen, but caught in an expensive formatting loop) when huge
5507 not frozen, but caught in an expensive formatting loop) when huge
5502 variables are in the context of an exception.
5508 variables are in the context of an exception.
5503 (VerboseTB.text): Added '--->' markers at line where exception was
5509 (VerboseTB.text): Added '--->' markers at line where exception was
5504 triggered. Much clearer to read, especially in NoColor modes.
5510 triggered. Much clearer to read, especially in NoColor modes.
5505
5511
5506 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5512 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5507 implemented in reverse when changing to the new parse_options().
5513 implemented in reverse when changing to the new parse_options().
5508
5514
5509 2002-05-03 Fernando Perez <fperez@colorado.edu>
5515 2002-05-03 Fernando Perez <fperez@colorado.edu>
5510
5516
5511 * IPython/Magic.py (Magic.parse_options): new function so that
5517 * IPython/Magic.py (Magic.parse_options): new function so that
5512 magics can parse options easier.
5518 magics can parse options easier.
5513 (Magic.magic_prun): new function similar to profile.run(),
5519 (Magic.magic_prun): new function similar to profile.run(),
5514 suggested by Chris Hart.
5520 suggested by Chris Hart.
5515 (Magic.magic_cd): fixed behavior so that it only changes if
5521 (Magic.magic_cd): fixed behavior so that it only changes if
5516 directory actually is in history.
5522 directory actually is in history.
5517
5523
5518 * IPython/usage.py (__doc__): added information about potential
5524 * IPython/usage.py (__doc__): added information about potential
5519 slowness of Verbose exception mode when there are huge data
5525 slowness of Verbose exception mode when there are huge data
5520 structures to be formatted (thanks to Archie Paulson).
5526 structures to be formatted (thanks to Archie Paulson).
5521
5527
5522 * IPython/ipmaker.py (make_IPython): Changed default logging
5528 * IPython/ipmaker.py (make_IPython): Changed default logging
5523 (when simply called with -log) to use curr_dir/ipython.log in
5529 (when simply called with -log) to use curr_dir/ipython.log in
5524 rotate mode. Fixed crash which was occuring with -log before
5530 rotate mode. Fixed crash which was occuring with -log before
5525 (thanks to Jim Boyle).
5531 (thanks to Jim Boyle).
5526
5532
5527 2002-05-01 Fernando Perez <fperez@colorado.edu>
5533 2002-05-01 Fernando Perez <fperez@colorado.edu>
5528
5534
5529 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5535 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5530 was nasty -- though somewhat of a corner case).
5536 was nasty -- though somewhat of a corner case).
5531
5537
5532 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5538 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5533 text (was a bug).
5539 text (was a bug).
5534
5540
5535 2002-04-30 Fernando Perez <fperez@colorado.edu>
5541 2002-04-30 Fernando Perez <fperez@colorado.edu>
5536
5542
5537 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5543 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5538 a print after ^D or ^C from the user so that the In[] prompt
5544 a print after ^D or ^C from the user so that the In[] prompt
5539 doesn't over-run the gnuplot one.
5545 doesn't over-run the gnuplot one.
5540
5546
5541 2002-04-29 Fernando Perez <fperez@colorado.edu>
5547 2002-04-29 Fernando Perez <fperez@colorado.edu>
5542
5548
5543 * Released 0.2.10
5549 * Released 0.2.10
5544
5550
5545 * IPython/__release__.py (version): get date dynamically.
5551 * IPython/__release__.py (version): get date dynamically.
5546
5552
5547 * Misc. documentation updates thanks to Arnd's comments. Also ran
5553 * Misc. documentation updates thanks to Arnd's comments. Also ran
5548 a full spellcheck on the manual (hadn't been done in a while).
5554 a full spellcheck on the manual (hadn't been done in a while).
5549
5555
5550 2002-04-27 Fernando Perez <fperez@colorado.edu>
5556 2002-04-27 Fernando Perez <fperez@colorado.edu>
5551
5557
5552 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5558 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5553 starting a log in mid-session would reset the input history list.
5559 starting a log in mid-session would reset the input history list.
5554
5560
5555 2002-04-26 Fernando Perez <fperez@colorado.edu>
5561 2002-04-26 Fernando Perez <fperez@colorado.edu>
5556
5562
5557 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5563 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5558 all files were being included in an update. Now anything in
5564 all files were being included in an update. Now anything in
5559 UserConfig that matches [A-Za-z]*.py will go (this excludes
5565 UserConfig that matches [A-Za-z]*.py will go (this excludes
5560 __init__.py)
5566 __init__.py)
5561
5567
5562 2002-04-25 Fernando Perez <fperez@colorado.edu>
5568 2002-04-25 Fernando Perez <fperez@colorado.edu>
5563
5569
5564 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5570 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5565 to __builtins__ so that any form of embedded or imported code can
5571 to __builtins__ so that any form of embedded or imported code can
5566 test for being inside IPython.
5572 test for being inside IPython.
5567
5573
5568 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5574 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5569 changed to GnuplotMagic because it's now an importable module,
5575 changed to GnuplotMagic because it's now an importable module,
5570 this makes the name follow that of the standard Gnuplot module.
5576 this makes the name follow that of the standard Gnuplot module.
5571 GnuplotMagic can now be loaded at any time in mid-session.
5577 GnuplotMagic can now be loaded at any time in mid-session.
5572
5578
5573 2002-04-24 Fernando Perez <fperez@colorado.edu>
5579 2002-04-24 Fernando Perez <fperez@colorado.edu>
5574
5580
5575 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5581 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5576 the globals (IPython has its own namespace) and the
5582 the globals (IPython has its own namespace) and the
5577 PhysicalQuantity stuff is much better anyway.
5583 PhysicalQuantity stuff is much better anyway.
5578
5584
5579 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5585 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5580 embedding example to standard user directory for
5586 embedding example to standard user directory for
5581 distribution. Also put it in the manual.
5587 distribution. Also put it in the manual.
5582
5588
5583 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5589 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5584 instance as first argument (so it doesn't rely on some obscure
5590 instance as first argument (so it doesn't rely on some obscure
5585 hidden global).
5591 hidden global).
5586
5592
5587 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5593 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5588 delimiters. While it prevents ().TAB from working, it allows
5594 delimiters. While it prevents ().TAB from working, it allows
5589 completions in open (... expressions. This is by far a more common
5595 completions in open (... expressions. This is by far a more common
5590 case.
5596 case.
5591
5597
5592 2002-04-23 Fernando Perez <fperez@colorado.edu>
5598 2002-04-23 Fernando Perez <fperez@colorado.edu>
5593
5599
5594 * IPython/Extensions/InterpreterPasteInput.py: new
5600 * IPython/Extensions/InterpreterPasteInput.py: new
5595 syntax-processing module for pasting lines with >>> or ... at the
5601 syntax-processing module for pasting lines with >>> or ... at the
5596 start.
5602 start.
5597
5603
5598 * IPython/Extensions/PhysicalQ_Interactive.py
5604 * IPython/Extensions/PhysicalQ_Interactive.py
5599 (PhysicalQuantityInteractive.__int__): fixed to work with either
5605 (PhysicalQuantityInteractive.__int__): fixed to work with either
5600 Numeric or math.
5606 Numeric or math.
5601
5607
5602 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5608 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5603 provided profiles. Now we have:
5609 provided profiles. Now we have:
5604 -math -> math module as * and cmath with its own namespace.
5610 -math -> math module as * and cmath with its own namespace.
5605 -numeric -> Numeric as *, plus gnuplot & grace
5611 -numeric -> Numeric as *, plus gnuplot & grace
5606 -physics -> same as before
5612 -physics -> same as before
5607
5613
5608 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5614 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5609 user-defined magics wouldn't be found by @magic if they were
5615 user-defined magics wouldn't be found by @magic if they were
5610 defined as class methods. Also cleaned up the namespace search
5616 defined as class methods. Also cleaned up the namespace search
5611 logic and the string building (to use %s instead of many repeated
5617 logic and the string building (to use %s instead of many repeated
5612 string adds).
5618 string adds).
5613
5619
5614 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5620 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5615 of user-defined magics to operate with class methods (cleaner, in
5621 of user-defined magics to operate with class methods (cleaner, in
5616 line with the gnuplot code).
5622 line with the gnuplot code).
5617
5623
5618 2002-04-22 Fernando Perez <fperez@colorado.edu>
5624 2002-04-22 Fernando Perez <fperez@colorado.edu>
5619
5625
5620 * setup.py: updated dependency list so that manual is updated when
5626 * setup.py: updated dependency list so that manual is updated when
5621 all included files change.
5627 all included files change.
5622
5628
5623 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5629 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5624 the delimiter removal option (the fix is ugly right now).
5630 the delimiter removal option (the fix is ugly right now).
5625
5631
5626 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5632 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5627 all of the math profile (quicker loading, no conflict between
5633 all of the math profile (quicker loading, no conflict between
5628 g-9.8 and g-gnuplot).
5634 g-9.8 and g-gnuplot).
5629
5635
5630 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5636 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5631 name of post-mortem files to IPython_crash_report.txt.
5637 name of post-mortem files to IPython_crash_report.txt.
5632
5638
5633 * Cleanup/update of the docs. Added all the new readline info and
5639 * Cleanup/update of the docs. Added all the new readline info and
5634 formatted all lists as 'real lists'.
5640 formatted all lists as 'real lists'.
5635
5641
5636 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5642 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5637 tab-completion options, since the full readline parse_and_bind is
5643 tab-completion options, since the full readline parse_and_bind is
5638 now accessible.
5644 now accessible.
5639
5645
5640 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5646 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5641 handling of readline options. Now users can specify any string to
5647 handling of readline options. Now users can specify any string to
5642 be passed to parse_and_bind(), as well as the delimiters to be
5648 be passed to parse_and_bind(), as well as the delimiters to be
5643 removed.
5649 removed.
5644 (InteractiveShell.__init__): Added __name__ to the global
5650 (InteractiveShell.__init__): Added __name__ to the global
5645 namespace so that things like Itpl which rely on its existence
5651 namespace so that things like Itpl which rely on its existence
5646 don't crash.
5652 don't crash.
5647 (InteractiveShell._prefilter): Defined the default with a _ so
5653 (InteractiveShell._prefilter): Defined the default with a _ so
5648 that prefilter() is easier to override, while the default one
5654 that prefilter() is easier to override, while the default one
5649 remains available.
5655 remains available.
5650
5656
5651 2002-04-18 Fernando Perez <fperez@colorado.edu>
5657 2002-04-18 Fernando Perez <fperez@colorado.edu>
5652
5658
5653 * Added information about pdb in the docs.
5659 * Added information about pdb in the docs.
5654
5660
5655 2002-04-17 Fernando Perez <fperez@colorado.edu>
5661 2002-04-17 Fernando Perez <fperez@colorado.edu>
5656
5662
5657 * IPython/ipmaker.py (make_IPython): added rc_override option to
5663 * IPython/ipmaker.py (make_IPython): added rc_override option to
5658 allow passing config options at creation time which may override
5664 allow passing config options at creation time which may override
5659 anything set in the config files or command line. This is
5665 anything set in the config files or command line. This is
5660 particularly useful for configuring embedded instances.
5666 particularly useful for configuring embedded instances.
5661
5667
5662 2002-04-15 Fernando Perez <fperez@colorado.edu>
5668 2002-04-15 Fernando Perez <fperez@colorado.edu>
5663
5669
5664 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5670 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5665 crash embedded instances because of the input cache falling out of
5671 crash embedded instances because of the input cache falling out of
5666 sync with the output counter.
5672 sync with the output counter.
5667
5673
5668 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5674 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5669 mode which calls pdb after an uncaught exception in IPython itself.
5675 mode which calls pdb after an uncaught exception in IPython itself.
5670
5676
5671 2002-04-14 Fernando Perez <fperez@colorado.edu>
5677 2002-04-14 Fernando Perez <fperez@colorado.edu>
5672
5678
5673 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5679 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5674 readline, fix it back after each call.
5680 readline, fix it back after each call.
5675
5681
5676 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5682 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5677 method to force all access via __call__(), which guarantees that
5683 method to force all access via __call__(), which guarantees that
5678 traceback references are properly deleted.
5684 traceback references are properly deleted.
5679
5685
5680 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5686 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5681 improve printing when pprint is in use.
5687 improve printing when pprint is in use.
5682
5688
5683 2002-04-13 Fernando Perez <fperez@colorado.edu>
5689 2002-04-13 Fernando Perez <fperez@colorado.edu>
5684
5690
5685 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5691 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5686 exceptions aren't caught anymore. If the user triggers one, he
5692 exceptions aren't caught anymore. If the user triggers one, he
5687 should know why he's doing it and it should go all the way up,
5693 should know why he's doing it and it should go all the way up,
5688 just like any other exception. So now @abort will fully kill the
5694 just like any other exception. So now @abort will fully kill the
5689 embedded interpreter and the embedding code (unless that happens
5695 embedded interpreter and the embedding code (unless that happens
5690 to catch SystemExit).
5696 to catch SystemExit).
5691
5697
5692 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5698 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5693 and a debugger() method to invoke the interactive pdb debugger
5699 and a debugger() method to invoke the interactive pdb debugger
5694 after printing exception information. Also added the corresponding
5700 after printing exception information. Also added the corresponding
5695 -pdb option and @pdb magic to control this feature, and updated
5701 -pdb option and @pdb magic to control this feature, and updated
5696 the docs. After a suggestion from Christopher Hart
5702 the docs. After a suggestion from Christopher Hart
5697 (hart-AT-caltech.edu).
5703 (hart-AT-caltech.edu).
5698
5704
5699 2002-04-12 Fernando Perez <fperez@colorado.edu>
5705 2002-04-12 Fernando Perez <fperez@colorado.edu>
5700
5706
5701 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5707 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5702 the exception handlers defined by the user (not the CrashHandler)
5708 the exception handlers defined by the user (not the CrashHandler)
5703 so that user exceptions don't trigger an ipython bug report.
5709 so that user exceptions don't trigger an ipython bug report.
5704
5710
5705 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5711 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5706 configurable (it should have always been so).
5712 configurable (it should have always been so).
5707
5713
5708 2002-03-26 Fernando Perez <fperez@colorado.edu>
5714 2002-03-26 Fernando Perez <fperez@colorado.edu>
5709
5715
5710 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5716 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5711 and there to fix embedding namespace issues. This should all be
5717 and there to fix embedding namespace issues. This should all be
5712 done in a more elegant way.
5718 done in a more elegant way.
5713
5719
5714 2002-03-25 Fernando Perez <fperez@colorado.edu>
5720 2002-03-25 Fernando Perez <fperez@colorado.edu>
5715
5721
5716 * IPython/genutils.py (get_home_dir): Try to make it work under
5722 * IPython/genutils.py (get_home_dir): Try to make it work under
5717 win9x also.
5723 win9x also.
5718
5724
5719 2002-03-20 Fernando Perez <fperez@colorado.edu>
5725 2002-03-20 Fernando Perez <fperez@colorado.edu>
5720
5726
5721 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5727 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5722 sys.displayhook untouched upon __init__.
5728 sys.displayhook untouched upon __init__.
5723
5729
5724 2002-03-19 Fernando Perez <fperez@colorado.edu>
5730 2002-03-19 Fernando Perez <fperez@colorado.edu>
5725
5731
5726 * Released 0.2.9 (for embedding bug, basically).
5732 * Released 0.2.9 (for embedding bug, basically).
5727
5733
5728 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5734 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5729 exceptions so that enclosing shell's state can be restored.
5735 exceptions so that enclosing shell's state can be restored.
5730
5736
5731 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5737 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5732 naming conventions in the .ipython/ dir.
5738 naming conventions in the .ipython/ dir.
5733
5739
5734 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5740 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5735 from delimiters list so filenames with - in them get expanded.
5741 from delimiters list so filenames with - in them get expanded.
5736
5742
5737 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5743 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5738 sys.displayhook not being properly restored after an embedded call.
5744 sys.displayhook not being properly restored after an embedded call.
5739
5745
5740 2002-03-18 Fernando Perez <fperez@colorado.edu>
5746 2002-03-18 Fernando Perez <fperez@colorado.edu>
5741
5747
5742 * Released 0.2.8
5748 * Released 0.2.8
5743
5749
5744 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5750 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5745 some files weren't being included in a -upgrade.
5751 some files weren't being included in a -upgrade.
5746 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5752 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5747 on' so that the first tab completes.
5753 on' so that the first tab completes.
5748 (InteractiveShell.handle_magic): fixed bug with spaces around
5754 (InteractiveShell.handle_magic): fixed bug with spaces around
5749 quotes breaking many magic commands.
5755 quotes breaking many magic commands.
5750
5756
5751 * setup.py: added note about ignoring the syntax error messages at
5757 * setup.py: added note about ignoring the syntax error messages at
5752 installation.
5758 installation.
5753
5759
5754 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5760 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5755 streamlining the gnuplot interface, now there's only one magic @gp.
5761 streamlining the gnuplot interface, now there's only one magic @gp.
5756
5762
5757 2002-03-17 Fernando Perez <fperez@colorado.edu>
5763 2002-03-17 Fernando Perez <fperez@colorado.edu>
5758
5764
5759 * IPython/UserConfig/magic_gnuplot.py: new name for the
5765 * IPython/UserConfig/magic_gnuplot.py: new name for the
5760 example-magic_pm.py file. Much enhanced system, now with a shell
5766 example-magic_pm.py file. Much enhanced system, now with a shell
5761 for communicating directly with gnuplot, one command at a time.
5767 for communicating directly with gnuplot, one command at a time.
5762
5768
5763 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5769 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5764 setting __name__=='__main__'.
5770 setting __name__=='__main__'.
5765
5771
5766 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5772 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5767 mini-shell for accessing gnuplot from inside ipython. Should
5773 mini-shell for accessing gnuplot from inside ipython. Should
5768 extend it later for grace access too. Inspired by Arnd's
5774 extend it later for grace access too. Inspired by Arnd's
5769 suggestion.
5775 suggestion.
5770
5776
5771 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5777 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5772 calling magic functions with () in their arguments. Thanks to Arnd
5778 calling magic functions with () in their arguments. Thanks to Arnd
5773 Baecker for pointing this to me.
5779 Baecker for pointing this to me.
5774
5780
5775 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5781 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5776 infinitely for integer or complex arrays (only worked with floats).
5782 infinitely for integer or complex arrays (only worked with floats).
5777
5783
5778 2002-03-16 Fernando Perez <fperez@colorado.edu>
5784 2002-03-16 Fernando Perez <fperez@colorado.edu>
5779
5785
5780 * setup.py: Merged setup and setup_windows into a single script
5786 * setup.py: Merged setup and setup_windows into a single script
5781 which properly handles things for windows users.
5787 which properly handles things for windows users.
5782
5788
5783 2002-03-15 Fernando Perez <fperez@colorado.edu>
5789 2002-03-15 Fernando Perez <fperez@colorado.edu>
5784
5790
5785 * Big change to the manual: now the magics are all automatically
5791 * Big change to the manual: now the magics are all automatically
5786 documented. This information is generated from their docstrings
5792 documented. This information is generated from their docstrings
5787 and put in a latex file included by the manual lyx file. This way
5793 and put in a latex file included by the manual lyx file. This way
5788 we get always up to date information for the magics. The manual
5794 we get always up to date information for the magics. The manual
5789 now also has proper version information, also auto-synced.
5795 now also has proper version information, also auto-synced.
5790
5796
5791 For this to work, an undocumented --magic_docstrings option was added.
5797 For this to work, an undocumented --magic_docstrings option was added.
5792
5798
5793 2002-03-13 Fernando Perez <fperez@colorado.edu>
5799 2002-03-13 Fernando Perez <fperez@colorado.edu>
5794
5800
5795 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5801 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5796 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5802 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5797
5803
5798 2002-03-12 Fernando Perez <fperez@colorado.edu>
5804 2002-03-12 Fernando Perez <fperez@colorado.edu>
5799
5805
5800 * IPython/ultraTB.py (TermColors): changed color escapes again to
5806 * IPython/ultraTB.py (TermColors): changed color escapes again to
5801 fix the (old, reintroduced) line-wrapping bug. Basically, if
5807 fix the (old, reintroduced) line-wrapping bug. Basically, if
5802 \001..\002 aren't given in the color escapes, lines get wrapped
5808 \001..\002 aren't given in the color escapes, lines get wrapped
5803 weirdly. But giving those screws up old xterms and emacs terms. So
5809 weirdly. But giving those screws up old xterms and emacs terms. So
5804 I added some logic for emacs terms to be ok, but I can't identify old
5810 I added some logic for emacs terms to be ok, but I can't identify old
5805 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5811 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5806
5812
5807 2002-03-10 Fernando Perez <fperez@colorado.edu>
5813 2002-03-10 Fernando Perez <fperez@colorado.edu>
5808
5814
5809 * IPython/usage.py (__doc__): Various documentation cleanups and
5815 * IPython/usage.py (__doc__): Various documentation cleanups and
5810 updates, both in usage docstrings and in the manual.
5816 updates, both in usage docstrings and in the manual.
5811
5817
5812 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5818 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5813 handling of caching. Set minimum acceptabe value for having a
5819 handling of caching. Set minimum acceptabe value for having a
5814 cache at 20 values.
5820 cache at 20 values.
5815
5821
5816 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5822 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5817 install_first_time function to a method, renamed it and added an
5823 install_first_time function to a method, renamed it and added an
5818 'upgrade' mode. Now people can update their config directory with
5824 'upgrade' mode. Now people can update their config directory with
5819 a simple command line switch (-upgrade, also new).
5825 a simple command line switch (-upgrade, also new).
5820
5826
5821 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5827 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5822 @file (convenient for automagic users under Python >= 2.2).
5828 @file (convenient for automagic users under Python >= 2.2).
5823 Removed @files (it seemed more like a plural than an abbrev. of
5829 Removed @files (it seemed more like a plural than an abbrev. of
5824 'file show').
5830 'file show').
5825
5831
5826 * IPython/iplib.py (install_first_time): Fixed crash if there were
5832 * IPython/iplib.py (install_first_time): Fixed crash if there were
5827 backup files ('~') in .ipython/ install directory.
5833 backup files ('~') in .ipython/ install directory.
5828
5834
5829 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5835 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5830 system. Things look fine, but these changes are fairly
5836 system. Things look fine, but these changes are fairly
5831 intrusive. Test them for a few days.
5837 intrusive. Test them for a few days.
5832
5838
5833 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5839 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5834 the prompts system. Now all in/out prompt strings are user
5840 the prompts system. Now all in/out prompt strings are user
5835 controllable. This is particularly useful for embedding, as one
5841 controllable. This is particularly useful for embedding, as one
5836 can tag embedded instances with particular prompts.
5842 can tag embedded instances with particular prompts.
5837
5843
5838 Also removed global use of sys.ps1/2, which now allows nested
5844 Also removed global use of sys.ps1/2, which now allows nested
5839 embeddings without any problems. Added command-line options for
5845 embeddings without any problems. Added command-line options for
5840 the prompt strings.
5846 the prompt strings.
5841
5847
5842 2002-03-08 Fernando Perez <fperez@colorado.edu>
5848 2002-03-08 Fernando Perez <fperez@colorado.edu>
5843
5849
5844 * IPython/UserConfig/example-embed-short.py (ipshell): added
5850 * IPython/UserConfig/example-embed-short.py (ipshell): added
5845 example file with the bare minimum code for embedding.
5851 example file with the bare minimum code for embedding.
5846
5852
5847 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5853 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5848 functionality for the embeddable shell to be activated/deactivated
5854 functionality for the embeddable shell to be activated/deactivated
5849 either globally or at each call.
5855 either globally or at each call.
5850
5856
5851 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5857 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5852 rewriting the prompt with '--->' for auto-inputs with proper
5858 rewriting the prompt with '--->' for auto-inputs with proper
5853 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5859 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5854 this is handled by the prompts class itself, as it should.
5860 this is handled by the prompts class itself, as it should.
5855
5861
5856 2002-03-05 Fernando Perez <fperez@colorado.edu>
5862 2002-03-05 Fernando Perez <fperez@colorado.edu>
5857
5863
5858 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5864 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5859 @logstart to avoid name clashes with the math log function.
5865 @logstart to avoid name clashes with the math log function.
5860
5866
5861 * Big updates to X/Emacs section of the manual.
5867 * Big updates to X/Emacs section of the manual.
5862
5868
5863 * Removed ipython_emacs. Milan explained to me how to pass
5869 * Removed ipython_emacs. Milan explained to me how to pass
5864 arguments to ipython through Emacs. Some day I'm going to end up
5870 arguments to ipython through Emacs. Some day I'm going to end up
5865 learning some lisp...
5871 learning some lisp...
5866
5872
5867 2002-03-04 Fernando Perez <fperez@colorado.edu>
5873 2002-03-04 Fernando Perez <fperez@colorado.edu>
5868
5874
5869 * IPython/ipython_emacs: Created script to be used as the
5875 * IPython/ipython_emacs: Created script to be used as the
5870 py-python-command Emacs variable so we can pass IPython
5876 py-python-command Emacs variable so we can pass IPython
5871 parameters. I can't figure out how to tell Emacs directly to pass
5877 parameters. I can't figure out how to tell Emacs directly to pass
5872 parameters to IPython, so a dummy shell script will do it.
5878 parameters to IPython, so a dummy shell script will do it.
5873
5879
5874 Other enhancements made for things to work better under Emacs'
5880 Other enhancements made for things to work better under Emacs'
5875 various types of terminals. Many thanks to Milan Zamazal
5881 various types of terminals. Many thanks to Milan Zamazal
5876 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5882 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5877
5883
5878 2002-03-01 Fernando Perez <fperez@colorado.edu>
5884 2002-03-01 Fernando Perez <fperez@colorado.edu>
5879
5885
5880 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5886 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5881 that loading of readline is now optional. This gives better
5887 that loading of readline is now optional. This gives better
5882 control to emacs users.
5888 control to emacs users.
5883
5889
5884 * IPython/ultraTB.py (__date__): Modified color escape sequences
5890 * IPython/ultraTB.py (__date__): Modified color escape sequences
5885 and now things work fine under xterm and in Emacs' term buffers
5891 and now things work fine under xterm and in Emacs' term buffers
5886 (though not shell ones). Well, in emacs you get colors, but all
5892 (though not shell ones). Well, in emacs you get colors, but all
5887 seem to be 'light' colors (no difference between dark and light
5893 seem to be 'light' colors (no difference between dark and light
5888 ones). But the garbage chars are gone, and also in xterms. It
5894 ones). But the garbage chars are gone, and also in xterms. It
5889 seems that now I'm using 'cleaner' ansi sequences.
5895 seems that now I'm using 'cleaner' ansi sequences.
5890
5896
5891 2002-02-21 Fernando Perez <fperez@colorado.edu>
5897 2002-02-21 Fernando Perez <fperez@colorado.edu>
5892
5898
5893 * Released 0.2.7 (mainly to publish the scoping fix).
5899 * Released 0.2.7 (mainly to publish the scoping fix).
5894
5900
5895 * IPython/Logger.py (Logger.logstate): added. A corresponding
5901 * IPython/Logger.py (Logger.logstate): added. A corresponding
5896 @logstate magic was created.
5902 @logstate magic was created.
5897
5903
5898 * IPython/Magic.py: fixed nested scoping problem under Python
5904 * IPython/Magic.py: fixed nested scoping problem under Python
5899 2.1.x (automagic wasn't working).
5905 2.1.x (automagic wasn't working).
5900
5906
5901 2002-02-20 Fernando Perez <fperez@colorado.edu>
5907 2002-02-20 Fernando Perez <fperez@colorado.edu>
5902
5908
5903 * Released 0.2.6.
5909 * Released 0.2.6.
5904
5910
5905 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5911 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5906 option so that logs can come out without any headers at all.
5912 option so that logs can come out without any headers at all.
5907
5913
5908 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5914 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5909 SciPy.
5915 SciPy.
5910
5916
5911 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5917 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5912 that embedded IPython calls don't require vars() to be explicitly
5918 that embedded IPython calls don't require vars() to be explicitly
5913 passed. Now they are extracted from the caller's frame (code
5919 passed. Now they are extracted from the caller's frame (code
5914 snatched from Eric Jones' weave). Added better documentation to
5920 snatched from Eric Jones' weave). Added better documentation to
5915 the section on embedding and the example file.
5921 the section on embedding and the example file.
5916
5922
5917 * IPython/genutils.py (page): Changed so that under emacs, it just
5923 * IPython/genutils.py (page): Changed so that under emacs, it just
5918 prints the string. You can then page up and down in the emacs
5924 prints the string. You can then page up and down in the emacs
5919 buffer itself. This is how the builtin help() works.
5925 buffer itself. This is how the builtin help() works.
5920
5926
5921 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5927 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5922 macro scoping: macros need to be executed in the user's namespace
5928 macro scoping: macros need to be executed in the user's namespace
5923 to work as if they had been typed by the user.
5929 to work as if they had been typed by the user.
5924
5930
5925 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5931 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5926 execute automatically (no need to type 'exec...'). They then
5932 execute automatically (no need to type 'exec...'). They then
5927 behave like 'true macros'. The printing system was also modified
5933 behave like 'true macros'. The printing system was also modified
5928 for this to work.
5934 for this to work.
5929
5935
5930 2002-02-19 Fernando Perez <fperez@colorado.edu>
5936 2002-02-19 Fernando Perez <fperez@colorado.edu>
5931
5937
5932 * IPython/genutils.py (page_file): new function for paging files
5938 * IPython/genutils.py (page_file): new function for paging files
5933 in an OS-independent way. Also necessary for file viewing to work
5939 in an OS-independent way. Also necessary for file viewing to work
5934 well inside Emacs buffers.
5940 well inside Emacs buffers.
5935 (page): Added checks for being in an emacs buffer.
5941 (page): Added checks for being in an emacs buffer.
5936 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5942 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5937 same bug in iplib.
5943 same bug in iplib.
5938
5944
5939 2002-02-18 Fernando Perez <fperez@colorado.edu>
5945 2002-02-18 Fernando Perez <fperez@colorado.edu>
5940
5946
5941 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5947 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5942 of readline so that IPython can work inside an Emacs buffer.
5948 of readline so that IPython can work inside an Emacs buffer.
5943
5949
5944 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5950 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5945 method signatures (they weren't really bugs, but it looks cleaner
5951 method signatures (they weren't really bugs, but it looks cleaner
5946 and keeps PyChecker happy).
5952 and keeps PyChecker happy).
5947
5953
5948 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5954 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5949 for implementing various user-defined hooks. Currently only
5955 for implementing various user-defined hooks. Currently only
5950 display is done.
5956 display is done.
5951
5957
5952 * IPython/Prompts.py (CachedOutput._display): changed display
5958 * IPython/Prompts.py (CachedOutput._display): changed display
5953 functions so that they can be dynamically changed by users easily.
5959 functions so that they can be dynamically changed by users easily.
5954
5960
5955 * IPython/Extensions/numeric_formats.py (num_display): added an
5961 * IPython/Extensions/numeric_formats.py (num_display): added an
5956 extension for printing NumPy arrays in flexible manners. It
5962 extension for printing NumPy arrays in flexible manners. It
5957 doesn't do anything yet, but all the structure is in
5963 doesn't do anything yet, but all the structure is in
5958 place. Ultimately the plan is to implement output format control
5964 place. Ultimately the plan is to implement output format control
5959 like in Octave.
5965 like in Octave.
5960
5966
5961 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5967 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5962 methods are found at run-time by all the automatic machinery.
5968 methods are found at run-time by all the automatic machinery.
5963
5969
5964 2002-02-17 Fernando Perez <fperez@colorado.edu>
5970 2002-02-17 Fernando Perez <fperez@colorado.edu>
5965
5971
5966 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5972 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5967 whole file a little.
5973 whole file a little.
5968
5974
5969 * ToDo: closed this document. Now there's a new_design.lyx
5975 * ToDo: closed this document. Now there's a new_design.lyx
5970 document for all new ideas. Added making a pdf of it for the
5976 document for all new ideas. Added making a pdf of it for the
5971 end-user distro.
5977 end-user distro.
5972
5978
5973 * IPython/Logger.py (Logger.switch_log): Created this to replace
5979 * IPython/Logger.py (Logger.switch_log): Created this to replace
5974 logon() and logoff(). It also fixes a nasty crash reported by
5980 logon() and logoff(). It also fixes a nasty crash reported by
5975 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5981 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5976
5982
5977 * IPython/iplib.py (complete): got auto-completion to work with
5983 * IPython/iplib.py (complete): got auto-completion to work with
5978 automagic (I had wanted this for a long time).
5984 automagic (I had wanted this for a long time).
5979
5985
5980 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5986 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5981 to @file, since file() is now a builtin and clashes with automagic
5987 to @file, since file() is now a builtin and clashes with automagic
5982 for @file.
5988 for @file.
5983
5989
5984 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5990 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5985 of this was previously in iplib, which had grown to more than 2000
5991 of this was previously in iplib, which had grown to more than 2000
5986 lines, way too long. No new functionality, but it makes managing
5992 lines, way too long. No new functionality, but it makes managing
5987 the code a bit easier.
5993 the code a bit easier.
5988
5994
5989 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5995 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5990 information to crash reports.
5996 information to crash reports.
5991
5997
5992 2002-02-12 Fernando Perez <fperez@colorado.edu>
5998 2002-02-12 Fernando Perez <fperez@colorado.edu>
5993
5999
5994 * Released 0.2.5.
6000 * Released 0.2.5.
5995
6001
5996 2002-02-11 Fernando Perez <fperez@colorado.edu>
6002 2002-02-11 Fernando Perez <fperez@colorado.edu>
5997
6003
5998 * Wrote a relatively complete Windows installer. It puts
6004 * Wrote a relatively complete Windows installer. It puts
5999 everything in place, creates Start Menu entries and fixes the
6005 everything in place, creates Start Menu entries and fixes the
6000 color issues. Nothing fancy, but it works.
6006 color issues. Nothing fancy, but it works.
6001
6007
6002 2002-02-10 Fernando Perez <fperez@colorado.edu>
6008 2002-02-10 Fernando Perez <fperez@colorado.edu>
6003
6009
6004 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6010 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6005 os.path.expanduser() call so that we can type @run ~/myfile.py and
6011 os.path.expanduser() call so that we can type @run ~/myfile.py and
6006 have thigs work as expected.
6012 have thigs work as expected.
6007
6013
6008 * IPython/genutils.py (page): fixed exception handling so things
6014 * IPython/genutils.py (page): fixed exception handling so things
6009 work both in Unix and Windows correctly. Quitting a pager triggers
6015 work both in Unix and Windows correctly. Quitting a pager triggers
6010 an IOError/broken pipe in Unix, and in windows not finding a pager
6016 an IOError/broken pipe in Unix, and in windows not finding a pager
6011 is also an IOError, so I had to actually look at the return value
6017 is also an IOError, so I had to actually look at the return value
6012 of the exception, not just the exception itself. Should be ok now.
6018 of the exception, not just the exception itself. Should be ok now.
6013
6019
6014 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6020 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6015 modified to allow case-insensitive color scheme changes.
6021 modified to allow case-insensitive color scheme changes.
6016
6022
6017 2002-02-09 Fernando Perez <fperez@colorado.edu>
6023 2002-02-09 Fernando Perez <fperez@colorado.edu>
6018
6024
6019 * IPython/genutils.py (native_line_ends): new function to leave
6025 * IPython/genutils.py (native_line_ends): new function to leave
6020 user config files with os-native line-endings.
6026 user config files with os-native line-endings.
6021
6027
6022 * README and manual updates.
6028 * README and manual updates.
6023
6029
6024 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6030 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6025 instead of StringType to catch Unicode strings.
6031 instead of StringType to catch Unicode strings.
6026
6032
6027 * IPython/genutils.py (filefind): fixed bug for paths with
6033 * IPython/genutils.py (filefind): fixed bug for paths with
6028 embedded spaces (very common in Windows).
6034 embedded spaces (very common in Windows).
6029
6035
6030 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6036 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6031 files under Windows, so that they get automatically associated
6037 files under Windows, so that they get automatically associated
6032 with a text editor. Windows makes it a pain to handle
6038 with a text editor. Windows makes it a pain to handle
6033 extension-less files.
6039 extension-less files.
6034
6040
6035 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6041 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6036 warning about readline only occur for Posix. In Windows there's no
6042 warning about readline only occur for Posix. In Windows there's no
6037 way to get readline, so why bother with the warning.
6043 way to get readline, so why bother with the warning.
6038
6044
6039 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6045 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6040 for __str__ instead of dir(self), since dir() changed in 2.2.
6046 for __str__ instead of dir(self), since dir() changed in 2.2.
6041
6047
6042 * Ported to Windows! Tested on XP, I suspect it should work fine
6048 * Ported to Windows! Tested on XP, I suspect it should work fine
6043 on NT/2000, but I don't think it will work on 98 et al. That
6049 on NT/2000, but I don't think it will work on 98 et al. That
6044 series of Windows is such a piece of junk anyway that I won't try
6050 series of Windows is such a piece of junk anyway that I won't try
6045 porting it there. The XP port was straightforward, showed a few
6051 porting it there. The XP port was straightforward, showed a few
6046 bugs here and there (fixed all), in particular some string
6052 bugs here and there (fixed all), in particular some string
6047 handling stuff which required considering Unicode strings (which
6053 handling stuff which required considering Unicode strings (which
6048 Windows uses). This is good, but hasn't been too tested :) No
6054 Windows uses). This is good, but hasn't been too tested :) No
6049 fancy installer yet, I'll put a note in the manual so people at
6055 fancy installer yet, I'll put a note in the manual so people at
6050 least make manually a shortcut.
6056 least make manually a shortcut.
6051
6057
6052 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6058 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6053 into a single one, "colors". This now controls both prompt and
6059 into a single one, "colors". This now controls both prompt and
6054 exception color schemes, and can be changed both at startup
6060 exception color schemes, and can be changed both at startup
6055 (either via command-line switches or via ipythonrc files) and at
6061 (either via command-line switches or via ipythonrc files) and at
6056 runtime, with @colors.
6062 runtime, with @colors.
6057 (Magic.magic_run): renamed @prun to @run and removed the old
6063 (Magic.magic_run): renamed @prun to @run and removed the old
6058 @run. The two were too similar to warrant keeping both.
6064 @run. The two were too similar to warrant keeping both.
6059
6065
6060 2002-02-03 Fernando Perez <fperez@colorado.edu>
6066 2002-02-03 Fernando Perez <fperez@colorado.edu>
6061
6067
6062 * IPython/iplib.py (install_first_time): Added comment on how to
6068 * IPython/iplib.py (install_first_time): Added comment on how to
6063 configure the color options for first-time users. Put a <return>
6069 configure the color options for first-time users. Put a <return>
6064 request at the end so that small-terminal users get a chance to
6070 request at the end so that small-terminal users get a chance to
6065 read the startup info.
6071 read the startup info.
6066
6072
6067 2002-01-23 Fernando Perez <fperez@colorado.edu>
6073 2002-01-23 Fernando Perez <fperez@colorado.edu>
6068
6074
6069 * IPython/iplib.py (CachedOutput.update): Changed output memory
6075 * IPython/iplib.py (CachedOutput.update): Changed output memory
6070 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6076 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6071 input history we still use _i. Did this b/c these variable are
6077 input history we still use _i. Did this b/c these variable are
6072 very commonly used in interactive work, so the less we need to
6078 very commonly used in interactive work, so the less we need to
6073 type the better off we are.
6079 type the better off we are.
6074 (Magic.magic_prun): updated @prun to better handle the namespaces
6080 (Magic.magic_prun): updated @prun to better handle the namespaces
6075 the file will run in, including a fix for __name__ not being set
6081 the file will run in, including a fix for __name__ not being set
6076 before.
6082 before.
6077
6083
6078 2002-01-20 Fernando Perez <fperez@colorado.edu>
6084 2002-01-20 Fernando Perez <fperez@colorado.edu>
6079
6085
6080 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6086 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6081 extra garbage for Python 2.2. Need to look more carefully into
6087 extra garbage for Python 2.2. Need to look more carefully into
6082 this later.
6088 this later.
6083
6089
6084 2002-01-19 Fernando Perez <fperez@colorado.edu>
6090 2002-01-19 Fernando Perez <fperez@colorado.edu>
6085
6091
6086 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6092 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6087 display SyntaxError exceptions properly formatted when they occur
6093 display SyntaxError exceptions properly formatted when they occur
6088 (they can be triggered by imported code).
6094 (they can be triggered by imported code).
6089
6095
6090 2002-01-18 Fernando Perez <fperez@colorado.edu>
6096 2002-01-18 Fernando Perez <fperez@colorado.edu>
6091
6097
6092 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6098 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6093 SyntaxError exceptions are reported nicely formatted, instead of
6099 SyntaxError exceptions are reported nicely formatted, instead of
6094 spitting out only offset information as before.
6100 spitting out only offset information as before.
6095 (Magic.magic_prun): Added the @prun function for executing
6101 (Magic.magic_prun): Added the @prun function for executing
6096 programs with command line args inside IPython.
6102 programs with command line args inside IPython.
6097
6103
6098 2002-01-16 Fernando Perez <fperez@colorado.edu>
6104 2002-01-16 Fernando Perez <fperez@colorado.edu>
6099
6105
6100 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6106 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6101 to *not* include the last item given in a range. This brings their
6107 to *not* include the last item given in a range. This brings their
6102 behavior in line with Python's slicing:
6108 behavior in line with Python's slicing:
6103 a[n1:n2] -> a[n1]...a[n2-1]
6109 a[n1:n2] -> a[n1]...a[n2-1]
6104 It may be a bit less convenient, but I prefer to stick to Python's
6110 It may be a bit less convenient, but I prefer to stick to Python's
6105 conventions *everywhere*, so users never have to wonder.
6111 conventions *everywhere*, so users never have to wonder.
6106 (Magic.magic_macro): Added @macro function to ease the creation of
6112 (Magic.magic_macro): Added @macro function to ease the creation of
6107 macros.
6113 macros.
6108
6114
6109 2002-01-05 Fernando Perez <fperez@colorado.edu>
6115 2002-01-05 Fernando Perez <fperez@colorado.edu>
6110
6116
6111 * Released 0.2.4.
6117 * Released 0.2.4.
6112
6118
6113 * IPython/iplib.py (Magic.magic_pdef):
6119 * IPython/iplib.py (Magic.magic_pdef):
6114 (InteractiveShell.safe_execfile): report magic lines and error
6120 (InteractiveShell.safe_execfile): report magic lines and error
6115 lines without line numbers so one can easily copy/paste them for
6121 lines without line numbers so one can easily copy/paste them for
6116 re-execution.
6122 re-execution.
6117
6123
6118 * Updated manual with recent changes.
6124 * Updated manual with recent changes.
6119
6125
6120 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6126 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6121 docstring printing when class? is called. Very handy for knowing
6127 docstring printing when class? is called. Very handy for knowing
6122 how to create class instances (as long as __init__ is well
6128 how to create class instances (as long as __init__ is well
6123 documented, of course :)
6129 documented, of course :)
6124 (Magic.magic_doc): print both class and constructor docstrings.
6130 (Magic.magic_doc): print both class and constructor docstrings.
6125 (Magic.magic_pdef): give constructor info if passed a class and
6131 (Magic.magic_pdef): give constructor info if passed a class and
6126 __call__ info for callable object instances.
6132 __call__ info for callable object instances.
6127
6133
6128 2002-01-04 Fernando Perez <fperez@colorado.edu>
6134 2002-01-04 Fernando Perez <fperez@colorado.edu>
6129
6135
6130 * Made deep_reload() off by default. It doesn't always work
6136 * Made deep_reload() off by default. It doesn't always work
6131 exactly as intended, so it's probably safer to have it off. It's
6137 exactly as intended, so it's probably safer to have it off. It's
6132 still available as dreload() anyway, so nothing is lost.
6138 still available as dreload() anyway, so nothing is lost.
6133
6139
6134 2002-01-02 Fernando Perez <fperez@colorado.edu>
6140 2002-01-02 Fernando Perez <fperez@colorado.edu>
6135
6141
6136 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6142 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6137 so I wanted an updated release).
6143 so I wanted an updated release).
6138
6144
6139 2001-12-27 Fernando Perez <fperez@colorado.edu>
6145 2001-12-27 Fernando Perez <fperez@colorado.edu>
6140
6146
6141 * IPython/iplib.py (InteractiveShell.interact): Added the original
6147 * IPython/iplib.py (InteractiveShell.interact): Added the original
6142 code from 'code.py' for this module in order to change the
6148 code from 'code.py' for this module in order to change the
6143 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6149 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6144 the history cache would break when the user hit Ctrl-C, and
6150 the history cache would break when the user hit Ctrl-C, and
6145 interact() offers no way to add any hooks to it.
6151 interact() offers no way to add any hooks to it.
6146
6152
6147 2001-12-23 Fernando Perez <fperez@colorado.edu>
6153 2001-12-23 Fernando Perez <fperez@colorado.edu>
6148
6154
6149 * setup.py: added check for 'MANIFEST' before trying to remove
6155 * setup.py: added check for 'MANIFEST' before trying to remove
6150 it. Thanks to Sean Reifschneider.
6156 it. Thanks to Sean Reifschneider.
6151
6157
6152 2001-12-22 Fernando Perez <fperez@colorado.edu>
6158 2001-12-22 Fernando Perez <fperez@colorado.edu>
6153
6159
6154 * Released 0.2.2.
6160 * Released 0.2.2.
6155
6161
6156 * Finished (reasonably) writing the manual. Later will add the
6162 * Finished (reasonably) writing the manual. Later will add the
6157 python-standard navigation stylesheets, but for the time being
6163 python-standard navigation stylesheets, but for the time being
6158 it's fairly complete. Distribution will include html and pdf
6164 it's fairly complete. Distribution will include html and pdf
6159 versions.
6165 versions.
6160
6166
6161 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6167 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6162 (MayaVi author).
6168 (MayaVi author).
6163
6169
6164 2001-12-21 Fernando Perez <fperez@colorado.edu>
6170 2001-12-21 Fernando Perez <fperez@colorado.edu>
6165
6171
6166 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6172 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6167 good public release, I think (with the manual and the distutils
6173 good public release, I think (with the manual and the distutils
6168 installer). The manual can use some work, but that can go
6174 installer). The manual can use some work, but that can go
6169 slowly. Otherwise I think it's quite nice for end users. Next
6175 slowly. Otherwise I think it's quite nice for end users. Next
6170 summer, rewrite the guts of it...
6176 summer, rewrite the guts of it...
6171
6177
6172 * Changed format of ipythonrc files to use whitespace as the
6178 * Changed format of ipythonrc files to use whitespace as the
6173 separator instead of an explicit '='. Cleaner.
6179 separator instead of an explicit '='. Cleaner.
6174
6180
6175 2001-12-20 Fernando Perez <fperez@colorado.edu>
6181 2001-12-20 Fernando Perez <fperez@colorado.edu>
6176
6182
6177 * Started a manual in LyX. For now it's just a quick merge of the
6183 * Started a manual in LyX. For now it's just a quick merge of the
6178 various internal docstrings and READMEs. Later it may grow into a
6184 various internal docstrings and READMEs. Later it may grow into a
6179 nice, full-blown manual.
6185 nice, full-blown manual.
6180
6186
6181 * Set up a distutils based installer. Installation should now be
6187 * Set up a distutils based installer. Installation should now be
6182 trivially simple for end-users.
6188 trivially simple for end-users.
6183
6189
6184 2001-12-11 Fernando Perez <fperez@colorado.edu>
6190 2001-12-11 Fernando Perez <fperez@colorado.edu>
6185
6191
6186 * Released 0.2.0. First public release, announced it at
6192 * Released 0.2.0. First public release, announced it at
6187 comp.lang.python. From now on, just bugfixes...
6193 comp.lang.python. From now on, just bugfixes...
6188
6194
6189 * Went through all the files, set copyright/license notices and
6195 * Went through all the files, set copyright/license notices and
6190 cleaned up things. Ready for release.
6196 cleaned up things. Ready for release.
6191
6197
6192 2001-12-10 Fernando Perez <fperez@colorado.edu>
6198 2001-12-10 Fernando Perez <fperez@colorado.edu>
6193
6199
6194 * Changed the first-time installer not to use tarfiles. It's more
6200 * Changed the first-time installer not to use tarfiles. It's more
6195 robust now and less unix-dependent. Also makes it easier for
6201 robust now and less unix-dependent. Also makes it easier for
6196 people to later upgrade versions.
6202 people to later upgrade versions.
6197
6203
6198 * Changed @exit to @abort to reflect the fact that it's pretty
6204 * Changed @exit to @abort to reflect the fact that it's pretty
6199 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6205 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6200 becomes significant only when IPyhton is embedded: in that case,
6206 becomes significant only when IPyhton is embedded: in that case,
6201 C-D closes IPython only, but @abort kills the enclosing program
6207 C-D closes IPython only, but @abort kills the enclosing program
6202 too (unless it had called IPython inside a try catching
6208 too (unless it had called IPython inside a try catching
6203 SystemExit).
6209 SystemExit).
6204
6210
6205 * Created Shell module which exposes the actuall IPython Shell
6211 * Created Shell module which exposes the actuall IPython Shell
6206 classes, currently the normal and the embeddable one. This at
6212 classes, currently the normal and the embeddable one. This at
6207 least offers a stable interface we won't need to change when
6213 least offers a stable interface we won't need to change when
6208 (later) the internals are rewritten. That rewrite will be confined
6214 (later) the internals are rewritten. That rewrite will be confined
6209 to iplib and ipmaker, but the Shell interface should remain as is.
6215 to iplib and ipmaker, but the Shell interface should remain as is.
6210
6216
6211 * Added embed module which offers an embeddable IPShell object,
6217 * Added embed module which offers an embeddable IPShell object,
6212 useful to fire up IPython *inside* a running program. Great for
6218 useful to fire up IPython *inside* a running program. Great for
6213 debugging or dynamical data analysis.
6219 debugging or dynamical data analysis.
6214
6220
6215 2001-12-08 Fernando Perez <fperez@colorado.edu>
6221 2001-12-08 Fernando Perez <fperez@colorado.edu>
6216
6222
6217 * Fixed small bug preventing seeing info from methods of defined
6223 * Fixed small bug preventing seeing info from methods of defined
6218 objects (incorrect namespace in _ofind()).
6224 objects (incorrect namespace in _ofind()).
6219
6225
6220 * Documentation cleanup. Moved the main usage docstrings to a
6226 * Documentation cleanup. Moved the main usage docstrings to a
6221 separate file, usage.py (cleaner to maintain, and hopefully in the
6227 separate file, usage.py (cleaner to maintain, and hopefully in the
6222 future some perlpod-like way of producing interactive, man and
6228 future some perlpod-like way of producing interactive, man and
6223 html docs out of it will be found).
6229 html docs out of it will be found).
6224
6230
6225 * Added @profile to see your profile at any time.
6231 * Added @profile to see your profile at any time.
6226
6232
6227 * Added @p as an alias for 'print'. It's especially convenient if
6233 * Added @p as an alias for 'print'. It's especially convenient if
6228 using automagic ('p x' prints x).
6234 using automagic ('p x' prints x).
6229
6235
6230 * Small cleanups and fixes after a pychecker run.
6236 * Small cleanups and fixes after a pychecker run.
6231
6237
6232 * Changed the @cd command to handle @cd - and @cd -<n> for
6238 * Changed the @cd command to handle @cd - and @cd -<n> for
6233 visiting any directory in _dh.
6239 visiting any directory in _dh.
6234
6240
6235 * Introduced _dh, a history of visited directories. @dhist prints
6241 * Introduced _dh, a history of visited directories. @dhist prints
6236 it out with numbers.
6242 it out with numbers.
6237
6243
6238 2001-12-07 Fernando Perez <fperez@colorado.edu>
6244 2001-12-07 Fernando Perez <fperez@colorado.edu>
6239
6245
6240 * Released 0.1.22
6246 * Released 0.1.22
6241
6247
6242 * Made initialization a bit more robust against invalid color
6248 * Made initialization a bit more robust against invalid color
6243 options in user input (exit, not traceback-crash).
6249 options in user input (exit, not traceback-crash).
6244
6250
6245 * Changed the bug crash reporter to write the report only in the
6251 * Changed the bug crash reporter to write the report only in the
6246 user's .ipython directory. That way IPython won't litter people's
6252 user's .ipython directory. That way IPython won't litter people's
6247 hard disks with crash files all over the place. Also print on
6253 hard disks with crash files all over the place. Also print on
6248 screen the necessary mail command.
6254 screen the necessary mail command.
6249
6255
6250 * With the new ultraTB, implemented LightBG color scheme for light
6256 * With the new ultraTB, implemented LightBG color scheme for light
6251 background terminals. A lot of people like white backgrounds, so I
6257 background terminals. A lot of people like white backgrounds, so I
6252 guess we should at least give them something readable.
6258 guess we should at least give them something readable.
6253
6259
6254 2001-12-06 Fernando Perez <fperez@colorado.edu>
6260 2001-12-06 Fernando Perez <fperez@colorado.edu>
6255
6261
6256 * Modified the structure of ultraTB. Now there's a proper class
6262 * Modified the structure of ultraTB. Now there's a proper class
6257 for tables of color schemes which allow adding schemes easily and
6263 for tables of color schemes which allow adding schemes easily and
6258 switching the active scheme without creating a new instance every
6264 switching the active scheme without creating a new instance every
6259 time (which was ridiculous). The syntax for creating new schemes
6265 time (which was ridiculous). The syntax for creating new schemes
6260 is also cleaner. I think ultraTB is finally done, with a clean
6266 is also cleaner. I think ultraTB is finally done, with a clean
6261 class structure. Names are also much cleaner (now there's proper
6267 class structure. Names are also much cleaner (now there's proper
6262 color tables, no need for every variable to also have 'color' in
6268 color tables, no need for every variable to also have 'color' in
6263 its name).
6269 its name).
6264
6270
6265 * Broke down genutils into separate files. Now genutils only
6271 * Broke down genutils into separate files. Now genutils only
6266 contains utility functions, and classes have been moved to their
6272 contains utility functions, and classes have been moved to their
6267 own files (they had enough independent functionality to warrant
6273 own files (they had enough independent functionality to warrant
6268 it): ConfigLoader, OutputTrap, Struct.
6274 it): ConfigLoader, OutputTrap, Struct.
6269
6275
6270 2001-12-05 Fernando Perez <fperez@colorado.edu>
6276 2001-12-05 Fernando Perez <fperez@colorado.edu>
6271
6277
6272 * IPython turns 21! Released version 0.1.21, as a candidate for
6278 * IPython turns 21! Released version 0.1.21, as a candidate for
6273 public consumption. If all goes well, release in a few days.
6279 public consumption. If all goes well, release in a few days.
6274
6280
6275 * Fixed path bug (files in Extensions/ directory wouldn't be found
6281 * Fixed path bug (files in Extensions/ directory wouldn't be found
6276 unless IPython/ was explicitly in sys.path).
6282 unless IPython/ was explicitly in sys.path).
6277
6283
6278 * Extended the FlexCompleter class as MagicCompleter to allow
6284 * Extended the FlexCompleter class as MagicCompleter to allow
6279 completion of @-starting lines.
6285 completion of @-starting lines.
6280
6286
6281 * Created __release__.py file as a central repository for release
6287 * Created __release__.py file as a central repository for release
6282 info that other files can read from.
6288 info that other files can read from.
6283
6289
6284 * Fixed small bug in logging: when logging was turned on in
6290 * Fixed small bug in logging: when logging was turned on in
6285 mid-session, old lines with special meanings (!@?) were being
6291 mid-session, old lines with special meanings (!@?) were being
6286 logged without the prepended comment, which is necessary since
6292 logged without the prepended comment, which is necessary since
6287 they are not truly valid python syntax. This should make session
6293 they are not truly valid python syntax. This should make session
6288 restores produce less errors.
6294 restores produce less errors.
6289
6295
6290 * The namespace cleanup forced me to make a FlexCompleter class
6296 * The namespace cleanup forced me to make a FlexCompleter class
6291 which is nothing but a ripoff of rlcompleter, but with selectable
6297 which is nothing but a ripoff of rlcompleter, but with selectable
6292 namespace (rlcompleter only works in __main__.__dict__). I'll try
6298 namespace (rlcompleter only works in __main__.__dict__). I'll try
6293 to submit a note to the authors to see if this change can be
6299 to submit a note to the authors to see if this change can be
6294 incorporated in future rlcompleter releases (Dec.6: done)
6300 incorporated in future rlcompleter releases (Dec.6: done)
6295
6301
6296 * More fixes to namespace handling. It was a mess! Now all
6302 * More fixes to namespace handling. It was a mess! Now all
6297 explicit references to __main__.__dict__ are gone (except when
6303 explicit references to __main__.__dict__ are gone (except when
6298 really needed) and everything is handled through the namespace
6304 really needed) and everything is handled through the namespace
6299 dicts in the IPython instance. We seem to be getting somewhere
6305 dicts in the IPython instance. We seem to be getting somewhere
6300 with this, finally...
6306 with this, finally...
6301
6307
6302 * Small documentation updates.
6308 * Small documentation updates.
6303
6309
6304 * Created the Extensions directory under IPython (with an
6310 * Created the Extensions directory under IPython (with an
6305 __init__.py). Put the PhysicalQ stuff there. This directory should
6311 __init__.py). Put the PhysicalQ stuff there. This directory should
6306 be used for all special-purpose extensions.
6312 be used for all special-purpose extensions.
6307
6313
6308 * File renaming:
6314 * File renaming:
6309 ipythonlib --> ipmaker
6315 ipythonlib --> ipmaker
6310 ipplib --> iplib
6316 ipplib --> iplib
6311 This makes a bit more sense in terms of what these files actually do.
6317 This makes a bit more sense in terms of what these files actually do.
6312
6318
6313 * Moved all the classes and functions in ipythonlib to ipplib, so
6319 * Moved all the classes and functions in ipythonlib to ipplib, so
6314 now ipythonlib only has make_IPython(). This will ease up its
6320 now ipythonlib only has make_IPython(). This will ease up its
6315 splitting in smaller functional chunks later.
6321 splitting in smaller functional chunks later.
6316
6322
6317 * Cleaned up (done, I think) output of @whos. Better column
6323 * Cleaned up (done, I think) output of @whos. Better column
6318 formatting, and now shows str(var) for as much as it can, which is
6324 formatting, and now shows str(var) for as much as it can, which is
6319 typically what one gets with a 'print var'.
6325 typically what one gets with a 'print var'.
6320
6326
6321 2001-12-04 Fernando Perez <fperez@colorado.edu>
6327 2001-12-04 Fernando Perez <fperez@colorado.edu>
6322
6328
6323 * Fixed namespace problems. Now builtin/IPyhton/user names get
6329 * Fixed namespace problems. Now builtin/IPyhton/user names get
6324 properly reported in their namespace. Internal namespace handling
6330 properly reported in their namespace. Internal namespace handling
6325 is finally getting decent (not perfect yet, but much better than
6331 is finally getting decent (not perfect yet, but much better than
6326 the ad-hoc mess we had).
6332 the ad-hoc mess we had).
6327
6333
6328 * Removed -exit option. If people just want to run a python
6334 * Removed -exit option. If people just want to run a python
6329 script, that's what the normal interpreter is for. Less
6335 script, that's what the normal interpreter is for. Less
6330 unnecessary options, less chances for bugs.
6336 unnecessary options, less chances for bugs.
6331
6337
6332 * Added a crash handler which generates a complete post-mortem if
6338 * Added a crash handler which generates a complete post-mortem if
6333 IPython crashes. This will help a lot in tracking bugs down the
6339 IPython crashes. This will help a lot in tracking bugs down the
6334 road.
6340 road.
6335
6341
6336 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6342 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6337 which were boud to functions being reassigned would bypass the
6343 which were boud to functions being reassigned would bypass the
6338 logger, breaking the sync of _il with the prompt counter. This
6344 logger, breaking the sync of _il with the prompt counter. This
6339 would then crash IPython later when a new line was logged.
6345 would then crash IPython later when a new line was logged.
6340
6346
6341 2001-12-02 Fernando Perez <fperez@colorado.edu>
6347 2001-12-02 Fernando Perez <fperez@colorado.edu>
6342
6348
6343 * Made IPython a package. This means people don't have to clutter
6349 * Made IPython a package. This means people don't have to clutter
6344 their sys.path with yet another directory. Changed the INSTALL
6350 their sys.path with yet another directory. Changed the INSTALL
6345 file accordingly.
6351 file accordingly.
6346
6352
6347 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6353 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6348 sorts its output (so @who shows it sorted) and @whos formats the
6354 sorts its output (so @who shows it sorted) and @whos formats the
6349 table according to the width of the first column. Nicer, easier to
6355 table according to the width of the first column. Nicer, easier to
6350 read. Todo: write a generic table_format() which takes a list of
6356 read. Todo: write a generic table_format() which takes a list of
6351 lists and prints it nicely formatted, with optional row/column
6357 lists and prints it nicely formatted, with optional row/column
6352 separators and proper padding and justification.
6358 separators and proper padding and justification.
6353
6359
6354 * Released 0.1.20
6360 * Released 0.1.20
6355
6361
6356 * Fixed bug in @log which would reverse the inputcache list (a
6362 * Fixed bug in @log which would reverse the inputcache list (a
6357 copy operation was missing).
6363 copy operation was missing).
6358
6364
6359 * Code cleanup. @config was changed to use page(). Better, since
6365 * Code cleanup. @config was changed to use page(). Better, since
6360 its output is always quite long.
6366 its output is always quite long.
6361
6367
6362 * Itpl is back as a dependency. I was having too many problems
6368 * Itpl is back as a dependency. I was having too many problems
6363 getting the parametric aliases to work reliably, and it's just
6369 getting the parametric aliases to work reliably, and it's just
6364 easier to code weird string operations with it than playing %()s
6370 easier to code weird string operations with it than playing %()s
6365 games. It's only ~6k, so I don't think it's too big a deal.
6371 games. It's only ~6k, so I don't think it's too big a deal.
6366
6372
6367 * Found (and fixed) a very nasty bug with history. !lines weren't
6373 * Found (and fixed) a very nasty bug with history. !lines weren't
6368 getting cached, and the out of sync caches would crash
6374 getting cached, and the out of sync caches would crash
6369 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6375 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6370 division of labor a bit better. Bug fixed, cleaner structure.
6376 division of labor a bit better. Bug fixed, cleaner structure.
6371
6377
6372 2001-12-01 Fernando Perez <fperez@colorado.edu>
6378 2001-12-01 Fernando Perez <fperez@colorado.edu>
6373
6379
6374 * Released 0.1.19
6380 * Released 0.1.19
6375
6381
6376 * Added option -n to @hist to prevent line number printing. Much
6382 * Added option -n to @hist to prevent line number printing. Much
6377 easier to copy/paste code this way.
6383 easier to copy/paste code this way.
6378
6384
6379 * Created global _il to hold the input list. Allows easy
6385 * Created global _il to hold the input list. Allows easy
6380 re-execution of blocks of code by slicing it (inspired by Janko's
6386 re-execution of blocks of code by slicing it (inspired by Janko's
6381 comment on 'macros').
6387 comment on 'macros').
6382
6388
6383 * Small fixes and doc updates.
6389 * Small fixes and doc updates.
6384
6390
6385 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6391 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6386 much too fragile with automagic. Handles properly multi-line
6392 much too fragile with automagic. Handles properly multi-line
6387 statements and takes parameters.
6393 statements and takes parameters.
6388
6394
6389 2001-11-30 Fernando Perez <fperez@colorado.edu>
6395 2001-11-30 Fernando Perez <fperez@colorado.edu>
6390
6396
6391 * Version 0.1.18 released.
6397 * Version 0.1.18 released.
6392
6398
6393 * Fixed nasty namespace bug in initial module imports.
6399 * Fixed nasty namespace bug in initial module imports.
6394
6400
6395 * Added copyright/license notes to all code files (except
6401 * Added copyright/license notes to all code files (except
6396 DPyGetOpt). For the time being, LGPL. That could change.
6402 DPyGetOpt). For the time being, LGPL. That could change.
6397
6403
6398 * Rewrote a much nicer README, updated INSTALL, cleaned up
6404 * Rewrote a much nicer README, updated INSTALL, cleaned up
6399 ipythonrc-* samples.
6405 ipythonrc-* samples.
6400
6406
6401 * Overall code/documentation cleanup. Basically ready for
6407 * Overall code/documentation cleanup. Basically ready for
6402 release. Only remaining thing: licence decision (LGPL?).
6408 release. Only remaining thing: licence decision (LGPL?).
6403
6409
6404 * Converted load_config to a class, ConfigLoader. Now recursion
6410 * Converted load_config to a class, ConfigLoader. Now recursion
6405 control is better organized. Doesn't include the same file twice.
6411 control is better organized. Doesn't include the same file twice.
6406
6412
6407 2001-11-29 Fernando Perez <fperez@colorado.edu>
6413 2001-11-29 Fernando Perez <fperez@colorado.edu>
6408
6414
6409 * Got input history working. Changed output history variables from
6415 * Got input history working. Changed output history variables from
6410 _p to _o so that _i is for input and _o for output. Just cleaner
6416 _p to _o so that _i is for input and _o for output. Just cleaner
6411 convention.
6417 convention.
6412
6418
6413 * Implemented parametric aliases. This pretty much allows the
6419 * Implemented parametric aliases. This pretty much allows the
6414 alias system to offer full-blown shell convenience, I think.
6420 alias system to offer full-blown shell convenience, I think.
6415
6421
6416 * Version 0.1.17 released, 0.1.18 opened.
6422 * Version 0.1.17 released, 0.1.18 opened.
6417
6423
6418 * dot_ipython/ipythonrc (alias): added documentation.
6424 * dot_ipython/ipythonrc (alias): added documentation.
6419 (xcolor): Fixed small bug (xcolors -> xcolor)
6425 (xcolor): Fixed small bug (xcolors -> xcolor)
6420
6426
6421 * Changed the alias system. Now alias is a magic command to define
6427 * Changed the alias system. Now alias is a magic command to define
6422 aliases just like the shell. Rationale: the builtin magics should
6428 aliases just like the shell. Rationale: the builtin magics should
6423 be there for things deeply connected to IPython's
6429 be there for things deeply connected to IPython's
6424 architecture. And this is a much lighter system for what I think
6430 architecture. And this is a much lighter system for what I think
6425 is the really important feature: allowing users to define quickly
6431 is the really important feature: allowing users to define quickly
6426 magics that will do shell things for them, so they can customize
6432 magics that will do shell things for them, so they can customize
6427 IPython easily to match their work habits. If someone is really
6433 IPython easily to match their work habits. If someone is really
6428 desperate to have another name for a builtin alias, they can
6434 desperate to have another name for a builtin alias, they can
6429 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6435 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6430 works.
6436 works.
6431
6437
6432 2001-11-28 Fernando Perez <fperez@colorado.edu>
6438 2001-11-28 Fernando Perez <fperez@colorado.edu>
6433
6439
6434 * Changed @file so that it opens the source file at the proper
6440 * Changed @file so that it opens the source file at the proper
6435 line. Since it uses less, if your EDITOR environment is
6441 line. Since it uses less, if your EDITOR environment is
6436 configured, typing v will immediately open your editor of choice
6442 configured, typing v will immediately open your editor of choice
6437 right at the line where the object is defined. Not as quick as
6443 right at the line where the object is defined. Not as quick as
6438 having a direct @edit command, but for all intents and purposes it
6444 having a direct @edit command, but for all intents and purposes it
6439 works. And I don't have to worry about writing @edit to deal with
6445 works. And I don't have to worry about writing @edit to deal with
6440 all the editors, less does that.
6446 all the editors, less does that.
6441
6447
6442 * Version 0.1.16 released, 0.1.17 opened.
6448 * Version 0.1.16 released, 0.1.17 opened.
6443
6449
6444 * Fixed some nasty bugs in the page/page_dumb combo that could
6450 * Fixed some nasty bugs in the page/page_dumb combo that could
6445 crash IPython.
6451 crash IPython.
6446
6452
6447 2001-11-27 Fernando Perez <fperez@colorado.edu>
6453 2001-11-27 Fernando Perez <fperez@colorado.edu>
6448
6454
6449 * Version 0.1.15 released, 0.1.16 opened.
6455 * Version 0.1.15 released, 0.1.16 opened.
6450
6456
6451 * Finally got ? and ?? to work for undefined things: now it's
6457 * Finally got ? and ?? to work for undefined things: now it's
6452 possible to type {}.get? and get information about the get method
6458 possible to type {}.get? and get information about the get method
6453 of dicts, or os.path? even if only os is defined (so technically
6459 of dicts, or os.path? even if only os is defined (so technically
6454 os.path isn't). Works at any level. For example, after import os,
6460 os.path isn't). Works at any level. For example, after import os,
6455 os?, os.path?, os.path.abspath? all work. This is great, took some
6461 os?, os.path?, os.path.abspath? all work. This is great, took some
6456 work in _ofind.
6462 work in _ofind.
6457
6463
6458 * Fixed more bugs with logging. The sanest way to do it was to add
6464 * Fixed more bugs with logging. The sanest way to do it was to add
6459 to @log a 'mode' parameter. Killed two in one shot (this mode
6465 to @log a 'mode' parameter. Killed two in one shot (this mode
6460 option was a request of Janko's). I think it's finally clean
6466 option was a request of Janko's). I think it's finally clean
6461 (famous last words).
6467 (famous last words).
6462
6468
6463 * Added a page_dumb() pager which does a decent job of paging on
6469 * Added a page_dumb() pager which does a decent job of paging on
6464 screen, if better things (like less) aren't available. One less
6470 screen, if better things (like less) aren't available. One less
6465 unix dependency (someday maybe somebody will port this to
6471 unix dependency (someday maybe somebody will port this to
6466 windows).
6472 windows).
6467
6473
6468 * Fixed problem in magic_log: would lock of logging out if log
6474 * Fixed problem in magic_log: would lock of logging out if log
6469 creation failed (because it would still think it had succeeded).
6475 creation failed (because it would still think it had succeeded).
6470
6476
6471 * Improved the page() function using curses to auto-detect screen
6477 * Improved the page() function using curses to auto-detect screen
6472 size. Now it can make a much better decision on whether to print
6478 size. Now it can make a much better decision on whether to print
6473 or page a string. Option screen_length was modified: a value 0
6479 or page a string. Option screen_length was modified: a value 0
6474 means auto-detect, and that's the default now.
6480 means auto-detect, and that's the default now.
6475
6481
6476 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6482 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6477 go out. I'll test it for a few days, then talk to Janko about
6483 go out. I'll test it for a few days, then talk to Janko about
6478 licences and announce it.
6484 licences and announce it.
6479
6485
6480 * Fixed the length of the auto-generated ---> prompt which appears
6486 * Fixed the length of the auto-generated ---> prompt which appears
6481 for auto-parens and auto-quotes. Getting this right isn't trivial,
6487 for auto-parens and auto-quotes. Getting this right isn't trivial,
6482 with all the color escapes, different prompt types and optional
6488 with all the color escapes, different prompt types and optional
6483 separators. But it seems to be working in all the combinations.
6489 separators. But it seems to be working in all the combinations.
6484
6490
6485 2001-11-26 Fernando Perez <fperez@colorado.edu>
6491 2001-11-26 Fernando Perez <fperez@colorado.edu>
6486
6492
6487 * Wrote a regexp filter to get option types from the option names
6493 * Wrote a regexp filter to get option types from the option names
6488 string. This eliminates the need to manually keep two duplicate
6494 string. This eliminates the need to manually keep two duplicate
6489 lists.
6495 lists.
6490
6496
6491 * Removed the unneeded check_option_names. Now options are handled
6497 * Removed the unneeded check_option_names. Now options are handled
6492 in a much saner manner and it's easy to visually check that things
6498 in a much saner manner and it's easy to visually check that things
6493 are ok.
6499 are ok.
6494
6500
6495 * Updated version numbers on all files I modified to carry a
6501 * Updated version numbers on all files I modified to carry a
6496 notice so Janko and Nathan have clear version markers.
6502 notice so Janko and Nathan have clear version markers.
6497
6503
6498 * Updated docstring for ultraTB with my changes. I should send
6504 * Updated docstring for ultraTB with my changes. I should send
6499 this to Nathan.
6505 this to Nathan.
6500
6506
6501 * Lots of small fixes. Ran everything through pychecker again.
6507 * Lots of small fixes. Ran everything through pychecker again.
6502
6508
6503 * Made loading of deep_reload an cmd line option. If it's not too
6509 * Made loading of deep_reload an cmd line option. If it's not too
6504 kosher, now people can just disable it. With -nodeep_reload it's
6510 kosher, now people can just disable it. With -nodeep_reload it's
6505 still available as dreload(), it just won't overwrite reload().
6511 still available as dreload(), it just won't overwrite reload().
6506
6512
6507 * Moved many options to the no| form (-opt and -noopt
6513 * Moved many options to the no| form (-opt and -noopt
6508 accepted). Cleaner.
6514 accepted). Cleaner.
6509
6515
6510 * Changed magic_log so that if called with no parameters, it uses
6516 * Changed magic_log so that if called with no parameters, it uses
6511 'rotate' mode. That way auto-generated logs aren't automatically
6517 'rotate' mode. That way auto-generated logs aren't automatically
6512 over-written. For normal logs, now a backup is made if it exists
6518 over-written. For normal logs, now a backup is made if it exists
6513 (only 1 level of backups). A new 'backup' mode was added to the
6519 (only 1 level of backups). A new 'backup' mode was added to the
6514 Logger class to support this. This was a request by Janko.
6520 Logger class to support this. This was a request by Janko.
6515
6521
6516 * Added @logoff/@logon to stop/restart an active log.
6522 * Added @logoff/@logon to stop/restart an active log.
6517
6523
6518 * Fixed a lot of bugs in log saving/replay. It was pretty
6524 * Fixed a lot of bugs in log saving/replay. It was pretty
6519 broken. Now special lines (!@,/) appear properly in the command
6525 broken. Now special lines (!@,/) appear properly in the command
6520 history after a log replay.
6526 history after a log replay.
6521
6527
6522 * Tried and failed to implement full session saving via pickle. My
6528 * Tried and failed to implement full session saving via pickle. My
6523 idea was to pickle __main__.__dict__, but modules can't be
6529 idea was to pickle __main__.__dict__, but modules can't be
6524 pickled. This would be a better alternative to replaying logs, but
6530 pickled. This would be a better alternative to replaying logs, but
6525 seems quite tricky to get to work. Changed -session to be called
6531 seems quite tricky to get to work. Changed -session to be called
6526 -logplay, which more accurately reflects what it does. And if we
6532 -logplay, which more accurately reflects what it does. And if we
6527 ever get real session saving working, -session is now available.
6533 ever get real session saving working, -session is now available.
6528
6534
6529 * Implemented color schemes for prompts also. As for tracebacks,
6535 * Implemented color schemes for prompts also. As for tracebacks,
6530 currently only NoColor and Linux are supported. But now the
6536 currently only NoColor and Linux are supported. But now the
6531 infrastructure is in place, based on a generic ColorScheme
6537 infrastructure is in place, based on a generic ColorScheme
6532 class. So writing and activating new schemes both for the prompts
6538 class. So writing and activating new schemes both for the prompts
6533 and the tracebacks should be straightforward.
6539 and the tracebacks should be straightforward.
6534
6540
6535 * Version 0.1.13 released, 0.1.14 opened.
6541 * Version 0.1.13 released, 0.1.14 opened.
6536
6542
6537 * Changed handling of options for output cache. Now counter is
6543 * Changed handling of options for output cache. Now counter is
6538 hardwired starting at 1 and one specifies the maximum number of
6544 hardwired starting at 1 and one specifies the maximum number of
6539 entries *in the outcache* (not the max prompt counter). This is
6545 entries *in the outcache* (not the max prompt counter). This is
6540 much better, since many statements won't increase the cache
6546 much better, since many statements won't increase the cache
6541 count. It also eliminated some confusing options, now there's only
6547 count. It also eliminated some confusing options, now there's only
6542 one: cache_size.
6548 one: cache_size.
6543
6549
6544 * Added 'alias' magic function and magic_alias option in the
6550 * Added 'alias' magic function and magic_alias option in the
6545 ipythonrc file. Now the user can easily define whatever names he
6551 ipythonrc file. Now the user can easily define whatever names he
6546 wants for the magic functions without having to play weird
6552 wants for the magic functions without having to play weird
6547 namespace games. This gives IPython a real shell-like feel.
6553 namespace games. This gives IPython a real shell-like feel.
6548
6554
6549 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6555 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6550 @ or not).
6556 @ or not).
6551
6557
6552 This was one of the last remaining 'visible' bugs (that I know
6558 This was one of the last remaining 'visible' bugs (that I know
6553 of). I think if I can clean up the session loading so it works
6559 of). I think if I can clean up the session loading so it works
6554 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6560 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6555 about licensing).
6561 about licensing).
6556
6562
6557 2001-11-25 Fernando Perez <fperez@colorado.edu>
6563 2001-11-25 Fernando Perez <fperez@colorado.edu>
6558
6564
6559 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6565 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6560 there's a cleaner distinction between what ? and ?? show.
6566 there's a cleaner distinction between what ? and ?? show.
6561
6567
6562 * Added screen_length option. Now the user can define his own
6568 * Added screen_length option. Now the user can define his own
6563 screen size for page() operations.
6569 screen size for page() operations.
6564
6570
6565 * Implemented magic shell-like functions with automatic code
6571 * Implemented magic shell-like functions with automatic code
6566 generation. Now adding another function is just a matter of adding
6572 generation. Now adding another function is just a matter of adding
6567 an entry to a dict, and the function is dynamically generated at
6573 an entry to a dict, and the function is dynamically generated at
6568 run-time. Python has some really cool features!
6574 run-time. Python has some really cool features!
6569
6575
6570 * Renamed many options to cleanup conventions a little. Now all
6576 * Renamed many options to cleanup conventions a little. Now all
6571 are lowercase, and only underscores where needed. Also in the code
6577 are lowercase, and only underscores where needed. Also in the code
6572 option name tables are clearer.
6578 option name tables are clearer.
6573
6579
6574 * Changed prompts a little. Now input is 'In [n]:' instead of
6580 * Changed prompts a little. Now input is 'In [n]:' instead of
6575 'In[n]:='. This allows it the numbers to be aligned with the
6581 'In[n]:='. This allows it the numbers to be aligned with the
6576 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6582 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6577 Python (it was a Mathematica thing). The '...' continuation prompt
6583 Python (it was a Mathematica thing). The '...' continuation prompt
6578 was also changed a little to align better.
6584 was also changed a little to align better.
6579
6585
6580 * Fixed bug when flushing output cache. Not all _p<n> variables
6586 * Fixed bug when flushing output cache. Not all _p<n> variables
6581 exist, so their deletion needs to be wrapped in a try:
6587 exist, so their deletion needs to be wrapped in a try:
6582
6588
6583 * Figured out how to properly use inspect.formatargspec() (it
6589 * Figured out how to properly use inspect.formatargspec() (it
6584 requires the args preceded by *). So I removed all the code from
6590 requires the args preceded by *). So I removed all the code from
6585 _get_pdef in Magic, which was just replicating that.
6591 _get_pdef in Magic, which was just replicating that.
6586
6592
6587 * Added test to prefilter to allow redefining magic function names
6593 * Added test to prefilter to allow redefining magic function names
6588 as variables. This is ok, since the @ form is always available,
6594 as variables. This is ok, since the @ form is always available,
6589 but whe should allow the user to define a variable called 'ls' if
6595 but whe should allow the user to define a variable called 'ls' if
6590 he needs it.
6596 he needs it.
6591
6597
6592 * Moved the ToDo information from README into a separate ToDo.
6598 * Moved the ToDo information from README into a separate ToDo.
6593
6599
6594 * General code cleanup and small bugfixes. I think it's close to a
6600 * General code cleanup and small bugfixes. I think it's close to a
6595 state where it can be released, obviously with a big 'beta'
6601 state where it can be released, obviously with a big 'beta'
6596 warning on it.
6602 warning on it.
6597
6603
6598 * Got the magic function split to work. Now all magics are defined
6604 * Got the magic function split to work. Now all magics are defined
6599 in a separate class. It just organizes things a bit, and now
6605 in a separate class. It just organizes things a bit, and now
6600 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6606 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6601 was too long).
6607 was too long).
6602
6608
6603 * Changed @clear to @reset to avoid potential confusions with
6609 * Changed @clear to @reset to avoid potential confusions with
6604 the shell command clear. Also renamed @cl to @clear, which does
6610 the shell command clear. Also renamed @cl to @clear, which does
6605 exactly what people expect it to from their shell experience.
6611 exactly what people expect it to from their shell experience.
6606
6612
6607 Added a check to the @reset command (since it's so
6613 Added a check to the @reset command (since it's so
6608 destructive, it's probably a good idea to ask for confirmation).
6614 destructive, it's probably a good idea to ask for confirmation).
6609 But now reset only works for full namespace resetting. Since the
6615 But now reset only works for full namespace resetting. Since the
6610 del keyword is already there for deleting a few specific
6616 del keyword is already there for deleting a few specific
6611 variables, I don't see the point of having a redundant magic
6617 variables, I don't see the point of having a redundant magic
6612 function for the same task.
6618 function for the same task.
6613
6619
6614 2001-11-24 Fernando Perez <fperez@colorado.edu>
6620 2001-11-24 Fernando Perez <fperez@colorado.edu>
6615
6621
6616 * Updated the builtin docs (esp. the ? ones).
6622 * Updated the builtin docs (esp. the ? ones).
6617
6623
6618 * Ran all the code through pychecker. Not terribly impressed with
6624 * Ran all the code through pychecker. Not terribly impressed with
6619 it: lots of spurious warnings and didn't really find anything of
6625 it: lots of spurious warnings and didn't really find anything of
6620 substance (just a few modules being imported and not used).
6626 substance (just a few modules being imported and not used).
6621
6627
6622 * Implemented the new ultraTB functionality into IPython. New
6628 * Implemented the new ultraTB functionality into IPython. New
6623 option: xcolors. This chooses color scheme. xmode now only selects
6629 option: xcolors. This chooses color scheme. xmode now only selects
6624 between Plain and Verbose. Better orthogonality.
6630 between Plain and Verbose. Better orthogonality.
6625
6631
6626 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6632 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6627 mode and color scheme for the exception handlers. Now it's
6633 mode and color scheme for the exception handlers. Now it's
6628 possible to have the verbose traceback with no coloring.
6634 possible to have the verbose traceback with no coloring.
6629
6635
6630 2001-11-23 Fernando Perez <fperez@colorado.edu>
6636 2001-11-23 Fernando Perez <fperez@colorado.edu>
6631
6637
6632 * Version 0.1.12 released, 0.1.13 opened.
6638 * Version 0.1.12 released, 0.1.13 opened.
6633
6639
6634 * Removed option to set auto-quote and auto-paren escapes by
6640 * Removed option to set auto-quote and auto-paren escapes by
6635 user. The chances of breaking valid syntax are just too high. If
6641 user. The chances of breaking valid syntax are just too high. If
6636 someone *really* wants, they can always dig into the code.
6642 someone *really* wants, they can always dig into the code.
6637
6643
6638 * Made prompt separators configurable.
6644 * Made prompt separators configurable.
6639
6645
6640 2001-11-22 Fernando Perez <fperez@colorado.edu>
6646 2001-11-22 Fernando Perez <fperez@colorado.edu>
6641
6647
6642 * Small bugfixes in many places.
6648 * Small bugfixes in many places.
6643
6649
6644 * Removed the MyCompleter class from ipplib. It seemed redundant
6650 * Removed the MyCompleter class from ipplib. It seemed redundant
6645 with the C-p,C-n history search functionality. Less code to
6651 with the C-p,C-n history search functionality. Less code to
6646 maintain.
6652 maintain.
6647
6653
6648 * Moved all the original ipython.py code into ipythonlib.py. Right
6654 * Moved all the original ipython.py code into ipythonlib.py. Right
6649 now it's just one big dump into a function called make_IPython, so
6655 now it's just one big dump into a function called make_IPython, so
6650 no real modularity has been gained. But at least it makes the
6656 no real modularity has been gained. But at least it makes the
6651 wrapper script tiny, and since ipythonlib is a module, it gets
6657 wrapper script tiny, and since ipythonlib is a module, it gets
6652 compiled and startup is much faster.
6658 compiled and startup is much faster.
6653
6659
6654 This is a reasobably 'deep' change, so we should test it for a
6660 This is a reasobably 'deep' change, so we should test it for a
6655 while without messing too much more with the code.
6661 while without messing too much more with the code.
6656
6662
6657 2001-11-21 Fernando Perez <fperez@colorado.edu>
6663 2001-11-21 Fernando Perez <fperez@colorado.edu>
6658
6664
6659 * Version 0.1.11 released, 0.1.12 opened for further work.
6665 * Version 0.1.11 released, 0.1.12 opened for further work.
6660
6666
6661 * Removed dependency on Itpl. It was only needed in one place. It
6667 * Removed dependency on Itpl. It was only needed in one place. It
6662 would be nice if this became part of python, though. It makes life
6668 would be nice if this became part of python, though. It makes life
6663 *a lot* easier in some cases.
6669 *a lot* easier in some cases.
6664
6670
6665 * Simplified the prefilter code a bit. Now all handlers are
6671 * Simplified the prefilter code a bit. Now all handlers are
6666 expected to explicitly return a value (at least a blank string).
6672 expected to explicitly return a value (at least a blank string).
6667
6673
6668 * Heavy edits in ipplib. Removed the help system altogether. Now
6674 * Heavy edits in ipplib. Removed the help system altogether. Now
6669 obj?/?? is used for inspecting objects, a magic @doc prints
6675 obj?/?? is used for inspecting objects, a magic @doc prints
6670 docstrings, and full-blown Python help is accessed via the 'help'
6676 docstrings, and full-blown Python help is accessed via the 'help'
6671 keyword. This cleans up a lot of code (less to maintain) and does
6677 keyword. This cleans up a lot of code (less to maintain) and does
6672 the job. Since 'help' is now a standard Python component, might as
6678 the job. Since 'help' is now a standard Python component, might as
6673 well use it and remove duplicate functionality.
6679 well use it and remove duplicate functionality.
6674
6680
6675 Also removed the option to use ipplib as a standalone program. By
6681 Also removed the option to use ipplib as a standalone program. By
6676 now it's too dependent on other parts of IPython to function alone.
6682 now it's too dependent on other parts of IPython to function alone.
6677
6683
6678 * Fixed bug in genutils.pager. It would crash if the pager was
6684 * Fixed bug in genutils.pager. It would crash if the pager was
6679 exited immediately after opening (broken pipe).
6685 exited immediately after opening (broken pipe).
6680
6686
6681 * Trimmed down the VerboseTB reporting a little. The header is
6687 * Trimmed down the VerboseTB reporting a little. The header is
6682 much shorter now and the repeated exception arguments at the end
6688 much shorter now and the repeated exception arguments at the end
6683 have been removed. For interactive use the old header seemed a bit
6689 have been removed. For interactive use the old header seemed a bit
6684 excessive.
6690 excessive.
6685
6691
6686 * Fixed small bug in output of @whos for variables with multi-word
6692 * Fixed small bug in output of @whos for variables with multi-word
6687 types (only first word was displayed).
6693 types (only first word was displayed).
6688
6694
6689 2001-11-17 Fernando Perez <fperez@colorado.edu>
6695 2001-11-17 Fernando Perez <fperez@colorado.edu>
6690
6696
6691 * Version 0.1.10 released, 0.1.11 opened for further work.
6697 * Version 0.1.10 released, 0.1.11 opened for further work.
6692
6698
6693 * Modified dirs and friends. dirs now *returns* the stack (not
6699 * Modified dirs and friends. dirs now *returns* the stack (not
6694 prints), so one can manipulate it as a variable. Convenient to
6700 prints), so one can manipulate it as a variable. Convenient to
6695 travel along many directories.
6701 travel along many directories.
6696
6702
6697 * Fixed bug in magic_pdef: would only work with functions with
6703 * Fixed bug in magic_pdef: would only work with functions with
6698 arguments with default values.
6704 arguments with default values.
6699
6705
6700 2001-11-14 Fernando Perez <fperez@colorado.edu>
6706 2001-11-14 Fernando Perez <fperez@colorado.edu>
6701
6707
6702 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6708 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6703 example with IPython. Various other minor fixes and cleanups.
6709 example with IPython. Various other minor fixes and cleanups.
6704
6710
6705 * Version 0.1.9 released, 0.1.10 opened for further work.
6711 * Version 0.1.9 released, 0.1.10 opened for further work.
6706
6712
6707 * Added sys.path to the list of directories searched in the
6713 * Added sys.path to the list of directories searched in the
6708 execfile= option. It used to be the current directory and the
6714 execfile= option. It used to be the current directory and the
6709 user's IPYTHONDIR only.
6715 user's IPYTHONDIR only.
6710
6716
6711 2001-11-13 Fernando Perez <fperez@colorado.edu>
6717 2001-11-13 Fernando Perez <fperez@colorado.edu>
6712
6718
6713 * Reinstated the raw_input/prefilter separation that Janko had
6719 * Reinstated the raw_input/prefilter separation that Janko had
6714 initially. This gives a more convenient setup for extending the
6720 initially. This gives a more convenient setup for extending the
6715 pre-processor from the outside: raw_input always gets a string,
6721 pre-processor from the outside: raw_input always gets a string,
6716 and prefilter has to process it. We can then redefine prefilter
6722 and prefilter has to process it. We can then redefine prefilter
6717 from the outside and implement extensions for special
6723 from the outside and implement extensions for special
6718 purposes.
6724 purposes.
6719
6725
6720 Today I got one for inputting PhysicalQuantity objects
6726 Today I got one for inputting PhysicalQuantity objects
6721 (from Scientific) without needing any function calls at
6727 (from Scientific) without needing any function calls at
6722 all. Extremely convenient, and it's all done as a user-level
6728 all. Extremely convenient, and it's all done as a user-level
6723 extension (no IPython code was touched). Now instead of:
6729 extension (no IPython code was touched). Now instead of:
6724 a = PhysicalQuantity(4.2,'m/s**2')
6730 a = PhysicalQuantity(4.2,'m/s**2')
6725 one can simply say
6731 one can simply say
6726 a = 4.2 m/s**2
6732 a = 4.2 m/s**2
6727 or even
6733 or even
6728 a = 4.2 m/s^2
6734 a = 4.2 m/s^2
6729
6735
6730 I use this, but it's also a proof of concept: IPython really is
6736 I use this, but it's also a proof of concept: IPython really is
6731 fully user-extensible, even at the level of the parsing of the
6737 fully user-extensible, even at the level of the parsing of the
6732 command line. It's not trivial, but it's perfectly doable.
6738 command line. It's not trivial, but it's perfectly doable.
6733
6739
6734 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6740 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6735 the problem of modules being loaded in the inverse order in which
6741 the problem of modules being loaded in the inverse order in which
6736 they were defined in
6742 they were defined in
6737
6743
6738 * Version 0.1.8 released, 0.1.9 opened for further work.
6744 * Version 0.1.8 released, 0.1.9 opened for further work.
6739
6745
6740 * Added magics pdef, source and file. They respectively show the
6746 * Added magics pdef, source and file. They respectively show the
6741 definition line ('prototype' in C), source code and full python
6747 definition line ('prototype' in C), source code and full python
6742 file for any callable object. The object inspector oinfo uses
6748 file for any callable object. The object inspector oinfo uses
6743 these to show the same information.
6749 these to show the same information.
6744
6750
6745 * Version 0.1.7 released, 0.1.8 opened for further work.
6751 * Version 0.1.7 released, 0.1.8 opened for further work.
6746
6752
6747 * Separated all the magic functions into a class called Magic. The
6753 * Separated all the magic functions into a class called Magic. The
6748 InteractiveShell class was becoming too big for Xemacs to handle
6754 InteractiveShell class was becoming too big for Xemacs to handle
6749 (de-indenting a line would lock it up for 10 seconds while it
6755 (de-indenting a line would lock it up for 10 seconds while it
6750 backtracked on the whole class!)
6756 backtracked on the whole class!)
6751
6757
6752 FIXME: didn't work. It can be done, but right now namespaces are
6758 FIXME: didn't work. It can be done, but right now namespaces are
6753 all messed up. Do it later (reverted it for now, so at least
6759 all messed up. Do it later (reverted it for now, so at least
6754 everything works as before).
6760 everything works as before).
6755
6761
6756 * Got the object introspection system (magic_oinfo) working! I
6762 * Got the object introspection system (magic_oinfo) working! I
6757 think this is pretty much ready for release to Janko, so he can
6763 think this is pretty much ready for release to Janko, so he can
6758 test it for a while and then announce it. Pretty much 100% of what
6764 test it for a while and then announce it. Pretty much 100% of what
6759 I wanted for the 'phase 1' release is ready. Happy, tired.
6765 I wanted for the 'phase 1' release is ready. Happy, tired.
6760
6766
6761 2001-11-12 Fernando Perez <fperez@colorado.edu>
6767 2001-11-12 Fernando Perez <fperez@colorado.edu>
6762
6768
6763 * Version 0.1.6 released, 0.1.7 opened for further work.
6769 * Version 0.1.6 released, 0.1.7 opened for further work.
6764
6770
6765 * Fixed bug in printing: it used to test for truth before
6771 * Fixed bug in printing: it used to test for truth before
6766 printing, so 0 wouldn't print. Now checks for None.
6772 printing, so 0 wouldn't print. Now checks for None.
6767
6773
6768 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6774 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6769 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6775 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6770 reaches by hand into the outputcache. Think of a better way to do
6776 reaches by hand into the outputcache. Think of a better way to do
6771 this later.
6777 this later.
6772
6778
6773 * Various small fixes thanks to Nathan's comments.
6779 * Various small fixes thanks to Nathan's comments.
6774
6780
6775 * Changed magic_pprint to magic_Pprint. This way it doesn't
6781 * Changed magic_pprint to magic_Pprint. This way it doesn't
6776 collide with pprint() and the name is consistent with the command
6782 collide with pprint() and the name is consistent with the command
6777 line option.
6783 line option.
6778
6784
6779 * Changed prompt counter behavior to be fully like
6785 * Changed prompt counter behavior to be fully like
6780 Mathematica's. That is, even input that doesn't return a result
6786 Mathematica's. That is, even input that doesn't return a result
6781 raises the prompt counter. The old behavior was kind of confusing
6787 raises the prompt counter. The old behavior was kind of confusing
6782 (getting the same prompt number several times if the operation
6788 (getting the same prompt number several times if the operation
6783 didn't return a result).
6789 didn't return a result).
6784
6790
6785 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6791 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6786
6792
6787 * Fixed -Classic mode (wasn't working anymore).
6793 * Fixed -Classic mode (wasn't working anymore).
6788
6794
6789 * Added colored prompts using Nathan's new code. Colors are
6795 * Added colored prompts using Nathan's new code. Colors are
6790 currently hardwired, they can be user-configurable. For
6796 currently hardwired, they can be user-configurable. For
6791 developers, they can be chosen in file ipythonlib.py, at the
6797 developers, they can be chosen in file ipythonlib.py, at the
6792 beginning of the CachedOutput class def.
6798 beginning of the CachedOutput class def.
6793
6799
6794 2001-11-11 Fernando Perez <fperez@colorado.edu>
6800 2001-11-11 Fernando Perez <fperez@colorado.edu>
6795
6801
6796 * Version 0.1.5 released, 0.1.6 opened for further work.
6802 * Version 0.1.5 released, 0.1.6 opened for further work.
6797
6803
6798 * Changed magic_env to *return* the environment as a dict (not to
6804 * Changed magic_env to *return* the environment as a dict (not to
6799 print it). This way it prints, but it can also be processed.
6805 print it). This way it prints, but it can also be processed.
6800
6806
6801 * Added Verbose exception reporting to interactive
6807 * Added Verbose exception reporting to interactive
6802 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6808 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6803 traceback. Had to make some changes to the ultraTB file. This is
6809 traceback. Had to make some changes to the ultraTB file. This is
6804 probably the last 'big' thing in my mental todo list. This ties
6810 probably the last 'big' thing in my mental todo list. This ties
6805 in with the next entry:
6811 in with the next entry:
6806
6812
6807 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6813 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6808 has to specify is Plain, Color or Verbose for all exception
6814 has to specify is Plain, Color or Verbose for all exception
6809 handling.
6815 handling.
6810
6816
6811 * Removed ShellServices option. All this can really be done via
6817 * Removed ShellServices option. All this can really be done via
6812 the magic system. It's easier to extend, cleaner and has automatic
6818 the magic system. It's easier to extend, cleaner and has automatic
6813 namespace protection and documentation.
6819 namespace protection and documentation.
6814
6820
6815 2001-11-09 Fernando Perez <fperez@colorado.edu>
6821 2001-11-09 Fernando Perez <fperez@colorado.edu>
6816
6822
6817 * Fixed bug in output cache flushing (missing parameter to
6823 * Fixed bug in output cache flushing (missing parameter to
6818 __init__). Other small bugs fixed (found using pychecker).
6824 __init__). Other small bugs fixed (found using pychecker).
6819
6825
6820 * Version 0.1.4 opened for bugfixing.
6826 * Version 0.1.4 opened for bugfixing.
6821
6827
6822 2001-11-07 Fernando Perez <fperez@colorado.edu>
6828 2001-11-07 Fernando Perez <fperez@colorado.edu>
6823
6829
6824 * Version 0.1.3 released, mainly because of the raw_input bug.
6830 * Version 0.1.3 released, mainly because of the raw_input bug.
6825
6831
6826 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6832 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6827 and when testing for whether things were callable, a call could
6833 and when testing for whether things were callable, a call could
6828 actually be made to certain functions. They would get called again
6834 actually be made to certain functions. They would get called again
6829 once 'really' executed, with a resulting double call. A disaster
6835 once 'really' executed, with a resulting double call. A disaster
6830 in many cases (list.reverse() would never work!).
6836 in many cases (list.reverse() would never work!).
6831
6837
6832 * Removed prefilter() function, moved its code to raw_input (which
6838 * Removed prefilter() function, moved its code to raw_input (which
6833 after all was just a near-empty caller for prefilter). This saves
6839 after all was just a near-empty caller for prefilter). This saves
6834 a function call on every prompt, and simplifies the class a tiny bit.
6840 a function call on every prompt, and simplifies the class a tiny bit.
6835
6841
6836 * Fix _ip to __ip name in magic example file.
6842 * Fix _ip to __ip name in magic example file.
6837
6843
6838 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6844 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6839 work with non-gnu versions of tar.
6845 work with non-gnu versions of tar.
6840
6846
6841 2001-11-06 Fernando Perez <fperez@colorado.edu>
6847 2001-11-06 Fernando Perez <fperez@colorado.edu>
6842
6848
6843 * Version 0.1.2. Just to keep track of the recent changes.
6849 * Version 0.1.2. Just to keep track of the recent changes.
6844
6850
6845 * Fixed nasty bug in output prompt routine. It used to check 'if
6851 * Fixed nasty bug in output prompt routine. It used to check 'if
6846 arg != None...'. Problem is, this fails if arg implements a
6852 arg != None...'. Problem is, this fails if arg implements a
6847 special comparison (__cmp__) which disallows comparing to
6853 special comparison (__cmp__) which disallows comparing to
6848 None. Found it when trying to use the PhysicalQuantity module from
6854 None. Found it when trying to use the PhysicalQuantity module from
6849 ScientificPython.
6855 ScientificPython.
6850
6856
6851 2001-11-05 Fernando Perez <fperez@colorado.edu>
6857 2001-11-05 Fernando Perez <fperez@colorado.edu>
6852
6858
6853 * Also added dirs. Now the pushd/popd/dirs family functions
6859 * Also added dirs. Now the pushd/popd/dirs family functions
6854 basically like the shell, with the added convenience of going home
6860 basically like the shell, with the added convenience of going home
6855 when called with no args.
6861 when called with no args.
6856
6862
6857 * pushd/popd slightly modified to mimic shell behavior more
6863 * pushd/popd slightly modified to mimic shell behavior more
6858 closely.
6864 closely.
6859
6865
6860 * Added env,pushd,popd from ShellServices as magic functions. I
6866 * Added env,pushd,popd from ShellServices as magic functions. I
6861 think the cleanest will be to port all desired functions from
6867 think the cleanest will be to port all desired functions from
6862 ShellServices as magics and remove ShellServices altogether. This
6868 ShellServices as magics and remove ShellServices altogether. This
6863 will provide a single, clean way of adding functionality
6869 will provide a single, clean way of adding functionality
6864 (shell-type or otherwise) to IP.
6870 (shell-type or otherwise) to IP.
6865
6871
6866 2001-11-04 Fernando Perez <fperez@colorado.edu>
6872 2001-11-04 Fernando Perez <fperez@colorado.edu>
6867
6873
6868 * Added .ipython/ directory to sys.path. This way users can keep
6874 * Added .ipython/ directory to sys.path. This way users can keep
6869 customizations there and access them via import.
6875 customizations there and access them via import.
6870
6876
6871 2001-11-03 Fernando Perez <fperez@colorado.edu>
6877 2001-11-03 Fernando Perez <fperez@colorado.edu>
6872
6878
6873 * Opened version 0.1.1 for new changes.
6879 * Opened version 0.1.1 for new changes.
6874
6880
6875 * Changed version number to 0.1.0: first 'public' release, sent to
6881 * Changed version number to 0.1.0: first 'public' release, sent to
6876 Nathan and Janko.
6882 Nathan and Janko.
6877
6883
6878 * Lots of small fixes and tweaks.
6884 * Lots of small fixes and tweaks.
6879
6885
6880 * Minor changes to whos format. Now strings are shown, snipped if
6886 * Minor changes to whos format. Now strings are shown, snipped if
6881 too long.
6887 too long.
6882
6888
6883 * Changed ShellServices to work on __main__ so they show up in @who
6889 * Changed ShellServices to work on __main__ so they show up in @who
6884
6890
6885 * Help also works with ? at the end of a line:
6891 * Help also works with ? at the end of a line:
6886 ?sin and sin?
6892 ?sin and sin?
6887 both produce the same effect. This is nice, as often I use the
6893 both produce the same effect. This is nice, as often I use the
6888 tab-complete to find the name of a method, but I used to then have
6894 tab-complete to find the name of a method, but I used to then have
6889 to go to the beginning of the line to put a ? if I wanted more
6895 to go to the beginning of the line to put a ? if I wanted more
6890 info. Now I can just add the ? and hit return. Convenient.
6896 info. Now I can just add the ? and hit return. Convenient.
6891
6897
6892 2001-11-02 Fernando Perez <fperez@colorado.edu>
6898 2001-11-02 Fernando Perez <fperez@colorado.edu>
6893
6899
6894 * Python version check (>=2.1) added.
6900 * Python version check (>=2.1) added.
6895
6901
6896 * Added LazyPython documentation. At this point the docs are quite
6902 * Added LazyPython documentation. At this point the docs are quite
6897 a mess. A cleanup is in order.
6903 a mess. A cleanup is in order.
6898
6904
6899 * Auto-installer created. For some bizarre reason, the zipfiles
6905 * Auto-installer created. For some bizarre reason, the zipfiles
6900 module isn't working on my system. So I made a tar version
6906 module isn't working on my system. So I made a tar version
6901 (hopefully the command line options in various systems won't kill
6907 (hopefully the command line options in various systems won't kill
6902 me).
6908 me).
6903
6909
6904 * Fixes to Struct in genutils. Now all dictionary-like methods are
6910 * Fixes to Struct in genutils. Now all dictionary-like methods are
6905 protected (reasonably).
6911 protected (reasonably).
6906
6912
6907 * Added pager function to genutils and changed ? to print usage
6913 * Added pager function to genutils and changed ? to print usage
6908 note through it (it was too long).
6914 note through it (it was too long).
6909
6915
6910 * Added the LazyPython functionality. Works great! I changed the
6916 * Added the LazyPython functionality. Works great! I changed the
6911 auto-quote escape to ';', it's on home row and next to '. But
6917 auto-quote escape to ';', it's on home row and next to '. But
6912 both auto-quote and auto-paren (still /) escapes are command-line
6918 both auto-quote and auto-paren (still /) escapes are command-line
6913 parameters.
6919 parameters.
6914
6920
6915
6921
6916 2001-11-01 Fernando Perez <fperez@colorado.edu>
6922 2001-11-01 Fernando Perez <fperez@colorado.edu>
6917
6923
6918 * Version changed to 0.0.7. Fairly large change: configuration now
6924 * Version changed to 0.0.7. Fairly large change: configuration now
6919 is all stored in a directory, by default .ipython. There, all
6925 is all stored in a directory, by default .ipython. There, all
6920 config files have normal looking names (not .names)
6926 config files have normal looking names (not .names)
6921
6927
6922 * Version 0.0.6 Released first to Lucas and Archie as a test
6928 * Version 0.0.6 Released first to Lucas and Archie as a test
6923 run. Since it's the first 'semi-public' release, change version to
6929 run. Since it's the first 'semi-public' release, change version to
6924 > 0.0.6 for any changes now.
6930 > 0.0.6 for any changes now.
6925
6931
6926 * Stuff I had put in the ipplib.py changelog:
6932 * Stuff I had put in the ipplib.py changelog:
6927
6933
6928 Changes to InteractiveShell:
6934 Changes to InteractiveShell:
6929
6935
6930 - Made the usage message a parameter.
6936 - Made the usage message a parameter.
6931
6937
6932 - Require the name of the shell variable to be given. It's a bit
6938 - Require the name of the shell variable to be given. It's a bit
6933 of a hack, but allows the name 'shell' not to be hardwired in the
6939 of a hack, but allows the name 'shell' not to be hardwired in the
6934 magic (@) handler, which is problematic b/c it requires
6940 magic (@) handler, which is problematic b/c it requires
6935 polluting the global namespace with 'shell'. This in turn is
6941 polluting the global namespace with 'shell'. This in turn is
6936 fragile: if a user redefines a variable called shell, things
6942 fragile: if a user redefines a variable called shell, things
6937 break.
6943 break.
6938
6944
6939 - magic @: all functions available through @ need to be defined
6945 - magic @: all functions available through @ need to be defined
6940 as magic_<name>, even though they can be called simply as
6946 as magic_<name>, even though they can be called simply as
6941 @<name>. This allows the special command @magic to gather
6947 @<name>. This allows the special command @magic to gather
6942 information automatically about all existing magic functions,
6948 information automatically about all existing magic functions,
6943 even if they are run-time user extensions, by parsing the shell
6949 even if they are run-time user extensions, by parsing the shell
6944 instance __dict__ looking for special magic_ names.
6950 instance __dict__ looking for special magic_ names.
6945
6951
6946 - mainloop: added *two* local namespace parameters. This allows
6952 - mainloop: added *two* local namespace parameters. This allows
6947 the class to differentiate between parameters which were there
6953 the class to differentiate between parameters which were there
6948 before and after command line initialization was processed. This
6954 before and after command line initialization was processed. This
6949 way, later @who can show things loaded at startup by the
6955 way, later @who can show things loaded at startup by the
6950 user. This trick was necessary to make session saving/reloading
6956 user. This trick was necessary to make session saving/reloading
6951 really work: ideally after saving/exiting/reloading a session,
6957 really work: ideally after saving/exiting/reloading a session,
6952 *everything* should look the same, including the output of @who. I
6958 *everything* should look the same, including the output of @who. I
6953 was only able to make this work with this double namespace
6959 was only able to make this work with this double namespace
6954 trick.
6960 trick.
6955
6961
6956 - added a header to the logfile which allows (almost) full
6962 - added a header to the logfile which allows (almost) full
6957 session restoring.
6963 session restoring.
6958
6964
6959 - prepend lines beginning with @ or !, with a and log
6965 - prepend lines beginning with @ or !, with a and log
6960 them. Why? !lines: may be useful to know what you did @lines:
6966 them. Why? !lines: may be useful to know what you did @lines:
6961 they may affect session state. So when restoring a session, at
6967 they may affect session state. So when restoring a session, at
6962 least inform the user of their presence. I couldn't quite get
6968 least inform the user of their presence. I couldn't quite get
6963 them to properly re-execute, but at least the user is warned.
6969 them to properly re-execute, but at least the user is warned.
6964
6970
6965 * Started ChangeLog.
6971 * Started ChangeLog.
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now