##// END OF EJS Templates
Fix gtk threading bug
fperez -
Show More
@@ -1,917 +1,917 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """IPython Shell classes.
2 """IPython Shell classes.
3
3
4 All the matplotlib support code was co-developed with John Hunter,
4 All the matplotlib support code was co-developed with John Hunter,
5 matplotlib's author.
5 matplotlib's author.
6
6
7 $Id: Shell.py 965 2005-12-28 23:23:09Z fperez $"""
7 $Id: Shell.py 993 2006-01-04 19:51:01Z fperez $"""
8
8
9 #*****************************************************************************
9 #*****************************************************************************
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.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 from IPython import Release
16 from IPython import Release
17 __author__ = '%s <%s>' % Release.authors['Fernando']
17 __author__ = '%s <%s>' % Release.authors['Fernando']
18 __license__ = Release.license
18 __license__ = Release.license
19
19
20 # Code begins
20 # Code begins
21 import __main__
21 import __main__
22 import __builtin__
22 import __builtin__
23 import os
23 import os
24 import sys
24 import sys
25 import signal
25 import signal
26 import threading
26 import threading
27
27
28 import IPython
28 import IPython
29 from IPython import ultraTB
29 from IPython import ultraTB
30 from IPython.genutils import Term,warn,error,flag_calls
30 from IPython.genutils import Term,warn,error,flag_calls
31 from IPython.iplib import InteractiveShell
31 from IPython.iplib import InteractiveShell
32 from IPython.ipmaker import make_IPython
32 from IPython.ipmaker import make_IPython
33 from IPython.Magic import Magic
33 from IPython.Magic import Magic
34 from IPython.Struct import Struct
34 from IPython.Struct import Struct
35
35
36 # global flag to pass around information about Ctrl-C without exceptions
36 # global flag to pass around information about Ctrl-C without exceptions
37 KBINT = False
37 KBINT = False
38
38
39 # global flag to turn on/off Tk support.
39 # global flag to turn on/off Tk support.
40 USE_TK = False
40 USE_TK = False
41
41
42 #-----------------------------------------------------------------------------
42 #-----------------------------------------------------------------------------
43 # This class is trivial now, but I want to have it in to publish a clean
43 # This class is trivial now, but I want to have it in to publish a clean
44 # interface. Later when the internals are reorganized, code that uses this
44 # interface. Later when the internals are reorganized, code that uses this
45 # shouldn't have to change.
45 # shouldn't have to change.
46
46
47 class IPShell:
47 class IPShell:
48 """Create an IPython instance."""
48 """Create an IPython instance."""
49
49
50 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
50 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
51 debug=1,shell_class=InteractiveShell):
51 debug=1,shell_class=InteractiveShell):
52 self.IP = make_IPython(argv,user_ns=user_ns,user_global_ns=user_global_ns,
52 self.IP = make_IPython(argv,user_ns=user_ns,user_global_ns=user_global_ns,
53 debug=debug,shell_class=shell_class)
53 debug=debug,shell_class=shell_class)
54
54
55 def mainloop(self,sys_exit=0,banner=None):
55 def mainloop(self,sys_exit=0,banner=None):
56 self.IP.mainloop(banner)
56 self.IP.mainloop(banner)
57 if sys_exit:
57 if sys_exit:
58 sys.exit()
58 sys.exit()
59
59
60 #-----------------------------------------------------------------------------
60 #-----------------------------------------------------------------------------
61 class IPShellEmbed:
61 class IPShellEmbed:
62 """Allow embedding an IPython shell into a running program.
62 """Allow embedding an IPython shell into a running program.
63
63
64 Instances of this class are callable, with the __call__ method being an
64 Instances of this class are callable, with the __call__ method being an
65 alias to the embed() method of an InteractiveShell instance.
65 alias to the embed() method of an InteractiveShell instance.
66
66
67 Usage (see also the example-embed.py file for a running example):
67 Usage (see also the example-embed.py file for a running example):
68
68
69 ipshell = IPShellEmbed([argv,banner,exit_msg,rc_override])
69 ipshell = IPShellEmbed([argv,banner,exit_msg,rc_override])
70
70
71 - argv: list containing valid command-line options for IPython, as they
71 - argv: list containing valid command-line options for IPython, as they
72 would appear in sys.argv[1:].
72 would appear in sys.argv[1:].
73
73
74 For example, the following command-line options:
74 For example, the following command-line options:
75
75
76 $ ipython -prompt_in1 'Input <\\#>' -colors LightBG
76 $ ipython -prompt_in1 'Input <\\#>' -colors LightBG
77
77
78 would be passed in the argv list as:
78 would be passed in the argv list as:
79
79
80 ['-prompt_in1','Input <\\#>','-colors','LightBG']
80 ['-prompt_in1','Input <\\#>','-colors','LightBG']
81
81
82 - banner: string which gets printed every time the interpreter starts.
82 - banner: string which gets printed every time the interpreter starts.
83
83
84 - exit_msg: string which gets printed every time the interpreter exits.
84 - exit_msg: string which gets printed every time the interpreter exits.
85
85
86 - rc_override: a dict or Struct of configuration options such as those
86 - rc_override: a dict or Struct of configuration options such as those
87 used by IPython. These options are read from your ~/.ipython/ipythonrc
87 used by IPython. These options are read from your ~/.ipython/ipythonrc
88 file when the Shell object is created. Passing an explicit rc_override
88 file when the Shell object is created. Passing an explicit rc_override
89 dict with any options you want allows you to override those values at
89 dict with any options you want allows you to override those values at
90 creation time without having to modify the file. This way you can create
90 creation time without having to modify the file. This way you can create
91 embeddable instances configured in any way you want without editing any
91 embeddable instances configured in any way you want without editing any
92 global files (thus keeping your interactive IPython configuration
92 global files (thus keeping your interactive IPython configuration
93 unchanged).
93 unchanged).
94
94
95 Then the ipshell instance can be called anywhere inside your code:
95 Then the ipshell instance can be called anywhere inside your code:
96
96
97 ipshell(header='') -> Opens up an IPython shell.
97 ipshell(header='') -> Opens up an IPython shell.
98
98
99 - header: string printed by the IPython shell upon startup. This can let
99 - header: string printed by the IPython shell upon startup. This can let
100 you know where in your code you are when dropping into the shell. Note
100 you know where in your code you are when dropping into the shell. Note
101 that 'banner' gets prepended to all calls, so header is used for
101 that 'banner' gets prepended to all calls, so header is used for
102 location-specific information.
102 location-specific information.
103
103
104 For more details, see the __call__ method below.
104 For more details, see the __call__ method below.
105
105
106 When the IPython shell is exited with Ctrl-D, normal program execution
106 When the IPython shell is exited with Ctrl-D, normal program execution
107 resumes.
107 resumes.
108
108
109 This functionality was inspired by a posting on comp.lang.python by cmkl
109 This functionality was inspired by a posting on comp.lang.python by cmkl
110 <cmkleffner@gmx.de> on Dec. 06/01 concerning similar uses of pyrepl, and
110 <cmkleffner@gmx.de> on Dec. 06/01 concerning similar uses of pyrepl, and
111 by the IDL stop/continue commands."""
111 by the IDL stop/continue commands."""
112
112
113 def __init__(self,argv=None,banner='',exit_msg=None,rc_override=None):
113 def __init__(self,argv=None,banner='',exit_msg=None,rc_override=None):
114 """Note that argv here is a string, NOT a list."""
114 """Note that argv here is a string, NOT a list."""
115 self.set_banner(banner)
115 self.set_banner(banner)
116 self.set_exit_msg(exit_msg)
116 self.set_exit_msg(exit_msg)
117 self.set_dummy_mode(0)
117 self.set_dummy_mode(0)
118
118
119 # sys.displayhook is a global, we need to save the user's original
119 # sys.displayhook is a global, we need to save the user's original
120 # Don't rely on __displayhook__, as the user may have changed that.
120 # Don't rely on __displayhook__, as the user may have changed that.
121 self.sys_displayhook_ori = sys.displayhook
121 self.sys_displayhook_ori = sys.displayhook
122
122
123 # save readline completer status
123 # save readline completer status
124 try:
124 try:
125 #print 'Save completer',sys.ipcompleter # dbg
125 #print 'Save completer',sys.ipcompleter # dbg
126 self.sys_ipcompleter_ori = sys.ipcompleter
126 self.sys_ipcompleter_ori = sys.ipcompleter
127 except:
127 except:
128 pass # not nested with IPython
128 pass # not nested with IPython
129
129
130 # FIXME. Passing user_ns breaks namespace handling.
130 # FIXME. Passing user_ns breaks namespace handling.
131 #self.IP = make_IPython(argv,user_ns=__main__.__dict__)
131 #self.IP = make_IPython(argv,user_ns=__main__.__dict__)
132 self.IP = make_IPython(argv,rc_override=rc_override,embedded=True)
132 self.IP = make_IPython(argv,rc_override=rc_override,embedded=True)
133
133
134 # copy our own displayhook also
134 # copy our own displayhook also
135 self.sys_displayhook_embed = sys.displayhook
135 self.sys_displayhook_embed = sys.displayhook
136 # and leave the system's display hook clean
136 # and leave the system's display hook clean
137 sys.displayhook = self.sys_displayhook_ori
137 sys.displayhook = self.sys_displayhook_ori
138 # don't use the ipython crash handler so that user exceptions aren't
138 # don't use the ipython crash handler so that user exceptions aren't
139 # trapped
139 # trapped
140 sys.excepthook = ultraTB.FormattedTB(color_scheme = self.IP.rc.colors,
140 sys.excepthook = ultraTB.FormattedTB(color_scheme = self.IP.rc.colors,
141 mode = self.IP.rc.xmode,
141 mode = self.IP.rc.xmode,
142 call_pdb = self.IP.rc.pdb)
142 call_pdb = self.IP.rc.pdb)
143 self.restore_system_completer()
143 self.restore_system_completer()
144
144
145 def restore_system_completer(self):
145 def restore_system_completer(self):
146 """Restores the readline completer which was in place.
146 """Restores the readline completer which was in place.
147
147
148 This allows embedded IPython within IPython not to disrupt the
148 This allows embedded IPython within IPython not to disrupt the
149 parent's completion.
149 parent's completion.
150 """
150 """
151
151
152 try:
152 try:
153 self.IP.readline.set_completer(self.sys_ipcompleter_ori)
153 self.IP.readline.set_completer(self.sys_ipcompleter_ori)
154 sys.ipcompleter = self.sys_ipcompleter_ori
154 sys.ipcompleter = self.sys_ipcompleter_ori
155 except:
155 except:
156 pass
156 pass
157
157
158 def __call__(self,header='',local_ns=None,global_ns=None,dummy=None):
158 def __call__(self,header='',local_ns=None,global_ns=None,dummy=None):
159 """Activate the interactive interpreter.
159 """Activate the interactive interpreter.
160
160
161 __call__(self,header='',local_ns=None,global_ns,dummy=None) -> Start
161 __call__(self,header='',local_ns=None,global_ns,dummy=None) -> Start
162 the interpreter shell with the given local and global namespaces, and
162 the interpreter shell with the given local and global namespaces, and
163 optionally print a header string at startup.
163 optionally print a header string at startup.
164
164
165 The shell can be globally activated/deactivated using the
165 The shell can be globally activated/deactivated using the
166 set/get_dummy_mode methods. This allows you to turn off a shell used
166 set/get_dummy_mode methods. This allows you to turn off a shell used
167 for debugging globally.
167 for debugging globally.
168
168
169 However, *each* time you call the shell you can override the current
169 However, *each* time you call the shell you can override the current
170 state of dummy_mode with the optional keyword parameter 'dummy'. For
170 state of dummy_mode with the optional keyword parameter 'dummy'. For
171 example, if you set dummy mode on with IPShell.set_dummy_mode(1), you
171 example, if you set dummy mode on with IPShell.set_dummy_mode(1), you
172 can still have a specific call work by making it as IPShell(dummy=0).
172 can still have a specific call work by making it as IPShell(dummy=0).
173
173
174 The optional keyword parameter dummy controls whether the call
174 The optional keyword parameter dummy controls whether the call
175 actually does anything. """
175 actually does anything. """
176
176
177 # Allow the dummy parameter to override the global __dummy_mode
177 # Allow the dummy parameter to override the global __dummy_mode
178 if dummy or (dummy != 0 and self.__dummy_mode):
178 if dummy or (dummy != 0 and self.__dummy_mode):
179 return
179 return
180
180
181 # Set global subsystems (display,completions) to our values
181 # Set global subsystems (display,completions) to our values
182 sys.displayhook = self.sys_displayhook_embed
182 sys.displayhook = self.sys_displayhook_embed
183 if self.IP.has_readline:
183 if self.IP.has_readline:
184 self.IP.readline.set_completer(self.IP.Completer.complete)
184 self.IP.readline.set_completer(self.IP.Completer.complete)
185
185
186 if self.banner and header:
186 if self.banner and header:
187 format = '%s\n%s\n'
187 format = '%s\n%s\n'
188 else:
188 else:
189 format = '%s%s\n'
189 format = '%s%s\n'
190 banner = format % (self.banner,header)
190 banner = format % (self.banner,header)
191
191
192 # Call the embedding code with a stack depth of 1 so it can skip over
192 # Call the embedding code with a stack depth of 1 so it can skip over
193 # our call and get the original caller's namespaces.
193 # our call and get the original caller's namespaces.
194 self.IP.embed_mainloop(banner,local_ns,global_ns,stack_depth=1)
194 self.IP.embed_mainloop(banner,local_ns,global_ns,stack_depth=1)
195
195
196 if self.exit_msg:
196 if self.exit_msg:
197 print self.exit_msg
197 print self.exit_msg
198
198
199 # Restore global systems (display, completion)
199 # Restore global systems (display, completion)
200 sys.displayhook = self.sys_displayhook_ori
200 sys.displayhook = self.sys_displayhook_ori
201 self.restore_system_completer()
201 self.restore_system_completer()
202
202
203 def set_dummy_mode(self,dummy):
203 def set_dummy_mode(self,dummy):
204 """Sets the embeddable shell's dummy mode parameter.
204 """Sets the embeddable shell's dummy mode parameter.
205
205
206 set_dummy_mode(dummy): dummy = 0 or 1.
206 set_dummy_mode(dummy): dummy = 0 or 1.
207
207
208 This parameter is persistent and makes calls to the embeddable shell
208 This parameter is persistent and makes calls to the embeddable shell
209 silently return without performing any action. This allows you to
209 silently return without performing any action. This allows you to
210 globally activate or deactivate a shell you're using with a single call.
210 globally activate or deactivate a shell you're using with a single call.
211
211
212 If you need to manually"""
212 If you need to manually"""
213
213
214 if dummy not in [0,1,False,True]:
214 if dummy not in [0,1,False,True]:
215 raise ValueError,'dummy parameter must be boolean'
215 raise ValueError,'dummy parameter must be boolean'
216 self.__dummy_mode = dummy
216 self.__dummy_mode = dummy
217
217
218 def get_dummy_mode(self):
218 def get_dummy_mode(self):
219 """Return the current value of the dummy mode parameter.
219 """Return the current value of the dummy mode parameter.
220 """
220 """
221 return self.__dummy_mode
221 return self.__dummy_mode
222
222
223 def set_banner(self,banner):
223 def set_banner(self,banner):
224 """Sets the global banner.
224 """Sets the global banner.
225
225
226 This banner gets prepended to every header printed when the shell
226 This banner gets prepended to every header printed when the shell
227 instance is called."""
227 instance is called."""
228
228
229 self.banner = banner
229 self.banner = banner
230
230
231 def set_exit_msg(self,exit_msg):
231 def set_exit_msg(self,exit_msg):
232 """Sets the global exit_msg.
232 """Sets the global exit_msg.
233
233
234 This exit message gets printed upon exiting every time the embedded
234 This exit message gets printed upon exiting every time the embedded
235 shell is called. It is None by default. """
235 shell is called. It is None by default. """
236
236
237 self.exit_msg = exit_msg
237 self.exit_msg = exit_msg
238
238
239 #-----------------------------------------------------------------------------
239 #-----------------------------------------------------------------------------
240 def sigint_handler (signum,stack_frame):
240 def sigint_handler (signum,stack_frame):
241 """Sigint handler for threaded apps.
241 """Sigint handler for threaded apps.
242
242
243 This is a horrible hack to pass information about SIGINT _without_ using
243 This is a horrible hack to pass information about SIGINT _without_ using
244 exceptions, since I haven't been able to properly manage cross-thread
244 exceptions, since I haven't been able to properly manage cross-thread
245 exceptions in GTK/WX. In fact, I don't think it can be done (or at least
245 exceptions in GTK/WX. In fact, I don't think it can be done (or at least
246 that's my understanding from a c.l.py thread where this was discussed)."""
246 that's my understanding from a c.l.py thread where this was discussed)."""
247
247
248 global KBINT
248 global KBINT
249
249
250 print '\nKeyboardInterrupt - Press <Enter> to continue.',
250 print '\nKeyboardInterrupt - Press <Enter> to continue.',
251 Term.cout.flush()
251 Term.cout.flush()
252 # Set global flag so that runsource can know that Ctrl-C was hit
252 # Set global flag so that runsource can know that Ctrl-C was hit
253 KBINT = True
253 KBINT = True
254
254
255 class MTInteractiveShell(InteractiveShell):
255 class MTInteractiveShell(InteractiveShell):
256 """Simple multi-threaded shell."""
256 """Simple multi-threaded shell."""
257
257
258 # Threading strategy taken from:
258 # Threading strategy taken from:
259 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
259 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
260 # McErlean and John Finlay. Modified with corrections by Antoon Pardon,
260 # McErlean and John Finlay. Modified with corrections by Antoon Pardon,
261 # from the pygtk mailing list, to avoid lockups with system calls.
261 # from the pygtk mailing list, to avoid lockups with system calls.
262
262
263 # class attribute to indicate whether the class supports threads or not.
263 # class attribute to indicate whether the class supports threads or not.
264 # Subclasses with thread support should override this as needed.
264 # Subclasses with thread support should override this as needed.
265 isthreaded = True
265 isthreaded = True
266
266
267 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
267 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
268 user_ns=None,user_global_ns=None,banner2='',**kw):
268 user_ns=None,user_global_ns=None,banner2='',**kw):
269 """Similar to the normal InteractiveShell, but with threading control"""
269 """Similar to the normal InteractiveShell, but with threading control"""
270
270
271 InteractiveShell.__init__(self,name,usage,rc,user_ns,
271 InteractiveShell.__init__(self,name,usage,rc,user_ns,
272 user_global_ns,banner2)
272 user_global_ns,banner2)
273
273
274 # Locking control variable
274 # Locking control variable
275 self.thread_ready = threading.Condition()
275 self.thread_ready = threading.Condition()
276
276
277 # Stuff to do at closing time
277 # Stuff to do at closing time
278 self._kill = False
278 self._kill = False
279 on_kill = kw.get('on_kill')
279 on_kill = kw.get('on_kill')
280 if on_kill is None:
280 if on_kill is None:
281 on_kill = []
281 on_kill = []
282 # Check that all things to kill are callable:
282 # Check that all things to kill are callable:
283 for t in on_kill:
283 for t in on_kill:
284 if not callable(t):
284 if not callable(t):
285 raise TypeError,'on_kill must be a list of callables'
285 raise TypeError,'on_kill must be a list of callables'
286 self.on_kill = on_kill
286 self.on_kill = on_kill
287
287
288 def runsource(self, source, filename="<input>", symbol="single"):
288 def runsource(self, source, filename="<input>", symbol="single"):
289 """Compile and run some source in the interpreter.
289 """Compile and run some source in the interpreter.
290
290
291 Modified version of code.py's runsource(), to handle threading issues.
291 Modified version of code.py's runsource(), to handle threading issues.
292 See the original for full docstring details."""
292 See the original for full docstring details."""
293
293
294 global KBINT
294 global KBINT
295
295
296 # If Ctrl-C was typed, we reset the flag and return right away
296 # If Ctrl-C was typed, we reset the flag and return right away
297 if KBINT:
297 if KBINT:
298 KBINT = False
298 KBINT = False
299 return False
299 return False
300
300
301 try:
301 try:
302 code = self.compile(source, filename, symbol)
302 code = self.compile(source, filename, symbol)
303 except (OverflowError, SyntaxError, ValueError):
303 except (OverflowError, SyntaxError, ValueError):
304 # Case 1
304 # Case 1
305 self.showsyntaxerror(filename)
305 self.showsyntaxerror(filename)
306 return False
306 return False
307
307
308 if code is None:
308 if code is None:
309 # Case 2
309 # Case 2
310 return True
310 return True
311
311
312 # Case 3
312 # Case 3
313 # Store code in self, so the execution thread can handle it
313 # Store code in self, so the execution thread can handle it
314 self.thread_ready.acquire()
314 self.thread_ready.acquire()
315 self.code_to_run = code
315 self.code_to_run = code
316 self.thread_ready.wait() # Wait until processed in timeout interval
316 self.thread_ready.wait() # Wait until processed in timeout interval
317 self.thread_ready.release()
317 self.thread_ready.release()
318
318
319 return False
319 return False
320
320
321 def runcode(self):
321 def runcode(self):
322 """Execute a code object.
322 """Execute a code object.
323
323
324 Multithreaded wrapper around IPython's runcode()."""
324 Multithreaded wrapper around IPython's runcode()."""
325
325
326 # lock thread-protected stuff
326 # lock thread-protected stuff
327 self.thread_ready.acquire()
327 self.thread_ready.acquire()
328
328
329 # Install sigint handler
329 # Install sigint handler
330 try:
330 try:
331 signal.signal(signal.SIGINT, sigint_handler)
331 signal.signal(signal.SIGINT, sigint_handler)
332 except SystemError:
332 except SystemError:
333 # This happens under Windows, which seems to have all sorts
333 # This happens under Windows, which seems to have all sorts
334 # of problems with signal handling. Oh well...
334 # of problems with signal handling. Oh well...
335 pass
335 pass
336
336
337 if self._kill:
337 if self._kill:
338 print >>Term.cout, 'Closing threads...',
338 print >>Term.cout, 'Closing threads...',
339 Term.cout.flush()
339 Term.cout.flush()
340 for tokill in self.on_kill:
340 for tokill in self.on_kill:
341 tokill()
341 tokill()
342 print >>Term.cout, 'Done.'
342 print >>Term.cout, 'Done.'
343
343
344 # Run pending code by calling parent class
344 # Run pending code by calling parent class
345 if self.code_to_run is not None:
345 if self.code_to_run is not None:
346 self.thread_ready.notify()
346 self.thread_ready.notify()
347 InteractiveShell.runcode(self,self.code_to_run)
347 InteractiveShell.runcode(self,self.code_to_run)
348
348
349 # We're done with thread-protected variables
349 # We're done with thread-protected variables
350 self.thread_ready.release()
350 self.thread_ready.release()
351 # This MUST return true for gtk threading to work
351 # This MUST return true for gtk threading to work
352 return True
352 return True
353
353
354 def kill (self):
354 def kill (self):
355 """Kill the thread, returning when it has been shut down."""
355 """Kill the thread, returning when it has been shut down."""
356 self.thread_ready.acquire()
356 self.thread_ready.acquire()
357 self._kill = True
357 self._kill = True
358 self.thread_ready.release()
358 self.thread_ready.release()
359
359
360 class MatplotlibShellBase:
360 class MatplotlibShellBase:
361 """Mixin class to provide the necessary modifications to regular IPython
361 """Mixin class to provide the necessary modifications to regular IPython
362 shell classes for matplotlib support.
362 shell classes for matplotlib support.
363
363
364 Given Python's MRO, this should be used as the FIRST class in the
364 Given Python's MRO, this should be used as the FIRST class in the
365 inheritance hierarchy, so that it overrides the relevant methods."""
365 inheritance hierarchy, so that it overrides the relevant methods."""
366
366
367 def _matplotlib_config(self,name):
367 def _matplotlib_config(self,name):
368 """Return various items needed to setup the user's shell with matplotlib"""
368 """Return various items needed to setup the user's shell with matplotlib"""
369
369
370 # Initialize matplotlib to interactive mode always
370 # Initialize matplotlib to interactive mode always
371 import matplotlib
371 import matplotlib
372 from matplotlib import backends
372 from matplotlib import backends
373 matplotlib.interactive(True)
373 matplotlib.interactive(True)
374
374
375 def use(arg):
375 def use(arg):
376 """IPython wrapper for matplotlib's backend switcher.
376 """IPython wrapper for matplotlib's backend switcher.
377
377
378 In interactive use, we can not allow switching to a different
378 In interactive use, we can not allow switching to a different
379 interactive backend, since thread conflicts will most likely crash
379 interactive backend, since thread conflicts will most likely crash
380 the python interpreter. This routine does a safety check first,
380 the python interpreter. This routine does a safety check first,
381 and refuses to perform a dangerous switch. It still allows
381 and refuses to perform a dangerous switch. It still allows
382 switching to non-interactive backends."""
382 switching to non-interactive backends."""
383
383
384 if arg in backends.interactive_bk and arg != self.mpl_backend:
384 if arg in backends.interactive_bk and arg != self.mpl_backend:
385 m=('invalid matplotlib backend switch.\n'
385 m=('invalid matplotlib backend switch.\n'
386 'This script attempted to switch to the interactive '
386 'This script attempted to switch to the interactive '
387 'backend: `%s`\n'
387 'backend: `%s`\n'
388 'Your current choice of interactive backend is: `%s`\n\n'
388 'Your current choice of interactive backend is: `%s`\n\n'
389 'Switching interactive matplotlib backends at runtime\n'
389 'Switching interactive matplotlib backends at runtime\n'
390 'would crash the python interpreter, '
390 'would crash the python interpreter, '
391 'and IPython has blocked it.\n\n'
391 'and IPython has blocked it.\n\n'
392 'You need to either change your choice of matplotlib backend\n'
392 'You need to either change your choice of matplotlib backend\n'
393 'by editing your .matplotlibrc file, or run this script as a \n'
393 'by editing your .matplotlibrc file, or run this script as a \n'
394 'standalone file from the command line, not using IPython.\n' %
394 'standalone file from the command line, not using IPython.\n' %
395 (arg,self.mpl_backend) )
395 (arg,self.mpl_backend) )
396 raise RuntimeError, m
396 raise RuntimeError, m
397 else:
397 else:
398 self.mpl_use(arg)
398 self.mpl_use(arg)
399 self.mpl_use._called = True
399 self.mpl_use._called = True
400
400
401 self.matplotlib = matplotlib
401 self.matplotlib = matplotlib
402 self.mpl_backend = matplotlib.rcParams['backend']
402 self.mpl_backend = matplotlib.rcParams['backend']
403
403
404 # we also need to block switching of interactive backends by use()
404 # we also need to block switching of interactive backends by use()
405 self.mpl_use = matplotlib.use
405 self.mpl_use = matplotlib.use
406 self.mpl_use._called = False
406 self.mpl_use._called = False
407 # overwrite the original matplotlib.use with our wrapper
407 # overwrite the original matplotlib.use with our wrapper
408 matplotlib.use = use
408 matplotlib.use = use
409
409
410
410
411 # This must be imported last in the matplotlib series, after
411 # This must be imported last in the matplotlib series, after
412 # backend/interactivity choices have been made
412 # backend/interactivity choices have been made
413 try:
413 try:
414 import matplotlib.pylab as pylab
414 import matplotlib.pylab as pylab
415 self.pylab = pylab
415 self.pylab = pylab
416 self.pylab_name = 'pylab'
416 self.pylab_name = 'pylab'
417 except ImportError:
417 except ImportError:
418 import matplotlib.matlab as matlab
418 import matplotlib.matlab as matlab
419 self.pylab = matlab
419 self.pylab = matlab
420 self.pylab_name = 'matlab'
420 self.pylab_name = 'matlab'
421
421
422 self.pylab.show._needmain = False
422 self.pylab.show._needmain = False
423 # We need to detect at runtime whether show() is called by the user.
423 # We need to detect at runtime whether show() is called by the user.
424 # For this, we wrap it into a decorator which adds a 'called' flag.
424 # For this, we wrap it into a decorator which adds a 'called' flag.
425 self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive)
425 self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive)
426
426
427 # Build a user namespace initialized with matplotlib/matlab features.
427 # Build a user namespace initialized with matplotlib/matlab features.
428 user_ns = {'__name__':'__main__',
428 user_ns = {'__name__':'__main__',
429 '__builtins__' : __builtin__ }
429 '__builtins__' : __builtin__ }
430
430
431 # Be careful not to remove the final \n in the code string below, or
431 # Be careful not to remove the final \n in the code string below, or
432 # things will break badly with py22 (I think it's a python bug, 2.3 is
432 # things will break badly with py22 (I think it's a python bug, 2.3 is
433 # OK).
433 # OK).
434 pname = self.pylab_name # Python can't interpolate dotted var names
434 pname = self.pylab_name # Python can't interpolate dotted var names
435 exec ("import matplotlib\n"
435 exec ("import matplotlib\n"
436 "import matplotlib.%(pname)s as %(pname)s\n"
436 "import matplotlib.%(pname)s as %(pname)s\n"
437 "from matplotlib.%(pname)s import *\n" % locals()) in user_ns
437 "from matplotlib.%(pname)s import *\n" % locals()) in user_ns
438
438
439 # Build matplotlib info banner
439 # Build matplotlib info banner
440 b="""
440 b="""
441 Welcome to pylab, a matplotlib-based Python environment.
441 Welcome to pylab, a matplotlib-based Python environment.
442 For more information, type 'help(pylab)'.
442 For more information, type 'help(pylab)'.
443 """
443 """
444 return user_ns,b
444 return user_ns,b
445
445
446 def mplot_exec(self,fname,*where,**kw):
446 def mplot_exec(self,fname,*where,**kw):
447 """Execute a matplotlib script.
447 """Execute a matplotlib script.
448
448
449 This is a call to execfile(), but wrapped in safeties to properly
449 This is a call to execfile(), but wrapped in safeties to properly
450 handle interactive rendering and backend switching."""
450 handle interactive rendering and backend switching."""
451
451
452 #print '*** Matplotlib runner ***' # dbg
452 #print '*** Matplotlib runner ***' # dbg
453 # turn off rendering until end of script
453 # turn off rendering until end of script
454 isInteractive = self.matplotlib.rcParams['interactive']
454 isInteractive = self.matplotlib.rcParams['interactive']
455 self.matplotlib.interactive(False)
455 self.matplotlib.interactive(False)
456 self.safe_execfile(fname,*where,**kw)
456 self.safe_execfile(fname,*where,**kw)
457 self.matplotlib.interactive(isInteractive)
457 self.matplotlib.interactive(isInteractive)
458 # make rendering call now, if the user tried to do it
458 # make rendering call now, if the user tried to do it
459 if self.pylab.draw_if_interactive.called:
459 if self.pylab.draw_if_interactive.called:
460 self.pylab.draw()
460 self.pylab.draw()
461 self.pylab.draw_if_interactive.called = False
461 self.pylab.draw_if_interactive.called = False
462
462
463 # if a backend switch was performed, reverse it now
463 # if a backend switch was performed, reverse it now
464 if self.mpl_use._called:
464 if self.mpl_use._called:
465 self.matplotlib.rcParams['backend'] = self.mpl_backend
465 self.matplotlib.rcParams['backend'] = self.mpl_backend
466
466
467 def magic_run(self,parameter_s=''):
467 def magic_run(self,parameter_s=''):
468 Magic.magic_run(self,parameter_s,runner=self.mplot_exec)
468 Magic.magic_run(self,parameter_s,runner=self.mplot_exec)
469
469
470 # Fix the docstring so users see the original as well
470 # Fix the docstring so users see the original as well
471 magic_run.__doc__ = "%s\n%s" % (Magic.magic_run.__doc__,
471 magic_run.__doc__ = "%s\n%s" % (Magic.magic_run.__doc__,
472 "\n *** Modified %run for Matplotlib,"
472 "\n *** Modified %run for Matplotlib,"
473 " with proper interactive handling ***")
473 " with proper interactive handling ***")
474
474
475 # Now we provide 2 versions of a matplotlib-aware IPython base shells, single
475 # Now we provide 2 versions of a matplotlib-aware IPython base shells, single
476 # and multithreaded. Note that these are meant for internal use, the IPShell*
476 # and multithreaded. Note that these are meant for internal use, the IPShell*
477 # classes below are the ones meant for public consumption.
477 # classes below are the ones meant for public consumption.
478
478
479 class MatplotlibShell(MatplotlibShellBase,InteractiveShell):
479 class MatplotlibShell(MatplotlibShellBase,InteractiveShell):
480 """Single-threaded shell with matplotlib support."""
480 """Single-threaded shell with matplotlib support."""
481
481
482 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
482 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
483 user_ns=None,user_global_ns=None,**kw):
483 user_ns=None,user_global_ns=None,**kw):
484 user_ns,b2 = self._matplotlib_config(name)
484 user_ns,b2 = self._matplotlib_config(name)
485 InteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
485 InteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
486 banner2=b2,**kw)
486 banner2=b2,**kw)
487
487
488 class MatplotlibMTShell(MatplotlibShellBase,MTInteractiveShell):
488 class MatplotlibMTShell(MatplotlibShellBase,MTInteractiveShell):
489 """Multi-threaded shell with matplotlib support."""
489 """Multi-threaded shell with matplotlib support."""
490
490
491 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
491 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
492 user_ns=None,user_global_ns=None, **kw):
492 user_ns=None,user_global_ns=None, **kw):
493 user_ns,b2 = self._matplotlib_config(name)
493 user_ns,b2 = self._matplotlib_config(name)
494 MTInteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
494 MTInteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
495 banner2=b2,**kw)
495 banner2=b2,**kw)
496
496
497 #-----------------------------------------------------------------------------
497 #-----------------------------------------------------------------------------
498 # Utility functions for the different GUI enabled IPShell* classes.
498 # Utility functions for the different GUI enabled IPShell* classes.
499
499
500 def get_tk():
500 def get_tk():
501 """Tries to import Tkinter and returns a withdrawn Tkinter root
501 """Tries to import Tkinter and returns a withdrawn Tkinter root
502 window. If Tkinter is already imported or not available, this
502 window. If Tkinter is already imported or not available, this
503 returns None. This function calls `hijack_tk` underneath.
503 returns None. This function calls `hijack_tk` underneath.
504 """
504 """
505 if not USE_TK or sys.modules.has_key('Tkinter'):
505 if not USE_TK or sys.modules.has_key('Tkinter'):
506 return None
506 return None
507 else:
507 else:
508 try:
508 try:
509 import Tkinter
509 import Tkinter
510 except ImportError:
510 except ImportError:
511 return None
511 return None
512 else:
512 else:
513 hijack_tk()
513 hijack_tk()
514 r = Tkinter.Tk()
514 r = Tkinter.Tk()
515 r.withdraw()
515 r.withdraw()
516 return r
516 return r
517
517
518 def hijack_tk():
518 def hijack_tk():
519 """Modifies Tkinter's mainloop with a dummy so when a module calls
519 """Modifies Tkinter's mainloop with a dummy so when a module calls
520 mainloop, it does not block.
520 mainloop, it does not block.
521
521
522 """
522 """
523 def misc_mainloop(self, n=0):
523 def misc_mainloop(self, n=0):
524 pass
524 pass
525 def tkinter_mainloop(n=0):
525 def tkinter_mainloop(n=0):
526 pass
526 pass
527
527
528 import Tkinter
528 import Tkinter
529 Tkinter.Misc.mainloop = misc_mainloop
529 Tkinter.Misc.mainloop = misc_mainloop
530 Tkinter.mainloop = tkinter_mainloop
530 Tkinter.mainloop = tkinter_mainloop
531
531
532 def update_tk(tk):
532 def update_tk(tk):
533 """Updates the Tkinter event loop. This is typically called from
533 """Updates the Tkinter event loop. This is typically called from
534 the respective WX or GTK mainloops.
534 the respective WX or GTK mainloops.
535 """
535 """
536 if tk:
536 if tk:
537 tk.update()
537 tk.update()
538
538
539 def hijack_wx():
539 def hijack_wx():
540 """Modifies wxPython's MainLoop with a dummy so user code does not
540 """Modifies wxPython's MainLoop with a dummy so user code does not
541 block IPython. The hijacked mainloop function is returned.
541 block IPython. The hijacked mainloop function is returned.
542 """
542 """
543 def dummy_mainloop(*args, **kw):
543 def dummy_mainloop(*args, **kw):
544 pass
544 pass
545 import wxPython
545 import wxPython
546 ver = wxPython.__version__
546 ver = wxPython.__version__
547 orig_mainloop = None
547 orig_mainloop = None
548 if ver[:3] >= '2.5':
548 if ver[:3] >= '2.5':
549 import wx
549 import wx
550 if hasattr(wx, '_core_'): core = getattr(wx, '_core_')
550 if hasattr(wx, '_core_'): core = getattr(wx, '_core_')
551 elif hasattr(wx, '_core'): core = getattr(wx, '_core')
551 elif hasattr(wx, '_core'): core = getattr(wx, '_core')
552 else: raise AttributeError('Could not find wx core module')
552 else: raise AttributeError('Could not find wx core module')
553 orig_mainloop = core.PyApp_MainLoop
553 orig_mainloop = core.PyApp_MainLoop
554 core.PyApp_MainLoop = dummy_mainloop
554 core.PyApp_MainLoop = dummy_mainloop
555 elif ver[:3] == '2.4':
555 elif ver[:3] == '2.4':
556 orig_mainloop = wxPython.wxc.wxPyApp_MainLoop
556 orig_mainloop = wxPython.wxc.wxPyApp_MainLoop
557 wxPython.wxc.wxPyApp_MainLoop = dummy_mainloop
557 wxPython.wxc.wxPyApp_MainLoop = dummy_mainloop
558 else:
558 else:
559 warn("Unable to find either wxPython version 2.4 or >= 2.5.")
559 warn("Unable to find either wxPython version 2.4 or >= 2.5.")
560 return orig_mainloop
560 return orig_mainloop
561
561
562 def hijack_gtk():
562 def hijack_gtk():
563 """Modifies pyGTK's mainloop with a dummy so user code does not
563 """Modifies pyGTK's mainloop with a dummy so user code does not
564 block IPython. This function returns the original `gtk.mainloop`
564 block IPython. This function returns the original `gtk.mainloop`
565 function that has been hijacked.
565 function that has been hijacked.
566 """
566 """
567 def dummy_mainloop(*args, **kw):
567 def dummy_mainloop(*args, **kw):
568 pass
568 pass
569 import gtk
569 import gtk
570 if gtk.pygtk_version >= (2,4,0): orig_mainloop = gtk.main
570 if gtk.pygtk_version >= (2,4,0): orig_mainloop = gtk.main
571 else: orig_mainloop = gtk.mainloop
571 else: orig_mainloop = gtk.mainloop
572 gtk.mainloop = dummy_mainloop
572 gtk.mainloop = dummy_mainloop
573 gtk.main = dummy_mainloop
573 gtk.main = dummy_mainloop
574 return orig_mainloop
574 return orig_mainloop
575
575
576 #-----------------------------------------------------------------------------
576 #-----------------------------------------------------------------------------
577 # The IPShell* classes below are the ones meant to be run by external code as
577 # The IPShell* classes below are the ones meant to be run by external code as
578 # IPython instances. Note that unless a specific threading strategy is
578 # IPython instances. Note that unless a specific threading strategy is
579 # desired, the factory function start() below should be used instead (it
579 # desired, the factory function start() below should be used instead (it
580 # selects the proper threaded class).
580 # selects the proper threaded class).
581
581
582 class IPShellGTK(threading.Thread):
582 class IPShellGTK(threading.Thread):
583 """Run a gtk mainloop() in a separate thread.
583 """Run a gtk mainloop() in a separate thread.
584
584
585 Python commands can be passed to the thread where they will be executed.
585 Python commands can be passed to the thread where they will be executed.
586 This is implemented by periodically checking for passed code using a
586 This is implemented by periodically checking for passed code using a
587 GTK timeout callback."""
587 GTK timeout callback."""
588
588
589 TIMEOUT = 100 # Millisecond interval between timeouts.
589 TIMEOUT = 100 # Millisecond interval between timeouts.
590
590
591 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
591 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
592 debug=1,shell_class=MTInteractiveShell):
592 debug=1,shell_class=MTInteractiveShell):
593
593
594 import gtk
594 import gtk
595
595
596 self.gtk = gtk
596 self.gtk = gtk
597 self.gtk_mainloop = hijack_gtk()
597 self.gtk_mainloop = hijack_gtk()
598
598
599 # Allows us to use both Tk and GTK.
599 # Allows us to use both Tk and GTK.
600 self.tk = get_tk()
600 self.tk = get_tk()
601
601
602 if gtk.pygtk_version >= (2,4,0): mainquit = self.gtk.main_quit
602 if gtk.pygtk_version >= (2,4,0): mainquit = self.gtk.main_quit
603 else: mainquit = self.gtk.mainquit
603 else: mainquit = self.gtk.mainquit
604
604
605 self.IP = make_IPython(argv,user_ns=user_ns,
605 self.IP = make_IPython(argv,user_ns=user_ns,
606 user_global_ns=user_global_ns,
606 user_global_ns=user_global_ns,
607 debug=debug,
607 debug=debug,
608 shell_class=shell_class,
608 shell_class=shell_class,
609 on_kill=[mainquit])
609 on_kill=[mainquit])
610
610
611 # HACK: slot for banner in self; it will be passed to the mainloop
611 # HACK: slot for banner in self; it will be passed to the mainloop
612 # method only and .run() needs it. The actual value will be set by
612 # method only and .run() needs it. The actual value will be set by
613 # .mainloop().
613 # .mainloop().
614 self._banner = None
614 self._banner = None
615
615
616 threading.Thread.__init__(self)
616 threading.Thread.__init__(self)
617
617
618 def run(self):
618 def run(self):
619 self.IP.mainloop(self._banner)
619 self.IP.mainloop(self._banner)
620 self.IP.kill()
620 self.IP.kill()
621
621
622 def mainloop(self,sys_exit=0,banner=None):
622 def mainloop(self,sys_exit=0,banner=None):
623
623
624 self._banner = banner
624 self._banner = banner
625
625
626 if self.gtk.pygtk_version >= (2,4,0):
626 if self.gtk.pygtk_version >= (2,4,0):
627 import gobject
627 import gobject
628 gobject.idle_add(self.on_timer)
628 gobject.timeout_add(self.TIMEOUT, self.on_timer)
629 else:
629 else:
630 self.gtk.idle_add(self.on_timer)
630 self.gtk.timeout_add(self.TIMEOUT, self.on_timer)
631
631
632 if sys.platform != 'win32':
632 if sys.platform != 'win32':
633 try:
633 try:
634 if self.gtk.gtk_version[0] >= 2:
634 if self.gtk.gtk_version[0] >= 2:
635 self.gtk.threads_init()
635 self.gtk.threads_init()
636 except AttributeError:
636 except AttributeError:
637 pass
637 pass
638 except RuntimeError:
638 except RuntimeError:
639 error('Your pyGTK likely has not been compiled with '
639 error('Your pyGTK likely has not been compiled with '
640 'threading support.\n'
640 'threading support.\n'
641 'The exception printout is below.\n'
641 'The exception printout is below.\n'
642 'You can either rebuild pyGTK with threads, or '
642 'You can either rebuild pyGTK with threads, or '
643 'try using \n'
643 'try using \n'
644 'matplotlib with a different backend (like Tk or WX).\n'
644 'matplotlib with a different backend (like Tk or WX).\n'
645 'Note that matplotlib will most likely not work in its '
645 'Note that matplotlib will most likely not work in its '
646 'current state!')
646 'current state!')
647 self.IP.InteractiveTB()
647 self.IP.InteractiveTB()
648 self.start()
648 self.start()
649 self.gtk.threads_enter()
649 self.gtk.threads_enter()
650 self.gtk_mainloop()
650 self.gtk_mainloop()
651 self.gtk.threads_leave()
651 self.gtk.threads_leave()
652 self.join()
652 self.join()
653
653
654 def on_timer(self):
654 def on_timer(self):
655 update_tk(self.tk)
655 update_tk(self.tk)
656 return self.IP.runcode()
656 return self.IP.runcode()
657
657
658
658
659 class IPShellWX(threading.Thread):
659 class IPShellWX(threading.Thread):
660 """Run a wx mainloop() in a separate thread.
660 """Run a wx mainloop() in a separate thread.
661
661
662 Python commands can be passed to the thread where they will be executed.
662 Python commands can be passed to the thread where they will be executed.
663 This is implemented by periodically checking for passed code using a
663 This is implemented by periodically checking for passed code using a
664 GTK timeout callback."""
664 GTK timeout callback."""
665
665
666 TIMEOUT = 100 # Millisecond interval between timeouts.
666 TIMEOUT = 100 # Millisecond interval between timeouts.
667
667
668 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
668 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
669 debug=1,shell_class=MTInteractiveShell):
669 debug=1,shell_class=MTInteractiveShell):
670
670
671 import wxPython.wx as wx
671 import wxPython.wx as wx
672
672
673 threading.Thread.__init__(self)
673 threading.Thread.__init__(self)
674 self.wx = wx
674 self.wx = wx
675 self.wx_mainloop = hijack_wx()
675 self.wx_mainloop = hijack_wx()
676
676
677 # Allows us to use both Tk and GTK.
677 # Allows us to use both Tk and GTK.
678 self.tk = get_tk()
678 self.tk = get_tk()
679
679
680 self.IP = make_IPython(argv,user_ns=user_ns,
680 self.IP = make_IPython(argv,user_ns=user_ns,
681 user_global_ns=user_global_ns,
681 user_global_ns=user_global_ns,
682 debug=debug,
682 debug=debug,
683 shell_class=shell_class,
683 shell_class=shell_class,
684 on_kill=[self.wxexit])
684 on_kill=[self.wxexit])
685 # HACK: slot for banner in self; it will be passed to the mainloop
685 # HACK: slot for banner in self; it will be passed to the mainloop
686 # method only and .run() needs it. The actual value will be set by
686 # method only and .run() needs it. The actual value will be set by
687 # .mainloop().
687 # .mainloop().
688 self._banner = None
688 self._banner = None
689
689
690 self.app = None
690 self.app = None
691
691
692 def wxexit(self, *args):
692 def wxexit(self, *args):
693 if self.app is not None:
693 if self.app is not None:
694 self.app.agent.timer.Stop()
694 self.app.agent.timer.Stop()
695 self.app.ExitMainLoop()
695 self.app.ExitMainLoop()
696
696
697 def run(self):
697 def run(self):
698 self.IP.mainloop(self._banner)
698 self.IP.mainloop(self._banner)
699 self.IP.kill()
699 self.IP.kill()
700
700
701 def mainloop(self,sys_exit=0,banner=None):
701 def mainloop(self,sys_exit=0,banner=None):
702
702
703 self._banner = banner
703 self._banner = banner
704
704
705 self.start()
705 self.start()
706
706
707 class TimerAgent(self.wx.wxMiniFrame):
707 class TimerAgent(self.wx.wxMiniFrame):
708 wx = self.wx
708 wx = self.wx
709 IP = self.IP
709 IP = self.IP
710 tk = self.tk
710 tk = self.tk
711 def __init__(self, parent, interval):
711 def __init__(self, parent, interval):
712 style = self.wx.wxDEFAULT_FRAME_STYLE | self.wx.wxTINY_CAPTION_HORIZ
712 style = self.wx.wxDEFAULT_FRAME_STYLE | self.wx.wxTINY_CAPTION_HORIZ
713 self.wx.wxMiniFrame.__init__(self, parent, -1, ' ', pos=(200, 200),
713 self.wx.wxMiniFrame.__init__(self, parent, -1, ' ', pos=(200, 200),
714 size=(100, 100),style=style)
714 size=(100, 100),style=style)
715 self.Show(False)
715 self.Show(False)
716 self.interval = interval
716 self.interval = interval
717 self.timerId = self.wx.wxNewId()
717 self.timerId = self.wx.wxNewId()
718
718
719 def StartWork(self):
719 def StartWork(self):
720 self.timer = self.wx.wxTimer(self, self.timerId)
720 self.timer = self.wx.wxTimer(self, self.timerId)
721 self.wx.EVT_TIMER(self, self.timerId, self.OnTimer)
721 self.wx.EVT_TIMER(self, self.timerId, self.OnTimer)
722 self.timer.Start(self.interval)
722 self.timer.Start(self.interval)
723
723
724 def OnTimer(self, event):
724 def OnTimer(self, event):
725 update_tk(self.tk)
725 update_tk(self.tk)
726 self.IP.runcode()
726 self.IP.runcode()
727
727
728 class App(self.wx.wxApp):
728 class App(self.wx.wxApp):
729 wx = self.wx
729 wx = self.wx
730 TIMEOUT = self.TIMEOUT
730 TIMEOUT = self.TIMEOUT
731 def OnInit(self):
731 def OnInit(self):
732 'Create the main window and insert the custom frame'
732 'Create the main window and insert the custom frame'
733 self.agent = TimerAgent(None, self.TIMEOUT)
733 self.agent = TimerAgent(None, self.TIMEOUT)
734 self.agent.Show(self.wx.false)
734 self.agent.Show(self.wx.false)
735 self.agent.StartWork()
735 self.agent.StartWork()
736 return self.wx.true
736 return self.wx.true
737
737
738 self.app = App(redirect=False)
738 self.app = App(redirect=False)
739 self.wx_mainloop(self.app)
739 self.wx_mainloop(self.app)
740 self.join()
740 self.join()
741
741
742
742
743 class IPShellQt(threading.Thread):
743 class IPShellQt(threading.Thread):
744 """Run a Qt event loop in a separate thread.
744 """Run a Qt event loop in a separate thread.
745
745
746 Python commands can be passed to the thread where they will be executed.
746 Python commands can be passed to the thread where they will be executed.
747 This is implemented by periodically checking for passed code using a
747 This is implemented by periodically checking for passed code using a
748 Qt timer / slot."""
748 Qt timer / slot."""
749
749
750 TIMEOUT = 100 # Millisecond interval between timeouts.
750 TIMEOUT = 100 # Millisecond interval between timeouts.
751
751
752 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
752 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
753 debug=0,shell_class=MTInteractiveShell):
753 debug=0,shell_class=MTInteractiveShell):
754
754
755 import qt
755 import qt
756
756
757 class newQApplication:
757 class newQApplication:
758 def __init__( self ):
758 def __init__( self ):
759 self.QApplication = qt.QApplication
759 self.QApplication = qt.QApplication
760
760
761 def __call__( *args, **kwargs ):
761 def __call__( *args, **kwargs ):
762 return qt.qApp
762 return qt.qApp
763
763
764 def exec_loop( *args, **kwargs ):
764 def exec_loop( *args, **kwargs ):
765 pass
765 pass
766
766
767 def __getattr__( self, name ):
767 def __getattr__( self, name ):
768 return getattr( self.QApplication, name )
768 return getattr( self.QApplication, name )
769
769
770 qt.QApplication = newQApplication()
770 qt.QApplication = newQApplication()
771
771
772 # Allows us to use both Tk and QT.
772 # Allows us to use both Tk and QT.
773 self.tk = get_tk()
773 self.tk = get_tk()
774
774
775 self.IP = make_IPython(argv,user_ns=user_ns,
775 self.IP = make_IPython(argv,user_ns=user_ns,
776 user_global_ns=user_global_ns,
776 user_global_ns=user_global_ns,
777 debug=debug,
777 debug=debug,
778 shell_class=shell_class,
778 shell_class=shell_class,
779 on_kill=[qt.qApp.exit])
779 on_kill=[qt.qApp.exit])
780
780
781 # HACK: slot for banner in self; it will be passed to the mainloop
781 # HACK: slot for banner in self; it will be passed to the mainloop
782 # method only and .run() needs it. The actual value will be set by
782 # method only and .run() needs it. The actual value will be set by
783 # .mainloop().
783 # .mainloop().
784 self._banner = None
784 self._banner = None
785
785
786 threading.Thread.__init__(self)
786 threading.Thread.__init__(self)
787
787
788 def run(self):
788 def run(self):
789 self.IP.mainloop(self._banner)
789 self.IP.mainloop(self._banner)
790 self.IP.kill()
790 self.IP.kill()
791
791
792 def mainloop(self,sys_exit=0,banner=None):
792 def mainloop(self,sys_exit=0,banner=None):
793
793
794 import qt
794 import qt
795
795
796 self._banner = banner
796 self._banner = banner
797
797
798 if qt.QApplication.startingUp():
798 if qt.QApplication.startingUp():
799 a = qt.QApplication.QApplication(sys.argv)
799 a = qt.QApplication.QApplication(sys.argv)
800 self.timer = qt.QTimer()
800 self.timer = qt.QTimer()
801 qt.QObject.connect( self.timer, qt.SIGNAL( 'timeout()' ), self.on_timer )
801 qt.QObject.connect( self.timer, qt.SIGNAL( 'timeout()' ), self.on_timer )
802
802
803 self.start()
803 self.start()
804 self.timer.start( self.TIMEOUT, True )
804 self.timer.start( self.TIMEOUT, True )
805 while True:
805 while True:
806 if self.IP._kill: break
806 if self.IP._kill: break
807 qt.qApp.exec_loop()
807 qt.qApp.exec_loop()
808 self.join()
808 self.join()
809
809
810 def on_timer(self):
810 def on_timer(self):
811 update_tk(self.tk)
811 update_tk(self.tk)
812 result = self.IP.runcode()
812 result = self.IP.runcode()
813 self.timer.start( self.TIMEOUT, True )
813 self.timer.start( self.TIMEOUT, True )
814 return result
814 return result
815
815
816 # A set of matplotlib public IPython shell classes, for single-threaded
816 # A set of matplotlib public IPython shell classes, for single-threaded
817 # (Tk* and FLTK* backends) and multithreaded (GTK* and WX* backends) use.
817 # (Tk* and FLTK* backends) and multithreaded (GTK* and WX* backends) use.
818 class IPShellMatplotlib(IPShell):
818 class IPShellMatplotlib(IPShell):
819 """Subclass IPShell with MatplotlibShell as the internal shell.
819 """Subclass IPShell with MatplotlibShell as the internal shell.
820
820
821 Single-threaded class, meant for the Tk* and FLTK* backends.
821 Single-threaded class, meant for the Tk* and FLTK* backends.
822
822
823 Having this on a separate class simplifies the external driver code."""
823 Having this on a separate class simplifies the external driver code."""
824
824
825 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
825 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
826 IPShell.__init__(self,argv,user_ns,user_global_ns,debug,
826 IPShell.__init__(self,argv,user_ns,user_global_ns,debug,
827 shell_class=MatplotlibShell)
827 shell_class=MatplotlibShell)
828
828
829 class IPShellMatplotlibGTK(IPShellGTK):
829 class IPShellMatplotlibGTK(IPShellGTK):
830 """Subclass IPShellGTK with MatplotlibMTShell as the internal shell.
830 """Subclass IPShellGTK with MatplotlibMTShell as the internal shell.
831
831
832 Multi-threaded class, meant for the GTK* backends."""
832 Multi-threaded class, meant for the GTK* backends."""
833
833
834 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
834 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
835 IPShellGTK.__init__(self,argv,user_ns,user_global_ns,debug,
835 IPShellGTK.__init__(self,argv,user_ns,user_global_ns,debug,
836 shell_class=MatplotlibMTShell)
836 shell_class=MatplotlibMTShell)
837
837
838 class IPShellMatplotlibWX(IPShellWX):
838 class IPShellMatplotlibWX(IPShellWX):
839 """Subclass IPShellWX with MatplotlibMTShell as the internal shell.
839 """Subclass IPShellWX with MatplotlibMTShell as the internal shell.
840
840
841 Multi-threaded class, meant for the WX* backends."""
841 Multi-threaded class, meant for the WX* backends."""
842
842
843 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
843 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
844 IPShellWX.__init__(self,argv,user_ns,user_global_ns,debug,
844 IPShellWX.__init__(self,argv,user_ns,user_global_ns,debug,
845 shell_class=MatplotlibMTShell)
845 shell_class=MatplotlibMTShell)
846
846
847 class IPShellMatplotlibQt(IPShellQt):
847 class IPShellMatplotlibQt(IPShellQt):
848 """Subclass IPShellQt with MatplotlibMTShell as the internal shell.
848 """Subclass IPShellQt with MatplotlibMTShell as the internal shell.
849
849
850 Multi-threaded class, meant for the Qt* backends."""
850 Multi-threaded class, meant for the Qt* backends."""
851
851
852 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
852 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
853 IPShellQt.__init__(self,argv,user_ns,user_global_ns,debug,
853 IPShellQt.__init__(self,argv,user_ns,user_global_ns,debug,
854 shell_class=MatplotlibMTShell)
854 shell_class=MatplotlibMTShell)
855
855
856 #-----------------------------------------------------------------------------
856 #-----------------------------------------------------------------------------
857 # Factory functions to actually start the proper thread-aware shell
857 # Factory functions to actually start the proper thread-aware shell
858
858
859 def _matplotlib_shell_class():
859 def _matplotlib_shell_class():
860 """Factory function to handle shell class selection for matplotlib.
860 """Factory function to handle shell class selection for matplotlib.
861
861
862 The proper shell class to use depends on the matplotlib backend, since
862 The proper shell class to use depends on the matplotlib backend, since
863 each backend requires a different threading strategy."""
863 each backend requires a different threading strategy."""
864
864
865 try:
865 try:
866 import matplotlib
866 import matplotlib
867 except ImportError:
867 except ImportError:
868 error('matplotlib could NOT be imported! Starting normal IPython.')
868 error('matplotlib could NOT be imported! Starting normal IPython.')
869 sh_class = IPShell
869 sh_class = IPShell
870 else:
870 else:
871 backend = matplotlib.rcParams['backend']
871 backend = matplotlib.rcParams['backend']
872 if backend.startswith('GTK'):
872 if backend.startswith('GTK'):
873 sh_class = IPShellMatplotlibGTK
873 sh_class = IPShellMatplotlibGTK
874 elif backend.startswith('WX'):
874 elif backend.startswith('WX'):
875 sh_class = IPShellMatplotlibWX
875 sh_class = IPShellMatplotlibWX
876 elif backend.startswith('Qt'):
876 elif backend.startswith('Qt'):
877 sh_class = IPShellMatplotlibQt
877 sh_class = IPShellMatplotlibQt
878 else:
878 else:
879 sh_class = IPShellMatplotlib
879 sh_class = IPShellMatplotlib
880 #print 'Using %s with the %s backend.' % (sh_class,backend) # dbg
880 #print 'Using %s with the %s backend.' % (sh_class,backend) # dbg
881 return sh_class
881 return sh_class
882
882
883 # This is the one which should be called by external code.
883 # This is the one which should be called by external code.
884 def start():
884 def start():
885 """Return a running shell instance, dealing with threading options.
885 """Return a running shell instance, dealing with threading options.
886
886
887 This is a factory function which will instantiate the proper IPython shell
887 This is a factory function which will instantiate the proper IPython shell
888 based on the user's threading choice. Such a selector is needed because
888 based on the user's threading choice. Such a selector is needed because
889 different GUI toolkits require different thread handling details."""
889 different GUI toolkits require different thread handling details."""
890
890
891 global USE_TK
891 global USE_TK
892 # Crude sys.argv hack to extract the threading options.
892 # Crude sys.argv hack to extract the threading options.
893 argv = sys.argv
893 argv = sys.argv
894 if len(argv) > 1:
894 if len(argv) > 1:
895 if len(argv) > 2:
895 if len(argv) > 2:
896 arg2 = argv[2]
896 arg2 = argv[2]
897 if arg2.endswith('-tk'):
897 if arg2.endswith('-tk'):
898 USE_TK = True
898 USE_TK = True
899 arg1 = argv[1]
899 arg1 = argv[1]
900 if arg1.endswith('-gthread'):
900 if arg1.endswith('-gthread'):
901 shell = IPShellGTK
901 shell = IPShellGTK
902 elif arg1.endswith( '-qthread' ):
902 elif arg1.endswith( '-qthread' ):
903 shell = IPShellQt
903 shell = IPShellQt
904 elif arg1.endswith('-wthread'):
904 elif arg1.endswith('-wthread'):
905 shell = IPShellWX
905 shell = IPShellWX
906 elif arg1.endswith('-pylab'):
906 elif arg1.endswith('-pylab'):
907 shell = _matplotlib_shell_class()
907 shell = _matplotlib_shell_class()
908 else:
908 else:
909 shell = IPShell
909 shell = IPShell
910 else:
910 else:
911 shell = IPShell
911 shell = IPShell
912 return shell()
912 return shell()
913
913
914 # Some aliases for backwards compatibility
914 # Some aliases for backwards compatibility
915 IPythonShell = IPShell
915 IPythonShell = IPShell
916 IPythonShellEmbed = IPShellEmbed
916 IPythonShellEmbed = IPShellEmbed
917 #************************ End of file <Shell.py> ***************************
917 #************************ End of file <Shell.py> ***************************
@@ -1,2153 +1,2153 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.1 or newer.
5 Requires Python 2.1 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 990 2006-01-04 06:59:02Z fperez $
9 $Id: iplib.py 993 2006-01-04 19:51:01Z 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-2005 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from __future__ import generators # for 2.2 backwards-compatibility
31 from __future__ import generators # for 2.2 backwards-compatibility
32
32
33 from IPython import Release
33 from IPython import Release
34 __author__ = '%s <%s>\n%s <%s>' % \
34 __author__ = '%s <%s>\n%s <%s>' % \
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
36 __license__ = Release.license
36 __license__ = Release.license
37 __version__ = Release.version
37 __version__ = Release.version
38
38
39 # Python standard modules
39 # Python standard modules
40 import __main__
40 import __main__
41 import __builtin__
41 import __builtin__
42 import StringIO
42 import StringIO
43 import bdb
43 import bdb
44 import cPickle as pickle
44 import cPickle as pickle
45 import codeop
45 import codeop
46 import exceptions
46 import exceptions
47 import glob
47 import glob
48 import inspect
48 import inspect
49 import keyword
49 import keyword
50 import new
50 import new
51 import os
51 import os
52 import pdb
52 import pdb
53 import pydoc
53 import pydoc
54 import re
54 import re
55 import shutil
55 import shutil
56 import string
56 import string
57 import sys
57 import sys
58 import tempfile
58 import tempfile
59 import traceback
59 import traceback
60 import types
60 import types
61
61
62 from pprint import pprint, pformat
62 from pprint import pprint, pformat
63
63
64 # IPython's own modules
64 # IPython's own modules
65 import IPython
65 import IPython
66 from IPython import OInspect,PyColorize,ultraTB
66 from IPython import OInspect,PyColorize,ultraTB
67 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
68 from IPython.FakeModule import FakeModule
68 from IPython.FakeModule import FakeModule
69 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
70 from IPython.Logger import Logger
70 from IPython.Logger import Logger
71 from IPython.Magic import Magic
71 from IPython.Magic import Magic
72 from IPython.Prompts import CachedOutput
72 from IPython.Prompts import CachedOutput
73 from IPython.Struct import Struct
73 from IPython.Struct import Struct
74 from IPython.background_jobs import BackgroundJobManager
74 from IPython.background_jobs import BackgroundJobManager
75 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.usage import cmd_line_usage,interactive_usage
76 from IPython.genutils import *
76 from IPython.genutils import *
77
77
78 # store the builtin raw_input globally, and use this always, in case user code
78 # store the builtin raw_input globally, and use this always, in case user code
79 # overwrites it (like wx.py.PyShell does)
79 # overwrites it (like wx.py.PyShell does)
80 raw_input_original = raw_input
80 raw_input_original = raw_input
81
81
82 # compiled regexps for autoindent management
82 # compiled regexps for autoindent management
83 ini_spaces_re = re.compile(r'^(\s+)')
83 ini_spaces_re = re.compile(r'^(\s+)')
84 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
84 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85
85
86 #****************************************************************************
86 #****************************************************************************
87 # Some utility function definitions
87 # Some utility function definitions
88
88
89 def softspace(file, newvalue):
89 def softspace(file, newvalue):
90 """Copied from code.py, to remove the dependency"""
90 """Copied from code.py, to remove the dependency"""
91 oldvalue = 0
91 oldvalue = 0
92 try:
92 try:
93 oldvalue = file.softspace
93 oldvalue = file.softspace
94 except AttributeError:
94 except AttributeError:
95 pass
95 pass
96 try:
96 try:
97 file.softspace = newvalue
97 file.softspace = newvalue
98 except (AttributeError, TypeError):
98 except (AttributeError, TypeError):
99 # "attribute-less object" or "read-only attributes"
99 # "attribute-less object" or "read-only attributes"
100 pass
100 pass
101 return oldvalue
101 return oldvalue
102
102
103 #****************************************************************************
103 #****************************************************************************
104
104
105
105
106 #****************************************************************************
106 #****************************************************************************
107 # Local use exceptions
107 # Local use exceptions
108 class SpaceInInput(exceptions.Exception): pass
108 class SpaceInInput(exceptions.Exception): pass
109
109
110 #****************************************************************************
110 #****************************************************************************
111 # Local use classes
111 # Local use classes
112 class Bunch: pass
112 class Bunch: pass
113
113
114 class Undefined: pass
114 class Undefined: pass
115
115
116 class InputList(list):
116 class InputList(list):
117 """Class to store user input.
117 """Class to store user input.
118
118
119 It's basically a list, but slices return a string instead of a list, thus
119 It's basically a list, but slices return a string instead of a list, thus
120 allowing things like (assuming 'In' is an instance):
120 allowing things like (assuming 'In' is an instance):
121
121
122 exec In[4:7]
122 exec In[4:7]
123
123
124 or
124 or
125
125
126 exec In[5:9] + In[14] + In[21:25]"""
126 exec In[5:9] + In[14] + In[21:25]"""
127
127
128 def __getslice__(self,i,j):
128 def __getslice__(self,i,j):
129 return ''.join(list.__getslice__(self,i,j))
129 return ''.join(list.__getslice__(self,i,j))
130
130
131 class SyntaxTB(ultraTB.ListTB):
131 class SyntaxTB(ultraTB.ListTB):
132 """Extension which holds some state: the last exception value"""
132 """Extension which holds some state: the last exception value"""
133
133
134 def __init__(self,color_scheme = 'NoColor'):
134 def __init__(self,color_scheme = 'NoColor'):
135 ultraTB.ListTB.__init__(self,color_scheme)
135 ultraTB.ListTB.__init__(self,color_scheme)
136 self.last_syntax_error = None
136 self.last_syntax_error = None
137
137
138 def __call__(self, etype, value, elist):
138 def __call__(self, etype, value, elist):
139 self.last_syntax_error = value
139 self.last_syntax_error = value
140 ultraTB.ListTB.__call__(self,etype,value,elist)
140 ultraTB.ListTB.__call__(self,etype,value,elist)
141
141
142 def clear_err_state(self):
142 def clear_err_state(self):
143 """Return the current error state and clear it"""
143 """Return the current error state and clear it"""
144 e = self.last_syntax_error
144 e = self.last_syntax_error
145 self.last_syntax_error = None
145 self.last_syntax_error = None
146 return e
146 return e
147
147
148 #****************************************************************************
148 #****************************************************************************
149 # Main IPython class
149 # Main IPython class
150
150
151 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
151 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
152 # until a full rewrite is made. I've cleaned all cross-class uses of
152 # until a full rewrite is made. I've cleaned all cross-class uses of
153 # attributes and methods, but too much user code out there relies on the
153 # attributes and methods, but too much user code out there relies on the
154 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
154 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
155 #
155 #
156 # But at least now, all the pieces have been separated and we could, in
156 # But at least now, all the pieces have been separated and we could, in
157 # principle, stop using the mixin. This will ease the transition to the
157 # principle, stop using the mixin. This will ease the transition to the
158 # chainsaw branch.
158 # chainsaw branch.
159
159
160 # For reference, the following is the list of 'self.foo' uses in the Magic
160 # For reference, the following is the list of 'self.foo' uses in the Magic
161 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
161 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
162 # class, to prevent clashes.
162 # class, to prevent clashes.
163
163
164 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
164 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
165 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
165 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
166 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
166 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
167 # 'self.value']
167 # 'self.value']
168
168
169 class InteractiveShell(object,Magic):
169 class InteractiveShell(object,Magic):
170 """An enhanced console for Python."""
170 """An enhanced console for Python."""
171
171
172 # class attribute to indicate whether the class supports threads or not.
172 # class attribute to indicate whether the class supports threads or not.
173 # Subclasses with thread support should override this as needed.
173 # Subclasses with thread support should override this as needed.
174 isthreaded = False
174 isthreaded = False
175
175
176 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
176 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
177 user_ns = None,user_global_ns=None,banner2='',
177 user_ns = None,user_global_ns=None,banner2='',
178 custom_exceptions=((),None),embedded=False):
178 custom_exceptions=((),None),embedded=False):
179
179
180 # some minimal strict typechecks. For some core data structures, I
180 # some minimal strict typechecks. For some core data structures, I
181 # want actual basic python types, not just anything that looks like
181 # want actual basic python types, not just anything that looks like
182 # one. This is especially true for namespaces.
182 # one. This is especially true for namespaces.
183 for ns in (user_ns,user_global_ns):
183 for ns in (user_ns,user_global_ns):
184 if ns is not None and type(ns) != types.DictType:
184 if ns is not None and type(ns) != types.DictType:
185 raise TypeError,'namespace must be a dictionary'
185 raise TypeError,'namespace must be a dictionary'
186
186
187 # Job manager (for jobs run as background threads)
187 # Job manager (for jobs run as background threads)
188 self.jobs = BackgroundJobManager()
188 self.jobs = BackgroundJobManager()
189
189
190 # track which builtins we add, so we can clean up later
190 # track which builtins we add, so we can clean up later
191 self.builtins_added = {}
191 self.builtins_added = {}
192 # This method will add the necessary builtins for operation, but
192 # This method will add the necessary builtins for operation, but
193 # tracking what it did via the builtins_added dict.
193 # tracking what it did via the builtins_added dict.
194 self.add_builtins()
194 self.add_builtins()
195
195
196 # Do the intuitively correct thing for quit/exit: we remove the
196 # Do the intuitively correct thing for quit/exit: we remove the
197 # builtins if they exist, and our own magics will deal with this
197 # builtins if they exist, and our own magics will deal with this
198 try:
198 try:
199 del __builtin__.exit, __builtin__.quit
199 del __builtin__.exit, __builtin__.quit
200 except AttributeError:
200 except AttributeError:
201 pass
201 pass
202
202
203 # Store the actual shell's name
203 # Store the actual shell's name
204 self.name = name
204 self.name = name
205
205
206 # We need to know whether the instance is meant for embedding, since
206 # We need to know whether the instance is meant for embedding, since
207 # global/local namespaces need to be handled differently in that case
207 # global/local namespaces need to be handled differently in that case
208 self.embedded = embedded
208 self.embedded = embedded
209
209
210 # command compiler
210 # command compiler
211 self.compile = codeop.CommandCompiler()
211 self.compile = codeop.CommandCompiler()
212
212
213 # User input buffer
213 # User input buffer
214 self.buffer = []
214 self.buffer = []
215
215
216 # Default name given in compilation of code
216 # Default name given in compilation of code
217 self.filename = '<ipython console>'
217 self.filename = '<ipython console>'
218
218
219 # Make an empty namespace, which extension writers can rely on both
219 # Make an empty namespace, which extension writers can rely on both
220 # existing and NEVER being used by ipython itself. This gives them a
220 # existing and NEVER being used by ipython itself. This gives them a
221 # convenient location for storing additional information and state
221 # convenient location for storing additional information and state
222 # their extensions may require, without fear of collisions with other
222 # their extensions may require, without fear of collisions with other
223 # ipython names that may develop later.
223 # ipython names that may develop later.
224 self.meta = Bunch()
224 self.meta = Bunch()
225
225
226 # Create the namespace where the user will operate. user_ns is
226 # Create the namespace where the user will operate. user_ns is
227 # normally the only one used, and it is passed to the exec calls as
227 # normally the only one used, and it is passed to the exec calls as
228 # the locals argument. But we do carry a user_global_ns namespace
228 # the locals argument. But we do carry a user_global_ns namespace
229 # given as the exec 'globals' argument, This is useful in embedding
229 # given as the exec 'globals' argument, This is useful in embedding
230 # situations where the ipython shell opens in a context where the
230 # situations where the ipython shell opens in a context where the
231 # distinction between locals and globals is meaningful.
231 # distinction between locals and globals is meaningful.
232
232
233 # FIXME. For some strange reason, __builtins__ is showing up at user
233 # FIXME. For some strange reason, __builtins__ is showing up at user
234 # level as a dict instead of a module. This is a manual fix, but I
234 # level as a dict instead of a module. This is a manual fix, but I
235 # should really track down where the problem is coming from. Alex
235 # should really track down where the problem is coming from. Alex
236 # Schmolck reported this problem first.
236 # Schmolck reported this problem first.
237
237
238 # A useful post by Alex Martelli on this topic:
238 # A useful post by Alex Martelli on this topic:
239 # Re: inconsistent value from __builtins__
239 # Re: inconsistent value from __builtins__
240 # Von: Alex Martelli <aleaxit@yahoo.com>
240 # Von: Alex Martelli <aleaxit@yahoo.com>
241 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
241 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
242 # Gruppen: comp.lang.python
242 # Gruppen: comp.lang.python
243
243
244 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
244 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
245 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
245 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
246 # > <type 'dict'>
246 # > <type 'dict'>
247 # > >>> print type(__builtins__)
247 # > >>> print type(__builtins__)
248 # > <type 'module'>
248 # > <type 'module'>
249 # > Is this difference in return value intentional?
249 # > Is this difference in return value intentional?
250
250
251 # Well, it's documented that '__builtins__' can be either a dictionary
251 # Well, it's documented that '__builtins__' can be either a dictionary
252 # or a module, and it's been that way for a long time. Whether it's
252 # or a module, and it's been that way for a long time. Whether it's
253 # intentional (or sensible), I don't know. In any case, the idea is
253 # intentional (or sensible), I don't know. In any case, the idea is
254 # that if you need to access the built-in namespace directly, you
254 # that if you need to access the built-in namespace directly, you
255 # should start with "import __builtin__" (note, no 's') which will
255 # should start with "import __builtin__" (note, no 's') which will
256 # definitely give you a module. Yeah, it's somewhatΒ confusing:-(.
256 # definitely give you a module. Yeah, it's somewhatΒ confusing:-(.
257
257
258 if user_ns is None:
258 if user_ns is None:
259 # Set __name__ to __main__ to better match the behavior of the
259 # Set __name__ to __main__ to better match the behavior of the
260 # normal interpreter.
260 # normal interpreter.
261 user_ns = {'__name__' :'__main__',
261 user_ns = {'__name__' :'__main__',
262 '__builtins__' : __builtin__,
262 '__builtins__' : __builtin__,
263 }
263 }
264
264
265 if user_global_ns is None:
265 if user_global_ns is None:
266 user_global_ns = {}
266 user_global_ns = {}
267
267
268 # Assign namespaces
268 # Assign namespaces
269 # This is the namespace where all normal user variables live
269 # This is the namespace where all normal user variables live
270 self.user_ns = user_ns
270 self.user_ns = user_ns
271 # Embedded instances require a separate namespace for globals.
271 # Embedded instances require a separate namespace for globals.
272 # Normally this one is unused by non-embedded instances.
272 # Normally this one is unused by non-embedded instances.
273 self.user_global_ns = user_global_ns
273 self.user_global_ns = user_global_ns
274 # A namespace to keep track of internal data structures to prevent
274 # A namespace to keep track of internal data structures to prevent
275 # them from cluttering user-visible stuff. Will be updated later
275 # them from cluttering user-visible stuff. Will be updated later
276 self.internal_ns = {}
276 self.internal_ns = {}
277
277
278 # Namespace of system aliases. Each entry in the alias
278 # Namespace of system aliases. Each entry in the alias
279 # table must be a 2-tuple of the form (N,name), where N is the number
279 # table must be a 2-tuple of the form (N,name), where N is the number
280 # of positional arguments of the alias.
280 # of positional arguments of the alias.
281 self.alias_table = {}
281 self.alias_table = {}
282
282
283 # A table holding all the namespaces IPython deals with, so that
283 # A table holding all the namespaces IPython deals with, so that
284 # introspection facilities can search easily.
284 # introspection facilities can search easily.
285 self.ns_table = {'user':user_ns,
285 self.ns_table = {'user':user_ns,
286 'user_global':user_global_ns,
286 'user_global':user_global_ns,
287 'alias':self.alias_table,
287 'alias':self.alias_table,
288 'internal':self.internal_ns,
288 'internal':self.internal_ns,
289 'builtin':__builtin__.__dict__
289 'builtin':__builtin__.__dict__
290 }
290 }
291
291
292 # The user namespace MUST have a pointer to the shell itself.
292 # The user namespace MUST have a pointer to the shell itself.
293 self.user_ns[name] = self
293 self.user_ns[name] = self
294
294
295 # We need to insert into sys.modules something that looks like a
295 # We need to insert into sys.modules something that looks like a
296 # module but which accesses the IPython namespace, for shelve and
296 # module but which accesses the IPython namespace, for shelve and
297 # pickle to work interactively. Normally they rely on getting
297 # pickle to work interactively. Normally they rely on getting
298 # everything out of __main__, but for embedding purposes each IPython
298 # everything out of __main__, but for embedding purposes each IPython
299 # instance has its own private namespace, so we can't go shoving
299 # instance has its own private namespace, so we can't go shoving
300 # everything into __main__.
300 # everything into __main__.
301
301
302 # note, however, that we should only do this for non-embedded
302 # note, however, that we should only do this for non-embedded
303 # ipythons, which really mimic the __main__.__dict__ with their own
303 # ipythons, which really mimic the __main__.__dict__ with their own
304 # namespace. Embedded instances, on the other hand, should not do
304 # namespace. Embedded instances, on the other hand, should not do
305 # this because they need to manage the user local/global namespaces
305 # this because they need to manage the user local/global namespaces
306 # only, but they live within a 'normal' __main__ (meaning, they
306 # only, but they live within a 'normal' __main__ (meaning, they
307 # shouldn't overtake the execution environment of the script they're
307 # shouldn't overtake the execution environment of the script they're
308 # embedded in).
308 # embedded in).
309
309
310 if not embedded:
310 if not embedded:
311 try:
311 try:
312 main_name = self.user_ns['__name__']
312 main_name = self.user_ns['__name__']
313 except KeyError:
313 except KeyError:
314 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
314 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
315 else:
315 else:
316 #print "pickle hack in place" # dbg
316 #print "pickle hack in place" # dbg
317 #print 'main_name:',main_name # dbg
317 #print 'main_name:',main_name # dbg
318 sys.modules[main_name] = FakeModule(self.user_ns)
318 sys.modules[main_name] = FakeModule(self.user_ns)
319
319
320 # List of input with multi-line handling.
320 # List of input with multi-line handling.
321 # Fill its zero entry, user counter starts at 1
321 # Fill its zero entry, user counter starts at 1
322 self.input_hist = InputList(['\n'])
322 self.input_hist = InputList(['\n'])
323
323
324 # list of visited directories
324 # list of visited directories
325 try:
325 try:
326 self.dir_hist = [os.getcwd()]
326 self.dir_hist = [os.getcwd()]
327 except IOError, e:
327 except IOError, e:
328 self.dir_hist = []
328 self.dir_hist = []
329
329
330 # dict of output history
330 # dict of output history
331 self.output_hist = {}
331 self.output_hist = {}
332
332
333 # dict of things NOT to alias (keywords, builtins and some magics)
333 # dict of things NOT to alias (keywords, builtins and some magics)
334 no_alias = {}
334 no_alias = {}
335 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
335 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
336 for key in keyword.kwlist + no_alias_magics:
336 for key in keyword.kwlist + no_alias_magics:
337 no_alias[key] = 1
337 no_alias[key] = 1
338 no_alias.update(__builtin__.__dict__)
338 no_alias.update(__builtin__.__dict__)
339 self.no_alias = no_alias
339 self.no_alias = no_alias
340
340
341 # make global variables for user access to these
341 # make global variables for user access to these
342 self.user_ns['_ih'] = self.input_hist
342 self.user_ns['_ih'] = self.input_hist
343 self.user_ns['_oh'] = self.output_hist
343 self.user_ns['_oh'] = self.output_hist
344 self.user_ns['_dh'] = self.dir_hist
344 self.user_ns['_dh'] = self.dir_hist
345
345
346 # user aliases to input and output histories
346 # user aliases to input and output histories
347 self.user_ns['In'] = self.input_hist
347 self.user_ns['In'] = self.input_hist
348 self.user_ns['Out'] = self.output_hist
348 self.user_ns['Out'] = self.output_hist
349
349
350 # Object variable to store code object waiting execution. This is
350 # Object variable to store code object waiting execution. This is
351 # used mainly by the multithreaded shells, but it can come in handy in
351 # used mainly by the multithreaded shells, but it can come in handy in
352 # other situations. No need to use a Queue here, since it's a single
352 # other situations. No need to use a Queue here, since it's a single
353 # item which gets cleared once run.
353 # item which gets cleared once run.
354 self.code_to_run = None
354 self.code_to_run = None
355
355
356 # escapes for automatic behavior on the command line
356 # escapes for automatic behavior on the command line
357 self.ESC_SHELL = '!'
357 self.ESC_SHELL = '!'
358 self.ESC_HELP = '?'
358 self.ESC_HELP = '?'
359 self.ESC_MAGIC = '%'
359 self.ESC_MAGIC = '%'
360 self.ESC_QUOTE = ','
360 self.ESC_QUOTE = ','
361 self.ESC_QUOTE2 = ';'
361 self.ESC_QUOTE2 = ';'
362 self.ESC_PAREN = '/'
362 self.ESC_PAREN = '/'
363
363
364 # And their associated handlers
364 # And their associated handlers
365 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
365 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
366 self.ESC_QUOTE : self.handle_auto,
366 self.ESC_QUOTE : self.handle_auto,
367 self.ESC_QUOTE2 : self.handle_auto,
367 self.ESC_QUOTE2 : self.handle_auto,
368 self.ESC_MAGIC : self.handle_magic,
368 self.ESC_MAGIC : self.handle_magic,
369 self.ESC_HELP : self.handle_help,
369 self.ESC_HELP : self.handle_help,
370 self.ESC_SHELL : self.handle_shell_escape,
370 self.ESC_SHELL : self.handle_shell_escape,
371 }
371 }
372
372
373 # class initializations
373 # class initializations
374 Magic.__init__(self,self)
374 Magic.__init__(self,self)
375
375
376 # Python source parser/formatter for syntax highlighting
376 # Python source parser/formatter for syntax highlighting
377 pyformat = PyColorize.Parser().format
377 pyformat = PyColorize.Parser().format
378 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
378 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
379
379
380 # hooks holds pointers used for user-side customizations
380 # hooks holds pointers used for user-side customizations
381 self.hooks = Struct()
381 self.hooks = Struct()
382
382
383 # Set all default hooks, defined in the IPython.hooks module.
383 # Set all default hooks, defined in the IPython.hooks module.
384 hooks = IPython.hooks
384 hooks = IPython.hooks
385 for hook_name in hooks.__all__:
385 for hook_name in hooks.__all__:
386 self.set_hook(hook_name,getattr(hooks,hook_name))
386 self.set_hook(hook_name,getattr(hooks,hook_name))
387
387
388 # Flag to mark unconditional exit
388 # Flag to mark unconditional exit
389 self.exit_now = False
389 self.exit_now = False
390
390
391 self.usage_min = """\
391 self.usage_min = """\
392 An enhanced console for Python.
392 An enhanced console for Python.
393 Some of its features are:
393 Some of its features are:
394 - Readline support if the readline library is present.
394 - Readline support if the readline library is present.
395 - Tab completion in the local namespace.
395 - Tab completion in the local namespace.
396 - Logging of input, see command-line options.
396 - Logging of input, see command-line options.
397 - System shell escape via ! , eg !ls.
397 - System shell escape via ! , eg !ls.
398 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
398 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
399 - Keeps track of locally defined variables via %who, %whos.
399 - Keeps track of locally defined variables via %who, %whos.
400 - Show object information with a ? eg ?x or x? (use ?? for more info).
400 - Show object information with a ? eg ?x or x? (use ?? for more info).
401 """
401 """
402 if usage: self.usage = usage
402 if usage: self.usage = usage
403 else: self.usage = self.usage_min
403 else: self.usage = self.usage_min
404
404
405 # Storage
405 # Storage
406 self.rc = rc # This will hold all configuration information
406 self.rc = rc # This will hold all configuration information
407 self.pager = 'less'
407 self.pager = 'less'
408 # temporary files used for various purposes. Deleted at exit.
408 # temporary files used for various purposes. Deleted at exit.
409 self.tempfiles = []
409 self.tempfiles = []
410
410
411 # Keep track of readline usage (later set by init_readline)
411 # Keep track of readline usage (later set by init_readline)
412 self.has_readline = False
412 self.has_readline = False
413
413
414 # template for logfile headers. It gets resolved at runtime by the
414 # template for logfile headers. It gets resolved at runtime by the
415 # logstart method.
415 # logstart method.
416 self.loghead_tpl = \
416 self.loghead_tpl = \
417 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
417 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
418 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
418 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
419 #log# opts = %s
419 #log# opts = %s
420 #log# args = %s
420 #log# args = %s
421 #log# It is safe to make manual edits below here.
421 #log# It is safe to make manual edits below here.
422 #log#-----------------------------------------------------------------------
422 #log#-----------------------------------------------------------------------
423 """
423 """
424 # for pushd/popd management
424 # for pushd/popd management
425 try:
425 try:
426 self.home_dir = get_home_dir()
426 self.home_dir = get_home_dir()
427 except HomeDirError,msg:
427 except HomeDirError,msg:
428 fatal(msg)
428 fatal(msg)
429
429
430 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
430 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
431
431
432 # Functions to call the underlying shell.
432 # Functions to call the underlying shell.
433
433
434 # utility to expand user variables via Itpl
434 # utility to expand user variables via Itpl
435 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
435 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
436 self.user_ns))
436 self.user_ns))
437 # The first is similar to os.system, but it doesn't return a value,
437 # The first is similar to os.system, but it doesn't return a value,
438 # and it allows interpolation of variables in the user's namespace.
438 # and it allows interpolation of variables in the user's namespace.
439 self.system = lambda cmd: shell(self.var_expand(cmd),
439 self.system = lambda cmd: shell(self.var_expand(cmd),
440 header='IPython system call: ',
440 header='IPython system call: ',
441 verbose=self.rc.system_verbose)
441 verbose=self.rc.system_verbose)
442 # These are for getoutput and getoutputerror:
442 # These are for getoutput and getoutputerror:
443 self.getoutput = lambda cmd: \
443 self.getoutput = lambda cmd: \
444 getoutput(self.var_expand(cmd),
444 getoutput(self.var_expand(cmd),
445 header='IPython system call: ',
445 header='IPython system call: ',
446 verbose=self.rc.system_verbose)
446 verbose=self.rc.system_verbose)
447 self.getoutputerror = lambda cmd: \
447 self.getoutputerror = lambda cmd: \
448 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
448 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
449 self.user_ns)),
449 self.user_ns)),
450 header='IPython system call: ',
450 header='IPython system call: ',
451 verbose=self.rc.system_verbose)
451 verbose=self.rc.system_verbose)
452
452
453 # RegExp for splitting line contents into pre-char//first
453 # RegExp for splitting line contents into pre-char//first
454 # word-method//rest. For clarity, each group in on one line.
454 # word-method//rest. For clarity, each group in on one line.
455
455
456 # WARNING: update the regexp if the above escapes are changed, as they
456 # WARNING: update the regexp if the above escapes are changed, as they
457 # are hardwired in.
457 # are hardwired in.
458
458
459 # Don't get carried away with trying to make the autocalling catch too
459 # Don't get carried away with trying to make the autocalling catch too
460 # much: it's better to be conservative rather than to trigger hidden
460 # much: it's better to be conservative rather than to trigger hidden
461 # evals() somewhere and end up causing side effects.
461 # evals() somewhere and end up causing side effects.
462
462
463 self.line_split = re.compile(r'^([\s*,;/])'
463 self.line_split = re.compile(r'^([\s*,;/])'
464 r'([\?\w\.]+\w*\s*)'
464 r'([\?\w\.]+\w*\s*)'
465 r'(\(?.*$)')
465 r'(\(?.*$)')
466
466
467 # Original re, keep around for a while in case changes break something
467 # Original re, keep around for a while in case changes break something
468 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
468 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
469 # r'(\s*[\?\w\.]+\w*\s*)'
469 # r'(\s*[\?\w\.]+\w*\s*)'
470 # r'(\(?.*$)')
470 # r'(\(?.*$)')
471
471
472 # RegExp to identify potential function names
472 # RegExp to identify potential function names
473 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
473 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
474 # RegExp to exclude strings with this start from autocalling
474 # RegExp to exclude strings with this start from autocalling
475 self.re_exclude_auto = re.compile('^[!=()\[\]<>,\*/\+-]|^is ')
475 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
476
476
477 # try to catch also methods for stuff in lists/tuples/dicts: off
477 # try to catch also methods for stuff in lists/tuples/dicts: off
478 # (experimental). For this to work, the line_split regexp would need
478 # (experimental). For this to work, the line_split regexp would need
479 # to be modified so it wouldn't break things at '['. That line is
479 # to be modified so it wouldn't break things at '['. That line is
480 # nasty enough that I shouldn't change it until I can test it _well_.
480 # nasty enough that I shouldn't change it until I can test it _well_.
481 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
481 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
482
482
483 # keep track of where we started running (mainly for crash post-mortem)
483 # keep track of where we started running (mainly for crash post-mortem)
484 self.starting_dir = os.getcwd()
484 self.starting_dir = os.getcwd()
485
485
486 # Various switches which can be set
486 # Various switches which can be set
487 self.CACHELENGTH = 5000 # this is cheap, it's just text
487 self.CACHELENGTH = 5000 # this is cheap, it's just text
488 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
488 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
489 self.banner2 = banner2
489 self.banner2 = banner2
490
490
491 # TraceBack handlers:
491 # TraceBack handlers:
492
492
493 # Syntax error handler.
493 # Syntax error handler.
494 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
494 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
495
495
496 # The interactive one is initialized with an offset, meaning we always
496 # The interactive one is initialized with an offset, meaning we always
497 # want to remove the topmost item in the traceback, which is our own
497 # want to remove the topmost item in the traceback, which is our own
498 # internal code. Valid modes: ['Plain','Context','Verbose']
498 # internal code. Valid modes: ['Plain','Context','Verbose']
499 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
499 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
500 color_scheme='NoColor',
500 color_scheme='NoColor',
501 tb_offset = 1)
501 tb_offset = 1)
502
502
503 # IPython itself shouldn't crash. This will produce a detailed
503 # IPython itself shouldn't crash. This will produce a detailed
504 # post-mortem if it does. But we only install the crash handler for
504 # post-mortem if it does. But we only install the crash handler for
505 # non-threaded shells, the threaded ones use a normal verbose reporter
505 # non-threaded shells, the threaded ones use a normal verbose reporter
506 # and lose the crash handler. This is because exceptions in the main
506 # and lose the crash handler. This is because exceptions in the main
507 # thread (such as in GUI code) propagate directly to sys.excepthook,
507 # thread (such as in GUI code) propagate directly to sys.excepthook,
508 # and there's no point in printing crash dumps for every user exception.
508 # and there's no point in printing crash dumps for every user exception.
509 if self.isthreaded:
509 if self.isthreaded:
510 sys.excepthook = ultraTB.FormattedTB()
510 sys.excepthook = ultraTB.FormattedTB()
511 else:
511 else:
512 from IPython import CrashHandler
512 from IPython import CrashHandler
513 sys.excepthook = CrashHandler.CrashHandler(self)
513 sys.excepthook = CrashHandler.CrashHandler(self)
514
514
515 # The instance will store a pointer to this, so that runtime code
515 # The instance will store a pointer to this, so that runtime code
516 # (such as magics) can access it. This is because during the
516 # (such as magics) can access it. This is because during the
517 # read-eval loop, it gets temporarily overwritten (to deal with GUI
517 # read-eval loop, it gets temporarily overwritten (to deal with GUI
518 # frameworks).
518 # frameworks).
519 self.sys_excepthook = sys.excepthook
519 self.sys_excepthook = sys.excepthook
520
520
521 # and add any custom exception handlers the user may have specified
521 # and add any custom exception handlers the user may have specified
522 self.set_custom_exc(*custom_exceptions)
522 self.set_custom_exc(*custom_exceptions)
523
523
524 # Object inspector
524 # Object inspector
525 self.inspector = OInspect.Inspector(OInspect.InspectColors,
525 self.inspector = OInspect.Inspector(OInspect.InspectColors,
526 PyColorize.ANSICodeColors,
526 PyColorize.ANSICodeColors,
527 'NoColor')
527 'NoColor')
528 # indentation management
528 # indentation management
529 self.autoindent = False
529 self.autoindent = False
530 self.indent_current_nsp = 0
530 self.indent_current_nsp = 0
531 self.indent_current = '' # actual indent string
531 self.indent_current = '' # actual indent string
532
532
533 # Make some aliases automatically
533 # Make some aliases automatically
534 # Prepare list of shell aliases to auto-define
534 # Prepare list of shell aliases to auto-define
535 if os.name == 'posix':
535 if os.name == 'posix':
536 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
536 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
537 'mv mv -i','rm rm -i','cp cp -i',
537 'mv mv -i','rm rm -i','cp cp -i',
538 'cat cat','less less','clear clear',
538 'cat cat','less less','clear clear',
539 # a better ls
539 # a better ls
540 'ls ls -F',
540 'ls ls -F',
541 # long ls
541 # long ls
542 'll ls -lF',
542 'll ls -lF',
543 # color ls
543 # color ls
544 'lc ls -F -o --color',
544 'lc ls -F -o --color',
545 # ls normal files only
545 # ls normal files only
546 'lf ls -F -o --color %l | grep ^-',
546 'lf ls -F -o --color %l | grep ^-',
547 # ls symbolic links
547 # ls symbolic links
548 'lk ls -F -o --color %l | grep ^l',
548 'lk ls -F -o --color %l | grep ^l',
549 # directories or links to directories,
549 # directories or links to directories,
550 'ldir ls -F -o --color %l | grep /$',
550 'ldir ls -F -o --color %l | grep /$',
551 # things which are executable
551 # things which are executable
552 'lx ls -F -o --color %l | grep ^-..x',
552 'lx ls -F -o --color %l | grep ^-..x',
553 )
553 )
554 elif os.name in ['nt','dos']:
554 elif os.name in ['nt','dos']:
555 auto_alias = ('dir dir /on', 'ls dir /on',
555 auto_alias = ('dir dir /on', 'ls dir /on',
556 'ddir dir /ad /on', 'ldir dir /ad /on',
556 'ddir dir /ad /on', 'ldir dir /ad /on',
557 'mkdir mkdir','rmdir rmdir','echo echo',
557 'mkdir mkdir','rmdir rmdir','echo echo',
558 'ren ren','cls cls','copy copy')
558 'ren ren','cls cls','copy copy')
559 else:
559 else:
560 auto_alias = ()
560 auto_alias = ()
561 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
561 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
562 # Call the actual (public) initializer
562 # Call the actual (public) initializer
563 self.init_auto_alias()
563 self.init_auto_alias()
564 # end __init__
564 # end __init__
565
565
566 def post_config_initialization(self):
566 def post_config_initialization(self):
567 """Post configuration init method
567 """Post configuration init method
568
568
569 This is called after the configuration files have been processed to
569 This is called after the configuration files have been processed to
570 'finalize' the initialization."""
570 'finalize' the initialization."""
571
571
572 rc = self.rc
572 rc = self.rc
573
573
574 # Load readline proper
574 # Load readline proper
575 if rc.readline:
575 if rc.readline:
576 self.init_readline()
576 self.init_readline()
577
577
578 # log system
578 # log system
579 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
579 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
580 # local shortcut, this is used a LOT
580 # local shortcut, this is used a LOT
581 self.log = self.logger.log
581 self.log = self.logger.log
582
582
583 # Initialize cache, set in/out prompts and printing system
583 # Initialize cache, set in/out prompts and printing system
584 self.outputcache = CachedOutput(self,
584 self.outputcache = CachedOutput(self,
585 rc.cache_size,
585 rc.cache_size,
586 rc.pprint,
586 rc.pprint,
587 input_sep = rc.separate_in,
587 input_sep = rc.separate_in,
588 output_sep = rc.separate_out,
588 output_sep = rc.separate_out,
589 output_sep2 = rc.separate_out2,
589 output_sep2 = rc.separate_out2,
590 ps1 = rc.prompt_in1,
590 ps1 = rc.prompt_in1,
591 ps2 = rc.prompt_in2,
591 ps2 = rc.prompt_in2,
592 ps_out = rc.prompt_out,
592 ps_out = rc.prompt_out,
593 pad_left = rc.prompts_pad_left)
593 pad_left = rc.prompts_pad_left)
594
594
595 # user may have over-ridden the default print hook:
595 # user may have over-ridden the default print hook:
596 try:
596 try:
597 self.outputcache.__class__.display = self.hooks.display
597 self.outputcache.__class__.display = self.hooks.display
598 except AttributeError:
598 except AttributeError:
599 pass
599 pass
600
600
601 # I don't like assigning globally to sys, because it means when embedding
601 # I don't like assigning globally to sys, because it means when embedding
602 # instances, each embedded instance overrides the previous choice. But
602 # instances, each embedded instance overrides the previous choice. But
603 # sys.displayhook seems to be called internally by exec, so I don't see a
603 # sys.displayhook seems to be called internally by exec, so I don't see a
604 # way around it.
604 # way around it.
605 sys.displayhook = self.outputcache
605 sys.displayhook = self.outputcache
606
606
607 # Set user colors (don't do it in the constructor above so that it
607 # Set user colors (don't do it in the constructor above so that it
608 # doesn't crash if colors option is invalid)
608 # doesn't crash if colors option is invalid)
609 self.magic_colors(rc.colors)
609 self.magic_colors(rc.colors)
610
610
611 # Set calling of pdb on exceptions
611 # Set calling of pdb on exceptions
612 self.call_pdb = rc.pdb
612 self.call_pdb = rc.pdb
613
613
614 # Load user aliases
614 # Load user aliases
615 for alias in rc.alias:
615 for alias in rc.alias:
616 self.magic_alias(alias)
616 self.magic_alias(alias)
617
617
618 # dynamic data that survives through sessions
618 # dynamic data that survives through sessions
619 # XXX make the filename a config option?
619 # XXX make the filename a config option?
620 persist_base = 'persist'
620 persist_base = 'persist'
621 if rc.profile:
621 if rc.profile:
622 persist_base += '_%s' % rc.profile
622 persist_base += '_%s' % rc.profile
623 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
623 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
624
624
625 try:
625 try:
626 self.persist = pickle.load(file(self.persist_fname))
626 self.persist = pickle.load(file(self.persist_fname))
627 except:
627 except:
628 self.persist = {}
628 self.persist = {}
629
629
630
630
631 for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]:
631 for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]:
632 try:
632 try:
633 obj = pickle.loads(value)
633 obj = pickle.loads(value)
634 except:
634 except:
635
635
636 print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key
636 print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key
637 print "The error was:",sys.exc_info()[0]
637 print "The error was:",sys.exc_info()[0]
638 continue
638 continue
639
639
640
640
641 self.user_ns[key] = obj
641 self.user_ns[key] = obj
642
642
643 def add_builtins(self):
643 def add_builtins(self):
644 """Store ipython references into the builtin namespace.
644 """Store ipython references into the builtin namespace.
645
645
646 Some parts of ipython operate via builtins injected here, which hold a
646 Some parts of ipython operate via builtins injected here, which hold a
647 reference to IPython itself."""
647 reference to IPython itself."""
648
648
649 builtins_new = dict(__IPYTHON__ = self,
649 builtins_new = dict(__IPYTHON__ = self,
650 ip_set_hook = self.set_hook,
650 ip_set_hook = self.set_hook,
651 jobs = self.jobs,
651 jobs = self.jobs,
652 ipmagic = self.ipmagic,
652 ipmagic = self.ipmagic,
653 ipalias = self.ipalias,
653 ipalias = self.ipalias,
654 ipsystem = self.ipsystem,
654 ipsystem = self.ipsystem,
655 )
655 )
656 for biname,bival in builtins_new.items():
656 for biname,bival in builtins_new.items():
657 try:
657 try:
658 # store the orignal value so we can restore it
658 # store the orignal value so we can restore it
659 self.builtins_added[biname] = __builtin__.__dict__[biname]
659 self.builtins_added[biname] = __builtin__.__dict__[biname]
660 except KeyError:
660 except KeyError:
661 # or mark that it wasn't defined, and we'll just delete it at
661 # or mark that it wasn't defined, and we'll just delete it at
662 # cleanup
662 # cleanup
663 self.builtins_added[biname] = Undefined
663 self.builtins_added[biname] = Undefined
664 __builtin__.__dict__[biname] = bival
664 __builtin__.__dict__[biname] = bival
665
665
666 # Keep in the builtins a flag for when IPython is active. We set it
666 # Keep in the builtins a flag for when IPython is active. We set it
667 # with setdefault so that multiple nested IPythons don't clobber one
667 # with setdefault so that multiple nested IPythons don't clobber one
668 # another. Each will increase its value by one upon being activated,
668 # another. Each will increase its value by one upon being activated,
669 # which also gives us a way to determine the nesting level.
669 # which also gives us a way to determine the nesting level.
670 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
670 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
671
671
672 def clean_builtins(self):
672 def clean_builtins(self):
673 """Remove any builtins which might have been added by add_builtins, or
673 """Remove any builtins which might have been added by add_builtins, or
674 restore overwritten ones to their previous values."""
674 restore overwritten ones to their previous values."""
675 for biname,bival in self.builtins_added.items():
675 for biname,bival in self.builtins_added.items():
676 if bival is Undefined:
676 if bival is Undefined:
677 del __builtin__.__dict__[biname]
677 del __builtin__.__dict__[biname]
678 else:
678 else:
679 __builtin__.__dict__[biname] = bival
679 __builtin__.__dict__[biname] = bival
680 self.builtins_added.clear()
680 self.builtins_added.clear()
681
681
682 def set_hook(self,name,hook):
682 def set_hook(self,name,hook):
683 """set_hook(name,hook) -> sets an internal IPython hook.
683 """set_hook(name,hook) -> sets an internal IPython hook.
684
684
685 IPython exposes some of its internal API as user-modifiable hooks. By
685 IPython exposes some of its internal API as user-modifiable hooks. By
686 resetting one of these hooks, you can modify IPython's behavior to
686 resetting one of these hooks, you can modify IPython's behavior to
687 call at runtime your own routines."""
687 call at runtime your own routines."""
688
688
689 # At some point in the future, this should validate the hook before it
689 # At some point in the future, this should validate the hook before it
690 # accepts it. Probably at least check that the hook takes the number
690 # accepts it. Probably at least check that the hook takes the number
691 # of args it's supposed to.
691 # of args it's supposed to.
692 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
692 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
693
693
694 def set_custom_exc(self,exc_tuple,handler):
694 def set_custom_exc(self,exc_tuple,handler):
695 """set_custom_exc(exc_tuple,handler)
695 """set_custom_exc(exc_tuple,handler)
696
696
697 Set a custom exception handler, which will be called if any of the
697 Set a custom exception handler, which will be called if any of the
698 exceptions in exc_tuple occur in the mainloop (specifically, in the
698 exceptions in exc_tuple occur in the mainloop (specifically, in the
699 runcode() method.
699 runcode() method.
700
700
701 Inputs:
701 Inputs:
702
702
703 - exc_tuple: a *tuple* of valid exceptions to call the defined
703 - exc_tuple: a *tuple* of valid exceptions to call the defined
704 handler for. It is very important that you use a tuple, and NOT A
704 handler for. It is very important that you use a tuple, and NOT A
705 LIST here, because of the way Python's except statement works. If
705 LIST here, because of the way Python's except statement works. If
706 you only want to trap a single exception, use a singleton tuple:
706 you only want to trap a single exception, use a singleton tuple:
707
707
708 exc_tuple == (MyCustomException,)
708 exc_tuple == (MyCustomException,)
709
709
710 - handler: this must be defined as a function with the following
710 - handler: this must be defined as a function with the following
711 basic interface: def my_handler(self,etype,value,tb).
711 basic interface: def my_handler(self,etype,value,tb).
712
712
713 This will be made into an instance method (via new.instancemethod)
713 This will be made into an instance method (via new.instancemethod)
714 of IPython itself, and it will be called if any of the exceptions
714 of IPython itself, and it will be called if any of the exceptions
715 listed in the exc_tuple are caught. If the handler is None, an
715 listed in the exc_tuple are caught. If the handler is None, an
716 internal basic one is used, which just prints basic info.
716 internal basic one is used, which just prints basic info.
717
717
718 WARNING: by putting in your own exception handler into IPython's main
718 WARNING: by putting in your own exception handler into IPython's main
719 execution loop, you run a very good chance of nasty crashes. This
719 execution loop, you run a very good chance of nasty crashes. This
720 facility should only be used if you really know what you are doing."""
720 facility should only be used if you really know what you are doing."""
721
721
722 assert type(exc_tuple)==type(()) , \
722 assert type(exc_tuple)==type(()) , \
723 "The custom exceptions must be given AS A TUPLE."
723 "The custom exceptions must be given AS A TUPLE."
724
724
725 def dummy_handler(self,etype,value,tb):
725 def dummy_handler(self,etype,value,tb):
726 print '*** Simple custom exception handler ***'
726 print '*** Simple custom exception handler ***'
727 print 'Exception type :',etype
727 print 'Exception type :',etype
728 print 'Exception value:',value
728 print 'Exception value:',value
729 print 'Traceback :',tb
729 print 'Traceback :',tb
730 print 'Source code :','\n'.join(self.buffer)
730 print 'Source code :','\n'.join(self.buffer)
731
731
732 if handler is None: handler = dummy_handler
732 if handler is None: handler = dummy_handler
733
733
734 self.CustomTB = new.instancemethod(handler,self,self.__class__)
734 self.CustomTB = new.instancemethod(handler,self,self.__class__)
735 self.custom_exceptions = exc_tuple
735 self.custom_exceptions = exc_tuple
736
736
737 def set_custom_completer(self,completer,pos=0):
737 def set_custom_completer(self,completer,pos=0):
738 """set_custom_completer(completer,pos=0)
738 """set_custom_completer(completer,pos=0)
739
739
740 Adds a new custom completer function.
740 Adds a new custom completer function.
741
741
742 The position argument (defaults to 0) is the index in the completers
742 The position argument (defaults to 0) is the index in the completers
743 list where you want the completer to be inserted."""
743 list where you want the completer to be inserted."""
744
744
745 newcomp = new.instancemethod(completer,self.Completer,
745 newcomp = new.instancemethod(completer,self.Completer,
746 self.Completer.__class__)
746 self.Completer.__class__)
747 self.Completer.matchers.insert(pos,newcomp)
747 self.Completer.matchers.insert(pos,newcomp)
748
748
749 def _get_call_pdb(self):
749 def _get_call_pdb(self):
750 return self._call_pdb
750 return self._call_pdb
751
751
752 def _set_call_pdb(self,val):
752 def _set_call_pdb(self,val):
753
753
754 if val not in (0,1,False,True):
754 if val not in (0,1,False,True):
755 raise ValueError,'new call_pdb value must be boolean'
755 raise ValueError,'new call_pdb value must be boolean'
756
756
757 # store value in instance
757 # store value in instance
758 self._call_pdb = val
758 self._call_pdb = val
759
759
760 # notify the actual exception handlers
760 # notify the actual exception handlers
761 self.InteractiveTB.call_pdb = val
761 self.InteractiveTB.call_pdb = val
762 if self.isthreaded:
762 if self.isthreaded:
763 try:
763 try:
764 self.sys_excepthook.call_pdb = val
764 self.sys_excepthook.call_pdb = val
765 except:
765 except:
766 warn('Failed to activate pdb for threaded exception handler')
766 warn('Failed to activate pdb for threaded exception handler')
767
767
768 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
768 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
769 'Control auto-activation of pdb at exceptions')
769 'Control auto-activation of pdb at exceptions')
770
770
771
771
772 # These special functions get installed in the builtin namespace, to
772 # These special functions get installed in the builtin namespace, to
773 # provide programmatic (pure python) access to magics, aliases and system
773 # provide programmatic (pure python) access to magics, aliases and system
774 # calls. This is important for logging, user scripting, and more.
774 # calls. This is important for logging, user scripting, and more.
775
775
776 # We are basically exposing, via normal python functions, the three
776 # We are basically exposing, via normal python functions, the three
777 # mechanisms in which ipython offers special call modes (magics for
777 # mechanisms in which ipython offers special call modes (magics for
778 # internal control, aliases for direct system access via pre-selected
778 # internal control, aliases for direct system access via pre-selected
779 # names, and !cmd for calling arbitrary system commands).
779 # names, and !cmd for calling arbitrary system commands).
780
780
781 def ipmagic(self,arg_s):
781 def ipmagic(self,arg_s):
782 """Call a magic function by name.
782 """Call a magic function by name.
783
783
784 Input: a string containing the name of the magic function to call and any
784 Input: a string containing the name of the magic function to call and any
785 additional arguments to be passed to the magic.
785 additional arguments to be passed to the magic.
786
786
787 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
787 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
788 prompt:
788 prompt:
789
789
790 In[1]: %name -opt foo bar
790 In[1]: %name -opt foo bar
791
791
792 To call a magic without arguments, simply use ipmagic('name').
792 To call a magic without arguments, simply use ipmagic('name').
793
793
794 This provides a proper Python function to call IPython's magics in any
794 This provides a proper Python function to call IPython's magics in any
795 valid Python code you can type at the interpreter, including loops and
795 valid Python code you can type at the interpreter, including loops and
796 compound statements. It is added by IPython to the Python builtin
796 compound statements. It is added by IPython to the Python builtin
797 namespace upon initialization."""
797 namespace upon initialization."""
798
798
799 args = arg_s.split(' ',1)
799 args = arg_s.split(' ',1)
800 magic_name = args[0]
800 magic_name = args[0]
801 if magic_name.startswith(self.ESC_MAGIC):
801 if magic_name.startswith(self.ESC_MAGIC):
802 magic_name = magic_name[1:]
802 magic_name = magic_name[1:]
803 try:
803 try:
804 magic_args = args[1]
804 magic_args = args[1]
805 except IndexError:
805 except IndexError:
806 magic_args = ''
806 magic_args = ''
807 fn = getattr(self,'magic_'+magic_name,None)
807 fn = getattr(self,'magic_'+magic_name,None)
808 if fn is None:
808 if fn is None:
809 error("Magic function `%s` not found." % magic_name)
809 error("Magic function `%s` not found." % magic_name)
810 else:
810 else:
811 magic_args = self.var_expand(magic_args)
811 magic_args = self.var_expand(magic_args)
812 return fn(magic_args)
812 return fn(magic_args)
813
813
814 def ipalias(self,arg_s):
814 def ipalias(self,arg_s):
815 """Call an alias by name.
815 """Call an alias by name.
816
816
817 Input: a string containing the name of the alias to call and any
817 Input: a string containing the name of the alias to call and any
818 additional arguments to be passed to the magic.
818 additional arguments to be passed to the magic.
819
819
820 ipalias('name -opt foo bar') is equivalent to typing at the ipython
820 ipalias('name -opt foo bar') is equivalent to typing at the ipython
821 prompt:
821 prompt:
822
822
823 In[1]: name -opt foo bar
823 In[1]: name -opt foo bar
824
824
825 To call an alias without arguments, simply use ipalias('name').
825 To call an alias without arguments, simply use ipalias('name').
826
826
827 This provides a proper Python function to call IPython's aliases in any
827 This provides a proper Python function to call IPython's aliases in any
828 valid Python code you can type at the interpreter, including loops and
828 valid Python code you can type at the interpreter, including loops and
829 compound statements. It is added by IPython to the Python builtin
829 compound statements. It is added by IPython to the Python builtin
830 namespace upon initialization."""
830 namespace upon initialization."""
831
831
832 args = arg_s.split(' ',1)
832 args = arg_s.split(' ',1)
833 alias_name = args[0]
833 alias_name = args[0]
834 try:
834 try:
835 alias_args = args[1]
835 alias_args = args[1]
836 except IndexError:
836 except IndexError:
837 alias_args = ''
837 alias_args = ''
838 if alias_name in self.alias_table:
838 if alias_name in self.alias_table:
839 self.call_alias(alias_name,alias_args)
839 self.call_alias(alias_name,alias_args)
840 else:
840 else:
841 error("Alias `%s` not found." % alias_name)
841 error("Alias `%s` not found." % alias_name)
842
842
843 def ipsystem(self,arg_s):
843 def ipsystem(self,arg_s):
844 """Make a system call, using IPython."""
844 """Make a system call, using IPython."""
845 self.system(arg_s)
845 self.system(arg_s)
846
846
847 def complete(self,text):
847 def complete(self,text):
848 """Return a sorted list of all possible completions on text.
848 """Return a sorted list of all possible completions on text.
849
849
850 Inputs:
850 Inputs:
851
851
852 - text: a string of text to be completed on.
852 - text: a string of text to be completed on.
853
853
854 This is a wrapper around the completion mechanism, similar to what
854 This is a wrapper around the completion mechanism, similar to what
855 readline does at the command line when the TAB key is hit. By
855 readline does at the command line when the TAB key is hit. By
856 exposing it as a method, it can be used by other non-readline
856 exposing it as a method, it can be used by other non-readline
857 environments (such as GUIs) for text completion.
857 environments (such as GUIs) for text completion.
858
858
859 Simple usage example:
859 Simple usage example:
860
860
861 In [1]: x = 'hello'
861 In [1]: x = 'hello'
862
862
863 In [2]: __IP.complete('x.l')
863 In [2]: __IP.complete('x.l')
864 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
864 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
865
865
866 complete = self.Completer.complete
866 complete = self.Completer.complete
867 state = 0
867 state = 0
868 # use a dict so we get unique keys, since ipyhton's multiple
868 # use a dict so we get unique keys, since ipyhton's multiple
869 # completers can return duplicates.
869 # completers can return duplicates.
870 comps = {}
870 comps = {}
871 while True:
871 while True:
872 newcomp = complete(text,state)
872 newcomp = complete(text,state)
873 if newcomp is None:
873 if newcomp is None:
874 break
874 break
875 comps[newcomp] = 1
875 comps[newcomp] = 1
876 state += 1
876 state += 1
877 outcomps = comps.keys()
877 outcomps = comps.keys()
878 outcomps.sort()
878 outcomps.sort()
879 return outcomps
879 return outcomps
880
880
881 def set_completer_frame(self, frame):
881 def set_completer_frame(self, frame):
882 if frame:
882 if frame:
883 self.Completer.namespace = frame.f_locals
883 self.Completer.namespace = frame.f_locals
884 self.Completer.global_namespace = frame.f_globals
884 self.Completer.global_namespace = frame.f_globals
885 else:
885 else:
886 self.Completer.namespace = self.user_ns
886 self.Completer.namespace = self.user_ns
887 self.Completer.global_namespace = self.user_global_ns
887 self.Completer.global_namespace = self.user_global_ns
888
888
889 def init_auto_alias(self):
889 def init_auto_alias(self):
890 """Define some aliases automatically.
890 """Define some aliases automatically.
891
891
892 These are ALL parameter-less aliases"""
892 These are ALL parameter-less aliases"""
893 for alias,cmd in self.auto_alias:
893 for alias,cmd in self.auto_alias:
894 self.alias_table[alias] = (0,cmd)
894 self.alias_table[alias] = (0,cmd)
895
895
896 def alias_table_validate(self,verbose=0):
896 def alias_table_validate(self,verbose=0):
897 """Update information about the alias table.
897 """Update information about the alias table.
898
898
899 In particular, make sure no Python keywords/builtins are in it."""
899 In particular, make sure no Python keywords/builtins are in it."""
900
900
901 no_alias = self.no_alias
901 no_alias = self.no_alias
902 for k in self.alias_table.keys():
902 for k in self.alias_table.keys():
903 if k in no_alias:
903 if k in no_alias:
904 del self.alias_table[k]
904 del self.alias_table[k]
905 if verbose:
905 if verbose:
906 print ("Deleting alias <%s>, it's a Python "
906 print ("Deleting alias <%s>, it's a Python "
907 "keyword or builtin." % k)
907 "keyword or builtin." % k)
908
908
909 def set_autoindent(self,value=None):
909 def set_autoindent(self,value=None):
910 """Set the autoindent flag, checking for readline support.
910 """Set the autoindent flag, checking for readline support.
911
911
912 If called with no arguments, it acts as a toggle."""
912 If called with no arguments, it acts as a toggle."""
913
913
914 if not self.has_readline:
914 if not self.has_readline:
915 if os.name == 'posix':
915 if os.name == 'posix':
916 warn("The auto-indent feature requires the readline library")
916 warn("The auto-indent feature requires the readline library")
917 self.autoindent = 0
917 self.autoindent = 0
918 return
918 return
919 if value is None:
919 if value is None:
920 self.autoindent = not self.autoindent
920 self.autoindent = not self.autoindent
921 else:
921 else:
922 self.autoindent = value
922 self.autoindent = value
923
923
924 def rc_set_toggle(self,rc_field,value=None):
924 def rc_set_toggle(self,rc_field,value=None):
925 """Set or toggle a field in IPython's rc config. structure.
925 """Set or toggle a field in IPython's rc config. structure.
926
926
927 If called with no arguments, it acts as a toggle.
927 If called with no arguments, it acts as a toggle.
928
928
929 If called with a non-existent field, the resulting AttributeError
929 If called with a non-existent field, the resulting AttributeError
930 exception will propagate out."""
930 exception will propagate out."""
931
931
932 rc_val = getattr(self.rc,rc_field)
932 rc_val = getattr(self.rc,rc_field)
933 if value is None:
933 if value is None:
934 value = not rc_val
934 value = not rc_val
935 setattr(self.rc,rc_field,value)
935 setattr(self.rc,rc_field,value)
936
936
937 def user_setup(self,ipythondir,rc_suffix,mode='install'):
937 def user_setup(self,ipythondir,rc_suffix,mode='install'):
938 """Install the user configuration directory.
938 """Install the user configuration directory.
939
939
940 Can be called when running for the first time or to upgrade the user's
940 Can be called when running for the first time or to upgrade the user's
941 .ipython/ directory with the mode parameter. Valid modes are 'install'
941 .ipython/ directory with the mode parameter. Valid modes are 'install'
942 and 'upgrade'."""
942 and 'upgrade'."""
943
943
944 def wait():
944 def wait():
945 try:
945 try:
946 raw_input("Please press <RETURN> to start IPython.")
946 raw_input("Please press <RETURN> to start IPython.")
947 except EOFError:
947 except EOFError:
948 print >> Term.cout
948 print >> Term.cout
949 print '*'*70
949 print '*'*70
950
950
951 cwd = os.getcwd() # remember where we started
951 cwd = os.getcwd() # remember where we started
952 glb = glob.glob
952 glb = glob.glob
953 print '*'*70
953 print '*'*70
954 if mode == 'install':
954 if mode == 'install':
955 print \
955 print \
956 """Welcome to IPython. I will try to create a personal configuration directory
956 """Welcome to IPython. I will try to create a personal configuration directory
957 where you can customize many aspects of IPython's functionality in:\n"""
957 where you can customize many aspects of IPython's functionality in:\n"""
958 else:
958 else:
959 print 'I am going to upgrade your configuration in:'
959 print 'I am going to upgrade your configuration in:'
960
960
961 print ipythondir
961 print ipythondir
962
962
963 rcdirend = os.path.join('IPython','UserConfig')
963 rcdirend = os.path.join('IPython','UserConfig')
964 cfg = lambda d: os.path.join(d,rcdirend)
964 cfg = lambda d: os.path.join(d,rcdirend)
965 try:
965 try:
966 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
966 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
967 except IOError:
967 except IOError:
968 warning = """
968 warning = """
969 Installation error. IPython's directory was not found.
969 Installation error. IPython's directory was not found.
970
970
971 Check the following:
971 Check the following:
972
972
973 The ipython/IPython directory should be in a directory belonging to your
973 The ipython/IPython directory should be in a directory belonging to your
974 PYTHONPATH environment variable (that is, it should be in a directory
974 PYTHONPATH environment variable (that is, it should be in a directory
975 belonging to sys.path). You can copy it explicitly there or just link to it.
975 belonging to sys.path). You can copy it explicitly there or just link to it.
976
976
977 IPython will proceed with builtin defaults.
977 IPython will proceed with builtin defaults.
978 """
978 """
979 warn(warning)
979 warn(warning)
980 wait()
980 wait()
981 return
981 return
982
982
983 if mode == 'install':
983 if mode == 'install':
984 try:
984 try:
985 shutil.copytree(rcdir,ipythondir)
985 shutil.copytree(rcdir,ipythondir)
986 os.chdir(ipythondir)
986 os.chdir(ipythondir)
987 rc_files = glb("ipythonrc*")
987 rc_files = glb("ipythonrc*")
988 for rc_file in rc_files:
988 for rc_file in rc_files:
989 os.rename(rc_file,rc_file+rc_suffix)
989 os.rename(rc_file,rc_file+rc_suffix)
990 except:
990 except:
991 warning = """
991 warning = """
992
992
993 There was a problem with the installation:
993 There was a problem with the installation:
994 %s
994 %s
995 Try to correct it or contact the developers if you think it's a bug.
995 Try to correct it or contact the developers if you think it's a bug.
996 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
996 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
997 warn(warning)
997 warn(warning)
998 wait()
998 wait()
999 return
999 return
1000
1000
1001 elif mode == 'upgrade':
1001 elif mode == 'upgrade':
1002 try:
1002 try:
1003 os.chdir(ipythondir)
1003 os.chdir(ipythondir)
1004 except:
1004 except:
1005 print """
1005 print """
1006 Can not upgrade: changing to directory %s failed. Details:
1006 Can not upgrade: changing to directory %s failed. Details:
1007 %s
1007 %s
1008 """ % (ipythondir,sys.exc_info()[1])
1008 """ % (ipythondir,sys.exc_info()[1])
1009 wait()
1009 wait()
1010 return
1010 return
1011 else:
1011 else:
1012 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1012 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1013 for new_full_path in sources:
1013 for new_full_path in sources:
1014 new_filename = os.path.basename(new_full_path)
1014 new_filename = os.path.basename(new_full_path)
1015 if new_filename.startswith('ipythonrc'):
1015 if new_filename.startswith('ipythonrc'):
1016 new_filename = new_filename + rc_suffix
1016 new_filename = new_filename + rc_suffix
1017 # The config directory should only contain files, skip any
1017 # The config directory should only contain files, skip any
1018 # directories which may be there (like CVS)
1018 # directories which may be there (like CVS)
1019 if os.path.isdir(new_full_path):
1019 if os.path.isdir(new_full_path):
1020 continue
1020 continue
1021 if os.path.exists(new_filename):
1021 if os.path.exists(new_filename):
1022 old_file = new_filename+'.old'
1022 old_file = new_filename+'.old'
1023 if os.path.exists(old_file):
1023 if os.path.exists(old_file):
1024 os.remove(old_file)
1024 os.remove(old_file)
1025 os.rename(new_filename,old_file)
1025 os.rename(new_filename,old_file)
1026 shutil.copy(new_full_path,new_filename)
1026 shutil.copy(new_full_path,new_filename)
1027 else:
1027 else:
1028 raise ValueError,'unrecognized mode for install:',`mode`
1028 raise ValueError,'unrecognized mode for install:',`mode`
1029
1029
1030 # Fix line-endings to those native to each platform in the config
1030 # Fix line-endings to those native to each platform in the config
1031 # directory.
1031 # directory.
1032 try:
1032 try:
1033 os.chdir(ipythondir)
1033 os.chdir(ipythondir)
1034 except:
1034 except:
1035 print """
1035 print """
1036 Problem: changing to directory %s failed.
1036 Problem: changing to directory %s failed.
1037 Details:
1037 Details:
1038 %s
1038 %s
1039
1039
1040 Some configuration files may have incorrect line endings. This should not
1040 Some configuration files may have incorrect line endings. This should not
1041 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1041 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1042 wait()
1042 wait()
1043 else:
1043 else:
1044 for fname in glb('ipythonrc*'):
1044 for fname in glb('ipythonrc*'):
1045 try:
1045 try:
1046 native_line_ends(fname,backup=0)
1046 native_line_ends(fname,backup=0)
1047 except IOError:
1047 except IOError:
1048 pass
1048 pass
1049
1049
1050 if mode == 'install':
1050 if mode == 'install':
1051 print """
1051 print """
1052 Successful installation!
1052 Successful installation!
1053
1053
1054 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1054 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1055 IPython manual (there are both HTML and PDF versions supplied with the
1055 IPython manual (there are both HTML and PDF versions supplied with the
1056 distribution) to make sure that your system environment is properly configured
1056 distribution) to make sure that your system environment is properly configured
1057 to take advantage of IPython's features."""
1057 to take advantage of IPython's features."""
1058 else:
1058 else:
1059 print """
1059 print """
1060 Successful upgrade!
1060 Successful upgrade!
1061
1061
1062 All files in your directory:
1062 All files in your directory:
1063 %(ipythondir)s
1063 %(ipythondir)s
1064 which would have been overwritten by the upgrade were backed up with a .old
1064 which would have been overwritten by the upgrade were backed up with a .old
1065 extension. If you had made particular customizations in those files you may
1065 extension. If you had made particular customizations in those files you may
1066 want to merge them back into the new files.""" % locals()
1066 want to merge them back into the new files.""" % locals()
1067 wait()
1067 wait()
1068 os.chdir(cwd)
1068 os.chdir(cwd)
1069 # end user_setup()
1069 # end user_setup()
1070
1070
1071 def atexit_operations(self):
1071 def atexit_operations(self):
1072 """This will be executed at the time of exit.
1072 """This will be executed at the time of exit.
1073
1073
1074 Saving of persistent data should be performed here. """
1074 Saving of persistent data should be performed here. """
1075
1075
1076 # input history
1076 # input history
1077 self.savehist()
1077 self.savehist()
1078
1078
1079 # Cleanup all tempfiles left around
1079 # Cleanup all tempfiles left around
1080 for tfile in self.tempfiles:
1080 for tfile in self.tempfiles:
1081 try:
1081 try:
1082 os.unlink(tfile)
1082 os.unlink(tfile)
1083 except OSError:
1083 except OSError:
1084 pass
1084 pass
1085
1085
1086 # save the "persistent data" catch-all dictionary
1086 # save the "persistent data" catch-all dictionary
1087 try:
1087 try:
1088 pickle.dump(self.persist, open(self.persist_fname,"w"))
1088 pickle.dump(self.persist, open(self.persist_fname,"w"))
1089 except:
1089 except:
1090 print "*** ERROR *** persistent data saving failed."
1090 print "*** ERROR *** persistent data saving failed."
1091
1091
1092 def savehist(self):
1092 def savehist(self):
1093 """Save input history to a file (via readline library)."""
1093 """Save input history to a file (via readline library)."""
1094 try:
1094 try:
1095 self.readline.write_history_file(self.histfile)
1095 self.readline.write_history_file(self.histfile)
1096 except:
1096 except:
1097 print 'Unable to save IPython command history to file: ' + \
1097 print 'Unable to save IPython command history to file: ' + \
1098 `self.histfile`
1098 `self.histfile`
1099
1099
1100 def pre_readline(self):
1100 def pre_readline(self):
1101 """readline hook to be used at the start of each line.
1101 """readline hook to be used at the start of each line.
1102
1102
1103 Currently it handles auto-indent only."""
1103 Currently it handles auto-indent only."""
1104
1104
1105 self.readline.insert_text(self.indent_current)
1105 self.readline.insert_text(self.indent_current)
1106
1106
1107 def init_readline(self):
1107 def init_readline(self):
1108 """Command history completion/saving/reloading."""
1108 """Command history completion/saving/reloading."""
1109 try:
1109 try:
1110 import readline
1110 import readline
1111 except ImportError:
1111 except ImportError:
1112 self.has_readline = 0
1112 self.has_readline = 0
1113 self.readline = None
1113 self.readline = None
1114 # no point in bugging windows users with this every time:
1114 # no point in bugging windows users with this every time:
1115 if os.name == 'posix':
1115 if os.name == 'posix':
1116 warn('Readline services not available on this platform.')
1116 warn('Readline services not available on this platform.')
1117 else:
1117 else:
1118 import atexit
1118 import atexit
1119 from IPython.completer import IPCompleter
1119 from IPython.completer import IPCompleter
1120 self.Completer = IPCompleter(self,
1120 self.Completer = IPCompleter(self,
1121 self.user_ns,
1121 self.user_ns,
1122 self.user_global_ns,
1122 self.user_global_ns,
1123 self.rc.readline_omit__names,
1123 self.rc.readline_omit__names,
1124 self.alias_table)
1124 self.alias_table)
1125
1125
1126 # Platform-specific configuration
1126 # Platform-specific configuration
1127 if os.name == 'nt':
1127 if os.name == 'nt':
1128 self.readline_startup_hook = readline.set_pre_input_hook
1128 self.readline_startup_hook = readline.set_pre_input_hook
1129 else:
1129 else:
1130 self.readline_startup_hook = readline.set_startup_hook
1130 self.readline_startup_hook = readline.set_startup_hook
1131
1131
1132 # Load user's initrc file (readline config)
1132 # Load user's initrc file (readline config)
1133 inputrc_name = os.environ.get('INPUTRC')
1133 inputrc_name = os.environ.get('INPUTRC')
1134 if inputrc_name is None:
1134 if inputrc_name is None:
1135 home_dir = get_home_dir()
1135 home_dir = get_home_dir()
1136 if home_dir is not None:
1136 if home_dir is not None:
1137 inputrc_name = os.path.join(home_dir,'.inputrc')
1137 inputrc_name = os.path.join(home_dir,'.inputrc')
1138 if os.path.isfile(inputrc_name):
1138 if os.path.isfile(inputrc_name):
1139 try:
1139 try:
1140 readline.read_init_file(inputrc_name)
1140 readline.read_init_file(inputrc_name)
1141 except:
1141 except:
1142 warn('Problems reading readline initialization file <%s>'
1142 warn('Problems reading readline initialization file <%s>'
1143 % inputrc_name)
1143 % inputrc_name)
1144
1144
1145 self.has_readline = 1
1145 self.has_readline = 1
1146 self.readline = readline
1146 self.readline = readline
1147 # save this in sys so embedded copies can restore it properly
1147 # save this in sys so embedded copies can restore it properly
1148 sys.ipcompleter = self.Completer.complete
1148 sys.ipcompleter = self.Completer.complete
1149 readline.set_completer(self.Completer.complete)
1149 readline.set_completer(self.Completer.complete)
1150
1150
1151 # Configure readline according to user's prefs
1151 # Configure readline according to user's prefs
1152 for rlcommand in self.rc.readline_parse_and_bind:
1152 for rlcommand in self.rc.readline_parse_and_bind:
1153 readline.parse_and_bind(rlcommand)
1153 readline.parse_and_bind(rlcommand)
1154
1154
1155 # remove some chars from the delimiters list
1155 # remove some chars from the delimiters list
1156 delims = readline.get_completer_delims()
1156 delims = readline.get_completer_delims()
1157 delims = delims.translate(string._idmap,
1157 delims = delims.translate(string._idmap,
1158 self.rc.readline_remove_delims)
1158 self.rc.readline_remove_delims)
1159 readline.set_completer_delims(delims)
1159 readline.set_completer_delims(delims)
1160 # otherwise we end up with a monster history after a while:
1160 # otherwise we end up with a monster history after a while:
1161 readline.set_history_length(1000)
1161 readline.set_history_length(1000)
1162 try:
1162 try:
1163 #print '*** Reading readline history' # dbg
1163 #print '*** Reading readline history' # dbg
1164 readline.read_history_file(self.histfile)
1164 readline.read_history_file(self.histfile)
1165 except IOError:
1165 except IOError:
1166 pass # It doesn't exist yet.
1166 pass # It doesn't exist yet.
1167
1167
1168 atexit.register(self.atexit_operations)
1168 atexit.register(self.atexit_operations)
1169 del atexit
1169 del atexit
1170
1170
1171 # Configure auto-indent for all platforms
1171 # Configure auto-indent for all platforms
1172 self.set_autoindent(self.rc.autoindent)
1172 self.set_autoindent(self.rc.autoindent)
1173
1173
1174 def _should_recompile(self,e):
1174 def _should_recompile(self,e):
1175 """Utility routine for edit_syntax_error"""
1175 """Utility routine for edit_syntax_error"""
1176
1176
1177 if e.filename in ('<ipython console>','<input>','<string>',
1177 if e.filename in ('<ipython console>','<input>','<string>',
1178 '<console>'):
1178 '<console>'):
1179 return False
1179 return False
1180 try:
1180 try:
1181 if not ask_yes_no('Return to editor to correct syntax error? '
1181 if not ask_yes_no('Return to editor to correct syntax error? '
1182 '[Y/n] ','y'):
1182 '[Y/n] ','y'):
1183 return False
1183 return False
1184 except EOFError:
1184 except EOFError:
1185 return False
1185 return False
1186 self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg)
1186 self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg)
1187 return True
1187 return True
1188
1188
1189 def edit_syntax_error(self):
1189 def edit_syntax_error(self):
1190 """The bottom half of the syntax error handler called in the main loop.
1190 """The bottom half of the syntax error handler called in the main loop.
1191
1191
1192 Loop until syntax error is fixed or user cancels.
1192 Loop until syntax error is fixed or user cancels.
1193 """
1193 """
1194
1194
1195 while self.SyntaxTB.last_syntax_error:
1195 while self.SyntaxTB.last_syntax_error:
1196 # copy and clear last_syntax_error
1196 # copy and clear last_syntax_error
1197 err = self.SyntaxTB.clear_err_state()
1197 err = self.SyntaxTB.clear_err_state()
1198 if not self._should_recompile(err):
1198 if not self._should_recompile(err):
1199 return
1199 return
1200 try:
1200 try:
1201 # may set last_syntax_error again if a SyntaxError is raised
1201 # may set last_syntax_error again if a SyntaxError is raised
1202 self.safe_execfile(err.filename,self.shell.user_ns)
1202 self.safe_execfile(err.filename,self.shell.user_ns)
1203 except:
1203 except:
1204 self.showtraceback()
1204 self.showtraceback()
1205 else:
1205 else:
1206 f = file(err.filename)
1206 f = file(err.filename)
1207 try:
1207 try:
1208 sys.displayhook(f.read())
1208 sys.displayhook(f.read())
1209 finally:
1209 finally:
1210 f.close()
1210 f.close()
1211
1211
1212 def showsyntaxerror(self, filename=None):
1212 def showsyntaxerror(self, filename=None):
1213 """Display the syntax error that just occurred.
1213 """Display the syntax error that just occurred.
1214
1214
1215 This doesn't display a stack trace because there isn't one.
1215 This doesn't display a stack trace because there isn't one.
1216
1216
1217 If a filename is given, it is stuffed in the exception instead
1217 If a filename is given, it is stuffed in the exception instead
1218 of what was there before (because Python's parser always uses
1218 of what was there before (because Python's parser always uses
1219 "<string>" when reading from a string).
1219 "<string>" when reading from a string).
1220 """
1220 """
1221 etype, value, last_traceback = sys.exc_info()
1221 etype, value, last_traceback = sys.exc_info()
1222 if filename and etype is SyntaxError:
1222 if filename and etype is SyntaxError:
1223 # Work hard to stuff the correct filename in the exception
1223 # Work hard to stuff the correct filename in the exception
1224 try:
1224 try:
1225 msg, (dummy_filename, lineno, offset, line) = value
1225 msg, (dummy_filename, lineno, offset, line) = value
1226 except:
1226 except:
1227 # Not the format we expect; leave it alone
1227 # Not the format we expect; leave it alone
1228 pass
1228 pass
1229 else:
1229 else:
1230 # Stuff in the right filename
1230 # Stuff in the right filename
1231 try:
1231 try:
1232 # Assume SyntaxError is a class exception
1232 # Assume SyntaxError is a class exception
1233 value = SyntaxError(msg, (filename, lineno, offset, line))
1233 value = SyntaxError(msg, (filename, lineno, offset, line))
1234 except:
1234 except:
1235 # If that failed, assume SyntaxError is a string
1235 # If that failed, assume SyntaxError is a string
1236 value = msg, (filename, lineno, offset, line)
1236 value = msg, (filename, lineno, offset, line)
1237 self.SyntaxTB(etype,value,[])
1237 self.SyntaxTB(etype,value,[])
1238
1238
1239 def debugger(self):
1239 def debugger(self):
1240 """Call the pdb debugger."""
1240 """Call the pdb debugger."""
1241
1241
1242 if not self.rc.pdb:
1242 if not self.rc.pdb:
1243 return
1243 return
1244 pdb.pm()
1244 pdb.pm()
1245
1245
1246 def showtraceback(self,exc_tuple = None,filename=None):
1246 def showtraceback(self,exc_tuple = None,filename=None):
1247 """Display the exception that just occurred."""
1247 """Display the exception that just occurred."""
1248
1248
1249 # Though this won't be called by syntax errors in the input line,
1249 # Though this won't be called by syntax errors in the input line,
1250 # there may be SyntaxError cases whith imported code.
1250 # there may be SyntaxError cases whith imported code.
1251 if exc_tuple is None:
1251 if exc_tuple is None:
1252 type, value, tb = sys.exc_info()
1252 type, value, tb = sys.exc_info()
1253 else:
1253 else:
1254 type, value, tb = exc_tuple
1254 type, value, tb = exc_tuple
1255 if type is SyntaxError:
1255 if type is SyntaxError:
1256 self.showsyntaxerror(filename)
1256 self.showsyntaxerror(filename)
1257 else:
1257 else:
1258 self.InteractiveTB()
1258 self.InteractiveTB()
1259 if self.InteractiveTB.call_pdb and self.has_readline:
1259 if self.InteractiveTB.call_pdb and self.has_readline:
1260 # pdb mucks up readline, fix it back
1260 # pdb mucks up readline, fix it back
1261 self.readline.set_completer(self.Completer.complete)
1261 self.readline.set_completer(self.Completer.complete)
1262
1262
1263 def mainloop(self,banner=None):
1263 def mainloop(self,banner=None):
1264 """Creates the local namespace and starts the mainloop.
1264 """Creates the local namespace and starts the mainloop.
1265
1265
1266 If an optional banner argument is given, it will override the
1266 If an optional banner argument is given, it will override the
1267 internally created default banner."""
1267 internally created default banner."""
1268
1268
1269 if self.rc.c: # Emulate Python's -c option
1269 if self.rc.c: # Emulate Python's -c option
1270 self.exec_init_cmd()
1270 self.exec_init_cmd()
1271 if banner is None:
1271 if banner is None:
1272 if self.rc.banner:
1272 if self.rc.banner:
1273 banner = self.BANNER+self.banner2
1273 banner = self.BANNER+self.banner2
1274 else:
1274 else:
1275 banner = ''
1275 banner = ''
1276 self.interact(banner)
1276 self.interact(banner)
1277
1277
1278 def exec_init_cmd(self):
1278 def exec_init_cmd(self):
1279 """Execute a command given at the command line.
1279 """Execute a command given at the command line.
1280
1280
1281 This emulates Python's -c option."""
1281 This emulates Python's -c option."""
1282
1282
1283 sys.argv = ['-c']
1283 sys.argv = ['-c']
1284 self.push(self.rc.c)
1284 self.push(self.rc.c)
1285
1285
1286 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1286 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1287 """Embeds IPython into a running python program.
1287 """Embeds IPython into a running python program.
1288
1288
1289 Input:
1289 Input:
1290
1290
1291 - header: An optional header message can be specified.
1291 - header: An optional header message can be specified.
1292
1292
1293 - local_ns, global_ns: working namespaces. If given as None, the
1293 - local_ns, global_ns: working namespaces. If given as None, the
1294 IPython-initialized one is updated with __main__.__dict__, so that
1294 IPython-initialized one is updated with __main__.__dict__, so that
1295 program variables become visible but user-specific configuration
1295 program variables become visible but user-specific configuration
1296 remains possible.
1296 remains possible.
1297
1297
1298 - stack_depth: specifies how many levels in the stack to go to
1298 - stack_depth: specifies how many levels in the stack to go to
1299 looking for namespaces (when local_ns and global_ns are None). This
1299 looking for namespaces (when local_ns and global_ns are None). This
1300 allows an intermediate caller to make sure that this function gets
1300 allows an intermediate caller to make sure that this function gets
1301 the namespace from the intended level in the stack. By default (0)
1301 the namespace from the intended level in the stack. By default (0)
1302 it will get its locals and globals from the immediate caller.
1302 it will get its locals and globals from the immediate caller.
1303
1303
1304 Warning: it's possible to use this in a program which is being run by
1304 Warning: it's possible to use this in a program which is being run by
1305 IPython itself (via %run), but some funny things will happen (a few
1305 IPython itself (via %run), but some funny things will happen (a few
1306 globals get overwritten). In the future this will be cleaned up, as
1306 globals get overwritten). In the future this will be cleaned up, as
1307 there is no fundamental reason why it can't work perfectly."""
1307 there is no fundamental reason why it can't work perfectly."""
1308
1308
1309 # Get locals and globals from caller
1309 # Get locals and globals from caller
1310 if local_ns is None or global_ns is None:
1310 if local_ns is None or global_ns is None:
1311 call_frame = sys._getframe(stack_depth).f_back
1311 call_frame = sys._getframe(stack_depth).f_back
1312
1312
1313 if local_ns is None:
1313 if local_ns is None:
1314 local_ns = call_frame.f_locals
1314 local_ns = call_frame.f_locals
1315 if global_ns is None:
1315 if global_ns is None:
1316 global_ns = call_frame.f_globals
1316 global_ns = call_frame.f_globals
1317
1317
1318 # Update namespaces and fire up interpreter
1318 # Update namespaces and fire up interpreter
1319
1319
1320 # The global one is easy, we can just throw it in
1320 # The global one is easy, we can just throw it in
1321 self.user_global_ns = global_ns
1321 self.user_global_ns = global_ns
1322
1322
1323 # but the user/local one is tricky: ipython needs it to store internal
1323 # but the user/local one is tricky: ipython needs it to store internal
1324 # data, but we also need the locals. We'll copy locals in the user
1324 # data, but we also need the locals. We'll copy locals in the user
1325 # one, but will track what got copied so we can delete them at exit.
1325 # one, but will track what got copied so we can delete them at exit.
1326 # This is so that a later embedded call doesn't see locals from a
1326 # This is so that a later embedded call doesn't see locals from a
1327 # previous call (which most likely existed in a separate scope).
1327 # previous call (which most likely existed in a separate scope).
1328 local_varnames = local_ns.keys()
1328 local_varnames = local_ns.keys()
1329 self.user_ns.update(local_ns)
1329 self.user_ns.update(local_ns)
1330
1330
1331 # Patch for global embedding to make sure that things don't overwrite
1331 # Patch for global embedding to make sure that things don't overwrite
1332 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1332 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1333 # FIXME. Test this a bit more carefully (the if.. is new)
1333 # FIXME. Test this a bit more carefully (the if.. is new)
1334 if local_ns is None and global_ns is None:
1334 if local_ns is None and global_ns is None:
1335 self.user_global_ns.update(__main__.__dict__)
1335 self.user_global_ns.update(__main__.__dict__)
1336
1336
1337 # make sure the tab-completer has the correct frame information, so it
1337 # make sure the tab-completer has the correct frame information, so it
1338 # actually completes using the frame's locals/globals
1338 # actually completes using the frame's locals/globals
1339 self.set_completer_frame(call_frame)
1339 self.set_completer_frame(call_frame)
1340
1340
1341 # before activating the interactive mode, we need to make sure that
1341 # before activating the interactive mode, we need to make sure that
1342 # all names in the builtin namespace needed by ipython point to
1342 # all names in the builtin namespace needed by ipython point to
1343 # ourselves, and not to other instances.
1343 # ourselves, and not to other instances.
1344 self.add_builtins()
1344 self.add_builtins()
1345
1345
1346 self.interact(header)
1346 self.interact(header)
1347
1347
1348 # now, purge out the user namespace from anything we might have added
1348 # now, purge out the user namespace from anything we might have added
1349 # from the caller's local namespace
1349 # from the caller's local namespace
1350 delvar = self.user_ns.pop
1350 delvar = self.user_ns.pop
1351 for var in local_varnames:
1351 for var in local_varnames:
1352 delvar(var,None)
1352 delvar(var,None)
1353 # and clean builtins we may have overridden
1353 # and clean builtins we may have overridden
1354 self.clean_builtins()
1354 self.clean_builtins()
1355
1355
1356 def interact(self, banner=None):
1356 def interact(self, banner=None):
1357 """Closely emulate the interactive Python console.
1357 """Closely emulate the interactive Python console.
1358
1358
1359 The optional banner argument specify the banner to print
1359 The optional banner argument specify the banner to print
1360 before the first interaction; by default it prints a banner
1360 before the first interaction; by default it prints a banner
1361 similar to the one printed by the real Python interpreter,
1361 similar to the one printed by the real Python interpreter,
1362 followed by the current class name in parentheses (so as not
1362 followed by the current class name in parentheses (so as not
1363 to confuse this with the real interpreter -- since it's so
1363 to confuse this with the real interpreter -- since it's so
1364 close!).
1364 close!).
1365
1365
1366 """
1366 """
1367 cprt = 'Type "copyright", "credits" or "license" for more information.'
1367 cprt = 'Type "copyright", "credits" or "license" for more information.'
1368 if banner is None:
1368 if banner is None:
1369 self.write("Python %s on %s\n%s\n(%s)\n" %
1369 self.write("Python %s on %s\n%s\n(%s)\n" %
1370 (sys.version, sys.platform, cprt,
1370 (sys.version, sys.platform, cprt,
1371 self.__class__.__name__))
1371 self.__class__.__name__))
1372 else:
1372 else:
1373 self.write(banner)
1373 self.write(banner)
1374
1374
1375 more = 0
1375 more = 0
1376
1376
1377 # Mark activity in the builtins
1377 # Mark activity in the builtins
1378 __builtin__.__dict__['__IPYTHON__active'] += 1
1378 __builtin__.__dict__['__IPYTHON__active'] += 1
1379
1379
1380 # exit_now is set by a call to %Exit or %Quit
1380 # exit_now is set by a call to %Exit or %Quit
1381 self.exit_now = False
1381 self.exit_now = False
1382 while not self.exit_now:
1382 while not self.exit_now:
1383
1383
1384 try:
1384 try:
1385 if more:
1385 if more:
1386 prompt = self.outputcache.prompt2
1386 prompt = self.outputcache.prompt2
1387 if self.autoindent:
1387 if self.autoindent:
1388 self.readline_startup_hook(self.pre_readline)
1388 self.readline_startup_hook(self.pre_readline)
1389 else:
1389 else:
1390 prompt = self.outputcache.prompt1
1390 prompt = self.outputcache.prompt1
1391 try:
1391 try:
1392 line = self.raw_input(prompt,more)
1392 line = self.raw_input(prompt,more)
1393 if self.autoindent:
1393 if self.autoindent:
1394 self.readline_startup_hook(None)
1394 self.readline_startup_hook(None)
1395 except EOFError:
1395 except EOFError:
1396 if self.autoindent:
1396 if self.autoindent:
1397 self.readline_startup_hook(None)
1397 self.readline_startup_hook(None)
1398 self.write("\n")
1398 self.write("\n")
1399 self.exit()
1399 self.exit()
1400 else:
1400 else:
1401 more = self.push(line)
1401 more = self.push(line)
1402
1402
1403 if (self.SyntaxTB.last_syntax_error and
1403 if (self.SyntaxTB.last_syntax_error and
1404 self.rc.autoedit_syntax):
1404 self.rc.autoedit_syntax):
1405 self.edit_syntax_error()
1405 self.edit_syntax_error()
1406
1406
1407 except KeyboardInterrupt:
1407 except KeyboardInterrupt:
1408 self.write("\nKeyboardInterrupt\n")
1408 self.write("\nKeyboardInterrupt\n")
1409 self.resetbuffer()
1409 self.resetbuffer()
1410 more = 0
1410 more = 0
1411 # keep cache in sync with the prompt counter:
1411 # keep cache in sync with the prompt counter:
1412 self.outputcache.prompt_count -= 1
1412 self.outputcache.prompt_count -= 1
1413
1413
1414 if self.autoindent:
1414 if self.autoindent:
1415 self.indent_current_nsp = 0
1415 self.indent_current_nsp = 0
1416 self.indent_current = ' '* self.indent_current_nsp
1416 self.indent_current = ' '* self.indent_current_nsp
1417
1417
1418 except bdb.BdbQuit:
1418 except bdb.BdbQuit:
1419 warn("The Python debugger has exited with a BdbQuit exception.\n"
1419 warn("The Python debugger has exited with a BdbQuit exception.\n"
1420 "Because of how pdb handles the stack, it is impossible\n"
1420 "Because of how pdb handles the stack, it is impossible\n"
1421 "for IPython to properly format this particular exception.\n"
1421 "for IPython to properly format this particular exception.\n"
1422 "IPython will resume normal operation.")
1422 "IPython will resume normal operation.")
1423
1423
1424 # We are off again...
1424 # We are off again...
1425 __builtin__.__dict__['__IPYTHON__active'] -= 1
1425 __builtin__.__dict__['__IPYTHON__active'] -= 1
1426
1426
1427 def excepthook(self, type, value, tb):
1427 def excepthook(self, type, value, tb):
1428 """One more defense for GUI apps that call sys.excepthook.
1428 """One more defense for GUI apps that call sys.excepthook.
1429
1429
1430 GUI frameworks like wxPython trap exceptions and call
1430 GUI frameworks like wxPython trap exceptions and call
1431 sys.excepthook themselves. I guess this is a feature that
1431 sys.excepthook themselves. I guess this is a feature that
1432 enables them to keep running after exceptions that would
1432 enables them to keep running after exceptions that would
1433 otherwise kill their mainloop. This is a bother for IPython
1433 otherwise kill their mainloop. This is a bother for IPython
1434 which excepts to catch all of the program exceptions with a try:
1434 which excepts to catch all of the program exceptions with a try:
1435 except: statement.
1435 except: statement.
1436
1436
1437 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1437 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1438 any app directly invokes sys.excepthook, it will look to the user like
1438 any app directly invokes sys.excepthook, it will look to the user like
1439 IPython crashed. In order to work around this, we can disable the
1439 IPython crashed. In order to work around this, we can disable the
1440 CrashHandler and replace it with this excepthook instead, which prints a
1440 CrashHandler and replace it with this excepthook instead, which prints a
1441 regular traceback using our InteractiveTB. In this fashion, apps which
1441 regular traceback using our InteractiveTB. In this fashion, apps which
1442 call sys.excepthook will generate a regular-looking exception from
1442 call sys.excepthook will generate a regular-looking exception from
1443 IPython, and the CrashHandler will only be triggered by real IPython
1443 IPython, and the CrashHandler will only be triggered by real IPython
1444 crashes.
1444 crashes.
1445
1445
1446 This hook should be used sparingly, only in places which are not likely
1446 This hook should be used sparingly, only in places which are not likely
1447 to be true IPython errors.
1447 to be true IPython errors.
1448 """
1448 """
1449
1449
1450 self.InteractiveTB(type, value, tb, tb_offset=0)
1450 self.InteractiveTB(type, value, tb, tb_offset=0)
1451 if self.InteractiveTB.call_pdb and self.has_readline:
1451 if self.InteractiveTB.call_pdb and self.has_readline:
1452 self.readline.set_completer(self.Completer.complete)
1452 self.readline.set_completer(self.Completer.complete)
1453
1453
1454 def call_alias(self,alias,rest=''):
1454 def call_alias(self,alias,rest=''):
1455 """Call an alias given its name and the rest of the line.
1455 """Call an alias given its name and the rest of the line.
1456
1456
1457 This function MUST be given a proper alias, because it doesn't make
1457 This function MUST be given a proper alias, because it doesn't make
1458 any checks when looking up into the alias table. The caller is
1458 any checks when looking up into the alias table. The caller is
1459 responsible for invoking it only with a valid alias."""
1459 responsible for invoking it only with a valid alias."""
1460
1460
1461 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1461 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1462 nargs,cmd = self.alias_table[alias]
1462 nargs,cmd = self.alias_table[alias]
1463 # Expand the %l special to be the user's input line
1463 # Expand the %l special to be the user's input line
1464 if cmd.find('%l') >= 0:
1464 if cmd.find('%l') >= 0:
1465 cmd = cmd.replace('%l',rest)
1465 cmd = cmd.replace('%l',rest)
1466 rest = ''
1466 rest = ''
1467 if nargs==0:
1467 if nargs==0:
1468 # Simple, argument-less aliases
1468 # Simple, argument-less aliases
1469 cmd = '%s %s' % (cmd,rest)
1469 cmd = '%s %s' % (cmd,rest)
1470 else:
1470 else:
1471 # Handle aliases with positional arguments
1471 # Handle aliases with positional arguments
1472 args = rest.split(None,nargs)
1472 args = rest.split(None,nargs)
1473 if len(args)< nargs:
1473 if len(args)< nargs:
1474 error('Alias <%s> requires %s arguments, %s given.' %
1474 error('Alias <%s> requires %s arguments, %s given.' %
1475 (alias,nargs,len(args)))
1475 (alias,nargs,len(args)))
1476 return
1476 return
1477 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1477 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1478 # Now call the macro, evaluating in the user's namespace
1478 # Now call the macro, evaluating in the user's namespace
1479 try:
1479 try:
1480 self.system(cmd)
1480 self.system(cmd)
1481 except:
1481 except:
1482 self.showtraceback()
1482 self.showtraceback()
1483
1483
1484 def autoindent_update(self,line):
1484 def autoindent_update(self,line):
1485 """Keep track of the indent level."""
1485 """Keep track of the indent level."""
1486 if self.autoindent:
1486 if self.autoindent:
1487 if line:
1487 if line:
1488 ini_spaces = ini_spaces_re.match(line)
1488 ini_spaces = ini_spaces_re.match(line)
1489 if ini_spaces:
1489 if ini_spaces:
1490 nspaces = ini_spaces.end()
1490 nspaces = ini_spaces.end()
1491 else:
1491 else:
1492 nspaces = 0
1492 nspaces = 0
1493 self.indent_current_nsp = nspaces
1493 self.indent_current_nsp = nspaces
1494
1494
1495 if line[-1] == ':':
1495 if line[-1] == ':':
1496 self.indent_current_nsp += 4
1496 self.indent_current_nsp += 4
1497 elif dedent_re.match(line):
1497 elif dedent_re.match(line):
1498 self.indent_current_nsp -= 4
1498 self.indent_current_nsp -= 4
1499 else:
1499 else:
1500 self.indent_current_nsp = 0
1500 self.indent_current_nsp = 0
1501
1501
1502 # indent_current is the actual string to be inserted
1502 # indent_current is the actual string to be inserted
1503 # by the readline hooks for indentation
1503 # by the readline hooks for indentation
1504 self.indent_current = ' '* self.indent_current_nsp
1504 self.indent_current = ' '* self.indent_current_nsp
1505
1505
1506 def runlines(self,lines):
1506 def runlines(self,lines):
1507 """Run a string of one or more lines of source.
1507 """Run a string of one or more lines of source.
1508
1508
1509 This method is capable of running a string containing multiple source
1509 This method is capable of running a string containing multiple source
1510 lines, as if they had been entered at the IPython prompt. Since it
1510 lines, as if they had been entered at the IPython prompt. Since it
1511 exposes IPython's processing machinery, the given strings can contain
1511 exposes IPython's processing machinery, the given strings can contain
1512 magic calls (%magic), special shell access (!cmd), etc."""
1512 magic calls (%magic), special shell access (!cmd), etc."""
1513
1513
1514 # We must start with a clean buffer, in case this is run from an
1514 # We must start with a clean buffer, in case this is run from an
1515 # interactive IPython session (via a magic, for example).
1515 # interactive IPython session (via a magic, for example).
1516 self.resetbuffer()
1516 self.resetbuffer()
1517 lines = lines.split('\n')
1517 lines = lines.split('\n')
1518 more = 0
1518 more = 0
1519 for line in lines:
1519 for line in lines:
1520 # skip blank lines so we don't mess up the prompt counter, but do
1520 # skip blank lines so we don't mess up the prompt counter, but do
1521 # NOT skip even a blank line if we are in a code block (more is
1521 # NOT skip even a blank line if we are in a code block (more is
1522 # true)
1522 # true)
1523 if line or more:
1523 if line or more:
1524 more = self.push(self.prefilter(line,more))
1524 more = self.push(self.prefilter(line,more))
1525 # IPython's runsource returns None if there was an error
1525 # IPython's runsource returns None if there was an error
1526 # compiling the code. This allows us to stop processing right
1526 # compiling the code. This allows us to stop processing right
1527 # away, so the user gets the error message at the right place.
1527 # away, so the user gets the error message at the right place.
1528 if more is None:
1528 if more is None:
1529 break
1529 break
1530 # final newline in case the input didn't have it, so that the code
1530 # final newline in case the input didn't have it, so that the code
1531 # actually does get executed
1531 # actually does get executed
1532 if more:
1532 if more:
1533 self.push('\n')
1533 self.push('\n')
1534
1534
1535 def runsource(self, source, filename='<input>', symbol='single'):
1535 def runsource(self, source, filename='<input>', symbol='single'):
1536 """Compile and run some source in the interpreter.
1536 """Compile and run some source in the interpreter.
1537
1537
1538 Arguments are as for compile_command().
1538 Arguments are as for compile_command().
1539
1539
1540 One several things can happen:
1540 One several things can happen:
1541
1541
1542 1) The input is incorrect; compile_command() raised an
1542 1) The input is incorrect; compile_command() raised an
1543 exception (SyntaxError or OverflowError). A syntax traceback
1543 exception (SyntaxError or OverflowError). A syntax traceback
1544 will be printed by calling the showsyntaxerror() method.
1544 will be printed by calling the showsyntaxerror() method.
1545
1545
1546 2) The input is incomplete, and more input is required;
1546 2) The input is incomplete, and more input is required;
1547 compile_command() returned None. Nothing happens.
1547 compile_command() returned None. Nothing happens.
1548
1548
1549 3) The input is complete; compile_command() returned a code
1549 3) The input is complete; compile_command() returned a code
1550 object. The code is executed by calling self.runcode() (which
1550 object. The code is executed by calling self.runcode() (which
1551 also handles run-time exceptions, except for SystemExit).
1551 also handles run-time exceptions, except for SystemExit).
1552
1552
1553 The return value is:
1553 The return value is:
1554
1554
1555 - True in case 2
1555 - True in case 2
1556
1556
1557 - False in the other cases, unless an exception is raised, where
1557 - False in the other cases, unless an exception is raised, where
1558 None is returned instead. This can be used by external callers to
1558 None is returned instead. This can be used by external callers to
1559 know whether to continue feeding input or not.
1559 know whether to continue feeding input or not.
1560
1560
1561 The return value can be used to decide whether to use sys.ps1 or
1561 The return value can be used to decide whether to use sys.ps1 or
1562 sys.ps2 to prompt the next line."""
1562 sys.ps2 to prompt the next line."""
1563
1563
1564 try:
1564 try:
1565 code = self.compile(source,filename,symbol)
1565 code = self.compile(source,filename,symbol)
1566 except (OverflowError, SyntaxError, ValueError):
1566 except (OverflowError, SyntaxError, ValueError):
1567 # Case 1
1567 # Case 1
1568 self.showsyntaxerror(filename)
1568 self.showsyntaxerror(filename)
1569 return None
1569 return None
1570
1570
1571 if code is None:
1571 if code is None:
1572 # Case 2
1572 # Case 2
1573 return True
1573 return True
1574
1574
1575 # Case 3
1575 # Case 3
1576 # We store the code object so that threaded shells and
1576 # We store the code object so that threaded shells and
1577 # custom exception handlers can access all this info if needed.
1577 # custom exception handlers can access all this info if needed.
1578 # The source corresponding to this can be obtained from the
1578 # The source corresponding to this can be obtained from the
1579 # buffer attribute as '\n'.join(self.buffer).
1579 # buffer attribute as '\n'.join(self.buffer).
1580 self.code_to_run = code
1580 self.code_to_run = code
1581 # now actually execute the code object
1581 # now actually execute the code object
1582 if self.runcode(code) == 0:
1582 if self.runcode(code) == 0:
1583 return False
1583 return False
1584 else:
1584 else:
1585 return None
1585 return None
1586
1586
1587 def runcode(self,code_obj):
1587 def runcode(self,code_obj):
1588 """Execute a code object.
1588 """Execute a code object.
1589
1589
1590 When an exception occurs, self.showtraceback() is called to display a
1590 When an exception occurs, self.showtraceback() is called to display a
1591 traceback.
1591 traceback.
1592
1592
1593 Return value: a flag indicating whether the code to be run completed
1593 Return value: a flag indicating whether the code to be run completed
1594 successfully:
1594 successfully:
1595
1595
1596 - 0: successful execution.
1596 - 0: successful execution.
1597 - 1: an error occurred.
1597 - 1: an error occurred.
1598 """
1598 """
1599
1599
1600 # Set our own excepthook in case the user code tries to call it
1600 # Set our own excepthook in case the user code tries to call it
1601 # directly, so that the IPython crash handler doesn't get triggered
1601 # directly, so that the IPython crash handler doesn't get triggered
1602 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1602 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1603
1603
1604 # we save the original sys.excepthook in the instance, in case config
1604 # we save the original sys.excepthook in the instance, in case config
1605 # code (such as magics) needs access to it.
1605 # code (such as magics) needs access to it.
1606 self.sys_excepthook = old_excepthook
1606 self.sys_excepthook = old_excepthook
1607 outflag = 1 # happens in more places, so it's easier as default
1607 outflag = 1 # happens in more places, so it's easier as default
1608 try:
1608 try:
1609 try:
1609 try:
1610 # Embedded instances require separate global/local namespaces
1610 # Embedded instances require separate global/local namespaces
1611 # so they can see both the surrounding (local) namespace and
1611 # so they can see both the surrounding (local) namespace and
1612 # the module-level globals when called inside another function.
1612 # the module-level globals when called inside another function.
1613 if self.embedded:
1613 if self.embedded:
1614 exec code_obj in self.user_global_ns, self.user_ns
1614 exec code_obj in self.user_global_ns, self.user_ns
1615 # Normal (non-embedded) instances should only have a single
1615 # Normal (non-embedded) instances should only have a single
1616 # namespace for user code execution, otherwise functions won't
1616 # namespace for user code execution, otherwise functions won't
1617 # see interactive top-level globals.
1617 # see interactive top-level globals.
1618 else:
1618 else:
1619 exec code_obj in self.user_ns
1619 exec code_obj in self.user_ns
1620 finally:
1620 finally:
1621 # Reset our crash handler in place
1621 # Reset our crash handler in place
1622 sys.excepthook = old_excepthook
1622 sys.excepthook = old_excepthook
1623 except SystemExit:
1623 except SystemExit:
1624 self.resetbuffer()
1624 self.resetbuffer()
1625 self.showtraceback()
1625 self.showtraceback()
1626 warn("Type exit or quit to exit IPython "
1626 warn("Type exit or quit to exit IPython "
1627 "(%Exit or %Quit do so unconditionally).",level=1)
1627 "(%Exit or %Quit do so unconditionally).",level=1)
1628 except self.custom_exceptions:
1628 except self.custom_exceptions:
1629 etype,value,tb = sys.exc_info()
1629 etype,value,tb = sys.exc_info()
1630 self.CustomTB(etype,value,tb)
1630 self.CustomTB(etype,value,tb)
1631 except:
1631 except:
1632 self.showtraceback()
1632 self.showtraceback()
1633 else:
1633 else:
1634 outflag = 0
1634 outflag = 0
1635 if softspace(sys.stdout, 0):
1635 if softspace(sys.stdout, 0):
1636 print
1636 print
1637 # Flush out code object which has been run (and source)
1637 # Flush out code object which has been run (and source)
1638 self.code_to_run = None
1638 self.code_to_run = None
1639 return outflag
1639 return outflag
1640
1640
1641 def push(self, line):
1641 def push(self, line):
1642 """Push a line to the interpreter.
1642 """Push a line to the interpreter.
1643
1643
1644 The line should not have a trailing newline; it may have
1644 The line should not have a trailing newline; it may have
1645 internal newlines. The line is appended to a buffer and the
1645 internal newlines. The line is appended to a buffer and the
1646 interpreter's runsource() method is called with the
1646 interpreter's runsource() method is called with the
1647 concatenated contents of the buffer as source. If this
1647 concatenated contents of the buffer as source. If this
1648 indicates that the command was executed or invalid, the buffer
1648 indicates that the command was executed or invalid, the buffer
1649 is reset; otherwise, the command is incomplete, and the buffer
1649 is reset; otherwise, the command is incomplete, and the buffer
1650 is left as it was after the line was appended. The return
1650 is left as it was after the line was appended. The return
1651 value is 1 if more input is required, 0 if the line was dealt
1651 value is 1 if more input is required, 0 if the line was dealt
1652 with in some way (this is the same as runsource()).
1652 with in some way (this is the same as runsource()).
1653 """
1653 """
1654
1654
1655 # autoindent management should be done here, and not in the
1655 # autoindent management should be done here, and not in the
1656 # interactive loop, since that one is only seen by keyboard input. We
1656 # interactive loop, since that one is only seen by keyboard input. We
1657 # need this done correctly even for code run via runlines (which uses
1657 # need this done correctly even for code run via runlines (which uses
1658 # push).
1658 # push).
1659
1659
1660 #print 'push line: <%s>' % line # dbg
1660 #print 'push line: <%s>' % line # dbg
1661 self.autoindent_update(line)
1661 self.autoindent_update(line)
1662
1662
1663 self.buffer.append(line)
1663 self.buffer.append(line)
1664 more = self.runsource('\n'.join(self.buffer), self.filename)
1664 more = self.runsource('\n'.join(self.buffer), self.filename)
1665 if not more:
1665 if not more:
1666 self.resetbuffer()
1666 self.resetbuffer()
1667 return more
1667 return more
1668
1668
1669 def resetbuffer(self):
1669 def resetbuffer(self):
1670 """Reset the input buffer."""
1670 """Reset the input buffer."""
1671 self.buffer[:] = []
1671 self.buffer[:] = []
1672
1672
1673 def raw_input(self,prompt='',continue_prompt=False):
1673 def raw_input(self,prompt='',continue_prompt=False):
1674 """Write a prompt and read a line.
1674 """Write a prompt and read a line.
1675
1675
1676 The returned line does not include the trailing newline.
1676 The returned line does not include the trailing newline.
1677 When the user enters the EOF key sequence, EOFError is raised.
1677 When the user enters the EOF key sequence, EOFError is raised.
1678
1678
1679 Optional inputs:
1679 Optional inputs:
1680
1680
1681 - prompt(''): a string to be printed to prompt the user.
1681 - prompt(''): a string to be printed to prompt the user.
1682
1682
1683 - continue_prompt(False): whether this line is the first one or a
1683 - continue_prompt(False): whether this line is the first one or a
1684 continuation in a sequence of inputs.
1684 continuation in a sequence of inputs.
1685 """
1685 """
1686
1686
1687 line = raw_input_original(prompt)
1687 line = raw_input_original(prompt)
1688 # Try to be reasonably smart about not re-indenting pasted input more
1688 # Try to be reasonably smart about not re-indenting pasted input more
1689 # than necessary. We do this by trimming out the auto-indent initial
1689 # than necessary. We do this by trimming out the auto-indent initial
1690 # spaces, if the user's actual input started itself with whitespace.
1690 # spaces, if the user's actual input started itself with whitespace.
1691 if self.autoindent:
1691 if self.autoindent:
1692 line2 = line[self.indent_current_nsp:]
1692 line2 = line[self.indent_current_nsp:]
1693 if line2[0:1] in (' ','\t'):
1693 if line2[0:1] in (' ','\t'):
1694 line = line2
1694 line = line2
1695 return self.prefilter(line,continue_prompt)
1695 return self.prefilter(line,continue_prompt)
1696
1696
1697 def split_user_input(self,line):
1697 def split_user_input(self,line):
1698 """Split user input into pre-char, function part and rest."""
1698 """Split user input into pre-char, function part and rest."""
1699
1699
1700 lsplit = self.line_split.match(line)
1700 lsplit = self.line_split.match(line)
1701 if lsplit is None: # no regexp match returns None
1701 if lsplit is None: # no regexp match returns None
1702 try:
1702 try:
1703 iFun,theRest = line.split(None,1)
1703 iFun,theRest = line.split(None,1)
1704 except ValueError:
1704 except ValueError:
1705 iFun,theRest = line,''
1705 iFun,theRest = line,''
1706 pre = re.match('^(\s*)(.*)',line).groups()[0]
1706 pre = re.match('^(\s*)(.*)',line).groups()[0]
1707 else:
1707 else:
1708 pre,iFun,theRest = lsplit.groups()
1708 pre,iFun,theRest = lsplit.groups()
1709
1709
1710 #print 'line:<%s>' % line # dbg
1710 #print 'line:<%s>' % line # dbg
1711 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1711 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1712 return pre,iFun.strip(),theRest
1712 return pre,iFun.strip(),theRest
1713
1713
1714 def _prefilter(self, line, continue_prompt):
1714 def _prefilter(self, line, continue_prompt):
1715 """Calls different preprocessors, depending on the form of line."""
1715 """Calls different preprocessors, depending on the form of line."""
1716
1716
1717 # All handlers *must* return a value, even if it's blank ('').
1717 # All handlers *must* return a value, even if it's blank ('').
1718
1718
1719 # Lines are NOT logged here. Handlers should process the line as
1719 # Lines are NOT logged here. Handlers should process the line as
1720 # needed, update the cache AND log it (so that the input cache array
1720 # needed, update the cache AND log it (so that the input cache array
1721 # stays synced).
1721 # stays synced).
1722
1722
1723 # This function is _very_ delicate, and since it's also the one which
1723 # This function is _very_ delicate, and since it's also the one which
1724 # determines IPython's response to user input, it must be as efficient
1724 # determines IPython's response to user input, it must be as efficient
1725 # as possible. For this reason it has _many_ returns in it, trying
1725 # as possible. For this reason it has _many_ returns in it, trying
1726 # always to exit as quickly as it can figure out what it needs to do.
1726 # always to exit as quickly as it can figure out what it needs to do.
1727
1727
1728 # This function is the main responsible for maintaining IPython's
1728 # This function is the main responsible for maintaining IPython's
1729 # behavior respectful of Python's semantics. So be _very_ careful if
1729 # behavior respectful of Python's semantics. So be _very_ careful if
1730 # making changes to anything here.
1730 # making changes to anything here.
1731
1731
1732 #.....................................................................
1732 #.....................................................................
1733 # Code begins
1733 # Code begins
1734
1734
1735 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1735 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1736
1736
1737 # save the line away in case we crash, so the post-mortem handler can
1737 # save the line away in case we crash, so the post-mortem handler can
1738 # record it
1738 # record it
1739 self._last_input_line = line
1739 self._last_input_line = line
1740
1740
1741 #print '***line: <%s>' % line # dbg
1741 #print '***line: <%s>' % line # dbg
1742
1742
1743 # the input history needs to track even empty lines
1743 # the input history needs to track even empty lines
1744 if not line.strip():
1744 if not line.strip():
1745 if not continue_prompt:
1745 if not continue_prompt:
1746 self.outputcache.prompt_count -= 1
1746 self.outputcache.prompt_count -= 1
1747 return self.handle_normal(line,continue_prompt)
1747 return self.handle_normal(line,continue_prompt)
1748 #return self.handle_normal('',continue_prompt)
1748 #return self.handle_normal('',continue_prompt)
1749
1749
1750 # print '***cont',continue_prompt # dbg
1750 # print '***cont',continue_prompt # dbg
1751 # special handlers are only allowed for single line statements
1751 # special handlers are only allowed for single line statements
1752 if continue_prompt and not self.rc.multi_line_specials:
1752 if continue_prompt and not self.rc.multi_line_specials:
1753 return self.handle_normal(line,continue_prompt)
1753 return self.handle_normal(line,continue_prompt)
1754
1754
1755 # For the rest, we need the structure of the input
1755 # For the rest, we need the structure of the input
1756 pre,iFun,theRest = self.split_user_input(line)
1756 pre,iFun,theRest = self.split_user_input(line)
1757 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1757 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1758
1758
1759 # First check for explicit escapes in the last/first character
1759 # First check for explicit escapes in the last/first character
1760 handler = None
1760 handler = None
1761 if line[-1] == self.ESC_HELP:
1761 if line[-1] == self.ESC_HELP:
1762 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1762 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1763 if handler is None:
1763 if handler is None:
1764 # look at the first character of iFun, NOT of line, so we skip
1764 # look at the first character of iFun, NOT of line, so we skip
1765 # leading whitespace in multiline input
1765 # leading whitespace in multiline input
1766 handler = self.esc_handlers.get(iFun[0:1])
1766 handler = self.esc_handlers.get(iFun[0:1])
1767 if handler is not None:
1767 if handler is not None:
1768 return handler(line,continue_prompt,pre,iFun,theRest)
1768 return handler(line,continue_prompt,pre,iFun,theRest)
1769 # Emacs ipython-mode tags certain input lines
1769 # Emacs ipython-mode tags certain input lines
1770 if line.endswith('# PYTHON-MODE'):
1770 if line.endswith('# PYTHON-MODE'):
1771 return self.handle_emacs(line,continue_prompt)
1771 return self.handle_emacs(line,continue_prompt)
1772
1772
1773 # Next, check if we can automatically execute this thing
1773 # Next, check if we can automatically execute this thing
1774
1774
1775 # Allow ! in multi-line statements if multi_line_specials is on:
1775 # Allow ! in multi-line statements if multi_line_specials is on:
1776 if continue_prompt and self.rc.multi_line_specials and \
1776 if continue_prompt and self.rc.multi_line_specials and \
1777 iFun.startswith(self.ESC_SHELL):
1777 iFun.startswith(self.ESC_SHELL):
1778 return self.handle_shell_escape(line,continue_prompt,
1778 return self.handle_shell_escape(line,continue_prompt,
1779 pre=pre,iFun=iFun,
1779 pre=pre,iFun=iFun,
1780 theRest=theRest)
1780 theRest=theRest)
1781
1781
1782 # Let's try to find if the input line is a magic fn
1782 # Let's try to find if the input line is a magic fn
1783 oinfo = None
1783 oinfo = None
1784 if hasattr(self,'magic_'+iFun):
1784 if hasattr(self,'magic_'+iFun):
1785 # WARNING: _ofind uses getattr(), so it can consume generators and
1785 # WARNING: _ofind uses getattr(), so it can consume generators and
1786 # cause other side effects.
1786 # cause other side effects.
1787 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1787 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1788 if oinfo['ismagic']:
1788 if oinfo['ismagic']:
1789 # Be careful not to call magics when a variable assignment is
1789 # Be careful not to call magics when a variable assignment is
1790 # being made (ls='hi', for example)
1790 # being made (ls='hi', for example)
1791 if self.rc.automagic and \
1791 if self.rc.automagic and \
1792 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1792 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1793 (self.rc.multi_line_specials or not continue_prompt):
1793 (self.rc.multi_line_specials or not continue_prompt):
1794 return self.handle_magic(line,continue_prompt,
1794 return self.handle_magic(line,continue_prompt,
1795 pre,iFun,theRest)
1795 pre,iFun,theRest)
1796 else:
1796 else:
1797 return self.handle_normal(line,continue_prompt)
1797 return self.handle_normal(line,continue_prompt)
1798
1798
1799 # If the rest of the line begins with an (in)equality, assginment or
1799 # If the rest of the line begins with an (in)equality, assginment or
1800 # function call, we should not call _ofind but simply execute it.
1800 # function call, we should not call _ofind but simply execute it.
1801 # This avoids spurious geattr() accesses on objects upon assignment.
1801 # This avoids spurious geattr() accesses on objects upon assignment.
1802 #
1802 #
1803 # It also allows users to assign to either alias or magic names true
1803 # It also allows users to assign to either alias or magic names true
1804 # python variables (the magic/alias systems always take second seat to
1804 # python variables (the magic/alias systems always take second seat to
1805 # true python code).
1805 # true python code).
1806 if theRest and theRest[0] in '!=()':
1806 if theRest and theRest[0] in '!=()':
1807 return self.handle_normal(line,continue_prompt)
1807 return self.handle_normal(line,continue_prompt)
1808
1808
1809 if oinfo is None:
1809 if oinfo is None:
1810 # let's try to ensure that _oinfo is ONLY called when autocall is
1810 # let's try to ensure that _oinfo is ONLY called when autocall is
1811 # on. Since it has inevitable potential side effects, at least
1811 # on. Since it has inevitable potential side effects, at least
1812 # having autocall off should be a guarantee to the user that no
1812 # having autocall off should be a guarantee to the user that no
1813 # weird things will happen.
1813 # weird things will happen.
1814
1814
1815 if self.rc.autocall:
1815 if self.rc.autocall:
1816 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1816 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1817 else:
1817 else:
1818 # in this case, all that's left is either an alias or
1818 # in this case, all that's left is either an alias or
1819 # processing the line normally.
1819 # processing the line normally.
1820 if iFun in self.alias_table:
1820 if iFun in self.alias_table:
1821 return self.handle_alias(line,continue_prompt,
1821 return self.handle_alias(line,continue_prompt,
1822 pre,iFun,theRest)
1822 pre,iFun,theRest)
1823 else:
1823 else:
1824 return self.handle_normal(line,continue_prompt)
1824 return self.handle_normal(line,continue_prompt)
1825
1825
1826 if not oinfo['found']:
1826 if not oinfo['found']:
1827 return self.handle_normal(line,continue_prompt)
1827 return self.handle_normal(line,continue_prompt)
1828 else:
1828 else:
1829 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1829 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1830 if oinfo['isalias']:
1830 if oinfo['isalias']:
1831 return self.handle_alias(line,continue_prompt,
1831 return self.handle_alias(line,continue_prompt,
1832 pre,iFun,theRest)
1832 pre,iFun,theRest)
1833
1833
1834 if self.rc.autocall and \
1834 if self.rc.autocall and \
1835 not self.re_exclude_auto.match(theRest) and \
1835 not self.re_exclude_auto.match(theRest) and \
1836 self.re_fun_name.match(iFun) and \
1836 self.re_fun_name.match(iFun) and \
1837 callable(oinfo['obj']) :
1837 callable(oinfo['obj']) :
1838 #print 'going auto' # dbg
1838 #print 'going auto' # dbg
1839 return self.handle_auto(line,continue_prompt,
1839 return self.handle_auto(line,continue_prompt,
1840 pre,iFun,theRest,oinfo['obj'])
1840 pre,iFun,theRest,oinfo['obj'])
1841 else:
1841 else:
1842 #print 'was callable?', callable(oinfo['obj']) # dbg
1842 #print 'was callable?', callable(oinfo['obj']) # dbg
1843 return self.handle_normal(line,continue_prompt)
1843 return self.handle_normal(line,continue_prompt)
1844
1844
1845 # If we get here, we have a normal Python line. Log and return.
1845 # If we get here, we have a normal Python line. Log and return.
1846 return self.handle_normal(line,continue_prompt)
1846 return self.handle_normal(line,continue_prompt)
1847
1847
1848 def _prefilter_dumb(self, line, continue_prompt):
1848 def _prefilter_dumb(self, line, continue_prompt):
1849 """simple prefilter function, for debugging"""
1849 """simple prefilter function, for debugging"""
1850 return self.handle_normal(line,continue_prompt)
1850 return self.handle_normal(line,continue_prompt)
1851
1851
1852 # Set the default prefilter() function (this can be user-overridden)
1852 # Set the default prefilter() function (this can be user-overridden)
1853 prefilter = _prefilter
1853 prefilter = _prefilter
1854
1854
1855 def handle_normal(self,line,continue_prompt=None,
1855 def handle_normal(self,line,continue_prompt=None,
1856 pre=None,iFun=None,theRest=None):
1856 pre=None,iFun=None,theRest=None):
1857 """Handle normal input lines. Use as a template for handlers."""
1857 """Handle normal input lines. Use as a template for handlers."""
1858
1858
1859 # With autoindent on, we need some way to exit the input loop, and I
1859 # With autoindent on, we need some way to exit the input loop, and I
1860 # don't want to force the user to have to backspace all the way to
1860 # don't want to force the user to have to backspace all the way to
1861 # clear the line. The rule will be in this case, that either two
1861 # clear the line. The rule will be in this case, that either two
1862 # lines of pure whitespace in a row, or a line of pure whitespace but
1862 # lines of pure whitespace in a row, or a line of pure whitespace but
1863 # of a size different to the indent level, will exit the input loop.
1863 # of a size different to the indent level, will exit the input loop.
1864
1864
1865 if (continue_prompt and self.autoindent and isspace(line) and
1865 if (continue_prompt and self.autoindent and isspace(line) and
1866 (line != self.indent_current or isspace(self.buffer[-1]))):
1866 (line != self.indent_current or isspace(self.buffer[-1]))):
1867 line = ''
1867 line = ''
1868
1868
1869 self.log(line,continue_prompt)
1869 self.log(line,continue_prompt)
1870 return line
1870 return line
1871
1871
1872 def handle_alias(self,line,continue_prompt=None,
1872 def handle_alias(self,line,continue_prompt=None,
1873 pre=None,iFun=None,theRest=None):
1873 pre=None,iFun=None,theRest=None):
1874 """Handle alias input lines. """
1874 """Handle alias input lines. """
1875
1875
1876 # pre is needed, because it carries the leading whitespace. Otherwise
1876 # pre is needed, because it carries the leading whitespace. Otherwise
1877 # aliases won't work in indented sections.
1877 # aliases won't work in indented sections.
1878 line_out = '%sipalias("%s %s")' % (pre,iFun,esc_quotes(theRest))
1878 line_out = '%sipalias("%s %s")' % (pre,iFun,esc_quotes(theRest))
1879 self.log(line_out,continue_prompt)
1879 self.log(line_out,continue_prompt)
1880 return line_out
1880 return line_out
1881
1881
1882 def handle_shell_escape(self, line, continue_prompt=None,
1882 def handle_shell_escape(self, line, continue_prompt=None,
1883 pre=None,iFun=None,theRest=None):
1883 pre=None,iFun=None,theRest=None):
1884 """Execute the line in a shell, empty return value"""
1884 """Execute the line in a shell, empty return value"""
1885
1885
1886 #print 'line in :', `line` # dbg
1886 #print 'line in :', `line` # dbg
1887 # Example of a special handler. Others follow a similar pattern.
1887 # Example of a special handler. Others follow a similar pattern.
1888 if continue_prompt: # multi-line statements
1888 if continue_prompt: # multi-line statements
1889 if iFun.startswith('!!'):
1889 if iFun.startswith('!!'):
1890 print 'SyntaxError: !! is not allowed in multiline statements'
1890 print 'SyntaxError: !! is not allowed in multiline statements'
1891 return pre
1891 return pre
1892 else:
1892 else:
1893 cmd = ("%s %s" % (iFun[1:],theRest))
1893 cmd = ("%s %s" % (iFun[1:],theRest))
1894 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd + "_")
1894 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd + "_")
1895 else: # single-line input
1895 else: # single-line input
1896 if line.startswith('!!'):
1896 if line.startswith('!!'):
1897 # rewrite iFun/theRest to properly hold the call to %sx and
1897 # rewrite iFun/theRest to properly hold the call to %sx and
1898 # the actual command to be executed, so handle_magic can work
1898 # the actual command to be executed, so handle_magic can work
1899 # correctly
1899 # correctly
1900 theRest = '%s %s' % (iFun[2:],theRest)
1900 theRest = '%s %s' % (iFun[2:],theRest)
1901 iFun = 'sx'
1901 iFun = 'sx'
1902 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1902 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1903 continue_prompt,pre,iFun,theRest)
1903 continue_prompt,pre,iFun,theRest)
1904 else:
1904 else:
1905 cmd=line[1:]
1905 cmd=line[1:]
1906 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd +"_")
1906 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd +"_")
1907 # update cache/log and return
1907 # update cache/log and return
1908 self.log(line_out,continue_prompt)
1908 self.log(line_out,continue_prompt)
1909 return line_out
1909 return line_out
1910
1910
1911 def handle_magic(self, line, continue_prompt=None,
1911 def handle_magic(self, line, continue_prompt=None,
1912 pre=None,iFun=None,theRest=None):
1912 pre=None,iFun=None,theRest=None):
1913 """Execute magic functions.
1913 """Execute magic functions.
1914
1914
1915 Also log them with a prepended # so the log is clean Python."""
1915 Also log them with a prepended # so the log is clean Python."""
1916
1916
1917 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1917 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1918 self.log(cmd,continue_prompt)
1918 self.log(cmd,continue_prompt)
1919 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1919 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1920 return cmd
1920 return cmd
1921
1921
1922 def handle_auto(self, line, continue_prompt=None,
1922 def handle_auto(self, line, continue_prompt=None,
1923 pre=None,iFun=None,theRest=None,obj=None):
1923 pre=None,iFun=None,theRest=None,obj=None):
1924 """Hande lines which can be auto-executed, quoting if requested."""
1924 """Hande lines which can be auto-executed, quoting if requested."""
1925
1925
1926 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1926 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1927
1927
1928 # This should only be active for single-line input!
1928 # This should only be active for single-line input!
1929 if continue_prompt:
1929 if continue_prompt:
1930 self.log(line,continue_prompt)
1930 self.log(line,continue_prompt)
1931 return line
1931 return line
1932
1932
1933 auto_rewrite = True
1933 auto_rewrite = True
1934 if pre == self.ESC_QUOTE:
1934 if pre == self.ESC_QUOTE:
1935 # Auto-quote splitting on whitespace
1935 # Auto-quote splitting on whitespace
1936 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1936 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1937 elif pre == self.ESC_QUOTE2:
1937 elif pre == self.ESC_QUOTE2:
1938 # Auto-quote whole string
1938 # Auto-quote whole string
1939 newcmd = '%s("%s")' % (iFun,theRest)
1939 newcmd = '%s("%s")' % (iFun,theRest)
1940 else:
1940 else:
1941 # Auto-paren.
1941 # Auto-paren.
1942 # We only apply it to argument-less calls if the autocall
1942 # We only apply it to argument-less calls if the autocall
1943 # parameter is set to 2. We only need to check that autocall is <
1943 # parameter is set to 2. We only need to check that autocall is <
1944 # 2, since this function isn't called unless it's at least 1.
1944 # 2, since this function isn't called unless it's at least 1.
1945 if not theRest and self.rc.autocall < 2:
1945 if not theRest and (self.rc.autocall < 2):
1946 newcmd = '%s %s' % (iFun,theRest)
1946 newcmd = '%s %s' % (iFun,theRest)
1947 auto_rewrite = False
1947 auto_rewrite = False
1948 else:
1948 else:
1949 if theRest.startswith('['):
1949 if theRest.startswith('['):
1950 if hasattr(obj,'__getitem__'):
1950 if hasattr(obj,'__getitem__'):
1951 # Don't autocall in this case: item access for an object
1951 # Don't autocall in this case: item access for an object
1952 # which is BOTH callable and implements __getitem__.
1952 # which is BOTH callable and implements __getitem__.
1953 newcmd = '%s %s' % (iFun,theRest)
1953 newcmd = '%s %s' % (iFun,theRest)
1954 auto_rewrite = False
1954 auto_rewrite = False
1955 else:
1955 else:
1956 # if the object doesn't support [] access, go ahead and
1956 # if the object doesn't support [] access, go ahead and
1957 # autocall
1957 # autocall
1958 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1958 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1959 elif theRest.endswith(';'):
1959 elif theRest.endswith(';'):
1960 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1960 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1961 else:
1961 else:
1962 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1962 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1963
1963
1964 if auto_rewrite:
1964 if auto_rewrite:
1965 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1965 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1966 # log what is now valid Python, not the actual user input (without the
1966 # log what is now valid Python, not the actual user input (without the
1967 # final newline)
1967 # final newline)
1968 self.log(newcmd,continue_prompt)
1968 self.log(newcmd,continue_prompt)
1969 return newcmd
1969 return newcmd
1970
1970
1971 def handle_help(self, line, continue_prompt=None,
1971 def handle_help(self, line, continue_prompt=None,
1972 pre=None,iFun=None,theRest=None):
1972 pre=None,iFun=None,theRest=None):
1973 """Try to get some help for the object.
1973 """Try to get some help for the object.
1974
1974
1975 obj? or ?obj -> basic information.
1975 obj? or ?obj -> basic information.
1976 obj?? or ??obj -> more details.
1976 obj?? or ??obj -> more details.
1977 """
1977 """
1978
1978
1979 # We need to make sure that we don't process lines which would be
1979 # We need to make sure that we don't process lines which would be
1980 # otherwise valid python, such as "x=1 # what?"
1980 # otherwise valid python, such as "x=1 # what?"
1981 try:
1981 try:
1982 codeop.compile_command(line)
1982 codeop.compile_command(line)
1983 except SyntaxError:
1983 except SyntaxError:
1984 # We should only handle as help stuff which is NOT valid syntax
1984 # We should only handle as help stuff which is NOT valid syntax
1985 if line[0]==self.ESC_HELP:
1985 if line[0]==self.ESC_HELP:
1986 line = line[1:]
1986 line = line[1:]
1987 elif line[-1]==self.ESC_HELP:
1987 elif line[-1]==self.ESC_HELP:
1988 line = line[:-1]
1988 line = line[:-1]
1989 self.log('#?'+line)
1989 self.log('#?'+line)
1990 if line:
1990 if line:
1991 self.magic_pinfo(line)
1991 self.magic_pinfo(line)
1992 else:
1992 else:
1993 page(self.usage,screen_lines=self.rc.screen_length)
1993 page(self.usage,screen_lines=self.rc.screen_length)
1994 return '' # Empty string is needed here!
1994 return '' # Empty string is needed here!
1995 except:
1995 except:
1996 # Pass any other exceptions through to the normal handler
1996 # Pass any other exceptions through to the normal handler
1997 return self.handle_normal(line,continue_prompt)
1997 return self.handle_normal(line,continue_prompt)
1998 else:
1998 else:
1999 # If the code compiles ok, we should handle it normally
1999 # If the code compiles ok, we should handle it normally
2000 return self.handle_normal(line,continue_prompt)
2000 return self.handle_normal(line,continue_prompt)
2001
2001
2002 def handle_emacs(self,line,continue_prompt=None,
2002 def handle_emacs(self,line,continue_prompt=None,
2003 pre=None,iFun=None,theRest=None):
2003 pre=None,iFun=None,theRest=None):
2004 """Handle input lines marked by python-mode."""
2004 """Handle input lines marked by python-mode."""
2005
2005
2006 # Currently, nothing is done. Later more functionality can be added
2006 # Currently, nothing is done. Later more functionality can be added
2007 # here if needed.
2007 # here if needed.
2008
2008
2009 # The input cache shouldn't be updated
2009 # The input cache shouldn't be updated
2010
2010
2011 return line
2011 return line
2012
2012
2013 def mktempfile(self,data=None):
2013 def mktempfile(self,data=None):
2014 """Make a new tempfile and return its filename.
2014 """Make a new tempfile and return its filename.
2015
2015
2016 This makes a call to tempfile.mktemp, but it registers the created
2016 This makes a call to tempfile.mktemp, but it registers the created
2017 filename internally so ipython cleans it up at exit time.
2017 filename internally so ipython cleans it up at exit time.
2018
2018
2019 Optional inputs:
2019 Optional inputs:
2020
2020
2021 - data(None): if data is given, it gets written out to the temp file
2021 - data(None): if data is given, it gets written out to the temp file
2022 immediately, and the file is closed again."""
2022 immediately, and the file is closed again."""
2023
2023
2024 filename = tempfile.mktemp('.py')
2024 filename = tempfile.mktemp('.py')
2025 self.tempfiles.append(filename)
2025 self.tempfiles.append(filename)
2026
2026
2027 if data:
2027 if data:
2028 tmp_file = open(filename,'w')
2028 tmp_file = open(filename,'w')
2029 tmp_file.write(data)
2029 tmp_file.write(data)
2030 tmp_file.close()
2030 tmp_file.close()
2031 return filename
2031 return filename
2032
2032
2033 def write(self,data):
2033 def write(self,data):
2034 """Write a string to the default output"""
2034 """Write a string to the default output"""
2035 Term.cout.write(data)
2035 Term.cout.write(data)
2036
2036
2037 def write_err(self,data):
2037 def write_err(self,data):
2038 """Write a string to the default error output"""
2038 """Write a string to the default error output"""
2039 Term.cerr.write(data)
2039 Term.cerr.write(data)
2040
2040
2041 def exit(self):
2041 def exit(self):
2042 """Handle interactive exit.
2042 """Handle interactive exit.
2043
2043
2044 This method sets the exit_now attribute."""
2044 This method sets the exit_now attribute."""
2045
2045
2046 if self.rc.confirm_exit:
2046 if self.rc.confirm_exit:
2047 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2047 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2048 self.exit_now = True
2048 self.exit_now = True
2049 else:
2049 else:
2050 self.exit_now = True
2050 self.exit_now = True
2051 return self.exit_now
2051 return self.exit_now
2052
2052
2053 def safe_execfile(self,fname,*where,**kw):
2053 def safe_execfile(self,fname,*where,**kw):
2054 fname = os.path.expanduser(fname)
2054 fname = os.path.expanduser(fname)
2055
2055
2056 # find things also in current directory
2056 # find things also in current directory
2057 dname = os.path.dirname(fname)
2057 dname = os.path.dirname(fname)
2058 if not sys.path.count(dname):
2058 if not sys.path.count(dname):
2059 sys.path.append(dname)
2059 sys.path.append(dname)
2060
2060
2061 try:
2061 try:
2062 xfile = open(fname)
2062 xfile = open(fname)
2063 except:
2063 except:
2064 print >> Term.cerr, \
2064 print >> Term.cerr, \
2065 'Could not open file <%s> for safe execution.' % fname
2065 'Could not open file <%s> for safe execution.' % fname
2066 return None
2066 return None
2067
2067
2068 kw.setdefault('islog',0)
2068 kw.setdefault('islog',0)
2069 kw.setdefault('quiet',1)
2069 kw.setdefault('quiet',1)
2070 kw.setdefault('exit_ignore',0)
2070 kw.setdefault('exit_ignore',0)
2071 first = xfile.readline()
2071 first = xfile.readline()
2072 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2072 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2073 xfile.close()
2073 xfile.close()
2074 # line by line execution
2074 # line by line execution
2075 if first.startswith(loghead) or kw['islog']:
2075 if first.startswith(loghead) or kw['islog']:
2076 print 'Loading log file <%s> one line at a time...' % fname
2076 print 'Loading log file <%s> one line at a time...' % fname
2077 if kw['quiet']:
2077 if kw['quiet']:
2078 stdout_save = sys.stdout
2078 stdout_save = sys.stdout
2079 sys.stdout = StringIO.StringIO()
2079 sys.stdout = StringIO.StringIO()
2080 try:
2080 try:
2081 globs,locs = where[0:2]
2081 globs,locs = where[0:2]
2082 except:
2082 except:
2083 try:
2083 try:
2084 globs = locs = where[0]
2084 globs = locs = where[0]
2085 except:
2085 except:
2086 globs = locs = globals()
2086 globs = locs = globals()
2087 badblocks = []
2087 badblocks = []
2088
2088
2089 # we also need to identify indented blocks of code when replaying
2089 # we also need to identify indented blocks of code when replaying
2090 # logs and put them together before passing them to an exec
2090 # logs and put them together before passing them to an exec
2091 # statement. This takes a bit of regexp and look-ahead work in the
2091 # statement. This takes a bit of regexp and look-ahead work in the
2092 # file. It's easiest if we swallow the whole thing in memory
2092 # file. It's easiest if we swallow the whole thing in memory
2093 # first, and manually walk through the lines list moving the
2093 # first, and manually walk through the lines list moving the
2094 # counter ourselves.
2094 # counter ourselves.
2095 indent_re = re.compile('\s+\S')
2095 indent_re = re.compile('\s+\S')
2096 xfile = open(fname)
2096 xfile = open(fname)
2097 filelines = xfile.readlines()
2097 filelines = xfile.readlines()
2098 xfile.close()
2098 xfile.close()
2099 nlines = len(filelines)
2099 nlines = len(filelines)
2100 lnum = 0
2100 lnum = 0
2101 while lnum < nlines:
2101 while lnum < nlines:
2102 line = filelines[lnum]
2102 line = filelines[lnum]
2103 lnum += 1
2103 lnum += 1
2104 # don't re-insert logger status info into cache
2104 # don't re-insert logger status info into cache
2105 if line.startswith('#log#'):
2105 if line.startswith('#log#'):
2106 continue
2106 continue
2107 else:
2107 else:
2108 # build a block of code (maybe a single line) for execution
2108 # build a block of code (maybe a single line) for execution
2109 block = line
2109 block = line
2110 try:
2110 try:
2111 next = filelines[lnum] # lnum has already incremented
2111 next = filelines[lnum] # lnum has already incremented
2112 except:
2112 except:
2113 next = None
2113 next = None
2114 while next and indent_re.match(next):
2114 while next and indent_re.match(next):
2115 block += next
2115 block += next
2116 lnum += 1
2116 lnum += 1
2117 try:
2117 try:
2118 next = filelines[lnum]
2118 next = filelines[lnum]
2119 except:
2119 except:
2120 next = None
2120 next = None
2121 # now execute the block of one or more lines
2121 # now execute the block of one or more lines
2122 try:
2122 try:
2123 exec block in globs,locs
2123 exec block in globs,locs
2124 except SystemExit:
2124 except SystemExit:
2125 pass
2125 pass
2126 except:
2126 except:
2127 badblocks.append(block.rstrip())
2127 badblocks.append(block.rstrip())
2128 if kw['quiet']: # restore stdout
2128 if kw['quiet']: # restore stdout
2129 sys.stdout.close()
2129 sys.stdout.close()
2130 sys.stdout = stdout_save
2130 sys.stdout = stdout_save
2131 print 'Finished replaying log file <%s>' % fname
2131 print 'Finished replaying log file <%s>' % fname
2132 if badblocks:
2132 if badblocks:
2133 print >> sys.stderr, ('\nThe following lines/blocks in file '
2133 print >> sys.stderr, ('\nThe following lines/blocks in file '
2134 '<%s> reported errors:' % fname)
2134 '<%s> reported errors:' % fname)
2135
2135
2136 for badline in badblocks:
2136 for badline in badblocks:
2137 print >> sys.stderr, badline
2137 print >> sys.stderr, badline
2138 else: # regular file execution
2138 else: # regular file execution
2139 try:
2139 try:
2140 execfile(fname,*where)
2140 execfile(fname,*where)
2141 except SyntaxError:
2141 except SyntaxError:
2142 etype,evalue = sys.exc_info()[:2]
2142 etype,evalue = sys.exc_info()[:2]
2143 self.SyntaxTB(etype,evalue,[])
2143 self.SyntaxTB(etype,evalue,[])
2144 warn('Failure executing file: <%s>' % fname)
2144 warn('Failure executing file: <%s>' % fname)
2145 except SystemExit,status:
2145 except SystemExit,status:
2146 if not kw['exit_ignore']:
2146 if not kw['exit_ignore']:
2147 self.InteractiveTB()
2147 self.InteractiveTB()
2148 warn('Failure executing file: <%s>' % fname)
2148 warn('Failure executing file: <%s>' % fname)
2149 except:
2149 except:
2150 self.InteractiveTB()
2150 self.InteractiveTB()
2151 warn('Failure executing file: <%s>' % fname)
2151 warn('Failure executing file: <%s>' % fname)
2152
2152
2153 #************************* end of file <iplib.py> *****************************
2153 #************************* end of file <iplib.py> *****************************
@@ -1,4768 +1,4776 b''
1 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
4 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
5 Moad for help with tracking it down.
6
7 * IPython/iplib.py (handle_auto): fix autocall handling for
8 objects which support BOTH __getitem__ and __call__ (so that f [x]
9 is left alone, instead of becoming f([x]) automatically).
10
3 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
11 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
4 Ville's patch.
12 Ville's patch.
5
13
6 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
14 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
7
15
8 * IPython/iplib.py (handle_auto): changed autocall semantics to
16 * IPython/iplib.py (handle_auto): changed autocall semantics to
9 include 'smart' mode, where the autocall transformation is NOT
17 include 'smart' mode, where the autocall transformation is NOT
10 applied if there are no arguments on the line. This allows you to
18 applied if there are no arguments on the line. This allows you to
11 just type 'foo' if foo is a callable to see its internal form,
19 just type 'foo' if foo is a callable to see its internal form,
12 instead of having it called with no arguments (typically a
20 instead of having it called with no arguments (typically a
13 mistake). The old 'full' autocall still exists: for that, you
21 mistake). The old 'full' autocall still exists: for that, you
14 need to set the 'autocall' parameter to 2 in your ipythonrc file.
22 need to set the 'autocall' parameter to 2 in your ipythonrc file.
15
23
16 * IPython/completer.py (Completer.attr_matches): add
24 * IPython/completer.py (Completer.attr_matches): add
17 tab-completion support for Enthoughts' traits. After a report by
25 tab-completion support for Enthoughts' traits. After a report by
18 Arnd and a patch by Prabhu.
26 Arnd and a patch by Prabhu.
19
27
20 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
28 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
21
29
22 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
30 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
23 Schmolck's patch to fix inspect.getinnerframes().
31 Schmolck's patch to fix inspect.getinnerframes().
24
32
25 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
33 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
26 for embedded instances, regarding handling of namespaces and items
34 for embedded instances, regarding handling of namespaces and items
27 added to the __builtin__ one. Multiple embedded instances and
35 added to the __builtin__ one. Multiple embedded instances and
28 recursive embeddings should work better now (though I'm not sure
36 recursive embeddings should work better now (though I'm not sure
29 I've got all the corner cases fixed, that code is a bit of a brain
37 I've got all the corner cases fixed, that code is a bit of a brain
30 twister).
38 twister).
31
39
32 * IPython/Magic.py (magic_edit): added support to edit in-memory
40 * IPython/Magic.py (magic_edit): added support to edit in-memory
33 macros (automatically creates the necessary temp files). %edit
41 macros (automatically creates the necessary temp files). %edit
34 also doesn't return the file contents anymore, it's just noise.
42 also doesn't return the file contents anymore, it's just noise.
35
43
36 * IPython/completer.py (Completer.attr_matches): revert change to
44 * IPython/completer.py (Completer.attr_matches): revert change to
37 complete only on attributes listed in __all__. I realized it
45 complete only on attributes listed in __all__. I realized it
38 cripples the tab-completion system as a tool for exploring the
46 cripples the tab-completion system as a tool for exploring the
39 internals of unknown libraries (it renders any non-__all__
47 internals of unknown libraries (it renders any non-__all__
40 attribute off-limits). I got bit by this when trying to see
48 attribute off-limits). I got bit by this when trying to see
41 something inside the dis module.
49 something inside the dis module.
42
50
43 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
51 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
44
52
45 * IPython/iplib.py (InteractiveShell.__init__): add .meta
53 * IPython/iplib.py (InteractiveShell.__init__): add .meta
46 namespace for users and extension writers to hold data in. This
54 namespace for users and extension writers to hold data in. This
47 follows the discussion in
55 follows the discussion in
48 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
56 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
49
57
50 * IPython/completer.py (IPCompleter.complete): small patch to help
58 * IPython/completer.py (IPCompleter.complete): small patch to help
51 tab-completion under Emacs, after a suggestion by John Barnard
59 tab-completion under Emacs, after a suggestion by John Barnard
52 <barnarj-AT-ccf.org>.
60 <barnarj-AT-ccf.org>.
53
61
54 * IPython/Magic.py (Magic.extract_input_slices): added support for
62 * IPython/Magic.py (Magic.extract_input_slices): added support for
55 the slice notation in magics to use N-M to represent numbers N...M
63 the slice notation in magics to use N-M to represent numbers N...M
56 (closed endpoints). This is used by %macro and %save.
64 (closed endpoints). This is used by %macro and %save.
57
65
58 * IPython/completer.py (Completer.attr_matches): for modules which
66 * IPython/completer.py (Completer.attr_matches): for modules which
59 define __all__, complete only on those. After a patch by Jeffrey
67 define __all__, complete only on those. After a patch by Jeffrey
60 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
68 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
61 speed up this routine.
69 speed up this routine.
62
70
63 * IPython/Logger.py (Logger.log): fix a history handling bug. I
71 * IPython/Logger.py (Logger.log): fix a history handling bug. I
64 don't know if this is the end of it, but the behavior now is
72 don't know if this is the end of it, but the behavior now is
65 certainly much more correct. Note that coupled with macros,
73 certainly much more correct. Note that coupled with macros,
66 slightly surprising (at first) behavior may occur: a macro will in
74 slightly surprising (at first) behavior may occur: a macro will in
67 general expand to multiple lines of input, so upon exiting, the
75 general expand to multiple lines of input, so upon exiting, the
68 in/out counters will both be bumped by the corresponding amount
76 in/out counters will both be bumped by the corresponding amount
69 (as if the macro's contents had been typed interactively). Typing
77 (as if the macro's contents had been typed interactively). Typing
70 %hist will reveal the intermediate (silently processed) lines.
78 %hist will reveal the intermediate (silently processed) lines.
71
79
72 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
80 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
73 pickle to fail (%run was overwriting __main__ and not restoring
81 pickle to fail (%run was overwriting __main__ and not restoring
74 it, but pickle relies on __main__ to operate).
82 it, but pickle relies on __main__ to operate).
75
83
76 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
84 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
77 using properties, but forgot to make the main InteractiveShell
85 using properties, but forgot to make the main InteractiveShell
78 class a new-style class. Properties fail silently, and
86 class a new-style class. Properties fail silently, and
79 misteriously, with old-style class (getters work, but
87 misteriously, with old-style class (getters work, but
80 setters don't do anything).
88 setters don't do anything).
81
89
82 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
90 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
83
91
84 * IPython/Magic.py (magic_history): fix history reporting bug (I
92 * IPython/Magic.py (magic_history): fix history reporting bug (I
85 know some nasties are still there, I just can't seem to find a
93 know some nasties are still there, I just can't seem to find a
86 reproducible test case to track them down; the input history is
94 reproducible test case to track them down; the input history is
87 falling out of sync...)
95 falling out of sync...)
88
96
89 * IPython/iplib.py (handle_shell_escape): fix bug where both
97 * IPython/iplib.py (handle_shell_escape): fix bug where both
90 aliases and system accesses where broken for indented code (such
98 aliases and system accesses where broken for indented code (such
91 as loops).
99 as loops).
92
100
93 * IPython/genutils.py (shell): fix small but critical bug for
101 * IPython/genutils.py (shell): fix small but critical bug for
94 win32 system access.
102 win32 system access.
95
103
96 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
104 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
97
105
98 * IPython/iplib.py (showtraceback): remove use of the
106 * IPython/iplib.py (showtraceback): remove use of the
99 sys.last_{type/value/traceback} structures, which are non
107 sys.last_{type/value/traceback} structures, which are non
100 thread-safe.
108 thread-safe.
101 (_prefilter): change control flow to ensure that we NEVER
109 (_prefilter): change control flow to ensure that we NEVER
102 introspect objects when autocall is off. This will guarantee that
110 introspect objects when autocall is off. This will guarantee that
103 having an input line of the form 'x.y', where access to attribute
111 having an input line of the form 'x.y', where access to attribute
104 'y' has side effects, doesn't trigger the side effect TWICE. It
112 'y' has side effects, doesn't trigger the side effect TWICE. It
105 is important to note that, with autocall on, these side effects
113 is important to note that, with autocall on, these side effects
106 can still happen.
114 can still happen.
107 (ipsystem): new builtin, to complete the ip{magic/alias/system}
115 (ipsystem): new builtin, to complete the ip{magic/alias/system}
108 trio. IPython offers these three kinds of special calls which are
116 trio. IPython offers these three kinds of special calls which are
109 not python code, and it's a good thing to have their call method
117 not python code, and it's a good thing to have their call method
110 be accessible as pure python functions (not just special syntax at
118 be accessible as pure python functions (not just special syntax at
111 the command line). It gives us a better internal implementation
119 the command line). It gives us a better internal implementation
112 structure, as well as exposing these for user scripting more
120 structure, as well as exposing these for user scripting more
113 cleanly.
121 cleanly.
114
122
115 * IPython/macro.py (Macro.__init__): moved macros to a standalone
123 * IPython/macro.py (Macro.__init__): moved macros to a standalone
116 file. Now that they'll be more likely to be used with the
124 file. Now that they'll be more likely to be used with the
117 persistance system (%store), I want to make sure their module path
125 persistance system (%store), I want to make sure their module path
118 doesn't change in the future, so that we don't break things for
126 doesn't change in the future, so that we don't break things for
119 users' persisted data.
127 users' persisted data.
120
128
121 * IPython/iplib.py (autoindent_update): move indentation
129 * IPython/iplib.py (autoindent_update): move indentation
122 management into the _text_ processing loop, not the keyboard
130 management into the _text_ processing loop, not the keyboard
123 interactive one. This is necessary to correctly process non-typed
131 interactive one. This is necessary to correctly process non-typed
124 multiline input (such as macros).
132 multiline input (such as macros).
125
133
126 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
134 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
127 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
135 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
128 which was producing problems in the resulting manual.
136 which was producing problems in the resulting manual.
129 (magic_whos): improve reporting of instances (show their class,
137 (magic_whos): improve reporting of instances (show their class,
130 instead of simply printing 'instance' which isn't terribly
138 instead of simply printing 'instance' which isn't terribly
131 informative).
139 informative).
132
140
133 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
141 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
134 (minor mods) to support network shares under win32.
142 (minor mods) to support network shares under win32.
135
143
136 * IPython/winconsole.py (get_console_size): add new winconsole
144 * IPython/winconsole.py (get_console_size): add new winconsole
137 module and fixes to page_dumb() to improve its behavior under
145 module and fixes to page_dumb() to improve its behavior under
138 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
146 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
139
147
140 * IPython/Magic.py (Macro): simplified Macro class to just
148 * IPython/Magic.py (Macro): simplified Macro class to just
141 subclass list. We've had only 2.2 compatibility for a very long
149 subclass list. We've had only 2.2 compatibility for a very long
142 time, yet I was still avoiding subclassing the builtin types. No
150 time, yet I was still avoiding subclassing the builtin types. No
143 more (I'm also starting to use properties, though I won't shift to
151 more (I'm also starting to use properties, though I won't shift to
144 2.3-specific features quite yet).
152 2.3-specific features quite yet).
145 (magic_store): added Ville's patch for lightweight variable
153 (magic_store): added Ville's patch for lightweight variable
146 persistence, after a request on the user list by Matt Wilkie
154 persistence, after a request on the user list by Matt Wilkie
147 <maphew-AT-gmail.com>. The new %store magic's docstring has full
155 <maphew-AT-gmail.com>. The new %store magic's docstring has full
148 details.
156 details.
149
157
150 * IPython/iplib.py (InteractiveShell.post_config_initialization):
158 * IPython/iplib.py (InteractiveShell.post_config_initialization):
151 changed the default logfile name from 'ipython.log' to
159 changed the default logfile name from 'ipython.log' to
152 'ipython_log.py'. These logs are real python files, and now that
160 'ipython_log.py'. These logs are real python files, and now that
153 we have much better multiline support, people are more likely to
161 we have much better multiline support, people are more likely to
154 want to use them as such. Might as well name them correctly.
162 want to use them as such. Might as well name them correctly.
155
163
156 * IPython/Magic.py: substantial cleanup. While we can't stop
164 * IPython/Magic.py: substantial cleanup. While we can't stop
157 using magics as mixins, due to the existing customizations 'out
165 using magics as mixins, due to the existing customizations 'out
158 there' which rely on the mixin naming conventions, at least I
166 there' which rely on the mixin naming conventions, at least I
159 cleaned out all cross-class name usage. So once we are OK with
167 cleaned out all cross-class name usage. So once we are OK with
160 breaking compatibility, the two systems can be separated.
168 breaking compatibility, the two systems can be separated.
161
169
162 * IPython/Logger.py: major cleanup. This one is NOT a mixin
170 * IPython/Logger.py: major cleanup. This one is NOT a mixin
163 anymore, and the class is a fair bit less hideous as well. New
171 anymore, and the class is a fair bit less hideous as well. New
164 features were also introduced: timestamping of input, and logging
172 features were also introduced: timestamping of input, and logging
165 of output results. These are user-visible with the -t and -o
173 of output results. These are user-visible with the -t and -o
166 options to %logstart. Closes
174 options to %logstart. Closes
167 http://www.scipy.net/roundup/ipython/issue11 and a request by
175 http://www.scipy.net/roundup/ipython/issue11 and a request by
168 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
176 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
169
177
170 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
178 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
171
179
172 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
180 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
173 better hadnle backslashes in paths. See the thread 'More Windows
181 better hadnle backslashes in paths. See the thread 'More Windows
174 questions part 2 - \/ characters revisited' on the iypthon user
182 questions part 2 - \/ characters revisited' on the iypthon user
175 list:
183 list:
176 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
184 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
177
185
178 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
186 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
179
187
180 (InteractiveShell.__init__): change threaded shells to not use the
188 (InteractiveShell.__init__): change threaded shells to not use the
181 ipython crash handler. This was causing more problems than not,
189 ipython crash handler. This was causing more problems than not,
182 as exceptions in the main thread (GUI code, typically) would
190 as exceptions in the main thread (GUI code, typically) would
183 always show up as a 'crash', when they really weren't.
191 always show up as a 'crash', when they really weren't.
184
192
185 The colors and exception mode commands (%colors/%xmode) have been
193 The colors and exception mode commands (%colors/%xmode) have been
186 synchronized to also take this into account, so users can get
194 synchronized to also take this into account, so users can get
187 verbose exceptions for their threaded code as well. I also added
195 verbose exceptions for their threaded code as well. I also added
188 support for activating pdb inside this exception handler as well,
196 support for activating pdb inside this exception handler as well,
189 so now GUI authors can use IPython's enhanced pdb at runtime.
197 so now GUI authors can use IPython's enhanced pdb at runtime.
190
198
191 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
199 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
192 true by default, and add it to the shipped ipythonrc file. Since
200 true by default, and add it to the shipped ipythonrc file. Since
193 this asks the user before proceeding, I think it's OK to make it
201 this asks the user before proceeding, I think it's OK to make it
194 true by default.
202 true by default.
195
203
196 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
204 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
197 of the previous special-casing of input in the eval loop. I think
205 of the previous special-casing of input in the eval loop. I think
198 this is cleaner, as they really are commands and shouldn't have
206 this is cleaner, as they really are commands and shouldn't have
199 a special role in the middle of the core code.
207 a special role in the middle of the core code.
200
208
201 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
209 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
202
210
203 * IPython/iplib.py (edit_syntax_error): added support for
211 * IPython/iplib.py (edit_syntax_error): added support for
204 automatically reopening the editor if the file had a syntax error
212 automatically reopening the editor if the file had a syntax error
205 in it. Thanks to scottt who provided the patch at:
213 in it. Thanks to scottt who provided the patch at:
206 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
214 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
207 version committed).
215 version committed).
208
216
209 * IPython/iplib.py (handle_normal): add suport for multi-line
217 * IPython/iplib.py (handle_normal): add suport for multi-line
210 input with emtpy lines. This fixes
218 input with emtpy lines. This fixes
211 http://www.scipy.net/roundup/ipython/issue43 and a similar
219 http://www.scipy.net/roundup/ipython/issue43 and a similar
212 discussion on the user list.
220 discussion on the user list.
213
221
214 WARNING: a behavior change is necessarily introduced to support
222 WARNING: a behavior change is necessarily introduced to support
215 blank lines: now a single blank line with whitespace does NOT
223 blank lines: now a single blank line with whitespace does NOT
216 break the input loop, which means that when autoindent is on, by
224 break the input loop, which means that when autoindent is on, by
217 default hitting return on the next (indented) line does NOT exit.
225 default hitting return on the next (indented) line does NOT exit.
218
226
219 Instead, to exit a multiline input you can either have:
227 Instead, to exit a multiline input you can either have:
220
228
221 - TWO whitespace lines (just hit return again), or
229 - TWO whitespace lines (just hit return again), or
222 - a single whitespace line of a different length than provided
230 - a single whitespace line of a different length than provided
223 by the autoindent (add or remove a space).
231 by the autoindent (add or remove a space).
224
232
225 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
233 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
226 module to better organize all readline-related functionality.
234 module to better organize all readline-related functionality.
227 I've deleted FlexCompleter and put all completion clases here.
235 I've deleted FlexCompleter and put all completion clases here.
228
236
229 * IPython/iplib.py (raw_input): improve indentation management.
237 * IPython/iplib.py (raw_input): improve indentation management.
230 It is now possible to paste indented code with autoindent on, and
238 It is now possible to paste indented code with autoindent on, and
231 the code is interpreted correctly (though it still looks bad on
239 the code is interpreted correctly (though it still looks bad on
232 screen, due to the line-oriented nature of ipython).
240 screen, due to the line-oriented nature of ipython).
233 (MagicCompleter.complete): change behavior so that a TAB key on an
241 (MagicCompleter.complete): change behavior so that a TAB key on an
234 otherwise empty line actually inserts a tab, instead of completing
242 otherwise empty line actually inserts a tab, instead of completing
235 on the entire global namespace. This makes it easier to use the
243 on the entire global namespace. This makes it easier to use the
236 TAB key for indentation. After a request by Hans Meine
244 TAB key for indentation. After a request by Hans Meine
237 <hans_meine-AT-gmx.net>
245 <hans_meine-AT-gmx.net>
238 (_prefilter): add support so that typing plain 'exit' or 'quit'
246 (_prefilter): add support so that typing plain 'exit' or 'quit'
239 does a sensible thing. Originally I tried to deviate as little as
247 does a sensible thing. Originally I tried to deviate as little as
240 possible from the default python behavior, but even that one may
248 possible from the default python behavior, but even that one may
241 change in this direction (thread on python-dev to that effect).
249 change in this direction (thread on python-dev to that effect).
242 Regardless, ipython should do the right thing even if CPython's
250 Regardless, ipython should do the right thing even if CPython's
243 '>>>' prompt doesn't.
251 '>>>' prompt doesn't.
244 (InteractiveShell): removed subclassing code.InteractiveConsole
252 (InteractiveShell): removed subclassing code.InteractiveConsole
245 class. By now we'd overridden just about all of its methods: I've
253 class. By now we'd overridden just about all of its methods: I've
246 copied the remaining two over, and now ipython is a standalone
254 copied the remaining two over, and now ipython is a standalone
247 class. This will provide a clearer picture for the chainsaw
255 class. This will provide a clearer picture for the chainsaw
248 branch refactoring.
256 branch refactoring.
249
257
250 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
258 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
251
259
252 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
260 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
253 failures for objects which break when dir() is called on them.
261 failures for objects which break when dir() is called on them.
254
262
255 * IPython/FlexCompleter.py (Completer.__init__): Added support for
263 * IPython/FlexCompleter.py (Completer.__init__): Added support for
256 distinct local and global namespaces in the completer API. This
264 distinct local and global namespaces in the completer API. This
257 change allows us top properly handle completion with distinct
265 change allows us top properly handle completion with distinct
258 scopes, including in embedded instances (this had never really
266 scopes, including in embedded instances (this had never really
259 worked correctly).
267 worked correctly).
260
268
261 Note: this introduces a change in the constructor for
269 Note: this introduces a change in the constructor for
262 MagicCompleter, as a new global_namespace parameter is now the
270 MagicCompleter, as a new global_namespace parameter is now the
263 second argument (the others were bumped one position).
271 second argument (the others were bumped one position).
264
272
265 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
273 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
266
274
267 * IPython/iplib.py (embed_mainloop): fix tab-completion in
275 * IPython/iplib.py (embed_mainloop): fix tab-completion in
268 embedded instances (which can be done now thanks to Vivian's
276 embedded instances (which can be done now thanks to Vivian's
269 frame-handling fixes for pdb).
277 frame-handling fixes for pdb).
270 (InteractiveShell.__init__): Fix namespace handling problem in
278 (InteractiveShell.__init__): Fix namespace handling problem in
271 embedded instances. We were overwriting __main__ unconditionally,
279 embedded instances. We were overwriting __main__ unconditionally,
272 and this should only be done for 'full' (non-embedded) IPython;
280 and this should only be done for 'full' (non-embedded) IPython;
273 embedded instances must respect the caller's __main__. Thanks to
281 embedded instances must respect the caller's __main__. Thanks to
274 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
282 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
275
283
276 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
284 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
277
285
278 * setup.py: added download_url to setup(). This registers the
286 * setup.py: added download_url to setup(). This registers the
279 download address at PyPI, which is not only useful to humans
287 download address at PyPI, which is not only useful to humans
280 browsing the site, but is also picked up by setuptools (the Eggs
288 browsing the site, but is also picked up by setuptools (the Eggs
281 machinery). Thanks to Ville and R. Kern for the info/discussion
289 machinery). Thanks to Ville and R. Kern for the info/discussion
282 on this.
290 on this.
283
291
284 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
292 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
285
293
286 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
294 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
287 This brings a lot of nice functionality to the pdb mode, which now
295 This brings a lot of nice functionality to the pdb mode, which now
288 has tab-completion, syntax highlighting, and better stack handling
296 has tab-completion, syntax highlighting, and better stack handling
289 than before. Many thanks to Vivian De Smedt
297 than before. Many thanks to Vivian De Smedt
290 <vivian-AT-vdesmedt.com> for the original patches.
298 <vivian-AT-vdesmedt.com> for the original patches.
291
299
292 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
300 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
293
301
294 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
302 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
295 sequence to consistently accept the banner argument. The
303 sequence to consistently accept the banner argument. The
296 inconsistency was tripping SAGE, thanks to Gary Zablackis
304 inconsistency was tripping SAGE, thanks to Gary Zablackis
297 <gzabl-AT-yahoo.com> for the report.
305 <gzabl-AT-yahoo.com> for the report.
298
306
299 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
307 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
300
308
301 * IPython/iplib.py (InteractiveShell.post_config_initialization):
309 * IPython/iplib.py (InteractiveShell.post_config_initialization):
302 Fix bug where a naked 'alias' call in the ipythonrc file would
310 Fix bug where a naked 'alias' call in the ipythonrc file would
303 cause a crash. Bug reported by Jorgen Stenarson.
311 cause a crash. Bug reported by Jorgen Stenarson.
304
312
305 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
313 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
306
314
307 * IPython/ipmaker.py (make_IPython): cleanups which should improve
315 * IPython/ipmaker.py (make_IPython): cleanups which should improve
308 startup time.
316 startup time.
309
317
310 * IPython/iplib.py (runcode): my globals 'fix' for embedded
318 * IPython/iplib.py (runcode): my globals 'fix' for embedded
311 instances had introduced a bug with globals in normal code. Now
319 instances had introduced a bug with globals in normal code. Now
312 it's working in all cases.
320 it's working in all cases.
313
321
314 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
322 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
315 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
323 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
316 has been introduced to set the default case sensitivity of the
324 has been introduced to set the default case sensitivity of the
317 searches. Users can still select either mode at runtime on a
325 searches. Users can still select either mode at runtime on a
318 per-search basis.
326 per-search basis.
319
327
320 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
328 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
321
329
322 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
330 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
323 attributes in wildcard searches for subclasses. Modified version
331 attributes in wildcard searches for subclasses. Modified version
324 of a patch by Jorgen.
332 of a patch by Jorgen.
325
333
326 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
334 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
327
335
328 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
336 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
329 embedded instances. I added a user_global_ns attribute to the
337 embedded instances. I added a user_global_ns attribute to the
330 InteractiveShell class to handle this.
338 InteractiveShell class to handle this.
331
339
332 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
340 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
333
341
334 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
342 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
335 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
343 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
336 (reported under win32, but may happen also in other platforms).
344 (reported under win32, but may happen also in other platforms).
337 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
345 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
338
346
339 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
347 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
340
348
341 * IPython/Magic.py (magic_psearch): new support for wildcard
349 * IPython/Magic.py (magic_psearch): new support for wildcard
342 patterns. Now, typing ?a*b will list all names which begin with a
350 patterns. Now, typing ?a*b will list all names which begin with a
343 and end in b, for example. The %psearch magic has full
351 and end in b, for example. The %psearch magic has full
344 docstrings. Many thanks to JΓΆrgen Stenarson
352 docstrings. Many thanks to JΓΆrgen Stenarson
345 <jorgen.stenarson-AT-bostream.nu>, author of the patches
353 <jorgen.stenarson-AT-bostream.nu>, author of the patches
346 implementing this functionality.
354 implementing this functionality.
347
355
348 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
356 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
349
357
350 * Manual: fixed long-standing annoyance of double-dashes (as in
358 * Manual: fixed long-standing annoyance of double-dashes (as in
351 --prefix=~, for example) being stripped in the HTML version. This
359 --prefix=~, for example) being stripped in the HTML version. This
352 is a latex2html bug, but a workaround was provided. Many thanks
360 is a latex2html bug, but a workaround was provided. Many thanks
353 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
361 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
354 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
362 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
355 rolling. This seemingly small issue had tripped a number of users
363 rolling. This seemingly small issue had tripped a number of users
356 when first installing, so I'm glad to see it gone.
364 when first installing, so I'm glad to see it gone.
357
365
358 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
366 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
359
367
360 * IPython/Extensions/numeric_formats.py: fix missing import,
368 * IPython/Extensions/numeric_formats.py: fix missing import,
361 reported by Stephen Walton.
369 reported by Stephen Walton.
362
370
363 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
371 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
364
372
365 * IPython/demo.py: finish demo module, fully documented now.
373 * IPython/demo.py: finish demo module, fully documented now.
366
374
367 * IPython/genutils.py (file_read): simple little utility to read a
375 * IPython/genutils.py (file_read): simple little utility to read a
368 file and ensure it's closed afterwards.
376 file and ensure it's closed afterwards.
369
377
370 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
378 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
371
379
372 * IPython/demo.py (Demo.__init__): added support for individually
380 * IPython/demo.py (Demo.__init__): added support for individually
373 tagging blocks for automatic execution.
381 tagging blocks for automatic execution.
374
382
375 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
383 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
376 syntax-highlighted python sources, requested by John.
384 syntax-highlighted python sources, requested by John.
377
385
378 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
386 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
379
387
380 * IPython/demo.py (Demo.again): fix bug where again() blocks after
388 * IPython/demo.py (Demo.again): fix bug where again() blocks after
381 finishing.
389 finishing.
382
390
383 * IPython/genutils.py (shlex_split): moved from Magic to here,
391 * IPython/genutils.py (shlex_split): moved from Magic to here,
384 where all 2.2 compatibility stuff lives. I needed it for demo.py.
392 where all 2.2 compatibility stuff lives. I needed it for demo.py.
385
393
386 * IPython/demo.py (Demo.__init__): added support for silent
394 * IPython/demo.py (Demo.__init__): added support for silent
387 blocks, improved marks as regexps, docstrings written.
395 blocks, improved marks as regexps, docstrings written.
388 (Demo.__init__): better docstring, added support for sys.argv.
396 (Demo.__init__): better docstring, added support for sys.argv.
389
397
390 * IPython/genutils.py (marquee): little utility used by the demo
398 * IPython/genutils.py (marquee): little utility used by the demo
391 code, handy in general.
399 code, handy in general.
392
400
393 * IPython/demo.py (Demo.__init__): new class for interactive
401 * IPython/demo.py (Demo.__init__): new class for interactive
394 demos. Not documented yet, I just wrote it in a hurry for
402 demos. Not documented yet, I just wrote it in a hurry for
395 scipy'05. Will docstring later.
403 scipy'05. Will docstring later.
396
404
397 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
405 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
398
406
399 * IPython/Shell.py (sigint_handler): Drastic simplification which
407 * IPython/Shell.py (sigint_handler): Drastic simplification which
400 also seems to make Ctrl-C work correctly across threads! This is
408 also seems to make Ctrl-C work correctly across threads! This is
401 so simple, that I can't beleive I'd missed it before. Needs more
409 so simple, that I can't beleive I'd missed it before. Needs more
402 testing, though.
410 testing, though.
403 (KBINT): Never mind, revert changes. I'm sure I'd tried something
411 (KBINT): Never mind, revert changes. I'm sure I'd tried something
404 like this before...
412 like this before...
405
413
406 * IPython/genutils.py (get_home_dir): add protection against
414 * IPython/genutils.py (get_home_dir): add protection against
407 non-dirs in win32 registry.
415 non-dirs in win32 registry.
408
416
409 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
417 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
410 bug where dict was mutated while iterating (pysh crash).
418 bug where dict was mutated while iterating (pysh crash).
411
419
412 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
420 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
413
421
414 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
422 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
415 spurious newlines added by this routine. After a report by
423 spurious newlines added by this routine. After a report by
416 F. Mantegazza.
424 F. Mantegazza.
417
425
418 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
426 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
419
427
420 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
428 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
421 calls. These were a leftover from the GTK 1.x days, and can cause
429 calls. These were a leftover from the GTK 1.x days, and can cause
422 problems in certain cases (after a report by John Hunter).
430 problems in certain cases (after a report by John Hunter).
423
431
424 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
432 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
425 os.getcwd() fails at init time. Thanks to patch from David Remahl
433 os.getcwd() fails at init time. Thanks to patch from David Remahl
426 <chmod007-AT-mac.com>.
434 <chmod007-AT-mac.com>.
427 (InteractiveShell.__init__): prevent certain special magics from
435 (InteractiveShell.__init__): prevent certain special magics from
428 being shadowed by aliases. Closes
436 being shadowed by aliases. Closes
429 http://www.scipy.net/roundup/ipython/issue41.
437 http://www.scipy.net/roundup/ipython/issue41.
430
438
431 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
439 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
432
440
433 * IPython/iplib.py (InteractiveShell.complete): Added new
441 * IPython/iplib.py (InteractiveShell.complete): Added new
434 top-level completion method to expose the completion mechanism
442 top-level completion method to expose the completion mechanism
435 beyond readline-based environments.
443 beyond readline-based environments.
436
444
437 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
445 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
438
446
439 * tools/ipsvnc (svnversion): fix svnversion capture.
447 * tools/ipsvnc (svnversion): fix svnversion capture.
440
448
441 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
449 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
442 attribute to self, which was missing. Before, it was set by a
450 attribute to self, which was missing. Before, it was set by a
443 routine which in certain cases wasn't being called, so the
451 routine which in certain cases wasn't being called, so the
444 instance could end up missing the attribute. This caused a crash.
452 instance could end up missing the attribute. This caused a crash.
445 Closes http://www.scipy.net/roundup/ipython/issue40.
453 Closes http://www.scipy.net/roundup/ipython/issue40.
446
454
447 2005-08-16 Fernando Perez <fperez@colorado.edu>
455 2005-08-16 Fernando Perez <fperez@colorado.edu>
448
456
449 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
457 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
450 contains non-string attribute. Closes
458 contains non-string attribute. Closes
451 http://www.scipy.net/roundup/ipython/issue38.
459 http://www.scipy.net/roundup/ipython/issue38.
452
460
453 2005-08-14 Fernando Perez <fperez@colorado.edu>
461 2005-08-14 Fernando Perez <fperez@colorado.edu>
454
462
455 * tools/ipsvnc: Minor improvements, to add changeset info.
463 * tools/ipsvnc: Minor improvements, to add changeset info.
456
464
457 2005-08-12 Fernando Perez <fperez@colorado.edu>
465 2005-08-12 Fernando Perez <fperez@colorado.edu>
458
466
459 * IPython/iplib.py (runsource): remove self.code_to_run_src
467 * IPython/iplib.py (runsource): remove self.code_to_run_src
460 attribute. I realized this is nothing more than
468 attribute. I realized this is nothing more than
461 '\n'.join(self.buffer), and having the same data in two different
469 '\n'.join(self.buffer), and having the same data in two different
462 places is just asking for synchronization bugs. This may impact
470 places is just asking for synchronization bugs. This may impact
463 people who have custom exception handlers, so I need to warn
471 people who have custom exception handlers, so I need to warn
464 ipython-dev about it (F. Mantegazza may use them).
472 ipython-dev about it (F. Mantegazza may use them).
465
473
466 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
474 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
467
475
468 * IPython/genutils.py: fix 2.2 compatibility (generators)
476 * IPython/genutils.py: fix 2.2 compatibility (generators)
469
477
470 2005-07-18 Fernando Perez <fperez@colorado.edu>
478 2005-07-18 Fernando Perez <fperez@colorado.edu>
471
479
472 * IPython/genutils.py (get_home_dir): fix to help users with
480 * IPython/genutils.py (get_home_dir): fix to help users with
473 invalid $HOME under win32.
481 invalid $HOME under win32.
474
482
475 2005-07-17 Fernando Perez <fperez@colorado.edu>
483 2005-07-17 Fernando Perez <fperez@colorado.edu>
476
484
477 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
485 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
478 some old hacks and clean up a bit other routines; code should be
486 some old hacks and clean up a bit other routines; code should be
479 simpler and a bit faster.
487 simpler and a bit faster.
480
488
481 * IPython/iplib.py (interact): removed some last-resort attempts
489 * IPython/iplib.py (interact): removed some last-resort attempts
482 to survive broken stdout/stderr. That code was only making it
490 to survive broken stdout/stderr. That code was only making it
483 harder to abstract out the i/o (necessary for gui integration),
491 harder to abstract out the i/o (necessary for gui integration),
484 and the crashes it could prevent were extremely rare in practice
492 and the crashes it could prevent were extremely rare in practice
485 (besides being fully user-induced in a pretty violent manner).
493 (besides being fully user-induced in a pretty violent manner).
486
494
487 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
495 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
488 Nothing major yet, but the code is simpler to read; this should
496 Nothing major yet, but the code is simpler to read; this should
489 make it easier to do more serious modifications in the future.
497 make it easier to do more serious modifications in the future.
490
498
491 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
499 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
492 which broke in .15 (thanks to a report by Ville).
500 which broke in .15 (thanks to a report by Ville).
493
501
494 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
502 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
495 be quite correct, I know next to nothing about unicode). This
503 be quite correct, I know next to nothing about unicode). This
496 will allow unicode strings to be used in prompts, amongst other
504 will allow unicode strings to be used in prompts, amongst other
497 cases. It also will prevent ipython from crashing when unicode
505 cases. It also will prevent ipython from crashing when unicode
498 shows up unexpectedly in many places. If ascii encoding fails, we
506 shows up unexpectedly in many places. If ascii encoding fails, we
499 assume utf_8. Currently the encoding is not a user-visible
507 assume utf_8. Currently the encoding is not a user-visible
500 setting, though it could be made so if there is demand for it.
508 setting, though it could be made so if there is demand for it.
501
509
502 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
510 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
503
511
504 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
512 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
505
513
506 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
514 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
507
515
508 * IPython/genutils.py: Add 2.2 compatibility here, so all other
516 * IPython/genutils.py: Add 2.2 compatibility here, so all other
509 code can work transparently for 2.2/2.3.
517 code can work transparently for 2.2/2.3.
510
518
511 2005-07-16 Fernando Perez <fperez@colorado.edu>
519 2005-07-16 Fernando Perez <fperez@colorado.edu>
512
520
513 * IPython/ultraTB.py (ExceptionColors): Make a global variable
521 * IPython/ultraTB.py (ExceptionColors): Make a global variable
514 out of the color scheme table used for coloring exception
522 out of the color scheme table used for coloring exception
515 tracebacks. This allows user code to add new schemes at runtime.
523 tracebacks. This allows user code to add new schemes at runtime.
516 This is a minimally modified version of the patch at
524 This is a minimally modified version of the patch at
517 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
525 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
518 for the contribution.
526 for the contribution.
519
527
520 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
528 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
521 slightly modified version of the patch in
529 slightly modified version of the patch in
522 http://www.scipy.net/roundup/ipython/issue34, which also allows me
530 http://www.scipy.net/roundup/ipython/issue34, which also allows me
523 to remove the previous try/except solution (which was costlier).
531 to remove the previous try/except solution (which was costlier).
524 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
532 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
525
533
526 2005-06-08 Fernando Perez <fperez@colorado.edu>
534 2005-06-08 Fernando Perez <fperez@colorado.edu>
527
535
528 * IPython/iplib.py (write/write_err): Add methods to abstract all
536 * IPython/iplib.py (write/write_err): Add methods to abstract all
529 I/O a bit more.
537 I/O a bit more.
530
538
531 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
539 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
532 warning, reported by Aric Hagberg, fix by JD Hunter.
540 warning, reported by Aric Hagberg, fix by JD Hunter.
533
541
534 2005-06-02 *** Released version 0.6.15
542 2005-06-02 *** Released version 0.6.15
535
543
536 2005-06-01 Fernando Perez <fperez@colorado.edu>
544 2005-06-01 Fernando Perez <fperez@colorado.edu>
537
545
538 * IPython/iplib.py (MagicCompleter.file_matches): Fix
546 * IPython/iplib.py (MagicCompleter.file_matches): Fix
539 tab-completion of filenames within open-quoted strings. Note that
547 tab-completion of filenames within open-quoted strings. Note that
540 this requires that in ~/.ipython/ipythonrc, users change the
548 this requires that in ~/.ipython/ipythonrc, users change the
541 readline delimiters configuration to read:
549 readline delimiters configuration to read:
542
550
543 readline_remove_delims -/~
551 readline_remove_delims -/~
544
552
545
553
546 2005-05-31 *** Released version 0.6.14
554 2005-05-31 *** Released version 0.6.14
547
555
548 2005-05-29 Fernando Perez <fperez@colorado.edu>
556 2005-05-29 Fernando Perez <fperez@colorado.edu>
549
557
550 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
558 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
551 with files not on the filesystem. Reported by Eliyahu Sandler
559 with files not on the filesystem. Reported by Eliyahu Sandler
552 <eli@gondolin.net>
560 <eli@gondolin.net>
553
561
554 2005-05-22 Fernando Perez <fperez@colorado.edu>
562 2005-05-22 Fernando Perez <fperez@colorado.edu>
555
563
556 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
564 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
557 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
565 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
558
566
559 2005-05-19 Fernando Perez <fperez@colorado.edu>
567 2005-05-19 Fernando Perez <fperez@colorado.edu>
560
568
561 * IPython/iplib.py (safe_execfile): close a file which could be
569 * IPython/iplib.py (safe_execfile): close a file which could be
562 left open (causing problems in win32, which locks open files).
570 left open (causing problems in win32, which locks open files).
563 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
571 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
564
572
565 2005-05-18 Fernando Perez <fperez@colorado.edu>
573 2005-05-18 Fernando Perez <fperez@colorado.edu>
566
574
567 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
575 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
568 keyword arguments correctly to safe_execfile().
576 keyword arguments correctly to safe_execfile().
569
577
570 2005-05-13 Fernando Perez <fperez@colorado.edu>
578 2005-05-13 Fernando Perez <fperez@colorado.edu>
571
579
572 * ipython.1: Added info about Qt to manpage, and threads warning
580 * ipython.1: Added info about Qt to manpage, and threads warning
573 to usage page (invoked with --help).
581 to usage page (invoked with --help).
574
582
575 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
583 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
576 new matcher (it goes at the end of the priority list) to do
584 new matcher (it goes at the end of the priority list) to do
577 tab-completion on named function arguments. Submitted by George
585 tab-completion on named function arguments. Submitted by George
578 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
586 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
579 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
587 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
580 for more details.
588 for more details.
581
589
582 * IPython/Magic.py (magic_run): Added new -e flag to ignore
590 * IPython/Magic.py (magic_run): Added new -e flag to ignore
583 SystemExit exceptions in the script being run. Thanks to a report
591 SystemExit exceptions in the script being run. Thanks to a report
584 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
592 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
585 producing very annoying behavior when running unit tests.
593 producing very annoying behavior when running unit tests.
586
594
587 2005-05-12 Fernando Perez <fperez@colorado.edu>
595 2005-05-12 Fernando Perez <fperez@colorado.edu>
588
596
589 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
597 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
590 which I'd broken (again) due to a changed regexp. In the process,
598 which I'd broken (again) due to a changed regexp. In the process,
591 added ';' as an escape to auto-quote the whole line without
599 added ';' as an escape to auto-quote the whole line without
592 splitting its arguments. Thanks to a report by Jerry McRae
600 splitting its arguments. Thanks to a report by Jerry McRae
593 <qrs0xyc02-AT-sneakemail.com>.
601 <qrs0xyc02-AT-sneakemail.com>.
594
602
595 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
603 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
596 possible crashes caused by a TokenError. Reported by Ed Schofield
604 possible crashes caused by a TokenError. Reported by Ed Schofield
597 <schofield-AT-ftw.at>.
605 <schofield-AT-ftw.at>.
598
606
599 2005-05-06 Fernando Perez <fperez@colorado.edu>
607 2005-05-06 Fernando Perez <fperez@colorado.edu>
600
608
601 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
609 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
602
610
603 2005-04-29 Fernando Perez <fperez@colorado.edu>
611 2005-04-29 Fernando Perez <fperez@colorado.edu>
604
612
605 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
613 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
606 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
614 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
607 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
615 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
608 which provides support for Qt interactive usage (similar to the
616 which provides support for Qt interactive usage (similar to the
609 existing one for WX and GTK). This had been often requested.
617 existing one for WX and GTK). This had been often requested.
610
618
611 2005-04-14 *** Released version 0.6.13
619 2005-04-14 *** Released version 0.6.13
612
620
613 2005-04-08 Fernando Perez <fperez@colorado.edu>
621 2005-04-08 Fernando Perez <fperez@colorado.edu>
614
622
615 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
623 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
616 from _ofind, which gets called on almost every input line. Now,
624 from _ofind, which gets called on almost every input line. Now,
617 we only try to get docstrings if they are actually going to be
625 we only try to get docstrings if they are actually going to be
618 used (the overhead of fetching unnecessary docstrings can be
626 used (the overhead of fetching unnecessary docstrings can be
619 noticeable for certain objects, such as Pyro proxies).
627 noticeable for certain objects, such as Pyro proxies).
620
628
621 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
629 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
622 for completers. For some reason I had been passing them the state
630 for completers. For some reason I had been passing them the state
623 variable, which completers never actually need, and was in
631 variable, which completers never actually need, and was in
624 conflict with the rlcompleter API. Custom completers ONLY need to
632 conflict with the rlcompleter API. Custom completers ONLY need to
625 take the text parameter.
633 take the text parameter.
626
634
627 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
635 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
628 work correctly in pysh. I've also moved all the logic which used
636 work correctly in pysh. I've also moved all the logic which used
629 to be in pysh.py here, which will prevent problems with future
637 to be in pysh.py here, which will prevent problems with future
630 upgrades. However, this time I must warn users to update their
638 upgrades. However, this time I must warn users to update their
631 pysh profile to include the line
639 pysh profile to include the line
632
640
633 import_all IPython.Extensions.InterpreterExec
641 import_all IPython.Extensions.InterpreterExec
634
642
635 because otherwise things won't work for them. They MUST also
643 because otherwise things won't work for them. They MUST also
636 delete pysh.py and the line
644 delete pysh.py and the line
637
645
638 execfile pysh.py
646 execfile pysh.py
639
647
640 from their ipythonrc-pysh.
648 from their ipythonrc-pysh.
641
649
642 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
650 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
643 robust in the face of objects whose dir() returns non-strings
651 robust in the face of objects whose dir() returns non-strings
644 (which it shouldn't, but some broken libs like ITK do). Thanks to
652 (which it shouldn't, but some broken libs like ITK do). Thanks to
645 a patch by John Hunter (implemented differently, though). Also
653 a patch by John Hunter (implemented differently, though). Also
646 minor improvements by using .extend instead of + on lists.
654 minor improvements by using .extend instead of + on lists.
647
655
648 * pysh.py:
656 * pysh.py:
649
657
650 2005-04-06 Fernando Perez <fperez@colorado.edu>
658 2005-04-06 Fernando Perez <fperez@colorado.edu>
651
659
652 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
660 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
653 by default, so that all users benefit from it. Those who don't
661 by default, so that all users benefit from it. Those who don't
654 want it can still turn it off.
662 want it can still turn it off.
655
663
656 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
664 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
657 config file, I'd forgotten about this, so users were getting it
665 config file, I'd forgotten about this, so users were getting it
658 off by default.
666 off by default.
659
667
660 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
668 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
661 consistency. Now magics can be called in multiline statements,
669 consistency. Now magics can be called in multiline statements,
662 and python variables can be expanded in magic calls via $var.
670 and python variables can be expanded in magic calls via $var.
663 This makes the magic system behave just like aliases or !system
671 This makes the magic system behave just like aliases or !system
664 calls.
672 calls.
665
673
666 2005-03-28 Fernando Perez <fperez@colorado.edu>
674 2005-03-28 Fernando Perez <fperez@colorado.edu>
667
675
668 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
676 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
669 expensive string additions for building command. Add support for
677 expensive string additions for building command. Add support for
670 trailing ';' when autocall is used.
678 trailing ';' when autocall is used.
671
679
672 2005-03-26 Fernando Perez <fperez@colorado.edu>
680 2005-03-26 Fernando Perez <fperez@colorado.edu>
673
681
674 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
682 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
675 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
683 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
676 ipython.el robust against prompts with any number of spaces
684 ipython.el robust against prompts with any number of spaces
677 (including 0) after the ':' character.
685 (including 0) after the ':' character.
678
686
679 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
687 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
680 continuation prompt, which misled users to think the line was
688 continuation prompt, which misled users to think the line was
681 already indented. Closes debian Bug#300847, reported to me by
689 already indented. Closes debian Bug#300847, reported to me by
682 Norbert Tretkowski <tretkowski-AT-inittab.de>.
690 Norbert Tretkowski <tretkowski-AT-inittab.de>.
683
691
684 2005-03-23 Fernando Perez <fperez@colorado.edu>
692 2005-03-23 Fernando Perez <fperez@colorado.edu>
685
693
686 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
694 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
687 properly aligned if they have embedded newlines.
695 properly aligned if they have embedded newlines.
688
696
689 * IPython/iplib.py (runlines): Add a public method to expose
697 * IPython/iplib.py (runlines): Add a public method to expose
690 IPython's code execution machinery, so that users can run strings
698 IPython's code execution machinery, so that users can run strings
691 as if they had been typed at the prompt interactively.
699 as if they had been typed at the prompt interactively.
692 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
700 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
693 methods which can call the system shell, but with python variable
701 methods which can call the system shell, but with python variable
694 expansion. The three such methods are: __IPYTHON__.system,
702 expansion. The three such methods are: __IPYTHON__.system,
695 .getoutput and .getoutputerror. These need to be documented in a
703 .getoutput and .getoutputerror. These need to be documented in a
696 'public API' section (to be written) of the manual.
704 'public API' section (to be written) of the manual.
697
705
698 2005-03-20 Fernando Perez <fperez@colorado.edu>
706 2005-03-20 Fernando Perez <fperez@colorado.edu>
699
707
700 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
708 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
701 for custom exception handling. This is quite powerful, and it
709 for custom exception handling. This is quite powerful, and it
702 allows for user-installable exception handlers which can trap
710 allows for user-installable exception handlers which can trap
703 custom exceptions at runtime and treat them separately from
711 custom exceptions at runtime and treat them separately from
704 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
712 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
705 Mantegazza <mantegazza-AT-ill.fr>.
713 Mantegazza <mantegazza-AT-ill.fr>.
706 (InteractiveShell.set_custom_completer): public API function to
714 (InteractiveShell.set_custom_completer): public API function to
707 add new completers at runtime.
715 add new completers at runtime.
708
716
709 2005-03-19 Fernando Perez <fperez@colorado.edu>
717 2005-03-19 Fernando Perez <fperez@colorado.edu>
710
718
711 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
719 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
712 allow objects which provide their docstrings via non-standard
720 allow objects which provide their docstrings via non-standard
713 mechanisms (like Pyro proxies) to still be inspected by ipython's
721 mechanisms (like Pyro proxies) to still be inspected by ipython's
714 ? system.
722 ? system.
715
723
716 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
724 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
717 automatic capture system. I tried quite hard to make it work
725 automatic capture system. I tried quite hard to make it work
718 reliably, and simply failed. I tried many combinations with the
726 reliably, and simply failed. I tried many combinations with the
719 subprocess module, but eventually nothing worked in all needed
727 subprocess module, but eventually nothing worked in all needed
720 cases (not blocking stdin for the child, duplicating stdout
728 cases (not blocking stdin for the child, duplicating stdout
721 without blocking, etc). The new %sc/%sx still do capture to these
729 without blocking, etc). The new %sc/%sx still do capture to these
722 magical list/string objects which make shell use much more
730 magical list/string objects which make shell use much more
723 conveninent, so not all is lost.
731 conveninent, so not all is lost.
724
732
725 XXX - FIX MANUAL for the change above!
733 XXX - FIX MANUAL for the change above!
726
734
727 (runsource): I copied code.py's runsource() into ipython to modify
735 (runsource): I copied code.py's runsource() into ipython to modify
728 it a bit. Now the code object and source to be executed are
736 it a bit. Now the code object and source to be executed are
729 stored in ipython. This makes this info accessible to third-party
737 stored in ipython. This makes this info accessible to third-party
730 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
738 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
731 Mantegazza <mantegazza-AT-ill.fr>.
739 Mantegazza <mantegazza-AT-ill.fr>.
732
740
733 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
741 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
734 history-search via readline (like C-p/C-n). I'd wanted this for a
742 history-search via readline (like C-p/C-n). I'd wanted this for a
735 long time, but only recently found out how to do it. For users
743 long time, but only recently found out how to do it. For users
736 who already have their ipythonrc files made and want this, just
744 who already have their ipythonrc files made and want this, just
737 add:
745 add:
738
746
739 readline_parse_and_bind "\e[A": history-search-backward
747 readline_parse_and_bind "\e[A": history-search-backward
740 readline_parse_and_bind "\e[B": history-search-forward
748 readline_parse_and_bind "\e[B": history-search-forward
741
749
742 2005-03-18 Fernando Perez <fperez@colorado.edu>
750 2005-03-18 Fernando Perez <fperez@colorado.edu>
743
751
744 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
752 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
745 LSString and SList classes which allow transparent conversions
753 LSString and SList classes which allow transparent conversions
746 between list mode and whitespace-separated string.
754 between list mode and whitespace-separated string.
747 (magic_r): Fix recursion problem in %r.
755 (magic_r): Fix recursion problem in %r.
748
756
749 * IPython/genutils.py (LSString): New class to be used for
757 * IPython/genutils.py (LSString): New class to be used for
750 automatic storage of the results of all alias/system calls in _o
758 automatic storage of the results of all alias/system calls in _o
751 and _e (stdout/err). These provide a .l/.list attribute which
759 and _e (stdout/err). These provide a .l/.list attribute which
752 does automatic splitting on newlines. This means that for most
760 does automatic splitting on newlines. This means that for most
753 uses, you'll never need to do capturing of output with %sc/%sx
761 uses, you'll never need to do capturing of output with %sc/%sx
754 anymore, since ipython keeps this always done for you. Note that
762 anymore, since ipython keeps this always done for you. Note that
755 only the LAST results are stored, the _o/e variables are
763 only the LAST results are stored, the _o/e variables are
756 overwritten on each call. If you need to save their contents
764 overwritten on each call. If you need to save their contents
757 further, simply bind them to any other name.
765 further, simply bind them to any other name.
758
766
759 2005-03-17 Fernando Perez <fperez@colorado.edu>
767 2005-03-17 Fernando Perez <fperez@colorado.edu>
760
768
761 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
769 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
762 prompt namespace handling.
770 prompt namespace handling.
763
771
764 2005-03-16 Fernando Perez <fperez@colorado.edu>
772 2005-03-16 Fernando Perez <fperez@colorado.edu>
765
773
766 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
774 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
767 classic prompts to be '>>> ' (final space was missing, and it
775 classic prompts to be '>>> ' (final space was missing, and it
768 trips the emacs python mode).
776 trips the emacs python mode).
769 (BasePrompt.__str__): Added safe support for dynamic prompt
777 (BasePrompt.__str__): Added safe support for dynamic prompt
770 strings. Now you can set your prompt string to be '$x', and the
778 strings. Now you can set your prompt string to be '$x', and the
771 value of x will be printed from your interactive namespace. The
779 value of x will be printed from your interactive namespace. The
772 interpolation syntax includes the full Itpl support, so
780 interpolation syntax includes the full Itpl support, so
773 ${foo()+x+bar()} is a valid prompt string now, and the function
781 ${foo()+x+bar()} is a valid prompt string now, and the function
774 calls will be made at runtime.
782 calls will be made at runtime.
775
783
776 2005-03-15 Fernando Perez <fperez@colorado.edu>
784 2005-03-15 Fernando Perez <fperez@colorado.edu>
777
785
778 * IPython/Magic.py (magic_history): renamed %hist to %history, to
786 * IPython/Magic.py (magic_history): renamed %hist to %history, to
779 avoid name clashes in pylab. %hist still works, it just forwards
787 avoid name clashes in pylab. %hist still works, it just forwards
780 the call to %history.
788 the call to %history.
781
789
782 2005-03-02 *** Released version 0.6.12
790 2005-03-02 *** Released version 0.6.12
783
791
784 2005-03-02 Fernando Perez <fperez@colorado.edu>
792 2005-03-02 Fernando Perez <fperez@colorado.edu>
785
793
786 * IPython/iplib.py (handle_magic): log magic calls properly as
794 * IPython/iplib.py (handle_magic): log magic calls properly as
787 ipmagic() function calls.
795 ipmagic() function calls.
788
796
789 * IPython/Magic.py (magic_time): Improved %time to support
797 * IPython/Magic.py (magic_time): Improved %time to support
790 statements and provide wall-clock as well as CPU time.
798 statements and provide wall-clock as well as CPU time.
791
799
792 2005-02-27 Fernando Perez <fperez@colorado.edu>
800 2005-02-27 Fernando Perez <fperez@colorado.edu>
793
801
794 * IPython/hooks.py: New hooks module, to expose user-modifiable
802 * IPython/hooks.py: New hooks module, to expose user-modifiable
795 IPython functionality in a clean manner. For now only the editor
803 IPython functionality in a clean manner. For now only the editor
796 hook is actually written, and other thigns which I intend to turn
804 hook is actually written, and other thigns which I intend to turn
797 into proper hooks aren't yet there. The display and prefilter
805 into proper hooks aren't yet there. The display and prefilter
798 stuff, for example, should be hooks. But at least now the
806 stuff, for example, should be hooks. But at least now the
799 framework is in place, and the rest can be moved here with more
807 framework is in place, and the rest can be moved here with more
800 time later. IPython had had a .hooks variable for a long time for
808 time later. IPython had had a .hooks variable for a long time for
801 this purpose, but I'd never actually used it for anything.
809 this purpose, but I'd never actually used it for anything.
802
810
803 2005-02-26 Fernando Perez <fperez@colorado.edu>
811 2005-02-26 Fernando Perez <fperez@colorado.edu>
804
812
805 * IPython/ipmaker.py (make_IPython): make the default ipython
813 * IPython/ipmaker.py (make_IPython): make the default ipython
806 directory be called _ipython under win32, to follow more the
814 directory be called _ipython under win32, to follow more the
807 naming peculiarities of that platform (where buggy software like
815 naming peculiarities of that platform (where buggy software like
808 Visual Sourcesafe breaks with .named directories). Reported by
816 Visual Sourcesafe breaks with .named directories). Reported by
809 Ville Vainio.
817 Ville Vainio.
810
818
811 2005-02-23 Fernando Perez <fperez@colorado.edu>
819 2005-02-23 Fernando Perez <fperez@colorado.edu>
812
820
813 * IPython/iplib.py (InteractiveShell.__init__): removed a few
821 * IPython/iplib.py (InteractiveShell.__init__): removed a few
814 auto_aliases for win32 which were causing problems. Users can
822 auto_aliases for win32 which were causing problems. Users can
815 define the ones they personally like.
823 define the ones they personally like.
816
824
817 2005-02-21 Fernando Perez <fperez@colorado.edu>
825 2005-02-21 Fernando Perez <fperez@colorado.edu>
818
826
819 * IPython/Magic.py (magic_time): new magic to time execution of
827 * IPython/Magic.py (magic_time): new magic to time execution of
820 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
828 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
821
829
822 2005-02-19 Fernando Perez <fperez@colorado.edu>
830 2005-02-19 Fernando Perez <fperez@colorado.edu>
823
831
824 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
832 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
825 into keys (for prompts, for example).
833 into keys (for prompts, for example).
826
834
827 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
835 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
828 prompts in case users want them. This introduces a small behavior
836 prompts in case users want them. This introduces a small behavior
829 change: ipython does not automatically add a space to all prompts
837 change: ipython does not automatically add a space to all prompts
830 anymore. To get the old prompts with a space, users should add it
838 anymore. To get the old prompts with a space, users should add it
831 manually to their ipythonrc file, so for example prompt_in1 should
839 manually to their ipythonrc file, so for example prompt_in1 should
832 now read 'In [\#]: ' instead of 'In [\#]:'.
840 now read 'In [\#]: ' instead of 'In [\#]:'.
833 (BasePrompt.__init__): New option prompts_pad_left (only in rc
841 (BasePrompt.__init__): New option prompts_pad_left (only in rc
834 file) to control left-padding of secondary prompts.
842 file) to control left-padding of secondary prompts.
835
843
836 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
844 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
837 the profiler can't be imported. Fix for Debian, which removed
845 the profiler can't be imported. Fix for Debian, which removed
838 profile.py because of License issues. I applied a slightly
846 profile.py because of License issues. I applied a slightly
839 modified version of the original Debian patch at
847 modified version of the original Debian patch at
840 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
848 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
841
849
842 2005-02-17 Fernando Perez <fperez@colorado.edu>
850 2005-02-17 Fernando Perez <fperez@colorado.edu>
843
851
844 * IPython/genutils.py (native_line_ends): Fix bug which would
852 * IPython/genutils.py (native_line_ends): Fix bug which would
845 cause improper line-ends under win32 b/c I was not opening files
853 cause improper line-ends under win32 b/c I was not opening files
846 in binary mode. Bug report and fix thanks to Ville.
854 in binary mode. Bug report and fix thanks to Ville.
847
855
848 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
856 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
849 trying to catch spurious foo[1] autocalls. My fix actually broke
857 trying to catch spurious foo[1] autocalls. My fix actually broke
850 ',/' autoquote/call with explicit escape (bad regexp).
858 ',/' autoquote/call with explicit escape (bad regexp).
851
859
852 2005-02-15 *** Released version 0.6.11
860 2005-02-15 *** Released version 0.6.11
853
861
854 2005-02-14 Fernando Perez <fperez@colorado.edu>
862 2005-02-14 Fernando Perez <fperez@colorado.edu>
855
863
856 * IPython/background_jobs.py: New background job management
864 * IPython/background_jobs.py: New background job management
857 subsystem. This is implemented via a new set of classes, and
865 subsystem. This is implemented via a new set of classes, and
858 IPython now provides a builtin 'jobs' object for background job
866 IPython now provides a builtin 'jobs' object for background job
859 execution. A convenience %bg magic serves as a lightweight
867 execution. A convenience %bg magic serves as a lightweight
860 frontend for starting the more common type of calls. This was
868 frontend for starting the more common type of calls. This was
861 inspired by discussions with B. Granger and the BackgroundCommand
869 inspired by discussions with B. Granger and the BackgroundCommand
862 class described in the book Python Scripting for Computational
870 class described in the book Python Scripting for Computational
863 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
871 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
864 (although ultimately no code from this text was used, as IPython's
872 (although ultimately no code from this text was used, as IPython's
865 system is a separate implementation).
873 system is a separate implementation).
866
874
867 * IPython/iplib.py (MagicCompleter.python_matches): add new option
875 * IPython/iplib.py (MagicCompleter.python_matches): add new option
868 to control the completion of single/double underscore names
876 to control the completion of single/double underscore names
869 separately. As documented in the example ipytonrc file, the
877 separately. As documented in the example ipytonrc file, the
870 readline_omit__names variable can now be set to 2, to omit even
878 readline_omit__names variable can now be set to 2, to omit even
871 single underscore names. Thanks to a patch by Brian Wong
879 single underscore names. Thanks to a patch by Brian Wong
872 <BrianWong-AT-AirgoNetworks.Com>.
880 <BrianWong-AT-AirgoNetworks.Com>.
873 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
881 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
874 be autocalled as foo([1]) if foo were callable. A problem for
882 be autocalled as foo([1]) if foo were callable. A problem for
875 things which are both callable and implement __getitem__.
883 things which are both callable and implement __getitem__.
876 (init_readline): Fix autoindentation for win32. Thanks to a patch
884 (init_readline): Fix autoindentation for win32. Thanks to a patch
877 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
885 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
878
886
879 2005-02-12 Fernando Perez <fperez@colorado.edu>
887 2005-02-12 Fernando Perez <fperez@colorado.edu>
880
888
881 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
889 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
882 which I had written long ago to sort out user error messages which
890 which I had written long ago to sort out user error messages which
883 may occur during startup. This seemed like a good idea initially,
891 may occur during startup. This seemed like a good idea initially,
884 but it has proven a disaster in retrospect. I don't want to
892 but it has proven a disaster in retrospect. I don't want to
885 change much code for now, so my fix is to set the internal 'debug'
893 change much code for now, so my fix is to set the internal 'debug'
886 flag to true everywhere, whose only job was precisely to control
894 flag to true everywhere, whose only job was precisely to control
887 this subsystem. This closes issue 28 (as well as avoiding all
895 this subsystem. This closes issue 28 (as well as avoiding all
888 sorts of strange hangups which occur from time to time).
896 sorts of strange hangups which occur from time to time).
889
897
890 2005-02-07 Fernando Perez <fperez@colorado.edu>
898 2005-02-07 Fernando Perez <fperez@colorado.edu>
891
899
892 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
900 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
893 previous call produced a syntax error.
901 previous call produced a syntax error.
894
902
895 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
903 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
896 classes without constructor.
904 classes without constructor.
897
905
898 2005-02-06 Fernando Perez <fperez@colorado.edu>
906 2005-02-06 Fernando Perez <fperez@colorado.edu>
899
907
900 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
908 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
901 completions with the results of each matcher, so we return results
909 completions with the results of each matcher, so we return results
902 to the user from all namespaces. This breaks with ipython
910 to the user from all namespaces. This breaks with ipython
903 tradition, but I think it's a nicer behavior. Now you get all
911 tradition, but I think it's a nicer behavior. Now you get all
904 possible completions listed, from all possible namespaces (python,
912 possible completions listed, from all possible namespaces (python,
905 filesystem, magics...) After a request by John Hunter
913 filesystem, magics...) After a request by John Hunter
906 <jdhunter-AT-nitace.bsd.uchicago.edu>.
914 <jdhunter-AT-nitace.bsd.uchicago.edu>.
907
915
908 2005-02-05 Fernando Perez <fperez@colorado.edu>
916 2005-02-05 Fernando Perez <fperez@colorado.edu>
909
917
910 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
918 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
911 the call had quote characters in it (the quotes were stripped).
919 the call had quote characters in it (the quotes were stripped).
912
920
913 2005-01-31 Fernando Perez <fperez@colorado.edu>
921 2005-01-31 Fernando Perez <fperez@colorado.edu>
914
922
915 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
923 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
916 Itpl.itpl() to make the code more robust against psyco
924 Itpl.itpl() to make the code more robust against psyco
917 optimizations.
925 optimizations.
918
926
919 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
927 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
920 of causing an exception. Quicker, cleaner.
928 of causing an exception. Quicker, cleaner.
921
929
922 2005-01-28 Fernando Perez <fperez@colorado.edu>
930 2005-01-28 Fernando Perez <fperez@colorado.edu>
923
931
924 * scripts/ipython_win_post_install.py (install): hardcode
932 * scripts/ipython_win_post_install.py (install): hardcode
925 sys.prefix+'python.exe' as the executable path. It turns out that
933 sys.prefix+'python.exe' as the executable path. It turns out that
926 during the post-installation run, sys.executable resolves to the
934 during the post-installation run, sys.executable resolves to the
927 name of the binary installer! I should report this as a distutils
935 name of the binary installer! I should report this as a distutils
928 bug, I think. I updated the .10 release with this tiny fix, to
936 bug, I think. I updated the .10 release with this tiny fix, to
929 avoid annoying the lists further.
937 avoid annoying the lists further.
930
938
931 2005-01-27 *** Released version 0.6.10
939 2005-01-27 *** Released version 0.6.10
932
940
933 2005-01-27 Fernando Perez <fperez@colorado.edu>
941 2005-01-27 Fernando Perez <fperez@colorado.edu>
934
942
935 * IPython/numutils.py (norm): Added 'inf' as optional name for
943 * IPython/numutils.py (norm): Added 'inf' as optional name for
936 L-infinity norm, included references to mathworld.com for vector
944 L-infinity norm, included references to mathworld.com for vector
937 norm definitions.
945 norm definitions.
938 (amin/amax): added amin/amax for array min/max. Similar to what
946 (amin/amax): added amin/amax for array min/max. Similar to what
939 pylab ships with after the recent reorganization of names.
947 pylab ships with after the recent reorganization of names.
940 (spike/spike_odd): removed deprecated spike/spike_odd functions.
948 (spike/spike_odd): removed deprecated spike/spike_odd functions.
941
949
942 * ipython.el: committed Alex's recent fixes and improvements.
950 * ipython.el: committed Alex's recent fixes and improvements.
943 Tested with python-mode from CVS, and it looks excellent. Since
951 Tested with python-mode from CVS, and it looks excellent. Since
944 python-mode hasn't released anything in a while, I'm temporarily
952 python-mode hasn't released anything in a while, I'm temporarily
945 putting a copy of today's CVS (v 4.70) of python-mode in:
953 putting a copy of today's CVS (v 4.70) of python-mode in:
946 http://ipython.scipy.org/tmp/python-mode.el
954 http://ipython.scipy.org/tmp/python-mode.el
947
955
948 * scripts/ipython_win_post_install.py (install): Win32 fix to use
956 * scripts/ipython_win_post_install.py (install): Win32 fix to use
949 sys.executable for the executable name, instead of assuming it's
957 sys.executable for the executable name, instead of assuming it's
950 called 'python.exe' (the post-installer would have produced broken
958 called 'python.exe' (the post-installer would have produced broken
951 setups on systems with a differently named python binary).
959 setups on systems with a differently named python binary).
952
960
953 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
961 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
954 references to os.linesep, to make the code more
962 references to os.linesep, to make the code more
955 platform-independent. This is also part of the win32 coloring
963 platform-independent. This is also part of the win32 coloring
956 fixes.
964 fixes.
957
965
958 * IPython/genutils.py (page_dumb): Remove attempts to chop long
966 * IPython/genutils.py (page_dumb): Remove attempts to chop long
959 lines, which actually cause coloring bugs because the length of
967 lines, which actually cause coloring bugs because the length of
960 the line is very difficult to correctly compute with embedded
968 the line is very difficult to correctly compute with embedded
961 escapes. This was the source of all the coloring problems under
969 escapes. This was the source of all the coloring problems under
962 Win32. I think that _finally_, Win32 users have a properly
970 Win32. I think that _finally_, Win32 users have a properly
963 working ipython in all respects. This would never have happened
971 working ipython in all respects. This would never have happened
964 if not for Gary Bishop and Viktor Ransmayr's great help and work.
972 if not for Gary Bishop and Viktor Ransmayr's great help and work.
965
973
966 2005-01-26 *** Released version 0.6.9
974 2005-01-26 *** Released version 0.6.9
967
975
968 2005-01-25 Fernando Perez <fperez@colorado.edu>
976 2005-01-25 Fernando Perez <fperez@colorado.edu>
969
977
970 * setup.py: finally, we have a true Windows installer, thanks to
978 * setup.py: finally, we have a true Windows installer, thanks to
971 the excellent work of Viktor Ransmayr
979 the excellent work of Viktor Ransmayr
972 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
980 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
973 Windows users. The setup routine is quite a bit cleaner thanks to
981 Windows users. The setup routine is quite a bit cleaner thanks to
974 this, and the post-install script uses the proper functions to
982 this, and the post-install script uses the proper functions to
975 allow a clean de-installation using the standard Windows Control
983 allow a clean de-installation using the standard Windows Control
976 Panel.
984 Panel.
977
985
978 * IPython/genutils.py (get_home_dir): changed to use the $HOME
986 * IPython/genutils.py (get_home_dir): changed to use the $HOME
979 environment variable under all OSes (including win32) if
987 environment variable under all OSes (including win32) if
980 available. This will give consistency to win32 users who have set
988 available. This will give consistency to win32 users who have set
981 this variable for any reason. If os.environ['HOME'] fails, the
989 this variable for any reason. If os.environ['HOME'] fails, the
982 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
990 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
983
991
984 2005-01-24 Fernando Perez <fperez@colorado.edu>
992 2005-01-24 Fernando Perez <fperez@colorado.edu>
985
993
986 * IPython/numutils.py (empty_like): add empty_like(), similar to
994 * IPython/numutils.py (empty_like): add empty_like(), similar to
987 zeros_like() but taking advantage of the new empty() Numeric routine.
995 zeros_like() but taking advantage of the new empty() Numeric routine.
988
996
989 2005-01-23 *** Released version 0.6.8
997 2005-01-23 *** Released version 0.6.8
990
998
991 2005-01-22 Fernando Perez <fperez@colorado.edu>
999 2005-01-22 Fernando Perez <fperez@colorado.edu>
992
1000
993 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1001 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
994 automatic show() calls. After discussing things with JDH, it
1002 automatic show() calls. After discussing things with JDH, it
995 turns out there are too many corner cases where this can go wrong.
1003 turns out there are too many corner cases where this can go wrong.
996 It's best not to try to be 'too smart', and simply have ipython
1004 It's best not to try to be 'too smart', and simply have ipython
997 reproduce as much as possible the default behavior of a normal
1005 reproduce as much as possible the default behavior of a normal
998 python shell.
1006 python shell.
999
1007
1000 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1008 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1001 line-splitting regexp and _prefilter() to avoid calling getattr()
1009 line-splitting regexp and _prefilter() to avoid calling getattr()
1002 on assignments. This closes
1010 on assignments. This closes
1003 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1011 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1004 readline uses getattr(), so a simple <TAB> keypress is still
1012 readline uses getattr(), so a simple <TAB> keypress is still
1005 enough to trigger getattr() calls on an object.
1013 enough to trigger getattr() calls on an object.
1006
1014
1007 2005-01-21 Fernando Perez <fperez@colorado.edu>
1015 2005-01-21 Fernando Perez <fperez@colorado.edu>
1008
1016
1009 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1017 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1010 docstring under pylab so it doesn't mask the original.
1018 docstring under pylab so it doesn't mask the original.
1011
1019
1012 2005-01-21 *** Released version 0.6.7
1020 2005-01-21 *** Released version 0.6.7
1013
1021
1014 2005-01-21 Fernando Perez <fperez@colorado.edu>
1022 2005-01-21 Fernando Perez <fperez@colorado.edu>
1015
1023
1016 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1024 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1017 signal handling for win32 users in multithreaded mode.
1025 signal handling for win32 users in multithreaded mode.
1018
1026
1019 2005-01-17 Fernando Perez <fperez@colorado.edu>
1027 2005-01-17 Fernando Perez <fperez@colorado.edu>
1020
1028
1021 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1029 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1022 instances with no __init__. After a crash report by Norbert Nemec
1030 instances with no __init__. After a crash report by Norbert Nemec
1023 <Norbert-AT-nemec-online.de>.
1031 <Norbert-AT-nemec-online.de>.
1024
1032
1025 2005-01-14 Fernando Perez <fperez@colorado.edu>
1033 2005-01-14 Fernando Perez <fperez@colorado.edu>
1026
1034
1027 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1035 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1028 names for verbose exceptions, when multiple dotted names and the
1036 names for verbose exceptions, when multiple dotted names and the
1029 'parent' object were present on the same line.
1037 'parent' object were present on the same line.
1030
1038
1031 2005-01-11 Fernando Perez <fperez@colorado.edu>
1039 2005-01-11 Fernando Perez <fperez@colorado.edu>
1032
1040
1033 * IPython/genutils.py (flag_calls): new utility to trap and flag
1041 * IPython/genutils.py (flag_calls): new utility to trap and flag
1034 calls in functions. I need it to clean up matplotlib support.
1042 calls in functions. I need it to clean up matplotlib support.
1035 Also removed some deprecated code in genutils.
1043 Also removed some deprecated code in genutils.
1036
1044
1037 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1045 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1038 that matplotlib scripts called with %run, which don't call show()
1046 that matplotlib scripts called with %run, which don't call show()
1039 themselves, still have their plotting windows open.
1047 themselves, still have their plotting windows open.
1040
1048
1041 2005-01-05 Fernando Perez <fperez@colorado.edu>
1049 2005-01-05 Fernando Perez <fperez@colorado.edu>
1042
1050
1043 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1051 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1044 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1052 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1045
1053
1046 2004-12-19 Fernando Perez <fperez@colorado.edu>
1054 2004-12-19 Fernando Perez <fperez@colorado.edu>
1047
1055
1048 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1056 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1049 parent_runcode, which was an eyesore. The same result can be
1057 parent_runcode, which was an eyesore. The same result can be
1050 obtained with Python's regular superclass mechanisms.
1058 obtained with Python's regular superclass mechanisms.
1051
1059
1052 2004-12-17 Fernando Perez <fperez@colorado.edu>
1060 2004-12-17 Fernando Perez <fperez@colorado.edu>
1053
1061
1054 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1062 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1055 reported by Prabhu.
1063 reported by Prabhu.
1056 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1064 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1057 sys.stderr) instead of explicitly calling sys.stderr. This helps
1065 sys.stderr) instead of explicitly calling sys.stderr. This helps
1058 maintain our I/O abstractions clean, for future GUI embeddings.
1066 maintain our I/O abstractions clean, for future GUI embeddings.
1059
1067
1060 * IPython/genutils.py (info): added new utility for sys.stderr
1068 * IPython/genutils.py (info): added new utility for sys.stderr
1061 unified info message handling (thin wrapper around warn()).
1069 unified info message handling (thin wrapper around warn()).
1062
1070
1063 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1071 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1064 composite (dotted) names on verbose exceptions.
1072 composite (dotted) names on verbose exceptions.
1065 (VerboseTB.nullrepr): harden against another kind of errors which
1073 (VerboseTB.nullrepr): harden against another kind of errors which
1066 Python's inspect module can trigger, and which were crashing
1074 Python's inspect module can trigger, and which were crashing
1067 IPython. Thanks to a report by Marco Lombardi
1075 IPython. Thanks to a report by Marco Lombardi
1068 <mlombard-AT-ma010192.hq.eso.org>.
1076 <mlombard-AT-ma010192.hq.eso.org>.
1069
1077
1070 2004-12-13 *** Released version 0.6.6
1078 2004-12-13 *** Released version 0.6.6
1071
1079
1072 2004-12-12 Fernando Perez <fperez@colorado.edu>
1080 2004-12-12 Fernando Perez <fperez@colorado.edu>
1073
1081
1074 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1082 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1075 generated by pygtk upon initialization if it was built without
1083 generated by pygtk upon initialization if it was built without
1076 threads (for matplotlib users). After a crash reported by
1084 threads (for matplotlib users). After a crash reported by
1077 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1085 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1078
1086
1079 * IPython/ipmaker.py (make_IPython): fix small bug in the
1087 * IPython/ipmaker.py (make_IPython): fix small bug in the
1080 import_some parameter for multiple imports.
1088 import_some parameter for multiple imports.
1081
1089
1082 * IPython/iplib.py (ipmagic): simplified the interface of
1090 * IPython/iplib.py (ipmagic): simplified the interface of
1083 ipmagic() to take a single string argument, just as it would be
1091 ipmagic() to take a single string argument, just as it would be
1084 typed at the IPython cmd line.
1092 typed at the IPython cmd line.
1085 (ipalias): Added new ipalias() with an interface identical to
1093 (ipalias): Added new ipalias() with an interface identical to
1086 ipmagic(). This completes exposing a pure python interface to the
1094 ipmagic(). This completes exposing a pure python interface to the
1087 alias and magic system, which can be used in loops or more complex
1095 alias and magic system, which can be used in loops or more complex
1088 code where IPython's automatic line mangling is not active.
1096 code where IPython's automatic line mangling is not active.
1089
1097
1090 * IPython/genutils.py (timing): changed interface of timing to
1098 * IPython/genutils.py (timing): changed interface of timing to
1091 simply run code once, which is the most common case. timings()
1099 simply run code once, which is the most common case. timings()
1092 remains unchanged, for the cases where you want multiple runs.
1100 remains unchanged, for the cases where you want multiple runs.
1093
1101
1094 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1102 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1095 bug where Python2.2 crashes with exec'ing code which does not end
1103 bug where Python2.2 crashes with exec'ing code which does not end
1096 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1104 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1097 before.
1105 before.
1098
1106
1099 2004-12-10 Fernando Perez <fperez@colorado.edu>
1107 2004-12-10 Fernando Perez <fperez@colorado.edu>
1100
1108
1101 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1109 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1102 -t to -T, to accomodate the new -t flag in %run (the %run and
1110 -t to -T, to accomodate the new -t flag in %run (the %run and
1103 %prun options are kind of intermixed, and it's not easy to change
1111 %prun options are kind of intermixed, and it's not easy to change
1104 this with the limitations of python's getopt).
1112 this with the limitations of python's getopt).
1105
1113
1106 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1114 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1107 the execution of scripts. It's not as fine-tuned as timeit.py,
1115 the execution of scripts. It's not as fine-tuned as timeit.py,
1108 but it works from inside ipython (and under 2.2, which lacks
1116 but it works from inside ipython (and under 2.2, which lacks
1109 timeit.py). Optionally a number of runs > 1 can be given for
1117 timeit.py). Optionally a number of runs > 1 can be given for
1110 timing very short-running code.
1118 timing very short-running code.
1111
1119
1112 * IPython/genutils.py (uniq_stable): new routine which returns a
1120 * IPython/genutils.py (uniq_stable): new routine which returns a
1113 list of unique elements in any iterable, but in stable order of
1121 list of unique elements in any iterable, but in stable order of
1114 appearance. I needed this for the ultraTB fixes, and it's a handy
1122 appearance. I needed this for the ultraTB fixes, and it's a handy
1115 utility.
1123 utility.
1116
1124
1117 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1125 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1118 dotted names in Verbose exceptions. This had been broken since
1126 dotted names in Verbose exceptions. This had been broken since
1119 the very start, now x.y will properly be printed in a Verbose
1127 the very start, now x.y will properly be printed in a Verbose
1120 traceback, instead of x being shown and y appearing always as an
1128 traceback, instead of x being shown and y appearing always as an
1121 'undefined global'. Getting this to work was a bit tricky,
1129 'undefined global'. Getting this to work was a bit tricky,
1122 because by default python tokenizers are stateless. Saved by
1130 because by default python tokenizers are stateless. Saved by
1123 python's ability to easily add a bit of state to an arbitrary
1131 python's ability to easily add a bit of state to an arbitrary
1124 function (without needing to build a full-blown callable object).
1132 function (without needing to build a full-blown callable object).
1125
1133
1126 Also big cleanup of this code, which had horrendous runtime
1134 Also big cleanup of this code, which had horrendous runtime
1127 lookups of zillions of attributes for colorization. Moved all
1135 lookups of zillions of attributes for colorization. Moved all
1128 this code into a few templates, which make it cleaner and quicker.
1136 this code into a few templates, which make it cleaner and quicker.
1129
1137
1130 Printout quality was also improved for Verbose exceptions: one
1138 Printout quality was also improved for Verbose exceptions: one
1131 variable per line, and memory addresses are printed (this can be
1139 variable per line, and memory addresses are printed (this can be
1132 quite handy in nasty debugging situations, which is what Verbose
1140 quite handy in nasty debugging situations, which is what Verbose
1133 is for).
1141 is for).
1134
1142
1135 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1143 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1136 the command line as scripts to be loaded by embedded instances.
1144 the command line as scripts to be loaded by embedded instances.
1137 Doing so has the potential for an infinite recursion if there are
1145 Doing so has the potential for an infinite recursion if there are
1138 exceptions thrown in the process. This fixes a strange crash
1146 exceptions thrown in the process. This fixes a strange crash
1139 reported by Philippe MULLER <muller-AT-irit.fr>.
1147 reported by Philippe MULLER <muller-AT-irit.fr>.
1140
1148
1141 2004-12-09 Fernando Perez <fperez@colorado.edu>
1149 2004-12-09 Fernando Perez <fperez@colorado.edu>
1142
1150
1143 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1151 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1144 to reflect new names in matplotlib, which now expose the
1152 to reflect new names in matplotlib, which now expose the
1145 matlab-compatible interface via a pylab module instead of the
1153 matlab-compatible interface via a pylab module instead of the
1146 'matlab' name. The new code is backwards compatible, so users of
1154 'matlab' name. The new code is backwards compatible, so users of
1147 all matplotlib versions are OK. Patch by J. Hunter.
1155 all matplotlib versions are OK. Patch by J. Hunter.
1148
1156
1149 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1157 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1150 of __init__ docstrings for instances (class docstrings are already
1158 of __init__ docstrings for instances (class docstrings are already
1151 automatically printed). Instances with customized docstrings
1159 automatically printed). Instances with customized docstrings
1152 (indep. of the class) are also recognized and all 3 separate
1160 (indep. of the class) are also recognized and all 3 separate
1153 docstrings are printed (instance, class, constructor). After some
1161 docstrings are printed (instance, class, constructor). After some
1154 comments/suggestions by J. Hunter.
1162 comments/suggestions by J. Hunter.
1155
1163
1156 2004-12-05 Fernando Perez <fperez@colorado.edu>
1164 2004-12-05 Fernando Perez <fperez@colorado.edu>
1157
1165
1158 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1166 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1159 warnings when tab-completion fails and triggers an exception.
1167 warnings when tab-completion fails and triggers an exception.
1160
1168
1161 2004-12-03 Fernando Perez <fperez@colorado.edu>
1169 2004-12-03 Fernando Perez <fperez@colorado.edu>
1162
1170
1163 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1171 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1164 be triggered when using 'run -p'. An incorrect option flag was
1172 be triggered when using 'run -p'. An incorrect option flag was
1165 being set ('d' instead of 'D').
1173 being set ('d' instead of 'D').
1166 (manpage): fix missing escaped \- sign.
1174 (manpage): fix missing escaped \- sign.
1167
1175
1168 2004-11-30 *** Released version 0.6.5
1176 2004-11-30 *** Released version 0.6.5
1169
1177
1170 2004-11-30 Fernando Perez <fperez@colorado.edu>
1178 2004-11-30 Fernando Perez <fperez@colorado.edu>
1171
1179
1172 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1180 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1173 setting with -d option.
1181 setting with -d option.
1174
1182
1175 * setup.py (docfiles): Fix problem where the doc glob I was using
1183 * setup.py (docfiles): Fix problem where the doc glob I was using
1176 was COMPLETELY BROKEN. It was giving the right files by pure
1184 was COMPLETELY BROKEN. It was giving the right files by pure
1177 accident, but failed once I tried to include ipython.el. Note:
1185 accident, but failed once I tried to include ipython.el. Note:
1178 glob() does NOT allow you to do exclusion on multiple endings!
1186 glob() does NOT allow you to do exclusion on multiple endings!
1179
1187
1180 2004-11-29 Fernando Perez <fperez@colorado.edu>
1188 2004-11-29 Fernando Perez <fperez@colorado.edu>
1181
1189
1182 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1190 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1183 the manpage as the source. Better formatting & consistency.
1191 the manpage as the source. Better formatting & consistency.
1184
1192
1185 * IPython/Magic.py (magic_run): Added new -d option, to run
1193 * IPython/Magic.py (magic_run): Added new -d option, to run
1186 scripts under the control of the python pdb debugger. Note that
1194 scripts under the control of the python pdb debugger. Note that
1187 this required changing the %prun option -d to -D, to avoid a clash
1195 this required changing the %prun option -d to -D, to avoid a clash
1188 (since %run must pass options to %prun, and getopt is too dumb to
1196 (since %run must pass options to %prun, and getopt is too dumb to
1189 handle options with string values with embedded spaces). Thanks
1197 handle options with string values with embedded spaces). Thanks
1190 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1198 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1191 (magic_who_ls): added type matching to %who and %whos, so that one
1199 (magic_who_ls): added type matching to %who and %whos, so that one
1192 can filter their output to only include variables of certain
1200 can filter their output to only include variables of certain
1193 types. Another suggestion by Matthew.
1201 types. Another suggestion by Matthew.
1194 (magic_whos): Added memory summaries in kb and Mb for arrays.
1202 (magic_whos): Added memory summaries in kb and Mb for arrays.
1195 (magic_who): Improve formatting (break lines every 9 vars).
1203 (magic_who): Improve formatting (break lines every 9 vars).
1196
1204
1197 2004-11-28 Fernando Perez <fperez@colorado.edu>
1205 2004-11-28 Fernando Perez <fperez@colorado.edu>
1198
1206
1199 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1207 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1200 cache when empty lines were present.
1208 cache when empty lines were present.
1201
1209
1202 2004-11-24 Fernando Perez <fperez@colorado.edu>
1210 2004-11-24 Fernando Perez <fperez@colorado.edu>
1203
1211
1204 * IPython/usage.py (__doc__): document the re-activated threading
1212 * IPython/usage.py (__doc__): document the re-activated threading
1205 options for WX and GTK.
1213 options for WX and GTK.
1206
1214
1207 2004-11-23 Fernando Perez <fperez@colorado.edu>
1215 2004-11-23 Fernando Perez <fperez@colorado.edu>
1208
1216
1209 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1217 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1210 the -wthread and -gthread options, along with a new -tk one to try
1218 the -wthread and -gthread options, along with a new -tk one to try
1211 and coordinate Tk threading with wx/gtk. The tk support is very
1219 and coordinate Tk threading with wx/gtk. The tk support is very
1212 platform dependent, since it seems to require Tcl and Tk to be
1220 platform dependent, since it seems to require Tcl and Tk to be
1213 built with threads (Fedora1/2 appears NOT to have it, but in
1221 built with threads (Fedora1/2 appears NOT to have it, but in
1214 Prabhu's Debian boxes it works OK). But even with some Tk
1222 Prabhu's Debian boxes it works OK). But even with some Tk
1215 limitations, this is a great improvement.
1223 limitations, this is a great improvement.
1216
1224
1217 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1225 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1218 info in user prompts. Patch by Prabhu.
1226 info in user prompts. Patch by Prabhu.
1219
1227
1220 2004-11-18 Fernando Perez <fperez@colorado.edu>
1228 2004-11-18 Fernando Perez <fperez@colorado.edu>
1221
1229
1222 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1230 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1223 EOFErrors and bail, to avoid infinite loops if a non-terminating
1231 EOFErrors and bail, to avoid infinite loops if a non-terminating
1224 file is fed into ipython. Patch submitted in issue 19 by user,
1232 file is fed into ipython. Patch submitted in issue 19 by user,
1225 many thanks.
1233 many thanks.
1226
1234
1227 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1235 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1228 autoquote/parens in continuation prompts, which can cause lots of
1236 autoquote/parens in continuation prompts, which can cause lots of
1229 problems. Closes roundup issue 20.
1237 problems. Closes roundup issue 20.
1230
1238
1231 2004-11-17 Fernando Perez <fperez@colorado.edu>
1239 2004-11-17 Fernando Perez <fperez@colorado.edu>
1232
1240
1233 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1241 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1234 reported as debian bug #280505. I'm not sure my local changelog
1242 reported as debian bug #280505. I'm not sure my local changelog
1235 entry has the proper debian format (Jack?).
1243 entry has the proper debian format (Jack?).
1236
1244
1237 2004-11-08 *** Released version 0.6.4
1245 2004-11-08 *** Released version 0.6.4
1238
1246
1239 2004-11-08 Fernando Perez <fperez@colorado.edu>
1247 2004-11-08 Fernando Perez <fperez@colorado.edu>
1240
1248
1241 * IPython/iplib.py (init_readline): Fix exit message for Windows
1249 * IPython/iplib.py (init_readline): Fix exit message for Windows
1242 when readline is active. Thanks to a report by Eric Jones
1250 when readline is active. Thanks to a report by Eric Jones
1243 <eric-AT-enthought.com>.
1251 <eric-AT-enthought.com>.
1244
1252
1245 2004-11-07 Fernando Perez <fperez@colorado.edu>
1253 2004-11-07 Fernando Perez <fperez@colorado.edu>
1246
1254
1247 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1255 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1248 sometimes seen by win2k/cygwin users.
1256 sometimes seen by win2k/cygwin users.
1249
1257
1250 2004-11-06 Fernando Perez <fperez@colorado.edu>
1258 2004-11-06 Fernando Perez <fperez@colorado.edu>
1251
1259
1252 * IPython/iplib.py (interact): Change the handling of %Exit from
1260 * IPython/iplib.py (interact): Change the handling of %Exit from
1253 trying to propagate a SystemExit to an internal ipython flag.
1261 trying to propagate a SystemExit to an internal ipython flag.
1254 This is less elegant than using Python's exception mechanism, but
1262 This is less elegant than using Python's exception mechanism, but
1255 I can't get that to work reliably with threads, so under -pylab
1263 I can't get that to work reliably with threads, so under -pylab
1256 %Exit was hanging IPython. Cross-thread exception handling is
1264 %Exit was hanging IPython. Cross-thread exception handling is
1257 really a bitch. Thaks to a bug report by Stephen Walton
1265 really a bitch. Thaks to a bug report by Stephen Walton
1258 <stephen.walton-AT-csun.edu>.
1266 <stephen.walton-AT-csun.edu>.
1259
1267
1260 2004-11-04 Fernando Perez <fperez@colorado.edu>
1268 2004-11-04 Fernando Perez <fperez@colorado.edu>
1261
1269
1262 * IPython/iplib.py (raw_input_original): store a pointer to the
1270 * IPython/iplib.py (raw_input_original): store a pointer to the
1263 true raw_input to harden against code which can modify it
1271 true raw_input to harden against code which can modify it
1264 (wx.py.PyShell does this and would otherwise crash ipython).
1272 (wx.py.PyShell does this and would otherwise crash ipython).
1265 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1273 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1266
1274
1267 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1275 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1268 Ctrl-C problem, which does not mess up the input line.
1276 Ctrl-C problem, which does not mess up the input line.
1269
1277
1270 2004-11-03 Fernando Perez <fperez@colorado.edu>
1278 2004-11-03 Fernando Perez <fperez@colorado.edu>
1271
1279
1272 * IPython/Release.py: Changed licensing to BSD, in all files.
1280 * IPython/Release.py: Changed licensing to BSD, in all files.
1273 (name): lowercase name for tarball/RPM release.
1281 (name): lowercase name for tarball/RPM release.
1274
1282
1275 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1283 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1276 use throughout ipython.
1284 use throughout ipython.
1277
1285
1278 * IPython/Magic.py (Magic._ofind): Switch to using the new
1286 * IPython/Magic.py (Magic._ofind): Switch to using the new
1279 OInspect.getdoc() function.
1287 OInspect.getdoc() function.
1280
1288
1281 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1289 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1282 of the line currently being canceled via Ctrl-C. It's extremely
1290 of the line currently being canceled via Ctrl-C. It's extremely
1283 ugly, but I don't know how to do it better (the problem is one of
1291 ugly, but I don't know how to do it better (the problem is one of
1284 handling cross-thread exceptions).
1292 handling cross-thread exceptions).
1285
1293
1286 2004-10-28 Fernando Perez <fperez@colorado.edu>
1294 2004-10-28 Fernando Perez <fperez@colorado.edu>
1287
1295
1288 * IPython/Shell.py (signal_handler): add signal handlers to trap
1296 * IPython/Shell.py (signal_handler): add signal handlers to trap
1289 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1297 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1290 report by Francesc Alted.
1298 report by Francesc Alted.
1291
1299
1292 2004-10-21 Fernando Perez <fperez@colorado.edu>
1300 2004-10-21 Fernando Perez <fperez@colorado.edu>
1293
1301
1294 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1302 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1295 to % for pysh syntax extensions.
1303 to % for pysh syntax extensions.
1296
1304
1297 2004-10-09 Fernando Perez <fperez@colorado.edu>
1305 2004-10-09 Fernando Perez <fperez@colorado.edu>
1298
1306
1299 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1307 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1300 arrays to print a more useful summary, without calling str(arr).
1308 arrays to print a more useful summary, without calling str(arr).
1301 This avoids the problem of extremely lengthy computations which
1309 This avoids the problem of extremely lengthy computations which
1302 occur if arr is large, and appear to the user as a system lockup
1310 occur if arr is large, and appear to the user as a system lockup
1303 with 100% cpu activity. After a suggestion by Kristian Sandberg
1311 with 100% cpu activity. After a suggestion by Kristian Sandberg
1304 <Kristian.Sandberg@colorado.edu>.
1312 <Kristian.Sandberg@colorado.edu>.
1305 (Magic.__init__): fix bug in global magic escapes not being
1313 (Magic.__init__): fix bug in global magic escapes not being
1306 correctly set.
1314 correctly set.
1307
1315
1308 2004-10-08 Fernando Perez <fperez@colorado.edu>
1316 2004-10-08 Fernando Perez <fperez@colorado.edu>
1309
1317
1310 * IPython/Magic.py (__license__): change to absolute imports of
1318 * IPython/Magic.py (__license__): change to absolute imports of
1311 ipython's own internal packages, to start adapting to the absolute
1319 ipython's own internal packages, to start adapting to the absolute
1312 import requirement of PEP-328.
1320 import requirement of PEP-328.
1313
1321
1314 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1322 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1315 files, and standardize author/license marks through the Release
1323 files, and standardize author/license marks through the Release
1316 module instead of having per/file stuff (except for files with
1324 module instead of having per/file stuff (except for files with
1317 particular licenses, like the MIT/PSF-licensed codes).
1325 particular licenses, like the MIT/PSF-licensed codes).
1318
1326
1319 * IPython/Debugger.py: remove dead code for python 2.1
1327 * IPython/Debugger.py: remove dead code for python 2.1
1320
1328
1321 2004-10-04 Fernando Perez <fperez@colorado.edu>
1329 2004-10-04 Fernando Perez <fperez@colorado.edu>
1322
1330
1323 * IPython/iplib.py (ipmagic): New function for accessing magics
1331 * IPython/iplib.py (ipmagic): New function for accessing magics
1324 via a normal python function call.
1332 via a normal python function call.
1325
1333
1326 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1334 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1327 from '@' to '%', to accomodate the new @decorator syntax of python
1335 from '@' to '%', to accomodate the new @decorator syntax of python
1328 2.4.
1336 2.4.
1329
1337
1330 2004-09-29 Fernando Perez <fperez@colorado.edu>
1338 2004-09-29 Fernando Perez <fperez@colorado.edu>
1331
1339
1332 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1340 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1333 matplotlib.use to prevent running scripts which try to switch
1341 matplotlib.use to prevent running scripts which try to switch
1334 interactive backends from within ipython. This will just crash
1342 interactive backends from within ipython. This will just crash
1335 the python interpreter, so we can't allow it (but a detailed error
1343 the python interpreter, so we can't allow it (but a detailed error
1336 is given to the user).
1344 is given to the user).
1337
1345
1338 2004-09-28 Fernando Perez <fperez@colorado.edu>
1346 2004-09-28 Fernando Perez <fperez@colorado.edu>
1339
1347
1340 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1348 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1341 matplotlib-related fixes so that using @run with non-matplotlib
1349 matplotlib-related fixes so that using @run with non-matplotlib
1342 scripts doesn't pop up spurious plot windows. This requires
1350 scripts doesn't pop up spurious plot windows. This requires
1343 matplotlib >= 0.63, where I had to make some changes as well.
1351 matplotlib >= 0.63, where I had to make some changes as well.
1344
1352
1345 * IPython/ipmaker.py (make_IPython): update version requirement to
1353 * IPython/ipmaker.py (make_IPython): update version requirement to
1346 python 2.2.
1354 python 2.2.
1347
1355
1348 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1356 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1349 banner arg for embedded customization.
1357 banner arg for embedded customization.
1350
1358
1351 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1359 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1352 explicit uses of __IP as the IPython's instance name. Now things
1360 explicit uses of __IP as the IPython's instance name. Now things
1353 are properly handled via the shell.name value. The actual code
1361 are properly handled via the shell.name value. The actual code
1354 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1362 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1355 is much better than before. I'll clean things completely when the
1363 is much better than before. I'll clean things completely when the
1356 magic stuff gets a real overhaul.
1364 magic stuff gets a real overhaul.
1357
1365
1358 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1366 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1359 minor changes to debian dir.
1367 minor changes to debian dir.
1360
1368
1361 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1369 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1362 pointer to the shell itself in the interactive namespace even when
1370 pointer to the shell itself in the interactive namespace even when
1363 a user-supplied dict is provided. This is needed for embedding
1371 a user-supplied dict is provided. This is needed for embedding
1364 purposes (found by tests with Michel Sanner).
1372 purposes (found by tests with Michel Sanner).
1365
1373
1366 2004-09-27 Fernando Perez <fperez@colorado.edu>
1374 2004-09-27 Fernando Perez <fperez@colorado.edu>
1367
1375
1368 * IPython/UserConfig/ipythonrc: remove []{} from
1376 * IPython/UserConfig/ipythonrc: remove []{} from
1369 readline_remove_delims, so that things like [modname.<TAB> do
1377 readline_remove_delims, so that things like [modname.<TAB> do
1370 proper completion. This disables [].TAB, but that's a less common
1378 proper completion. This disables [].TAB, but that's a less common
1371 case than module names in list comprehensions, for example.
1379 case than module names in list comprehensions, for example.
1372 Thanks to a report by Andrea Riciputi.
1380 Thanks to a report by Andrea Riciputi.
1373
1381
1374 2004-09-09 Fernando Perez <fperez@colorado.edu>
1382 2004-09-09 Fernando Perez <fperez@colorado.edu>
1375
1383
1376 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1384 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1377 blocking problems in win32 and osx. Fix by John.
1385 blocking problems in win32 and osx. Fix by John.
1378
1386
1379 2004-09-08 Fernando Perez <fperez@colorado.edu>
1387 2004-09-08 Fernando Perez <fperez@colorado.edu>
1380
1388
1381 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1389 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1382 for Win32 and OSX. Fix by John Hunter.
1390 for Win32 and OSX. Fix by John Hunter.
1383
1391
1384 2004-08-30 *** Released version 0.6.3
1392 2004-08-30 *** Released version 0.6.3
1385
1393
1386 2004-08-30 Fernando Perez <fperez@colorado.edu>
1394 2004-08-30 Fernando Perez <fperez@colorado.edu>
1387
1395
1388 * setup.py (isfile): Add manpages to list of dependent files to be
1396 * setup.py (isfile): Add manpages to list of dependent files to be
1389 updated.
1397 updated.
1390
1398
1391 2004-08-27 Fernando Perez <fperez@colorado.edu>
1399 2004-08-27 Fernando Perez <fperez@colorado.edu>
1392
1400
1393 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1401 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1394 for now. They don't really work with standalone WX/GTK code
1402 for now. They don't really work with standalone WX/GTK code
1395 (though matplotlib IS working fine with both of those backends).
1403 (though matplotlib IS working fine with both of those backends).
1396 This will neeed much more testing. I disabled most things with
1404 This will neeed much more testing. I disabled most things with
1397 comments, so turning it back on later should be pretty easy.
1405 comments, so turning it back on later should be pretty easy.
1398
1406
1399 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1407 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1400 autocalling of expressions like r'foo', by modifying the line
1408 autocalling of expressions like r'foo', by modifying the line
1401 split regexp. Closes
1409 split regexp. Closes
1402 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1410 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1403 Riley <ipythonbugs-AT-sabi.net>.
1411 Riley <ipythonbugs-AT-sabi.net>.
1404 (InteractiveShell.mainloop): honor --nobanner with banner
1412 (InteractiveShell.mainloop): honor --nobanner with banner
1405 extensions.
1413 extensions.
1406
1414
1407 * IPython/Shell.py: Significant refactoring of all classes, so
1415 * IPython/Shell.py: Significant refactoring of all classes, so
1408 that we can really support ALL matplotlib backends and threading
1416 that we can really support ALL matplotlib backends and threading
1409 models (John spotted a bug with Tk which required this). Now we
1417 models (John spotted a bug with Tk which required this). Now we
1410 should support single-threaded, WX-threads and GTK-threads, both
1418 should support single-threaded, WX-threads and GTK-threads, both
1411 for generic code and for matplotlib.
1419 for generic code and for matplotlib.
1412
1420
1413 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1421 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1414 -pylab, to simplify things for users. Will also remove the pylab
1422 -pylab, to simplify things for users. Will also remove the pylab
1415 profile, since now all of matplotlib configuration is directly
1423 profile, since now all of matplotlib configuration is directly
1416 handled here. This also reduces startup time.
1424 handled here. This also reduces startup time.
1417
1425
1418 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1426 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1419 shell wasn't being correctly called. Also in IPShellWX.
1427 shell wasn't being correctly called. Also in IPShellWX.
1420
1428
1421 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1429 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1422 fine-tune banner.
1430 fine-tune banner.
1423
1431
1424 * IPython/numutils.py (spike): Deprecate these spike functions,
1432 * IPython/numutils.py (spike): Deprecate these spike functions,
1425 delete (long deprecated) gnuplot_exec handler.
1433 delete (long deprecated) gnuplot_exec handler.
1426
1434
1427 2004-08-26 Fernando Perez <fperez@colorado.edu>
1435 2004-08-26 Fernando Perez <fperez@colorado.edu>
1428
1436
1429 * ipython.1: Update for threading options, plus some others which
1437 * ipython.1: Update for threading options, plus some others which
1430 were missing.
1438 were missing.
1431
1439
1432 * IPython/ipmaker.py (__call__): Added -wthread option for
1440 * IPython/ipmaker.py (__call__): Added -wthread option for
1433 wxpython thread handling. Make sure threading options are only
1441 wxpython thread handling. Make sure threading options are only
1434 valid at the command line.
1442 valid at the command line.
1435
1443
1436 * scripts/ipython: moved shell selection into a factory function
1444 * scripts/ipython: moved shell selection into a factory function
1437 in Shell.py, to keep the starter script to a minimum.
1445 in Shell.py, to keep the starter script to a minimum.
1438
1446
1439 2004-08-25 Fernando Perez <fperez@colorado.edu>
1447 2004-08-25 Fernando Perez <fperez@colorado.edu>
1440
1448
1441 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1449 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1442 John. Along with some recent changes he made to matplotlib, the
1450 John. Along with some recent changes he made to matplotlib, the
1443 next versions of both systems should work very well together.
1451 next versions of both systems should work very well together.
1444
1452
1445 2004-08-24 Fernando Perez <fperez@colorado.edu>
1453 2004-08-24 Fernando Perez <fperez@colorado.edu>
1446
1454
1447 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1455 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1448 tried to switch the profiling to using hotshot, but I'm getting
1456 tried to switch the profiling to using hotshot, but I'm getting
1449 strange errors from prof.runctx() there. I may be misreading the
1457 strange errors from prof.runctx() there. I may be misreading the
1450 docs, but it looks weird. For now the profiling code will
1458 docs, but it looks weird. For now the profiling code will
1451 continue to use the standard profiler.
1459 continue to use the standard profiler.
1452
1460
1453 2004-08-23 Fernando Perez <fperez@colorado.edu>
1461 2004-08-23 Fernando Perez <fperez@colorado.edu>
1454
1462
1455 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1463 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1456 threaded shell, by John Hunter. It's not quite ready yet, but
1464 threaded shell, by John Hunter. It's not quite ready yet, but
1457 close.
1465 close.
1458
1466
1459 2004-08-22 Fernando Perez <fperez@colorado.edu>
1467 2004-08-22 Fernando Perez <fperez@colorado.edu>
1460
1468
1461 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1469 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1462 in Magic and ultraTB.
1470 in Magic and ultraTB.
1463
1471
1464 * ipython.1: document threading options in manpage.
1472 * ipython.1: document threading options in manpage.
1465
1473
1466 * scripts/ipython: Changed name of -thread option to -gthread,
1474 * scripts/ipython: Changed name of -thread option to -gthread,
1467 since this is GTK specific. I want to leave the door open for a
1475 since this is GTK specific. I want to leave the door open for a
1468 -wthread option for WX, which will most likely be necessary. This
1476 -wthread option for WX, which will most likely be necessary. This
1469 change affects usage and ipmaker as well.
1477 change affects usage and ipmaker as well.
1470
1478
1471 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1479 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1472 handle the matplotlib shell issues. Code by John Hunter
1480 handle the matplotlib shell issues. Code by John Hunter
1473 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1481 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1474 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1482 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1475 broken (and disabled for end users) for now, but it puts the
1483 broken (and disabled for end users) for now, but it puts the
1476 infrastructure in place.
1484 infrastructure in place.
1477
1485
1478 2004-08-21 Fernando Perez <fperez@colorado.edu>
1486 2004-08-21 Fernando Perez <fperez@colorado.edu>
1479
1487
1480 * ipythonrc-pylab: Add matplotlib support.
1488 * ipythonrc-pylab: Add matplotlib support.
1481
1489
1482 * matplotlib_config.py: new files for matplotlib support, part of
1490 * matplotlib_config.py: new files for matplotlib support, part of
1483 the pylab profile.
1491 the pylab profile.
1484
1492
1485 * IPython/usage.py (__doc__): documented the threading options.
1493 * IPython/usage.py (__doc__): documented the threading options.
1486
1494
1487 2004-08-20 Fernando Perez <fperez@colorado.edu>
1495 2004-08-20 Fernando Perez <fperez@colorado.edu>
1488
1496
1489 * ipython: Modified the main calling routine to handle the -thread
1497 * ipython: Modified the main calling routine to handle the -thread
1490 and -mpthread options. This needs to be done as a top-level hack,
1498 and -mpthread options. This needs to be done as a top-level hack,
1491 because it determines which class to instantiate for IPython
1499 because it determines which class to instantiate for IPython
1492 itself.
1500 itself.
1493
1501
1494 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1502 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1495 classes to support multithreaded GTK operation without blocking,
1503 classes to support multithreaded GTK operation without blocking,
1496 and matplotlib with all backends. This is a lot of still very
1504 and matplotlib with all backends. This is a lot of still very
1497 experimental code, and threads are tricky. So it may still have a
1505 experimental code, and threads are tricky. So it may still have a
1498 few rough edges... This code owes a lot to
1506 few rough edges... This code owes a lot to
1499 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1507 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1500 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1508 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1501 to John Hunter for all the matplotlib work.
1509 to John Hunter for all the matplotlib work.
1502
1510
1503 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1511 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1504 options for gtk thread and matplotlib support.
1512 options for gtk thread and matplotlib support.
1505
1513
1506 2004-08-16 Fernando Perez <fperez@colorado.edu>
1514 2004-08-16 Fernando Perez <fperez@colorado.edu>
1507
1515
1508 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1516 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1509 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1517 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1510 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1518 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1511
1519
1512 2004-08-11 Fernando Perez <fperez@colorado.edu>
1520 2004-08-11 Fernando Perez <fperez@colorado.edu>
1513
1521
1514 * setup.py (isfile): Fix build so documentation gets updated for
1522 * setup.py (isfile): Fix build so documentation gets updated for
1515 rpms (it was only done for .tgz builds).
1523 rpms (it was only done for .tgz builds).
1516
1524
1517 2004-08-10 Fernando Perez <fperez@colorado.edu>
1525 2004-08-10 Fernando Perez <fperez@colorado.edu>
1518
1526
1519 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1527 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1520
1528
1521 * iplib.py : Silence syntax error exceptions in tab-completion.
1529 * iplib.py : Silence syntax error exceptions in tab-completion.
1522
1530
1523 2004-08-05 Fernando Perez <fperez@colorado.edu>
1531 2004-08-05 Fernando Perez <fperez@colorado.edu>
1524
1532
1525 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1533 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1526 'color off' mark for continuation prompts. This was causing long
1534 'color off' mark for continuation prompts. This was causing long
1527 continuation lines to mis-wrap.
1535 continuation lines to mis-wrap.
1528
1536
1529 2004-08-01 Fernando Perez <fperez@colorado.edu>
1537 2004-08-01 Fernando Perez <fperez@colorado.edu>
1530
1538
1531 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1539 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1532 for building ipython to be a parameter. All this is necessary
1540 for building ipython to be a parameter. All this is necessary
1533 right now to have a multithreaded version, but this insane
1541 right now to have a multithreaded version, but this insane
1534 non-design will be cleaned up soon. For now, it's a hack that
1542 non-design will be cleaned up soon. For now, it's a hack that
1535 works.
1543 works.
1536
1544
1537 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1545 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1538 args in various places. No bugs so far, but it's a dangerous
1546 args in various places. No bugs so far, but it's a dangerous
1539 practice.
1547 practice.
1540
1548
1541 2004-07-31 Fernando Perez <fperez@colorado.edu>
1549 2004-07-31 Fernando Perez <fperez@colorado.edu>
1542
1550
1543 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1551 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1544 fix completion of files with dots in their names under most
1552 fix completion of files with dots in their names under most
1545 profiles (pysh was OK because the completion order is different).
1553 profiles (pysh was OK because the completion order is different).
1546
1554
1547 2004-07-27 Fernando Perez <fperez@colorado.edu>
1555 2004-07-27 Fernando Perez <fperez@colorado.edu>
1548
1556
1549 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1557 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1550 keywords manually, b/c the one in keyword.py was removed in python
1558 keywords manually, b/c the one in keyword.py was removed in python
1551 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1559 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1552 This is NOT a bug under python 2.3 and earlier.
1560 This is NOT a bug under python 2.3 and earlier.
1553
1561
1554 2004-07-26 Fernando Perez <fperez@colorado.edu>
1562 2004-07-26 Fernando Perez <fperez@colorado.edu>
1555
1563
1556 * IPython/ultraTB.py (VerboseTB.text): Add another
1564 * IPython/ultraTB.py (VerboseTB.text): Add another
1557 linecache.checkcache() call to try to prevent inspect.py from
1565 linecache.checkcache() call to try to prevent inspect.py from
1558 crashing under python 2.3. I think this fixes
1566 crashing under python 2.3. I think this fixes
1559 http://www.scipy.net/roundup/ipython/issue17.
1567 http://www.scipy.net/roundup/ipython/issue17.
1560
1568
1561 2004-07-26 *** Released version 0.6.2
1569 2004-07-26 *** Released version 0.6.2
1562
1570
1563 2004-07-26 Fernando Perez <fperez@colorado.edu>
1571 2004-07-26 Fernando Perez <fperez@colorado.edu>
1564
1572
1565 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1573 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1566 fail for any number.
1574 fail for any number.
1567 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1575 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1568 empty bookmarks.
1576 empty bookmarks.
1569
1577
1570 2004-07-26 *** Released version 0.6.1
1578 2004-07-26 *** Released version 0.6.1
1571
1579
1572 2004-07-26 Fernando Perez <fperez@colorado.edu>
1580 2004-07-26 Fernando Perez <fperez@colorado.edu>
1573
1581
1574 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1582 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1575
1583
1576 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1584 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1577 escaping '()[]{}' in filenames.
1585 escaping '()[]{}' in filenames.
1578
1586
1579 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1587 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1580 Python 2.2 users who lack a proper shlex.split.
1588 Python 2.2 users who lack a proper shlex.split.
1581
1589
1582 2004-07-19 Fernando Perez <fperez@colorado.edu>
1590 2004-07-19 Fernando Perez <fperez@colorado.edu>
1583
1591
1584 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1592 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1585 for reading readline's init file. I follow the normal chain:
1593 for reading readline's init file. I follow the normal chain:
1586 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1594 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1587 report by Mike Heeter. This closes
1595 report by Mike Heeter. This closes
1588 http://www.scipy.net/roundup/ipython/issue16.
1596 http://www.scipy.net/roundup/ipython/issue16.
1589
1597
1590 2004-07-18 Fernando Perez <fperez@colorado.edu>
1598 2004-07-18 Fernando Perez <fperez@colorado.edu>
1591
1599
1592 * IPython/iplib.py (__init__): Add better handling of '\' under
1600 * IPython/iplib.py (__init__): Add better handling of '\' under
1593 Win32 for filenames. After a patch by Ville.
1601 Win32 for filenames. After a patch by Ville.
1594
1602
1595 2004-07-17 Fernando Perez <fperez@colorado.edu>
1603 2004-07-17 Fernando Perez <fperez@colorado.edu>
1596
1604
1597 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1605 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1598 autocalling would be triggered for 'foo is bar' if foo is
1606 autocalling would be triggered for 'foo is bar' if foo is
1599 callable. I also cleaned up the autocall detection code to use a
1607 callable. I also cleaned up the autocall detection code to use a
1600 regexp, which is faster. Bug reported by Alexander Schmolck.
1608 regexp, which is faster. Bug reported by Alexander Schmolck.
1601
1609
1602 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1610 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1603 '?' in them would confuse the help system. Reported by Alex
1611 '?' in them would confuse the help system. Reported by Alex
1604 Schmolck.
1612 Schmolck.
1605
1613
1606 2004-07-16 Fernando Perez <fperez@colorado.edu>
1614 2004-07-16 Fernando Perez <fperez@colorado.edu>
1607
1615
1608 * IPython/GnuplotInteractive.py (__all__): added plot2.
1616 * IPython/GnuplotInteractive.py (__all__): added plot2.
1609
1617
1610 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1618 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1611 plotting dictionaries, lists or tuples of 1d arrays.
1619 plotting dictionaries, lists or tuples of 1d arrays.
1612
1620
1613 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1621 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1614 optimizations.
1622 optimizations.
1615
1623
1616 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1624 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1617 the information which was there from Janko's original IPP code:
1625 the information which was there from Janko's original IPP code:
1618
1626
1619 03.05.99 20:53 porto.ifm.uni-kiel.de
1627 03.05.99 20:53 porto.ifm.uni-kiel.de
1620 --Started changelog.
1628 --Started changelog.
1621 --make clear do what it say it does
1629 --make clear do what it say it does
1622 --added pretty output of lines from inputcache
1630 --added pretty output of lines from inputcache
1623 --Made Logger a mixin class, simplifies handling of switches
1631 --Made Logger a mixin class, simplifies handling of switches
1624 --Added own completer class. .string<TAB> expands to last history
1632 --Added own completer class. .string<TAB> expands to last history
1625 line which starts with string. The new expansion is also present
1633 line which starts with string. The new expansion is also present
1626 with Ctrl-r from the readline library. But this shows, who this
1634 with Ctrl-r from the readline library. But this shows, who this
1627 can be done for other cases.
1635 can be done for other cases.
1628 --Added convention that all shell functions should accept a
1636 --Added convention that all shell functions should accept a
1629 parameter_string This opens the door for different behaviour for
1637 parameter_string This opens the door for different behaviour for
1630 each function. @cd is a good example of this.
1638 each function. @cd is a good example of this.
1631
1639
1632 04.05.99 12:12 porto.ifm.uni-kiel.de
1640 04.05.99 12:12 porto.ifm.uni-kiel.de
1633 --added logfile rotation
1641 --added logfile rotation
1634 --added new mainloop method which freezes first the namespace
1642 --added new mainloop method which freezes first the namespace
1635
1643
1636 07.05.99 21:24 porto.ifm.uni-kiel.de
1644 07.05.99 21:24 porto.ifm.uni-kiel.de
1637 --added the docreader classes. Now there is a help system.
1645 --added the docreader classes. Now there is a help system.
1638 -This is only a first try. Currently it's not easy to put new
1646 -This is only a first try. Currently it's not easy to put new
1639 stuff in the indices. But this is the way to go. Info would be
1647 stuff in the indices. But this is the way to go. Info would be
1640 better, but HTML is every where and not everybody has an info
1648 better, but HTML is every where and not everybody has an info
1641 system installed and it's not so easy to change html-docs to info.
1649 system installed and it's not so easy to change html-docs to info.
1642 --added global logfile option
1650 --added global logfile option
1643 --there is now a hook for object inspection method pinfo needs to
1651 --there is now a hook for object inspection method pinfo needs to
1644 be provided for this. Can be reached by two '??'.
1652 be provided for this. Can be reached by two '??'.
1645
1653
1646 08.05.99 20:51 porto.ifm.uni-kiel.de
1654 08.05.99 20:51 porto.ifm.uni-kiel.de
1647 --added a README
1655 --added a README
1648 --bug in rc file. Something has changed so functions in the rc
1656 --bug in rc file. Something has changed so functions in the rc
1649 file need to reference the shell and not self. Not clear if it's a
1657 file need to reference the shell and not self. Not clear if it's a
1650 bug or feature.
1658 bug or feature.
1651 --changed rc file for new behavior
1659 --changed rc file for new behavior
1652
1660
1653 2004-07-15 Fernando Perez <fperez@colorado.edu>
1661 2004-07-15 Fernando Perez <fperez@colorado.edu>
1654
1662
1655 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1663 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1656 cache was falling out of sync in bizarre manners when multi-line
1664 cache was falling out of sync in bizarre manners when multi-line
1657 input was present. Minor optimizations and cleanup.
1665 input was present. Minor optimizations and cleanup.
1658
1666
1659 (Logger): Remove old Changelog info for cleanup. This is the
1667 (Logger): Remove old Changelog info for cleanup. This is the
1660 information which was there from Janko's original code:
1668 information which was there from Janko's original code:
1661
1669
1662 Changes to Logger: - made the default log filename a parameter
1670 Changes to Logger: - made the default log filename a parameter
1663
1671
1664 - put a check for lines beginning with !@? in log(). Needed
1672 - put a check for lines beginning with !@? in log(). Needed
1665 (even if the handlers properly log their lines) for mid-session
1673 (even if the handlers properly log their lines) for mid-session
1666 logging activation to work properly. Without this, lines logged
1674 logging activation to work properly. Without this, lines logged
1667 in mid session, which get read from the cache, would end up
1675 in mid session, which get read from the cache, would end up
1668 'bare' (with !@? in the open) in the log. Now they are caught
1676 'bare' (with !@? in the open) in the log. Now they are caught
1669 and prepended with a #.
1677 and prepended with a #.
1670
1678
1671 * IPython/iplib.py (InteractiveShell.init_readline): added check
1679 * IPython/iplib.py (InteractiveShell.init_readline): added check
1672 in case MagicCompleter fails to be defined, so we don't crash.
1680 in case MagicCompleter fails to be defined, so we don't crash.
1673
1681
1674 2004-07-13 Fernando Perez <fperez@colorado.edu>
1682 2004-07-13 Fernando Perez <fperez@colorado.edu>
1675
1683
1676 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1684 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1677 of EPS if the requested filename ends in '.eps'.
1685 of EPS if the requested filename ends in '.eps'.
1678
1686
1679 2004-07-04 Fernando Perez <fperez@colorado.edu>
1687 2004-07-04 Fernando Perez <fperez@colorado.edu>
1680
1688
1681 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1689 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1682 escaping of quotes when calling the shell.
1690 escaping of quotes when calling the shell.
1683
1691
1684 2004-07-02 Fernando Perez <fperez@colorado.edu>
1692 2004-07-02 Fernando Perez <fperez@colorado.edu>
1685
1693
1686 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1694 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1687 gettext not working because we were clobbering '_'. Fixes
1695 gettext not working because we were clobbering '_'. Fixes
1688 http://www.scipy.net/roundup/ipython/issue6.
1696 http://www.scipy.net/roundup/ipython/issue6.
1689
1697
1690 2004-07-01 Fernando Perez <fperez@colorado.edu>
1698 2004-07-01 Fernando Perez <fperez@colorado.edu>
1691
1699
1692 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1700 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1693 into @cd. Patch by Ville.
1701 into @cd. Patch by Ville.
1694
1702
1695 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1703 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1696 new function to store things after ipmaker runs. Patch by Ville.
1704 new function to store things after ipmaker runs. Patch by Ville.
1697 Eventually this will go away once ipmaker is removed and the class
1705 Eventually this will go away once ipmaker is removed and the class
1698 gets cleaned up, but for now it's ok. Key functionality here is
1706 gets cleaned up, but for now it's ok. Key functionality here is
1699 the addition of the persistent storage mechanism, a dict for
1707 the addition of the persistent storage mechanism, a dict for
1700 keeping data across sessions (for now just bookmarks, but more can
1708 keeping data across sessions (for now just bookmarks, but more can
1701 be implemented later).
1709 be implemented later).
1702
1710
1703 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1711 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1704 persistent across sections. Patch by Ville, I modified it
1712 persistent across sections. Patch by Ville, I modified it
1705 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1713 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1706 added a '-l' option to list all bookmarks.
1714 added a '-l' option to list all bookmarks.
1707
1715
1708 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1716 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1709 center for cleanup. Registered with atexit.register(). I moved
1717 center for cleanup. Registered with atexit.register(). I moved
1710 here the old exit_cleanup(). After a patch by Ville.
1718 here the old exit_cleanup(). After a patch by Ville.
1711
1719
1712 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1720 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1713 characters in the hacked shlex_split for python 2.2.
1721 characters in the hacked shlex_split for python 2.2.
1714
1722
1715 * IPython/iplib.py (file_matches): more fixes to filenames with
1723 * IPython/iplib.py (file_matches): more fixes to filenames with
1716 whitespace in them. It's not perfect, but limitations in python's
1724 whitespace in them. It's not perfect, but limitations in python's
1717 readline make it impossible to go further.
1725 readline make it impossible to go further.
1718
1726
1719 2004-06-29 Fernando Perez <fperez@colorado.edu>
1727 2004-06-29 Fernando Perez <fperez@colorado.edu>
1720
1728
1721 * IPython/iplib.py (file_matches): escape whitespace correctly in
1729 * IPython/iplib.py (file_matches): escape whitespace correctly in
1722 filename completions. Bug reported by Ville.
1730 filename completions. Bug reported by Ville.
1723
1731
1724 2004-06-28 Fernando Perez <fperez@colorado.edu>
1732 2004-06-28 Fernando Perez <fperez@colorado.edu>
1725
1733
1726 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1734 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1727 the history file will be called 'history-PROFNAME' (or just
1735 the history file will be called 'history-PROFNAME' (or just
1728 'history' if no profile is loaded). I was getting annoyed at
1736 'history' if no profile is loaded). I was getting annoyed at
1729 getting my Numerical work history clobbered by pysh sessions.
1737 getting my Numerical work history clobbered by pysh sessions.
1730
1738
1731 * IPython/iplib.py (InteractiveShell.__init__): Internal
1739 * IPython/iplib.py (InteractiveShell.__init__): Internal
1732 getoutputerror() function so that we can honor the system_verbose
1740 getoutputerror() function so that we can honor the system_verbose
1733 flag for _all_ system calls. I also added escaping of #
1741 flag for _all_ system calls. I also added escaping of #
1734 characters here to avoid confusing Itpl.
1742 characters here to avoid confusing Itpl.
1735
1743
1736 * IPython/Magic.py (shlex_split): removed call to shell in
1744 * IPython/Magic.py (shlex_split): removed call to shell in
1737 parse_options and replaced it with shlex.split(). The annoying
1745 parse_options and replaced it with shlex.split(). The annoying
1738 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1746 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1739 to backport it from 2.3, with several frail hacks (the shlex
1747 to backport it from 2.3, with several frail hacks (the shlex
1740 module is rather limited in 2.2). Thanks to a suggestion by Ville
1748 module is rather limited in 2.2). Thanks to a suggestion by Ville
1741 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1749 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1742 problem.
1750 problem.
1743
1751
1744 (Magic.magic_system_verbose): new toggle to print the actual
1752 (Magic.magic_system_verbose): new toggle to print the actual
1745 system calls made by ipython. Mainly for debugging purposes.
1753 system calls made by ipython. Mainly for debugging purposes.
1746
1754
1747 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1755 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1748 doesn't support persistence. Reported (and fix suggested) by
1756 doesn't support persistence. Reported (and fix suggested) by
1749 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1757 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1750
1758
1751 2004-06-26 Fernando Perez <fperez@colorado.edu>
1759 2004-06-26 Fernando Perez <fperez@colorado.edu>
1752
1760
1753 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1761 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1754 continue prompts.
1762 continue prompts.
1755
1763
1756 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1764 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1757 function (basically a big docstring) and a few more things here to
1765 function (basically a big docstring) and a few more things here to
1758 speedup startup. pysh.py is now very lightweight. We want because
1766 speedup startup. pysh.py is now very lightweight. We want because
1759 it gets execfile'd, while InterpreterExec gets imported, so
1767 it gets execfile'd, while InterpreterExec gets imported, so
1760 byte-compilation saves time.
1768 byte-compilation saves time.
1761
1769
1762 2004-06-25 Fernando Perez <fperez@colorado.edu>
1770 2004-06-25 Fernando Perez <fperez@colorado.edu>
1763
1771
1764 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1772 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1765 -NUM', which was recently broken.
1773 -NUM', which was recently broken.
1766
1774
1767 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1775 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1768 in multi-line input (but not !!, which doesn't make sense there).
1776 in multi-line input (but not !!, which doesn't make sense there).
1769
1777
1770 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1778 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1771 It's just too useful, and people can turn it off in the less
1779 It's just too useful, and people can turn it off in the less
1772 common cases where it's a problem.
1780 common cases where it's a problem.
1773
1781
1774 2004-06-24 Fernando Perez <fperez@colorado.edu>
1782 2004-06-24 Fernando Perez <fperez@colorado.edu>
1775
1783
1776 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1784 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1777 special syntaxes (like alias calling) is now allied in multi-line
1785 special syntaxes (like alias calling) is now allied in multi-line
1778 input. This is still _very_ experimental, but it's necessary for
1786 input. This is still _very_ experimental, but it's necessary for
1779 efficient shell usage combining python looping syntax with system
1787 efficient shell usage combining python looping syntax with system
1780 calls. For now it's restricted to aliases, I don't think it
1788 calls. For now it's restricted to aliases, I don't think it
1781 really even makes sense to have this for magics.
1789 really even makes sense to have this for magics.
1782
1790
1783 2004-06-23 Fernando Perez <fperez@colorado.edu>
1791 2004-06-23 Fernando Perez <fperez@colorado.edu>
1784
1792
1785 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1793 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1786 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1794 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1787
1795
1788 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1796 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1789 extensions under Windows (after code sent by Gary Bishop). The
1797 extensions under Windows (after code sent by Gary Bishop). The
1790 extensions considered 'executable' are stored in IPython's rc
1798 extensions considered 'executable' are stored in IPython's rc
1791 structure as win_exec_ext.
1799 structure as win_exec_ext.
1792
1800
1793 * IPython/genutils.py (shell): new function, like system() but
1801 * IPython/genutils.py (shell): new function, like system() but
1794 without return value. Very useful for interactive shell work.
1802 without return value. Very useful for interactive shell work.
1795
1803
1796 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1804 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1797 delete aliases.
1805 delete aliases.
1798
1806
1799 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1807 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1800 sure that the alias table doesn't contain python keywords.
1808 sure that the alias table doesn't contain python keywords.
1801
1809
1802 2004-06-21 Fernando Perez <fperez@colorado.edu>
1810 2004-06-21 Fernando Perez <fperez@colorado.edu>
1803
1811
1804 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1812 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1805 non-existent items are found in $PATH. Reported by Thorsten.
1813 non-existent items are found in $PATH. Reported by Thorsten.
1806
1814
1807 2004-06-20 Fernando Perez <fperez@colorado.edu>
1815 2004-06-20 Fernando Perez <fperez@colorado.edu>
1808
1816
1809 * IPython/iplib.py (complete): modified the completer so that the
1817 * IPython/iplib.py (complete): modified the completer so that the
1810 order of priorities can be easily changed at runtime.
1818 order of priorities can be easily changed at runtime.
1811
1819
1812 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1820 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1813 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1821 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1814
1822
1815 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1823 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1816 expand Python variables prepended with $ in all system calls. The
1824 expand Python variables prepended with $ in all system calls. The
1817 same was done to InteractiveShell.handle_shell_escape. Now all
1825 same was done to InteractiveShell.handle_shell_escape. Now all
1818 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1826 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1819 expansion of python variables and expressions according to the
1827 expansion of python variables and expressions according to the
1820 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1828 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1821
1829
1822 Though PEP-215 has been rejected, a similar (but simpler) one
1830 Though PEP-215 has been rejected, a similar (but simpler) one
1823 seems like it will go into Python 2.4, PEP-292 -
1831 seems like it will go into Python 2.4, PEP-292 -
1824 http://www.python.org/peps/pep-0292.html.
1832 http://www.python.org/peps/pep-0292.html.
1825
1833
1826 I'll keep the full syntax of PEP-215, since IPython has since the
1834 I'll keep the full syntax of PEP-215, since IPython has since the
1827 start used Ka-Ping Yee's reference implementation discussed there
1835 start used Ka-Ping Yee's reference implementation discussed there
1828 (Itpl), and I actually like the powerful semantics it offers.
1836 (Itpl), and I actually like the powerful semantics it offers.
1829
1837
1830 In order to access normal shell variables, the $ has to be escaped
1838 In order to access normal shell variables, the $ has to be escaped
1831 via an extra $. For example:
1839 via an extra $. For example:
1832
1840
1833 In [7]: PATH='a python variable'
1841 In [7]: PATH='a python variable'
1834
1842
1835 In [8]: !echo $PATH
1843 In [8]: !echo $PATH
1836 a python variable
1844 a python variable
1837
1845
1838 In [9]: !echo $$PATH
1846 In [9]: !echo $$PATH
1839 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1847 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1840
1848
1841 (Magic.parse_options): escape $ so the shell doesn't evaluate
1849 (Magic.parse_options): escape $ so the shell doesn't evaluate
1842 things prematurely.
1850 things prematurely.
1843
1851
1844 * IPython/iplib.py (InteractiveShell.call_alias): added the
1852 * IPython/iplib.py (InteractiveShell.call_alias): added the
1845 ability for aliases to expand python variables via $.
1853 ability for aliases to expand python variables via $.
1846
1854
1847 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1855 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1848 system, now there's a @rehash/@rehashx pair of magics. These work
1856 system, now there's a @rehash/@rehashx pair of magics. These work
1849 like the csh rehash command, and can be invoked at any time. They
1857 like the csh rehash command, and can be invoked at any time. They
1850 build a table of aliases to everything in the user's $PATH
1858 build a table of aliases to everything in the user's $PATH
1851 (@rehash uses everything, @rehashx is slower but only adds
1859 (@rehash uses everything, @rehashx is slower but only adds
1852 executable files). With this, the pysh.py-based shell profile can
1860 executable files). With this, the pysh.py-based shell profile can
1853 now simply call rehash upon startup, and full access to all
1861 now simply call rehash upon startup, and full access to all
1854 programs in the user's path is obtained.
1862 programs in the user's path is obtained.
1855
1863
1856 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1864 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1857 functionality is now fully in place. I removed the old dynamic
1865 functionality is now fully in place. I removed the old dynamic
1858 code generation based approach, in favor of a much lighter one
1866 code generation based approach, in favor of a much lighter one
1859 based on a simple dict. The advantage is that this allows me to
1867 based on a simple dict. The advantage is that this allows me to
1860 now have thousands of aliases with negligible cost (unthinkable
1868 now have thousands of aliases with negligible cost (unthinkable
1861 with the old system).
1869 with the old system).
1862
1870
1863 2004-06-19 Fernando Perez <fperez@colorado.edu>
1871 2004-06-19 Fernando Perez <fperez@colorado.edu>
1864
1872
1865 * IPython/iplib.py (__init__): extended MagicCompleter class to
1873 * IPython/iplib.py (__init__): extended MagicCompleter class to
1866 also complete (last in priority) on user aliases.
1874 also complete (last in priority) on user aliases.
1867
1875
1868 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1876 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1869 call to eval.
1877 call to eval.
1870 (ItplNS.__init__): Added a new class which functions like Itpl,
1878 (ItplNS.__init__): Added a new class which functions like Itpl,
1871 but allows configuring the namespace for the evaluation to occur
1879 but allows configuring the namespace for the evaluation to occur
1872 in.
1880 in.
1873
1881
1874 2004-06-18 Fernando Perez <fperez@colorado.edu>
1882 2004-06-18 Fernando Perez <fperez@colorado.edu>
1875
1883
1876 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1884 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1877 better message when 'exit' or 'quit' are typed (a common newbie
1885 better message when 'exit' or 'quit' are typed (a common newbie
1878 confusion).
1886 confusion).
1879
1887
1880 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1888 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1881 check for Windows users.
1889 check for Windows users.
1882
1890
1883 * IPython/iplib.py (InteractiveShell.user_setup): removed
1891 * IPython/iplib.py (InteractiveShell.user_setup): removed
1884 disabling of colors for Windows. I'll test at runtime and issue a
1892 disabling of colors for Windows. I'll test at runtime and issue a
1885 warning if Gary's readline isn't found, as to nudge users to
1893 warning if Gary's readline isn't found, as to nudge users to
1886 download it.
1894 download it.
1887
1895
1888 2004-06-16 Fernando Perez <fperez@colorado.edu>
1896 2004-06-16 Fernando Perez <fperez@colorado.edu>
1889
1897
1890 * IPython/genutils.py (Stream.__init__): changed to print errors
1898 * IPython/genutils.py (Stream.__init__): changed to print errors
1891 to sys.stderr. I had a circular dependency here. Now it's
1899 to sys.stderr. I had a circular dependency here. Now it's
1892 possible to run ipython as IDLE's shell (consider this pre-alpha,
1900 possible to run ipython as IDLE's shell (consider this pre-alpha,
1893 since true stdout things end up in the starting terminal instead
1901 since true stdout things end up in the starting terminal instead
1894 of IDLE's out).
1902 of IDLE's out).
1895
1903
1896 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1904 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1897 users who haven't # updated their prompt_in2 definitions. Remove
1905 users who haven't # updated their prompt_in2 definitions. Remove
1898 eventually.
1906 eventually.
1899 (multiple_replace): added credit to original ASPN recipe.
1907 (multiple_replace): added credit to original ASPN recipe.
1900
1908
1901 2004-06-15 Fernando Perez <fperez@colorado.edu>
1909 2004-06-15 Fernando Perez <fperez@colorado.edu>
1902
1910
1903 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1911 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1904 list of auto-defined aliases.
1912 list of auto-defined aliases.
1905
1913
1906 2004-06-13 Fernando Perez <fperez@colorado.edu>
1914 2004-06-13 Fernando Perez <fperez@colorado.edu>
1907
1915
1908 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1916 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1909 install was really requested (so setup.py can be used for other
1917 install was really requested (so setup.py can be used for other
1910 things under Windows).
1918 things under Windows).
1911
1919
1912 2004-06-10 Fernando Perez <fperez@colorado.edu>
1920 2004-06-10 Fernando Perez <fperez@colorado.edu>
1913
1921
1914 * IPython/Logger.py (Logger.create_log): Manually remove any old
1922 * IPython/Logger.py (Logger.create_log): Manually remove any old
1915 backup, since os.remove may fail under Windows. Fixes bug
1923 backup, since os.remove may fail under Windows. Fixes bug
1916 reported by Thorsten.
1924 reported by Thorsten.
1917
1925
1918 2004-06-09 Fernando Perez <fperez@colorado.edu>
1926 2004-06-09 Fernando Perez <fperez@colorado.edu>
1919
1927
1920 * examples/example-embed.py: fixed all references to %n (replaced
1928 * examples/example-embed.py: fixed all references to %n (replaced
1921 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1929 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1922 for all examples and the manual as well.
1930 for all examples and the manual as well.
1923
1931
1924 2004-06-08 Fernando Perez <fperez@colorado.edu>
1932 2004-06-08 Fernando Perez <fperez@colorado.edu>
1925
1933
1926 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1934 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1927 alignment and color management. All 3 prompt subsystems now
1935 alignment and color management. All 3 prompt subsystems now
1928 inherit from BasePrompt.
1936 inherit from BasePrompt.
1929
1937
1930 * tools/release: updates for windows installer build and tag rpms
1938 * tools/release: updates for windows installer build and tag rpms
1931 with python version (since paths are fixed).
1939 with python version (since paths are fixed).
1932
1940
1933 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1941 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1934 which will become eventually obsolete. Also fixed the default
1942 which will become eventually obsolete. Also fixed the default
1935 prompt_in2 to use \D, so at least new users start with the correct
1943 prompt_in2 to use \D, so at least new users start with the correct
1936 defaults.
1944 defaults.
1937 WARNING: Users with existing ipythonrc files will need to apply
1945 WARNING: Users with existing ipythonrc files will need to apply
1938 this fix manually!
1946 this fix manually!
1939
1947
1940 * setup.py: make windows installer (.exe). This is finally the
1948 * setup.py: make windows installer (.exe). This is finally the
1941 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1949 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1942 which I hadn't included because it required Python 2.3 (or recent
1950 which I hadn't included because it required Python 2.3 (or recent
1943 distutils).
1951 distutils).
1944
1952
1945 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1953 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1946 usage of new '\D' escape.
1954 usage of new '\D' escape.
1947
1955
1948 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1956 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1949 lacks os.getuid())
1957 lacks os.getuid())
1950 (CachedOutput.set_colors): Added the ability to turn coloring
1958 (CachedOutput.set_colors): Added the ability to turn coloring
1951 on/off with @colors even for manually defined prompt colors. It
1959 on/off with @colors even for manually defined prompt colors. It
1952 uses a nasty global, but it works safely and via the generic color
1960 uses a nasty global, but it works safely and via the generic color
1953 handling mechanism.
1961 handling mechanism.
1954 (Prompt2.__init__): Introduced new escape '\D' for continuation
1962 (Prompt2.__init__): Introduced new escape '\D' for continuation
1955 prompts. It represents the counter ('\#') as dots.
1963 prompts. It represents the counter ('\#') as dots.
1956 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1964 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1957 need to update their ipythonrc files and replace '%n' with '\D' in
1965 need to update their ipythonrc files and replace '%n' with '\D' in
1958 their prompt_in2 settings everywhere. Sorry, but there's
1966 their prompt_in2 settings everywhere. Sorry, but there's
1959 otherwise no clean way to get all prompts to properly align. The
1967 otherwise no clean way to get all prompts to properly align. The
1960 ipythonrc shipped with IPython has been updated.
1968 ipythonrc shipped with IPython has been updated.
1961
1969
1962 2004-06-07 Fernando Perez <fperez@colorado.edu>
1970 2004-06-07 Fernando Perez <fperez@colorado.edu>
1963
1971
1964 * setup.py (isfile): Pass local_icons option to latex2html, so the
1972 * setup.py (isfile): Pass local_icons option to latex2html, so the
1965 resulting HTML file is self-contained. Thanks to
1973 resulting HTML file is self-contained. Thanks to
1966 dryice-AT-liu.com.cn for the tip.
1974 dryice-AT-liu.com.cn for the tip.
1967
1975
1968 * pysh.py: I created a new profile 'shell', which implements a
1976 * pysh.py: I created a new profile 'shell', which implements a
1969 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1977 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1970 system shell, nor will it become one anytime soon. It's mainly
1978 system shell, nor will it become one anytime soon. It's mainly
1971 meant to illustrate the use of the new flexible bash-like prompts.
1979 meant to illustrate the use of the new flexible bash-like prompts.
1972 I guess it could be used by hardy souls for true shell management,
1980 I guess it could be used by hardy souls for true shell management,
1973 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1981 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1974 profile. This uses the InterpreterExec extension provided by
1982 profile. This uses the InterpreterExec extension provided by
1975 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1983 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1976
1984
1977 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1985 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1978 auto-align itself with the length of the previous input prompt
1986 auto-align itself with the length of the previous input prompt
1979 (taking into account the invisible color escapes).
1987 (taking into account the invisible color escapes).
1980 (CachedOutput.__init__): Large restructuring of this class. Now
1988 (CachedOutput.__init__): Large restructuring of this class. Now
1981 all three prompts (primary1, primary2, output) are proper objects,
1989 all three prompts (primary1, primary2, output) are proper objects,
1982 managed by the 'parent' CachedOutput class. The code is still a
1990 managed by the 'parent' CachedOutput class. The code is still a
1983 bit hackish (all prompts share state via a pointer to the cache),
1991 bit hackish (all prompts share state via a pointer to the cache),
1984 but it's overall far cleaner than before.
1992 but it's overall far cleaner than before.
1985
1993
1986 * IPython/genutils.py (getoutputerror): modified to add verbose,
1994 * IPython/genutils.py (getoutputerror): modified to add verbose,
1987 debug and header options. This makes the interface of all getout*
1995 debug and header options. This makes the interface of all getout*
1988 functions uniform.
1996 functions uniform.
1989 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1997 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1990
1998
1991 * IPython/Magic.py (Magic.default_option): added a function to
1999 * IPython/Magic.py (Magic.default_option): added a function to
1992 allow registering default options for any magic command. This
2000 allow registering default options for any magic command. This
1993 makes it easy to have profiles which customize the magics globally
2001 makes it easy to have profiles which customize the magics globally
1994 for a certain use. The values set through this function are
2002 for a certain use. The values set through this function are
1995 picked up by the parse_options() method, which all magics should
2003 picked up by the parse_options() method, which all magics should
1996 use to parse their options.
2004 use to parse their options.
1997
2005
1998 * IPython/genutils.py (warn): modified the warnings framework to
2006 * IPython/genutils.py (warn): modified the warnings framework to
1999 use the Term I/O class. I'm trying to slowly unify all of
2007 use the Term I/O class. I'm trying to slowly unify all of
2000 IPython's I/O operations to pass through Term.
2008 IPython's I/O operations to pass through Term.
2001
2009
2002 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2010 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2003 the secondary prompt to correctly match the length of the primary
2011 the secondary prompt to correctly match the length of the primary
2004 one for any prompt. Now multi-line code will properly line up
2012 one for any prompt. Now multi-line code will properly line up
2005 even for path dependent prompts, such as the new ones available
2013 even for path dependent prompts, such as the new ones available
2006 via the prompt_specials.
2014 via the prompt_specials.
2007
2015
2008 2004-06-06 Fernando Perez <fperez@colorado.edu>
2016 2004-06-06 Fernando Perez <fperez@colorado.edu>
2009
2017
2010 * IPython/Prompts.py (prompt_specials): Added the ability to have
2018 * IPython/Prompts.py (prompt_specials): Added the ability to have
2011 bash-like special sequences in the prompts, which get
2019 bash-like special sequences in the prompts, which get
2012 automatically expanded. Things like hostname, current working
2020 automatically expanded. Things like hostname, current working
2013 directory and username are implemented already, but it's easy to
2021 directory and username are implemented already, but it's easy to
2014 add more in the future. Thanks to a patch by W.J. van der Laan
2022 add more in the future. Thanks to a patch by W.J. van der Laan
2015 <gnufnork-AT-hetdigitalegat.nl>
2023 <gnufnork-AT-hetdigitalegat.nl>
2016 (prompt_specials): Added color support for prompt strings, so
2024 (prompt_specials): Added color support for prompt strings, so
2017 users can define arbitrary color setups for their prompts.
2025 users can define arbitrary color setups for their prompts.
2018
2026
2019 2004-06-05 Fernando Perez <fperez@colorado.edu>
2027 2004-06-05 Fernando Perez <fperez@colorado.edu>
2020
2028
2021 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2029 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2022 code to load Gary Bishop's readline and configure it
2030 code to load Gary Bishop's readline and configure it
2023 automatically. Thanks to Gary for help on this.
2031 automatically. Thanks to Gary for help on this.
2024
2032
2025 2004-06-01 Fernando Perez <fperez@colorado.edu>
2033 2004-06-01 Fernando Perez <fperez@colorado.edu>
2026
2034
2027 * IPython/Logger.py (Logger.create_log): fix bug for logging
2035 * IPython/Logger.py (Logger.create_log): fix bug for logging
2028 with no filename (previous fix was incomplete).
2036 with no filename (previous fix was incomplete).
2029
2037
2030 2004-05-25 Fernando Perez <fperez@colorado.edu>
2038 2004-05-25 Fernando Perez <fperez@colorado.edu>
2031
2039
2032 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2040 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2033 parens would get passed to the shell.
2041 parens would get passed to the shell.
2034
2042
2035 2004-05-20 Fernando Perez <fperez@colorado.edu>
2043 2004-05-20 Fernando Perez <fperez@colorado.edu>
2036
2044
2037 * IPython/Magic.py (Magic.magic_prun): changed default profile
2045 * IPython/Magic.py (Magic.magic_prun): changed default profile
2038 sort order to 'time' (the more common profiling need).
2046 sort order to 'time' (the more common profiling need).
2039
2047
2040 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2048 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2041 so that source code shown is guaranteed in sync with the file on
2049 so that source code shown is guaranteed in sync with the file on
2042 disk (also changed in psource). Similar fix to the one for
2050 disk (also changed in psource). Similar fix to the one for
2043 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2051 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2044 <yann.ledu-AT-noos.fr>.
2052 <yann.ledu-AT-noos.fr>.
2045
2053
2046 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2054 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2047 with a single option would not be correctly parsed. Closes
2055 with a single option would not be correctly parsed. Closes
2048 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2056 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2049 introduced in 0.6.0 (on 2004-05-06).
2057 introduced in 0.6.0 (on 2004-05-06).
2050
2058
2051 2004-05-13 *** Released version 0.6.0
2059 2004-05-13 *** Released version 0.6.0
2052
2060
2053 2004-05-13 Fernando Perez <fperez@colorado.edu>
2061 2004-05-13 Fernando Perez <fperez@colorado.edu>
2054
2062
2055 * debian/: Added debian/ directory to CVS, so that debian support
2063 * debian/: Added debian/ directory to CVS, so that debian support
2056 is publicly accessible. The debian package is maintained by Jack
2064 is publicly accessible. The debian package is maintained by Jack
2057 Moffit <jack-AT-xiph.org>.
2065 Moffit <jack-AT-xiph.org>.
2058
2066
2059 * Documentation: included the notes about an ipython-based system
2067 * Documentation: included the notes about an ipython-based system
2060 shell (the hypothetical 'pysh') into the new_design.pdf document,
2068 shell (the hypothetical 'pysh') into the new_design.pdf document,
2061 so that these ideas get distributed to users along with the
2069 so that these ideas get distributed to users along with the
2062 official documentation.
2070 official documentation.
2063
2071
2064 2004-05-10 Fernando Perez <fperez@colorado.edu>
2072 2004-05-10 Fernando Perez <fperez@colorado.edu>
2065
2073
2066 * IPython/Logger.py (Logger.create_log): fix recently introduced
2074 * IPython/Logger.py (Logger.create_log): fix recently introduced
2067 bug (misindented line) where logstart would fail when not given an
2075 bug (misindented line) where logstart would fail when not given an
2068 explicit filename.
2076 explicit filename.
2069
2077
2070 2004-05-09 Fernando Perez <fperez@colorado.edu>
2078 2004-05-09 Fernando Perez <fperez@colorado.edu>
2071
2079
2072 * IPython/Magic.py (Magic.parse_options): skip system call when
2080 * IPython/Magic.py (Magic.parse_options): skip system call when
2073 there are no options to look for. Faster, cleaner for the common
2081 there are no options to look for. Faster, cleaner for the common
2074 case.
2082 case.
2075
2083
2076 * Documentation: many updates to the manual: describing Windows
2084 * Documentation: many updates to the manual: describing Windows
2077 support better, Gnuplot updates, credits, misc small stuff. Also
2085 support better, Gnuplot updates, credits, misc small stuff. Also
2078 updated the new_design doc a bit.
2086 updated the new_design doc a bit.
2079
2087
2080 2004-05-06 *** Released version 0.6.0.rc1
2088 2004-05-06 *** Released version 0.6.0.rc1
2081
2089
2082 2004-05-06 Fernando Perez <fperez@colorado.edu>
2090 2004-05-06 Fernando Perez <fperez@colorado.edu>
2083
2091
2084 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2092 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2085 operations to use the vastly more efficient list/''.join() method.
2093 operations to use the vastly more efficient list/''.join() method.
2086 (FormattedTB.text): Fix
2094 (FormattedTB.text): Fix
2087 http://www.scipy.net/roundup/ipython/issue12 - exception source
2095 http://www.scipy.net/roundup/ipython/issue12 - exception source
2088 extract not updated after reload. Thanks to Mike Salib
2096 extract not updated after reload. Thanks to Mike Salib
2089 <msalib-AT-mit.edu> for pinning the source of the problem.
2097 <msalib-AT-mit.edu> for pinning the source of the problem.
2090 Fortunately, the solution works inside ipython and doesn't require
2098 Fortunately, the solution works inside ipython and doesn't require
2091 any changes to python proper.
2099 any changes to python proper.
2092
2100
2093 * IPython/Magic.py (Magic.parse_options): Improved to process the
2101 * IPython/Magic.py (Magic.parse_options): Improved to process the
2094 argument list as a true shell would (by actually using the
2102 argument list as a true shell would (by actually using the
2095 underlying system shell). This way, all @magics automatically get
2103 underlying system shell). This way, all @magics automatically get
2096 shell expansion for variables. Thanks to a comment by Alex
2104 shell expansion for variables. Thanks to a comment by Alex
2097 Schmolck.
2105 Schmolck.
2098
2106
2099 2004-04-04 Fernando Perez <fperez@colorado.edu>
2107 2004-04-04 Fernando Perez <fperez@colorado.edu>
2100
2108
2101 * IPython/iplib.py (InteractiveShell.interact): Added a special
2109 * IPython/iplib.py (InteractiveShell.interact): Added a special
2102 trap for a debugger quit exception, which is basically impossible
2110 trap for a debugger quit exception, which is basically impossible
2103 to handle by normal mechanisms, given what pdb does to the stack.
2111 to handle by normal mechanisms, given what pdb does to the stack.
2104 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2112 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2105
2113
2106 2004-04-03 Fernando Perez <fperez@colorado.edu>
2114 2004-04-03 Fernando Perez <fperez@colorado.edu>
2107
2115
2108 * IPython/genutils.py (Term): Standardized the names of the Term
2116 * IPython/genutils.py (Term): Standardized the names of the Term
2109 class streams to cin/cout/cerr, following C++ naming conventions
2117 class streams to cin/cout/cerr, following C++ naming conventions
2110 (I can't use in/out/err because 'in' is not a valid attribute
2118 (I can't use in/out/err because 'in' is not a valid attribute
2111 name).
2119 name).
2112
2120
2113 * IPython/iplib.py (InteractiveShell.interact): don't increment
2121 * IPython/iplib.py (InteractiveShell.interact): don't increment
2114 the prompt if there's no user input. By Daniel 'Dang' Griffith
2122 the prompt if there's no user input. By Daniel 'Dang' Griffith
2115 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2123 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2116 Francois Pinard.
2124 Francois Pinard.
2117
2125
2118 2004-04-02 Fernando Perez <fperez@colorado.edu>
2126 2004-04-02 Fernando Perez <fperez@colorado.edu>
2119
2127
2120 * IPython/genutils.py (Stream.__init__): Modified to survive at
2128 * IPython/genutils.py (Stream.__init__): Modified to survive at
2121 least importing in contexts where stdin/out/err aren't true file
2129 least importing in contexts where stdin/out/err aren't true file
2122 objects, such as PyCrust (they lack fileno() and mode). However,
2130 objects, such as PyCrust (they lack fileno() and mode). However,
2123 the recovery facilities which rely on these things existing will
2131 the recovery facilities which rely on these things existing will
2124 not work.
2132 not work.
2125
2133
2126 2004-04-01 Fernando Perez <fperez@colorado.edu>
2134 2004-04-01 Fernando Perez <fperez@colorado.edu>
2127
2135
2128 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2136 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2129 use the new getoutputerror() function, so it properly
2137 use the new getoutputerror() function, so it properly
2130 distinguishes stdout/err.
2138 distinguishes stdout/err.
2131
2139
2132 * IPython/genutils.py (getoutputerror): added a function to
2140 * IPython/genutils.py (getoutputerror): added a function to
2133 capture separately the standard output and error of a command.
2141 capture separately the standard output and error of a command.
2134 After a comment from dang on the mailing lists. This code is
2142 After a comment from dang on the mailing lists. This code is
2135 basically a modified version of commands.getstatusoutput(), from
2143 basically a modified version of commands.getstatusoutput(), from
2136 the standard library.
2144 the standard library.
2137
2145
2138 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2146 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2139 '!!' as a special syntax (shorthand) to access @sx.
2147 '!!' as a special syntax (shorthand) to access @sx.
2140
2148
2141 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2149 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2142 command and return its output as a list split on '\n'.
2150 command and return its output as a list split on '\n'.
2143
2151
2144 2004-03-31 Fernando Perez <fperez@colorado.edu>
2152 2004-03-31 Fernando Perez <fperez@colorado.edu>
2145
2153
2146 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2154 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2147 method to dictionaries used as FakeModule instances if they lack
2155 method to dictionaries used as FakeModule instances if they lack
2148 it. At least pydoc in python2.3 breaks for runtime-defined
2156 it. At least pydoc in python2.3 breaks for runtime-defined
2149 functions without this hack. At some point I need to _really_
2157 functions without this hack. At some point I need to _really_
2150 understand what FakeModule is doing, because it's a gross hack.
2158 understand what FakeModule is doing, because it's a gross hack.
2151 But it solves Arnd's problem for now...
2159 But it solves Arnd's problem for now...
2152
2160
2153 2004-02-27 Fernando Perez <fperez@colorado.edu>
2161 2004-02-27 Fernando Perez <fperez@colorado.edu>
2154
2162
2155 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2163 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2156 mode would behave erratically. Also increased the number of
2164 mode would behave erratically. Also increased the number of
2157 possible logs in rotate mod to 999. Thanks to Rod Holland
2165 possible logs in rotate mod to 999. Thanks to Rod Holland
2158 <rhh@StructureLABS.com> for the report and fixes.
2166 <rhh@StructureLABS.com> for the report and fixes.
2159
2167
2160 2004-02-26 Fernando Perez <fperez@colorado.edu>
2168 2004-02-26 Fernando Perez <fperez@colorado.edu>
2161
2169
2162 * IPython/genutils.py (page): Check that the curses module really
2170 * IPython/genutils.py (page): Check that the curses module really
2163 has the initscr attribute before trying to use it. For some
2171 has the initscr attribute before trying to use it. For some
2164 reason, the Solaris curses module is missing this. I think this
2172 reason, the Solaris curses module is missing this. I think this
2165 should be considered a Solaris python bug, but I'm not sure.
2173 should be considered a Solaris python bug, but I'm not sure.
2166
2174
2167 2004-01-17 Fernando Perez <fperez@colorado.edu>
2175 2004-01-17 Fernando Perez <fperez@colorado.edu>
2168
2176
2169 * IPython/genutils.py (Stream.__init__): Changes to try to make
2177 * IPython/genutils.py (Stream.__init__): Changes to try to make
2170 ipython robust against stdin/out/err being closed by the user.
2178 ipython robust against stdin/out/err being closed by the user.
2171 This is 'user error' (and blocks a normal python session, at least
2179 This is 'user error' (and blocks a normal python session, at least
2172 the stdout case). However, Ipython should be able to survive such
2180 the stdout case). However, Ipython should be able to survive such
2173 instances of abuse as gracefully as possible. To simplify the
2181 instances of abuse as gracefully as possible. To simplify the
2174 coding and maintain compatibility with Gary Bishop's Term
2182 coding and maintain compatibility with Gary Bishop's Term
2175 contributions, I've made use of classmethods for this. I think
2183 contributions, I've made use of classmethods for this. I think
2176 this introduces a dependency on python 2.2.
2184 this introduces a dependency on python 2.2.
2177
2185
2178 2004-01-13 Fernando Perez <fperez@colorado.edu>
2186 2004-01-13 Fernando Perez <fperez@colorado.edu>
2179
2187
2180 * IPython/numutils.py (exp_safe): simplified the code a bit and
2188 * IPython/numutils.py (exp_safe): simplified the code a bit and
2181 removed the need for importing the kinds module altogether.
2189 removed the need for importing the kinds module altogether.
2182
2190
2183 2004-01-06 Fernando Perez <fperez@colorado.edu>
2191 2004-01-06 Fernando Perez <fperez@colorado.edu>
2184
2192
2185 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2193 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2186 a magic function instead, after some community feedback. No
2194 a magic function instead, after some community feedback. No
2187 special syntax will exist for it, but its name is deliberately
2195 special syntax will exist for it, but its name is deliberately
2188 very short.
2196 very short.
2189
2197
2190 2003-12-20 Fernando Perez <fperez@colorado.edu>
2198 2003-12-20 Fernando Perez <fperez@colorado.edu>
2191
2199
2192 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2200 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2193 new functionality, to automagically assign the result of a shell
2201 new functionality, to automagically assign the result of a shell
2194 command to a variable. I'll solicit some community feedback on
2202 command to a variable. I'll solicit some community feedback on
2195 this before making it permanent.
2203 this before making it permanent.
2196
2204
2197 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2205 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2198 requested about callables for which inspect couldn't obtain a
2206 requested about callables for which inspect couldn't obtain a
2199 proper argspec. Thanks to a crash report sent by Etienne
2207 proper argspec. Thanks to a crash report sent by Etienne
2200 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2208 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2201
2209
2202 2003-12-09 Fernando Perez <fperez@colorado.edu>
2210 2003-12-09 Fernando Perez <fperez@colorado.edu>
2203
2211
2204 * IPython/genutils.py (page): patch for the pager to work across
2212 * IPython/genutils.py (page): patch for the pager to work across
2205 various versions of Windows. By Gary Bishop.
2213 various versions of Windows. By Gary Bishop.
2206
2214
2207 2003-12-04 Fernando Perez <fperez@colorado.edu>
2215 2003-12-04 Fernando Perez <fperez@colorado.edu>
2208
2216
2209 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2217 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2210 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2218 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2211 While I tested this and it looks ok, there may still be corner
2219 While I tested this and it looks ok, there may still be corner
2212 cases I've missed.
2220 cases I've missed.
2213
2221
2214 2003-12-01 Fernando Perez <fperez@colorado.edu>
2222 2003-12-01 Fernando Perez <fperez@colorado.edu>
2215
2223
2216 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2224 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2217 where a line like 'p,q=1,2' would fail because the automagic
2225 where a line like 'p,q=1,2' would fail because the automagic
2218 system would be triggered for @p.
2226 system would be triggered for @p.
2219
2227
2220 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2228 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2221 cleanups, code unmodified.
2229 cleanups, code unmodified.
2222
2230
2223 * IPython/genutils.py (Term): added a class for IPython to handle
2231 * IPython/genutils.py (Term): added a class for IPython to handle
2224 output. In most cases it will just be a proxy for stdout/err, but
2232 output. In most cases it will just be a proxy for stdout/err, but
2225 having this allows modifications to be made for some platforms,
2233 having this allows modifications to be made for some platforms,
2226 such as handling color escapes under Windows. All of this code
2234 such as handling color escapes under Windows. All of this code
2227 was contributed by Gary Bishop, with minor modifications by me.
2235 was contributed by Gary Bishop, with minor modifications by me.
2228 The actual changes affect many files.
2236 The actual changes affect many files.
2229
2237
2230 2003-11-30 Fernando Perez <fperez@colorado.edu>
2238 2003-11-30 Fernando Perez <fperez@colorado.edu>
2231
2239
2232 * IPython/iplib.py (file_matches): new completion code, courtesy
2240 * IPython/iplib.py (file_matches): new completion code, courtesy
2233 of Jeff Collins. This enables filename completion again under
2241 of Jeff Collins. This enables filename completion again under
2234 python 2.3, which disabled it at the C level.
2242 python 2.3, which disabled it at the C level.
2235
2243
2236 2003-11-11 Fernando Perez <fperez@colorado.edu>
2244 2003-11-11 Fernando Perez <fperez@colorado.edu>
2237
2245
2238 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2246 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2239 for Numeric.array(map(...)), but often convenient.
2247 for Numeric.array(map(...)), but often convenient.
2240
2248
2241 2003-11-05 Fernando Perez <fperez@colorado.edu>
2249 2003-11-05 Fernando Perez <fperez@colorado.edu>
2242
2250
2243 * IPython/numutils.py (frange): Changed a call from int() to
2251 * IPython/numutils.py (frange): Changed a call from int() to
2244 int(round()) to prevent a problem reported with arange() in the
2252 int(round()) to prevent a problem reported with arange() in the
2245 numpy list.
2253 numpy list.
2246
2254
2247 2003-10-06 Fernando Perez <fperez@colorado.edu>
2255 2003-10-06 Fernando Perez <fperez@colorado.edu>
2248
2256
2249 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2257 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2250 prevent crashes if sys lacks an argv attribute (it happens with
2258 prevent crashes if sys lacks an argv attribute (it happens with
2251 embedded interpreters which build a bare-bones sys module).
2259 embedded interpreters which build a bare-bones sys module).
2252 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2260 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2253
2261
2254 2003-09-24 Fernando Perez <fperez@colorado.edu>
2262 2003-09-24 Fernando Perez <fperez@colorado.edu>
2255
2263
2256 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2264 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2257 to protect against poorly written user objects where __getattr__
2265 to protect against poorly written user objects where __getattr__
2258 raises exceptions other than AttributeError. Thanks to a bug
2266 raises exceptions other than AttributeError. Thanks to a bug
2259 report by Oliver Sander <osander-AT-gmx.de>.
2267 report by Oliver Sander <osander-AT-gmx.de>.
2260
2268
2261 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2269 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2262 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2270 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2263
2271
2264 2003-09-09 Fernando Perez <fperez@colorado.edu>
2272 2003-09-09 Fernando Perez <fperez@colorado.edu>
2265
2273
2266 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2274 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2267 unpacking a list whith a callable as first element would
2275 unpacking a list whith a callable as first element would
2268 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2276 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2269 Collins.
2277 Collins.
2270
2278
2271 2003-08-25 *** Released version 0.5.0
2279 2003-08-25 *** Released version 0.5.0
2272
2280
2273 2003-08-22 Fernando Perez <fperez@colorado.edu>
2281 2003-08-22 Fernando Perez <fperez@colorado.edu>
2274
2282
2275 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2283 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2276 improperly defined user exceptions. Thanks to feedback from Mark
2284 improperly defined user exceptions. Thanks to feedback from Mark
2277 Russell <mrussell-AT-verio.net>.
2285 Russell <mrussell-AT-verio.net>.
2278
2286
2279 2003-08-20 Fernando Perez <fperez@colorado.edu>
2287 2003-08-20 Fernando Perez <fperez@colorado.edu>
2280
2288
2281 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2289 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2282 printing so that it would print multi-line string forms starting
2290 printing so that it would print multi-line string forms starting
2283 with a new line. This way the formatting is better respected for
2291 with a new line. This way the formatting is better respected for
2284 objects which work hard to make nice string forms.
2292 objects which work hard to make nice string forms.
2285
2293
2286 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2294 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2287 autocall would overtake data access for objects with both
2295 autocall would overtake data access for objects with both
2288 __getitem__ and __call__.
2296 __getitem__ and __call__.
2289
2297
2290 2003-08-19 *** Released version 0.5.0-rc1
2298 2003-08-19 *** Released version 0.5.0-rc1
2291
2299
2292 2003-08-19 Fernando Perez <fperez@colorado.edu>
2300 2003-08-19 Fernando Perez <fperez@colorado.edu>
2293
2301
2294 * IPython/deep_reload.py (load_tail): single tiny change here
2302 * IPython/deep_reload.py (load_tail): single tiny change here
2295 seems to fix the long-standing bug of dreload() failing to work
2303 seems to fix the long-standing bug of dreload() failing to work
2296 for dotted names. But this module is pretty tricky, so I may have
2304 for dotted names. But this module is pretty tricky, so I may have
2297 missed some subtlety. Needs more testing!.
2305 missed some subtlety. Needs more testing!.
2298
2306
2299 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2307 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2300 exceptions which have badly implemented __str__ methods.
2308 exceptions which have badly implemented __str__ methods.
2301 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2309 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2302 which I've been getting reports about from Python 2.3 users. I
2310 which I've been getting reports about from Python 2.3 users. I
2303 wish I had a simple test case to reproduce the problem, so I could
2311 wish I had a simple test case to reproduce the problem, so I could
2304 either write a cleaner workaround or file a bug report if
2312 either write a cleaner workaround or file a bug report if
2305 necessary.
2313 necessary.
2306
2314
2307 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2315 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2308 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2316 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2309 a bug report by Tjabo Kloppenburg.
2317 a bug report by Tjabo Kloppenburg.
2310
2318
2311 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2319 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2312 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2320 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2313 seems rather unstable. Thanks to a bug report by Tjabo
2321 seems rather unstable. Thanks to a bug report by Tjabo
2314 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2322 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2315
2323
2316 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2324 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2317 this out soon because of the critical fixes in the inner loop for
2325 this out soon because of the critical fixes in the inner loop for
2318 generators.
2326 generators.
2319
2327
2320 * IPython/Magic.py (Magic.getargspec): removed. This (and
2328 * IPython/Magic.py (Magic.getargspec): removed. This (and
2321 _get_def) have been obsoleted by OInspect for a long time, I
2329 _get_def) have been obsoleted by OInspect for a long time, I
2322 hadn't noticed that they were dead code.
2330 hadn't noticed that they were dead code.
2323 (Magic._ofind): restored _ofind functionality for a few literals
2331 (Magic._ofind): restored _ofind functionality for a few literals
2324 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2332 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2325 for things like "hello".capitalize?, since that would require a
2333 for things like "hello".capitalize?, since that would require a
2326 potentially dangerous eval() again.
2334 potentially dangerous eval() again.
2327
2335
2328 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2336 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2329 logic a bit more to clean up the escapes handling and minimize the
2337 logic a bit more to clean up the escapes handling and minimize the
2330 use of _ofind to only necessary cases. The interactive 'feel' of
2338 use of _ofind to only necessary cases. The interactive 'feel' of
2331 IPython should have improved quite a bit with the changes in
2339 IPython should have improved quite a bit with the changes in
2332 _prefilter and _ofind (besides being far safer than before).
2340 _prefilter and _ofind (besides being far safer than before).
2333
2341
2334 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2342 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2335 obscure, never reported). Edit would fail to find the object to
2343 obscure, never reported). Edit would fail to find the object to
2336 edit under some circumstances.
2344 edit under some circumstances.
2337 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2345 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2338 which were causing double-calling of generators. Those eval calls
2346 which were causing double-calling of generators. Those eval calls
2339 were _very_ dangerous, since code with side effects could be
2347 were _very_ dangerous, since code with side effects could be
2340 triggered. As they say, 'eval is evil'... These were the
2348 triggered. As they say, 'eval is evil'... These were the
2341 nastiest evals in IPython. Besides, _ofind is now far simpler,
2349 nastiest evals in IPython. Besides, _ofind is now far simpler,
2342 and it should also be quite a bit faster. Its use of inspect is
2350 and it should also be quite a bit faster. Its use of inspect is
2343 also safer, so perhaps some of the inspect-related crashes I've
2351 also safer, so perhaps some of the inspect-related crashes I've
2344 seen lately with Python 2.3 might be taken care of. That will
2352 seen lately with Python 2.3 might be taken care of. That will
2345 need more testing.
2353 need more testing.
2346
2354
2347 2003-08-17 Fernando Perez <fperez@colorado.edu>
2355 2003-08-17 Fernando Perez <fperez@colorado.edu>
2348
2356
2349 * IPython/iplib.py (InteractiveShell._prefilter): significant
2357 * IPython/iplib.py (InteractiveShell._prefilter): significant
2350 simplifications to the logic for handling user escapes. Faster
2358 simplifications to the logic for handling user escapes. Faster
2351 and simpler code.
2359 and simpler code.
2352
2360
2353 2003-08-14 Fernando Perez <fperez@colorado.edu>
2361 2003-08-14 Fernando Perez <fperez@colorado.edu>
2354
2362
2355 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2363 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2356 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2364 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2357 but it should be quite a bit faster. And the recursive version
2365 but it should be quite a bit faster. And the recursive version
2358 generated O(log N) intermediate storage for all rank>1 arrays,
2366 generated O(log N) intermediate storage for all rank>1 arrays,
2359 even if they were contiguous.
2367 even if they were contiguous.
2360 (l1norm): Added this function.
2368 (l1norm): Added this function.
2361 (norm): Added this function for arbitrary norms (including
2369 (norm): Added this function for arbitrary norms (including
2362 l-infinity). l1 and l2 are still special cases for convenience
2370 l-infinity). l1 and l2 are still special cases for convenience
2363 and speed.
2371 and speed.
2364
2372
2365 2003-08-03 Fernando Perez <fperez@colorado.edu>
2373 2003-08-03 Fernando Perez <fperez@colorado.edu>
2366
2374
2367 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2375 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2368 exceptions, which now raise PendingDeprecationWarnings in Python
2376 exceptions, which now raise PendingDeprecationWarnings in Python
2369 2.3. There were some in Magic and some in Gnuplot2.
2377 2.3. There were some in Magic and some in Gnuplot2.
2370
2378
2371 2003-06-30 Fernando Perez <fperez@colorado.edu>
2379 2003-06-30 Fernando Perez <fperez@colorado.edu>
2372
2380
2373 * IPython/genutils.py (page): modified to call curses only for
2381 * IPython/genutils.py (page): modified to call curses only for
2374 terminals where TERM=='xterm'. After problems under many other
2382 terminals where TERM=='xterm'. After problems under many other
2375 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2383 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2376
2384
2377 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2385 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2378 would be triggered when readline was absent. This was just an old
2386 would be triggered when readline was absent. This was just an old
2379 debugging statement I'd forgotten to take out.
2387 debugging statement I'd forgotten to take out.
2380
2388
2381 2003-06-20 Fernando Perez <fperez@colorado.edu>
2389 2003-06-20 Fernando Perez <fperez@colorado.edu>
2382
2390
2383 * IPython/genutils.py (clock): modified to return only user time
2391 * IPython/genutils.py (clock): modified to return only user time
2384 (not counting system time), after a discussion on scipy. While
2392 (not counting system time), after a discussion on scipy. While
2385 system time may be a useful quantity occasionally, it may much
2393 system time may be a useful quantity occasionally, it may much
2386 more easily be skewed by occasional swapping or other similar
2394 more easily be skewed by occasional swapping or other similar
2387 activity.
2395 activity.
2388
2396
2389 2003-06-05 Fernando Perez <fperez@colorado.edu>
2397 2003-06-05 Fernando Perez <fperez@colorado.edu>
2390
2398
2391 * IPython/numutils.py (identity): new function, for building
2399 * IPython/numutils.py (identity): new function, for building
2392 arbitrary rank Kronecker deltas (mostly backwards compatible with
2400 arbitrary rank Kronecker deltas (mostly backwards compatible with
2393 Numeric.identity)
2401 Numeric.identity)
2394
2402
2395 2003-06-03 Fernando Perez <fperez@colorado.edu>
2403 2003-06-03 Fernando Perez <fperez@colorado.edu>
2396
2404
2397 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2405 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2398 arguments passed to magics with spaces, to allow trailing '\' to
2406 arguments passed to magics with spaces, to allow trailing '\' to
2399 work normally (mainly for Windows users).
2407 work normally (mainly for Windows users).
2400
2408
2401 2003-05-29 Fernando Perez <fperez@colorado.edu>
2409 2003-05-29 Fernando Perez <fperez@colorado.edu>
2402
2410
2403 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2411 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2404 instead of pydoc.help. This fixes a bizarre behavior where
2412 instead of pydoc.help. This fixes a bizarre behavior where
2405 printing '%s' % locals() would trigger the help system. Now
2413 printing '%s' % locals() would trigger the help system. Now
2406 ipython behaves like normal python does.
2414 ipython behaves like normal python does.
2407
2415
2408 Note that if one does 'from pydoc import help', the bizarre
2416 Note that if one does 'from pydoc import help', the bizarre
2409 behavior returns, but this will also happen in normal python, so
2417 behavior returns, but this will also happen in normal python, so
2410 it's not an ipython bug anymore (it has to do with how pydoc.help
2418 it's not an ipython bug anymore (it has to do with how pydoc.help
2411 is implemented).
2419 is implemented).
2412
2420
2413 2003-05-22 Fernando Perez <fperez@colorado.edu>
2421 2003-05-22 Fernando Perez <fperez@colorado.edu>
2414
2422
2415 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2423 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2416 return [] instead of None when nothing matches, also match to end
2424 return [] instead of None when nothing matches, also match to end
2417 of line. Patch by Gary Bishop.
2425 of line. Patch by Gary Bishop.
2418
2426
2419 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2427 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2420 protection as before, for files passed on the command line. This
2428 protection as before, for files passed on the command line. This
2421 prevents the CrashHandler from kicking in if user files call into
2429 prevents the CrashHandler from kicking in if user files call into
2422 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2430 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2423 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2431 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2424
2432
2425 2003-05-20 *** Released version 0.4.0
2433 2003-05-20 *** Released version 0.4.0
2426
2434
2427 2003-05-20 Fernando Perez <fperez@colorado.edu>
2435 2003-05-20 Fernando Perez <fperez@colorado.edu>
2428
2436
2429 * setup.py: added support for manpages. It's a bit hackish b/c of
2437 * setup.py: added support for manpages. It's a bit hackish b/c of
2430 a bug in the way the bdist_rpm distutils target handles gzipped
2438 a bug in the way the bdist_rpm distutils target handles gzipped
2431 manpages, but it works. After a patch by Jack.
2439 manpages, but it works. After a patch by Jack.
2432
2440
2433 2003-05-19 Fernando Perez <fperez@colorado.edu>
2441 2003-05-19 Fernando Perez <fperez@colorado.edu>
2434
2442
2435 * IPython/numutils.py: added a mockup of the kinds module, since
2443 * IPython/numutils.py: added a mockup of the kinds module, since
2436 it was recently removed from Numeric. This way, numutils will
2444 it was recently removed from Numeric. This way, numutils will
2437 work for all users even if they are missing kinds.
2445 work for all users even if they are missing kinds.
2438
2446
2439 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2447 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2440 failure, which can occur with SWIG-wrapped extensions. After a
2448 failure, which can occur with SWIG-wrapped extensions. After a
2441 crash report from Prabhu.
2449 crash report from Prabhu.
2442
2450
2443 2003-05-16 Fernando Perez <fperez@colorado.edu>
2451 2003-05-16 Fernando Perez <fperez@colorado.edu>
2444
2452
2445 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2453 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2446 protect ipython from user code which may call directly
2454 protect ipython from user code which may call directly
2447 sys.excepthook (this looks like an ipython crash to the user, even
2455 sys.excepthook (this looks like an ipython crash to the user, even
2448 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2456 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2449 This is especially important to help users of WxWindows, but may
2457 This is especially important to help users of WxWindows, but may
2450 also be useful in other cases.
2458 also be useful in other cases.
2451
2459
2452 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2460 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2453 an optional tb_offset to be specified, and to preserve exception
2461 an optional tb_offset to be specified, and to preserve exception
2454 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2462 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2455
2463
2456 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2464 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2457
2465
2458 2003-05-15 Fernando Perez <fperez@colorado.edu>
2466 2003-05-15 Fernando Perez <fperez@colorado.edu>
2459
2467
2460 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2468 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2461 installing for a new user under Windows.
2469 installing for a new user under Windows.
2462
2470
2463 2003-05-12 Fernando Perez <fperez@colorado.edu>
2471 2003-05-12 Fernando Perez <fperez@colorado.edu>
2464
2472
2465 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2473 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2466 handler for Emacs comint-based lines. Currently it doesn't do
2474 handler for Emacs comint-based lines. Currently it doesn't do
2467 much (but importantly, it doesn't update the history cache). In
2475 much (but importantly, it doesn't update the history cache). In
2468 the future it may be expanded if Alex needs more functionality
2476 the future it may be expanded if Alex needs more functionality
2469 there.
2477 there.
2470
2478
2471 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2479 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2472 info to crash reports.
2480 info to crash reports.
2473
2481
2474 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2482 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2475 just like Python's -c. Also fixed crash with invalid -color
2483 just like Python's -c. Also fixed crash with invalid -color
2476 option value at startup. Thanks to Will French
2484 option value at startup. Thanks to Will French
2477 <wfrench-AT-bestweb.net> for the bug report.
2485 <wfrench-AT-bestweb.net> for the bug report.
2478
2486
2479 2003-05-09 Fernando Perez <fperez@colorado.edu>
2487 2003-05-09 Fernando Perez <fperez@colorado.edu>
2480
2488
2481 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2489 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2482 to EvalDict (it's a mapping, after all) and simplified its code
2490 to EvalDict (it's a mapping, after all) and simplified its code
2483 quite a bit, after a nice discussion on c.l.py where Gustavo
2491 quite a bit, after a nice discussion on c.l.py where Gustavo
2484 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2492 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2485
2493
2486 2003-04-30 Fernando Perez <fperez@colorado.edu>
2494 2003-04-30 Fernando Perez <fperez@colorado.edu>
2487
2495
2488 * IPython/genutils.py (timings_out): modified it to reduce its
2496 * IPython/genutils.py (timings_out): modified it to reduce its
2489 overhead in the common reps==1 case.
2497 overhead in the common reps==1 case.
2490
2498
2491 2003-04-29 Fernando Perez <fperez@colorado.edu>
2499 2003-04-29 Fernando Perez <fperez@colorado.edu>
2492
2500
2493 * IPython/genutils.py (timings_out): Modified to use the resource
2501 * IPython/genutils.py (timings_out): Modified to use the resource
2494 module, which avoids the wraparound problems of time.clock().
2502 module, which avoids the wraparound problems of time.clock().
2495
2503
2496 2003-04-17 *** Released version 0.2.15pre4
2504 2003-04-17 *** Released version 0.2.15pre4
2497
2505
2498 2003-04-17 Fernando Perez <fperez@colorado.edu>
2506 2003-04-17 Fernando Perez <fperez@colorado.edu>
2499
2507
2500 * setup.py (scriptfiles): Split windows-specific stuff over to a
2508 * setup.py (scriptfiles): Split windows-specific stuff over to a
2501 separate file, in an attempt to have a Windows GUI installer.
2509 separate file, in an attempt to have a Windows GUI installer.
2502 That didn't work, but part of the groundwork is done.
2510 That didn't work, but part of the groundwork is done.
2503
2511
2504 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2512 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2505 indent/unindent with 4 spaces. Particularly useful in combination
2513 indent/unindent with 4 spaces. Particularly useful in combination
2506 with the new auto-indent option.
2514 with the new auto-indent option.
2507
2515
2508 2003-04-16 Fernando Perez <fperez@colorado.edu>
2516 2003-04-16 Fernando Perez <fperez@colorado.edu>
2509
2517
2510 * IPython/Magic.py: various replacements of self.rc for
2518 * IPython/Magic.py: various replacements of self.rc for
2511 self.shell.rc. A lot more remains to be done to fully disentangle
2519 self.shell.rc. A lot more remains to be done to fully disentangle
2512 this class from the main Shell class.
2520 this class from the main Shell class.
2513
2521
2514 * IPython/GnuplotRuntime.py: added checks for mouse support so
2522 * IPython/GnuplotRuntime.py: added checks for mouse support so
2515 that we don't try to enable it if the current gnuplot doesn't
2523 that we don't try to enable it if the current gnuplot doesn't
2516 really support it. Also added checks so that we don't try to
2524 really support it. Also added checks so that we don't try to
2517 enable persist under Windows (where Gnuplot doesn't recognize the
2525 enable persist under Windows (where Gnuplot doesn't recognize the
2518 option).
2526 option).
2519
2527
2520 * IPython/iplib.py (InteractiveShell.interact): Added optional
2528 * IPython/iplib.py (InteractiveShell.interact): Added optional
2521 auto-indenting code, after a patch by King C. Shu
2529 auto-indenting code, after a patch by King C. Shu
2522 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2530 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2523 get along well with pasting indented code. If I ever figure out
2531 get along well with pasting indented code. If I ever figure out
2524 how to make that part go well, it will become on by default.
2532 how to make that part go well, it will become on by default.
2525
2533
2526 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2534 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2527 crash ipython if there was an unmatched '%' in the user's prompt
2535 crash ipython if there was an unmatched '%' in the user's prompt
2528 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2536 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2529
2537
2530 * IPython/iplib.py (InteractiveShell.interact): removed the
2538 * IPython/iplib.py (InteractiveShell.interact): removed the
2531 ability to ask the user whether he wants to crash or not at the
2539 ability to ask the user whether he wants to crash or not at the
2532 'last line' exception handler. Calling functions at that point
2540 'last line' exception handler. Calling functions at that point
2533 changes the stack, and the error reports would have incorrect
2541 changes the stack, and the error reports would have incorrect
2534 tracebacks.
2542 tracebacks.
2535
2543
2536 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2544 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2537 pass through a peger a pretty-printed form of any object. After a
2545 pass through a peger a pretty-printed form of any object. After a
2538 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2546 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2539
2547
2540 2003-04-14 Fernando Perez <fperez@colorado.edu>
2548 2003-04-14 Fernando Perez <fperez@colorado.edu>
2541
2549
2542 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2550 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2543 all files in ~ would be modified at first install (instead of
2551 all files in ~ would be modified at first install (instead of
2544 ~/.ipython). This could be potentially disastrous, as the
2552 ~/.ipython). This could be potentially disastrous, as the
2545 modification (make line-endings native) could damage binary files.
2553 modification (make line-endings native) could damage binary files.
2546
2554
2547 2003-04-10 Fernando Perez <fperez@colorado.edu>
2555 2003-04-10 Fernando Perez <fperez@colorado.edu>
2548
2556
2549 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2557 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2550 handle only lines which are invalid python. This now means that
2558 handle only lines which are invalid python. This now means that
2551 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2559 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2552 for the bug report.
2560 for the bug report.
2553
2561
2554 2003-04-01 Fernando Perez <fperez@colorado.edu>
2562 2003-04-01 Fernando Perez <fperez@colorado.edu>
2555
2563
2556 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2564 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2557 where failing to set sys.last_traceback would crash pdb.pm().
2565 where failing to set sys.last_traceback would crash pdb.pm().
2558 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2566 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2559 report.
2567 report.
2560
2568
2561 2003-03-25 Fernando Perez <fperez@colorado.edu>
2569 2003-03-25 Fernando Perez <fperez@colorado.edu>
2562
2570
2563 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2571 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2564 before printing it (it had a lot of spurious blank lines at the
2572 before printing it (it had a lot of spurious blank lines at the
2565 end).
2573 end).
2566
2574
2567 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2575 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2568 output would be sent 21 times! Obviously people don't use this
2576 output would be sent 21 times! Obviously people don't use this
2569 too often, or I would have heard about it.
2577 too often, or I would have heard about it.
2570
2578
2571 2003-03-24 Fernando Perez <fperez@colorado.edu>
2579 2003-03-24 Fernando Perez <fperez@colorado.edu>
2572
2580
2573 * setup.py (scriptfiles): renamed the data_files parameter from
2581 * setup.py (scriptfiles): renamed the data_files parameter from
2574 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2582 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2575 for the patch.
2583 for the patch.
2576
2584
2577 2003-03-20 Fernando Perez <fperez@colorado.edu>
2585 2003-03-20 Fernando Perez <fperez@colorado.edu>
2578
2586
2579 * IPython/genutils.py (error): added error() and fatal()
2587 * IPython/genutils.py (error): added error() and fatal()
2580 functions.
2588 functions.
2581
2589
2582 2003-03-18 *** Released version 0.2.15pre3
2590 2003-03-18 *** Released version 0.2.15pre3
2583
2591
2584 2003-03-18 Fernando Perez <fperez@colorado.edu>
2592 2003-03-18 Fernando Perez <fperez@colorado.edu>
2585
2593
2586 * setupext/install_data_ext.py
2594 * setupext/install_data_ext.py
2587 (install_data_ext.initialize_options): Class contributed by Jack
2595 (install_data_ext.initialize_options): Class contributed by Jack
2588 Moffit for fixing the old distutils hack. He is sending this to
2596 Moffit for fixing the old distutils hack. He is sending this to
2589 the distutils folks so in the future we may not need it as a
2597 the distutils folks so in the future we may not need it as a
2590 private fix.
2598 private fix.
2591
2599
2592 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2600 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2593 changes for Debian packaging. See his patch for full details.
2601 changes for Debian packaging. See his patch for full details.
2594 The old distutils hack of making the ipythonrc* files carry a
2602 The old distutils hack of making the ipythonrc* files carry a
2595 bogus .py extension is gone, at last. Examples were moved to a
2603 bogus .py extension is gone, at last. Examples were moved to a
2596 separate subdir under doc/, and the separate executable scripts
2604 separate subdir under doc/, and the separate executable scripts
2597 now live in their own directory. Overall a great cleanup. The
2605 now live in their own directory. Overall a great cleanup. The
2598 manual was updated to use the new files, and setup.py has been
2606 manual was updated to use the new files, and setup.py has been
2599 fixed for this setup.
2607 fixed for this setup.
2600
2608
2601 * IPython/PyColorize.py (Parser.usage): made non-executable and
2609 * IPython/PyColorize.py (Parser.usage): made non-executable and
2602 created a pycolor wrapper around it to be included as a script.
2610 created a pycolor wrapper around it to be included as a script.
2603
2611
2604 2003-03-12 *** Released version 0.2.15pre2
2612 2003-03-12 *** Released version 0.2.15pre2
2605
2613
2606 2003-03-12 Fernando Perez <fperez@colorado.edu>
2614 2003-03-12 Fernando Perez <fperez@colorado.edu>
2607
2615
2608 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2616 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2609 long-standing problem with garbage characters in some terminals.
2617 long-standing problem with garbage characters in some terminals.
2610 The issue was really that the \001 and \002 escapes must _only_ be
2618 The issue was really that the \001 and \002 escapes must _only_ be
2611 passed to input prompts (which call readline), but _never_ to
2619 passed to input prompts (which call readline), but _never_ to
2612 normal text to be printed on screen. I changed ColorANSI to have
2620 normal text to be printed on screen. I changed ColorANSI to have
2613 two classes: TermColors and InputTermColors, each with the
2621 two classes: TermColors and InputTermColors, each with the
2614 appropriate escapes for input prompts or normal text. The code in
2622 appropriate escapes for input prompts or normal text. The code in
2615 Prompts.py got slightly more complicated, but this very old and
2623 Prompts.py got slightly more complicated, but this very old and
2616 annoying bug is finally fixed.
2624 annoying bug is finally fixed.
2617
2625
2618 All the credit for nailing down the real origin of this problem
2626 All the credit for nailing down the real origin of this problem
2619 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2627 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2620 *Many* thanks to him for spending quite a bit of effort on this.
2628 *Many* thanks to him for spending quite a bit of effort on this.
2621
2629
2622 2003-03-05 *** Released version 0.2.15pre1
2630 2003-03-05 *** Released version 0.2.15pre1
2623
2631
2624 2003-03-03 Fernando Perez <fperez@colorado.edu>
2632 2003-03-03 Fernando Perez <fperez@colorado.edu>
2625
2633
2626 * IPython/FakeModule.py: Moved the former _FakeModule to a
2634 * IPython/FakeModule.py: Moved the former _FakeModule to a
2627 separate file, because it's also needed by Magic (to fix a similar
2635 separate file, because it's also needed by Magic (to fix a similar
2628 pickle-related issue in @run).
2636 pickle-related issue in @run).
2629
2637
2630 2003-03-02 Fernando Perez <fperez@colorado.edu>
2638 2003-03-02 Fernando Perez <fperez@colorado.edu>
2631
2639
2632 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2640 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2633 the autocall option at runtime.
2641 the autocall option at runtime.
2634 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2642 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2635 across Magic.py to start separating Magic from InteractiveShell.
2643 across Magic.py to start separating Magic from InteractiveShell.
2636 (Magic._ofind): Fixed to return proper namespace for dotted
2644 (Magic._ofind): Fixed to return proper namespace for dotted
2637 names. Before, a dotted name would always return 'not currently
2645 names. Before, a dotted name would always return 'not currently
2638 defined', because it would find the 'parent'. s.x would be found,
2646 defined', because it would find the 'parent'. s.x would be found,
2639 but since 'x' isn't defined by itself, it would get confused.
2647 but since 'x' isn't defined by itself, it would get confused.
2640 (Magic.magic_run): Fixed pickling problems reported by Ralf
2648 (Magic.magic_run): Fixed pickling problems reported by Ralf
2641 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2649 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2642 that I'd used when Mike Heeter reported similar issues at the
2650 that I'd used when Mike Heeter reported similar issues at the
2643 top-level, but now for @run. It boils down to injecting the
2651 top-level, but now for @run. It boils down to injecting the
2644 namespace where code is being executed with something that looks
2652 namespace where code is being executed with something that looks
2645 enough like a module to fool pickle.dump(). Since a pickle stores
2653 enough like a module to fool pickle.dump(). Since a pickle stores
2646 a named reference to the importing module, we need this for
2654 a named reference to the importing module, we need this for
2647 pickles to save something sensible.
2655 pickles to save something sensible.
2648
2656
2649 * IPython/ipmaker.py (make_IPython): added an autocall option.
2657 * IPython/ipmaker.py (make_IPython): added an autocall option.
2650
2658
2651 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2659 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2652 the auto-eval code. Now autocalling is an option, and the code is
2660 the auto-eval code. Now autocalling is an option, and the code is
2653 also vastly safer. There is no more eval() involved at all.
2661 also vastly safer. There is no more eval() involved at all.
2654
2662
2655 2003-03-01 Fernando Perez <fperez@colorado.edu>
2663 2003-03-01 Fernando Perez <fperez@colorado.edu>
2656
2664
2657 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2665 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2658 dict with named keys instead of a tuple.
2666 dict with named keys instead of a tuple.
2659
2667
2660 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2668 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2661
2669
2662 * setup.py (make_shortcut): Fixed message about directories
2670 * setup.py (make_shortcut): Fixed message about directories
2663 created during Windows installation (the directories were ok, just
2671 created during Windows installation (the directories were ok, just
2664 the printed message was misleading). Thanks to Chris Liechti
2672 the printed message was misleading). Thanks to Chris Liechti
2665 <cliechti-AT-gmx.net> for the heads up.
2673 <cliechti-AT-gmx.net> for the heads up.
2666
2674
2667 2003-02-21 Fernando Perez <fperez@colorado.edu>
2675 2003-02-21 Fernando Perez <fperez@colorado.edu>
2668
2676
2669 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2677 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2670 of ValueError exception when checking for auto-execution. This
2678 of ValueError exception when checking for auto-execution. This
2671 one is raised by things like Numeric arrays arr.flat when the
2679 one is raised by things like Numeric arrays arr.flat when the
2672 array is non-contiguous.
2680 array is non-contiguous.
2673
2681
2674 2003-01-31 Fernando Perez <fperez@colorado.edu>
2682 2003-01-31 Fernando Perez <fperez@colorado.edu>
2675
2683
2676 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2684 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2677 not return any value at all (even though the command would get
2685 not return any value at all (even though the command would get
2678 executed).
2686 executed).
2679 (xsys): Flush stdout right after printing the command to ensure
2687 (xsys): Flush stdout right after printing the command to ensure
2680 proper ordering of commands and command output in the total
2688 proper ordering of commands and command output in the total
2681 output.
2689 output.
2682 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2690 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2683 system/getoutput as defaults. The old ones are kept for
2691 system/getoutput as defaults. The old ones are kept for
2684 compatibility reasons, so no code which uses this library needs
2692 compatibility reasons, so no code which uses this library needs
2685 changing.
2693 changing.
2686
2694
2687 2003-01-27 *** Released version 0.2.14
2695 2003-01-27 *** Released version 0.2.14
2688
2696
2689 2003-01-25 Fernando Perez <fperez@colorado.edu>
2697 2003-01-25 Fernando Perez <fperez@colorado.edu>
2690
2698
2691 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2699 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2692 functions defined in previous edit sessions could not be re-edited
2700 functions defined in previous edit sessions could not be re-edited
2693 (because the temp files were immediately removed). Now temp files
2701 (because the temp files were immediately removed). Now temp files
2694 are removed only at IPython's exit.
2702 are removed only at IPython's exit.
2695 (Magic.magic_run): Improved @run to perform shell-like expansions
2703 (Magic.magic_run): Improved @run to perform shell-like expansions
2696 on its arguments (~users and $VARS). With this, @run becomes more
2704 on its arguments (~users and $VARS). With this, @run becomes more
2697 like a normal command-line.
2705 like a normal command-line.
2698
2706
2699 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2707 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2700 bugs related to embedding and cleaned up that code. A fairly
2708 bugs related to embedding and cleaned up that code. A fairly
2701 important one was the impossibility to access the global namespace
2709 important one was the impossibility to access the global namespace
2702 through the embedded IPython (only local variables were visible).
2710 through the embedded IPython (only local variables were visible).
2703
2711
2704 2003-01-14 Fernando Perez <fperez@colorado.edu>
2712 2003-01-14 Fernando Perez <fperez@colorado.edu>
2705
2713
2706 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2714 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2707 auto-calling to be a bit more conservative. Now it doesn't get
2715 auto-calling to be a bit more conservative. Now it doesn't get
2708 triggered if any of '!=()<>' are in the rest of the input line, to
2716 triggered if any of '!=()<>' are in the rest of the input line, to
2709 allow comparing callables. Thanks to Alex for the heads up.
2717 allow comparing callables. Thanks to Alex for the heads up.
2710
2718
2711 2003-01-07 Fernando Perez <fperez@colorado.edu>
2719 2003-01-07 Fernando Perez <fperez@colorado.edu>
2712
2720
2713 * IPython/genutils.py (page): fixed estimation of the number of
2721 * IPython/genutils.py (page): fixed estimation of the number of
2714 lines in a string to be paged to simply count newlines. This
2722 lines in a string to be paged to simply count newlines. This
2715 prevents over-guessing due to embedded escape sequences. A better
2723 prevents over-guessing due to embedded escape sequences. A better
2716 long-term solution would involve stripping out the control chars
2724 long-term solution would involve stripping out the control chars
2717 for the count, but it's potentially so expensive I just don't
2725 for the count, but it's potentially so expensive I just don't
2718 think it's worth doing.
2726 think it's worth doing.
2719
2727
2720 2002-12-19 *** Released version 0.2.14pre50
2728 2002-12-19 *** Released version 0.2.14pre50
2721
2729
2722 2002-12-19 Fernando Perez <fperez@colorado.edu>
2730 2002-12-19 Fernando Perez <fperez@colorado.edu>
2723
2731
2724 * tools/release (version): Changed release scripts to inform
2732 * tools/release (version): Changed release scripts to inform
2725 Andrea and build a NEWS file with a list of recent changes.
2733 Andrea and build a NEWS file with a list of recent changes.
2726
2734
2727 * IPython/ColorANSI.py (__all__): changed terminal detection
2735 * IPython/ColorANSI.py (__all__): changed terminal detection
2728 code. Seems to work better for xterms without breaking
2736 code. Seems to work better for xterms without breaking
2729 konsole. Will need more testing to determine if WinXP and Mac OSX
2737 konsole. Will need more testing to determine if WinXP and Mac OSX
2730 also work ok.
2738 also work ok.
2731
2739
2732 2002-12-18 *** Released version 0.2.14pre49
2740 2002-12-18 *** Released version 0.2.14pre49
2733
2741
2734 2002-12-18 Fernando Perez <fperez@colorado.edu>
2742 2002-12-18 Fernando Perez <fperez@colorado.edu>
2735
2743
2736 * Docs: added new info about Mac OSX, from Andrea.
2744 * Docs: added new info about Mac OSX, from Andrea.
2737
2745
2738 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2746 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2739 allow direct plotting of python strings whose format is the same
2747 allow direct plotting of python strings whose format is the same
2740 of gnuplot data files.
2748 of gnuplot data files.
2741
2749
2742 2002-12-16 Fernando Perez <fperez@colorado.edu>
2750 2002-12-16 Fernando Perez <fperez@colorado.edu>
2743
2751
2744 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2752 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2745 value of exit question to be acknowledged.
2753 value of exit question to be acknowledged.
2746
2754
2747 2002-12-03 Fernando Perez <fperez@colorado.edu>
2755 2002-12-03 Fernando Perez <fperez@colorado.edu>
2748
2756
2749 * IPython/ipmaker.py: removed generators, which had been added
2757 * IPython/ipmaker.py: removed generators, which had been added
2750 by mistake in an earlier debugging run. This was causing trouble
2758 by mistake in an earlier debugging run. This was causing trouble
2751 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2759 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2752 for pointing this out.
2760 for pointing this out.
2753
2761
2754 2002-11-17 Fernando Perez <fperez@colorado.edu>
2762 2002-11-17 Fernando Perez <fperez@colorado.edu>
2755
2763
2756 * Manual: updated the Gnuplot section.
2764 * Manual: updated the Gnuplot section.
2757
2765
2758 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2766 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2759 a much better split of what goes in Runtime and what goes in
2767 a much better split of what goes in Runtime and what goes in
2760 Interactive.
2768 Interactive.
2761
2769
2762 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2770 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2763 being imported from iplib.
2771 being imported from iplib.
2764
2772
2765 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2773 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2766 for command-passing. Now the global Gnuplot instance is called
2774 for command-passing. Now the global Gnuplot instance is called
2767 'gp' instead of 'g', which was really a far too fragile and
2775 'gp' instead of 'g', which was really a far too fragile and
2768 common name.
2776 common name.
2769
2777
2770 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2778 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2771 bounding boxes generated by Gnuplot for square plots.
2779 bounding boxes generated by Gnuplot for square plots.
2772
2780
2773 * IPython/genutils.py (popkey): new function added. I should
2781 * IPython/genutils.py (popkey): new function added. I should
2774 suggest this on c.l.py as a dict method, it seems useful.
2782 suggest this on c.l.py as a dict method, it seems useful.
2775
2783
2776 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2784 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2777 to transparently handle PostScript generation. MUCH better than
2785 to transparently handle PostScript generation. MUCH better than
2778 the previous plot_eps/replot_eps (which I removed now). The code
2786 the previous plot_eps/replot_eps (which I removed now). The code
2779 is also fairly clean and well documented now (including
2787 is also fairly clean and well documented now (including
2780 docstrings).
2788 docstrings).
2781
2789
2782 2002-11-13 Fernando Perez <fperez@colorado.edu>
2790 2002-11-13 Fernando Perez <fperez@colorado.edu>
2783
2791
2784 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2792 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2785 (inconsistent with options).
2793 (inconsistent with options).
2786
2794
2787 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2795 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2788 manually disabled, I don't know why. Fixed it.
2796 manually disabled, I don't know why. Fixed it.
2789 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2797 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2790 eps output.
2798 eps output.
2791
2799
2792 2002-11-12 Fernando Perez <fperez@colorado.edu>
2800 2002-11-12 Fernando Perez <fperez@colorado.edu>
2793
2801
2794 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2802 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2795 don't propagate up to caller. Fixes crash reported by François
2803 don't propagate up to caller. Fixes crash reported by François
2796 Pinard.
2804 Pinard.
2797
2805
2798 2002-11-09 Fernando Perez <fperez@colorado.edu>
2806 2002-11-09 Fernando Perez <fperez@colorado.edu>
2799
2807
2800 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2808 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2801 history file for new users.
2809 history file for new users.
2802 (make_IPython): fixed bug where initial install would leave the
2810 (make_IPython): fixed bug where initial install would leave the
2803 user running in the .ipython dir.
2811 user running in the .ipython dir.
2804 (make_IPython): fixed bug where config dir .ipython would be
2812 (make_IPython): fixed bug where config dir .ipython would be
2805 created regardless of the given -ipythondir option. Thanks to Cory
2813 created regardless of the given -ipythondir option. Thanks to Cory
2806 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2814 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2807
2815
2808 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2816 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2809 type confirmations. Will need to use it in all of IPython's code
2817 type confirmations. Will need to use it in all of IPython's code
2810 consistently.
2818 consistently.
2811
2819
2812 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2820 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2813 context to print 31 lines instead of the default 5. This will make
2821 context to print 31 lines instead of the default 5. This will make
2814 the crash reports extremely detailed in case the problem is in
2822 the crash reports extremely detailed in case the problem is in
2815 libraries I don't have access to.
2823 libraries I don't have access to.
2816
2824
2817 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2825 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2818 line of defense' code to still crash, but giving users fair
2826 line of defense' code to still crash, but giving users fair
2819 warning. I don't want internal errors to go unreported: if there's
2827 warning. I don't want internal errors to go unreported: if there's
2820 an internal problem, IPython should crash and generate a full
2828 an internal problem, IPython should crash and generate a full
2821 report.
2829 report.
2822
2830
2823 2002-11-08 Fernando Perez <fperez@colorado.edu>
2831 2002-11-08 Fernando Perez <fperez@colorado.edu>
2824
2832
2825 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2833 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2826 otherwise uncaught exceptions which can appear if people set
2834 otherwise uncaught exceptions which can appear if people set
2827 sys.stdout to something badly broken. Thanks to a crash report
2835 sys.stdout to something badly broken. Thanks to a crash report
2828 from henni-AT-mail.brainbot.com.
2836 from henni-AT-mail.brainbot.com.
2829
2837
2830 2002-11-04 Fernando Perez <fperez@colorado.edu>
2838 2002-11-04 Fernando Perez <fperez@colorado.edu>
2831
2839
2832 * IPython/iplib.py (InteractiveShell.interact): added
2840 * IPython/iplib.py (InteractiveShell.interact): added
2833 __IPYTHON__active to the builtins. It's a flag which goes on when
2841 __IPYTHON__active to the builtins. It's a flag which goes on when
2834 the interaction starts and goes off again when it stops. This
2842 the interaction starts and goes off again when it stops. This
2835 allows embedding code to detect being inside IPython. Before this
2843 allows embedding code to detect being inside IPython. Before this
2836 was done via __IPYTHON__, but that only shows that an IPython
2844 was done via __IPYTHON__, but that only shows that an IPython
2837 instance has been created.
2845 instance has been created.
2838
2846
2839 * IPython/Magic.py (Magic.magic_env): I realized that in a
2847 * IPython/Magic.py (Magic.magic_env): I realized that in a
2840 UserDict, instance.data holds the data as a normal dict. So I
2848 UserDict, instance.data holds the data as a normal dict. So I
2841 modified @env to return os.environ.data instead of rebuilding a
2849 modified @env to return os.environ.data instead of rebuilding a
2842 dict by hand.
2850 dict by hand.
2843
2851
2844 2002-11-02 Fernando Perez <fperez@colorado.edu>
2852 2002-11-02 Fernando Perez <fperez@colorado.edu>
2845
2853
2846 * IPython/genutils.py (warn): changed so that level 1 prints no
2854 * IPython/genutils.py (warn): changed so that level 1 prints no
2847 header. Level 2 is now the default (with 'WARNING' header, as
2855 header. Level 2 is now the default (with 'WARNING' header, as
2848 before). I think I tracked all places where changes were needed in
2856 before). I think I tracked all places where changes were needed in
2849 IPython, but outside code using the old level numbering may have
2857 IPython, but outside code using the old level numbering may have
2850 broken.
2858 broken.
2851
2859
2852 * IPython/iplib.py (InteractiveShell.runcode): added this to
2860 * IPython/iplib.py (InteractiveShell.runcode): added this to
2853 handle the tracebacks in SystemExit traps correctly. The previous
2861 handle the tracebacks in SystemExit traps correctly. The previous
2854 code (through interact) was printing more of the stack than
2862 code (through interact) was printing more of the stack than
2855 necessary, showing IPython internal code to the user.
2863 necessary, showing IPython internal code to the user.
2856
2864
2857 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2865 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2858 default. Now that the default at the confirmation prompt is yes,
2866 default. Now that the default at the confirmation prompt is yes,
2859 it's not so intrusive. François' argument that ipython sessions
2867 it's not so intrusive. François' argument that ipython sessions
2860 tend to be complex enough not to lose them from an accidental C-d,
2868 tend to be complex enough not to lose them from an accidental C-d,
2861 is a valid one.
2869 is a valid one.
2862
2870
2863 * IPython/iplib.py (InteractiveShell.interact): added a
2871 * IPython/iplib.py (InteractiveShell.interact): added a
2864 showtraceback() call to the SystemExit trap, and modified the exit
2872 showtraceback() call to the SystemExit trap, and modified the exit
2865 confirmation to have yes as the default.
2873 confirmation to have yes as the default.
2866
2874
2867 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2875 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2868 this file. It's been gone from the code for a long time, this was
2876 this file. It's been gone from the code for a long time, this was
2869 simply leftover junk.
2877 simply leftover junk.
2870
2878
2871 2002-11-01 Fernando Perez <fperez@colorado.edu>
2879 2002-11-01 Fernando Perez <fperez@colorado.edu>
2872
2880
2873 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2881 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2874 added. If set, IPython now traps EOF and asks for
2882 added. If set, IPython now traps EOF and asks for
2875 confirmation. After a request by François Pinard.
2883 confirmation. After a request by François Pinard.
2876
2884
2877 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2885 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2878 of @abort, and with a new (better) mechanism for handling the
2886 of @abort, and with a new (better) mechanism for handling the
2879 exceptions.
2887 exceptions.
2880
2888
2881 2002-10-27 Fernando Perez <fperez@colorado.edu>
2889 2002-10-27 Fernando Perez <fperez@colorado.edu>
2882
2890
2883 * IPython/usage.py (__doc__): updated the --help information and
2891 * IPython/usage.py (__doc__): updated the --help information and
2884 the ipythonrc file to indicate that -log generates
2892 the ipythonrc file to indicate that -log generates
2885 ./ipython.log. Also fixed the corresponding info in @logstart.
2893 ./ipython.log. Also fixed the corresponding info in @logstart.
2886 This and several other fixes in the manuals thanks to reports by
2894 This and several other fixes in the manuals thanks to reports by
2887 François Pinard <pinard-AT-iro.umontreal.ca>.
2895 François Pinard <pinard-AT-iro.umontreal.ca>.
2888
2896
2889 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2897 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2890 refer to @logstart (instead of @log, which doesn't exist).
2898 refer to @logstart (instead of @log, which doesn't exist).
2891
2899
2892 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2900 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2893 AttributeError crash. Thanks to Christopher Armstrong
2901 AttributeError crash. Thanks to Christopher Armstrong
2894 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2902 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2895 introduced recently (in 0.2.14pre37) with the fix to the eval
2903 introduced recently (in 0.2.14pre37) with the fix to the eval
2896 problem mentioned below.
2904 problem mentioned below.
2897
2905
2898 2002-10-17 Fernando Perez <fperez@colorado.edu>
2906 2002-10-17 Fernando Perez <fperez@colorado.edu>
2899
2907
2900 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2908 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2901 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2909 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2902
2910
2903 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2911 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2904 this function to fix a problem reported by Alex Schmolck. He saw
2912 this function to fix a problem reported by Alex Schmolck. He saw
2905 it with list comprehensions and generators, which were getting
2913 it with list comprehensions and generators, which were getting
2906 called twice. The real problem was an 'eval' call in testing for
2914 called twice. The real problem was an 'eval' call in testing for
2907 automagic which was evaluating the input line silently.
2915 automagic which was evaluating the input line silently.
2908
2916
2909 This is a potentially very nasty bug, if the input has side
2917 This is a potentially very nasty bug, if the input has side
2910 effects which must not be repeated. The code is much cleaner now,
2918 effects which must not be repeated. The code is much cleaner now,
2911 without any blanket 'except' left and with a regexp test for
2919 without any blanket 'except' left and with a regexp test for
2912 actual function names.
2920 actual function names.
2913
2921
2914 But an eval remains, which I'm not fully comfortable with. I just
2922 But an eval remains, which I'm not fully comfortable with. I just
2915 don't know how to find out if an expression could be a callable in
2923 don't know how to find out if an expression could be a callable in
2916 the user's namespace without doing an eval on the string. However
2924 the user's namespace without doing an eval on the string. However
2917 that string is now much more strictly checked so that no code
2925 that string is now much more strictly checked so that no code
2918 slips by, so the eval should only happen for things that can
2926 slips by, so the eval should only happen for things that can
2919 really be only function/method names.
2927 really be only function/method names.
2920
2928
2921 2002-10-15 Fernando Perez <fperez@colorado.edu>
2929 2002-10-15 Fernando Perez <fperez@colorado.edu>
2922
2930
2923 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2931 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2924 OSX information to main manual, removed README_Mac_OSX file from
2932 OSX information to main manual, removed README_Mac_OSX file from
2925 distribution. Also updated credits for recent additions.
2933 distribution. Also updated credits for recent additions.
2926
2934
2927 2002-10-10 Fernando Perez <fperez@colorado.edu>
2935 2002-10-10 Fernando Perez <fperez@colorado.edu>
2928
2936
2929 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2937 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2930 terminal-related issues. Many thanks to Andrea Riciputi
2938 terminal-related issues. Many thanks to Andrea Riciputi
2931 <andrea.riciputi-AT-libero.it> for writing it.
2939 <andrea.riciputi-AT-libero.it> for writing it.
2932
2940
2933 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2941 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2934 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2942 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2935
2943
2936 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2944 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2937 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2945 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2938 <syver-en-AT-online.no> who both submitted patches for this problem.
2946 <syver-en-AT-online.no> who both submitted patches for this problem.
2939
2947
2940 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2948 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2941 global embedding to make sure that things don't overwrite user
2949 global embedding to make sure that things don't overwrite user
2942 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2950 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2943
2951
2944 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2952 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2945 compatibility. Thanks to Hayden Callow
2953 compatibility. Thanks to Hayden Callow
2946 <h.callow-AT-elec.canterbury.ac.nz>
2954 <h.callow-AT-elec.canterbury.ac.nz>
2947
2955
2948 2002-10-04 Fernando Perez <fperez@colorado.edu>
2956 2002-10-04 Fernando Perez <fperez@colorado.edu>
2949
2957
2950 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2958 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2951 Gnuplot.File objects.
2959 Gnuplot.File objects.
2952
2960
2953 2002-07-23 Fernando Perez <fperez@colorado.edu>
2961 2002-07-23 Fernando Perez <fperez@colorado.edu>
2954
2962
2955 * IPython/genutils.py (timing): Added timings() and timing() for
2963 * IPython/genutils.py (timing): Added timings() and timing() for
2956 quick access to the most commonly needed data, the execution
2964 quick access to the most commonly needed data, the execution
2957 times. Old timing() renamed to timings_out().
2965 times. Old timing() renamed to timings_out().
2958
2966
2959 2002-07-18 Fernando Perez <fperez@colorado.edu>
2967 2002-07-18 Fernando Perez <fperez@colorado.edu>
2960
2968
2961 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2969 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2962 bug with nested instances disrupting the parent's tab completion.
2970 bug with nested instances disrupting the parent's tab completion.
2963
2971
2964 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2972 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2965 all_completions code to begin the emacs integration.
2973 all_completions code to begin the emacs integration.
2966
2974
2967 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2975 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2968 argument to allow titling individual arrays when plotting.
2976 argument to allow titling individual arrays when plotting.
2969
2977
2970 2002-07-15 Fernando Perez <fperez@colorado.edu>
2978 2002-07-15 Fernando Perez <fperez@colorado.edu>
2971
2979
2972 * setup.py (make_shortcut): changed to retrieve the value of
2980 * setup.py (make_shortcut): changed to retrieve the value of
2973 'Program Files' directory from the registry (this value changes in
2981 'Program Files' directory from the registry (this value changes in
2974 non-english versions of Windows). Thanks to Thomas Fanslau
2982 non-english versions of Windows). Thanks to Thomas Fanslau
2975 <tfanslau-AT-gmx.de> for the report.
2983 <tfanslau-AT-gmx.de> for the report.
2976
2984
2977 2002-07-10 Fernando Perez <fperez@colorado.edu>
2985 2002-07-10 Fernando Perez <fperez@colorado.edu>
2978
2986
2979 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2987 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2980 a bug in pdb, which crashes if a line with only whitespace is
2988 a bug in pdb, which crashes if a line with only whitespace is
2981 entered. Bug report submitted to sourceforge.
2989 entered. Bug report submitted to sourceforge.
2982
2990
2983 2002-07-09 Fernando Perez <fperez@colorado.edu>
2991 2002-07-09 Fernando Perez <fperez@colorado.edu>
2984
2992
2985 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2993 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2986 reporting exceptions (it's a bug in inspect.py, I just set a
2994 reporting exceptions (it's a bug in inspect.py, I just set a
2987 workaround).
2995 workaround).
2988
2996
2989 2002-07-08 Fernando Perez <fperez@colorado.edu>
2997 2002-07-08 Fernando Perez <fperez@colorado.edu>
2990
2998
2991 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2999 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2992 __IPYTHON__ in __builtins__ to show up in user_ns.
3000 __IPYTHON__ in __builtins__ to show up in user_ns.
2993
3001
2994 2002-07-03 Fernando Perez <fperez@colorado.edu>
3002 2002-07-03 Fernando Perez <fperez@colorado.edu>
2995
3003
2996 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3004 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2997 name from @gp_set_instance to @gp_set_default.
3005 name from @gp_set_instance to @gp_set_default.
2998
3006
2999 * IPython/ipmaker.py (make_IPython): default editor value set to
3007 * IPython/ipmaker.py (make_IPython): default editor value set to
3000 '0' (a string), to match the rc file. Otherwise will crash when
3008 '0' (a string), to match the rc file. Otherwise will crash when
3001 .strip() is called on it.
3009 .strip() is called on it.
3002
3010
3003
3011
3004 2002-06-28 Fernando Perez <fperez@colorado.edu>
3012 2002-06-28 Fernando Perez <fperez@colorado.edu>
3005
3013
3006 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3014 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3007 of files in current directory when a file is executed via
3015 of files in current directory when a file is executed via
3008 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3016 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3009
3017
3010 * setup.py (manfiles): fix for rpm builds, submitted by RA
3018 * setup.py (manfiles): fix for rpm builds, submitted by RA
3011 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3019 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3012
3020
3013 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3021 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3014 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3022 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3015 string!). A. Schmolck caught this one.
3023 string!). A. Schmolck caught this one.
3016
3024
3017 2002-06-27 Fernando Perez <fperez@colorado.edu>
3025 2002-06-27 Fernando Perez <fperez@colorado.edu>
3018
3026
3019 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3027 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3020 defined files at the cmd line. __name__ wasn't being set to
3028 defined files at the cmd line. __name__ wasn't being set to
3021 __main__.
3029 __main__.
3022
3030
3023 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3031 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3024 regular lists and tuples besides Numeric arrays.
3032 regular lists and tuples besides Numeric arrays.
3025
3033
3026 * IPython/Prompts.py (CachedOutput.__call__): Added output
3034 * IPython/Prompts.py (CachedOutput.__call__): Added output
3027 supression for input ending with ';'. Similar to Mathematica and
3035 supression for input ending with ';'. Similar to Mathematica and
3028 Matlab. The _* vars and Out[] list are still updated, just like
3036 Matlab. The _* vars and Out[] list are still updated, just like
3029 Mathematica behaves.
3037 Mathematica behaves.
3030
3038
3031 2002-06-25 Fernando Perez <fperez@colorado.edu>
3039 2002-06-25 Fernando Perez <fperez@colorado.edu>
3032
3040
3033 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3041 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3034 .ini extensions for profiels under Windows.
3042 .ini extensions for profiels under Windows.
3035
3043
3036 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3044 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3037 string form. Fix contributed by Alexander Schmolck
3045 string form. Fix contributed by Alexander Schmolck
3038 <a.schmolck-AT-gmx.net>
3046 <a.schmolck-AT-gmx.net>
3039
3047
3040 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3048 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3041 pre-configured Gnuplot instance.
3049 pre-configured Gnuplot instance.
3042
3050
3043 2002-06-21 Fernando Perez <fperez@colorado.edu>
3051 2002-06-21 Fernando Perez <fperez@colorado.edu>
3044
3052
3045 * IPython/numutils.py (exp_safe): new function, works around the
3053 * IPython/numutils.py (exp_safe): new function, works around the
3046 underflow problems in Numeric.
3054 underflow problems in Numeric.
3047 (log2): New fn. Safe log in base 2: returns exact integer answer
3055 (log2): New fn. Safe log in base 2: returns exact integer answer
3048 for exact integer powers of 2.
3056 for exact integer powers of 2.
3049
3057
3050 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3058 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3051 properly.
3059 properly.
3052
3060
3053 2002-06-20 Fernando Perez <fperez@colorado.edu>
3061 2002-06-20 Fernando Perez <fperez@colorado.edu>
3054
3062
3055 * IPython/genutils.py (timing): new function like
3063 * IPython/genutils.py (timing): new function like
3056 Mathematica's. Similar to time_test, but returns more info.
3064 Mathematica's. Similar to time_test, but returns more info.
3057
3065
3058 2002-06-18 Fernando Perez <fperez@colorado.edu>
3066 2002-06-18 Fernando Perez <fperez@colorado.edu>
3059
3067
3060 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3068 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3061 according to Mike Heeter's suggestions.
3069 according to Mike Heeter's suggestions.
3062
3070
3063 2002-06-16 Fernando Perez <fperez@colorado.edu>
3071 2002-06-16 Fernando Perez <fperez@colorado.edu>
3064
3072
3065 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3073 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3066 system. GnuplotMagic is gone as a user-directory option. New files
3074 system. GnuplotMagic is gone as a user-directory option. New files
3067 make it easier to use all the gnuplot stuff both from external
3075 make it easier to use all the gnuplot stuff both from external
3068 programs as well as from IPython. Had to rewrite part of
3076 programs as well as from IPython. Had to rewrite part of
3069 hardcopy() b/c of a strange bug: often the ps files simply don't
3077 hardcopy() b/c of a strange bug: often the ps files simply don't
3070 get created, and require a repeat of the command (often several
3078 get created, and require a repeat of the command (often several
3071 times).
3079 times).
3072
3080
3073 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3081 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3074 resolve output channel at call time, so that if sys.stderr has
3082 resolve output channel at call time, so that if sys.stderr has
3075 been redirected by user this gets honored.
3083 been redirected by user this gets honored.
3076
3084
3077 2002-06-13 Fernando Perez <fperez@colorado.edu>
3085 2002-06-13 Fernando Perez <fperez@colorado.edu>
3078
3086
3079 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3087 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3080 IPShell. Kept a copy with the old names to avoid breaking people's
3088 IPShell. Kept a copy with the old names to avoid breaking people's
3081 embedded code.
3089 embedded code.
3082
3090
3083 * IPython/ipython: simplified it to the bare minimum after
3091 * IPython/ipython: simplified it to the bare minimum after
3084 Holger's suggestions. Added info about how to use it in
3092 Holger's suggestions. Added info about how to use it in
3085 PYTHONSTARTUP.
3093 PYTHONSTARTUP.
3086
3094
3087 * IPython/Shell.py (IPythonShell): changed the options passing
3095 * IPython/Shell.py (IPythonShell): changed the options passing
3088 from a string with funky %s replacements to a straight list. Maybe
3096 from a string with funky %s replacements to a straight list. Maybe
3089 a bit more typing, but it follows sys.argv conventions, so there's
3097 a bit more typing, but it follows sys.argv conventions, so there's
3090 less special-casing to remember.
3098 less special-casing to remember.
3091
3099
3092 2002-06-12 Fernando Perez <fperez@colorado.edu>
3100 2002-06-12 Fernando Perez <fperez@colorado.edu>
3093
3101
3094 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3102 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3095 command. Thanks to a suggestion by Mike Heeter.
3103 command. Thanks to a suggestion by Mike Heeter.
3096 (Magic.magic_pfile): added behavior to look at filenames if given
3104 (Magic.magic_pfile): added behavior to look at filenames if given
3097 arg is not a defined object.
3105 arg is not a defined object.
3098 (Magic.magic_save): New @save function to save code snippets. Also
3106 (Magic.magic_save): New @save function to save code snippets. Also
3099 a Mike Heeter idea.
3107 a Mike Heeter idea.
3100
3108
3101 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3109 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3102 plot() and replot(). Much more convenient now, especially for
3110 plot() and replot(). Much more convenient now, especially for
3103 interactive use.
3111 interactive use.
3104
3112
3105 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3113 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3106 filenames.
3114 filenames.
3107
3115
3108 2002-06-02 Fernando Perez <fperez@colorado.edu>
3116 2002-06-02 Fernando Perez <fperez@colorado.edu>
3109
3117
3110 * IPython/Struct.py (Struct.__init__): modified to admit
3118 * IPython/Struct.py (Struct.__init__): modified to admit
3111 initialization via another struct.
3119 initialization via another struct.
3112
3120
3113 * IPython/genutils.py (SystemExec.__init__): New stateful
3121 * IPython/genutils.py (SystemExec.__init__): New stateful
3114 interface to xsys and bq. Useful for writing system scripts.
3122 interface to xsys and bq. Useful for writing system scripts.
3115
3123
3116 2002-05-30 Fernando Perez <fperez@colorado.edu>
3124 2002-05-30 Fernando Perez <fperez@colorado.edu>
3117
3125
3118 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3126 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3119 documents. This will make the user download smaller (it's getting
3127 documents. This will make the user download smaller (it's getting
3120 too big).
3128 too big).
3121
3129
3122 2002-05-29 Fernando Perez <fperez@colorado.edu>
3130 2002-05-29 Fernando Perez <fperez@colorado.edu>
3123
3131
3124 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3132 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3125 fix problems with shelve and pickle. Seems to work, but I don't
3133 fix problems with shelve and pickle. Seems to work, but I don't
3126 know if corner cases break it. Thanks to Mike Heeter
3134 know if corner cases break it. Thanks to Mike Heeter
3127 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3135 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3128
3136
3129 2002-05-24 Fernando Perez <fperez@colorado.edu>
3137 2002-05-24 Fernando Perez <fperez@colorado.edu>
3130
3138
3131 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3139 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3132 macros having broken.
3140 macros having broken.
3133
3141
3134 2002-05-21 Fernando Perez <fperez@colorado.edu>
3142 2002-05-21 Fernando Perez <fperez@colorado.edu>
3135
3143
3136 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3144 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3137 introduced logging bug: all history before logging started was
3145 introduced logging bug: all history before logging started was
3138 being written one character per line! This came from the redesign
3146 being written one character per line! This came from the redesign
3139 of the input history as a special list which slices to strings,
3147 of the input history as a special list which slices to strings,
3140 not to lists.
3148 not to lists.
3141
3149
3142 2002-05-20 Fernando Perez <fperez@colorado.edu>
3150 2002-05-20 Fernando Perez <fperez@colorado.edu>
3143
3151
3144 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3152 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3145 be an attribute of all classes in this module. The design of these
3153 be an attribute of all classes in this module. The design of these
3146 classes needs some serious overhauling.
3154 classes needs some serious overhauling.
3147
3155
3148 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3156 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3149 which was ignoring '_' in option names.
3157 which was ignoring '_' in option names.
3150
3158
3151 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3159 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3152 'Verbose_novars' to 'Context' and made it the new default. It's a
3160 'Verbose_novars' to 'Context' and made it the new default. It's a
3153 bit more readable and also safer than verbose.
3161 bit more readable and also safer than verbose.
3154
3162
3155 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3163 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3156 triple-quoted strings.
3164 triple-quoted strings.
3157
3165
3158 * IPython/OInspect.py (__all__): new module exposing the object
3166 * IPython/OInspect.py (__all__): new module exposing the object
3159 introspection facilities. Now the corresponding magics are dummy
3167 introspection facilities. Now the corresponding magics are dummy
3160 wrappers around this. Having this module will make it much easier
3168 wrappers around this. Having this module will make it much easier
3161 to put these functions into our modified pdb.
3169 to put these functions into our modified pdb.
3162 This new object inspector system uses the new colorizing module,
3170 This new object inspector system uses the new colorizing module,
3163 so source code and other things are nicely syntax highlighted.
3171 so source code and other things are nicely syntax highlighted.
3164
3172
3165 2002-05-18 Fernando Perez <fperez@colorado.edu>
3173 2002-05-18 Fernando Perez <fperez@colorado.edu>
3166
3174
3167 * IPython/ColorANSI.py: Split the coloring tools into a separate
3175 * IPython/ColorANSI.py: Split the coloring tools into a separate
3168 module so I can use them in other code easier (they were part of
3176 module so I can use them in other code easier (they were part of
3169 ultraTB).
3177 ultraTB).
3170
3178
3171 2002-05-17 Fernando Perez <fperez@colorado.edu>
3179 2002-05-17 Fernando Perez <fperez@colorado.edu>
3172
3180
3173 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3181 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3174 fixed it to set the global 'g' also to the called instance, as
3182 fixed it to set the global 'g' also to the called instance, as
3175 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3183 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3176 user's 'g' variables).
3184 user's 'g' variables).
3177
3185
3178 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3186 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3179 global variables (aliases to _ih,_oh) so that users which expect
3187 global variables (aliases to _ih,_oh) so that users which expect
3180 In[5] or Out[7] to work aren't unpleasantly surprised.
3188 In[5] or Out[7] to work aren't unpleasantly surprised.
3181 (InputList.__getslice__): new class to allow executing slices of
3189 (InputList.__getslice__): new class to allow executing slices of
3182 input history directly. Very simple class, complements the use of
3190 input history directly. Very simple class, complements the use of
3183 macros.
3191 macros.
3184
3192
3185 2002-05-16 Fernando Perez <fperez@colorado.edu>
3193 2002-05-16 Fernando Perez <fperez@colorado.edu>
3186
3194
3187 * setup.py (docdirbase): make doc directory be just doc/IPython
3195 * setup.py (docdirbase): make doc directory be just doc/IPython
3188 without version numbers, it will reduce clutter for users.
3196 without version numbers, it will reduce clutter for users.
3189
3197
3190 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3198 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3191 execfile call to prevent possible memory leak. See for details:
3199 execfile call to prevent possible memory leak. See for details:
3192 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3200 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3193
3201
3194 2002-05-15 Fernando Perez <fperez@colorado.edu>
3202 2002-05-15 Fernando Perez <fperez@colorado.edu>
3195
3203
3196 * IPython/Magic.py (Magic.magic_psource): made the object
3204 * IPython/Magic.py (Magic.magic_psource): made the object
3197 introspection names be more standard: pdoc, pdef, pfile and
3205 introspection names be more standard: pdoc, pdef, pfile and
3198 psource. They all print/page their output, and it makes
3206 psource. They all print/page their output, and it makes
3199 remembering them easier. Kept old names for compatibility as
3207 remembering them easier. Kept old names for compatibility as
3200 aliases.
3208 aliases.
3201
3209
3202 2002-05-14 Fernando Perez <fperez@colorado.edu>
3210 2002-05-14 Fernando Perez <fperez@colorado.edu>
3203
3211
3204 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3212 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3205 what the mouse problem was. The trick is to use gnuplot with temp
3213 what the mouse problem was. The trick is to use gnuplot with temp
3206 files and NOT with pipes (for data communication), because having
3214 files and NOT with pipes (for data communication), because having
3207 both pipes and the mouse on is bad news.
3215 both pipes and the mouse on is bad news.
3208
3216
3209 2002-05-13 Fernando Perez <fperez@colorado.edu>
3217 2002-05-13 Fernando Perez <fperez@colorado.edu>
3210
3218
3211 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3219 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3212 bug. Information would be reported about builtins even when
3220 bug. Information would be reported about builtins even when
3213 user-defined functions overrode them.
3221 user-defined functions overrode them.
3214
3222
3215 2002-05-11 Fernando Perez <fperez@colorado.edu>
3223 2002-05-11 Fernando Perez <fperez@colorado.edu>
3216
3224
3217 * IPython/__init__.py (__all__): removed FlexCompleter from
3225 * IPython/__init__.py (__all__): removed FlexCompleter from
3218 __all__ so that things don't fail in platforms without readline.
3226 __all__ so that things don't fail in platforms without readline.
3219
3227
3220 2002-05-10 Fernando Perez <fperez@colorado.edu>
3228 2002-05-10 Fernando Perez <fperez@colorado.edu>
3221
3229
3222 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3230 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3223 it requires Numeric, effectively making Numeric a dependency for
3231 it requires Numeric, effectively making Numeric a dependency for
3224 IPython.
3232 IPython.
3225
3233
3226 * Released 0.2.13
3234 * Released 0.2.13
3227
3235
3228 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3236 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3229 profiler interface. Now all the major options from the profiler
3237 profiler interface. Now all the major options from the profiler
3230 module are directly supported in IPython, both for single
3238 module are directly supported in IPython, both for single
3231 expressions (@prun) and for full programs (@run -p).
3239 expressions (@prun) and for full programs (@run -p).
3232
3240
3233 2002-05-09 Fernando Perez <fperez@colorado.edu>
3241 2002-05-09 Fernando Perez <fperez@colorado.edu>
3234
3242
3235 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3243 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3236 magic properly formatted for screen.
3244 magic properly formatted for screen.
3237
3245
3238 * setup.py (make_shortcut): Changed things to put pdf version in
3246 * setup.py (make_shortcut): Changed things to put pdf version in
3239 doc/ instead of doc/manual (had to change lyxport a bit).
3247 doc/ instead of doc/manual (had to change lyxport a bit).
3240
3248
3241 * IPython/Magic.py (Profile.string_stats): made profile runs go
3249 * IPython/Magic.py (Profile.string_stats): made profile runs go
3242 through pager (they are long and a pager allows searching, saving,
3250 through pager (they are long and a pager allows searching, saving,
3243 etc.)
3251 etc.)
3244
3252
3245 2002-05-08 Fernando Perez <fperez@colorado.edu>
3253 2002-05-08 Fernando Perez <fperez@colorado.edu>
3246
3254
3247 * Released 0.2.12
3255 * Released 0.2.12
3248
3256
3249 2002-05-06 Fernando Perez <fperez@colorado.edu>
3257 2002-05-06 Fernando Perez <fperez@colorado.edu>
3250
3258
3251 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3259 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3252 introduced); 'hist n1 n2' was broken.
3260 introduced); 'hist n1 n2' was broken.
3253 (Magic.magic_pdb): added optional on/off arguments to @pdb
3261 (Magic.magic_pdb): added optional on/off arguments to @pdb
3254 (Magic.magic_run): added option -i to @run, which executes code in
3262 (Magic.magic_run): added option -i to @run, which executes code in
3255 the IPython namespace instead of a clean one. Also added @irun as
3263 the IPython namespace instead of a clean one. Also added @irun as
3256 an alias to @run -i.
3264 an alias to @run -i.
3257
3265
3258 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3266 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3259 fixed (it didn't really do anything, the namespaces were wrong).
3267 fixed (it didn't really do anything, the namespaces were wrong).
3260
3268
3261 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3269 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3262
3270
3263 * IPython/__init__.py (__all__): Fixed package namespace, now
3271 * IPython/__init__.py (__all__): Fixed package namespace, now
3264 'import IPython' does give access to IPython.<all> as
3272 'import IPython' does give access to IPython.<all> as
3265 expected. Also renamed __release__ to Release.
3273 expected. Also renamed __release__ to Release.
3266
3274
3267 * IPython/Debugger.py (__license__): created new Pdb class which
3275 * IPython/Debugger.py (__license__): created new Pdb class which
3268 functions like a drop-in for the normal pdb.Pdb but does NOT
3276 functions like a drop-in for the normal pdb.Pdb but does NOT
3269 import readline by default. This way it doesn't muck up IPython's
3277 import readline by default. This way it doesn't muck up IPython's
3270 readline handling, and now tab-completion finally works in the
3278 readline handling, and now tab-completion finally works in the
3271 debugger -- sort of. It completes things globally visible, but the
3279 debugger -- sort of. It completes things globally visible, but the
3272 completer doesn't track the stack as pdb walks it. That's a bit
3280 completer doesn't track the stack as pdb walks it. That's a bit
3273 tricky, and I'll have to implement it later.
3281 tricky, and I'll have to implement it later.
3274
3282
3275 2002-05-05 Fernando Perez <fperez@colorado.edu>
3283 2002-05-05 Fernando Perez <fperez@colorado.edu>
3276
3284
3277 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3285 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3278 magic docstrings when printed via ? (explicit \'s were being
3286 magic docstrings when printed via ? (explicit \'s were being
3279 printed).
3287 printed).
3280
3288
3281 * IPython/ipmaker.py (make_IPython): fixed namespace
3289 * IPython/ipmaker.py (make_IPython): fixed namespace
3282 identification bug. Now variables loaded via logs or command-line
3290 identification bug. Now variables loaded via logs or command-line
3283 files are recognized in the interactive namespace by @who.
3291 files are recognized in the interactive namespace by @who.
3284
3292
3285 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3293 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3286 log replay system stemming from the string form of Structs.
3294 log replay system stemming from the string form of Structs.
3287
3295
3288 * IPython/Magic.py (Macro.__init__): improved macros to properly
3296 * IPython/Magic.py (Macro.__init__): improved macros to properly
3289 handle magic commands in them.
3297 handle magic commands in them.
3290 (Magic.magic_logstart): usernames are now expanded so 'logstart
3298 (Magic.magic_logstart): usernames are now expanded so 'logstart
3291 ~/mylog' now works.
3299 ~/mylog' now works.
3292
3300
3293 * IPython/iplib.py (complete): fixed bug where paths starting with
3301 * IPython/iplib.py (complete): fixed bug where paths starting with
3294 '/' would be completed as magic names.
3302 '/' would be completed as magic names.
3295
3303
3296 2002-05-04 Fernando Perez <fperez@colorado.edu>
3304 2002-05-04 Fernando Perez <fperez@colorado.edu>
3297
3305
3298 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3306 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3299 allow running full programs under the profiler's control.
3307 allow running full programs under the profiler's control.
3300
3308
3301 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3309 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3302 mode to report exceptions verbosely but without formatting
3310 mode to report exceptions verbosely but without formatting
3303 variables. This addresses the issue of ipython 'freezing' (it's
3311 variables. This addresses the issue of ipython 'freezing' (it's
3304 not frozen, but caught in an expensive formatting loop) when huge
3312 not frozen, but caught in an expensive formatting loop) when huge
3305 variables are in the context of an exception.
3313 variables are in the context of an exception.
3306 (VerboseTB.text): Added '--->' markers at line where exception was
3314 (VerboseTB.text): Added '--->' markers at line where exception was
3307 triggered. Much clearer to read, especially in NoColor modes.
3315 triggered. Much clearer to read, especially in NoColor modes.
3308
3316
3309 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3317 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3310 implemented in reverse when changing to the new parse_options().
3318 implemented in reverse when changing to the new parse_options().
3311
3319
3312 2002-05-03 Fernando Perez <fperez@colorado.edu>
3320 2002-05-03 Fernando Perez <fperez@colorado.edu>
3313
3321
3314 * IPython/Magic.py (Magic.parse_options): new function so that
3322 * IPython/Magic.py (Magic.parse_options): new function so that
3315 magics can parse options easier.
3323 magics can parse options easier.
3316 (Magic.magic_prun): new function similar to profile.run(),
3324 (Magic.magic_prun): new function similar to profile.run(),
3317 suggested by Chris Hart.
3325 suggested by Chris Hart.
3318 (Magic.magic_cd): fixed behavior so that it only changes if
3326 (Magic.magic_cd): fixed behavior so that it only changes if
3319 directory actually is in history.
3327 directory actually is in history.
3320
3328
3321 * IPython/usage.py (__doc__): added information about potential
3329 * IPython/usage.py (__doc__): added information about potential
3322 slowness of Verbose exception mode when there are huge data
3330 slowness of Verbose exception mode when there are huge data
3323 structures to be formatted (thanks to Archie Paulson).
3331 structures to be formatted (thanks to Archie Paulson).
3324
3332
3325 * IPython/ipmaker.py (make_IPython): Changed default logging
3333 * IPython/ipmaker.py (make_IPython): Changed default logging
3326 (when simply called with -log) to use curr_dir/ipython.log in
3334 (when simply called with -log) to use curr_dir/ipython.log in
3327 rotate mode. Fixed crash which was occuring with -log before
3335 rotate mode. Fixed crash which was occuring with -log before
3328 (thanks to Jim Boyle).
3336 (thanks to Jim Boyle).
3329
3337
3330 2002-05-01 Fernando Perez <fperez@colorado.edu>
3338 2002-05-01 Fernando Perez <fperez@colorado.edu>
3331
3339
3332 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3340 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3333 was nasty -- though somewhat of a corner case).
3341 was nasty -- though somewhat of a corner case).
3334
3342
3335 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3343 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3336 text (was a bug).
3344 text (was a bug).
3337
3345
3338 2002-04-30 Fernando Perez <fperez@colorado.edu>
3346 2002-04-30 Fernando Perez <fperez@colorado.edu>
3339
3347
3340 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3348 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3341 a print after ^D or ^C from the user so that the In[] prompt
3349 a print after ^D or ^C from the user so that the In[] prompt
3342 doesn't over-run the gnuplot one.
3350 doesn't over-run the gnuplot one.
3343
3351
3344 2002-04-29 Fernando Perez <fperez@colorado.edu>
3352 2002-04-29 Fernando Perez <fperez@colorado.edu>
3345
3353
3346 * Released 0.2.10
3354 * Released 0.2.10
3347
3355
3348 * IPython/__release__.py (version): get date dynamically.
3356 * IPython/__release__.py (version): get date dynamically.
3349
3357
3350 * Misc. documentation updates thanks to Arnd's comments. Also ran
3358 * Misc. documentation updates thanks to Arnd's comments. Also ran
3351 a full spellcheck on the manual (hadn't been done in a while).
3359 a full spellcheck on the manual (hadn't been done in a while).
3352
3360
3353 2002-04-27 Fernando Perez <fperez@colorado.edu>
3361 2002-04-27 Fernando Perez <fperez@colorado.edu>
3354
3362
3355 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3363 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3356 starting a log in mid-session would reset the input history list.
3364 starting a log in mid-session would reset the input history list.
3357
3365
3358 2002-04-26 Fernando Perez <fperez@colorado.edu>
3366 2002-04-26 Fernando Perez <fperez@colorado.edu>
3359
3367
3360 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3368 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3361 all files were being included in an update. Now anything in
3369 all files were being included in an update. Now anything in
3362 UserConfig that matches [A-Za-z]*.py will go (this excludes
3370 UserConfig that matches [A-Za-z]*.py will go (this excludes
3363 __init__.py)
3371 __init__.py)
3364
3372
3365 2002-04-25 Fernando Perez <fperez@colorado.edu>
3373 2002-04-25 Fernando Perez <fperez@colorado.edu>
3366
3374
3367 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3375 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3368 to __builtins__ so that any form of embedded or imported code can
3376 to __builtins__ so that any form of embedded or imported code can
3369 test for being inside IPython.
3377 test for being inside IPython.
3370
3378
3371 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3379 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3372 changed to GnuplotMagic because it's now an importable module,
3380 changed to GnuplotMagic because it's now an importable module,
3373 this makes the name follow that of the standard Gnuplot module.
3381 this makes the name follow that of the standard Gnuplot module.
3374 GnuplotMagic can now be loaded at any time in mid-session.
3382 GnuplotMagic can now be loaded at any time in mid-session.
3375
3383
3376 2002-04-24 Fernando Perez <fperez@colorado.edu>
3384 2002-04-24 Fernando Perez <fperez@colorado.edu>
3377
3385
3378 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3386 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3379 the globals (IPython has its own namespace) and the
3387 the globals (IPython has its own namespace) and the
3380 PhysicalQuantity stuff is much better anyway.
3388 PhysicalQuantity stuff is much better anyway.
3381
3389
3382 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3390 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3383 embedding example to standard user directory for
3391 embedding example to standard user directory for
3384 distribution. Also put it in the manual.
3392 distribution. Also put it in the manual.
3385
3393
3386 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3394 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3387 instance as first argument (so it doesn't rely on some obscure
3395 instance as first argument (so it doesn't rely on some obscure
3388 hidden global).
3396 hidden global).
3389
3397
3390 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3398 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3391 delimiters. While it prevents ().TAB from working, it allows
3399 delimiters. While it prevents ().TAB from working, it allows
3392 completions in open (... expressions. This is by far a more common
3400 completions in open (... expressions. This is by far a more common
3393 case.
3401 case.
3394
3402
3395 2002-04-23 Fernando Perez <fperez@colorado.edu>
3403 2002-04-23 Fernando Perez <fperez@colorado.edu>
3396
3404
3397 * IPython/Extensions/InterpreterPasteInput.py: new
3405 * IPython/Extensions/InterpreterPasteInput.py: new
3398 syntax-processing module for pasting lines with >>> or ... at the
3406 syntax-processing module for pasting lines with >>> or ... at the
3399 start.
3407 start.
3400
3408
3401 * IPython/Extensions/PhysicalQ_Interactive.py
3409 * IPython/Extensions/PhysicalQ_Interactive.py
3402 (PhysicalQuantityInteractive.__int__): fixed to work with either
3410 (PhysicalQuantityInteractive.__int__): fixed to work with either
3403 Numeric or math.
3411 Numeric or math.
3404
3412
3405 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3413 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3406 provided profiles. Now we have:
3414 provided profiles. Now we have:
3407 -math -> math module as * and cmath with its own namespace.
3415 -math -> math module as * and cmath with its own namespace.
3408 -numeric -> Numeric as *, plus gnuplot & grace
3416 -numeric -> Numeric as *, plus gnuplot & grace
3409 -physics -> same as before
3417 -physics -> same as before
3410
3418
3411 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3419 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3412 user-defined magics wouldn't be found by @magic if they were
3420 user-defined magics wouldn't be found by @magic if they were
3413 defined as class methods. Also cleaned up the namespace search
3421 defined as class methods. Also cleaned up the namespace search
3414 logic and the string building (to use %s instead of many repeated
3422 logic and the string building (to use %s instead of many repeated
3415 string adds).
3423 string adds).
3416
3424
3417 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3425 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3418 of user-defined magics to operate with class methods (cleaner, in
3426 of user-defined magics to operate with class methods (cleaner, in
3419 line with the gnuplot code).
3427 line with the gnuplot code).
3420
3428
3421 2002-04-22 Fernando Perez <fperez@colorado.edu>
3429 2002-04-22 Fernando Perez <fperez@colorado.edu>
3422
3430
3423 * setup.py: updated dependency list so that manual is updated when
3431 * setup.py: updated dependency list so that manual is updated when
3424 all included files change.
3432 all included files change.
3425
3433
3426 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3434 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3427 the delimiter removal option (the fix is ugly right now).
3435 the delimiter removal option (the fix is ugly right now).
3428
3436
3429 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3437 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3430 all of the math profile (quicker loading, no conflict between
3438 all of the math profile (quicker loading, no conflict between
3431 g-9.8 and g-gnuplot).
3439 g-9.8 and g-gnuplot).
3432
3440
3433 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3441 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3434 name of post-mortem files to IPython_crash_report.txt.
3442 name of post-mortem files to IPython_crash_report.txt.
3435
3443
3436 * Cleanup/update of the docs. Added all the new readline info and
3444 * Cleanup/update of the docs. Added all the new readline info and
3437 formatted all lists as 'real lists'.
3445 formatted all lists as 'real lists'.
3438
3446
3439 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3447 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3440 tab-completion options, since the full readline parse_and_bind is
3448 tab-completion options, since the full readline parse_and_bind is
3441 now accessible.
3449 now accessible.
3442
3450
3443 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3451 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3444 handling of readline options. Now users can specify any string to
3452 handling of readline options. Now users can specify any string to
3445 be passed to parse_and_bind(), as well as the delimiters to be
3453 be passed to parse_and_bind(), as well as the delimiters to be
3446 removed.
3454 removed.
3447 (InteractiveShell.__init__): Added __name__ to the global
3455 (InteractiveShell.__init__): Added __name__ to the global
3448 namespace so that things like Itpl which rely on its existence
3456 namespace so that things like Itpl which rely on its existence
3449 don't crash.
3457 don't crash.
3450 (InteractiveShell._prefilter): Defined the default with a _ so
3458 (InteractiveShell._prefilter): Defined the default with a _ so
3451 that prefilter() is easier to override, while the default one
3459 that prefilter() is easier to override, while the default one
3452 remains available.
3460 remains available.
3453
3461
3454 2002-04-18 Fernando Perez <fperez@colorado.edu>
3462 2002-04-18 Fernando Perez <fperez@colorado.edu>
3455
3463
3456 * Added information about pdb in the docs.
3464 * Added information about pdb in the docs.
3457
3465
3458 2002-04-17 Fernando Perez <fperez@colorado.edu>
3466 2002-04-17 Fernando Perez <fperez@colorado.edu>
3459
3467
3460 * IPython/ipmaker.py (make_IPython): added rc_override option to
3468 * IPython/ipmaker.py (make_IPython): added rc_override option to
3461 allow passing config options at creation time which may override
3469 allow passing config options at creation time which may override
3462 anything set in the config files or command line. This is
3470 anything set in the config files or command line. This is
3463 particularly useful for configuring embedded instances.
3471 particularly useful for configuring embedded instances.
3464
3472
3465 2002-04-15 Fernando Perez <fperez@colorado.edu>
3473 2002-04-15 Fernando Perez <fperez@colorado.edu>
3466
3474
3467 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3475 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3468 crash embedded instances because of the input cache falling out of
3476 crash embedded instances because of the input cache falling out of
3469 sync with the output counter.
3477 sync with the output counter.
3470
3478
3471 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3479 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3472 mode which calls pdb after an uncaught exception in IPython itself.
3480 mode which calls pdb after an uncaught exception in IPython itself.
3473
3481
3474 2002-04-14 Fernando Perez <fperez@colorado.edu>
3482 2002-04-14 Fernando Perez <fperez@colorado.edu>
3475
3483
3476 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3484 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3477 readline, fix it back after each call.
3485 readline, fix it back after each call.
3478
3486
3479 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3487 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3480 method to force all access via __call__(), which guarantees that
3488 method to force all access via __call__(), which guarantees that
3481 traceback references are properly deleted.
3489 traceback references are properly deleted.
3482
3490
3483 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3491 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3484 improve printing when pprint is in use.
3492 improve printing when pprint is in use.
3485
3493
3486 2002-04-13 Fernando Perez <fperez@colorado.edu>
3494 2002-04-13 Fernando Perez <fperez@colorado.edu>
3487
3495
3488 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3496 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3489 exceptions aren't caught anymore. If the user triggers one, he
3497 exceptions aren't caught anymore. If the user triggers one, he
3490 should know why he's doing it and it should go all the way up,
3498 should know why he's doing it and it should go all the way up,
3491 just like any other exception. So now @abort will fully kill the
3499 just like any other exception. So now @abort will fully kill the
3492 embedded interpreter and the embedding code (unless that happens
3500 embedded interpreter and the embedding code (unless that happens
3493 to catch SystemExit).
3501 to catch SystemExit).
3494
3502
3495 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3503 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3496 and a debugger() method to invoke the interactive pdb debugger
3504 and a debugger() method to invoke the interactive pdb debugger
3497 after printing exception information. Also added the corresponding
3505 after printing exception information. Also added the corresponding
3498 -pdb option and @pdb magic to control this feature, and updated
3506 -pdb option and @pdb magic to control this feature, and updated
3499 the docs. After a suggestion from Christopher Hart
3507 the docs. After a suggestion from Christopher Hart
3500 (hart-AT-caltech.edu).
3508 (hart-AT-caltech.edu).
3501
3509
3502 2002-04-12 Fernando Perez <fperez@colorado.edu>
3510 2002-04-12 Fernando Perez <fperez@colorado.edu>
3503
3511
3504 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3512 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3505 the exception handlers defined by the user (not the CrashHandler)
3513 the exception handlers defined by the user (not the CrashHandler)
3506 so that user exceptions don't trigger an ipython bug report.
3514 so that user exceptions don't trigger an ipython bug report.
3507
3515
3508 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3516 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3509 configurable (it should have always been so).
3517 configurable (it should have always been so).
3510
3518
3511 2002-03-26 Fernando Perez <fperez@colorado.edu>
3519 2002-03-26 Fernando Perez <fperez@colorado.edu>
3512
3520
3513 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3521 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3514 and there to fix embedding namespace issues. This should all be
3522 and there to fix embedding namespace issues. This should all be
3515 done in a more elegant way.
3523 done in a more elegant way.
3516
3524
3517 2002-03-25 Fernando Perez <fperez@colorado.edu>
3525 2002-03-25 Fernando Perez <fperez@colorado.edu>
3518
3526
3519 * IPython/genutils.py (get_home_dir): Try to make it work under
3527 * IPython/genutils.py (get_home_dir): Try to make it work under
3520 win9x also.
3528 win9x also.
3521
3529
3522 2002-03-20 Fernando Perez <fperez@colorado.edu>
3530 2002-03-20 Fernando Perez <fperez@colorado.edu>
3523
3531
3524 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3532 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3525 sys.displayhook untouched upon __init__.
3533 sys.displayhook untouched upon __init__.
3526
3534
3527 2002-03-19 Fernando Perez <fperez@colorado.edu>
3535 2002-03-19 Fernando Perez <fperez@colorado.edu>
3528
3536
3529 * Released 0.2.9 (for embedding bug, basically).
3537 * Released 0.2.9 (for embedding bug, basically).
3530
3538
3531 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3539 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3532 exceptions so that enclosing shell's state can be restored.
3540 exceptions so that enclosing shell's state can be restored.
3533
3541
3534 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3542 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3535 naming conventions in the .ipython/ dir.
3543 naming conventions in the .ipython/ dir.
3536
3544
3537 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3545 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3538 from delimiters list so filenames with - in them get expanded.
3546 from delimiters list so filenames with - in them get expanded.
3539
3547
3540 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3548 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3541 sys.displayhook not being properly restored after an embedded call.
3549 sys.displayhook not being properly restored after an embedded call.
3542
3550
3543 2002-03-18 Fernando Perez <fperez@colorado.edu>
3551 2002-03-18 Fernando Perez <fperez@colorado.edu>
3544
3552
3545 * Released 0.2.8
3553 * Released 0.2.8
3546
3554
3547 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3555 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3548 some files weren't being included in a -upgrade.
3556 some files weren't being included in a -upgrade.
3549 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3557 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3550 on' so that the first tab completes.
3558 on' so that the first tab completes.
3551 (InteractiveShell.handle_magic): fixed bug with spaces around
3559 (InteractiveShell.handle_magic): fixed bug with spaces around
3552 quotes breaking many magic commands.
3560 quotes breaking many magic commands.
3553
3561
3554 * setup.py: added note about ignoring the syntax error messages at
3562 * setup.py: added note about ignoring the syntax error messages at
3555 installation.
3563 installation.
3556
3564
3557 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3565 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3558 streamlining the gnuplot interface, now there's only one magic @gp.
3566 streamlining the gnuplot interface, now there's only one magic @gp.
3559
3567
3560 2002-03-17 Fernando Perez <fperez@colorado.edu>
3568 2002-03-17 Fernando Perez <fperez@colorado.edu>
3561
3569
3562 * IPython/UserConfig/magic_gnuplot.py: new name for the
3570 * IPython/UserConfig/magic_gnuplot.py: new name for the
3563 example-magic_pm.py file. Much enhanced system, now with a shell
3571 example-magic_pm.py file. Much enhanced system, now with a shell
3564 for communicating directly with gnuplot, one command at a time.
3572 for communicating directly with gnuplot, one command at a time.
3565
3573
3566 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3574 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3567 setting __name__=='__main__'.
3575 setting __name__=='__main__'.
3568
3576
3569 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3577 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3570 mini-shell for accessing gnuplot from inside ipython. Should
3578 mini-shell for accessing gnuplot from inside ipython. Should
3571 extend it later for grace access too. Inspired by Arnd's
3579 extend it later for grace access too. Inspired by Arnd's
3572 suggestion.
3580 suggestion.
3573
3581
3574 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3582 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3575 calling magic functions with () in their arguments. Thanks to Arnd
3583 calling magic functions with () in their arguments. Thanks to Arnd
3576 Baecker for pointing this to me.
3584 Baecker for pointing this to me.
3577
3585
3578 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3586 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3579 infinitely for integer or complex arrays (only worked with floats).
3587 infinitely for integer or complex arrays (only worked with floats).
3580
3588
3581 2002-03-16 Fernando Perez <fperez@colorado.edu>
3589 2002-03-16 Fernando Perez <fperez@colorado.edu>
3582
3590
3583 * setup.py: Merged setup and setup_windows into a single script
3591 * setup.py: Merged setup and setup_windows into a single script
3584 which properly handles things for windows users.
3592 which properly handles things for windows users.
3585
3593
3586 2002-03-15 Fernando Perez <fperez@colorado.edu>
3594 2002-03-15 Fernando Perez <fperez@colorado.edu>
3587
3595
3588 * Big change to the manual: now the magics are all automatically
3596 * Big change to the manual: now the magics are all automatically
3589 documented. This information is generated from their docstrings
3597 documented. This information is generated from their docstrings
3590 and put in a latex file included by the manual lyx file. This way
3598 and put in a latex file included by the manual lyx file. This way
3591 we get always up to date information for the magics. The manual
3599 we get always up to date information for the magics. The manual
3592 now also has proper version information, also auto-synced.
3600 now also has proper version information, also auto-synced.
3593
3601
3594 For this to work, an undocumented --magic_docstrings option was added.
3602 For this to work, an undocumented --magic_docstrings option was added.
3595
3603
3596 2002-03-13 Fernando Perez <fperez@colorado.edu>
3604 2002-03-13 Fernando Perez <fperez@colorado.edu>
3597
3605
3598 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3606 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3599 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3607 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3600
3608
3601 2002-03-12 Fernando Perez <fperez@colorado.edu>
3609 2002-03-12 Fernando Perez <fperez@colorado.edu>
3602
3610
3603 * IPython/ultraTB.py (TermColors): changed color escapes again to
3611 * IPython/ultraTB.py (TermColors): changed color escapes again to
3604 fix the (old, reintroduced) line-wrapping bug. Basically, if
3612 fix the (old, reintroduced) line-wrapping bug. Basically, if
3605 \001..\002 aren't given in the color escapes, lines get wrapped
3613 \001..\002 aren't given in the color escapes, lines get wrapped
3606 weirdly. But giving those screws up old xterms and emacs terms. So
3614 weirdly. But giving those screws up old xterms and emacs terms. So
3607 I added some logic for emacs terms to be ok, but I can't identify old
3615 I added some logic for emacs terms to be ok, but I can't identify old
3608 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3616 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3609
3617
3610 2002-03-10 Fernando Perez <fperez@colorado.edu>
3618 2002-03-10 Fernando Perez <fperez@colorado.edu>
3611
3619
3612 * IPython/usage.py (__doc__): Various documentation cleanups and
3620 * IPython/usage.py (__doc__): Various documentation cleanups and
3613 updates, both in usage docstrings and in the manual.
3621 updates, both in usage docstrings and in the manual.
3614
3622
3615 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3623 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3616 handling of caching. Set minimum acceptabe value for having a
3624 handling of caching. Set minimum acceptabe value for having a
3617 cache at 20 values.
3625 cache at 20 values.
3618
3626
3619 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3627 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3620 install_first_time function to a method, renamed it and added an
3628 install_first_time function to a method, renamed it and added an
3621 'upgrade' mode. Now people can update their config directory with
3629 'upgrade' mode. Now people can update their config directory with
3622 a simple command line switch (-upgrade, also new).
3630 a simple command line switch (-upgrade, also new).
3623
3631
3624 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3632 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3625 @file (convenient for automagic users under Python >= 2.2).
3633 @file (convenient for automagic users under Python >= 2.2).
3626 Removed @files (it seemed more like a plural than an abbrev. of
3634 Removed @files (it seemed more like a plural than an abbrev. of
3627 'file show').
3635 'file show').
3628
3636
3629 * IPython/iplib.py (install_first_time): Fixed crash if there were
3637 * IPython/iplib.py (install_first_time): Fixed crash if there were
3630 backup files ('~') in .ipython/ install directory.
3638 backup files ('~') in .ipython/ install directory.
3631
3639
3632 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3640 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3633 system. Things look fine, but these changes are fairly
3641 system. Things look fine, but these changes are fairly
3634 intrusive. Test them for a few days.
3642 intrusive. Test them for a few days.
3635
3643
3636 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3644 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3637 the prompts system. Now all in/out prompt strings are user
3645 the prompts system. Now all in/out prompt strings are user
3638 controllable. This is particularly useful for embedding, as one
3646 controllable. This is particularly useful for embedding, as one
3639 can tag embedded instances with particular prompts.
3647 can tag embedded instances with particular prompts.
3640
3648
3641 Also removed global use of sys.ps1/2, which now allows nested
3649 Also removed global use of sys.ps1/2, which now allows nested
3642 embeddings without any problems. Added command-line options for
3650 embeddings without any problems. Added command-line options for
3643 the prompt strings.
3651 the prompt strings.
3644
3652
3645 2002-03-08 Fernando Perez <fperez@colorado.edu>
3653 2002-03-08 Fernando Perez <fperez@colorado.edu>
3646
3654
3647 * IPython/UserConfig/example-embed-short.py (ipshell): added
3655 * IPython/UserConfig/example-embed-short.py (ipshell): added
3648 example file with the bare minimum code for embedding.
3656 example file with the bare minimum code for embedding.
3649
3657
3650 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3658 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3651 functionality for the embeddable shell to be activated/deactivated
3659 functionality for the embeddable shell to be activated/deactivated
3652 either globally or at each call.
3660 either globally or at each call.
3653
3661
3654 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3662 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3655 rewriting the prompt with '--->' for auto-inputs with proper
3663 rewriting the prompt with '--->' for auto-inputs with proper
3656 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3664 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3657 this is handled by the prompts class itself, as it should.
3665 this is handled by the prompts class itself, as it should.
3658
3666
3659 2002-03-05 Fernando Perez <fperez@colorado.edu>
3667 2002-03-05 Fernando Perez <fperez@colorado.edu>
3660
3668
3661 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3669 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3662 @logstart to avoid name clashes with the math log function.
3670 @logstart to avoid name clashes with the math log function.
3663
3671
3664 * Big updates to X/Emacs section of the manual.
3672 * Big updates to X/Emacs section of the manual.
3665
3673
3666 * Removed ipython_emacs. Milan explained to me how to pass
3674 * Removed ipython_emacs. Milan explained to me how to pass
3667 arguments to ipython through Emacs. Some day I'm going to end up
3675 arguments to ipython through Emacs. Some day I'm going to end up
3668 learning some lisp...
3676 learning some lisp...
3669
3677
3670 2002-03-04 Fernando Perez <fperez@colorado.edu>
3678 2002-03-04 Fernando Perez <fperez@colorado.edu>
3671
3679
3672 * IPython/ipython_emacs: Created script to be used as the
3680 * IPython/ipython_emacs: Created script to be used as the
3673 py-python-command Emacs variable so we can pass IPython
3681 py-python-command Emacs variable so we can pass IPython
3674 parameters. I can't figure out how to tell Emacs directly to pass
3682 parameters. I can't figure out how to tell Emacs directly to pass
3675 parameters to IPython, so a dummy shell script will do it.
3683 parameters to IPython, so a dummy shell script will do it.
3676
3684
3677 Other enhancements made for things to work better under Emacs'
3685 Other enhancements made for things to work better under Emacs'
3678 various types of terminals. Many thanks to Milan Zamazal
3686 various types of terminals. Many thanks to Milan Zamazal
3679 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3687 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3680
3688
3681 2002-03-01 Fernando Perez <fperez@colorado.edu>
3689 2002-03-01 Fernando Perez <fperez@colorado.edu>
3682
3690
3683 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3691 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3684 that loading of readline is now optional. This gives better
3692 that loading of readline is now optional. This gives better
3685 control to emacs users.
3693 control to emacs users.
3686
3694
3687 * IPython/ultraTB.py (__date__): Modified color escape sequences
3695 * IPython/ultraTB.py (__date__): Modified color escape sequences
3688 and now things work fine under xterm and in Emacs' term buffers
3696 and now things work fine under xterm and in Emacs' term buffers
3689 (though not shell ones). Well, in emacs you get colors, but all
3697 (though not shell ones). Well, in emacs you get colors, but all
3690 seem to be 'light' colors (no difference between dark and light
3698 seem to be 'light' colors (no difference between dark and light
3691 ones). But the garbage chars are gone, and also in xterms. It
3699 ones). But the garbage chars are gone, and also in xterms. It
3692 seems that now I'm using 'cleaner' ansi sequences.
3700 seems that now I'm using 'cleaner' ansi sequences.
3693
3701
3694 2002-02-21 Fernando Perez <fperez@colorado.edu>
3702 2002-02-21 Fernando Perez <fperez@colorado.edu>
3695
3703
3696 * Released 0.2.7 (mainly to publish the scoping fix).
3704 * Released 0.2.7 (mainly to publish the scoping fix).
3697
3705
3698 * IPython/Logger.py (Logger.logstate): added. A corresponding
3706 * IPython/Logger.py (Logger.logstate): added. A corresponding
3699 @logstate magic was created.
3707 @logstate magic was created.
3700
3708
3701 * IPython/Magic.py: fixed nested scoping problem under Python
3709 * IPython/Magic.py: fixed nested scoping problem under Python
3702 2.1.x (automagic wasn't working).
3710 2.1.x (automagic wasn't working).
3703
3711
3704 2002-02-20 Fernando Perez <fperez@colorado.edu>
3712 2002-02-20 Fernando Perez <fperez@colorado.edu>
3705
3713
3706 * Released 0.2.6.
3714 * Released 0.2.6.
3707
3715
3708 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3716 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3709 option so that logs can come out without any headers at all.
3717 option so that logs can come out without any headers at all.
3710
3718
3711 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3719 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3712 SciPy.
3720 SciPy.
3713
3721
3714 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3722 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3715 that embedded IPython calls don't require vars() to be explicitly
3723 that embedded IPython calls don't require vars() to be explicitly
3716 passed. Now they are extracted from the caller's frame (code
3724 passed. Now they are extracted from the caller's frame (code
3717 snatched from Eric Jones' weave). Added better documentation to
3725 snatched from Eric Jones' weave). Added better documentation to
3718 the section on embedding and the example file.
3726 the section on embedding and the example file.
3719
3727
3720 * IPython/genutils.py (page): Changed so that under emacs, it just
3728 * IPython/genutils.py (page): Changed so that under emacs, it just
3721 prints the string. You can then page up and down in the emacs
3729 prints the string. You can then page up and down in the emacs
3722 buffer itself. This is how the builtin help() works.
3730 buffer itself. This is how the builtin help() works.
3723
3731
3724 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3732 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3725 macro scoping: macros need to be executed in the user's namespace
3733 macro scoping: macros need to be executed in the user's namespace
3726 to work as if they had been typed by the user.
3734 to work as if they had been typed by the user.
3727
3735
3728 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3736 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3729 execute automatically (no need to type 'exec...'). They then
3737 execute automatically (no need to type 'exec...'). They then
3730 behave like 'true macros'. The printing system was also modified
3738 behave like 'true macros'. The printing system was also modified
3731 for this to work.
3739 for this to work.
3732
3740
3733 2002-02-19 Fernando Perez <fperez@colorado.edu>
3741 2002-02-19 Fernando Perez <fperez@colorado.edu>
3734
3742
3735 * IPython/genutils.py (page_file): new function for paging files
3743 * IPython/genutils.py (page_file): new function for paging files
3736 in an OS-independent way. Also necessary for file viewing to work
3744 in an OS-independent way. Also necessary for file viewing to work
3737 well inside Emacs buffers.
3745 well inside Emacs buffers.
3738 (page): Added checks for being in an emacs buffer.
3746 (page): Added checks for being in an emacs buffer.
3739 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3747 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3740 same bug in iplib.
3748 same bug in iplib.
3741
3749
3742 2002-02-18 Fernando Perez <fperez@colorado.edu>
3750 2002-02-18 Fernando Perez <fperez@colorado.edu>
3743
3751
3744 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3752 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3745 of readline so that IPython can work inside an Emacs buffer.
3753 of readline so that IPython can work inside an Emacs buffer.
3746
3754
3747 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3755 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3748 method signatures (they weren't really bugs, but it looks cleaner
3756 method signatures (they weren't really bugs, but it looks cleaner
3749 and keeps PyChecker happy).
3757 and keeps PyChecker happy).
3750
3758
3751 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3759 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3752 for implementing various user-defined hooks. Currently only
3760 for implementing various user-defined hooks. Currently only
3753 display is done.
3761 display is done.
3754
3762
3755 * IPython/Prompts.py (CachedOutput._display): changed display
3763 * IPython/Prompts.py (CachedOutput._display): changed display
3756 functions so that they can be dynamically changed by users easily.
3764 functions so that they can be dynamically changed by users easily.
3757
3765
3758 * IPython/Extensions/numeric_formats.py (num_display): added an
3766 * IPython/Extensions/numeric_formats.py (num_display): added an
3759 extension for printing NumPy arrays in flexible manners. It
3767 extension for printing NumPy arrays in flexible manners. It
3760 doesn't do anything yet, but all the structure is in
3768 doesn't do anything yet, but all the structure is in
3761 place. Ultimately the plan is to implement output format control
3769 place. Ultimately the plan is to implement output format control
3762 like in Octave.
3770 like in Octave.
3763
3771
3764 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3772 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3765 methods are found at run-time by all the automatic machinery.
3773 methods are found at run-time by all the automatic machinery.
3766
3774
3767 2002-02-17 Fernando Perez <fperez@colorado.edu>
3775 2002-02-17 Fernando Perez <fperez@colorado.edu>
3768
3776
3769 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3777 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3770 whole file a little.
3778 whole file a little.
3771
3779
3772 * ToDo: closed this document. Now there's a new_design.lyx
3780 * ToDo: closed this document. Now there's a new_design.lyx
3773 document for all new ideas. Added making a pdf of it for the
3781 document for all new ideas. Added making a pdf of it for the
3774 end-user distro.
3782 end-user distro.
3775
3783
3776 * IPython/Logger.py (Logger.switch_log): Created this to replace
3784 * IPython/Logger.py (Logger.switch_log): Created this to replace
3777 logon() and logoff(). It also fixes a nasty crash reported by
3785 logon() and logoff(). It also fixes a nasty crash reported by
3778 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3786 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3779
3787
3780 * IPython/iplib.py (complete): got auto-completion to work with
3788 * IPython/iplib.py (complete): got auto-completion to work with
3781 automagic (I had wanted this for a long time).
3789 automagic (I had wanted this for a long time).
3782
3790
3783 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3791 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3784 to @file, since file() is now a builtin and clashes with automagic
3792 to @file, since file() is now a builtin and clashes with automagic
3785 for @file.
3793 for @file.
3786
3794
3787 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3795 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3788 of this was previously in iplib, which had grown to more than 2000
3796 of this was previously in iplib, which had grown to more than 2000
3789 lines, way too long. No new functionality, but it makes managing
3797 lines, way too long. No new functionality, but it makes managing
3790 the code a bit easier.
3798 the code a bit easier.
3791
3799
3792 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3800 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3793 information to crash reports.
3801 information to crash reports.
3794
3802
3795 2002-02-12 Fernando Perez <fperez@colorado.edu>
3803 2002-02-12 Fernando Perez <fperez@colorado.edu>
3796
3804
3797 * Released 0.2.5.
3805 * Released 0.2.5.
3798
3806
3799 2002-02-11 Fernando Perez <fperez@colorado.edu>
3807 2002-02-11 Fernando Perez <fperez@colorado.edu>
3800
3808
3801 * Wrote a relatively complete Windows installer. It puts
3809 * Wrote a relatively complete Windows installer. It puts
3802 everything in place, creates Start Menu entries and fixes the
3810 everything in place, creates Start Menu entries and fixes the
3803 color issues. Nothing fancy, but it works.
3811 color issues. Nothing fancy, but it works.
3804
3812
3805 2002-02-10 Fernando Perez <fperez@colorado.edu>
3813 2002-02-10 Fernando Perez <fperez@colorado.edu>
3806
3814
3807 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3815 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3808 os.path.expanduser() call so that we can type @run ~/myfile.py and
3816 os.path.expanduser() call so that we can type @run ~/myfile.py and
3809 have thigs work as expected.
3817 have thigs work as expected.
3810
3818
3811 * IPython/genutils.py (page): fixed exception handling so things
3819 * IPython/genutils.py (page): fixed exception handling so things
3812 work both in Unix and Windows correctly. Quitting a pager triggers
3820 work both in Unix and Windows correctly. Quitting a pager triggers
3813 an IOError/broken pipe in Unix, and in windows not finding a pager
3821 an IOError/broken pipe in Unix, and in windows not finding a pager
3814 is also an IOError, so I had to actually look at the return value
3822 is also an IOError, so I had to actually look at the return value
3815 of the exception, not just the exception itself. Should be ok now.
3823 of the exception, not just the exception itself. Should be ok now.
3816
3824
3817 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3825 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3818 modified to allow case-insensitive color scheme changes.
3826 modified to allow case-insensitive color scheme changes.
3819
3827
3820 2002-02-09 Fernando Perez <fperez@colorado.edu>
3828 2002-02-09 Fernando Perez <fperez@colorado.edu>
3821
3829
3822 * IPython/genutils.py (native_line_ends): new function to leave
3830 * IPython/genutils.py (native_line_ends): new function to leave
3823 user config files with os-native line-endings.
3831 user config files with os-native line-endings.
3824
3832
3825 * README and manual updates.
3833 * README and manual updates.
3826
3834
3827 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3835 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3828 instead of StringType to catch Unicode strings.
3836 instead of StringType to catch Unicode strings.
3829
3837
3830 * IPython/genutils.py (filefind): fixed bug for paths with
3838 * IPython/genutils.py (filefind): fixed bug for paths with
3831 embedded spaces (very common in Windows).
3839 embedded spaces (very common in Windows).
3832
3840
3833 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3841 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3834 files under Windows, so that they get automatically associated
3842 files under Windows, so that they get automatically associated
3835 with a text editor. Windows makes it a pain to handle
3843 with a text editor. Windows makes it a pain to handle
3836 extension-less files.
3844 extension-less files.
3837
3845
3838 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3846 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3839 warning about readline only occur for Posix. In Windows there's no
3847 warning about readline only occur for Posix. In Windows there's no
3840 way to get readline, so why bother with the warning.
3848 way to get readline, so why bother with the warning.
3841
3849
3842 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3850 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3843 for __str__ instead of dir(self), since dir() changed in 2.2.
3851 for __str__ instead of dir(self), since dir() changed in 2.2.
3844
3852
3845 * Ported to Windows! Tested on XP, I suspect it should work fine
3853 * Ported to Windows! Tested on XP, I suspect it should work fine
3846 on NT/2000, but I don't think it will work on 98 et al. That
3854 on NT/2000, but I don't think it will work on 98 et al. That
3847 series of Windows is such a piece of junk anyway that I won't try
3855 series of Windows is such a piece of junk anyway that I won't try
3848 porting it there. The XP port was straightforward, showed a few
3856 porting it there. The XP port was straightforward, showed a few
3849 bugs here and there (fixed all), in particular some string
3857 bugs here and there (fixed all), in particular some string
3850 handling stuff which required considering Unicode strings (which
3858 handling stuff which required considering Unicode strings (which
3851 Windows uses). This is good, but hasn't been too tested :) No
3859 Windows uses). This is good, but hasn't been too tested :) No
3852 fancy installer yet, I'll put a note in the manual so people at
3860 fancy installer yet, I'll put a note in the manual so people at
3853 least make manually a shortcut.
3861 least make manually a shortcut.
3854
3862
3855 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3863 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3856 into a single one, "colors". This now controls both prompt and
3864 into a single one, "colors". This now controls both prompt and
3857 exception color schemes, and can be changed both at startup
3865 exception color schemes, and can be changed both at startup
3858 (either via command-line switches or via ipythonrc files) and at
3866 (either via command-line switches or via ipythonrc files) and at
3859 runtime, with @colors.
3867 runtime, with @colors.
3860 (Magic.magic_run): renamed @prun to @run and removed the old
3868 (Magic.magic_run): renamed @prun to @run and removed the old
3861 @run. The two were too similar to warrant keeping both.
3869 @run. The two were too similar to warrant keeping both.
3862
3870
3863 2002-02-03 Fernando Perez <fperez@colorado.edu>
3871 2002-02-03 Fernando Perez <fperez@colorado.edu>
3864
3872
3865 * IPython/iplib.py (install_first_time): Added comment on how to
3873 * IPython/iplib.py (install_first_time): Added comment on how to
3866 configure the color options for first-time users. Put a <return>
3874 configure the color options for first-time users. Put a <return>
3867 request at the end so that small-terminal users get a chance to
3875 request at the end so that small-terminal users get a chance to
3868 read the startup info.
3876 read the startup info.
3869
3877
3870 2002-01-23 Fernando Perez <fperez@colorado.edu>
3878 2002-01-23 Fernando Perez <fperez@colorado.edu>
3871
3879
3872 * IPython/iplib.py (CachedOutput.update): Changed output memory
3880 * IPython/iplib.py (CachedOutput.update): Changed output memory
3873 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3881 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3874 input history we still use _i. Did this b/c these variable are
3882 input history we still use _i. Did this b/c these variable are
3875 very commonly used in interactive work, so the less we need to
3883 very commonly used in interactive work, so the less we need to
3876 type the better off we are.
3884 type the better off we are.
3877 (Magic.magic_prun): updated @prun to better handle the namespaces
3885 (Magic.magic_prun): updated @prun to better handle the namespaces
3878 the file will run in, including a fix for __name__ not being set
3886 the file will run in, including a fix for __name__ not being set
3879 before.
3887 before.
3880
3888
3881 2002-01-20 Fernando Perez <fperez@colorado.edu>
3889 2002-01-20 Fernando Perez <fperez@colorado.edu>
3882
3890
3883 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3891 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3884 extra garbage for Python 2.2. Need to look more carefully into
3892 extra garbage for Python 2.2. Need to look more carefully into
3885 this later.
3893 this later.
3886
3894
3887 2002-01-19 Fernando Perez <fperez@colorado.edu>
3895 2002-01-19 Fernando Perez <fperez@colorado.edu>
3888
3896
3889 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3897 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3890 display SyntaxError exceptions properly formatted when they occur
3898 display SyntaxError exceptions properly formatted when they occur
3891 (they can be triggered by imported code).
3899 (they can be triggered by imported code).
3892
3900
3893 2002-01-18 Fernando Perez <fperez@colorado.edu>
3901 2002-01-18 Fernando Perez <fperez@colorado.edu>
3894
3902
3895 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3903 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3896 SyntaxError exceptions are reported nicely formatted, instead of
3904 SyntaxError exceptions are reported nicely formatted, instead of
3897 spitting out only offset information as before.
3905 spitting out only offset information as before.
3898 (Magic.magic_prun): Added the @prun function for executing
3906 (Magic.magic_prun): Added the @prun function for executing
3899 programs with command line args inside IPython.
3907 programs with command line args inside IPython.
3900
3908
3901 2002-01-16 Fernando Perez <fperez@colorado.edu>
3909 2002-01-16 Fernando Perez <fperez@colorado.edu>
3902
3910
3903 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3911 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3904 to *not* include the last item given in a range. This brings their
3912 to *not* include the last item given in a range. This brings their
3905 behavior in line with Python's slicing:
3913 behavior in line with Python's slicing:
3906 a[n1:n2] -> a[n1]...a[n2-1]
3914 a[n1:n2] -> a[n1]...a[n2-1]
3907 It may be a bit less convenient, but I prefer to stick to Python's
3915 It may be a bit less convenient, but I prefer to stick to Python's
3908 conventions *everywhere*, so users never have to wonder.
3916 conventions *everywhere*, so users never have to wonder.
3909 (Magic.magic_macro): Added @macro function to ease the creation of
3917 (Magic.magic_macro): Added @macro function to ease the creation of
3910 macros.
3918 macros.
3911
3919
3912 2002-01-05 Fernando Perez <fperez@colorado.edu>
3920 2002-01-05 Fernando Perez <fperez@colorado.edu>
3913
3921
3914 * Released 0.2.4.
3922 * Released 0.2.4.
3915
3923
3916 * IPython/iplib.py (Magic.magic_pdef):
3924 * IPython/iplib.py (Magic.magic_pdef):
3917 (InteractiveShell.safe_execfile): report magic lines and error
3925 (InteractiveShell.safe_execfile): report magic lines and error
3918 lines without line numbers so one can easily copy/paste them for
3926 lines without line numbers so one can easily copy/paste them for
3919 re-execution.
3927 re-execution.
3920
3928
3921 * Updated manual with recent changes.
3929 * Updated manual with recent changes.
3922
3930
3923 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3931 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3924 docstring printing when class? is called. Very handy for knowing
3932 docstring printing when class? is called. Very handy for knowing
3925 how to create class instances (as long as __init__ is well
3933 how to create class instances (as long as __init__ is well
3926 documented, of course :)
3934 documented, of course :)
3927 (Magic.magic_doc): print both class and constructor docstrings.
3935 (Magic.magic_doc): print both class and constructor docstrings.
3928 (Magic.magic_pdef): give constructor info if passed a class and
3936 (Magic.magic_pdef): give constructor info if passed a class and
3929 __call__ info for callable object instances.
3937 __call__ info for callable object instances.
3930
3938
3931 2002-01-04 Fernando Perez <fperez@colorado.edu>
3939 2002-01-04 Fernando Perez <fperez@colorado.edu>
3932
3940
3933 * Made deep_reload() off by default. It doesn't always work
3941 * Made deep_reload() off by default. It doesn't always work
3934 exactly as intended, so it's probably safer to have it off. It's
3942 exactly as intended, so it's probably safer to have it off. It's
3935 still available as dreload() anyway, so nothing is lost.
3943 still available as dreload() anyway, so nothing is lost.
3936
3944
3937 2002-01-02 Fernando Perez <fperez@colorado.edu>
3945 2002-01-02 Fernando Perez <fperez@colorado.edu>
3938
3946
3939 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3947 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3940 so I wanted an updated release).
3948 so I wanted an updated release).
3941
3949
3942 2001-12-27 Fernando Perez <fperez@colorado.edu>
3950 2001-12-27 Fernando Perez <fperez@colorado.edu>
3943
3951
3944 * IPython/iplib.py (InteractiveShell.interact): Added the original
3952 * IPython/iplib.py (InteractiveShell.interact): Added the original
3945 code from 'code.py' for this module in order to change the
3953 code from 'code.py' for this module in order to change the
3946 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3954 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3947 the history cache would break when the user hit Ctrl-C, and
3955 the history cache would break when the user hit Ctrl-C, and
3948 interact() offers no way to add any hooks to it.
3956 interact() offers no way to add any hooks to it.
3949
3957
3950 2001-12-23 Fernando Perez <fperez@colorado.edu>
3958 2001-12-23 Fernando Perez <fperez@colorado.edu>
3951
3959
3952 * setup.py: added check for 'MANIFEST' before trying to remove
3960 * setup.py: added check for 'MANIFEST' before trying to remove
3953 it. Thanks to Sean Reifschneider.
3961 it. Thanks to Sean Reifschneider.
3954
3962
3955 2001-12-22 Fernando Perez <fperez@colorado.edu>
3963 2001-12-22 Fernando Perez <fperez@colorado.edu>
3956
3964
3957 * Released 0.2.2.
3965 * Released 0.2.2.
3958
3966
3959 * Finished (reasonably) writing the manual. Later will add the
3967 * Finished (reasonably) writing the manual. Later will add the
3960 python-standard navigation stylesheets, but for the time being
3968 python-standard navigation stylesheets, but for the time being
3961 it's fairly complete. Distribution will include html and pdf
3969 it's fairly complete. Distribution will include html and pdf
3962 versions.
3970 versions.
3963
3971
3964 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3972 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3965 (MayaVi author).
3973 (MayaVi author).
3966
3974
3967 2001-12-21 Fernando Perez <fperez@colorado.edu>
3975 2001-12-21 Fernando Perez <fperez@colorado.edu>
3968
3976
3969 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3977 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3970 good public release, I think (with the manual and the distutils
3978 good public release, I think (with the manual and the distutils
3971 installer). The manual can use some work, but that can go
3979 installer). The manual can use some work, but that can go
3972 slowly. Otherwise I think it's quite nice for end users. Next
3980 slowly. Otherwise I think it's quite nice for end users. Next
3973 summer, rewrite the guts of it...
3981 summer, rewrite the guts of it...
3974
3982
3975 * Changed format of ipythonrc files to use whitespace as the
3983 * Changed format of ipythonrc files to use whitespace as the
3976 separator instead of an explicit '='. Cleaner.
3984 separator instead of an explicit '='. Cleaner.
3977
3985
3978 2001-12-20 Fernando Perez <fperez@colorado.edu>
3986 2001-12-20 Fernando Perez <fperez@colorado.edu>
3979
3987
3980 * Started a manual in LyX. For now it's just a quick merge of the
3988 * Started a manual in LyX. For now it's just a quick merge of the
3981 various internal docstrings and READMEs. Later it may grow into a
3989 various internal docstrings and READMEs. Later it may grow into a
3982 nice, full-blown manual.
3990 nice, full-blown manual.
3983
3991
3984 * Set up a distutils based installer. Installation should now be
3992 * Set up a distutils based installer. Installation should now be
3985 trivially simple for end-users.
3993 trivially simple for end-users.
3986
3994
3987 2001-12-11 Fernando Perez <fperez@colorado.edu>
3995 2001-12-11 Fernando Perez <fperez@colorado.edu>
3988
3996
3989 * Released 0.2.0. First public release, announced it at
3997 * Released 0.2.0. First public release, announced it at
3990 comp.lang.python. From now on, just bugfixes...
3998 comp.lang.python. From now on, just bugfixes...
3991
3999
3992 * Went through all the files, set copyright/license notices and
4000 * Went through all the files, set copyright/license notices and
3993 cleaned up things. Ready for release.
4001 cleaned up things. Ready for release.
3994
4002
3995 2001-12-10 Fernando Perez <fperez@colorado.edu>
4003 2001-12-10 Fernando Perez <fperez@colorado.edu>
3996
4004
3997 * Changed the first-time installer not to use tarfiles. It's more
4005 * Changed the first-time installer not to use tarfiles. It's more
3998 robust now and less unix-dependent. Also makes it easier for
4006 robust now and less unix-dependent. Also makes it easier for
3999 people to later upgrade versions.
4007 people to later upgrade versions.
4000
4008
4001 * Changed @exit to @abort to reflect the fact that it's pretty
4009 * Changed @exit to @abort to reflect the fact that it's pretty
4002 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4010 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4003 becomes significant only when IPyhton is embedded: in that case,
4011 becomes significant only when IPyhton is embedded: in that case,
4004 C-D closes IPython only, but @abort kills the enclosing program
4012 C-D closes IPython only, but @abort kills the enclosing program
4005 too (unless it had called IPython inside a try catching
4013 too (unless it had called IPython inside a try catching
4006 SystemExit).
4014 SystemExit).
4007
4015
4008 * Created Shell module which exposes the actuall IPython Shell
4016 * Created Shell module which exposes the actuall IPython Shell
4009 classes, currently the normal and the embeddable one. This at
4017 classes, currently the normal and the embeddable one. This at
4010 least offers a stable interface we won't need to change when
4018 least offers a stable interface we won't need to change when
4011 (later) the internals are rewritten. That rewrite will be confined
4019 (later) the internals are rewritten. That rewrite will be confined
4012 to iplib and ipmaker, but the Shell interface should remain as is.
4020 to iplib and ipmaker, but the Shell interface should remain as is.
4013
4021
4014 * Added embed module which offers an embeddable IPShell object,
4022 * Added embed module which offers an embeddable IPShell object,
4015 useful to fire up IPython *inside* a running program. Great for
4023 useful to fire up IPython *inside* a running program. Great for
4016 debugging or dynamical data analysis.
4024 debugging or dynamical data analysis.
4017
4025
4018 2001-12-08 Fernando Perez <fperez@colorado.edu>
4026 2001-12-08 Fernando Perez <fperez@colorado.edu>
4019
4027
4020 * Fixed small bug preventing seeing info from methods of defined
4028 * Fixed small bug preventing seeing info from methods of defined
4021 objects (incorrect namespace in _ofind()).
4029 objects (incorrect namespace in _ofind()).
4022
4030
4023 * Documentation cleanup. Moved the main usage docstrings to a
4031 * Documentation cleanup. Moved the main usage docstrings to a
4024 separate file, usage.py (cleaner to maintain, and hopefully in the
4032 separate file, usage.py (cleaner to maintain, and hopefully in the
4025 future some perlpod-like way of producing interactive, man and
4033 future some perlpod-like way of producing interactive, man and
4026 html docs out of it will be found).
4034 html docs out of it will be found).
4027
4035
4028 * Added @profile to see your profile at any time.
4036 * Added @profile to see your profile at any time.
4029
4037
4030 * Added @p as an alias for 'print'. It's especially convenient if
4038 * Added @p as an alias for 'print'. It's especially convenient if
4031 using automagic ('p x' prints x).
4039 using automagic ('p x' prints x).
4032
4040
4033 * Small cleanups and fixes after a pychecker run.
4041 * Small cleanups and fixes after a pychecker run.
4034
4042
4035 * Changed the @cd command to handle @cd - and @cd -<n> for
4043 * Changed the @cd command to handle @cd - and @cd -<n> for
4036 visiting any directory in _dh.
4044 visiting any directory in _dh.
4037
4045
4038 * Introduced _dh, a history of visited directories. @dhist prints
4046 * Introduced _dh, a history of visited directories. @dhist prints
4039 it out with numbers.
4047 it out with numbers.
4040
4048
4041 2001-12-07 Fernando Perez <fperez@colorado.edu>
4049 2001-12-07 Fernando Perez <fperez@colorado.edu>
4042
4050
4043 * Released 0.1.22
4051 * Released 0.1.22
4044
4052
4045 * Made initialization a bit more robust against invalid color
4053 * Made initialization a bit more robust against invalid color
4046 options in user input (exit, not traceback-crash).
4054 options in user input (exit, not traceback-crash).
4047
4055
4048 * Changed the bug crash reporter to write the report only in the
4056 * Changed the bug crash reporter to write the report only in the
4049 user's .ipython directory. That way IPython won't litter people's
4057 user's .ipython directory. That way IPython won't litter people's
4050 hard disks with crash files all over the place. Also print on
4058 hard disks with crash files all over the place. Also print on
4051 screen the necessary mail command.
4059 screen the necessary mail command.
4052
4060
4053 * With the new ultraTB, implemented LightBG color scheme for light
4061 * With the new ultraTB, implemented LightBG color scheme for light
4054 background terminals. A lot of people like white backgrounds, so I
4062 background terminals. A lot of people like white backgrounds, so I
4055 guess we should at least give them something readable.
4063 guess we should at least give them something readable.
4056
4064
4057 2001-12-06 Fernando Perez <fperez@colorado.edu>
4065 2001-12-06 Fernando Perez <fperez@colorado.edu>
4058
4066
4059 * Modified the structure of ultraTB. Now there's a proper class
4067 * Modified the structure of ultraTB. Now there's a proper class
4060 for tables of color schemes which allow adding schemes easily and
4068 for tables of color schemes which allow adding schemes easily and
4061 switching the active scheme without creating a new instance every
4069 switching the active scheme without creating a new instance every
4062 time (which was ridiculous). The syntax for creating new schemes
4070 time (which was ridiculous). The syntax for creating new schemes
4063 is also cleaner. I think ultraTB is finally done, with a clean
4071 is also cleaner. I think ultraTB is finally done, with a clean
4064 class structure. Names are also much cleaner (now there's proper
4072 class structure. Names are also much cleaner (now there's proper
4065 color tables, no need for every variable to also have 'color' in
4073 color tables, no need for every variable to also have 'color' in
4066 its name).
4074 its name).
4067
4075
4068 * Broke down genutils into separate files. Now genutils only
4076 * Broke down genutils into separate files. Now genutils only
4069 contains utility functions, and classes have been moved to their
4077 contains utility functions, and classes have been moved to their
4070 own files (they had enough independent functionality to warrant
4078 own files (they had enough independent functionality to warrant
4071 it): ConfigLoader, OutputTrap, Struct.
4079 it): ConfigLoader, OutputTrap, Struct.
4072
4080
4073 2001-12-05 Fernando Perez <fperez@colorado.edu>
4081 2001-12-05 Fernando Perez <fperez@colorado.edu>
4074
4082
4075 * IPython turns 21! Released version 0.1.21, as a candidate for
4083 * IPython turns 21! Released version 0.1.21, as a candidate for
4076 public consumption. If all goes well, release in a few days.
4084 public consumption. If all goes well, release in a few days.
4077
4085
4078 * Fixed path bug (files in Extensions/ directory wouldn't be found
4086 * Fixed path bug (files in Extensions/ directory wouldn't be found
4079 unless IPython/ was explicitly in sys.path).
4087 unless IPython/ was explicitly in sys.path).
4080
4088
4081 * Extended the FlexCompleter class as MagicCompleter to allow
4089 * Extended the FlexCompleter class as MagicCompleter to allow
4082 completion of @-starting lines.
4090 completion of @-starting lines.
4083
4091
4084 * Created __release__.py file as a central repository for release
4092 * Created __release__.py file as a central repository for release
4085 info that other files can read from.
4093 info that other files can read from.
4086
4094
4087 * Fixed small bug in logging: when logging was turned on in
4095 * Fixed small bug in logging: when logging was turned on in
4088 mid-session, old lines with special meanings (!@?) were being
4096 mid-session, old lines with special meanings (!@?) were being
4089 logged without the prepended comment, which is necessary since
4097 logged without the prepended comment, which is necessary since
4090 they are not truly valid python syntax. This should make session
4098 they are not truly valid python syntax. This should make session
4091 restores produce less errors.
4099 restores produce less errors.
4092
4100
4093 * The namespace cleanup forced me to make a FlexCompleter class
4101 * The namespace cleanup forced me to make a FlexCompleter class
4094 which is nothing but a ripoff of rlcompleter, but with selectable
4102 which is nothing but a ripoff of rlcompleter, but with selectable
4095 namespace (rlcompleter only works in __main__.__dict__). I'll try
4103 namespace (rlcompleter only works in __main__.__dict__). I'll try
4096 to submit a note to the authors to see if this change can be
4104 to submit a note to the authors to see if this change can be
4097 incorporated in future rlcompleter releases (Dec.6: done)
4105 incorporated in future rlcompleter releases (Dec.6: done)
4098
4106
4099 * More fixes to namespace handling. It was a mess! Now all
4107 * More fixes to namespace handling. It was a mess! Now all
4100 explicit references to __main__.__dict__ are gone (except when
4108 explicit references to __main__.__dict__ are gone (except when
4101 really needed) and everything is handled through the namespace
4109 really needed) and everything is handled through the namespace
4102 dicts in the IPython instance. We seem to be getting somewhere
4110 dicts in the IPython instance. We seem to be getting somewhere
4103 with this, finally...
4111 with this, finally...
4104
4112
4105 * Small documentation updates.
4113 * Small documentation updates.
4106
4114
4107 * Created the Extensions directory under IPython (with an
4115 * Created the Extensions directory under IPython (with an
4108 __init__.py). Put the PhysicalQ stuff there. This directory should
4116 __init__.py). Put the PhysicalQ stuff there. This directory should
4109 be used for all special-purpose extensions.
4117 be used for all special-purpose extensions.
4110
4118
4111 * File renaming:
4119 * File renaming:
4112 ipythonlib --> ipmaker
4120 ipythonlib --> ipmaker
4113 ipplib --> iplib
4121 ipplib --> iplib
4114 This makes a bit more sense in terms of what these files actually do.
4122 This makes a bit more sense in terms of what these files actually do.
4115
4123
4116 * Moved all the classes and functions in ipythonlib to ipplib, so
4124 * Moved all the classes and functions in ipythonlib to ipplib, so
4117 now ipythonlib only has make_IPython(). This will ease up its
4125 now ipythonlib only has make_IPython(). This will ease up its
4118 splitting in smaller functional chunks later.
4126 splitting in smaller functional chunks later.
4119
4127
4120 * Cleaned up (done, I think) output of @whos. Better column
4128 * Cleaned up (done, I think) output of @whos. Better column
4121 formatting, and now shows str(var) for as much as it can, which is
4129 formatting, and now shows str(var) for as much as it can, which is
4122 typically what one gets with a 'print var'.
4130 typically what one gets with a 'print var'.
4123
4131
4124 2001-12-04 Fernando Perez <fperez@colorado.edu>
4132 2001-12-04 Fernando Perez <fperez@colorado.edu>
4125
4133
4126 * Fixed namespace problems. Now builtin/IPyhton/user names get
4134 * Fixed namespace problems. Now builtin/IPyhton/user names get
4127 properly reported in their namespace. Internal namespace handling
4135 properly reported in their namespace. Internal namespace handling
4128 is finally getting decent (not perfect yet, but much better than
4136 is finally getting decent (not perfect yet, but much better than
4129 the ad-hoc mess we had).
4137 the ad-hoc mess we had).
4130
4138
4131 * Removed -exit option. If people just want to run a python
4139 * Removed -exit option. If people just want to run a python
4132 script, that's what the normal interpreter is for. Less
4140 script, that's what the normal interpreter is for. Less
4133 unnecessary options, less chances for bugs.
4141 unnecessary options, less chances for bugs.
4134
4142
4135 * Added a crash handler which generates a complete post-mortem if
4143 * Added a crash handler which generates a complete post-mortem if
4136 IPython crashes. This will help a lot in tracking bugs down the
4144 IPython crashes. This will help a lot in tracking bugs down the
4137 road.
4145 road.
4138
4146
4139 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4147 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4140 which were boud to functions being reassigned would bypass the
4148 which were boud to functions being reassigned would bypass the
4141 logger, breaking the sync of _il with the prompt counter. This
4149 logger, breaking the sync of _il with the prompt counter. This
4142 would then crash IPython later when a new line was logged.
4150 would then crash IPython later when a new line was logged.
4143
4151
4144 2001-12-02 Fernando Perez <fperez@colorado.edu>
4152 2001-12-02 Fernando Perez <fperez@colorado.edu>
4145
4153
4146 * Made IPython a package. This means people don't have to clutter
4154 * Made IPython a package. This means people don't have to clutter
4147 their sys.path with yet another directory. Changed the INSTALL
4155 their sys.path with yet another directory. Changed the INSTALL
4148 file accordingly.
4156 file accordingly.
4149
4157
4150 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4158 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4151 sorts its output (so @who shows it sorted) and @whos formats the
4159 sorts its output (so @who shows it sorted) and @whos formats the
4152 table according to the width of the first column. Nicer, easier to
4160 table according to the width of the first column. Nicer, easier to
4153 read. Todo: write a generic table_format() which takes a list of
4161 read. Todo: write a generic table_format() which takes a list of
4154 lists and prints it nicely formatted, with optional row/column
4162 lists and prints it nicely formatted, with optional row/column
4155 separators and proper padding and justification.
4163 separators and proper padding and justification.
4156
4164
4157 * Released 0.1.20
4165 * Released 0.1.20
4158
4166
4159 * Fixed bug in @log which would reverse the inputcache list (a
4167 * Fixed bug in @log which would reverse the inputcache list (a
4160 copy operation was missing).
4168 copy operation was missing).
4161
4169
4162 * Code cleanup. @config was changed to use page(). Better, since
4170 * Code cleanup. @config was changed to use page(). Better, since
4163 its output is always quite long.
4171 its output is always quite long.
4164
4172
4165 * Itpl is back as a dependency. I was having too many problems
4173 * Itpl is back as a dependency. I was having too many problems
4166 getting the parametric aliases to work reliably, and it's just
4174 getting the parametric aliases to work reliably, and it's just
4167 easier to code weird string operations with it than playing %()s
4175 easier to code weird string operations with it than playing %()s
4168 games. It's only ~6k, so I don't think it's too big a deal.
4176 games. It's only ~6k, so I don't think it's too big a deal.
4169
4177
4170 * Found (and fixed) a very nasty bug with history. !lines weren't
4178 * Found (and fixed) a very nasty bug with history. !lines weren't
4171 getting cached, and the out of sync caches would crash
4179 getting cached, and the out of sync caches would crash
4172 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4180 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4173 division of labor a bit better. Bug fixed, cleaner structure.
4181 division of labor a bit better. Bug fixed, cleaner structure.
4174
4182
4175 2001-12-01 Fernando Perez <fperez@colorado.edu>
4183 2001-12-01 Fernando Perez <fperez@colorado.edu>
4176
4184
4177 * Released 0.1.19
4185 * Released 0.1.19
4178
4186
4179 * Added option -n to @hist to prevent line number printing. Much
4187 * Added option -n to @hist to prevent line number printing. Much
4180 easier to copy/paste code this way.
4188 easier to copy/paste code this way.
4181
4189
4182 * Created global _il to hold the input list. Allows easy
4190 * Created global _il to hold the input list. Allows easy
4183 re-execution of blocks of code by slicing it (inspired by Janko's
4191 re-execution of blocks of code by slicing it (inspired by Janko's
4184 comment on 'macros').
4192 comment on 'macros').
4185
4193
4186 * Small fixes and doc updates.
4194 * Small fixes and doc updates.
4187
4195
4188 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4196 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4189 much too fragile with automagic. Handles properly multi-line
4197 much too fragile with automagic. Handles properly multi-line
4190 statements and takes parameters.
4198 statements and takes parameters.
4191
4199
4192 2001-11-30 Fernando Perez <fperez@colorado.edu>
4200 2001-11-30 Fernando Perez <fperez@colorado.edu>
4193
4201
4194 * Version 0.1.18 released.
4202 * Version 0.1.18 released.
4195
4203
4196 * Fixed nasty namespace bug in initial module imports.
4204 * Fixed nasty namespace bug in initial module imports.
4197
4205
4198 * Added copyright/license notes to all code files (except
4206 * Added copyright/license notes to all code files (except
4199 DPyGetOpt). For the time being, LGPL. That could change.
4207 DPyGetOpt). For the time being, LGPL. That could change.
4200
4208
4201 * Rewrote a much nicer README, updated INSTALL, cleaned up
4209 * Rewrote a much nicer README, updated INSTALL, cleaned up
4202 ipythonrc-* samples.
4210 ipythonrc-* samples.
4203
4211
4204 * Overall code/documentation cleanup. Basically ready for
4212 * Overall code/documentation cleanup. Basically ready for
4205 release. Only remaining thing: licence decision (LGPL?).
4213 release. Only remaining thing: licence decision (LGPL?).
4206
4214
4207 * Converted load_config to a class, ConfigLoader. Now recursion
4215 * Converted load_config to a class, ConfigLoader. Now recursion
4208 control is better organized. Doesn't include the same file twice.
4216 control is better organized. Doesn't include the same file twice.
4209
4217
4210 2001-11-29 Fernando Perez <fperez@colorado.edu>
4218 2001-11-29 Fernando Perez <fperez@colorado.edu>
4211
4219
4212 * Got input history working. Changed output history variables from
4220 * Got input history working. Changed output history variables from
4213 _p to _o so that _i is for input and _o for output. Just cleaner
4221 _p to _o so that _i is for input and _o for output. Just cleaner
4214 convention.
4222 convention.
4215
4223
4216 * Implemented parametric aliases. This pretty much allows the
4224 * Implemented parametric aliases. This pretty much allows the
4217 alias system to offer full-blown shell convenience, I think.
4225 alias system to offer full-blown shell convenience, I think.
4218
4226
4219 * Version 0.1.17 released, 0.1.18 opened.
4227 * Version 0.1.17 released, 0.1.18 opened.
4220
4228
4221 * dot_ipython/ipythonrc (alias): added documentation.
4229 * dot_ipython/ipythonrc (alias): added documentation.
4222 (xcolor): Fixed small bug (xcolors -> xcolor)
4230 (xcolor): Fixed small bug (xcolors -> xcolor)
4223
4231
4224 * Changed the alias system. Now alias is a magic command to define
4232 * Changed the alias system. Now alias is a magic command to define
4225 aliases just like the shell. Rationale: the builtin magics should
4233 aliases just like the shell. Rationale: the builtin magics should
4226 be there for things deeply connected to IPython's
4234 be there for things deeply connected to IPython's
4227 architecture. And this is a much lighter system for what I think
4235 architecture. And this is a much lighter system for what I think
4228 is the really important feature: allowing users to define quickly
4236 is the really important feature: allowing users to define quickly
4229 magics that will do shell things for them, so they can customize
4237 magics that will do shell things for them, so they can customize
4230 IPython easily to match their work habits. If someone is really
4238 IPython easily to match their work habits. If someone is really
4231 desperate to have another name for a builtin alias, they can
4239 desperate to have another name for a builtin alias, they can
4232 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4240 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4233 works.
4241 works.
4234
4242
4235 2001-11-28 Fernando Perez <fperez@colorado.edu>
4243 2001-11-28 Fernando Perez <fperez@colorado.edu>
4236
4244
4237 * Changed @file so that it opens the source file at the proper
4245 * Changed @file so that it opens the source file at the proper
4238 line. Since it uses less, if your EDITOR environment is
4246 line. Since it uses less, if your EDITOR environment is
4239 configured, typing v will immediately open your editor of choice
4247 configured, typing v will immediately open your editor of choice
4240 right at the line where the object is defined. Not as quick as
4248 right at the line where the object is defined. Not as quick as
4241 having a direct @edit command, but for all intents and purposes it
4249 having a direct @edit command, but for all intents and purposes it
4242 works. And I don't have to worry about writing @edit to deal with
4250 works. And I don't have to worry about writing @edit to deal with
4243 all the editors, less does that.
4251 all the editors, less does that.
4244
4252
4245 * Version 0.1.16 released, 0.1.17 opened.
4253 * Version 0.1.16 released, 0.1.17 opened.
4246
4254
4247 * Fixed some nasty bugs in the page/page_dumb combo that could
4255 * Fixed some nasty bugs in the page/page_dumb combo that could
4248 crash IPython.
4256 crash IPython.
4249
4257
4250 2001-11-27 Fernando Perez <fperez@colorado.edu>
4258 2001-11-27 Fernando Perez <fperez@colorado.edu>
4251
4259
4252 * Version 0.1.15 released, 0.1.16 opened.
4260 * Version 0.1.15 released, 0.1.16 opened.
4253
4261
4254 * Finally got ? and ?? to work for undefined things: now it's
4262 * Finally got ? and ?? to work for undefined things: now it's
4255 possible to type {}.get? and get information about the get method
4263 possible to type {}.get? and get information about the get method
4256 of dicts, or os.path? even if only os is defined (so technically
4264 of dicts, or os.path? even if only os is defined (so technically
4257 os.path isn't). Works at any level. For example, after import os,
4265 os.path isn't). Works at any level. For example, after import os,
4258 os?, os.path?, os.path.abspath? all work. This is great, took some
4266 os?, os.path?, os.path.abspath? all work. This is great, took some
4259 work in _ofind.
4267 work in _ofind.
4260
4268
4261 * Fixed more bugs with logging. The sanest way to do it was to add
4269 * Fixed more bugs with logging. The sanest way to do it was to add
4262 to @log a 'mode' parameter. Killed two in one shot (this mode
4270 to @log a 'mode' parameter. Killed two in one shot (this mode
4263 option was a request of Janko's). I think it's finally clean
4271 option was a request of Janko's). I think it's finally clean
4264 (famous last words).
4272 (famous last words).
4265
4273
4266 * Added a page_dumb() pager which does a decent job of paging on
4274 * Added a page_dumb() pager which does a decent job of paging on
4267 screen, if better things (like less) aren't available. One less
4275 screen, if better things (like less) aren't available. One less
4268 unix dependency (someday maybe somebody will port this to
4276 unix dependency (someday maybe somebody will port this to
4269 windows).
4277 windows).
4270
4278
4271 * Fixed problem in magic_log: would lock of logging out if log
4279 * Fixed problem in magic_log: would lock of logging out if log
4272 creation failed (because it would still think it had succeeded).
4280 creation failed (because it would still think it had succeeded).
4273
4281
4274 * Improved the page() function using curses to auto-detect screen
4282 * Improved the page() function using curses to auto-detect screen
4275 size. Now it can make a much better decision on whether to print
4283 size. Now it can make a much better decision on whether to print
4276 or page a string. Option screen_length was modified: a value 0
4284 or page a string. Option screen_length was modified: a value 0
4277 means auto-detect, and that's the default now.
4285 means auto-detect, and that's the default now.
4278
4286
4279 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4287 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4280 go out. I'll test it for a few days, then talk to Janko about
4288 go out. I'll test it for a few days, then talk to Janko about
4281 licences and announce it.
4289 licences and announce it.
4282
4290
4283 * Fixed the length of the auto-generated ---> prompt which appears
4291 * Fixed the length of the auto-generated ---> prompt which appears
4284 for auto-parens and auto-quotes. Getting this right isn't trivial,
4292 for auto-parens and auto-quotes. Getting this right isn't trivial,
4285 with all the color escapes, different prompt types and optional
4293 with all the color escapes, different prompt types and optional
4286 separators. But it seems to be working in all the combinations.
4294 separators. But it seems to be working in all the combinations.
4287
4295
4288 2001-11-26 Fernando Perez <fperez@colorado.edu>
4296 2001-11-26 Fernando Perez <fperez@colorado.edu>
4289
4297
4290 * Wrote a regexp filter to get option types from the option names
4298 * Wrote a regexp filter to get option types from the option names
4291 string. This eliminates the need to manually keep two duplicate
4299 string. This eliminates the need to manually keep two duplicate
4292 lists.
4300 lists.
4293
4301
4294 * Removed the unneeded check_option_names. Now options are handled
4302 * Removed the unneeded check_option_names. Now options are handled
4295 in a much saner manner and it's easy to visually check that things
4303 in a much saner manner and it's easy to visually check that things
4296 are ok.
4304 are ok.
4297
4305
4298 * Updated version numbers on all files I modified to carry a
4306 * Updated version numbers on all files I modified to carry a
4299 notice so Janko and Nathan have clear version markers.
4307 notice so Janko and Nathan have clear version markers.
4300
4308
4301 * Updated docstring for ultraTB with my changes. I should send
4309 * Updated docstring for ultraTB with my changes. I should send
4302 this to Nathan.
4310 this to Nathan.
4303
4311
4304 * Lots of small fixes. Ran everything through pychecker again.
4312 * Lots of small fixes. Ran everything through pychecker again.
4305
4313
4306 * Made loading of deep_reload an cmd line option. If it's not too
4314 * Made loading of deep_reload an cmd line option. If it's not too
4307 kosher, now people can just disable it. With -nodeep_reload it's
4315 kosher, now people can just disable it. With -nodeep_reload it's
4308 still available as dreload(), it just won't overwrite reload().
4316 still available as dreload(), it just won't overwrite reload().
4309
4317
4310 * Moved many options to the no| form (-opt and -noopt
4318 * Moved many options to the no| form (-opt and -noopt
4311 accepted). Cleaner.
4319 accepted). Cleaner.
4312
4320
4313 * Changed magic_log so that if called with no parameters, it uses
4321 * Changed magic_log so that if called with no parameters, it uses
4314 'rotate' mode. That way auto-generated logs aren't automatically
4322 'rotate' mode. That way auto-generated logs aren't automatically
4315 over-written. For normal logs, now a backup is made if it exists
4323 over-written. For normal logs, now a backup is made if it exists
4316 (only 1 level of backups). A new 'backup' mode was added to the
4324 (only 1 level of backups). A new 'backup' mode was added to the
4317 Logger class to support this. This was a request by Janko.
4325 Logger class to support this. This was a request by Janko.
4318
4326
4319 * Added @logoff/@logon to stop/restart an active log.
4327 * Added @logoff/@logon to stop/restart an active log.
4320
4328
4321 * Fixed a lot of bugs in log saving/replay. It was pretty
4329 * Fixed a lot of bugs in log saving/replay. It was pretty
4322 broken. Now special lines (!@,/) appear properly in the command
4330 broken. Now special lines (!@,/) appear properly in the command
4323 history after a log replay.
4331 history after a log replay.
4324
4332
4325 * Tried and failed to implement full session saving via pickle. My
4333 * Tried and failed to implement full session saving via pickle. My
4326 idea was to pickle __main__.__dict__, but modules can't be
4334 idea was to pickle __main__.__dict__, but modules can't be
4327 pickled. This would be a better alternative to replaying logs, but
4335 pickled. This would be a better alternative to replaying logs, but
4328 seems quite tricky to get to work. Changed -session to be called
4336 seems quite tricky to get to work. Changed -session to be called
4329 -logplay, which more accurately reflects what it does. And if we
4337 -logplay, which more accurately reflects what it does. And if we
4330 ever get real session saving working, -session is now available.
4338 ever get real session saving working, -session is now available.
4331
4339
4332 * Implemented color schemes for prompts also. As for tracebacks,
4340 * Implemented color schemes for prompts also. As for tracebacks,
4333 currently only NoColor and Linux are supported. But now the
4341 currently only NoColor and Linux are supported. But now the
4334 infrastructure is in place, based on a generic ColorScheme
4342 infrastructure is in place, based on a generic ColorScheme
4335 class. So writing and activating new schemes both for the prompts
4343 class. So writing and activating new schemes both for the prompts
4336 and the tracebacks should be straightforward.
4344 and the tracebacks should be straightforward.
4337
4345
4338 * Version 0.1.13 released, 0.1.14 opened.
4346 * Version 0.1.13 released, 0.1.14 opened.
4339
4347
4340 * Changed handling of options for output cache. Now counter is
4348 * Changed handling of options for output cache. Now counter is
4341 hardwired starting at 1 and one specifies the maximum number of
4349 hardwired starting at 1 and one specifies the maximum number of
4342 entries *in the outcache* (not the max prompt counter). This is
4350 entries *in the outcache* (not the max prompt counter). This is
4343 much better, since many statements won't increase the cache
4351 much better, since many statements won't increase the cache
4344 count. It also eliminated some confusing options, now there's only
4352 count. It also eliminated some confusing options, now there's only
4345 one: cache_size.
4353 one: cache_size.
4346
4354
4347 * Added 'alias' magic function and magic_alias option in the
4355 * Added 'alias' magic function and magic_alias option in the
4348 ipythonrc file. Now the user can easily define whatever names he
4356 ipythonrc file. Now the user can easily define whatever names he
4349 wants for the magic functions without having to play weird
4357 wants for the magic functions without having to play weird
4350 namespace games. This gives IPython a real shell-like feel.
4358 namespace games. This gives IPython a real shell-like feel.
4351
4359
4352 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4360 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4353 @ or not).
4361 @ or not).
4354
4362
4355 This was one of the last remaining 'visible' bugs (that I know
4363 This was one of the last remaining 'visible' bugs (that I know
4356 of). I think if I can clean up the session loading so it works
4364 of). I think if I can clean up the session loading so it works
4357 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4365 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4358 about licensing).
4366 about licensing).
4359
4367
4360 2001-11-25 Fernando Perez <fperez@colorado.edu>
4368 2001-11-25 Fernando Perez <fperez@colorado.edu>
4361
4369
4362 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4370 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4363 there's a cleaner distinction between what ? and ?? show.
4371 there's a cleaner distinction between what ? and ?? show.
4364
4372
4365 * Added screen_length option. Now the user can define his own
4373 * Added screen_length option. Now the user can define his own
4366 screen size for page() operations.
4374 screen size for page() operations.
4367
4375
4368 * Implemented magic shell-like functions with automatic code
4376 * Implemented magic shell-like functions with automatic code
4369 generation. Now adding another function is just a matter of adding
4377 generation. Now adding another function is just a matter of adding
4370 an entry to a dict, and the function is dynamically generated at
4378 an entry to a dict, and the function is dynamically generated at
4371 run-time. Python has some really cool features!
4379 run-time. Python has some really cool features!
4372
4380
4373 * Renamed many options to cleanup conventions a little. Now all
4381 * Renamed many options to cleanup conventions a little. Now all
4374 are lowercase, and only underscores where needed. Also in the code
4382 are lowercase, and only underscores where needed. Also in the code
4375 option name tables are clearer.
4383 option name tables are clearer.
4376
4384
4377 * Changed prompts a little. Now input is 'In [n]:' instead of
4385 * Changed prompts a little. Now input is 'In [n]:' instead of
4378 'In[n]:='. This allows it the numbers to be aligned with the
4386 'In[n]:='. This allows it the numbers to be aligned with the
4379 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4387 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4380 Python (it was a Mathematica thing). The '...' continuation prompt
4388 Python (it was a Mathematica thing). The '...' continuation prompt
4381 was also changed a little to align better.
4389 was also changed a little to align better.
4382
4390
4383 * Fixed bug when flushing output cache. Not all _p<n> variables
4391 * Fixed bug when flushing output cache. Not all _p<n> variables
4384 exist, so their deletion needs to be wrapped in a try:
4392 exist, so their deletion needs to be wrapped in a try:
4385
4393
4386 * Figured out how to properly use inspect.formatargspec() (it
4394 * Figured out how to properly use inspect.formatargspec() (it
4387 requires the args preceded by *). So I removed all the code from
4395 requires the args preceded by *). So I removed all the code from
4388 _get_pdef in Magic, which was just replicating that.
4396 _get_pdef in Magic, which was just replicating that.
4389
4397
4390 * Added test to prefilter to allow redefining magic function names
4398 * Added test to prefilter to allow redefining magic function names
4391 as variables. This is ok, since the @ form is always available,
4399 as variables. This is ok, since the @ form is always available,
4392 but whe should allow the user to define a variable called 'ls' if
4400 but whe should allow the user to define a variable called 'ls' if
4393 he needs it.
4401 he needs it.
4394
4402
4395 * Moved the ToDo information from README into a separate ToDo.
4403 * Moved the ToDo information from README into a separate ToDo.
4396
4404
4397 * General code cleanup and small bugfixes. I think it's close to a
4405 * General code cleanup and small bugfixes. I think it's close to a
4398 state where it can be released, obviously with a big 'beta'
4406 state where it can be released, obviously with a big 'beta'
4399 warning on it.
4407 warning on it.
4400
4408
4401 * Got the magic function split to work. Now all magics are defined
4409 * Got the magic function split to work. Now all magics are defined
4402 in a separate class. It just organizes things a bit, and now
4410 in a separate class. It just organizes things a bit, and now
4403 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4411 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4404 was too long).
4412 was too long).
4405
4413
4406 * Changed @clear to @reset to avoid potential confusions with
4414 * Changed @clear to @reset to avoid potential confusions with
4407 the shell command clear. Also renamed @cl to @clear, which does
4415 the shell command clear. Also renamed @cl to @clear, which does
4408 exactly what people expect it to from their shell experience.
4416 exactly what people expect it to from their shell experience.
4409
4417
4410 Added a check to the @reset command (since it's so
4418 Added a check to the @reset command (since it's so
4411 destructive, it's probably a good idea to ask for confirmation).
4419 destructive, it's probably a good idea to ask for confirmation).
4412 But now reset only works for full namespace resetting. Since the
4420 But now reset only works for full namespace resetting. Since the
4413 del keyword is already there for deleting a few specific
4421 del keyword is already there for deleting a few specific
4414 variables, I don't see the point of having a redundant magic
4422 variables, I don't see the point of having a redundant magic
4415 function for the same task.
4423 function for the same task.
4416
4424
4417 2001-11-24 Fernando Perez <fperez@colorado.edu>
4425 2001-11-24 Fernando Perez <fperez@colorado.edu>
4418
4426
4419 * Updated the builtin docs (esp. the ? ones).
4427 * Updated the builtin docs (esp. the ? ones).
4420
4428
4421 * Ran all the code through pychecker. Not terribly impressed with
4429 * Ran all the code through pychecker. Not terribly impressed with
4422 it: lots of spurious warnings and didn't really find anything of
4430 it: lots of spurious warnings and didn't really find anything of
4423 substance (just a few modules being imported and not used).
4431 substance (just a few modules being imported and not used).
4424
4432
4425 * Implemented the new ultraTB functionality into IPython. New
4433 * Implemented the new ultraTB functionality into IPython. New
4426 option: xcolors. This chooses color scheme. xmode now only selects
4434 option: xcolors. This chooses color scheme. xmode now only selects
4427 between Plain and Verbose. Better orthogonality.
4435 between Plain and Verbose. Better orthogonality.
4428
4436
4429 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4437 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4430 mode and color scheme for the exception handlers. Now it's
4438 mode and color scheme for the exception handlers. Now it's
4431 possible to have the verbose traceback with no coloring.
4439 possible to have the verbose traceback with no coloring.
4432
4440
4433 2001-11-23 Fernando Perez <fperez@colorado.edu>
4441 2001-11-23 Fernando Perez <fperez@colorado.edu>
4434
4442
4435 * Version 0.1.12 released, 0.1.13 opened.
4443 * Version 0.1.12 released, 0.1.13 opened.
4436
4444
4437 * Removed option to set auto-quote and auto-paren escapes by
4445 * Removed option to set auto-quote and auto-paren escapes by
4438 user. The chances of breaking valid syntax are just too high. If
4446 user. The chances of breaking valid syntax are just too high. If
4439 someone *really* wants, they can always dig into the code.
4447 someone *really* wants, they can always dig into the code.
4440
4448
4441 * Made prompt separators configurable.
4449 * Made prompt separators configurable.
4442
4450
4443 2001-11-22 Fernando Perez <fperez@colorado.edu>
4451 2001-11-22 Fernando Perez <fperez@colorado.edu>
4444
4452
4445 * Small bugfixes in many places.
4453 * Small bugfixes in many places.
4446
4454
4447 * Removed the MyCompleter class from ipplib. It seemed redundant
4455 * Removed the MyCompleter class from ipplib. It seemed redundant
4448 with the C-p,C-n history search functionality. Less code to
4456 with the C-p,C-n history search functionality. Less code to
4449 maintain.
4457 maintain.
4450
4458
4451 * Moved all the original ipython.py code into ipythonlib.py. Right
4459 * Moved all the original ipython.py code into ipythonlib.py. Right
4452 now it's just one big dump into a function called make_IPython, so
4460 now it's just one big dump into a function called make_IPython, so
4453 no real modularity has been gained. But at least it makes the
4461 no real modularity has been gained. But at least it makes the
4454 wrapper script tiny, and since ipythonlib is a module, it gets
4462 wrapper script tiny, and since ipythonlib is a module, it gets
4455 compiled and startup is much faster.
4463 compiled and startup is much faster.
4456
4464
4457 This is a reasobably 'deep' change, so we should test it for a
4465 This is a reasobably 'deep' change, so we should test it for a
4458 while without messing too much more with the code.
4466 while without messing too much more with the code.
4459
4467
4460 2001-11-21 Fernando Perez <fperez@colorado.edu>
4468 2001-11-21 Fernando Perez <fperez@colorado.edu>
4461
4469
4462 * Version 0.1.11 released, 0.1.12 opened for further work.
4470 * Version 0.1.11 released, 0.1.12 opened for further work.
4463
4471
4464 * Removed dependency on Itpl. It was only needed in one place. It
4472 * Removed dependency on Itpl. It was only needed in one place. It
4465 would be nice if this became part of python, though. It makes life
4473 would be nice if this became part of python, though. It makes life
4466 *a lot* easier in some cases.
4474 *a lot* easier in some cases.
4467
4475
4468 * Simplified the prefilter code a bit. Now all handlers are
4476 * Simplified the prefilter code a bit. Now all handlers are
4469 expected to explicitly return a value (at least a blank string).
4477 expected to explicitly return a value (at least a blank string).
4470
4478
4471 * Heavy edits in ipplib. Removed the help system altogether. Now
4479 * Heavy edits in ipplib. Removed the help system altogether. Now
4472 obj?/?? is used for inspecting objects, a magic @doc prints
4480 obj?/?? is used for inspecting objects, a magic @doc prints
4473 docstrings, and full-blown Python help is accessed via the 'help'
4481 docstrings, and full-blown Python help is accessed via the 'help'
4474 keyword. This cleans up a lot of code (less to maintain) and does
4482 keyword. This cleans up a lot of code (less to maintain) and does
4475 the job. Since 'help' is now a standard Python component, might as
4483 the job. Since 'help' is now a standard Python component, might as
4476 well use it and remove duplicate functionality.
4484 well use it and remove duplicate functionality.
4477
4485
4478 Also removed the option to use ipplib as a standalone program. By
4486 Also removed the option to use ipplib as a standalone program. By
4479 now it's too dependent on other parts of IPython to function alone.
4487 now it's too dependent on other parts of IPython to function alone.
4480
4488
4481 * Fixed bug in genutils.pager. It would crash if the pager was
4489 * Fixed bug in genutils.pager. It would crash if the pager was
4482 exited immediately after opening (broken pipe).
4490 exited immediately after opening (broken pipe).
4483
4491
4484 * Trimmed down the VerboseTB reporting a little. The header is
4492 * Trimmed down the VerboseTB reporting a little. The header is
4485 much shorter now and the repeated exception arguments at the end
4493 much shorter now and the repeated exception arguments at the end
4486 have been removed. For interactive use the old header seemed a bit
4494 have been removed. For interactive use the old header seemed a bit
4487 excessive.
4495 excessive.
4488
4496
4489 * Fixed small bug in output of @whos for variables with multi-word
4497 * Fixed small bug in output of @whos for variables with multi-word
4490 types (only first word was displayed).
4498 types (only first word was displayed).
4491
4499
4492 2001-11-17 Fernando Perez <fperez@colorado.edu>
4500 2001-11-17 Fernando Perez <fperez@colorado.edu>
4493
4501
4494 * Version 0.1.10 released, 0.1.11 opened for further work.
4502 * Version 0.1.10 released, 0.1.11 opened for further work.
4495
4503
4496 * Modified dirs and friends. dirs now *returns* the stack (not
4504 * Modified dirs and friends. dirs now *returns* the stack (not
4497 prints), so one can manipulate it as a variable. Convenient to
4505 prints), so one can manipulate it as a variable. Convenient to
4498 travel along many directories.
4506 travel along many directories.
4499
4507
4500 * Fixed bug in magic_pdef: would only work with functions with
4508 * Fixed bug in magic_pdef: would only work with functions with
4501 arguments with default values.
4509 arguments with default values.
4502
4510
4503 2001-11-14 Fernando Perez <fperez@colorado.edu>
4511 2001-11-14 Fernando Perez <fperez@colorado.edu>
4504
4512
4505 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4513 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4506 example with IPython. Various other minor fixes and cleanups.
4514 example with IPython. Various other minor fixes and cleanups.
4507
4515
4508 * Version 0.1.9 released, 0.1.10 opened for further work.
4516 * Version 0.1.9 released, 0.1.10 opened for further work.
4509
4517
4510 * Added sys.path to the list of directories searched in the
4518 * Added sys.path to the list of directories searched in the
4511 execfile= option. It used to be the current directory and the
4519 execfile= option. It used to be the current directory and the
4512 user's IPYTHONDIR only.
4520 user's IPYTHONDIR only.
4513
4521
4514 2001-11-13 Fernando Perez <fperez@colorado.edu>
4522 2001-11-13 Fernando Perez <fperez@colorado.edu>
4515
4523
4516 * Reinstated the raw_input/prefilter separation that Janko had
4524 * Reinstated the raw_input/prefilter separation that Janko had
4517 initially. This gives a more convenient setup for extending the
4525 initially. This gives a more convenient setup for extending the
4518 pre-processor from the outside: raw_input always gets a string,
4526 pre-processor from the outside: raw_input always gets a string,
4519 and prefilter has to process it. We can then redefine prefilter
4527 and prefilter has to process it. We can then redefine prefilter
4520 from the outside and implement extensions for special
4528 from the outside and implement extensions for special
4521 purposes.
4529 purposes.
4522
4530
4523 Today I got one for inputting PhysicalQuantity objects
4531 Today I got one for inputting PhysicalQuantity objects
4524 (from Scientific) without needing any function calls at
4532 (from Scientific) without needing any function calls at
4525 all. Extremely convenient, and it's all done as a user-level
4533 all. Extremely convenient, and it's all done as a user-level
4526 extension (no IPython code was touched). Now instead of:
4534 extension (no IPython code was touched). Now instead of:
4527 a = PhysicalQuantity(4.2,'m/s**2')
4535 a = PhysicalQuantity(4.2,'m/s**2')
4528 one can simply say
4536 one can simply say
4529 a = 4.2 m/s**2
4537 a = 4.2 m/s**2
4530 or even
4538 or even
4531 a = 4.2 m/s^2
4539 a = 4.2 m/s^2
4532
4540
4533 I use this, but it's also a proof of concept: IPython really is
4541 I use this, but it's also a proof of concept: IPython really is
4534 fully user-extensible, even at the level of the parsing of the
4542 fully user-extensible, even at the level of the parsing of the
4535 command line. It's not trivial, but it's perfectly doable.
4543 command line. It's not trivial, but it's perfectly doable.
4536
4544
4537 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4545 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4538 the problem of modules being loaded in the inverse order in which
4546 the problem of modules being loaded in the inverse order in which
4539 they were defined in
4547 they were defined in
4540
4548
4541 * Version 0.1.8 released, 0.1.9 opened for further work.
4549 * Version 0.1.8 released, 0.1.9 opened for further work.
4542
4550
4543 * Added magics pdef, source and file. They respectively show the
4551 * Added magics pdef, source and file. They respectively show the
4544 definition line ('prototype' in C), source code and full python
4552 definition line ('prototype' in C), source code and full python
4545 file for any callable object. The object inspector oinfo uses
4553 file for any callable object. The object inspector oinfo uses
4546 these to show the same information.
4554 these to show the same information.
4547
4555
4548 * Version 0.1.7 released, 0.1.8 opened for further work.
4556 * Version 0.1.7 released, 0.1.8 opened for further work.
4549
4557
4550 * Separated all the magic functions into a class called Magic. The
4558 * Separated all the magic functions into a class called Magic. The
4551 InteractiveShell class was becoming too big for Xemacs to handle
4559 InteractiveShell class was becoming too big for Xemacs to handle
4552 (de-indenting a line would lock it up for 10 seconds while it
4560 (de-indenting a line would lock it up for 10 seconds while it
4553 backtracked on the whole class!)
4561 backtracked on the whole class!)
4554
4562
4555 FIXME: didn't work. It can be done, but right now namespaces are
4563 FIXME: didn't work. It can be done, but right now namespaces are
4556 all messed up. Do it later (reverted it for now, so at least
4564 all messed up. Do it later (reverted it for now, so at least
4557 everything works as before).
4565 everything works as before).
4558
4566
4559 * Got the object introspection system (magic_oinfo) working! I
4567 * Got the object introspection system (magic_oinfo) working! I
4560 think this is pretty much ready for release to Janko, so he can
4568 think this is pretty much ready for release to Janko, so he can
4561 test it for a while and then announce it. Pretty much 100% of what
4569 test it for a while and then announce it. Pretty much 100% of what
4562 I wanted for the 'phase 1' release is ready. Happy, tired.
4570 I wanted for the 'phase 1' release is ready. Happy, tired.
4563
4571
4564 2001-11-12 Fernando Perez <fperez@colorado.edu>
4572 2001-11-12 Fernando Perez <fperez@colorado.edu>
4565
4573
4566 * Version 0.1.6 released, 0.1.7 opened for further work.
4574 * Version 0.1.6 released, 0.1.7 opened for further work.
4567
4575
4568 * Fixed bug in printing: it used to test for truth before
4576 * Fixed bug in printing: it used to test for truth before
4569 printing, so 0 wouldn't print. Now checks for None.
4577 printing, so 0 wouldn't print. Now checks for None.
4570
4578
4571 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4579 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4572 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4580 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4573 reaches by hand into the outputcache. Think of a better way to do
4581 reaches by hand into the outputcache. Think of a better way to do
4574 this later.
4582 this later.
4575
4583
4576 * Various small fixes thanks to Nathan's comments.
4584 * Various small fixes thanks to Nathan's comments.
4577
4585
4578 * Changed magic_pprint to magic_Pprint. This way it doesn't
4586 * Changed magic_pprint to magic_Pprint. This way it doesn't
4579 collide with pprint() and the name is consistent with the command
4587 collide with pprint() and the name is consistent with the command
4580 line option.
4588 line option.
4581
4589
4582 * Changed prompt counter behavior to be fully like
4590 * Changed prompt counter behavior to be fully like
4583 Mathematica's. That is, even input that doesn't return a result
4591 Mathematica's. That is, even input that doesn't return a result
4584 raises the prompt counter. The old behavior was kind of confusing
4592 raises the prompt counter. The old behavior was kind of confusing
4585 (getting the same prompt number several times if the operation
4593 (getting the same prompt number several times if the operation
4586 didn't return a result).
4594 didn't return a result).
4587
4595
4588 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4596 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4589
4597
4590 * Fixed -Classic mode (wasn't working anymore).
4598 * Fixed -Classic mode (wasn't working anymore).
4591
4599
4592 * Added colored prompts using Nathan's new code. Colors are
4600 * Added colored prompts using Nathan's new code. Colors are
4593 currently hardwired, they can be user-configurable. For
4601 currently hardwired, they can be user-configurable. For
4594 developers, they can be chosen in file ipythonlib.py, at the
4602 developers, they can be chosen in file ipythonlib.py, at the
4595 beginning of the CachedOutput class def.
4603 beginning of the CachedOutput class def.
4596
4604
4597 2001-11-11 Fernando Perez <fperez@colorado.edu>
4605 2001-11-11 Fernando Perez <fperez@colorado.edu>
4598
4606
4599 * Version 0.1.5 released, 0.1.6 opened for further work.
4607 * Version 0.1.5 released, 0.1.6 opened for further work.
4600
4608
4601 * Changed magic_env to *return* the environment as a dict (not to
4609 * Changed magic_env to *return* the environment as a dict (not to
4602 print it). This way it prints, but it can also be processed.
4610 print it). This way it prints, but it can also be processed.
4603
4611
4604 * Added Verbose exception reporting to interactive
4612 * Added Verbose exception reporting to interactive
4605 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4613 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4606 traceback. Had to make some changes to the ultraTB file. This is
4614 traceback. Had to make some changes to the ultraTB file. This is
4607 probably the last 'big' thing in my mental todo list. This ties
4615 probably the last 'big' thing in my mental todo list. This ties
4608 in with the next entry:
4616 in with the next entry:
4609
4617
4610 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4618 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4611 has to specify is Plain, Color or Verbose for all exception
4619 has to specify is Plain, Color or Verbose for all exception
4612 handling.
4620 handling.
4613
4621
4614 * Removed ShellServices option. All this can really be done via
4622 * Removed ShellServices option. All this can really be done via
4615 the magic system. It's easier to extend, cleaner and has automatic
4623 the magic system. It's easier to extend, cleaner and has automatic
4616 namespace protection and documentation.
4624 namespace protection and documentation.
4617
4625
4618 2001-11-09 Fernando Perez <fperez@colorado.edu>
4626 2001-11-09 Fernando Perez <fperez@colorado.edu>
4619
4627
4620 * Fixed bug in output cache flushing (missing parameter to
4628 * Fixed bug in output cache flushing (missing parameter to
4621 __init__). Other small bugs fixed (found using pychecker).
4629 __init__). Other small bugs fixed (found using pychecker).
4622
4630
4623 * Version 0.1.4 opened for bugfixing.
4631 * Version 0.1.4 opened for bugfixing.
4624
4632
4625 2001-11-07 Fernando Perez <fperez@colorado.edu>
4633 2001-11-07 Fernando Perez <fperez@colorado.edu>
4626
4634
4627 * Version 0.1.3 released, mainly because of the raw_input bug.
4635 * Version 0.1.3 released, mainly because of the raw_input bug.
4628
4636
4629 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4637 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4630 and when testing for whether things were callable, a call could
4638 and when testing for whether things were callable, a call could
4631 actually be made to certain functions. They would get called again
4639 actually be made to certain functions. They would get called again
4632 once 'really' executed, with a resulting double call. A disaster
4640 once 'really' executed, with a resulting double call. A disaster
4633 in many cases (list.reverse() would never work!).
4641 in many cases (list.reverse() would never work!).
4634
4642
4635 * Removed prefilter() function, moved its code to raw_input (which
4643 * Removed prefilter() function, moved its code to raw_input (which
4636 after all was just a near-empty caller for prefilter). This saves
4644 after all was just a near-empty caller for prefilter). This saves
4637 a function call on every prompt, and simplifies the class a tiny bit.
4645 a function call on every prompt, and simplifies the class a tiny bit.
4638
4646
4639 * Fix _ip to __ip name in magic example file.
4647 * Fix _ip to __ip name in magic example file.
4640
4648
4641 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4649 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4642 work with non-gnu versions of tar.
4650 work with non-gnu versions of tar.
4643
4651
4644 2001-11-06 Fernando Perez <fperez@colorado.edu>
4652 2001-11-06 Fernando Perez <fperez@colorado.edu>
4645
4653
4646 * Version 0.1.2. Just to keep track of the recent changes.
4654 * Version 0.1.2. Just to keep track of the recent changes.
4647
4655
4648 * Fixed nasty bug in output prompt routine. It used to check 'if
4656 * Fixed nasty bug in output prompt routine. It used to check 'if
4649 arg != None...'. Problem is, this fails if arg implements a
4657 arg != None...'. Problem is, this fails if arg implements a
4650 special comparison (__cmp__) which disallows comparing to
4658 special comparison (__cmp__) which disallows comparing to
4651 None. Found it when trying to use the PhysicalQuantity module from
4659 None. Found it when trying to use the PhysicalQuantity module from
4652 ScientificPython.
4660 ScientificPython.
4653
4661
4654 2001-11-05 Fernando Perez <fperez@colorado.edu>
4662 2001-11-05 Fernando Perez <fperez@colorado.edu>
4655
4663
4656 * Also added dirs. Now the pushd/popd/dirs family functions
4664 * Also added dirs. Now the pushd/popd/dirs family functions
4657 basically like the shell, with the added convenience of going home
4665 basically like the shell, with the added convenience of going home
4658 when called with no args.
4666 when called with no args.
4659
4667
4660 * pushd/popd slightly modified to mimic shell behavior more
4668 * pushd/popd slightly modified to mimic shell behavior more
4661 closely.
4669 closely.
4662
4670
4663 * Added env,pushd,popd from ShellServices as magic functions. I
4671 * Added env,pushd,popd from ShellServices as magic functions. I
4664 think the cleanest will be to port all desired functions from
4672 think the cleanest will be to port all desired functions from
4665 ShellServices as magics and remove ShellServices altogether. This
4673 ShellServices as magics and remove ShellServices altogether. This
4666 will provide a single, clean way of adding functionality
4674 will provide a single, clean way of adding functionality
4667 (shell-type or otherwise) to IP.
4675 (shell-type or otherwise) to IP.
4668
4676
4669 2001-11-04 Fernando Perez <fperez@colorado.edu>
4677 2001-11-04 Fernando Perez <fperez@colorado.edu>
4670
4678
4671 * Added .ipython/ directory to sys.path. This way users can keep
4679 * Added .ipython/ directory to sys.path. This way users can keep
4672 customizations there and access them via import.
4680 customizations there and access them via import.
4673
4681
4674 2001-11-03 Fernando Perez <fperez@colorado.edu>
4682 2001-11-03 Fernando Perez <fperez@colorado.edu>
4675
4683
4676 * Opened version 0.1.1 for new changes.
4684 * Opened version 0.1.1 for new changes.
4677
4685
4678 * Changed version number to 0.1.0: first 'public' release, sent to
4686 * Changed version number to 0.1.0: first 'public' release, sent to
4679 Nathan and Janko.
4687 Nathan and Janko.
4680
4688
4681 * Lots of small fixes and tweaks.
4689 * Lots of small fixes and tweaks.
4682
4690
4683 * Minor changes to whos format. Now strings are shown, snipped if
4691 * Minor changes to whos format. Now strings are shown, snipped if
4684 too long.
4692 too long.
4685
4693
4686 * Changed ShellServices to work on __main__ so they show up in @who
4694 * Changed ShellServices to work on __main__ so they show up in @who
4687
4695
4688 * Help also works with ? at the end of a line:
4696 * Help also works with ? at the end of a line:
4689 ?sin and sin?
4697 ?sin and sin?
4690 both produce the same effect. This is nice, as often I use the
4698 both produce the same effect. This is nice, as often I use the
4691 tab-complete to find the name of a method, but I used to then have
4699 tab-complete to find the name of a method, but I used to then have
4692 to go to the beginning of the line to put a ? if I wanted more
4700 to go to the beginning of the line to put a ? if I wanted more
4693 info. Now I can just add the ? and hit return. Convenient.
4701 info. Now I can just add the ? and hit return. Convenient.
4694
4702
4695 2001-11-02 Fernando Perez <fperez@colorado.edu>
4703 2001-11-02 Fernando Perez <fperez@colorado.edu>
4696
4704
4697 * Python version check (>=2.1) added.
4705 * Python version check (>=2.1) added.
4698
4706
4699 * Added LazyPython documentation. At this point the docs are quite
4707 * Added LazyPython documentation. At this point the docs are quite
4700 a mess. A cleanup is in order.
4708 a mess. A cleanup is in order.
4701
4709
4702 * Auto-installer created. For some bizarre reason, the zipfiles
4710 * Auto-installer created. For some bizarre reason, the zipfiles
4703 module isn't working on my system. So I made a tar version
4711 module isn't working on my system. So I made a tar version
4704 (hopefully the command line options in various systems won't kill
4712 (hopefully the command line options in various systems won't kill
4705 me).
4713 me).
4706
4714
4707 * Fixes to Struct in genutils. Now all dictionary-like methods are
4715 * Fixes to Struct in genutils. Now all dictionary-like methods are
4708 protected (reasonably).
4716 protected (reasonably).
4709
4717
4710 * Added pager function to genutils and changed ? to print usage
4718 * Added pager function to genutils and changed ? to print usage
4711 note through it (it was too long).
4719 note through it (it was too long).
4712
4720
4713 * Added the LazyPython functionality. Works great! I changed the
4721 * Added the LazyPython functionality. Works great! I changed the
4714 auto-quote escape to ';', it's on home row and next to '. But
4722 auto-quote escape to ';', it's on home row and next to '. But
4715 both auto-quote and auto-paren (still /) escapes are command-line
4723 both auto-quote and auto-paren (still /) escapes are command-line
4716 parameters.
4724 parameters.
4717
4725
4718
4726
4719 2001-11-01 Fernando Perez <fperez@colorado.edu>
4727 2001-11-01 Fernando Perez <fperez@colorado.edu>
4720
4728
4721 * Version changed to 0.0.7. Fairly large change: configuration now
4729 * Version changed to 0.0.7. Fairly large change: configuration now
4722 is all stored in a directory, by default .ipython. There, all
4730 is all stored in a directory, by default .ipython. There, all
4723 config files have normal looking names (not .names)
4731 config files have normal looking names (not .names)
4724
4732
4725 * Version 0.0.6 Released first to Lucas and Archie as a test
4733 * Version 0.0.6 Released first to Lucas and Archie as a test
4726 run. Since it's the first 'semi-public' release, change version to
4734 run. Since it's the first 'semi-public' release, change version to
4727 > 0.0.6 for any changes now.
4735 > 0.0.6 for any changes now.
4728
4736
4729 * Stuff I had put in the ipplib.py changelog:
4737 * Stuff I had put in the ipplib.py changelog:
4730
4738
4731 Changes to InteractiveShell:
4739 Changes to InteractiveShell:
4732
4740
4733 - Made the usage message a parameter.
4741 - Made the usage message a parameter.
4734
4742
4735 - Require the name of the shell variable to be given. It's a bit
4743 - Require the name of the shell variable to be given. It's a bit
4736 of a hack, but allows the name 'shell' not to be hardwire in the
4744 of a hack, but allows the name 'shell' not to be hardwire in the
4737 magic (@) handler, which is problematic b/c it requires
4745 magic (@) handler, which is problematic b/c it requires
4738 polluting the global namespace with 'shell'. This in turn is
4746 polluting the global namespace with 'shell'. This in turn is
4739 fragile: if a user redefines a variable called shell, things
4747 fragile: if a user redefines a variable called shell, things
4740 break.
4748 break.
4741
4749
4742 - magic @: all functions available through @ need to be defined
4750 - magic @: all functions available through @ need to be defined
4743 as magic_<name>, even though they can be called simply as
4751 as magic_<name>, even though they can be called simply as
4744 @<name>. This allows the special command @magic to gather
4752 @<name>. This allows the special command @magic to gather
4745 information automatically about all existing magic functions,
4753 information automatically about all existing magic functions,
4746 even if they are run-time user extensions, by parsing the shell
4754 even if they are run-time user extensions, by parsing the shell
4747 instance __dict__ looking for special magic_ names.
4755 instance __dict__ looking for special magic_ names.
4748
4756
4749 - mainloop: added *two* local namespace parameters. This allows
4757 - mainloop: added *two* local namespace parameters. This allows
4750 the class to differentiate between parameters which were there
4758 the class to differentiate between parameters which were there
4751 before and after command line initialization was processed. This
4759 before and after command line initialization was processed. This
4752 way, later @who can show things loaded at startup by the
4760 way, later @who can show things loaded at startup by the
4753 user. This trick was necessary to make session saving/reloading
4761 user. This trick was necessary to make session saving/reloading
4754 really work: ideally after saving/exiting/reloading a session,
4762 really work: ideally after saving/exiting/reloading a session,
4755 *everythin* should look the same, including the output of @who. I
4763 *everythin* should look the same, including the output of @who. I
4756 was only able to make this work with this double namespace
4764 was only able to make this work with this double namespace
4757 trick.
4765 trick.
4758
4766
4759 - added a header to the logfile which allows (almost) full
4767 - added a header to the logfile which allows (almost) full
4760 session restoring.
4768 session restoring.
4761
4769
4762 - prepend lines beginning with @ or !, with a and log
4770 - prepend lines beginning with @ or !, with a and log
4763 them. Why? !lines: may be useful to know what you did @lines:
4771 them. Why? !lines: may be useful to know what you did @lines:
4764 they may affect session state. So when restoring a session, at
4772 they may affect session state. So when restoring a session, at
4765 least inform the user of their presence. I couldn't quite get
4773 least inform the user of their presence. I couldn't quite get
4766 them to properly re-execute, but at least the user is warned.
4774 them to properly re-execute, but at least the user is warned.
4767
4775
4768 * Started ChangeLog.
4776 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now