##// END OF EJS Templates
Fixes for handling of global variables in embedded ipython instances (I ran...
fperez -
Show More
@@ -1,881 +1,880 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 882 2005-09-20 23:17:41Z fperez $"""
7 $Id: Shell.py 921 2005-11-13 06:51:34Z 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 sys
23 import sys
24 import os
24 import os
25 import code
25 import code
26 import threading
26 import threading
27 import signal
27 import signal
28
28
29 import IPython
29 import IPython
30 from IPython.iplib import InteractiveShell
30 from IPython.iplib import InteractiveShell
31 from IPython.ipmaker import make_IPython
31 from IPython.ipmaker import make_IPython
32 from IPython.genutils import Term,warn,error,flag_calls
32 from IPython.genutils import Term,warn,error,flag_calls
33 from IPython.Struct import Struct
33 from IPython.Struct import Struct
34 from IPython.Magic import Magic
34 from IPython.Magic import Magic
35 from IPython import ultraTB
35 from IPython import ultraTB
36
36
37 # global flag to pass around information about Ctrl-C without exceptions
37 # global flag to pass around information about Ctrl-C without exceptions
38 KBINT = False
38 KBINT = False
39
39
40 # global flag to turn on/off Tk support.
40 # global flag to turn on/off Tk support.
41 USE_TK = False
41 USE_TK = False
42
42
43 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
44 # This class is trivial now, but I want to have it in to publish a clean
44 # This class is trivial now, but I want to have it in to publish a clean
45 # interface. Later when the internals are reorganized, code that uses this
45 # interface. Later when the internals are reorganized, code that uses this
46 # shouldn't have to change.
46 # shouldn't have to change.
47
47
48 class IPShell:
48 class IPShell:
49 """Create an IPython instance."""
49 """Create an IPython instance."""
50
50
51 def __init__(self,argv=None,user_ns=None,debug=1,
51 def __init__(self,argv=None,user_ns=None,debug=1,
52 shell_class=InteractiveShell):
52 shell_class=InteractiveShell):
53 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
53 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
54 shell_class=shell_class)
54 shell_class=shell_class)
55
55
56 def mainloop(self,sys_exit=0,banner=None):
56 def mainloop(self,sys_exit=0,banner=None):
57 self.IP.mainloop(banner)
57 self.IP.mainloop(banner)
58 if sys_exit:
58 if sys_exit:
59 sys.exit()
59 sys.exit()
60
60
61 #-----------------------------------------------------------------------------
61 #-----------------------------------------------------------------------------
62 class IPShellEmbed:
62 class IPShellEmbed:
63 """Allow embedding an IPython shell into a running program.
63 """Allow embedding an IPython shell into a running program.
64
64
65 Instances of this class are callable, with the __call__ method being an
65 Instances of this class are callable, with the __call__ method being an
66 alias to the embed() method of an InteractiveShell instance.
66 alias to the embed() method of an InteractiveShell instance.
67
67
68 Usage (see also the example-embed.py file for a running example):
68 Usage (see also the example-embed.py file for a running example):
69
69
70 ipshell = IPShellEmbed([argv,banner,exit_msg,rc_override])
70 ipshell = IPShellEmbed([argv,banner,exit_msg,rc_override])
71
71
72 - argv: list containing valid command-line options for IPython, as they
72 - argv: list containing valid command-line options for IPython, as they
73 would appear in sys.argv[1:].
73 would appear in sys.argv[1:].
74
74
75 For example, the following command-line options:
75 For example, the following command-line options:
76
76
77 $ ipython -prompt_in1 'Input <\\#>' -colors LightBG
77 $ ipython -prompt_in1 'Input <\\#>' -colors LightBG
78
78
79 would be passed in the argv list as:
79 would be passed in the argv list as:
80
80
81 ['-prompt_in1','Input <\\#>','-colors','LightBG']
81 ['-prompt_in1','Input <\\#>','-colors','LightBG']
82
82
83 - banner: string which gets printed every time the interpreter starts.
83 - banner: string which gets printed every time the interpreter starts.
84
84
85 - exit_msg: string which gets printed every time the interpreter exits.
85 - exit_msg: string which gets printed every time the interpreter exits.
86
86
87 - rc_override: a dict or Struct of configuration options such as those
87 - rc_override: a dict or Struct of configuration options such as those
88 used by IPython. These options are read from your ~/.ipython/ipythonrc
88 used by IPython. These options are read from your ~/.ipython/ipythonrc
89 file when the Shell object is created. Passing an explicit rc_override
89 file when the Shell object is created. Passing an explicit rc_override
90 dict with any options you want allows you to override those values at
90 dict with any options you want allows you to override those values at
91 creation time without having to modify the file. This way you can create
91 creation time without having to modify the file. This way you can create
92 embeddable instances configured in any way you want without editing any
92 embeddable instances configured in any way you want without editing any
93 global files (thus keeping your interactive IPython configuration
93 global files (thus keeping your interactive IPython configuration
94 unchanged).
94 unchanged).
95
95
96 Then the ipshell instance can be called anywhere inside your code:
96 Then the ipshell instance can be called anywhere inside your code:
97
97
98 ipshell(header='') -> Opens up an IPython shell.
98 ipshell(header='') -> Opens up an IPython shell.
99
99
100 - header: string printed by the IPython shell upon startup. This can let
100 - header: string printed by the IPython shell upon startup. This can let
101 you know where in your code you are when dropping into the shell. Note
101 you know where in your code you are when dropping into the shell. Note
102 that 'banner' gets prepended to all calls, so header is used for
102 that 'banner' gets prepended to all calls, so header is used for
103 location-specific information.
103 location-specific information.
104
104
105 For more details, see the __call__ method below.
105 For more details, see the __call__ method below.
106
106
107 When the IPython shell is exited with Ctrl-D, normal program execution
107 When the IPython shell is exited with Ctrl-D, normal program execution
108 resumes.
108 resumes.
109
109
110 This functionality was inspired by a posting on comp.lang.python by cmkl
110 This functionality was inspired by a posting on comp.lang.python by cmkl
111 <cmkleffner@gmx.de> on Dec. 06/01 concerning similar uses of pyrepl, and
111 <cmkleffner@gmx.de> on Dec. 06/01 concerning similar uses of pyrepl, and
112 by the IDL stop/continue commands."""
112 by the IDL stop/continue commands."""
113
113
114 def __init__(self,argv=None,banner='',exit_msg=None,rc_override=None):
114 def __init__(self,argv=None,banner='',exit_msg=None,rc_override=None):
115 """Note that argv here is a string, NOT a list."""
115 """Note that argv here is a string, NOT a list."""
116 self.set_banner(banner)
116 self.set_banner(banner)
117 self.set_exit_msg(exit_msg)
117 self.set_exit_msg(exit_msg)
118 self.set_dummy_mode(0)
118 self.set_dummy_mode(0)
119
119
120 # sys.displayhook is a global, we need to save the user's original
120 # sys.displayhook is a global, we need to save the user's original
121 # Don't rely on __displayhook__, as the user may have changed that.
121 # Don't rely on __displayhook__, as the user may have changed that.
122 self.sys_displayhook_ori = sys.displayhook
122 self.sys_displayhook_ori = sys.displayhook
123
123
124 # save readline completer status
124 # save readline completer status
125 try:
125 try:
126 #print 'Save completer',sys.ipcompleter # dbg
126 #print 'Save completer',sys.ipcompleter # dbg
127 self.sys_ipcompleter_ori = sys.ipcompleter
127 self.sys_ipcompleter_ori = sys.ipcompleter
128 except:
128 except:
129 pass # not nested with IPython
129 pass # not nested with IPython
130
130
131 # FIXME. Passing user_ns breaks namespace handling.
131 # FIXME. Passing user_ns breaks namespace handling.
132 #self.IP = make_IPython(argv,user_ns=__main__.__dict__)
132 #self.IP = make_IPython(argv,user_ns=__main__.__dict__)
133 self.IP = make_IPython(argv,rc_override=rc_override,embedded=True)
133 self.IP = make_IPython(argv,rc_override=rc_override,embedded=True)
134
134
135 self.IP.name_space_init()
136 # mark this as an embedded instance so we know if we get a crash
135 # mark this as an embedded instance so we know if we get a crash
137 # post-mortem
136 # post-mortem
138 self.IP.rc.embedded = 1
137 self.IP.rc.embedded = 1
139 # copy our own displayhook also
138 # copy our own displayhook also
140 self.sys_displayhook_embed = sys.displayhook
139 self.sys_displayhook_embed = sys.displayhook
141 # and leave the system's display hook clean
140 # and leave the system's display hook clean
142 sys.displayhook = self.sys_displayhook_ori
141 sys.displayhook = self.sys_displayhook_ori
143 # don't use the ipython crash handler so that user exceptions aren't
142 # don't use the ipython crash handler so that user exceptions aren't
144 # trapped
143 # trapped
145 sys.excepthook = ultraTB.FormattedTB(color_scheme = self.IP.rc.colors,
144 sys.excepthook = ultraTB.FormattedTB(color_scheme = self.IP.rc.colors,
146 mode = self.IP.rc.xmode,
145 mode = self.IP.rc.xmode,
147 call_pdb = self.IP.rc.pdb)
146 call_pdb = self.IP.rc.pdb)
148 self.restore_system_completer()
147 self.restore_system_completer()
149
148
150 def restore_system_completer(self):
149 def restore_system_completer(self):
151 """Restores the readline completer which was in place.
150 """Restores the readline completer which was in place.
152
151
153 This allows embedded IPython within IPython not to disrupt the
152 This allows embedded IPython within IPython not to disrupt the
154 parent's completion.
153 parent's completion.
155 """
154 """
156
155
157 try:
156 try:
158 self.IP.readline.set_completer(self.sys_ipcompleter_ori)
157 self.IP.readline.set_completer(self.sys_ipcompleter_ori)
159 sys.ipcompleter = self.sys_ipcompleter_ori
158 sys.ipcompleter = self.sys_ipcompleter_ori
160 except:
159 except:
161 pass
160 pass
162
161
163 def __call__(self,header='',local_ns=None,global_ns=None,dummy=None):
162 def __call__(self,header='',local_ns=None,global_ns=None,dummy=None):
164 """Activate the interactive interpreter.
163 """Activate the interactive interpreter.
165
164
166 __call__(self,header='',local_ns=None,global_ns,dummy=None) -> Start
165 __call__(self,header='',local_ns=None,global_ns,dummy=None) -> Start
167 the interpreter shell with the given local and global namespaces, and
166 the interpreter shell with the given local and global namespaces, and
168 optionally print a header string at startup.
167 optionally print a header string at startup.
169
168
170 The shell can be globally activated/deactivated using the
169 The shell can be globally activated/deactivated using the
171 set/get_dummy_mode methods. This allows you to turn off a shell used
170 set/get_dummy_mode methods. This allows you to turn off a shell used
172 for debugging globally.
171 for debugging globally.
173
172
174 However, *each* time you call the shell you can override the current
173 However, *each* time you call the shell you can override the current
175 state of dummy_mode with the optional keyword parameter 'dummy'. For
174 state of dummy_mode with the optional keyword parameter 'dummy'. For
176 example, if you set dummy mode on with IPShell.set_dummy_mode(1), you
175 example, if you set dummy mode on with IPShell.set_dummy_mode(1), you
177 can still have a specific call work by making it as IPShell(dummy=0).
176 can still have a specific call work by making it as IPShell(dummy=0).
178
177
179 The optional keyword parameter dummy controls whether the call
178 The optional keyword parameter dummy controls whether the call
180 actually does anything. """
179 actually does anything. """
181
180
182 # Allow the dummy parameter to override the global __dummy_mode
181 # Allow the dummy parameter to override the global __dummy_mode
183 if dummy or (dummy != 0 and self.__dummy_mode):
182 if dummy or (dummy != 0 and self.__dummy_mode):
184 return
183 return
185
184
186 # Set global subsystems (display,completions) to our values
185 # Set global subsystems (display,completions) to our values
187 sys.displayhook = self.sys_displayhook_embed
186 sys.displayhook = self.sys_displayhook_embed
188 if self.IP.has_readline:
187 if self.IP.has_readline:
189 self.IP.readline.set_completer(self.IP.Completer.complete)
188 self.IP.readline.set_completer(self.IP.Completer.complete)
190
189
191 if self.banner and header:
190 if self.banner and header:
192 format = '%s\n%s\n'
191 format = '%s\n%s\n'
193 else:
192 else:
194 format = '%s%s\n'
193 format = '%s%s\n'
195 banner = format % (self.banner,header)
194 banner = format % (self.banner,header)
196
195
197 # Call the embedding code with a stack depth of 1 so it can skip over
196 # Call the embedding code with a stack depth of 1 so it can skip over
198 # our call and get the original caller's namespaces.
197 # our call and get the original caller's namespaces.
199 self.IP.embed_mainloop(banner,local_ns,global_ns,stack_depth=1)
198 self.IP.embed_mainloop(banner,local_ns,global_ns,stack_depth=1)
200
199
201 if self.exit_msg:
200 if self.exit_msg:
202 print self.exit_msg
201 print self.exit_msg
203
202
204 # Restore global systems (display, completion)
203 # Restore global systems (display, completion)
205 sys.displayhook = self.sys_displayhook_ori
204 sys.displayhook = self.sys_displayhook_ori
206 self.restore_system_completer()
205 self.restore_system_completer()
207
206
208 def set_dummy_mode(self,dummy):
207 def set_dummy_mode(self,dummy):
209 """Sets the embeddable shell's dummy mode parameter.
208 """Sets the embeddable shell's dummy mode parameter.
210
209
211 set_dummy_mode(dummy): dummy = 0 or 1.
210 set_dummy_mode(dummy): dummy = 0 or 1.
212
211
213 This parameter is persistent and makes calls to the embeddable shell
212 This parameter is persistent and makes calls to the embeddable shell
214 silently return without performing any action. This allows you to
213 silently return without performing any action. This allows you to
215 globally activate or deactivate a shell you're using with a single call.
214 globally activate or deactivate a shell you're using with a single call.
216
215
217 If you need to manually"""
216 If you need to manually"""
218
217
219 if dummy not in [0,1]:
218 if dummy not in [0,1]:
220 raise ValueError,'dummy parameter must be 0 or 1'
219 raise ValueError,'dummy parameter must be 0 or 1'
221 self.__dummy_mode = dummy
220 self.__dummy_mode = dummy
222
221
223 def get_dummy_mode(self):
222 def get_dummy_mode(self):
224 """Return the current value of the dummy mode parameter.
223 """Return the current value of the dummy mode parameter.
225 """
224 """
226 return self.__dummy_mode
225 return self.__dummy_mode
227
226
228 def set_banner(self,banner):
227 def set_banner(self,banner):
229 """Sets the global banner.
228 """Sets the global banner.
230
229
231 This banner gets prepended to every header printed when the shell
230 This banner gets prepended to every header printed when the shell
232 instance is called."""
231 instance is called."""
233
232
234 self.banner = banner
233 self.banner = banner
235
234
236 def set_exit_msg(self,exit_msg):
235 def set_exit_msg(self,exit_msg):
237 """Sets the global exit_msg.
236 """Sets the global exit_msg.
238
237
239 This exit message gets printed upon exiting every time the embedded
238 This exit message gets printed upon exiting every time the embedded
240 shell is called. It is None by default. """
239 shell is called. It is None by default. """
241
240
242 self.exit_msg = exit_msg
241 self.exit_msg = exit_msg
243
242
244 #-----------------------------------------------------------------------------
243 #-----------------------------------------------------------------------------
245 def sigint_handler (signum,stack_frame):
244 def sigint_handler (signum,stack_frame):
246 """Sigint handler for threaded apps.
245 """Sigint handler for threaded apps.
247
246
248 This is a horrible hack to pass information about SIGINT _without_ using
247 This is a horrible hack to pass information about SIGINT _without_ using
249 exceptions, since I haven't been able to properly manage cross-thread
248 exceptions, since I haven't been able to properly manage cross-thread
250 exceptions in GTK/WX. In fact, I don't think it can be done (or at least
249 exceptions in GTK/WX. In fact, I don't think it can be done (or at least
251 that's my understanding from a c.l.py thread where this was discussed)."""
250 that's my understanding from a c.l.py thread where this was discussed)."""
252
251
253 global KBINT
252 global KBINT
254
253
255 print '\nKeyboardInterrupt - Press <Enter> to continue.',
254 print '\nKeyboardInterrupt - Press <Enter> to continue.',
256 Term.cout.flush()
255 Term.cout.flush()
257 # Set global flag so that runsource can know that Ctrl-C was hit
256 # Set global flag so that runsource can know that Ctrl-C was hit
258 KBINT = True
257 KBINT = True
259
258
260 class MTInteractiveShell(InteractiveShell):
259 class MTInteractiveShell(InteractiveShell):
261 """Simple multi-threaded shell."""
260 """Simple multi-threaded shell."""
262
261
263 # Threading strategy taken from:
262 # Threading strategy taken from:
264 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
263 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
265 # McErlean and John Finlay. Modified with corrections by Antoon Pardon,
264 # McErlean and John Finlay. Modified with corrections by Antoon Pardon,
266 # from the pygtk mailing list, to avoid lockups with system calls.
265 # from the pygtk mailing list, to avoid lockups with system calls.
267
266
268 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),
269 user_ns = None, banner2='',**kw):
268 user_ns = None, banner2='',**kw):
270 """Similar to the normal InteractiveShell, but with threading control"""
269 """Similar to the normal InteractiveShell, but with threading control"""
271
270
272 IPython.iplib.InteractiveShell.__init__(self,name,usage,rc,user_ns,banner2)
271 IPython.iplib.InteractiveShell.__init__(self,name,usage,rc,user_ns,banner2)
273
272
274 # Locking control variable
273 # Locking control variable
275 self.thread_ready = threading.Condition()
274 self.thread_ready = threading.Condition()
276
275
277 # Stuff to do at closing time
276 # Stuff to do at closing time
278 self._kill = False
277 self._kill = False
279 on_kill = kw.get('on_kill')
278 on_kill = kw.get('on_kill')
280 if on_kill is None:
279 if on_kill is None:
281 on_kill = []
280 on_kill = []
282 # Check that all things to kill are callable:
281 # Check that all things to kill are callable:
283 for t in on_kill:
282 for t in on_kill:
284 if not callable(t):
283 if not callable(t):
285 raise TypeError,'on_kill must be a list of callables'
284 raise TypeError,'on_kill must be a list of callables'
286 self.on_kill = on_kill
285 self.on_kill = on_kill
287
286
288 def runsource(self, source, filename="<input>", symbol="single"):
287 def runsource(self, source, filename="<input>", symbol="single"):
289 """Compile and run some source in the interpreter.
288 """Compile and run some source in the interpreter.
290
289
291 Modified version of code.py's runsource(), to handle threading issues.
290 Modified version of code.py's runsource(), to handle threading issues.
292 See the original for full docstring details."""
291 See the original for full docstring details."""
293
292
294 global KBINT
293 global KBINT
295
294
296 # If Ctrl-C was typed, we reset the flag and return right away
295 # If Ctrl-C was typed, we reset the flag and return right away
297 if KBINT:
296 if KBINT:
298 KBINT = False
297 KBINT = False
299 return False
298 return False
300
299
301 try:
300 try:
302 code = self.compile(source, filename, symbol)
301 code = self.compile(source, filename, symbol)
303 except (OverflowError, SyntaxError, ValueError):
302 except (OverflowError, SyntaxError, ValueError):
304 # Case 1
303 # Case 1
305 self.showsyntaxerror(filename)
304 self.showsyntaxerror(filename)
306 return False
305 return False
307
306
308 if code is None:
307 if code is None:
309 # Case 2
308 # Case 2
310 return True
309 return True
311
310
312 # Case 3
311 # Case 3
313 # Store code in self, so the execution thread can handle it
312 # Store code in self, so the execution thread can handle it
314 self.thread_ready.acquire()
313 self.thread_ready.acquire()
315 self.code_to_run = code
314 self.code_to_run = code
316 self.thread_ready.wait() # Wait until processed in timeout interval
315 self.thread_ready.wait() # Wait until processed in timeout interval
317 self.thread_ready.release()
316 self.thread_ready.release()
318
317
319 return False
318 return False
320
319
321 def runcode(self):
320 def runcode(self):
322 """Execute a code object.
321 """Execute a code object.
323
322
324 Multithreaded wrapper around IPython's runcode()."""
323 Multithreaded wrapper around IPython's runcode()."""
325
324
326 # lock thread-protected stuff
325 # lock thread-protected stuff
327 self.thread_ready.acquire()
326 self.thread_ready.acquire()
328
327
329 # Install sigint handler
328 # Install sigint handler
330 try:
329 try:
331 signal.signal(signal.SIGINT, sigint_handler)
330 signal.signal(signal.SIGINT, sigint_handler)
332 except SystemError:
331 except SystemError:
333 # This happens under Windows, which seems to have all sorts
332 # This happens under Windows, which seems to have all sorts
334 # of problems with signal handling. Oh well...
333 # of problems with signal handling. Oh well...
335 pass
334 pass
336
335
337 if self._kill:
336 if self._kill:
338 print >>Term.cout, 'Closing threads...',
337 print >>Term.cout, 'Closing threads...',
339 Term.cout.flush()
338 Term.cout.flush()
340 for tokill in self.on_kill:
339 for tokill in self.on_kill:
341 tokill()
340 tokill()
342 print >>Term.cout, 'Done.'
341 print >>Term.cout, 'Done.'
343
342
344 # Run pending code by calling parent class
343 # Run pending code by calling parent class
345 if self.code_to_run is not None:
344 if self.code_to_run is not None:
346 self.thread_ready.notify()
345 self.thread_ready.notify()
347 InteractiveShell.runcode(self,self.code_to_run)
346 InteractiveShell.runcode(self,self.code_to_run)
348
347
349 # We're done with thread-protected variables
348 # We're done with thread-protected variables
350 self.thread_ready.release()
349 self.thread_ready.release()
351 # This MUST return true for gtk threading to work
350 # This MUST return true for gtk threading to work
352 return True
351 return True
353
352
354 def kill (self):
353 def kill (self):
355 """Kill the thread, returning when it has been shut down."""
354 """Kill the thread, returning when it has been shut down."""
356 self.thread_ready.acquire()
355 self.thread_ready.acquire()
357 self._kill = True
356 self._kill = True
358 self.thread_ready.release()
357 self.thread_ready.release()
359
358
360 class MatplotlibShellBase:
359 class MatplotlibShellBase:
361 """Mixin class to provide the necessary modifications to regular IPython
360 """Mixin class to provide the necessary modifications to regular IPython
362 shell classes for matplotlib support.
361 shell classes for matplotlib support.
363
362
364 Given Python's MRO, this should be used as the FIRST class in the
363 Given Python's MRO, this should be used as the FIRST class in the
365 inheritance hierarchy, so that it overrides the relevant methods."""
364 inheritance hierarchy, so that it overrides the relevant methods."""
366
365
367 def _matplotlib_config(self,name):
366 def _matplotlib_config(self,name):
368 """Return various items needed to setup the user's shell with matplotlib"""
367 """Return various items needed to setup the user's shell with matplotlib"""
369
368
370 # Initialize matplotlib to interactive mode always
369 # Initialize matplotlib to interactive mode always
371 import matplotlib
370 import matplotlib
372 from matplotlib import backends
371 from matplotlib import backends
373 matplotlib.interactive(True)
372 matplotlib.interactive(True)
374
373
375 def use(arg):
374 def use(arg):
376 """IPython wrapper for matplotlib's backend switcher.
375 """IPython wrapper for matplotlib's backend switcher.
377
376
378 In interactive use, we can not allow switching to a different
377 In interactive use, we can not allow switching to a different
379 interactive backend, since thread conflicts will most likely crash
378 interactive backend, since thread conflicts will most likely crash
380 the python interpreter. This routine does a safety check first,
379 the python interpreter. This routine does a safety check first,
381 and refuses to perform a dangerous switch. It still allows
380 and refuses to perform a dangerous switch. It still allows
382 switching to non-interactive backends."""
381 switching to non-interactive backends."""
383
382
384 if arg in backends.interactive_bk and arg != self.mpl_backend:
383 if arg in backends.interactive_bk and arg != self.mpl_backend:
385 m=('invalid matplotlib backend switch.\n'
384 m=('invalid matplotlib backend switch.\n'
386 'This script attempted to switch to the interactive '
385 'This script attempted to switch to the interactive '
387 'backend: `%s`\n'
386 'backend: `%s`\n'
388 'Your current choice of interactive backend is: `%s`\n\n'
387 'Your current choice of interactive backend is: `%s`\n\n'
389 'Switching interactive matplotlib backends at runtime\n'
388 'Switching interactive matplotlib backends at runtime\n'
390 'would crash the python interpreter, '
389 'would crash the python interpreter, '
391 'and IPython has blocked it.\n\n'
390 'and IPython has blocked it.\n\n'
392 'You need to either change your choice of matplotlib backend\n'
391 'You need to either change your choice of matplotlib backend\n'
393 'by editing your .matplotlibrc file, or run this script as a \n'
392 'by editing your .matplotlibrc file, or run this script as a \n'
394 'standalone file from the command line, not using IPython.\n' %
393 'standalone file from the command line, not using IPython.\n' %
395 (arg,self.mpl_backend) )
394 (arg,self.mpl_backend) )
396 raise RuntimeError, m
395 raise RuntimeError, m
397 else:
396 else:
398 self.mpl_use(arg)
397 self.mpl_use(arg)
399 self.mpl_use._called = True
398 self.mpl_use._called = True
400
399
401 self.matplotlib = matplotlib
400 self.matplotlib = matplotlib
402 self.mpl_backend = matplotlib.rcParams['backend']
401 self.mpl_backend = matplotlib.rcParams['backend']
403
402
404 # we also need to block switching of interactive backends by use()
403 # we also need to block switching of interactive backends by use()
405 self.mpl_use = matplotlib.use
404 self.mpl_use = matplotlib.use
406 self.mpl_use._called = False
405 self.mpl_use._called = False
407 # overwrite the original matplotlib.use with our wrapper
406 # overwrite the original matplotlib.use with our wrapper
408 matplotlib.use = use
407 matplotlib.use = use
409
408
410
409
411 # This must be imported last in the matplotlib series, after
410 # This must be imported last in the matplotlib series, after
412 # backend/interactivity choices have been made
411 # backend/interactivity choices have been made
413 try:
412 try:
414 import matplotlib.pylab as pylab
413 import matplotlib.pylab as pylab
415 self.pylab = pylab
414 self.pylab = pylab
416 self.pylab_name = 'pylab'
415 self.pylab_name = 'pylab'
417 except ImportError:
416 except ImportError:
418 import matplotlib.matlab as matlab
417 import matplotlib.matlab as matlab
419 self.pylab = matlab
418 self.pylab = matlab
420 self.pylab_name = 'matlab'
419 self.pylab_name = 'matlab'
421
420
422 self.pylab.show._needmain = False
421 self.pylab.show._needmain = False
423 # We need to detect at runtime whether show() is called by the user.
422 # 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.
423 # 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)
424 self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive)
426
425
427 # Build a user namespace initialized with matplotlib/matlab features.
426 # Build a user namespace initialized with matplotlib/matlab features.
428 user_ns = {'__name__':'__main__',
427 user_ns = {'__name__':'__main__',
429 '__builtins__' : __builtin__ }
428 '__builtins__' : __builtin__ }
430
429
431 # Be careful not to remove the final \n in the code string below, or
430 # 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
431 # things will break badly with py22 (I think it's a python bug, 2.3 is
433 # OK).
432 # OK).
434 pname = self.pylab_name # Python can't interpolate dotted var names
433 pname = self.pylab_name # Python can't interpolate dotted var names
435 exec ("import matplotlib\n"
434 exec ("import matplotlib\n"
436 "import matplotlib.%(pname)s as %(pname)s\n"
435 "import matplotlib.%(pname)s as %(pname)s\n"
437 "from matplotlib.%(pname)s import *\n" % locals()) in user_ns
436 "from matplotlib.%(pname)s import *\n" % locals()) in user_ns
438
437
439 # Build matplotlib info banner
438 # Build matplotlib info banner
440 b="""
439 b="""
441 Welcome to pylab, a matplotlib-based Python environment.
440 Welcome to pylab, a matplotlib-based Python environment.
442 For more information, type 'help(pylab)'.
441 For more information, type 'help(pylab)'.
443 """
442 """
444 return user_ns,b
443 return user_ns,b
445
444
446 def mplot_exec(self,fname,*where,**kw):
445 def mplot_exec(self,fname,*where,**kw):
447 """Execute a matplotlib script.
446 """Execute a matplotlib script.
448
447
449 This is a call to execfile(), but wrapped in safeties to properly
448 This is a call to execfile(), but wrapped in safeties to properly
450 handle interactive rendering and backend switching."""
449 handle interactive rendering and backend switching."""
451
450
452 #print '*** Matplotlib runner ***' # dbg
451 #print '*** Matplotlib runner ***' # dbg
453 # turn off rendering until end of script
452 # turn off rendering until end of script
454 isInteractive = self.matplotlib.rcParams['interactive']
453 isInteractive = self.matplotlib.rcParams['interactive']
455 self.matplotlib.interactive(False)
454 self.matplotlib.interactive(False)
456 self.safe_execfile(fname,*where,**kw)
455 self.safe_execfile(fname,*where,**kw)
457 self.matplotlib.interactive(isInteractive)
456 self.matplotlib.interactive(isInteractive)
458 # make rendering call now, if the user tried to do it
457 # make rendering call now, if the user tried to do it
459 if self.pylab.draw_if_interactive.called:
458 if self.pylab.draw_if_interactive.called:
460 self.pylab.draw()
459 self.pylab.draw()
461 self.pylab.draw_if_interactive.called = False
460 self.pylab.draw_if_interactive.called = False
462
461
463 # if a backend switch was performed, reverse it now
462 # if a backend switch was performed, reverse it now
464 if self.mpl_use._called:
463 if self.mpl_use._called:
465 self.matplotlib.rcParams['backend'] = self.mpl_backend
464 self.matplotlib.rcParams['backend'] = self.mpl_backend
466
465
467 def magic_run(self,parameter_s=''):
466 def magic_run(self,parameter_s=''):
468 Magic.magic_run(self,parameter_s,runner=self.mplot_exec)
467 Magic.magic_run(self,parameter_s,runner=self.mplot_exec)
469
468
470 # Fix the docstring so users see the original as well
469 # Fix the docstring so users see the original as well
471 magic_run.__doc__ = "%s\n%s" % (Magic.magic_run.__doc__,
470 magic_run.__doc__ = "%s\n%s" % (Magic.magic_run.__doc__,
472 "\n *** Modified %run for Matplotlib,"
471 "\n *** Modified %run for Matplotlib,"
473 " with proper interactive handling ***")
472 " with proper interactive handling ***")
474
473
475 # Now we provide 2 versions of a matplotlib-aware IPython base shells, single
474 # 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*
475 # and multithreaded. Note that these are meant for internal use, the IPShell*
477 # classes below are the ones meant for public consumption.
476 # classes below are the ones meant for public consumption.
478
477
479 class MatplotlibShell(MatplotlibShellBase,InteractiveShell):
478 class MatplotlibShell(MatplotlibShellBase,InteractiveShell):
480 """Single-threaded shell with matplotlib support."""
479 """Single-threaded shell with matplotlib support."""
481
480
482 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
481 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
483 user_ns = None, **kw):
482 user_ns = None, **kw):
484 user_ns,b2 = self._matplotlib_config(name)
483 user_ns,b2 = self._matplotlib_config(name)
485 InteractiveShell.__init__(self,name,usage,rc,user_ns,banner2=b2,**kw)
484 InteractiveShell.__init__(self,name,usage,rc,user_ns,banner2=b2,**kw)
486
485
487 class MatplotlibMTShell(MatplotlibShellBase,MTInteractiveShell):
486 class MatplotlibMTShell(MatplotlibShellBase,MTInteractiveShell):
488 """Multi-threaded shell with matplotlib support."""
487 """Multi-threaded shell with matplotlib support."""
489
488
490 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
489 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
491 user_ns = None, **kw):
490 user_ns = None, **kw):
492 user_ns,b2 = self._matplotlib_config(name)
491 user_ns,b2 = self._matplotlib_config(name)
493 MTInteractiveShell.__init__(self,name,usage,rc,user_ns,banner2=b2,**kw)
492 MTInteractiveShell.__init__(self,name,usage,rc,user_ns,banner2=b2,**kw)
494
493
495 #-----------------------------------------------------------------------------
494 #-----------------------------------------------------------------------------
496 # Utility functions for the different GUI enabled IPShell* classes.
495 # Utility functions for the different GUI enabled IPShell* classes.
497
496
498 def get_tk():
497 def get_tk():
499 """Tries to import Tkinter and returns a withdrawn Tkinter root
498 """Tries to import Tkinter and returns a withdrawn Tkinter root
500 window. If Tkinter is already imported or not available, this
499 window. If Tkinter is already imported or not available, this
501 returns None. This function calls `hijack_tk` underneath.
500 returns None. This function calls `hijack_tk` underneath.
502 """
501 """
503 if not USE_TK or sys.modules.has_key('Tkinter'):
502 if not USE_TK or sys.modules.has_key('Tkinter'):
504 return None
503 return None
505 else:
504 else:
506 try:
505 try:
507 import Tkinter
506 import Tkinter
508 except ImportError:
507 except ImportError:
509 return None
508 return None
510 else:
509 else:
511 hijack_tk()
510 hijack_tk()
512 r = Tkinter.Tk()
511 r = Tkinter.Tk()
513 r.withdraw()
512 r.withdraw()
514 return r
513 return r
515
514
516 def hijack_tk():
515 def hijack_tk():
517 """Modifies Tkinter's mainloop with a dummy so when a module calls
516 """Modifies Tkinter's mainloop with a dummy so when a module calls
518 mainloop, it does not block.
517 mainloop, it does not block.
519
518
520 """
519 """
521 def misc_mainloop(self, n=0):
520 def misc_mainloop(self, n=0):
522 pass
521 pass
523 def tkinter_mainloop(n=0):
522 def tkinter_mainloop(n=0):
524 pass
523 pass
525
524
526 import Tkinter
525 import Tkinter
527 Tkinter.Misc.mainloop = misc_mainloop
526 Tkinter.Misc.mainloop = misc_mainloop
528 Tkinter.mainloop = tkinter_mainloop
527 Tkinter.mainloop = tkinter_mainloop
529
528
530 def update_tk(tk):
529 def update_tk(tk):
531 """Updates the Tkinter event loop. This is typically called from
530 """Updates the Tkinter event loop. This is typically called from
532 the respective WX or GTK mainloops.
531 the respective WX or GTK mainloops.
533 """
532 """
534 if tk:
533 if tk:
535 tk.update()
534 tk.update()
536
535
537 def hijack_wx():
536 def hijack_wx():
538 """Modifies wxPython's MainLoop with a dummy so user code does not
537 """Modifies wxPython's MainLoop with a dummy so user code does not
539 block IPython. The hijacked mainloop function is returned.
538 block IPython. The hijacked mainloop function is returned.
540 """
539 """
541 def dummy_mainloop(*args, **kw):
540 def dummy_mainloop(*args, **kw):
542 pass
541 pass
543 import wxPython
542 import wxPython
544 ver = wxPython.__version__
543 ver = wxPython.__version__
545 orig_mainloop = None
544 orig_mainloop = None
546 if ver[:3] >= '2.5':
545 if ver[:3] >= '2.5':
547 import wx
546 import wx
548 if hasattr(wx, '_core_'): core = getattr(wx, '_core_')
547 if hasattr(wx, '_core_'): core = getattr(wx, '_core_')
549 elif hasattr(wx, '_core'): core = getattr(wx, '_core')
548 elif hasattr(wx, '_core'): core = getattr(wx, '_core')
550 else: raise AttributeError('Could not find wx core module')
549 else: raise AttributeError('Could not find wx core module')
551 orig_mainloop = core.PyApp_MainLoop
550 orig_mainloop = core.PyApp_MainLoop
552 core.PyApp_MainLoop = dummy_mainloop
551 core.PyApp_MainLoop = dummy_mainloop
553 elif ver[:3] == '2.4':
552 elif ver[:3] == '2.4':
554 orig_mainloop = wxPython.wxc.wxPyApp_MainLoop
553 orig_mainloop = wxPython.wxc.wxPyApp_MainLoop
555 wxPython.wxc.wxPyApp_MainLoop = dummy_mainloop
554 wxPython.wxc.wxPyApp_MainLoop = dummy_mainloop
556 else:
555 else:
557 warn("Unable to find either wxPython version 2.4 or >= 2.5.")
556 warn("Unable to find either wxPython version 2.4 or >= 2.5.")
558 return orig_mainloop
557 return orig_mainloop
559
558
560 def hijack_gtk():
559 def hijack_gtk():
561 """Modifies pyGTK's mainloop with a dummy so user code does not
560 """Modifies pyGTK's mainloop with a dummy so user code does not
562 block IPython. This function returns the original `gtk.mainloop`
561 block IPython. This function returns the original `gtk.mainloop`
563 function that has been hijacked.
562 function that has been hijacked.
564 """
563 """
565 def dummy_mainloop(*args, **kw):
564 def dummy_mainloop(*args, **kw):
566 pass
565 pass
567 import gtk
566 import gtk
568 if gtk.pygtk_version >= (2,4,0): orig_mainloop = gtk.main
567 if gtk.pygtk_version >= (2,4,0): orig_mainloop = gtk.main
569 else: orig_mainloop = gtk.mainloop
568 else: orig_mainloop = gtk.mainloop
570 gtk.mainloop = dummy_mainloop
569 gtk.mainloop = dummy_mainloop
571 gtk.main = dummy_mainloop
570 gtk.main = dummy_mainloop
572 return orig_mainloop
571 return orig_mainloop
573
572
574 #-----------------------------------------------------------------------------
573 #-----------------------------------------------------------------------------
575 # The IPShell* classes below are the ones meant to be run by external code as
574 # The IPShell* classes below are the ones meant to be run by external code as
576 # IPython instances. Note that unless a specific threading strategy is
575 # IPython instances. Note that unless a specific threading strategy is
577 # desired, the factory function start() below should be used instead (it
576 # desired, the factory function start() below should be used instead (it
578 # selects the proper threaded class).
577 # selects the proper threaded class).
579
578
580 class IPShellGTK(threading.Thread):
579 class IPShellGTK(threading.Thread):
581 """Run a gtk mainloop() in a separate thread.
580 """Run a gtk mainloop() in a separate thread.
582
581
583 Python commands can be passed to the thread where they will be executed.
582 Python commands can be passed to the thread where they will be executed.
584 This is implemented by periodically checking for passed code using a
583 This is implemented by periodically checking for passed code using a
585 GTK timeout callback."""
584 GTK timeout callback."""
586
585
587 TIMEOUT = 100 # Millisecond interval between timeouts.
586 TIMEOUT = 100 # Millisecond interval between timeouts.
588
587
589 def __init__(self,argv=None,user_ns=None,debug=1,
588 def __init__(self,argv=None,user_ns=None,debug=1,
590 shell_class=MTInteractiveShell):
589 shell_class=MTInteractiveShell):
591
590
592 import gtk
591 import gtk
593
592
594 self.gtk = gtk
593 self.gtk = gtk
595 self.gtk_mainloop = hijack_gtk()
594 self.gtk_mainloop = hijack_gtk()
596
595
597 # Allows us to use both Tk and GTK.
596 # Allows us to use both Tk and GTK.
598 self.tk = get_tk()
597 self.tk = get_tk()
599
598
600 if gtk.pygtk_version >= (2,4,0): mainquit = self.gtk.main_quit
599 if gtk.pygtk_version >= (2,4,0): mainquit = self.gtk.main_quit
601 else: mainquit = self.gtk.mainquit
600 else: mainquit = self.gtk.mainquit
602
601
603 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
602 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
604 shell_class=shell_class,
603 shell_class=shell_class,
605 on_kill=[mainquit])
604 on_kill=[mainquit])
606 threading.Thread.__init__(self)
605 threading.Thread.__init__(self)
607
606
608 def run(self):
607 def run(self):
609 self.IP.mainloop()
608 self.IP.mainloop()
610 self.IP.kill()
609 self.IP.kill()
611
610
612 def mainloop(self):
611 def mainloop(self):
613
612
614 if self.gtk.pygtk_version >= (2,4,0):
613 if self.gtk.pygtk_version >= (2,4,0):
615 import gobject
614 import gobject
616 gobject.timeout_add(self.TIMEOUT, self.on_timer)
615 gobject.idle_add(self.on_timer)
617 else:
616 else:
618 self.gtk.timeout_add(self.TIMEOUT, self.on_timer)
617 self.gtk.idle_add(self.on_timer)
619
618
620 if sys.platform != 'win32':
619 if sys.platform != 'win32':
621 try:
620 try:
622 if self.gtk.gtk_version[0] >= 2:
621 if self.gtk.gtk_version[0] >= 2:
623 self.gtk.threads_init()
622 self.gtk.threads_init()
624 except AttributeError:
623 except AttributeError:
625 pass
624 pass
626 except RuntimeError:
625 except RuntimeError:
627 error('Your pyGTK likely has not been compiled with '
626 error('Your pyGTK likely has not been compiled with '
628 'threading support.\n'
627 'threading support.\n'
629 'The exception printout is below.\n'
628 'The exception printout is below.\n'
630 'You can either rebuild pyGTK with threads, or '
629 'You can either rebuild pyGTK with threads, or '
631 'try using \n'
630 'try using \n'
632 'matplotlib with a different backend (like Tk or WX).\n'
631 'matplotlib with a different backend (like Tk or WX).\n'
633 'Note that matplotlib will most likely not work in its '
632 'Note that matplotlib will most likely not work in its '
634 'current state!')
633 'current state!')
635 self.IP.InteractiveTB()
634 self.IP.InteractiveTB()
636 self.start()
635 self.start()
637 self.gtk.threads_enter()
636 self.gtk.threads_enter()
638 self.gtk_mainloop()
637 self.gtk_mainloop()
639 self.gtk.threads_leave()
638 self.gtk.threads_leave()
640 self.join()
639 self.join()
641
640
642 def on_timer(self):
641 def on_timer(self):
643 update_tk(self.tk)
642 update_tk(self.tk)
644 return self.IP.runcode()
643 return self.IP.runcode()
645
644
646
645
647 class IPShellWX(threading.Thread):
646 class IPShellWX(threading.Thread):
648 """Run a wx mainloop() in a separate thread.
647 """Run a wx mainloop() in a separate thread.
649
648
650 Python commands can be passed to the thread where they will be executed.
649 Python commands can be passed to the thread where they will be executed.
651 This is implemented by periodically checking for passed code using a
650 This is implemented by periodically checking for passed code using a
652 GTK timeout callback."""
651 GTK timeout callback."""
653
652
654 TIMEOUT = 100 # Millisecond interval between timeouts.
653 TIMEOUT = 100 # Millisecond interval between timeouts.
655
654
656 def __init__(self,argv=None,user_ns=None,debug=1,
655 def __init__(self,argv=None,user_ns=None,debug=1,
657 shell_class=MTInteractiveShell):
656 shell_class=MTInteractiveShell):
658
657
659 import wxPython.wx as wx
658 import wxPython.wx as wx
660
659
661 threading.Thread.__init__(self)
660 threading.Thread.__init__(self)
662 self.wx = wx
661 self.wx = wx
663 self.wx_mainloop = hijack_wx()
662 self.wx_mainloop = hijack_wx()
664
663
665 # Allows us to use both Tk and GTK.
664 # Allows us to use both Tk and GTK.
666 self.tk = get_tk()
665 self.tk = get_tk()
667
666
668 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
667 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
669 shell_class=shell_class,
668 shell_class=shell_class,
670 on_kill=[self.wxexit])
669 on_kill=[self.wxexit])
671 self.app = None
670 self.app = None
672
671
673 def wxexit(self, *args):
672 def wxexit(self, *args):
674 if self.app is not None:
673 if self.app is not None:
675 self.app.agent.timer.Stop()
674 self.app.agent.timer.Stop()
676 self.app.ExitMainLoop()
675 self.app.ExitMainLoop()
677
676
678 def run(self):
677 def run(self):
679 self.IP.mainloop()
678 self.IP.mainloop()
680 self.IP.kill()
679 self.IP.kill()
681
680
682 def mainloop(self):
681 def mainloop(self):
683
682
684 self.start()
683 self.start()
685
684
686 class TimerAgent(self.wx.wxMiniFrame):
685 class TimerAgent(self.wx.wxMiniFrame):
687 wx = self.wx
686 wx = self.wx
688 IP = self.IP
687 IP = self.IP
689 tk = self.tk
688 tk = self.tk
690 def __init__(self, parent, interval):
689 def __init__(self, parent, interval):
691 style = self.wx.wxDEFAULT_FRAME_STYLE | self.wx.wxTINY_CAPTION_HORIZ
690 style = self.wx.wxDEFAULT_FRAME_STYLE | self.wx.wxTINY_CAPTION_HORIZ
692 self.wx.wxMiniFrame.__init__(self, parent, -1, ' ', pos=(200, 200),
691 self.wx.wxMiniFrame.__init__(self, parent, -1, ' ', pos=(200, 200),
693 size=(100, 100),style=style)
692 size=(100, 100),style=style)
694 self.Show(False)
693 self.Show(False)
695 self.interval = interval
694 self.interval = interval
696 self.timerId = self.wx.wxNewId()
695 self.timerId = self.wx.wxNewId()
697
696
698 def StartWork(self):
697 def StartWork(self):
699 self.timer = self.wx.wxTimer(self, self.timerId)
698 self.timer = self.wx.wxTimer(self, self.timerId)
700 self.wx.EVT_TIMER(self, self.timerId, self.OnTimer)
699 self.wx.EVT_TIMER(self, self.timerId, self.OnTimer)
701 self.timer.Start(self.interval)
700 self.timer.Start(self.interval)
702
701
703 def OnTimer(self, event):
702 def OnTimer(self, event):
704 update_tk(self.tk)
703 update_tk(self.tk)
705 self.IP.runcode()
704 self.IP.runcode()
706
705
707 class App(self.wx.wxApp):
706 class App(self.wx.wxApp):
708 wx = self.wx
707 wx = self.wx
709 TIMEOUT = self.TIMEOUT
708 TIMEOUT = self.TIMEOUT
710 def OnInit(self):
709 def OnInit(self):
711 'Create the main window and insert the custom frame'
710 'Create the main window and insert the custom frame'
712 self.agent = TimerAgent(None, self.TIMEOUT)
711 self.agent = TimerAgent(None, self.TIMEOUT)
713 self.agent.Show(self.wx.false)
712 self.agent.Show(self.wx.false)
714 self.agent.StartWork()
713 self.agent.StartWork()
715 return self.wx.true
714 return self.wx.true
716
715
717 self.app = App(redirect=False)
716 self.app = App(redirect=False)
718 self.wx_mainloop(self.app)
717 self.wx_mainloop(self.app)
719 self.join()
718 self.join()
720
719
721
720
722 class IPShellQt(threading.Thread):
721 class IPShellQt(threading.Thread):
723 """Run a Qt event loop in a separate thread.
722 """Run a Qt event loop in a separate thread.
724
723
725 Python commands can be passed to the thread where they will be executed.
724 Python commands can be passed to the thread where they will be executed.
726 This is implemented by periodically checking for passed code using a
725 This is implemented by periodically checking for passed code using a
727 Qt timer / slot."""
726 Qt timer / slot."""
728
727
729 TIMEOUT = 100 # Millisecond interval between timeouts.
728 TIMEOUT = 100 # Millisecond interval between timeouts.
730
729
731 def __init__(self,argv=None,user_ns=None,debug=0,
730 def __init__(self,argv=None,user_ns=None,debug=0,
732 shell_class=MTInteractiveShell):
731 shell_class=MTInteractiveShell):
733
732
734 import qt
733 import qt
735
734
736 class newQApplication:
735 class newQApplication:
737 def __init__( self ):
736 def __init__( self ):
738 self.QApplication = qt.QApplication
737 self.QApplication = qt.QApplication
739
738
740 def __call__( *args, **kwargs ):
739 def __call__( *args, **kwargs ):
741 return qt.qApp
740 return qt.qApp
742
741
743 def exec_loop( *args, **kwargs ):
742 def exec_loop( *args, **kwargs ):
744 pass
743 pass
745
744
746 def __getattr__( self, name ):
745 def __getattr__( self, name ):
747 return getattr( self.QApplication, name )
746 return getattr( self.QApplication, name )
748
747
749 qt.QApplication = newQApplication()
748 qt.QApplication = newQApplication()
750
749
751 # Allows us to use both Tk and QT.
750 # Allows us to use both Tk and QT.
752 self.tk = get_tk()
751 self.tk = get_tk()
753
752
754 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
753 self.IP = make_IPython(argv,user_ns=user_ns,debug=debug,
755 shell_class=shell_class,
754 shell_class=shell_class,
756 on_kill=[qt.qApp.exit])
755 on_kill=[qt.qApp.exit])
757
756
758 threading.Thread.__init__(self)
757 threading.Thread.__init__(self)
759
758
760 def run(self):
759 def run(self):
761 #sys.excepthook = self.IP.excepthook # dbg
760 #sys.excepthook = self.IP.excepthook # dbg
762 self.IP.mainloop()
761 self.IP.mainloop()
763 self.IP.kill()
762 self.IP.kill()
764
763
765 def mainloop(self):
764 def mainloop(self):
766 import qt, sys
765 import qt, sys
767 if qt.QApplication.startingUp():
766 if qt.QApplication.startingUp():
768 a = qt.QApplication.QApplication( sys.argv )
767 a = qt.QApplication.QApplication( sys.argv )
769 self.timer = qt.QTimer()
768 self.timer = qt.QTimer()
770 qt.QObject.connect( self.timer, qt.SIGNAL( 'timeout()' ), self.on_timer )
769 qt.QObject.connect( self.timer, qt.SIGNAL( 'timeout()' ), self.on_timer )
771
770
772 self.start()
771 self.start()
773 self.timer.start( self.TIMEOUT, True )
772 self.timer.start( self.TIMEOUT, True )
774 while True:
773 while True:
775 if self.IP._kill: break
774 if self.IP._kill: break
776 qt.qApp.exec_loop()
775 qt.qApp.exec_loop()
777 self.join()
776 self.join()
778
777
779 def on_timer(self):
778 def on_timer(self):
780 update_tk(self.tk)
779 update_tk(self.tk)
781 result = self.IP.runcode()
780 result = self.IP.runcode()
782 self.timer.start( self.TIMEOUT, True )
781 self.timer.start( self.TIMEOUT, True )
783 return result
782 return result
784
783
785 # A set of matplotlib public IPython shell classes, for single-threaded
784 # A set of matplotlib public IPython shell classes, for single-threaded
786 # (Tk* and FLTK* backends) and multithreaded (GTK* and WX* backends) use.
785 # (Tk* and FLTK* backends) and multithreaded (GTK* and WX* backends) use.
787 class IPShellMatplotlib(IPShell):
786 class IPShellMatplotlib(IPShell):
788 """Subclass IPShell with MatplotlibShell as the internal shell.
787 """Subclass IPShell with MatplotlibShell as the internal shell.
789
788
790 Single-threaded class, meant for the Tk* and FLTK* backends.
789 Single-threaded class, meant for the Tk* and FLTK* backends.
791
790
792 Having this on a separate class simplifies the external driver code."""
791 Having this on a separate class simplifies the external driver code."""
793
792
794 def __init__(self,argv=None,user_ns=None,debug=1):
793 def __init__(self,argv=None,user_ns=None,debug=1):
795 IPShell.__init__(self,argv,user_ns,debug,shell_class=MatplotlibShell)
794 IPShell.__init__(self,argv,user_ns,debug,shell_class=MatplotlibShell)
796
795
797 class IPShellMatplotlibGTK(IPShellGTK):
796 class IPShellMatplotlibGTK(IPShellGTK):
798 """Subclass IPShellGTK with MatplotlibMTShell as the internal shell.
797 """Subclass IPShellGTK with MatplotlibMTShell as the internal shell.
799
798
800 Multi-threaded class, meant for the GTK* backends."""
799 Multi-threaded class, meant for the GTK* backends."""
801
800
802 def __init__(self,argv=None,user_ns=None,debug=1):
801 def __init__(self,argv=None,user_ns=None,debug=1):
803 IPShellGTK.__init__(self,argv,user_ns,debug,shell_class=MatplotlibMTShell)
802 IPShellGTK.__init__(self,argv,user_ns,debug,shell_class=MatplotlibMTShell)
804
803
805 class IPShellMatplotlibWX(IPShellWX):
804 class IPShellMatplotlibWX(IPShellWX):
806 """Subclass IPShellWX with MatplotlibMTShell as the internal shell.
805 """Subclass IPShellWX with MatplotlibMTShell as the internal shell.
807
806
808 Multi-threaded class, meant for the WX* backends."""
807 Multi-threaded class, meant for the WX* backends."""
809
808
810 def __init__(self,argv=None,user_ns=None,debug=1):
809 def __init__(self,argv=None,user_ns=None,debug=1):
811 IPShellWX.__init__(self,argv,user_ns,debug,shell_class=MatplotlibMTShell)
810 IPShellWX.__init__(self,argv,user_ns,debug,shell_class=MatplotlibMTShell)
812
811
813 class IPShellMatplotlibQt(IPShellQt):
812 class IPShellMatplotlibQt(IPShellQt):
814 """Subclass IPShellQt with MatplotlibMTShell as the internal shell.
813 """Subclass IPShellQt with MatplotlibMTShell as the internal shell.
815
814
816 Multi-threaded class, meant for the Qt* backends."""
815 Multi-threaded class, meant for the Qt* backends."""
817
816
818 def __init__(self,argv=None,user_ns=None,debug=1):
817 def __init__(self,argv=None,user_ns=None,debug=1):
819 IPShellQt.__init__(self,argv,user_ns,debug,shell_class=MatplotlibMTShell)
818 IPShellQt.__init__(self,argv,user_ns,debug,shell_class=MatplotlibMTShell)
820
819
821 #-----------------------------------------------------------------------------
820 #-----------------------------------------------------------------------------
822 # Factory functions to actually start the proper thread-aware shell
821 # Factory functions to actually start the proper thread-aware shell
823
822
824 def _matplotlib_shell_class():
823 def _matplotlib_shell_class():
825 """Factory function to handle shell class selection for matplotlib.
824 """Factory function to handle shell class selection for matplotlib.
826
825
827 The proper shell class to use depends on the matplotlib backend, since
826 The proper shell class to use depends on the matplotlib backend, since
828 each backend requires a different threading strategy."""
827 each backend requires a different threading strategy."""
829
828
830 try:
829 try:
831 import matplotlib
830 import matplotlib
832 except ImportError:
831 except ImportError:
833 error('matplotlib could NOT be imported! Starting normal IPython.')
832 error('matplotlib could NOT be imported! Starting normal IPython.')
834 sh_class = IPShell
833 sh_class = IPShell
835 else:
834 else:
836 backend = matplotlib.rcParams['backend']
835 backend = matplotlib.rcParams['backend']
837 if backend.startswith('GTK'):
836 if backend.startswith('GTK'):
838 sh_class = IPShellMatplotlibGTK
837 sh_class = IPShellMatplotlibGTK
839 elif backend.startswith('WX'):
838 elif backend.startswith('WX'):
840 sh_class = IPShellMatplotlibWX
839 sh_class = IPShellMatplotlibWX
841 elif backend.startswith('Qt'):
840 elif backend.startswith('Qt'):
842 sh_class = IPShellMatplotlibQt
841 sh_class = IPShellMatplotlibQt
843 else:
842 else:
844 sh_class = IPShellMatplotlib
843 sh_class = IPShellMatplotlib
845 #print 'Using %s with the %s backend.' % (sh_class,backend) # dbg
844 #print 'Using %s with the %s backend.' % (sh_class,backend) # dbg
846 return sh_class
845 return sh_class
847
846
848 # This is the one which should be called by external code.
847 # This is the one which should be called by external code.
849 def start():
848 def start():
850 """Return a running shell instance, dealing with threading options.
849 """Return a running shell instance, dealing with threading options.
851
850
852 This is a factory function which will instantiate the proper IPython shell
851 This is a factory function which will instantiate the proper IPython shell
853 based on the user's threading choice. Such a selector is needed because
852 based on the user's threading choice. Such a selector is needed because
854 different GUI toolkits require different thread handling details."""
853 different GUI toolkits require different thread handling details."""
855
854
856 global USE_TK
855 global USE_TK
857 # Crude sys.argv hack to extract the threading options.
856 # Crude sys.argv hack to extract the threading options.
858 if len(sys.argv) > 1:
857 if len(sys.argv) > 1:
859 if len(sys.argv) > 2:
858 if len(sys.argv) > 2:
860 arg2 = sys.argv[2]
859 arg2 = sys.argv[2]
861 if arg2.endswith('-tk'):
860 if arg2.endswith('-tk'):
862 USE_TK = True
861 USE_TK = True
863 arg1 = sys.argv[1]
862 arg1 = sys.argv[1]
864 if arg1.endswith('-gthread'):
863 if arg1.endswith('-gthread'):
865 shell = IPShellGTK
864 shell = IPShellGTK
866 elif arg1.endswith( '-qthread' ):
865 elif arg1.endswith( '-qthread' ):
867 shell = IPShellQt
866 shell = IPShellQt
868 elif arg1.endswith('-wthread'):
867 elif arg1.endswith('-wthread'):
869 shell = IPShellWX
868 shell = IPShellWX
870 elif arg1.endswith('-pylab'):
869 elif arg1.endswith('-pylab'):
871 shell = _matplotlib_shell_class()
870 shell = _matplotlib_shell_class()
872 else:
871 else:
873 shell = IPShell
872 shell = IPShell
874 else:
873 else:
875 shell = IPShell
874 shell = IPShell
876 return shell()
875 return shell()
877
876
878 # Some aliases for backwards compatibility
877 # Some aliases for backwards compatibility
879 IPythonShell = IPShell
878 IPythonShell = IPShell
880 IPythonShellEmbed = IPShellEmbed
879 IPythonShellEmbed = IPShellEmbed
881 #************************ End of file <Shell.py> ***************************
880 #************************ End of file <Shell.py> ***************************
@@ -1,2052 +1,2062 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 908 2005-09-26 16:05:48Z fperez $
9 $Id: iplib.py 921 2005-11-13 06:51:34Z 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-2004 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2004 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, much of that class has been copied
20 # Python standard library. Over time, much 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. The Python License (sec. 2) allows for this, but it's always
22 # subclassing. The Python License (sec. 2) allows for this, but it's always
23 # nice to acknowledge credit where credit is due.
23 # nice to acknowledge credit where credit is due.
24 #*****************************************************************************
24 #*****************************************************************************
25
25
26 #****************************************************************************
26 #****************************************************************************
27 # Modules and globals
27 # Modules and globals
28
28
29 from __future__ import generators # for 2.2 backwards-compatibility
29 from __future__ import generators # for 2.2 backwards-compatibility
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import exceptions
40 import exceptions
41 import keyword
41 import keyword
42 import new
42 import new
43 import os, sys, shutil
43 import os, sys, shutil
44 import code, glob, types, re
44 import code, glob, types, re
45 import string, StringIO
45 import string, StringIO
46 import inspect, pydoc
46 import inspect, pydoc
47 import bdb, pdb
47 import bdb, pdb
48 import UserList # don't subclass list so this works with Python2.1
48 import UserList # don't subclass list so this works with Python2.1
49 from pprint import pprint, pformat
49 from pprint import pprint, pformat
50 import cPickle as pickle
50 import cPickle as pickle
51 import traceback
51 import traceback
52 from codeop import CommandCompiler
52
53
53 # IPython's own modules
54 # IPython's own modules
54 import IPython
55 import IPython
55 from IPython import OInspect,PyColorize,ultraTB
56 from IPython import OInspect,PyColorize,ultraTB
56 from IPython.ultraTB import ColorScheme,ColorSchemeTable # too long names
57 from IPython.ultraTB import ColorScheme,ColorSchemeTable # too long names
57 from IPython.Logger import Logger
58 from IPython.Logger import Logger
58 from IPython.Magic import Magic,magic2python,shlex_split
59 from IPython.Magic import Magic,magic2python,shlex_split
59 from IPython.usage import cmd_line_usage,interactive_usage
60 from IPython.usage import cmd_line_usage,interactive_usage
60 from IPython.Struct import Struct
61 from IPython.Struct import Struct
61 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
62 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
62 from IPython.FakeModule import FakeModule
63 from IPython.FakeModule import FakeModule
63 from IPython.background_jobs import BackgroundJobManager
64 from IPython.background_jobs import BackgroundJobManager
64 from IPython.PyColorize import Parser
65 from IPython.PyColorize import Parser
65 from IPython.genutils import *
66 from IPython.genutils import *
66
67
67 # Global pointer to the running
68 # Global pointer to the running
68
69
69 # store the builtin raw_input globally, and use this always, in case user code
70 # store the builtin raw_input globally, and use this always, in case user code
70 # overwrites it (like wx.py.PyShell does)
71 # overwrites it (like wx.py.PyShell does)
71 raw_input_original = raw_input
72 raw_input_original = raw_input
72
73
73 #****************************************************************************
74 #****************************************************************************
74 # Some utility function definitions
75 # Some utility function definitions
75
76
76 class Bunch: pass
77 class Bunch: pass
77
78
78 def esc_quotes(strng):
79 def esc_quotes(strng):
79 """Return the input string with single and double quotes escaped out"""
80 """Return the input string with single and double quotes escaped out"""
80
81
81 return strng.replace('"','\\"').replace("'","\\'")
82 return strng.replace('"','\\"').replace("'","\\'")
82
83
83 def import_fail_info(mod_name,fns=None):
84 def import_fail_info(mod_name,fns=None):
84 """Inform load failure for a module."""
85 """Inform load failure for a module."""
85
86
86 if fns == None:
87 if fns == None:
87 warn("Loading of %s failed.\n" % (mod_name,))
88 warn("Loading of %s failed.\n" % (mod_name,))
88 else:
89 else:
89 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
90 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
90
91
91 def qw_lol(indata):
92 def qw_lol(indata):
92 """qw_lol('a b') -> [['a','b']],
93 """qw_lol('a b') -> [['a','b']],
93 otherwise it's just a call to qw().
94 otherwise it's just a call to qw().
94
95
95 We need this to make sure the modules_some keys *always* end up as a
96 We need this to make sure the modules_some keys *always* end up as a
96 list of lists."""
97 list of lists."""
97
98
98 if type(indata) in StringTypes:
99 if type(indata) in StringTypes:
99 return [qw(indata)]
100 return [qw(indata)]
100 else:
101 else:
101 return qw(indata)
102 return qw(indata)
102
103
103 def ipmagic(arg_s):
104 def ipmagic(arg_s):
104 """Call a magic function by name.
105 """Call a magic function by name.
105
106
106 Input: a string containing the name of the magic function to call and any
107 Input: a string containing the name of the magic function to call and any
107 additional arguments to be passed to the magic.
108 additional arguments to be passed to the magic.
108
109
109 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
110 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
110 prompt:
111 prompt:
111
112
112 In[1]: %name -opt foo bar
113 In[1]: %name -opt foo bar
113
114
114 To call a magic without arguments, simply use ipmagic('name').
115 To call a magic without arguments, simply use ipmagic('name').
115
116
116 This provides a proper Python function to call IPython's magics in any
117 This provides a proper Python function to call IPython's magics in any
117 valid Python code you can type at the interpreter, including loops and
118 valid Python code you can type at the interpreter, including loops and
118 compound statements. It is added by IPython to the Python builtin
119 compound statements. It is added by IPython to the Python builtin
119 namespace upon initialization."""
120 namespace upon initialization."""
120
121
121 args = arg_s.split(' ',1)
122 args = arg_s.split(' ',1)
122 magic_name = args[0]
123 magic_name = args[0]
123 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
124 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
124 magic_name = magic_name[1:]
125 magic_name = magic_name[1:]
125 try:
126 try:
126 magic_args = args[1]
127 magic_args = args[1]
127 except IndexError:
128 except IndexError:
128 magic_args = ''
129 magic_args = ''
129 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
130 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
130 if fn is None:
131 if fn is None:
131 error("Magic function `%s` not found." % magic_name)
132 error("Magic function `%s` not found." % magic_name)
132 else:
133 else:
133 magic_args = __IPYTHON__.var_expand(magic_args)
134 magic_args = __IPYTHON__.var_expand(magic_args)
134 return fn(magic_args)
135 return fn(magic_args)
135
136
136 def ipalias(arg_s):
137 def ipalias(arg_s):
137 """Call an alias by name.
138 """Call an alias by name.
138
139
139 Input: a string containing the name of the alias to call and any
140 Input: a string containing the name of the alias to call and any
140 additional arguments to be passed to the magic.
141 additional arguments to be passed to the magic.
141
142
142 ipalias('name -opt foo bar') is equivalent to typing at the ipython
143 ipalias('name -opt foo bar') is equivalent to typing at the ipython
143 prompt:
144 prompt:
144
145
145 In[1]: name -opt foo bar
146 In[1]: name -opt foo bar
146
147
147 To call an alias without arguments, simply use ipalias('name').
148 To call an alias without arguments, simply use ipalias('name').
148
149
149 This provides a proper Python function to call IPython's aliases in any
150 This provides a proper Python function to call IPython's aliases in any
150 valid Python code you can type at the interpreter, including loops and
151 valid Python code you can type at the interpreter, including loops and
151 compound statements. It is added by IPython to the Python builtin
152 compound statements. It is added by IPython to the Python builtin
152 namespace upon initialization."""
153 namespace upon initialization."""
153
154
154 args = arg_s.split(' ',1)
155 args = arg_s.split(' ',1)
155 alias_name = args[0]
156 alias_name = args[0]
156 try:
157 try:
157 alias_args = args[1]
158 alias_args = args[1]
158 except IndexError:
159 except IndexError:
159 alias_args = ''
160 alias_args = ''
160 if alias_name in __IPYTHON__.alias_table:
161 if alias_name in __IPYTHON__.alias_table:
161 __IPYTHON__.call_alias(alias_name,alias_args)
162 __IPYTHON__.call_alias(alias_name,alias_args)
162 else:
163 else:
163 error("Alias `%s` not found." % alias_name)
164 error("Alias `%s` not found." % alias_name)
164
165
165 #-----------------------------------------------------------------------------
166 #-----------------------------------------------------------------------------
166 # Local use classes
167 # Local use classes
167 try:
168 try:
168 from IPython import FlexCompleter
169 from IPython import FlexCompleter
169
170
170 class MagicCompleter(FlexCompleter.Completer):
171 class MagicCompleter(FlexCompleter.Completer):
171 """Extension of the completer class to work on %-prefixed lines."""
172 """Extension of the completer class to work on %-prefixed lines."""
172
173
173 def __init__(self,shell,namespace=None,omit__names=0,alias_table=None):
174 def __init__(self,shell,namespace=None,omit__names=0,alias_table=None):
174 """MagicCompleter() -> completer
175 """MagicCompleter() -> completer
175
176
176 Return a completer object suitable for use by the readline library
177 Return a completer object suitable for use by the readline library
177 via readline.set_completer().
178 via readline.set_completer().
178
179
179 Inputs:
180 Inputs:
180
181
181 - shell: a pointer to the ipython shell itself. This is needed
182 - shell: a pointer to the ipython shell itself. This is needed
182 because this completer knows about magic functions, and those can
183 because this completer knows about magic functions, and those can
183 only be accessed via the ipython instance.
184 only be accessed via the ipython instance.
184
185
185 - namespace: an optional dict where completions are performed.
186 - namespace: an optional dict where completions are performed.
186
187
187 - The optional omit__names parameter sets the completer to omit the
188 - The optional omit__names parameter sets the completer to omit the
188 'magic' names (__magicname__) for python objects unless the text
189 'magic' names (__magicname__) for python objects unless the text
189 to be completed explicitly starts with one or more underscores.
190 to be completed explicitly starts with one or more underscores.
190
191
191 - If alias_table is supplied, it should be a dictionary of aliases
192 - If alias_table is supplied, it should be a dictionary of aliases
192 to complete. """
193 to complete. """
193
194
194 FlexCompleter.Completer.__init__(self,namespace)
195 FlexCompleter.Completer.__init__(self,namespace)
195 self.magic_prefix = shell.name+'.magic_'
196 self.magic_prefix = shell.name+'.magic_'
196 self.magic_escape = shell.ESC_MAGIC
197 self.magic_escape = shell.ESC_MAGIC
197 self.readline = FlexCompleter.readline
198 self.readline = FlexCompleter.readline
198 delims = self.readline.get_completer_delims()
199 delims = self.readline.get_completer_delims()
199 delims = delims.replace(self.magic_escape,'')
200 delims = delims.replace(self.magic_escape,'')
200 self.readline.set_completer_delims(delims)
201 self.readline.set_completer_delims(delims)
201 self.get_line_buffer = self.readline.get_line_buffer
202 self.get_line_buffer = self.readline.get_line_buffer
202 self.omit__names = omit__names
203 self.omit__names = omit__names
203 self.merge_completions = shell.rc.readline_merge_completions
204 self.merge_completions = shell.rc.readline_merge_completions
204
205
205 if alias_table is None:
206 if alias_table is None:
206 alias_table = {}
207 alias_table = {}
207 self.alias_table = alias_table
208 self.alias_table = alias_table
208 # Regexp to split filenames with spaces in them
209 # Regexp to split filenames with spaces in them
209 self.space_name_re = re.compile(r'([^\\] )')
210 self.space_name_re = re.compile(r'([^\\] )')
210 # Hold a local ref. to glob.glob for speed
211 # Hold a local ref. to glob.glob for speed
211 self.glob = glob.glob
212 self.glob = glob.glob
212 # Special handling of backslashes needed in win32 platforms
213 # Special handling of backslashes needed in win32 platforms
213 if sys.platform == "win32":
214 if sys.platform == "win32":
214 self.clean_glob = self._clean_glob_win32
215 self.clean_glob = self._clean_glob_win32
215 else:
216 else:
216 self.clean_glob = self._clean_glob
217 self.clean_glob = self._clean_glob
217 self.matchers = [self.python_matches,
218 self.matchers = [self.python_matches,
218 self.file_matches,
219 self.file_matches,
219 self.alias_matches,
220 self.alias_matches,
220 self.python_func_kw_matches]
221 self.python_func_kw_matches]
221
222
222 # Code contributed by Alex Schmolck, for ipython/emacs integration
223 # Code contributed by Alex Schmolck, for ipython/emacs integration
223 def all_completions(self, text):
224 def all_completions(self, text):
224 """Return all possible completions for the benefit of emacs."""
225 """Return all possible completions for the benefit of emacs."""
225
226
226 completions = []
227 completions = []
227 try:
228 try:
228 for i in xrange(sys.maxint):
229 for i in xrange(sys.maxint):
229 res = self.complete(text, i)
230 res = self.complete(text, i)
230
231
231 if not res: break
232 if not res: break
232
233
233 completions.append(res)
234 completions.append(res)
234 #XXX workaround for ``notDefined.<tab>``
235 #XXX workaround for ``notDefined.<tab>``
235 except NameError:
236 except NameError:
236 pass
237 pass
237 return completions
238 return completions
238 # /end Alex Schmolck code.
239 # /end Alex Schmolck code.
239
240
240 def _clean_glob(self,text):
241 def _clean_glob(self,text):
241 return self.glob("%s*" % text)
242 return self.glob("%s*" % text)
242
243
243 def _clean_glob_win32(self,text):
244 def _clean_glob_win32(self,text):
244 return [f.replace("\\","/")
245 return [f.replace("\\","/")
245 for f in self.glob("%s*" % text)]
246 for f in self.glob("%s*" % text)]
246
247
247 def file_matches(self, text):
248 def file_matches(self, text):
248 """Match filneames, expanding ~USER type strings.
249 """Match filneames, expanding ~USER type strings.
249
250
250 Most of the seemingly convoluted logic in this completer is an
251 Most of the seemingly convoluted logic in this completer is an
251 attempt to handle filenames with spaces in them. And yet it's not
252 attempt to handle filenames with spaces in them. And yet it's not
252 quite perfect, because Python's readline doesn't expose all of the
253 quite perfect, because Python's readline doesn't expose all of the
253 GNU readline details needed for this to be done correctly.
254 GNU readline details needed for this to be done correctly.
254
255
255 For a filename with a space in it, the printed completions will be
256 For a filename with a space in it, the printed completions will be
256 only the parts after what's already been typed (instead of the
257 only the parts after what's already been typed (instead of the
257 full completions, as is normally done). I don't think with the
258 full completions, as is normally done). I don't think with the
258 current (as of Python 2.3) Python readline it's possible to do
259 current (as of Python 2.3) Python readline it's possible to do
259 better."""
260 better."""
260
261
261 #print 'Completer->file_matches: <%s>' % text # dbg
262 #print 'Completer->file_matches: <%s>' % text # dbg
262
263
263 # chars that require escaping with backslash - i.e. chars
264 # chars that require escaping with backslash - i.e. chars
264 # that readline treats incorrectly as delimiters, but we
265 # that readline treats incorrectly as delimiters, but we
265 # don't want to treat as delimiters in filename matching
266 # don't want to treat as delimiters in filename matching
266 # when escaped with backslash
267 # when escaped with backslash
267
268
268 protectables = ' ()[]{}'
269 protectables = ' ()[]{}'
269
270
270 def protect_filename(s):
271 def protect_filename(s):
271 return "".join([(ch in protectables and '\\' + ch or ch)
272 return "".join([(ch in protectables and '\\' + ch or ch)
272 for ch in s])
273 for ch in s])
273
274
274 lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
275 lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
275 open_quotes = 0 # track strings with open quotes
276 open_quotes = 0 # track strings with open quotes
276 try:
277 try:
277 lsplit = shlex_split(lbuf)[-1]
278 lsplit = shlex_split(lbuf)[-1]
278 except ValueError:
279 except ValueError:
279 # typically an unmatched ", or backslash without escaped char.
280 # typically an unmatched ", or backslash without escaped char.
280 if lbuf.count('"')==1:
281 if lbuf.count('"')==1:
281 open_quotes = 1
282 open_quotes = 1
282 lsplit = lbuf.split('"')[-1]
283 lsplit = lbuf.split('"')[-1]
283 elif lbuf.count("'")==1:
284 elif lbuf.count("'")==1:
284 open_quotes = 1
285 open_quotes = 1
285 lsplit = lbuf.split("'")[-1]
286 lsplit = lbuf.split("'")[-1]
286 else:
287 else:
287 return None
288 return None
288 except IndexError:
289 except IndexError:
289 # tab pressed on empty line
290 # tab pressed on empty line
290 lsplit = ""
291 lsplit = ""
291
292
292 if lsplit != protect_filename(lsplit):
293 if lsplit != protect_filename(lsplit):
293 # if protectables are found, do matching on the whole escaped
294 # if protectables are found, do matching on the whole escaped
294 # name
295 # name
295 has_protectables = 1
296 has_protectables = 1
296 text0,text = text,lsplit
297 text0,text = text,lsplit
297 else:
298 else:
298 has_protectables = 0
299 has_protectables = 0
299 text = os.path.expanduser(text)
300 text = os.path.expanduser(text)
300
301
301 if text == "":
302 if text == "":
302 return [protect_filename(f) for f in self.glob("*")]
303 return [protect_filename(f) for f in self.glob("*")]
303
304
304 m0 = self.clean_glob(text.replace('\\',''))
305 m0 = self.clean_glob(text.replace('\\',''))
305 if has_protectables:
306 if has_protectables:
306 # If we had protectables, we need to revert our changes to the
307 # If we had protectables, we need to revert our changes to the
307 # beginning of filename so that we don't double-write the part
308 # beginning of filename so that we don't double-write the part
308 # of the filename we have so far
309 # of the filename we have so far
309 len_lsplit = len(lsplit)
310 len_lsplit = len(lsplit)
310 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
311 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
311 else:
312 else:
312 if open_quotes:
313 if open_quotes:
313 # if we have a string with an open quote, we don't need to
314 # if we have a string with an open quote, we don't need to
314 # protect the names at all (and we _shouldn't_, as it
315 # protect the names at all (and we _shouldn't_, as it
315 # would cause bugs when the filesystem call is made).
316 # would cause bugs when the filesystem call is made).
316 matches = m0
317 matches = m0
317 else:
318 else:
318 matches = [protect_filename(f) for f in m0]
319 matches = [protect_filename(f) for f in m0]
319 if len(matches) == 1 and os.path.isdir(matches[0]):
320 if len(matches) == 1 and os.path.isdir(matches[0]):
320 # Takes care of links to directories also. Use '/'
321 # Takes care of links to directories also. Use '/'
321 # explicitly, even under Windows, so that name completions
322 # explicitly, even under Windows, so that name completions
322 # don't end up escaped.
323 # don't end up escaped.
323 matches[0] += '/'
324 matches[0] += '/'
324 return matches
325 return matches
325
326
326 def alias_matches(self, text):
327 def alias_matches(self, text):
327 """Match internal system aliases"""
328 """Match internal system aliases"""
328 #print 'Completer->alias_matches:',text # dbg
329 #print 'Completer->alias_matches:',text # dbg
329 text = os.path.expanduser(text)
330 text = os.path.expanduser(text)
330 aliases = self.alias_table.keys()
331 aliases = self.alias_table.keys()
331 if text == "":
332 if text == "":
332 return aliases
333 return aliases
333 else:
334 else:
334 return [alias for alias in aliases if alias.startswith(text)]
335 return [alias for alias in aliases if alias.startswith(text)]
335
336
336 def python_matches(self,text):
337 def python_matches(self,text):
337 """Match attributes or global python names"""
338 """Match attributes or global python names"""
338 #print 'Completer->python_matches' # dbg
339 #print 'Completer->python_matches' # dbg
339 if "." in text:
340 if "." in text:
340 try:
341 try:
341 matches = self.attr_matches(text)
342 matches = self.attr_matches(text)
342 if text.endswith('.') and self.omit__names:
343 if text.endswith('.') and self.omit__names:
343 if self.omit__names == 1:
344 if self.omit__names == 1:
344 # true if txt is _not_ a __ name, false otherwise:
345 # true if txt is _not_ a __ name, false otherwise:
345 no__name = (lambda txt:
346 no__name = (lambda txt:
346 re.match(r'.*\.__.*?__',txt) is None)
347 re.match(r'.*\.__.*?__',txt) is None)
347 else:
348 else:
348 # true if txt is _not_ a _ name, false otherwise:
349 # true if txt is _not_ a _ name, false otherwise:
349 no__name = (lambda txt:
350 no__name = (lambda txt:
350 re.match(r'.*\._.*?',txt) is None)
351 re.match(r'.*\._.*?',txt) is None)
351 matches = filter(no__name, matches)
352 matches = filter(no__name, matches)
352 except NameError:
353 except NameError:
353 # catches <undefined attributes>.<tab>
354 # catches <undefined attributes>.<tab>
354 matches = []
355 matches = []
355 else:
356 else:
356 matches = self.global_matches(text)
357 matches = self.global_matches(text)
357 # this is so completion finds magics when automagic is on:
358 # this is so completion finds magics when automagic is on:
358 if matches == [] and not text.startswith(os.sep):
359 if matches == [] and not text.startswith(os.sep):
359 matches = self.attr_matches(self.magic_prefix+text)
360 matches = self.attr_matches(self.magic_prefix+text)
360 return matches
361 return matches
361
362
362 def _default_arguments(self, obj):
363 def _default_arguments(self, obj):
363 """Return the list of default arguments of obj if it is callable,
364 """Return the list of default arguments of obj if it is callable,
364 or empty list otherwise."""
365 or empty list otherwise."""
365
366
366 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
367 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
367 # for classes, check for __init__,__new__
368 # for classes, check for __init__,__new__
368 if inspect.isclass(obj):
369 if inspect.isclass(obj):
369 obj = (getattr(obj,'__init__',None) or
370 obj = (getattr(obj,'__init__',None) or
370 getattr(obj,'__new__',None))
371 getattr(obj,'__new__',None))
371 # for all others, check if they are __call__able
372 # for all others, check if they are __call__able
372 elif hasattr(obj, '__call__'):
373 elif hasattr(obj, '__call__'):
373 obj = obj.__call__
374 obj = obj.__call__
374 # XXX: is there a way to handle the builtins ?
375 # XXX: is there a way to handle the builtins ?
375 try:
376 try:
376 args,_,_1,defaults = inspect.getargspec(obj)
377 args,_,_1,defaults = inspect.getargspec(obj)
377 if defaults:
378 if defaults:
378 return args[-len(defaults):]
379 return args[-len(defaults):]
379 except TypeError: pass
380 except TypeError: pass
380 return []
381 return []
381
382
382 def python_func_kw_matches(self,text):
383 def python_func_kw_matches(self,text):
383 """Match named parameters (kwargs) of the last open function"""
384 """Match named parameters (kwargs) of the last open function"""
384
385
385 if "." in text: # a parameter cannot be dotted
386 if "." in text: # a parameter cannot be dotted
386 return []
387 return []
387 try: regexp = self.__funcParamsRegex
388 try: regexp = self.__funcParamsRegex
388 except AttributeError:
389 except AttributeError:
389 regexp = self.__funcParamsRegex = re.compile(r'''
390 regexp = self.__funcParamsRegex = re.compile(r'''
390 '.*?' | # single quoted strings or
391 '.*?' | # single quoted strings or
391 ".*?" | # double quoted strings or
392 ".*?" | # double quoted strings or
392 \w+ | # identifier
393 \w+ | # identifier
393 \S # other characters
394 \S # other characters
394 ''', re.VERBOSE | re.DOTALL)
395 ''', re.VERBOSE | re.DOTALL)
395 # 1. find the nearest identifier that comes before an unclosed
396 # 1. find the nearest identifier that comes before an unclosed
396 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
397 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
397 tokens = regexp.findall(self.get_line_buffer())
398 tokens = regexp.findall(self.get_line_buffer())
398 tokens.reverse()
399 tokens.reverse()
399 iterTokens = iter(tokens); openPar = 0
400 iterTokens = iter(tokens); openPar = 0
400 for token in iterTokens:
401 for token in iterTokens:
401 if token == ')':
402 if token == ')':
402 openPar -= 1
403 openPar -= 1
403 elif token == '(':
404 elif token == '(':
404 openPar += 1
405 openPar += 1
405 if openPar > 0:
406 if openPar > 0:
406 # found the last unclosed parenthesis
407 # found the last unclosed parenthesis
407 break
408 break
408 else:
409 else:
409 return []
410 return []
410 # 2. Concatenate any dotted names (e.g. "foo.bar" for "foo.bar(x, pa" )
411 # 2. Concatenate any dotted names (e.g. "foo.bar" for "foo.bar(x, pa" )
411 ids = []
412 ids = []
412 isId = re.compile(r'\w+$').match
413 isId = re.compile(r'\w+$').match
413 while True:
414 while True:
414 try:
415 try:
415 ids.append(iterTokens.next())
416 ids.append(iterTokens.next())
416 if not isId(ids[-1]):
417 if not isId(ids[-1]):
417 ids.pop(); break
418 ids.pop(); break
418 if not iterTokens.next() == '.':
419 if not iterTokens.next() == '.':
419 break
420 break
420 except StopIteration:
421 except StopIteration:
421 break
422 break
422 # lookup the candidate callable matches either using global_matches
423 # lookup the candidate callable matches either using global_matches
423 # or attr_matches for dotted names
424 # or attr_matches for dotted names
424 if len(ids) == 1:
425 if len(ids) == 1:
425 callableMatches = self.global_matches(ids[0])
426 callableMatches = self.global_matches(ids[0])
426 else:
427 else:
427 callableMatches = self.attr_matches('.'.join(ids[::-1]))
428 callableMatches = self.attr_matches('.'.join(ids[::-1]))
428 argMatches = []
429 argMatches = []
429 for callableMatch in callableMatches:
430 for callableMatch in callableMatches:
430 try: namedArgs = self._default_arguments(eval(callableMatch,
431 try: namedArgs = self._default_arguments(eval(callableMatch,
431 self.namespace))
432 self.namespace))
432 except: continue
433 except: continue
433 for namedArg in namedArgs:
434 for namedArg in namedArgs:
434 if namedArg.startswith(text):
435 if namedArg.startswith(text):
435 argMatches.append("%s=" %namedArg)
436 argMatches.append("%s=" %namedArg)
436 return argMatches
437 return argMatches
437
438
438 def complete(self, text, state):
439 def complete(self, text, state):
439 """Return the next possible completion for 'text'.
440 """Return the next possible completion for 'text'.
440
441
441 This is called successively with state == 0, 1, 2, ... until it
442 This is called successively with state == 0, 1, 2, ... until it
442 returns None. The completion should begin with 'text'. """
443 returns None. The completion should begin with 'text'. """
443
444
444 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
445 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
445 magic_escape = self.magic_escape
446 magic_escape = self.magic_escape
446 magic_prefix = self.magic_prefix
447 magic_prefix = self.magic_prefix
447
448
448 try:
449 try:
449 if text.startswith(magic_escape):
450 if text.startswith(magic_escape):
450 text = text.replace(magic_escape,magic_prefix)
451 text = text.replace(magic_escape,magic_prefix)
451 elif text.startswith('~'):
452 elif text.startswith('~'):
452 text = os.path.expanduser(text)
453 text = os.path.expanduser(text)
453 if state == 0:
454 if state == 0:
454 # Extend the list of completions with the results of each
455 # Extend the list of completions with the results of each
455 # matcher, so we return results to the user from all
456 # matcher, so we return results to the user from all
456 # namespaces.
457 # namespaces.
457 if self.merge_completions:
458 if self.merge_completions:
458 self.matches = []
459 self.matches = []
459 for matcher in self.matchers:
460 for matcher in self.matchers:
460 self.matches.extend(matcher(text))
461 self.matches.extend(matcher(text))
461 else:
462 else:
462 for matcher in self.matchers:
463 for matcher in self.matchers:
463 self.matches = matcher(text)
464 self.matches = matcher(text)
464 if self.matches:
465 if self.matches:
465 break
466 break
466
467
467 try:
468 try:
468 return self.matches[state].replace(magic_prefix,magic_escape)
469 return self.matches[state].replace(magic_prefix,magic_escape)
469 except IndexError:
470 except IndexError:
470 return None
471 return None
471 except:
472 except:
472 # If completion fails, don't annoy the user.
473 # If completion fails, don't annoy the user.
473 pass
474 pass
474
475
475 except ImportError:
476 except ImportError:
476 pass # no readline support
477 pass # no readline support
477
478
478 except KeyError:
479 except KeyError:
479 pass # Windows doesn't set TERM, it doesn't matter
480 pass # Windows doesn't set TERM, it doesn't matter
480
481
481
482
482 class InputList(UserList.UserList):
483 class InputList(UserList.UserList):
483 """Class to store user input.
484 """Class to store user input.
484
485
485 It's basically a list, but slices return a string instead of a list, thus
486 It's basically a list, but slices return a string instead of a list, thus
486 allowing things like (assuming 'In' is an instance):
487 allowing things like (assuming 'In' is an instance):
487
488
488 exec In[4:7]
489 exec In[4:7]
489
490
490 or
491 or
491
492
492 exec In[5:9] + In[14] + In[21:25]"""
493 exec In[5:9] + In[14] + In[21:25]"""
493
494
494 def __getslice__(self,i,j):
495 def __getslice__(self,i,j):
495 return ''.join(UserList.UserList.__getslice__(self,i,j))
496 return ''.join(UserList.UserList.__getslice__(self,i,j))
496
497
497 #****************************************************************************
498 #****************************************************************************
498 # Local use exceptions
499 # Local use exceptions
499 class SpaceInInput(exceptions.Exception):
500 class SpaceInInput(exceptions.Exception):
500 pass
501 pass
501
502
502 #****************************************************************************
503 #****************************************************************************
503 # Main IPython class
504 # Main IPython class
504
505
505 class InteractiveShell(code.InteractiveConsole, Logger, Magic):
506 class InteractiveShell(code.InteractiveConsole, Logger, Magic):
506 """An enhanced console for Python."""
507 """An enhanced console for Python."""
507
508
508 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
509 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
509 user_ns = None,banner2='',
510 user_ns = None,user_global_ns=None,banner2='',
510 custom_exceptions=((),None)):
511 custom_exceptions=((),None)):
511
512
512 # Put a reference to self in builtins so that any form of embedded or
513 # Put a reference to self in builtins so that any form of embedded or
513 # imported code can test for being inside IPython.
514 # imported code can test for being inside IPython.
514 __builtin__.__IPYTHON__ = self
515 __builtin__.__IPYTHON__ = self
515
516
516 # And load into builtins ipmagic/ipalias as well
517 # And load into builtins ipmagic/ipalias as well
517 __builtin__.ipmagic = ipmagic
518 __builtin__.ipmagic = ipmagic
518 __builtin__.ipalias = ipalias
519 __builtin__.ipalias = ipalias
519
520
520 # Add to __builtin__ other parts of IPython's public API
521 # Add to __builtin__ other parts of IPython's public API
521 __builtin__.ip_set_hook = self.set_hook
522 __builtin__.ip_set_hook = self.set_hook
522
523
523 # Keep in the builtins a flag for when IPython is active. We set it
524 # Keep in the builtins a flag for when IPython is active. We set it
524 # with setdefault so that multiple nested IPythons don't clobber one
525 # with setdefault so that multiple nested IPythons don't clobber one
525 # another. Each will increase its value by one upon being activated,
526 # another. Each will increase its value by one upon being activated,
526 # which also gives us a way to determine the nesting level.
527 # which also gives us a way to determine the nesting level.
527 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
528 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
528
529
529 # Inform the user of ipython's fast exit magics.
530 # Inform the user of ipython's fast exit magics.
530 _exit = ' Use %Exit or %Quit to exit without confirmation.'
531 _exit = ' Use %Exit or %Quit to exit without confirmation.'
531 __builtin__.exit += _exit
532 __builtin__.exit += _exit
532 __builtin__.quit += _exit
533 __builtin__.quit += _exit
533
534
534 # Create the namespace where the user will operate:
535 # compiler command
536 self.compile = CommandCompiler()
537
538 # User input buffer
539 self.buffer = []
540
541 # Default name given in compilation of code
542 self.filename = '<ipython console>'
543
544 # Create the namespace where the user will operate. user_ns is
545 # normally the only one used, and it is passed to the exec calls as
546 # the locals argument. But we do carry a user_global_ns namespace
547 # given as the exec 'globals' argument, This is useful in embedding
548 # situations where the ipython shell opens in a context where the
549 # distinction between locals and globals is meaningful.
535
550
536 # FIXME. For some strange reason, __builtins__ is showing up at user
551 # FIXME. For some strange reason, __builtins__ is showing up at user
537 # level as a dict instead of a module. This is a manual fix, but I
552 # level as a dict instead of a module. This is a manual fix, but I
538 # should really track down where the problem is coming from. Alex
553 # should really track down where the problem is coming from. Alex
539 # Schmolck reported this problem first.
554 # Schmolck reported this problem first.
540
555
541 # A useful post by Alex Martelli on this topic:
556 # A useful post by Alex Martelli on this topic:
542 # Re: inconsistent value from __builtins__
557 # Re: inconsistent value from __builtins__
543 # Von: Alex Martelli <aleaxit@yahoo.com>
558 # Von: Alex Martelli <aleaxit@yahoo.com>
544 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
559 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
545 # Gruppen: comp.lang.python
560 # Gruppen: comp.lang.python
546 # Referenzen: 1
561 # Referenzen: 1
547
562
548 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
563 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
549 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
564 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
550 # > <type 'dict'>
565 # > <type 'dict'>
551 # > >>> print type(__builtins__)
566 # > >>> print type(__builtins__)
552 # > <type 'module'>
567 # > <type 'module'>
553 # > Is this difference in return value intentional?
568 # > Is this difference in return value intentional?
554
569
555 # Well, it's documented that '__builtins__' can be either a dictionary
570 # Well, it's documented that '__builtins__' can be either a dictionary
556 # or a module, and it's been that way for a long time. Whether it's
571 # or a module, and it's been that way for a long time. Whether it's
557 # intentional (or sensible), I don't know. In any case, the idea is that
572 # intentional (or sensible), I don't know. In any case, the idea is that
558 # if you need to access the built-in namespace directly, you should start
573 # if you need to access the built-in namespace directly, you should start
559 # with "import __builtin__" (note, no 's') which will definitely give you
574 # with "import __builtin__" (note, no 's') which will definitely give you
560 # a module. Yeah, it's somewhatΒ confusing:-(.
575 # a module. Yeah, it's somewhatΒ confusing:-(.
561
576
562 if user_ns is None:
577 if user_ns is None:
563 # Set __name__ to __main__ to better match the behavior of the
578 # Set __name__ to __main__ to better match the behavior of the
564 # normal interpreter.
579 # normal interpreter.
565 self.user_ns = {'__name__' :'__main__',
580 user_ns = {'__name__' :'__main__',
566 '__builtins__' : __builtin__,
581 '__builtins__' : __builtin__,
567 }
582 }
568 else:
583
569 self.user_ns = user_ns
584 if user_global_ns is None:
585 user_global_ns = {}
586
587 # assign namespaces
588 self.user_ns = user_ns
589 self.user_global_ns = user_global_ns
570
590
571 # The user namespace MUST have a pointer to the shell itself.
591 # The user namespace MUST have a pointer to the shell itself.
572 self.user_ns[name] = self
592 self.user_ns[name] = self
573
593
574 # We need to insert into sys.modules something that looks like a
594 # We need to insert into sys.modules something that looks like a
575 # module but which accesses the IPython namespace, for shelve and
595 # module but which accesses the IPython namespace, for shelve and
576 # pickle to work interactively. Normally they rely on getting
596 # pickle to work interactively. Normally they rely on getting
577 # everything out of __main__, but for embedding purposes each IPython
597 # everything out of __main__, but for embedding purposes each IPython
578 # instance has its own private namespace, so we can't go shoving
598 # instance has its own private namespace, so we can't go shoving
579 # everything into __main__.
599 # everything into __main__.
580
600
581 try:
601 try:
582 main_name = self.user_ns['__name__']
602 main_name = self.user_ns['__name__']
583 except KeyError:
603 except KeyError:
584 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
604 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
585 else:
605 else:
586 #print "pickle hack in place" # dbg
606 #print "pickle hack in place" # dbg
587 sys.modules[main_name] = FakeModule(self.user_ns)
607 sys.modules[main_name] = FakeModule(self.user_ns)
588
608
589 # List of input with multi-line handling.
609 # List of input with multi-line handling.
590 # Fill its zero entry, user counter starts at 1
610 # Fill its zero entry, user counter starts at 1
591 self.input_hist = InputList(['\n'])
611 self.input_hist = InputList(['\n'])
592
612
593 # list of visited directories
613 # list of visited directories
594 try:
614 try:
595 self.dir_hist = [os.getcwd()]
615 self.dir_hist = [os.getcwd()]
596 except IOError, e:
616 except IOError, e:
597 self.dir_hist = []
617 self.dir_hist = []
598
618
599 # dict of output history
619 # dict of output history
600 self.output_hist = {}
620 self.output_hist = {}
601
621
602 # dict of names to be treated as system aliases. Each entry in the
622 # dict of names to be treated as system aliases. Each entry in the
603 # alias table must be a 2-tuple of the form (N,name), where N is the
623 # alias table must be a 2-tuple of the form (N,name), where N is the
604 # number of positional arguments of the alias.
624 # number of positional arguments of the alias.
605 self.alias_table = {}
625 self.alias_table = {}
606
626
607 # dict of things NOT to alias (keywords, builtins and some special magics)
627 # dict of things NOT to alias (keywords, builtins and some special magics)
608 no_alias = {}
628 no_alias = {}
609 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
629 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
610 for key in keyword.kwlist + no_alias_magics:
630 for key in keyword.kwlist + no_alias_magics:
611 no_alias[key] = 1
631 no_alias[key] = 1
612 no_alias.update(__builtin__.__dict__)
632 no_alias.update(__builtin__.__dict__)
613 self.no_alias = no_alias
633 self.no_alias = no_alias
614
634
615
616 # make global variables for user access to these
635 # make global variables for user access to these
617 self.user_ns['_ih'] = self.input_hist
636 self.user_ns['_ih'] = self.input_hist
618 self.user_ns['_oh'] = self.output_hist
637 self.user_ns['_oh'] = self.output_hist
619 self.user_ns['_dh'] = self.dir_hist
638 self.user_ns['_dh'] = self.dir_hist
620
639
621 # user aliases to input and output histories
640 # user aliases to input and output histories
622 self.user_ns['In'] = self.input_hist
641 self.user_ns['In'] = self.input_hist
623 self.user_ns['Out'] = self.output_hist
642 self.user_ns['Out'] = self.output_hist
624
643
625 # Store the actual shell's name
644 # Store the actual shell's name
626 self.name = name
645 self.name = name
627
646
628 # Object variable to store code object waiting execution. This is
647 # Object variable to store code object waiting execution. This is
629 # used mainly by the multithreaded shells, but it can come in handy in
648 # used mainly by the multithreaded shells, but it can come in handy in
630 # other situations. No need to use a Queue here, since it's a single
649 # other situations. No need to use a Queue here, since it's a single
631 # item which gets cleared once run.
650 # item which gets cleared once run.
632 self.code_to_run = None
651 self.code_to_run = None
633
652
634 # Job manager (for jobs run as background threads)
653 # Job manager (for jobs run as background threads)
635 self.jobs = BackgroundJobManager()
654 self.jobs = BackgroundJobManager()
636 # Put the job manager into builtins so it's always there.
655 # Put the job manager into builtins so it's always there.
637 __builtin__.jobs = self.jobs
656 __builtin__.jobs = self.jobs
638
657
639 # escapes for automatic behavior on the command line
658 # escapes for automatic behavior on the command line
640 self.ESC_SHELL = '!'
659 self.ESC_SHELL = '!'
641 self.ESC_HELP = '?'
660 self.ESC_HELP = '?'
642 self.ESC_MAGIC = '%'
661 self.ESC_MAGIC = '%'
643 self.ESC_QUOTE = ','
662 self.ESC_QUOTE = ','
644 self.ESC_QUOTE2 = ';'
663 self.ESC_QUOTE2 = ';'
645 self.ESC_PAREN = '/'
664 self.ESC_PAREN = '/'
646
665
647 # And their associated handlers
666 # And their associated handlers
648 self.esc_handlers = {self.ESC_PAREN:self.handle_auto,
667 self.esc_handlers = {self.ESC_PAREN:self.handle_auto,
649 self.ESC_QUOTE:self.handle_auto,
668 self.ESC_QUOTE:self.handle_auto,
650 self.ESC_QUOTE2:self.handle_auto,
669 self.ESC_QUOTE2:self.handle_auto,
651 self.ESC_MAGIC:self.handle_magic,
670 self.ESC_MAGIC:self.handle_magic,
652 self.ESC_HELP:self.handle_help,
671 self.ESC_HELP:self.handle_help,
653 self.ESC_SHELL:self.handle_shell_escape,
672 self.ESC_SHELL:self.handle_shell_escape,
654 }
673 }
655
674
656 # class initializations
675 # class initializations
657 code.InteractiveConsole.__init__(self,locals = self.user_ns)
658 Logger.__init__(self,log_ns = self.user_ns)
676 Logger.__init__(self,log_ns = self.user_ns)
659 Magic.__init__(self,self)
677 Magic.__init__(self,self)
660
678
661 # an ugly hack to get a pointer to the shell, so I can start writing
679 # an ugly hack to get a pointer to the shell, so I can start writing
662 # magic code via this pointer instead of the current mixin salad.
680 # magic code via this pointer instead of the current mixin salad.
663 Magic.set_shell(self,self)
681 Magic.set_shell(self,self)
664
682
665 # Python source parser/formatter for syntax highlighting
683 # Python source parser/formatter for syntax highlighting
666 pyformat = Parser().format
684 pyformat = Parser().format
667 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
685 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
668
686
669 # hooks holds pointers used for user-side customizations
687 # hooks holds pointers used for user-side customizations
670 self.hooks = Struct()
688 self.hooks = Struct()
671
689
672 # Set all default hooks, defined in the IPython.hooks module.
690 # Set all default hooks, defined in the IPython.hooks module.
673 hooks = IPython.hooks
691 hooks = IPython.hooks
674 for hook_name in hooks.__all__:
692 for hook_name in hooks.__all__:
675 self.set_hook(hook_name,getattr(hooks,hook_name))
693 self.set_hook(hook_name,getattr(hooks,hook_name))
676
694
677 # Flag to mark unconditional exit
695 # Flag to mark unconditional exit
678 self.exit_now = False
696 self.exit_now = False
679
697
680 self.usage_min = """\
698 self.usage_min = """\
681 An enhanced console for Python.
699 An enhanced console for Python.
682 Some of its features are:
700 Some of its features are:
683 - Readline support if the readline library is present.
701 - Readline support if the readline library is present.
684 - Tab completion in the local namespace.
702 - Tab completion in the local namespace.
685 - Logging of input, see command-line options.
703 - Logging of input, see command-line options.
686 - System shell escape via ! , eg !ls.
704 - System shell escape via ! , eg !ls.
687 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
705 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
688 - Keeps track of locally defined variables via %who, %whos.
706 - Keeps track of locally defined variables via %who, %whos.
689 - Show object information with a ? eg ?x or x? (use ?? for more info).
707 - Show object information with a ? eg ?x or x? (use ?? for more info).
690 """
708 """
691 if usage: self.usage = usage
709 if usage: self.usage = usage
692 else: self.usage = self.usage_min
710 else: self.usage = self.usage_min
693
711
694 # Storage
712 # Storage
695 self.rc = rc # This will hold all configuration information
713 self.rc = rc # This will hold all configuration information
696 self.inputcache = []
714 self.inputcache = []
697 self._boundcache = []
715 self._boundcache = []
698 self.pager = 'less'
716 self.pager = 'less'
699 # temporary files used for various purposes. Deleted at exit.
717 # temporary files used for various purposes. Deleted at exit.
700 self.tempfiles = []
718 self.tempfiles = []
701
719
702 # Keep track of readline usage (later set by init_readline)
720 # Keep track of readline usage (later set by init_readline)
703 self.has_readline = 0
721 self.has_readline = 0
704
722
705 # for pushd/popd management
723 # for pushd/popd management
706 try:
724 try:
707 self.home_dir = get_home_dir()
725 self.home_dir = get_home_dir()
708 except HomeDirError,msg:
726 except HomeDirError,msg:
709 fatal(msg)
727 fatal(msg)
710
728
711 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
729 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
712
730
713 # Functions to call the underlying shell.
731 # Functions to call the underlying shell.
714
732
715 # utility to expand user variables via Itpl
733 # utility to expand user variables via Itpl
716 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
734 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
717 self.user_ns))
735 self.user_ns))
718 # The first is similar to os.system, but it doesn't return a value,
736 # The first is similar to os.system, but it doesn't return a value,
719 # and it allows interpolation of variables in the user's namespace.
737 # and it allows interpolation of variables in the user's namespace.
720 self.system = lambda cmd: shell(self.var_expand(cmd),
738 self.system = lambda cmd: shell(self.var_expand(cmd),
721 header='IPython system call: ',
739 header='IPython system call: ',
722 verbose=self.rc.system_verbose)
740 verbose=self.rc.system_verbose)
723 # These are for getoutput and getoutputerror:
741 # These are for getoutput and getoutputerror:
724 self.getoutput = lambda cmd: \
742 self.getoutput = lambda cmd: \
725 getoutput(self.var_expand(cmd),
743 getoutput(self.var_expand(cmd),
726 header='IPython system call: ',
744 header='IPython system call: ',
727 verbose=self.rc.system_verbose)
745 verbose=self.rc.system_verbose)
728 self.getoutputerror = lambda cmd: \
746 self.getoutputerror = lambda cmd: \
729 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
747 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
730 self.user_ns)),
748 self.user_ns)),
731 header='IPython system call: ',
749 header='IPython system call: ',
732 verbose=self.rc.system_verbose)
750 verbose=self.rc.system_verbose)
733
751
734 # RegExp for splitting line contents into pre-char//first
752 # RegExp for splitting line contents into pre-char//first
735 # word-method//rest. For clarity, each group in on one line.
753 # word-method//rest. For clarity, each group in on one line.
736
754
737 # WARNING: update the regexp if the above escapes are changed, as they
755 # WARNING: update the regexp if the above escapes are changed, as they
738 # are hardwired in.
756 # are hardwired in.
739
757
740 # Don't get carried away with trying to make the autocalling catch too
758 # Don't get carried away with trying to make the autocalling catch too
741 # much: it's better to be conservative rather than to trigger hidden
759 # much: it's better to be conservative rather than to trigger hidden
742 # evals() somewhere and end up causing side effects.
760 # evals() somewhere and end up causing side effects.
743
761
744 self.line_split = re.compile(r'^([\s*,;/])'
762 self.line_split = re.compile(r'^([\s*,;/])'
745 r'([\?\w\.]+\w*\s*)'
763 r'([\?\w\.]+\w*\s*)'
746 r'(\(?.*$)')
764 r'(\(?.*$)')
747
765
748 # Original re, keep around for a while in case changes break something
766 # Original re, keep around for a while in case changes break something
749 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
767 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
750 # r'(\s*[\?\w\.]+\w*\s*)'
768 # r'(\s*[\?\w\.]+\w*\s*)'
751 # r'(\(?.*$)')
769 # r'(\(?.*$)')
752
770
753 # RegExp to identify potential function names
771 # RegExp to identify potential function names
754 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
772 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
755 # RegExp to exclude strings with this start from autocalling
773 # RegExp to exclude strings with this start from autocalling
756 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
774 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
757 # try to catch also methods for stuff in lists/tuples/dicts: off
775 # try to catch also methods for stuff in lists/tuples/dicts: off
758 # (experimental). For this to work, the line_split regexp would need
776 # (experimental). For this to work, the line_split regexp would need
759 # to be modified so it wouldn't break things at '['. That line is
777 # to be modified so it wouldn't break things at '['. That line is
760 # nasty enough that I shouldn't change it until I can test it _well_.
778 # nasty enough that I shouldn't change it until I can test it _well_.
761 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
779 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
762
780
763 # keep track of where we started running (mainly for crash post-mortem)
781 # keep track of where we started running (mainly for crash post-mortem)
764 self.starting_dir = os.getcwd()
782 self.starting_dir = os.getcwd()
765
783
766 # Attributes for Logger mixin class, make defaults here
784 # Attributes for Logger mixin class, make defaults here
767 self._dolog = 0
785 self._dolog = 0
768 self.LOG = ''
786 self.LOG = ''
769 self.LOGDEF = '.InteractiveShell.log'
787 self.LOGDEF = '.InteractiveShell.log'
770 self.LOGMODE = 'over'
788 self.LOGMODE = 'over'
771 self.LOGHEAD = Itpl(
789 self.LOGHEAD = Itpl(
772 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
790 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
773 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
791 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
774 #log# opts = $self.rc.opts
792 #log# opts = $self.rc.opts
775 #log# args = $self.rc.args
793 #log# args = $self.rc.args
776 #log# It is safe to make manual edits below here.
794 #log# It is safe to make manual edits below here.
777 #log#-----------------------------------------------------------------------
795 #log#-----------------------------------------------------------------------
778 """)
796 """)
779 # Various switches which can be set
797 # Various switches which can be set
780 self.CACHELENGTH = 5000 # this is cheap, it's just text
798 self.CACHELENGTH = 5000 # this is cheap, it's just text
781 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
799 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
782 self.banner2 = banner2
800 self.banner2 = banner2
783
801
784 # TraceBack handlers:
802 # TraceBack handlers:
785 # Need two, one for syntax errors and one for other exceptions.
803 # Need two, one for syntax errors and one for other exceptions.
786 self.SyntaxTB = ultraTB.ListTB(color_scheme='NoColor')
804 self.SyntaxTB = ultraTB.ListTB(color_scheme='NoColor')
787 # This one is initialized with an offset, meaning we always want to
805 # This one is initialized with an offset, meaning we always want to
788 # remove the topmost item in the traceback, which is our own internal
806 # remove the topmost item in the traceback, which is our own internal
789 # code. Valid modes: ['Plain','Context','Verbose']
807 # code. Valid modes: ['Plain','Context','Verbose']
790 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
808 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
791 color_scheme='NoColor',
809 color_scheme='NoColor',
792 tb_offset = 1)
810 tb_offset = 1)
793 # and add any custom exception handlers the user may have specified
811 # and add any custom exception handlers the user may have specified
794 self.set_custom_exc(*custom_exceptions)
812 self.set_custom_exc(*custom_exceptions)
795
813
796 # Object inspector
814 # Object inspector
797 ins_colors = OInspect.InspectColors
815 ins_colors = OInspect.InspectColors
798 code_colors = PyColorize.ANSICodeColors
816 code_colors = PyColorize.ANSICodeColors
799 self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor')
817 self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor')
800 self.autoindent = 0
818 self.autoindent = 0
801
819
802 # Make some aliases automatically
820 # Make some aliases automatically
803 # Prepare list of shell aliases to auto-define
821 # Prepare list of shell aliases to auto-define
804 if os.name == 'posix':
822 if os.name == 'posix':
805 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
823 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
806 'mv mv -i','rm rm -i','cp cp -i',
824 'mv mv -i','rm rm -i','cp cp -i',
807 'cat cat','less less','clear clear',
825 'cat cat','less less','clear clear',
808 # a better ls
826 # a better ls
809 'ls ls -F',
827 'ls ls -F',
810 # long ls
828 # long ls
811 'll ls -lF',
829 'll ls -lF',
812 # color ls
830 # color ls
813 'lc ls -F -o --color',
831 'lc ls -F -o --color',
814 # ls normal files only
832 # ls normal files only
815 'lf ls -F -o --color %l | grep ^-',
833 'lf ls -F -o --color %l | grep ^-',
816 # ls symbolic links
834 # ls symbolic links
817 'lk ls -F -o --color %l | grep ^l',
835 'lk ls -F -o --color %l | grep ^l',
818 # directories or links to directories,
836 # directories or links to directories,
819 'ldir ls -F -o --color %l | grep /$',
837 'ldir ls -F -o --color %l | grep /$',
820 # things which are executable
838 # things which are executable
821 'lx ls -F -o --color %l | grep ^-..x',
839 'lx ls -F -o --color %l | grep ^-..x',
822 )
840 )
823 elif os.name in ['nt','dos']:
841 elif os.name in ['nt','dos']:
824 auto_alias = ('dir dir /on', 'ls dir /on',
842 auto_alias = ('dir dir /on', 'ls dir /on',
825 'ddir dir /ad /on', 'ldir dir /ad /on',
843 'ddir dir /ad /on', 'ldir dir /ad /on',
826 'mkdir mkdir','rmdir rmdir','echo echo',
844 'mkdir mkdir','rmdir rmdir','echo echo',
827 'ren ren','cls cls','copy copy')
845 'ren ren','cls cls','copy copy')
828 else:
846 else:
829 auto_alias = ()
847 auto_alias = ()
830 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
848 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
831 # Call the actual (public) initializer
849 # Call the actual (public) initializer
832 self.init_auto_alias()
850 self.init_auto_alias()
833 # end __init__
851 # end __init__
834
852
835 def set_hook(self,name,hook):
853 def set_hook(self,name,hook):
836 """set_hook(name,hook) -> sets an internal IPython hook.
854 """set_hook(name,hook) -> sets an internal IPython hook.
837
855
838 IPython exposes some of its internal API as user-modifiable hooks. By
856 IPython exposes some of its internal API as user-modifiable hooks. By
839 resetting one of these hooks, you can modify IPython's behavior to
857 resetting one of these hooks, you can modify IPython's behavior to
840 call at runtime your own routines."""
858 call at runtime your own routines."""
841
859
842 # At some point in the future, this should validate the hook before it
860 # At some point in the future, this should validate the hook before it
843 # accepts it. Probably at least check that the hook takes the number
861 # accepts it. Probably at least check that the hook takes the number
844 # of args it's supposed to.
862 # of args it's supposed to.
845 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
863 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
846
864
847 def set_custom_exc(self,exc_tuple,handler):
865 def set_custom_exc(self,exc_tuple,handler):
848 """set_custom_exc(exc_tuple,handler)
866 """set_custom_exc(exc_tuple,handler)
849
867
850 Set a custom exception handler, which will be called if any of the
868 Set a custom exception handler, which will be called if any of the
851 exceptions in exc_tuple occur in the mainloop (specifically, in the
869 exceptions in exc_tuple occur in the mainloop (specifically, in the
852 runcode() method.
870 runcode() method.
853
871
854 Inputs:
872 Inputs:
855
873
856 - exc_tuple: a *tuple* of valid exceptions to call the defined
874 - exc_tuple: a *tuple* of valid exceptions to call the defined
857 handler for. It is very important that you use a tuple, and NOT A
875 handler for. It is very important that you use a tuple, and NOT A
858 LIST here, because of the way Python's except statement works. If
876 LIST here, because of the way Python's except statement works. If
859 you only want to trap a single exception, use a singleton tuple:
877 you only want to trap a single exception, use a singleton tuple:
860
878
861 exc_tuple == (MyCustomException,)
879 exc_tuple == (MyCustomException,)
862
880
863 - handler: this must be defined as a function with the following
881 - handler: this must be defined as a function with the following
864 basic interface: def my_handler(self,etype,value,tb).
882 basic interface: def my_handler(self,etype,value,tb).
865
883
866 This will be made into an instance method (via new.instancemethod)
884 This will be made into an instance method (via new.instancemethod)
867 of IPython itself, and it will be called if any of the exceptions
885 of IPython itself, and it will be called if any of the exceptions
868 listed in the exc_tuple are caught. If the handler is None, an
886 listed in the exc_tuple are caught. If the handler is None, an
869 internal basic one is used, which just prints basic info.
887 internal basic one is used, which just prints basic info.
870
888
871 WARNING: by putting in your own exception handler into IPython's main
889 WARNING: by putting in your own exception handler into IPython's main
872 execution loop, you run a very good chance of nasty crashes. This
890 execution loop, you run a very good chance of nasty crashes. This
873 facility should only be used if you really know what you are doing."""
891 facility should only be used if you really know what you are doing."""
874
892
875 assert type(exc_tuple)==type(()) , \
893 assert type(exc_tuple)==type(()) , \
876 "The custom exceptions must be given AS A TUPLE."
894 "The custom exceptions must be given AS A TUPLE."
877
895
878 def dummy_handler(self,etype,value,tb):
896 def dummy_handler(self,etype,value,tb):
879 print '*** Simple custom exception handler ***'
897 print '*** Simple custom exception handler ***'
880 print 'Exception type :',etype
898 print 'Exception type :',etype
881 print 'Exception value:',value
899 print 'Exception value:',value
882 print 'Traceback :',tb
900 print 'Traceback :',tb
883 print 'Source code :','\n'.join(self.buffer)
901 print 'Source code :','\n'.join(self.buffer)
884
902
885 if handler is None: handler = dummy_handler
903 if handler is None: handler = dummy_handler
886
904
887 self.CustomTB = new.instancemethod(handler,self,self.__class__)
905 self.CustomTB = new.instancemethod(handler,self,self.__class__)
888 self.custom_exceptions = exc_tuple
906 self.custom_exceptions = exc_tuple
889
907
890 def set_custom_completer(self,completer,pos=0):
908 def set_custom_completer(self,completer,pos=0):
891 """set_custom_completer(completer,pos=0)
909 """set_custom_completer(completer,pos=0)
892
910
893 Adds a new custom completer function.
911 Adds a new custom completer function.
894
912
895 The position argument (defaults to 0) is the index in the completers
913 The position argument (defaults to 0) is the index in the completers
896 list where you want the completer to be inserted."""
914 list where you want the completer to be inserted."""
897
915
898 newcomp = new.instancemethod(completer,self.Completer,
916 newcomp = new.instancemethod(completer,self.Completer,
899 self.Completer.__class__)
917 self.Completer.__class__)
900 self.Completer.matchers.insert(pos,newcomp)
918 self.Completer.matchers.insert(pos,newcomp)
901
919
902 def complete(self,text):
920 def complete(self,text):
903 """Return a sorted list of all possible completions on text.
921 """Return a sorted list of all possible completions on text.
904
922
905 Inputs:
923 Inputs:
906
924
907 - text: a string of text to be completed on.
925 - text: a string of text to be completed on.
908
926
909 This is a wrapper around the completion mechanism, similar to what
927 This is a wrapper around the completion mechanism, similar to what
910 readline does at the command line when the TAB key is hit. By
928 readline does at the command line when the TAB key is hit. By
911 exposing it as a method, it can be used by other non-readline
929 exposing it as a method, it can be used by other non-readline
912 environments (such as GUIs) for text completion.
930 environments (such as GUIs) for text completion.
913
931
914 Simple usage example:
932 Simple usage example:
915
933
916 In [1]: x = 'hello'
934 In [1]: x = 'hello'
917
935
918 In [2]: __IP.complete('x.l')
936 In [2]: __IP.complete('x.l')
919 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
937 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
920
938
921 complete = self.Completer.complete
939 complete = self.Completer.complete
922 state = 0
940 state = 0
923 # use a dict so we get unique keys, since ipyhton's multiple
941 # use a dict so we get unique keys, since ipyhton's multiple
924 # completers can return duplicates.
942 # completers can return duplicates.
925 comps = {}
943 comps = {}
926 while True:
944 while True:
927 newcomp = complete(text,state)
945 newcomp = complete(text,state)
928 if newcomp is None:
946 if newcomp is None:
929 break
947 break
930 comps[newcomp] = 1
948 comps[newcomp] = 1
931 state += 1
949 state += 1
932 outcomps = comps.keys()
950 outcomps = comps.keys()
933 outcomps.sort()
951 outcomps.sort()
934 return outcomps
952 return outcomps
935
953
936 def post_config_initialization(self):
954 def post_config_initialization(self):
937 """Post configuration init method
955 """Post configuration init method
938
956
939 This is called after the configuration files have been processed to
957 This is called after the configuration files have been processed to
940 'finalize' the initialization."""
958 'finalize' the initialization."""
941
959
942 # dynamic data that survives through sessions
960 # dynamic data that survives through sessions
943 # XXX make the filename a config option?
961 # XXX make the filename a config option?
944 persist_base = 'persist'
962 persist_base = 'persist'
945 if self.rc.profile:
963 if self.rc.profile:
946 persist_base += '_%s' % self.rc.profile
964 persist_base += '_%s' % self.rc.profile
947 self.persist_fname = os.path.join(self.rc.ipythondir,persist_base)
965 self.persist_fname = os.path.join(self.rc.ipythondir,persist_base)
948
966
949 try:
967 try:
950 self.persist = pickle.load(file(self.persist_fname))
968 self.persist = pickle.load(file(self.persist_fname))
951 except:
969 except:
952 self.persist = {}
970 self.persist = {}
953
971
954 def init_auto_alias(self):
972 def init_auto_alias(self):
955 """Define some aliases automatically.
973 """Define some aliases automatically.
956
974
957 These are ALL parameter-less aliases"""
975 These are ALL parameter-less aliases"""
958 for alias,cmd in self.auto_alias:
976 for alias,cmd in self.auto_alias:
959 self.alias_table[alias] = (0,cmd)
977 self.alias_table[alias] = (0,cmd)
960
978
961 def alias_table_validate(self,verbose=0):
979 def alias_table_validate(self,verbose=0):
962 """Update information about the alias table.
980 """Update information about the alias table.
963
981
964 In particular, make sure no Python keywords/builtins are in it."""
982 In particular, make sure no Python keywords/builtins are in it."""
965
983
966 no_alias = self.no_alias
984 no_alias = self.no_alias
967 for k in self.alias_table.keys():
985 for k in self.alias_table.keys():
968 if k in no_alias:
986 if k in no_alias:
969 del self.alias_table[k]
987 del self.alias_table[k]
970 if verbose:
988 if verbose:
971 print ("Deleting alias <%s>, it's a Python "
989 print ("Deleting alias <%s>, it's a Python "
972 "keyword or builtin." % k)
990 "keyword or builtin." % k)
973
991
974 def set_autoindent(self,value=None):
992 def set_autoindent(self,value=None):
975 """Set the autoindent flag, checking for readline support.
993 """Set the autoindent flag, checking for readline support.
976
994
977 If called with no arguments, it acts as a toggle."""
995 If called with no arguments, it acts as a toggle."""
978
996
979 if not self.has_readline:
997 if not self.has_readline:
980 if os.name == 'posix':
998 if os.name == 'posix':
981 warn("The auto-indent feature requires the readline library")
999 warn("The auto-indent feature requires the readline library")
982 self.autoindent = 0
1000 self.autoindent = 0
983 return
1001 return
984 if value is None:
1002 if value is None:
985 self.autoindent = not self.autoindent
1003 self.autoindent = not self.autoindent
986 else:
1004 else:
987 self.autoindent = value
1005 self.autoindent = value
988
1006
989 def rc_set_toggle(self,rc_field,value=None):
1007 def rc_set_toggle(self,rc_field,value=None):
990 """Set or toggle a field in IPython's rc config. structure.
1008 """Set or toggle a field in IPython's rc config. structure.
991
1009
992 If called with no arguments, it acts as a toggle.
1010 If called with no arguments, it acts as a toggle.
993
1011
994 If called with a non-existent field, the resulting AttributeError
1012 If called with a non-existent field, the resulting AttributeError
995 exception will propagate out."""
1013 exception will propagate out."""
996
1014
997 rc_val = getattr(self.rc,rc_field)
1015 rc_val = getattr(self.rc,rc_field)
998 if value is None:
1016 if value is None:
999 value = not rc_val
1017 value = not rc_val
1000 setattr(self.rc,rc_field,value)
1018 setattr(self.rc,rc_field,value)
1001
1019
1002 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1020 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1003 """Install the user configuration directory.
1021 """Install the user configuration directory.
1004
1022
1005 Can be called when running for the first time or to upgrade the user's
1023 Can be called when running for the first time or to upgrade the user's
1006 .ipython/ directory with the mode parameter. Valid modes are 'install'
1024 .ipython/ directory with the mode parameter. Valid modes are 'install'
1007 and 'upgrade'."""
1025 and 'upgrade'."""
1008
1026
1009 def wait():
1027 def wait():
1010 try:
1028 try:
1011 raw_input("Please press <RETURN> to start IPython.")
1029 raw_input("Please press <RETURN> to start IPython.")
1012 except EOFError:
1030 except EOFError:
1013 print >> Term.cout
1031 print >> Term.cout
1014 print '*'*70
1032 print '*'*70
1015
1033
1016 cwd = os.getcwd() # remember where we started
1034 cwd = os.getcwd() # remember where we started
1017 glb = glob.glob
1035 glb = glob.glob
1018 print '*'*70
1036 print '*'*70
1019 if mode == 'install':
1037 if mode == 'install':
1020 print \
1038 print \
1021 """Welcome to IPython. I will try to create a personal configuration directory
1039 """Welcome to IPython. I will try to create a personal configuration directory
1022 where you can customize many aspects of IPython's functionality in:\n"""
1040 where you can customize many aspects of IPython's functionality in:\n"""
1023 else:
1041 else:
1024 print 'I am going to upgrade your configuration in:'
1042 print 'I am going to upgrade your configuration in:'
1025
1043
1026 print ipythondir
1044 print ipythondir
1027
1045
1028 rcdirend = os.path.join('IPython','UserConfig')
1046 rcdirend = os.path.join('IPython','UserConfig')
1029 cfg = lambda d: os.path.join(d,rcdirend)
1047 cfg = lambda d: os.path.join(d,rcdirend)
1030 try:
1048 try:
1031 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1049 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1032 except IOError:
1050 except IOError:
1033 warning = """
1051 warning = """
1034 Installation error. IPython's directory was not found.
1052 Installation error. IPython's directory was not found.
1035
1053
1036 Check the following:
1054 Check the following:
1037
1055
1038 The ipython/IPython directory should be in a directory belonging to your
1056 The ipython/IPython directory should be in a directory belonging to your
1039 PYTHONPATH environment variable (that is, it should be in a directory
1057 PYTHONPATH environment variable (that is, it should be in a directory
1040 belonging to sys.path). You can copy it explicitly there or just link to it.
1058 belonging to sys.path). You can copy it explicitly there or just link to it.
1041
1059
1042 IPython will proceed with builtin defaults.
1060 IPython will proceed with builtin defaults.
1043 """
1061 """
1044 warn(warning)
1062 warn(warning)
1045 wait()
1063 wait()
1046 return
1064 return
1047
1065
1048 if mode == 'install':
1066 if mode == 'install':
1049 try:
1067 try:
1050 shutil.copytree(rcdir,ipythondir)
1068 shutil.copytree(rcdir,ipythondir)
1051 os.chdir(ipythondir)
1069 os.chdir(ipythondir)
1052 rc_files = glb("ipythonrc*")
1070 rc_files = glb("ipythonrc*")
1053 for rc_file in rc_files:
1071 for rc_file in rc_files:
1054 os.rename(rc_file,rc_file+rc_suffix)
1072 os.rename(rc_file,rc_file+rc_suffix)
1055 except:
1073 except:
1056 warning = """
1074 warning = """
1057
1075
1058 There was a problem with the installation:
1076 There was a problem with the installation:
1059 %s
1077 %s
1060 Try to correct it or contact the developers if you think it's a bug.
1078 Try to correct it or contact the developers if you think it's a bug.
1061 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1079 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1062 warn(warning)
1080 warn(warning)
1063 wait()
1081 wait()
1064 return
1082 return
1065
1083
1066 elif mode == 'upgrade':
1084 elif mode == 'upgrade':
1067 try:
1085 try:
1068 os.chdir(ipythondir)
1086 os.chdir(ipythondir)
1069 except:
1087 except:
1070 print """
1088 print """
1071 Can not upgrade: changing to directory %s failed. Details:
1089 Can not upgrade: changing to directory %s failed. Details:
1072 %s
1090 %s
1073 """ % (ipythondir,sys.exc_info()[1])
1091 """ % (ipythondir,sys.exc_info()[1])
1074 wait()
1092 wait()
1075 return
1093 return
1076 else:
1094 else:
1077 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1095 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1078 for new_full_path in sources:
1096 for new_full_path in sources:
1079 new_filename = os.path.basename(new_full_path)
1097 new_filename = os.path.basename(new_full_path)
1080 if new_filename.startswith('ipythonrc'):
1098 if new_filename.startswith('ipythonrc'):
1081 new_filename = new_filename + rc_suffix
1099 new_filename = new_filename + rc_suffix
1082 # The config directory should only contain files, skip any
1100 # The config directory should only contain files, skip any
1083 # directories which may be there (like CVS)
1101 # directories which may be there (like CVS)
1084 if os.path.isdir(new_full_path):
1102 if os.path.isdir(new_full_path):
1085 continue
1103 continue
1086 if os.path.exists(new_filename):
1104 if os.path.exists(new_filename):
1087 old_file = new_filename+'.old'
1105 old_file = new_filename+'.old'
1088 if os.path.exists(old_file):
1106 if os.path.exists(old_file):
1089 os.remove(old_file)
1107 os.remove(old_file)
1090 os.rename(new_filename,old_file)
1108 os.rename(new_filename,old_file)
1091 shutil.copy(new_full_path,new_filename)
1109 shutil.copy(new_full_path,new_filename)
1092 else:
1110 else:
1093 raise ValueError,'unrecognized mode for install:',`mode`
1111 raise ValueError,'unrecognized mode for install:',`mode`
1094
1112
1095 # Fix line-endings to those native to each platform in the config
1113 # Fix line-endings to those native to each platform in the config
1096 # directory.
1114 # directory.
1097 try:
1115 try:
1098 os.chdir(ipythondir)
1116 os.chdir(ipythondir)
1099 except:
1117 except:
1100 print """
1118 print """
1101 Problem: changing to directory %s failed.
1119 Problem: changing to directory %s failed.
1102 Details:
1120 Details:
1103 %s
1121 %s
1104
1122
1105 Some configuration files may have incorrect line endings. This should not
1123 Some configuration files may have incorrect line endings. This should not
1106 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1124 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1107 wait()
1125 wait()
1108 else:
1126 else:
1109 for fname in glb('ipythonrc*'):
1127 for fname in glb('ipythonrc*'):
1110 try:
1128 try:
1111 native_line_ends(fname,backup=0)
1129 native_line_ends(fname,backup=0)
1112 except IOError:
1130 except IOError:
1113 pass
1131 pass
1114
1132
1115 if mode == 'install':
1133 if mode == 'install':
1116 print """
1134 print """
1117 Successful installation!
1135 Successful installation!
1118
1136
1119 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1137 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1120 IPython manual (there are both HTML and PDF versions supplied with the
1138 IPython manual (there are both HTML and PDF versions supplied with the
1121 distribution) to make sure that your system environment is properly configured
1139 distribution) to make sure that your system environment is properly configured
1122 to take advantage of IPython's features."""
1140 to take advantage of IPython's features."""
1123 else:
1141 else:
1124 print """
1142 print """
1125 Successful upgrade!
1143 Successful upgrade!
1126
1144
1127 All files in your directory:
1145 All files in your directory:
1128 %(ipythondir)s
1146 %(ipythondir)s
1129 which would have been overwritten by the upgrade were backed up with a .old
1147 which would have been overwritten by the upgrade were backed up with a .old
1130 extension. If you had made particular customizations in those files you may
1148 extension. If you had made particular customizations in those files you may
1131 want to merge them back into the new files.""" % locals()
1149 want to merge them back into the new files.""" % locals()
1132 wait()
1150 wait()
1133 os.chdir(cwd)
1151 os.chdir(cwd)
1134 # end user_setup()
1152 # end user_setup()
1135
1153
1136 def atexit_operations(self):
1154 def atexit_operations(self):
1137 """This will be executed at the time of exit.
1155 """This will be executed at the time of exit.
1138
1156
1139 Saving of persistent data should be performed here. """
1157 Saving of persistent data should be performed here. """
1140
1158
1141 # input history
1159 # input history
1142 self.savehist()
1160 self.savehist()
1143
1161
1144 # Cleanup all tempfiles left around
1162 # Cleanup all tempfiles left around
1145 for tfile in self.tempfiles:
1163 for tfile in self.tempfiles:
1146 try:
1164 try:
1147 os.unlink(tfile)
1165 os.unlink(tfile)
1148 except OSError:
1166 except OSError:
1149 pass
1167 pass
1150
1168
1151 # save the "persistent data" catch-all dictionary
1169 # save the "persistent data" catch-all dictionary
1152 try:
1170 try:
1153 pickle.dump(self.persist, open(self.persist_fname,"w"))
1171 pickle.dump(self.persist, open(self.persist_fname,"w"))
1154 except:
1172 except:
1155 print "*** ERROR *** persistent data saving failed."
1173 print "*** ERROR *** persistent data saving failed."
1156
1174
1157 def savehist(self):
1175 def savehist(self):
1158 """Save input history to a file (via readline library)."""
1176 """Save input history to a file (via readline library)."""
1159 try:
1177 try:
1160 self.readline.write_history_file(self.histfile)
1178 self.readline.write_history_file(self.histfile)
1161 except:
1179 except:
1162 print 'Unable to save IPython command history to file: ' + \
1180 print 'Unable to save IPython command history to file: ' + \
1163 `self.histfile`
1181 `self.histfile`
1164
1182
1165 def pre_readline(self):
1183 def pre_readline(self):
1166 """readline hook to be used at the start of each line.
1184 """readline hook to be used at the start of each line.
1167
1185
1168 Currently it handles auto-indent only."""
1186 Currently it handles auto-indent only."""
1169
1187
1170 self.readline.insert_text(' '* self.readline_indent)
1188 self.readline.insert_text(' '* self.readline_indent)
1171
1189
1172 def init_readline(self):
1190 def init_readline(self):
1173 """Command history completion/saving/reloading."""
1191 """Command history completion/saving/reloading."""
1174 try:
1192 try:
1175 import readline
1193 import readline
1176 self.Completer = MagicCompleter(self,
1194 self.Completer = MagicCompleter(self,
1177 self.user_ns,
1195 self.user_ns,
1178 self.rc.readline_omit__names,
1196 self.rc.readline_omit__names,
1179 self.alias_table)
1197 self.alias_table)
1180 except ImportError,NameError:
1198 except ImportError,NameError:
1181 # If FlexCompleter failed to import, MagicCompleter won't be
1199 # If FlexCompleter failed to import, MagicCompleter won't be
1182 # defined. This can happen because of a problem with readline
1200 # defined. This can happen because of a problem with readline
1183 self.has_readline = 0
1201 self.has_readline = 0
1184 # no point in bugging windows users with this every time:
1202 # no point in bugging windows users with this every time:
1185 if os.name == 'posix':
1203 if os.name == 'posix':
1186 warn('Readline services not available on this platform.')
1204 warn('Readline services not available on this platform.')
1187 else:
1205 else:
1188 import atexit
1206 import atexit
1189
1207
1190 # Platform-specific configuration
1208 # Platform-specific configuration
1191 if os.name == 'nt':
1209 if os.name == 'nt':
1192 # readline under Windows modifies the default exit behavior
1210 # readline under Windows modifies the default exit behavior
1193 # from being Ctrl-Z/Return to the Unix Ctrl-D one.
1211 # from being Ctrl-Z/Return to the Unix Ctrl-D one.
1194 __builtin__.exit = __builtin__.quit = \
1212 __builtin__.exit = __builtin__.quit = \
1195 ('Use Ctrl-D (i.e. EOF) to exit. '
1213 ('Use Ctrl-D (i.e. EOF) to exit. '
1196 'Use %Exit or %Quit to exit without confirmation.')
1214 'Use %Exit or %Quit to exit without confirmation.')
1197 self.readline_startup_hook = readline.set_pre_input_hook
1215 self.readline_startup_hook = readline.set_pre_input_hook
1198 else:
1216 else:
1199 self.readline_startup_hook = readline.set_startup_hook
1217 self.readline_startup_hook = readline.set_startup_hook
1200
1218
1201 # Load user's initrc file (readline config)
1219 # Load user's initrc file (readline config)
1202 inputrc_name = os.environ.get('INPUTRC')
1220 inputrc_name = os.environ.get('INPUTRC')
1203 if inputrc_name is None:
1221 if inputrc_name is None:
1204 home_dir = get_home_dir()
1222 home_dir = get_home_dir()
1205 if home_dir is not None:
1223 if home_dir is not None:
1206 inputrc_name = os.path.join(home_dir,'.inputrc')
1224 inputrc_name = os.path.join(home_dir,'.inputrc')
1207 if os.path.isfile(inputrc_name):
1225 if os.path.isfile(inputrc_name):
1208 try:
1226 try:
1209 readline.read_init_file(inputrc_name)
1227 readline.read_init_file(inputrc_name)
1210 except:
1228 except:
1211 warn('Problems reading readline initialization file <%s>'
1229 warn('Problems reading readline initialization file <%s>'
1212 % inputrc_name)
1230 % inputrc_name)
1213
1231
1214 self.has_readline = 1
1232 self.has_readline = 1
1215 self.readline = readline
1233 self.readline = readline
1216 self.readline_indent = 0 # for auto-indenting via readline
1234 self.readline_indent = 0 # for auto-indenting via readline
1217 # save this in sys so embedded copies can restore it properly
1235 # save this in sys so embedded copies can restore it properly
1218 sys.ipcompleter = self.Completer.complete
1236 sys.ipcompleter = self.Completer.complete
1219 readline.set_completer(self.Completer.complete)
1237 readline.set_completer(self.Completer.complete)
1220
1238
1221 # Configure readline according to user's prefs
1239 # Configure readline according to user's prefs
1222 for rlcommand in self.rc.readline_parse_and_bind:
1240 for rlcommand in self.rc.readline_parse_and_bind:
1223 readline.parse_and_bind(rlcommand)
1241 readline.parse_and_bind(rlcommand)
1224
1242
1225 # remove some chars from the delimiters list
1243 # remove some chars from the delimiters list
1226 delims = readline.get_completer_delims()
1244 delims = readline.get_completer_delims()
1227 delims = delims.translate(string._idmap,
1245 delims = delims.translate(string._idmap,
1228 self.rc.readline_remove_delims)
1246 self.rc.readline_remove_delims)
1229 readline.set_completer_delims(delims)
1247 readline.set_completer_delims(delims)
1230 # otherwise we end up with a monster history after a while:
1248 # otherwise we end up with a monster history after a while:
1231 readline.set_history_length(1000)
1249 readline.set_history_length(1000)
1232 try:
1250 try:
1233 #print '*** Reading readline history' # dbg
1251 #print '*** Reading readline history' # dbg
1234 readline.read_history_file(self.histfile)
1252 readline.read_history_file(self.histfile)
1235 except IOError:
1253 except IOError:
1236 pass # It doesn't exist yet.
1254 pass # It doesn't exist yet.
1237
1255
1238 atexit.register(self.atexit_operations)
1256 atexit.register(self.atexit_operations)
1239 del atexit
1257 del atexit
1240
1258
1241 # Configure auto-indent for all platforms
1259 # Configure auto-indent for all platforms
1242 self.set_autoindent(self.rc.autoindent)
1260 self.set_autoindent(self.rc.autoindent)
1243
1261
1244 def showsyntaxerror(self, filename=None):
1262 def showsyntaxerror(self, filename=None):
1245 """Display the syntax error that just occurred.
1263 """Display the syntax error that just occurred.
1246
1264
1247 This doesn't display a stack trace because there isn't one.
1265 This doesn't display a stack trace because there isn't one.
1248
1266
1249 If a filename is given, it is stuffed in the exception instead
1267 If a filename is given, it is stuffed in the exception instead
1250 of what was there before (because Python's parser always uses
1268 of what was there before (because Python's parser always uses
1251 "<string>" when reading from a string).
1269 "<string>" when reading from a string).
1252 """
1270 """
1253 type, value, sys.last_traceback = sys.exc_info()
1271 type, value, sys.last_traceback = sys.exc_info()
1254 sys.last_type = type
1272 sys.last_type = type
1255 sys.last_value = value
1273 sys.last_value = value
1256 if filename and type is SyntaxError:
1274 if filename and type is SyntaxError:
1257 # Work hard to stuff the correct filename in the exception
1275 # Work hard to stuff the correct filename in the exception
1258 try:
1276 try:
1259 msg, (dummy_filename, lineno, offset, line) = value
1277 msg, (dummy_filename, lineno, offset, line) = value
1260 except:
1278 except:
1261 # Not the format we expect; leave it alone
1279 # Not the format we expect; leave it alone
1262 pass
1280 pass
1263 else:
1281 else:
1264 # Stuff in the right filename
1282 # Stuff in the right filename
1265 try:
1283 try:
1266 # Assume SyntaxError is a class exception
1284 # Assume SyntaxError is a class exception
1267 value = SyntaxError(msg, (filename, lineno, offset, line))
1285 value = SyntaxError(msg, (filename, lineno, offset, line))
1268 except:
1286 except:
1269 # If that failed, assume SyntaxError is a string
1287 # If that failed, assume SyntaxError is a string
1270 value = msg, (filename, lineno, offset, line)
1288 value = msg, (filename, lineno, offset, line)
1271 self.SyntaxTB(type,value,[])
1289 self.SyntaxTB(type,value,[])
1272
1290
1273 def debugger(self):
1291 def debugger(self):
1274 """Call the pdb debugger."""
1292 """Call the pdb debugger."""
1275
1293
1276 if not self.rc.pdb:
1294 if not self.rc.pdb:
1277 return
1295 return
1278 pdb.pm()
1296 pdb.pm()
1279
1297
1280 def showtraceback(self,exc_tuple = None,filename=None):
1298 def showtraceback(self,exc_tuple = None,filename=None):
1281 """Display the exception that just occurred."""
1299 """Display the exception that just occurred."""
1282
1300
1283 # Though this won't be called by syntax errors in the input line,
1301 # Though this won't be called by syntax errors in the input line,
1284 # there may be SyntaxError cases whith imported code.
1302 # there may be SyntaxError cases whith imported code.
1285 if exc_tuple is None:
1303 if exc_tuple is None:
1286 type, value, tb = sys.exc_info()
1304 type, value, tb = sys.exc_info()
1287 else:
1305 else:
1288 type, value, tb = exc_tuple
1306 type, value, tb = exc_tuple
1289 if type is SyntaxError:
1307 if type is SyntaxError:
1290 self.showsyntaxerror(filename)
1308 self.showsyntaxerror(filename)
1291 else:
1309 else:
1292 sys.last_type = type
1310 sys.last_type = type
1293 sys.last_value = value
1311 sys.last_value = value
1294 sys.last_traceback = tb
1312 sys.last_traceback = tb
1295 self.InteractiveTB()
1313 self.InteractiveTB()
1296 if self.InteractiveTB.call_pdb and self.has_readline:
1314 if self.InteractiveTB.call_pdb and self.has_readline:
1297 # pdb mucks up readline, fix it back
1315 # pdb mucks up readline, fix it back
1298 self.readline.set_completer(self.Completer.complete)
1316 self.readline.set_completer(self.Completer.complete)
1299
1317
1300 def update_cache(self, line):
1318 def update_cache(self, line):
1301 """puts line into cache"""
1319 """puts line into cache"""
1302 self.inputcache.insert(0, line) # This copies the cache every time ... :-(
1320 self.inputcache.insert(0, line) # This copies the cache every time ... :-(
1303 if len(self.inputcache) >= self.CACHELENGTH:
1321 if len(self.inputcache) >= self.CACHELENGTH:
1304 self.inputcache.pop() # This not :-)
1322 self.inputcache.pop() # This not :-)
1305
1323
1306 def name_space_init(self):
1307 """Create local namespace."""
1308 # We want this to be a method to facilitate embedded initialization.
1309 code.InteractiveConsole.__init__(self,self.user_ns)
1310
1311 def mainloop(self,banner=None):
1324 def mainloop(self,banner=None):
1312 """Creates the local namespace and starts the mainloop.
1325 """Creates the local namespace and starts the mainloop.
1313
1326
1314 If an optional banner argument is given, it will override the
1327 If an optional banner argument is given, it will override the
1315 internally created default banner."""
1328 internally created default banner."""
1316
1329
1317 self.name_space_init()
1318 if self.rc.c: # Emulate Python's -c option
1330 if self.rc.c: # Emulate Python's -c option
1319 self.exec_init_cmd()
1331 self.exec_init_cmd()
1320 if banner is None:
1332 if banner is None:
1321 if self.rc.banner:
1333 if self.rc.banner:
1322 banner = self.BANNER+self.banner2
1334 banner = self.BANNER+self.banner2
1323 else:
1335 else:
1324 banner = ''
1336 banner = ''
1325 self.interact(banner)
1337 self.interact(banner)
1326
1338
1327 def exec_init_cmd(self):
1339 def exec_init_cmd(self):
1328 """Execute a command given at the command line.
1340 """Execute a command given at the command line.
1329
1341
1330 This emulates Python's -c option."""
1342 This emulates Python's -c option."""
1331
1343
1332 sys.argv = ['-c']
1344 sys.argv = ['-c']
1333 self.push(self.rc.c)
1345 self.push(self.rc.c)
1334
1346
1335 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1347 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1336 """Embeds IPython into a running python program.
1348 """Embeds IPython into a running python program.
1337
1349
1338 Input:
1350 Input:
1339
1351
1340 - header: An optional header message can be specified.
1352 - header: An optional header message can be specified.
1341
1353
1342 - local_ns, global_ns: working namespaces. If given as None, the
1354 - local_ns, global_ns: working namespaces. If given as None, the
1343 IPython-initialized one is updated with __main__.__dict__, so that
1355 IPython-initialized one is updated with __main__.__dict__, so that
1344 program variables become visible but user-specific configuration
1356 program variables become visible but user-specific configuration
1345 remains possible.
1357 remains possible.
1346
1358
1347 - stack_depth: specifies how many levels in the stack to go to
1359 - stack_depth: specifies how many levels in the stack to go to
1348 looking for namespaces (when local_ns and global_ns are None). This
1360 looking for namespaces (when local_ns and global_ns are None). This
1349 allows an intermediate caller to make sure that this function gets
1361 allows an intermediate caller to make sure that this function gets
1350 the namespace from the intended level in the stack. By default (0)
1362 the namespace from the intended level in the stack. By default (0)
1351 it will get its locals and globals from the immediate caller.
1363 it will get its locals and globals from the immediate caller.
1352
1364
1353 Warning: it's possible to use this in a program which is being run by
1365 Warning: it's possible to use this in a program which is being run by
1354 IPython itself (via %run), but some funny things will happen (a few
1366 IPython itself (via %run), but some funny things will happen (a few
1355 globals get overwritten). In the future this will be cleaned up, as
1367 globals get overwritten). In the future this will be cleaned up, as
1356 there is no fundamental reason why it can't work perfectly."""
1368 there is no fundamental reason why it can't work perfectly."""
1357
1369
1358 # Patch for global embedding to make sure that things don't overwrite
1359 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1360 # FIXME. Test this a bit more carefully (the if.. is new)
1361 if local_ns is None and global_ns is None:
1362 self.user_ns.update(__main__.__dict__)
1363
1364 # Get locals and globals from caller
1370 # Get locals and globals from caller
1365 if local_ns is None or global_ns is None:
1371 if local_ns is None or global_ns is None:
1366 call_frame = sys._getframe(stack_depth).f_back
1372 call_frame = sys._getframe(stack_depth).f_back
1367
1373
1368 if local_ns is None:
1374 if local_ns is None:
1369 local_ns = call_frame.f_locals
1375 local_ns = call_frame.f_locals
1370 if global_ns is None:
1376 if global_ns is None:
1371 global_ns = call_frame.f_globals
1377 global_ns = call_frame.f_globals
1372
1378
1373 # Update namespaces and fire up interpreter
1379 # Update namespaces and fire up interpreter
1374 self.user_ns.update(local_ns)
1380 self.user_ns = local_ns
1375 self.interact(header)
1381 self.user_global_ns = global_ns
1382
1383 # Patch for global embedding to make sure that things don't overwrite
1384 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1385 # FIXME. Test this a bit more carefully (the if.. is new)
1386 if local_ns is None and global_ns is None:
1387 self.user_global_ns.update(__main__.__dict__)
1376
1388
1377 # Remove locals from namespace
1389 self.interact(header)
1378 for k in local_ns:
1379 del self.user_ns[k]
1380
1390
1381 def interact(self, banner=None):
1391 def interact(self, banner=None):
1382 """Closely emulate the interactive Python console.
1392 """Closely emulate the interactive Python console.
1383
1393
1384 The optional banner argument specify the banner to print
1394 The optional banner argument specify the banner to print
1385 before the first interaction; by default it prints a banner
1395 before the first interaction; by default it prints a banner
1386 similar to the one printed by the real Python interpreter,
1396 similar to the one printed by the real Python interpreter,
1387 followed by the current class name in parentheses (so as not
1397 followed by the current class name in parentheses (so as not
1388 to confuse this with the real interpreter -- since it's so
1398 to confuse this with the real interpreter -- since it's so
1389 close!).
1399 close!).
1390
1400
1391 """
1401 """
1392 cprt = 'Type "copyright", "credits" or "license" for more information.'
1402 cprt = 'Type "copyright", "credits" or "license" for more information.'
1393 if banner is None:
1403 if banner is None:
1394 self.write("Python %s on %s\n%s\n(%s)\n" %
1404 self.write("Python %s on %s\n%s\n(%s)\n" %
1395 (sys.version, sys.platform, cprt,
1405 (sys.version, sys.platform, cprt,
1396 self.__class__.__name__))
1406 self.__class__.__name__))
1397 else:
1407 else:
1398 self.write(banner)
1408 self.write(banner)
1399
1409
1400 more = 0
1410 more = 0
1401
1411
1402 # Mark activity in the builtins
1412 # Mark activity in the builtins
1403 __builtin__.__dict__['__IPYTHON__active'] += 1
1413 __builtin__.__dict__['__IPYTHON__active'] += 1
1404
1414
1405 # exit_now is set by a call to %Exit or %Quit
1415 # exit_now is set by a call to %Exit or %Quit
1406 while not self.exit_now:
1416 while not self.exit_now:
1407 try:
1417 try:
1408 if more:
1418 if more:
1409 prompt = self.outputcache.prompt2
1419 prompt = self.outputcache.prompt2
1410 if self.autoindent:
1420 if self.autoindent:
1411 self.readline_startup_hook(self.pre_readline)
1421 self.readline_startup_hook(self.pre_readline)
1412 else:
1422 else:
1413 prompt = self.outputcache.prompt1
1423 prompt = self.outputcache.prompt1
1414 try:
1424 try:
1415 line = self.raw_input(prompt)
1425 line = self.raw_input(prompt)
1416 if self.autoindent:
1426 if self.autoindent:
1417 self.readline_startup_hook(None)
1427 self.readline_startup_hook(None)
1418 except EOFError:
1428 except EOFError:
1419 if self.autoindent:
1429 if self.autoindent:
1420 self.readline_startup_hook(None)
1430 self.readline_startup_hook(None)
1421 self.write("\n")
1431 self.write("\n")
1422 if self.rc.confirm_exit:
1432 if self.rc.confirm_exit:
1423 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1433 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1424 break
1434 break
1425 else:
1435 else:
1426 break
1436 break
1427 else:
1437 else:
1428 more = self.push(line)
1438 more = self.push(line)
1429 # Auto-indent management
1439 # Auto-indent management
1430 if self.autoindent:
1440 if self.autoindent:
1431 if line:
1441 if line:
1432 ini_spaces = re.match('^(\s+)',line)
1442 ini_spaces = re.match('^(\s+)',line)
1433 if ini_spaces:
1443 if ini_spaces:
1434 nspaces = ini_spaces.end()
1444 nspaces = ini_spaces.end()
1435 else:
1445 else:
1436 nspaces = 0
1446 nspaces = 0
1437 self.readline_indent = nspaces
1447 self.readline_indent = nspaces
1438
1448
1439 if line[-1] == ':':
1449 if line[-1] == ':':
1440 self.readline_indent += 4
1450 self.readline_indent += 4
1441 elif re.match(r'^\s+raise|^\s+return',line):
1451 elif re.match(r'^\s+raise|^\s+return',line):
1442 self.readline_indent -= 4
1452 self.readline_indent -= 4
1443 else:
1453 else:
1444 self.readline_indent = 0
1454 self.readline_indent = 0
1445
1455
1446 except KeyboardInterrupt:
1456 except KeyboardInterrupt:
1447 self.write("\nKeyboardInterrupt\n")
1457 self.write("\nKeyboardInterrupt\n")
1448 self.resetbuffer()
1458 self.resetbuffer()
1449 more = 0
1459 more = 0
1450 # keep cache in sync with the prompt counter:
1460 # keep cache in sync with the prompt counter:
1451 self.outputcache.prompt_count -= 1
1461 self.outputcache.prompt_count -= 1
1452
1462
1453 if self.autoindent:
1463 if self.autoindent:
1454 self.readline_indent = 0
1464 self.readline_indent = 0
1455
1465
1456 except bdb.BdbQuit:
1466 except bdb.BdbQuit:
1457 warn("The Python debugger has exited with a BdbQuit exception.\n"
1467 warn("The Python debugger has exited with a BdbQuit exception.\n"
1458 "Because of how pdb handles the stack, it is impossible\n"
1468 "Because of how pdb handles the stack, it is impossible\n"
1459 "for IPython to properly format this particular exception.\n"
1469 "for IPython to properly format this particular exception.\n"
1460 "IPython will resume normal operation.")
1470 "IPython will resume normal operation.")
1461
1471
1462 # We are off again...
1472 # We are off again...
1463 __builtin__.__dict__['__IPYTHON__active'] -= 1
1473 __builtin__.__dict__['__IPYTHON__active'] -= 1
1464
1474
1465 def excepthook(self, type, value, tb):
1475 def excepthook(self, type, value, tb):
1466 """One more defense for GUI apps that call sys.excepthook.
1476 """One more defense for GUI apps that call sys.excepthook.
1467
1477
1468 GUI frameworks like wxPython trap exceptions and call
1478 GUI frameworks like wxPython trap exceptions and call
1469 sys.excepthook themselves. I guess this is a feature that
1479 sys.excepthook themselves. I guess this is a feature that
1470 enables them to keep running after exceptions that would
1480 enables them to keep running after exceptions that would
1471 otherwise kill their mainloop. This is a bother for IPython
1481 otherwise kill their mainloop. This is a bother for IPython
1472 which excepts to catch all of the program exceptions with a try:
1482 which excepts to catch all of the program exceptions with a try:
1473 except: statement.
1483 except: statement.
1474
1484
1475 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1485 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1476 any app directly invokes sys.excepthook, it will look to the user like
1486 any app directly invokes sys.excepthook, it will look to the user like
1477 IPython crashed. In order to work around this, we can disable the
1487 IPython crashed. In order to work around this, we can disable the
1478 CrashHandler and replace it with this excepthook instead, which prints a
1488 CrashHandler and replace it with this excepthook instead, which prints a
1479 regular traceback using our InteractiveTB. In this fashion, apps which
1489 regular traceback using our InteractiveTB. In this fashion, apps which
1480 call sys.excepthook will generate a regular-looking exception from
1490 call sys.excepthook will generate a regular-looking exception from
1481 IPython, and the CrashHandler will only be triggered by real IPython
1491 IPython, and the CrashHandler will only be triggered by real IPython
1482 crashes.
1492 crashes.
1483
1493
1484 This hook should be used sparingly, only in places which are not likely
1494 This hook should be used sparingly, only in places which are not likely
1485 to be true IPython errors.
1495 to be true IPython errors.
1486 """
1496 """
1487
1497
1488 self.InteractiveTB(type, value, tb, tb_offset=0)
1498 self.InteractiveTB(type, value, tb, tb_offset=0)
1489 if self.InteractiveTB.call_pdb and self.has_readline:
1499 if self.InteractiveTB.call_pdb and self.has_readline:
1490 self.readline.set_completer(self.Completer.complete)
1500 self.readline.set_completer(self.Completer.complete)
1491
1501
1492 def call_alias(self,alias,rest=''):
1502 def call_alias(self,alias,rest=''):
1493 """Call an alias given its name and the rest of the line.
1503 """Call an alias given its name and the rest of the line.
1494
1504
1495 This function MUST be given a proper alias, because it doesn't make
1505 This function MUST be given a proper alias, because it doesn't make
1496 any checks when looking up into the alias table. The caller is
1506 any checks when looking up into the alias table. The caller is
1497 responsible for invoking it only with a valid alias."""
1507 responsible for invoking it only with a valid alias."""
1498
1508
1499 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1509 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1500 nargs,cmd = self.alias_table[alias]
1510 nargs,cmd = self.alias_table[alias]
1501 # Expand the %l special to be the user's input line
1511 # Expand the %l special to be the user's input line
1502 if cmd.find('%l') >= 0:
1512 if cmd.find('%l') >= 0:
1503 cmd = cmd.replace('%l',rest)
1513 cmd = cmd.replace('%l',rest)
1504 rest = ''
1514 rest = ''
1505 if nargs==0:
1515 if nargs==0:
1506 # Simple, argument-less aliases
1516 # Simple, argument-less aliases
1507 cmd = '%s %s' % (cmd,rest)
1517 cmd = '%s %s' % (cmd,rest)
1508 else:
1518 else:
1509 # Handle aliases with positional arguments
1519 # Handle aliases with positional arguments
1510 args = rest.split(None,nargs)
1520 args = rest.split(None,nargs)
1511 if len(args)< nargs:
1521 if len(args)< nargs:
1512 error('Alias <%s> requires %s arguments, %s given.' %
1522 error('Alias <%s> requires %s arguments, %s given.' %
1513 (alias,nargs,len(args)))
1523 (alias,nargs,len(args)))
1514 return
1524 return
1515 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1525 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1516 # Now call the macro, evaluating in the user's namespace
1526 # Now call the macro, evaluating in the user's namespace
1517 try:
1527 try:
1518 self.system(cmd)
1528 self.system(cmd)
1519 except:
1529 except:
1520 self.showtraceback()
1530 self.showtraceback()
1521
1531
1522 def runlines(self,lines):
1532 def runlines(self,lines):
1523 """Run a string of one or more lines of source.
1533 """Run a string of one or more lines of source.
1524
1534
1525 This method is capable of running a string containing multiple source
1535 This method is capable of running a string containing multiple source
1526 lines, as if they had been entered at the IPython prompt. Since it
1536 lines, as if they had been entered at the IPython prompt. Since it
1527 exposes IPython's processing machinery, the given strings can contain
1537 exposes IPython's processing machinery, the given strings can contain
1528 magic calls (%magic), special shell access (!cmd), etc."""
1538 magic calls (%magic), special shell access (!cmd), etc."""
1529
1539
1530 # We must start with a clean buffer, in case this is run from an
1540 # We must start with a clean buffer, in case this is run from an
1531 # interactive IPython session (via a magic, for example).
1541 # interactive IPython session (via a magic, for example).
1532 self.resetbuffer()
1542 self.resetbuffer()
1533 lines = lines.split('\n')
1543 lines = lines.split('\n')
1534 more = 0
1544 more = 0
1535 for line in lines:
1545 for line in lines:
1536 # skip blank lines so we don't mess up the prompt counter, but do
1546 # skip blank lines so we don't mess up the prompt counter, but do
1537 # NOT skip even a blank line if we are in a code block (more is
1547 # NOT skip even a blank line if we are in a code block (more is
1538 # true)
1548 # true)
1539 if line or more:
1549 if line or more:
1540 more = self.push((self.prefilter(line,more)))
1550 more = self.push((self.prefilter(line,more)))
1541 # IPython's runsource returns None if there was an error
1551 # IPython's runsource returns None if there was an error
1542 # compiling the code. This allows us to stop processing right
1552 # compiling the code. This allows us to stop processing right
1543 # away, so the user gets the error message at the right place.
1553 # away, so the user gets the error message at the right place.
1544 if more is None:
1554 if more is None:
1545 break
1555 break
1546 # final newline in case the input didn't have it, so that the code
1556 # final newline in case the input didn't have it, so that the code
1547 # actually does get executed
1557 # actually does get executed
1548 if more:
1558 if more:
1549 self.push('\n')
1559 self.push('\n')
1550
1560
1551 def runsource(self, source, filename="<input>", symbol="single"):
1561 def runsource(self, source, filename="<input>", symbol="single"):
1552 """Compile and run some source in the interpreter.
1562 """Compile and run some source in the interpreter.
1553
1563
1554 Arguments are as for compile_command().
1564 Arguments are as for compile_command().
1555
1565
1556 One several things can happen:
1566 One several things can happen:
1557
1567
1558 1) The input is incorrect; compile_command() raised an
1568 1) The input is incorrect; compile_command() raised an
1559 exception (SyntaxError or OverflowError). A syntax traceback
1569 exception (SyntaxError or OverflowError). A syntax traceback
1560 will be printed by calling the showsyntaxerror() method.
1570 will be printed by calling the showsyntaxerror() method.
1561
1571
1562 2) The input is incomplete, and more input is required;
1572 2) The input is incomplete, and more input is required;
1563 compile_command() returned None. Nothing happens.
1573 compile_command() returned None. Nothing happens.
1564
1574
1565 3) The input is complete; compile_command() returned a code
1575 3) The input is complete; compile_command() returned a code
1566 object. The code is executed by calling self.runcode() (which
1576 object. The code is executed by calling self.runcode() (which
1567 also handles run-time exceptions, except for SystemExit).
1577 also handles run-time exceptions, except for SystemExit).
1568
1578
1569 The return value is:
1579 The return value is:
1570
1580
1571 - True in case 2
1581 - True in case 2
1572
1582
1573 - False in the other cases, unless an exception is raised, where
1583 - False in the other cases, unless an exception is raised, where
1574 None is returned instead. This can be used by external callers to
1584 None is returned instead. This can be used by external callers to
1575 know whether to continue feeding input or not.
1585 know whether to continue feeding input or not.
1576
1586
1577 The return value can be used to decide whether to use sys.ps1 or
1587 The return value can be used to decide whether to use sys.ps1 or
1578 sys.ps2 to prompt the next line."""
1588 sys.ps2 to prompt the next line."""
1579
1589
1580 try:
1590 try:
1581 code = self.compile(source, filename, symbol)
1591 code = self.compile(source, filename, symbol)
1582 except (OverflowError, SyntaxError, ValueError):
1592 except (OverflowError, SyntaxError, ValueError):
1583 # Case 1
1593 # Case 1
1584 self.showsyntaxerror(filename)
1594 self.showsyntaxerror(filename)
1585 return None
1595 return None
1586
1596
1587 if code is None:
1597 if code is None:
1588 # Case 2
1598 # Case 2
1589 return True
1599 return True
1590
1600
1591 # Case 3
1601 # Case 3
1592 # We store the code object so that threaded shells and
1602 # We store the code object so that threaded shells and
1593 # custom exception handlers can access all this info if needed.
1603 # custom exception handlers can access all this info if needed.
1594 # The source corresponding to this can be obtained from the
1604 # The source corresponding to this can be obtained from the
1595 # buffer attribute as '\n'.join(self.buffer).
1605 # buffer attribute as '\n'.join(self.buffer).
1596 self.code_to_run = code
1606 self.code_to_run = code
1597 # now actually execute the code object
1607 # now actually execute the code object
1598 if self.runcode(code) == 0:
1608 if self.runcode(code) == 0:
1599 return False
1609 return False
1600 else:
1610 else:
1601 return None
1611 return None
1602
1612
1603 def runcode(self,code_obj):
1613 def runcode(self,code_obj):
1604 """Execute a code object.
1614 """Execute a code object.
1605
1615
1606 When an exception occurs, self.showtraceback() is called to display a
1616 When an exception occurs, self.showtraceback() is called to display a
1607 traceback.
1617 traceback.
1608
1618
1609 Return value: a flag indicating whether the code to be run completed
1619 Return value: a flag indicating whether the code to be run completed
1610 successfully:
1620 successfully:
1611
1621
1612 - 0: successful execution.
1622 - 0: successful execution.
1613 - 1: an error occurred.
1623 - 1: an error occurred.
1614 """
1624 """
1615
1625
1616 # Set our own excepthook in case the user code tries to call it
1626 # Set our own excepthook in case the user code tries to call it
1617 # directly, so that the IPython crash handler doesn't get triggered
1627 # directly, so that the IPython crash handler doesn't get triggered
1618 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1628 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1619 outflag = 1 # happens in more places, so it's easier as default
1629 outflag = 1 # happens in more places, so it's easier as default
1620 try:
1630 try:
1621 try:
1631 try:
1622 exec code_obj in self.locals
1632 exec code_obj in self.user_global_ns, self.user_ns
1623 finally:
1633 finally:
1624 # Reset our crash handler in place
1634 # Reset our crash handler in place
1625 sys.excepthook = old_excepthook
1635 sys.excepthook = old_excepthook
1626 except SystemExit:
1636 except SystemExit:
1627 self.resetbuffer()
1637 self.resetbuffer()
1628 self.showtraceback()
1638 self.showtraceback()
1629 warn( __builtin__.exit,level=1)
1639 warn( __builtin__.exit,level=1)
1630 except self.custom_exceptions:
1640 except self.custom_exceptions:
1631 etype,value,tb = sys.exc_info()
1641 etype,value,tb = sys.exc_info()
1632 self.CustomTB(etype,value,tb)
1642 self.CustomTB(etype,value,tb)
1633 except:
1643 except:
1634 self.showtraceback()
1644 self.showtraceback()
1635 else:
1645 else:
1636 outflag = 0
1646 outflag = 0
1637 if code.softspace(sys.stdout, 0):
1647 if code.softspace(sys.stdout, 0):
1638 print
1648 print
1639 # Flush out code object which has been run (and source)
1649 # Flush out code object which has been run (and source)
1640 self.code_to_run = None
1650 self.code_to_run = None
1641 return outflag
1651 return outflag
1642
1652
1643 def raw_input(self, prompt=""):
1653 def raw_input(self, prompt=""):
1644 """Write a prompt and read a line.
1654 """Write a prompt and read a line.
1645
1655
1646 The returned line does not include the trailing newline.
1656 The returned line does not include the trailing newline.
1647 When the user enters the EOF key sequence, EOFError is raised.
1657 When the user enters the EOF key sequence, EOFError is raised.
1648
1658
1649 The base implementation uses the built-in function
1659 The base implementation uses the built-in function
1650 raw_input(); a subclass may replace this with a different
1660 raw_input(); a subclass may replace this with a different
1651 implementation.
1661 implementation.
1652 """
1662 """
1653 return self.prefilter(raw_input_original(prompt),
1663 return self.prefilter(raw_input_original(prompt),
1654 prompt==self.outputcache.prompt2)
1664 prompt==self.outputcache.prompt2)
1655
1665
1656 def split_user_input(self,line):
1666 def split_user_input(self,line):
1657 """Split user input into pre-char, function part and rest."""
1667 """Split user input into pre-char, function part and rest."""
1658
1668
1659 lsplit = self.line_split.match(line)
1669 lsplit = self.line_split.match(line)
1660 if lsplit is None: # no regexp match returns None
1670 if lsplit is None: # no regexp match returns None
1661 try:
1671 try:
1662 iFun,theRest = line.split(None,1)
1672 iFun,theRest = line.split(None,1)
1663 except ValueError:
1673 except ValueError:
1664 iFun,theRest = line,''
1674 iFun,theRest = line,''
1665 pre = re.match('^(\s*)(.*)',line).groups()[0]
1675 pre = re.match('^(\s*)(.*)',line).groups()[0]
1666 else:
1676 else:
1667 pre,iFun,theRest = lsplit.groups()
1677 pre,iFun,theRest = lsplit.groups()
1668
1678
1669 #print 'line:<%s>' % line # dbg
1679 #print 'line:<%s>' % line # dbg
1670 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1680 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1671 return pre,iFun.strip(),theRest
1681 return pre,iFun.strip(),theRest
1672
1682
1673 def _prefilter(self, line, continue_prompt):
1683 def _prefilter(self, line, continue_prompt):
1674 """Calls different preprocessors, depending on the form of line."""
1684 """Calls different preprocessors, depending on the form of line."""
1675
1685
1676 # All handlers *must* return a value, even if it's blank ('').
1686 # All handlers *must* return a value, even if it's blank ('').
1677
1687
1678 # Lines are NOT logged here. Handlers should process the line as
1688 # Lines are NOT logged here. Handlers should process the line as
1679 # needed, update the cache AND log it (so that the input cache array
1689 # needed, update the cache AND log it (so that the input cache array
1680 # stays synced).
1690 # stays synced).
1681
1691
1682 # This function is _very_ delicate, and since it's also the one which
1692 # This function is _very_ delicate, and since it's also the one which
1683 # determines IPython's response to user input, it must be as efficient
1693 # determines IPython's response to user input, it must be as efficient
1684 # as possible. For this reason it has _many_ returns in it, trying
1694 # as possible. For this reason it has _many_ returns in it, trying
1685 # always to exit as quickly as it can figure out what it needs to do.
1695 # always to exit as quickly as it can figure out what it needs to do.
1686
1696
1687 # This function is the main responsible for maintaining IPython's
1697 # This function is the main responsible for maintaining IPython's
1688 # behavior respectful of Python's semantics. So be _very_ careful if
1698 # behavior respectful of Python's semantics. So be _very_ careful if
1689 # making changes to anything here.
1699 # making changes to anything here.
1690
1700
1691 #.....................................................................
1701 #.....................................................................
1692 # Code begins
1702 # Code begins
1693
1703
1694 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1704 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1695
1705
1696 # save the line away in case we crash, so the post-mortem handler can
1706 # save the line away in case we crash, so the post-mortem handler can
1697 # record it
1707 # record it
1698 self._last_input_line = line
1708 self._last_input_line = line
1699
1709
1700 #print '***line: <%s>' % line # dbg
1710 #print '***line: <%s>' % line # dbg
1701
1711
1702 # the input history needs to track even empty lines
1712 # the input history needs to track even empty lines
1703 if not line.strip():
1713 if not line.strip():
1704 if not continue_prompt:
1714 if not continue_prompt:
1705 self.outputcache.prompt_count -= 1
1715 self.outputcache.prompt_count -= 1
1706 return self.handle_normal('',continue_prompt)
1716 return self.handle_normal('',continue_prompt)
1707
1717
1708 # print '***cont',continue_prompt # dbg
1718 # print '***cont',continue_prompt # dbg
1709 # special handlers are only allowed for single line statements
1719 # special handlers are only allowed for single line statements
1710 if continue_prompt and not self.rc.multi_line_specials:
1720 if continue_prompt and not self.rc.multi_line_specials:
1711 return self.handle_normal(line,continue_prompt)
1721 return self.handle_normal(line,continue_prompt)
1712
1722
1713 # For the rest, we need the structure of the input
1723 # For the rest, we need the structure of the input
1714 pre,iFun,theRest = self.split_user_input(line)
1724 pre,iFun,theRest = self.split_user_input(line)
1715 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1725 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1716
1726
1717 # First check for explicit escapes in the last/first character
1727 # First check for explicit escapes in the last/first character
1718 handler = None
1728 handler = None
1719 if line[-1] == self.ESC_HELP:
1729 if line[-1] == self.ESC_HELP:
1720 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1730 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1721 if handler is None:
1731 if handler is None:
1722 # look at the first character of iFun, NOT of line, so we skip
1732 # look at the first character of iFun, NOT of line, so we skip
1723 # leading whitespace in multiline input
1733 # leading whitespace in multiline input
1724 handler = self.esc_handlers.get(iFun[0:1])
1734 handler = self.esc_handlers.get(iFun[0:1])
1725 if handler is not None:
1735 if handler is not None:
1726 return handler(line,continue_prompt,pre,iFun,theRest)
1736 return handler(line,continue_prompt,pre,iFun,theRest)
1727 # Emacs ipython-mode tags certain input lines
1737 # Emacs ipython-mode tags certain input lines
1728 if line.endswith('# PYTHON-MODE'):
1738 if line.endswith('# PYTHON-MODE'):
1729 return self.handle_emacs(line,continue_prompt)
1739 return self.handle_emacs(line,continue_prompt)
1730
1740
1731 # Next, check if we can automatically execute this thing
1741 # Next, check if we can automatically execute this thing
1732
1742
1733 # Allow ! in multi-line statements if multi_line_specials is on:
1743 # Allow ! in multi-line statements if multi_line_specials is on:
1734 if continue_prompt and self.rc.multi_line_specials and \
1744 if continue_prompt and self.rc.multi_line_specials and \
1735 iFun.startswith(self.ESC_SHELL):
1745 iFun.startswith(self.ESC_SHELL):
1736 return self.handle_shell_escape(line,continue_prompt,
1746 return self.handle_shell_escape(line,continue_prompt,
1737 pre=pre,iFun=iFun,
1747 pre=pre,iFun=iFun,
1738 theRest=theRest)
1748 theRest=theRest)
1739
1749
1740 # Let's try to find if the input line is a magic fn
1750 # Let's try to find if the input line is a magic fn
1741 oinfo = None
1751 oinfo = None
1742 if hasattr(self,'magic_'+iFun):
1752 if hasattr(self,'magic_'+iFun):
1743 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1753 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1744 if oinfo['ismagic']:
1754 if oinfo['ismagic']:
1745 # Be careful not to call magics when a variable assignment is
1755 # Be careful not to call magics when a variable assignment is
1746 # being made (ls='hi', for example)
1756 # being made (ls='hi', for example)
1747 if self.rc.automagic and \
1757 if self.rc.automagic and \
1748 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1758 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1749 (self.rc.multi_line_specials or not continue_prompt):
1759 (self.rc.multi_line_specials or not continue_prompt):
1750 return self.handle_magic(line,continue_prompt,
1760 return self.handle_magic(line,continue_prompt,
1751 pre,iFun,theRest)
1761 pre,iFun,theRest)
1752 else:
1762 else:
1753 return self.handle_normal(line,continue_prompt)
1763 return self.handle_normal(line,continue_prompt)
1754
1764
1755 # If the rest of the line begins with an (in)equality, assginment or
1765 # If the rest of the line begins with an (in)equality, assginment or
1756 # function call, we should not call _ofind but simply execute it.
1766 # function call, we should not call _ofind but simply execute it.
1757 # This avoids spurious geattr() accesses on objects upon assignment.
1767 # This avoids spurious geattr() accesses on objects upon assignment.
1758 #
1768 #
1759 # It also allows users to assign to either alias or magic names true
1769 # It also allows users to assign to either alias or magic names true
1760 # python variables (the magic/alias systems always take second seat to
1770 # python variables (the magic/alias systems always take second seat to
1761 # true python code).
1771 # true python code).
1762 if theRest and theRest[0] in '!=()':
1772 if theRest and theRest[0] in '!=()':
1763 return self.handle_normal(line,continue_prompt)
1773 return self.handle_normal(line,continue_prompt)
1764
1774
1765 if oinfo is None:
1775 if oinfo is None:
1766 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1776 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1767
1777
1768 if not oinfo['found']:
1778 if not oinfo['found']:
1769 return self.handle_normal(line,continue_prompt)
1779 return self.handle_normal(line,continue_prompt)
1770 else:
1780 else:
1771 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1781 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1772 if oinfo['isalias']:
1782 if oinfo['isalias']:
1773 return self.handle_alias(line,continue_prompt,
1783 return self.handle_alias(line,continue_prompt,
1774 pre,iFun,theRest)
1784 pre,iFun,theRest)
1775
1785
1776 if self.rc.autocall and \
1786 if self.rc.autocall and \
1777 not self.re_exclude_auto.match(theRest) and \
1787 not self.re_exclude_auto.match(theRest) and \
1778 self.re_fun_name.match(iFun) and \
1788 self.re_fun_name.match(iFun) and \
1779 callable(oinfo['obj']) :
1789 callable(oinfo['obj']) :
1780 #print 'going auto' # dbg
1790 #print 'going auto' # dbg
1781 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1791 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1782 else:
1792 else:
1783 #print 'was callable?', callable(oinfo['obj']) # dbg
1793 #print 'was callable?', callable(oinfo['obj']) # dbg
1784 return self.handle_normal(line,continue_prompt)
1794 return self.handle_normal(line,continue_prompt)
1785
1795
1786 # If we get here, we have a normal Python line. Log and return.
1796 # If we get here, we have a normal Python line. Log and return.
1787 return self.handle_normal(line,continue_prompt)
1797 return self.handle_normal(line,continue_prompt)
1788
1798
1789 def _prefilter_dumb(self, line, continue_prompt):
1799 def _prefilter_dumb(self, line, continue_prompt):
1790 """simple prefilter function, for debugging"""
1800 """simple prefilter function, for debugging"""
1791 return self.handle_normal(line,continue_prompt)
1801 return self.handle_normal(line,continue_prompt)
1792
1802
1793 # Set the default prefilter() function (this can be user-overridden)
1803 # Set the default prefilter() function (this can be user-overridden)
1794 prefilter = _prefilter
1804 prefilter = _prefilter
1795
1805
1796 def handle_normal(self,line,continue_prompt=None,
1806 def handle_normal(self,line,continue_prompt=None,
1797 pre=None,iFun=None,theRest=None):
1807 pre=None,iFun=None,theRest=None):
1798 """Handle normal input lines. Use as a template for handlers."""
1808 """Handle normal input lines. Use as a template for handlers."""
1799
1809
1800 self.log(line,continue_prompt)
1810 self.log(line,continue_prompt)
1801 self.update_cache(line)
1811 self.update_cache(line)
1802 return line
1812 return line
1803
1813
1804 def handle_alias(self,line,continue_prompt=None,
1814 def handle_alias(self,line,continue_prompt=None,
1805 pre=None,iFun=None,theRest=None):
1815 pre=None,iFun=None,theRest=None):
1806 """Handle alias input lines. """
1816 """Handle alias input lines. """
1807
1817
1808 theRest = esc_quotes(theRest)
1818 theRest = esc_quotes(theRest)
1809 line_out = "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest)
1819 line_out = "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest)
1810 self.log(line_out,continue_prompt)
1820 self.log(line_out,continue_prompt)
1811 self.update_cache(line_out)
1821 self.update_cache(line_out)
1812 return line_out
1822 return line_out
1813
1823
1814 def handle_shell_escape(self, line, continue_prompt=None,
1824 def handle_shell_escape(self, line, continue_prompt=None,
1815 pre=None,iFun=None,theRest=None):
1825 pre=None,iFun=None,theRest=None):
1816 """Execute the line in a shell, empty return value"""
1826 """Execute the line in a shell, empty return value"""
1817
1827
1818 #print 'line in :', `line` # dbg
1828 #print 'line in :', `line` # dbg
1819 # Example of a special handler. Others follow a similar pattern.
1829 # Example of a special handler. Others follow a similar pattern.
1820 if continue_prompt: # multi-line statements
1830 if continue_prompt: # multi-line statements
1821 if iFun.startswith('!!'):
1831 if iFun.startswith('!!'):
1822 print 'SyntaxError: !! is not allowed in multiline statements'
1832 print 'SyntaxError: !! is not allowed in multiline statements'
1823 return pre
1833 return pre
1824 else:
1834 else:
1825 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1835 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1826 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1836 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1827 #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')'
1837 #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')'
1828 else: # single-line input
1838 else: # single-line input
1829 if line.startswith('!!'):
1839 if line.startswith('!!'):
1830 # rewrite iFun/theRest to properly hold the call to %sx and
1840 # rewrite iFun/theRest to properly hold the call to %sx and
1831 # the actual command to be executed, so handle_magic can work
1841 # the actual command to be executed, so handle_magic can work
1832 # correctly
1842 # correctly
1833 theRest = '%s %s' % (iFun[2:],theRest)
1843 theRest = '%s %s' % (iFun[2:],theRest)
1834 iFun = 'sx'
1844 iFun = 'sx'
1835 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1845 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1836 continue_prompt,pre,iFun,theRest)
1846 continue_prompt,pre,iFun,theRest)
1837 else:
1847 else:
1838 cmd = esc_quotes(line[1:])
1848 cmd = esc_quotes(line[1:])
1839 line_out = '%s.system("%s")' % (self.name,cmd)
1849 line_out = '%s.system("%s")' % (self.name,cmd)
1840 #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')'
1850 #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')'
1841 # update cache/log and return
1851 # update cache/log and return
1842 self.log(line_out,continue_prompt)
1852 self.log(line_out,continue_prompt)
1843 self.update_cache(line_out) # readline cache gets normal line
1853 self.update_cache(line_out) # readline cache gets normal line
1844 #print 'line out r:', `line_out` # dbg
1854 #print 'line out r:', `line_out` # dbg
1845 #print 'line out s:', line_out # dbg
1855 #print 'line out s:', line_out # dbg
1846 return line_out
1856 return line_out
1847
1857
1848 def handle_magic(self, line, continue_prompt=None,
1858 def handle_magic(self, line, continue_prompt=None,
1849 pre=None,iFun=None,theRest=None):
1859 pre=None,iFun=None,theRest=None):
1850 """Execute magic functions.
1860 """Execute magic functions.
1851
1861
1852 Also log them with a prepended # so the log is clean Python."""
1862 Also log them with a prepended # so the log is clean Python."""
1853
1863
1854 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1864 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1855 self.log(cmd,continue_prompt)
1865 self.log(cmd,continue_prompt)
1856 self.update_cache(line)
1866 self.update_cache(line)
1857 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1867 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1858 return cmd
1868 return cmd
1859
1869
1860 def handle_auto(self, line, continue_prompt=None,
1870 def handle_auto(self, line, continue_prompt=None,
1861 pre=None,iFun=None,theRest=None):
1871 pre=None,iFun=None,theRest=None):
1862 """Hande lines which can be auto-executed, quoting if requested."""
1872 """Hande lines which can be auto-executed, quoting if requested."""
1863
1873
1864 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1874 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1865
1875
1866 # This should only be active for single-line input!
1876 # This should only be active for single-line input!
1867 if continue_prompt:
1877 if continue_prompt:
1868 return line
1878 return line
1869
1879
1870 if pre == self.ESC_QUOTE:
1880 if pre == self.ESC_QUOTE:
1871 # Auto-quote splitting on whitespace
1881 # Auto-quote splitting on whitespace
1872 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1882 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1873 elif pre == self.ESC_QUOTE2:
1883 elif pre == self.ESC_QUOTE2:
1874 # Auto-quote whole string
1884 # Auto-quote whole string
1875 newcmd = '%s("%s")' % (iFun,theRest)
1885 newcmd = '%s("%s")' % (iFun,theRest)
1876 else:
1886 else:
1877 # Auto-paren
1887 # Auto-paren
1878 if theRest[0:1] in ('=','['):
1888 if theRest[0:1] in ('=','['):
1879 # Don't autocall in these cases. They can be either
1889 # Don't autocall in these cases. They can be either
1880 # rebindings of an existing callable's name, or item access
1890 # rebindings of an existing callable's name, or item access
1881 # for an object which is BOTH callable and implements
1891 # for an object which is BOTH callable and implements
1882 # __getitem__.
1892 # __getitem__.
1883 return '%s %s' % (iFun,theRest)
1893 return '%s %s' % (iFun,theRest)
1884 if theRest.endswith(';'):
1894 if theRest.endswith(';'):
1885 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1895 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1886 else:
1896 else:
1887 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1897 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1888
1898
1889 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1899 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1890 # log what is now valid Python, not the actual user input (without the
1900 # log what is now valid Python, not the actual user input (without the
1891 # final newline)
1901 # final newline)
1892 self.log(newcmd,continue_prompt)
1902 self.log(newcmd,continue_prompt)
1893 return newcmd
1903 return newcmd
1894
1904
1895 def handle_help(self, line, continue_prompt=None,
1905 def handle_help(self, line, continue_prompt=None,
1896 pre=None,iFun=None,theRest=None):
1906 pre=None,iFun=None,theRest=None):
1897 """Try to get some help for the object.
1907 """Try to get some help for the object.
1898
1908
1899 obj? or ?obj -> basic information.
1909 obj? or ?obj -> basic information.
1900 obj?? or ??obj -> more details.
1910 obj?? or ??obj -> more details.
1901 """
1911 """
1902
1912
1903 # We need to make sure that we don't process lines which would be
1913 # We need to make sure that we don't process lines which would be
1904 # otherwise valid python, such as "x=1 # what?"
1914 # otherwise valid python, such as "x=1 # what?"
1905 try:
1915 try:
1906 code.compile_command(line)
1916 code.compile_command(line)
1907 except SyntaxError:
1917 except SyntaxError:
1908 # We should only handle as help stuff which is NOT valid syntax
1918 # We should only handle as help stuff which is NOT valid syntax
1909 if line[0]==self.ESC_HELP:
1919 if line[0]==self.ESC_HELP:
1910 line = line[1:]
1920 line = line[1:]
1911 elif line[-1]==self.ESC_HELP:
1921 elif line[-1]==self.ESC_HELP:
1912 line = line[:-1]
1922 line = line[:-1]
1913 self.log('#?'+line)
1923 self.log('#?'+line)
1914 self.update_cache(line)
1924 self.update_cache(line)
1915 if line:
1925 if line:
1916 self.magic_pinfo(line)
1926 self.magic_pinfo(line)
1917 else:
1927 else:
1918 page(self.usage,screen_lines=self.rc.screen_length)
1928 page(self.usage,screen_lines=self.rc.screen_length)
1919 return '' # Empty string is needed here!
1929 return '' # Empty string is needed here!
1920 except:
1930 except:
1921 # Pass any other exceptions through to the normal handler
1931 # Pass any other exceptions through to the normal handler
1922 return self.handle_normal(line,continue_prompt)
1932 return self.handle_normal(line,continue_prompt)
1923 else:
1933 else:
1924 # If the code compiles ok, we should handle it normally
1934 # If the code compiles ok, we should handle it normally
1925 return self.handle_normal(line,continue_prompt)
1935 return self.handle_normal(line,continue_prompt)
1926
1936
1927 def handle_emacs(self,line,continue_prompt=None,
1937 def handle_emacs(self,line,continue_prompt=None,
1928 pre=None,iFun=None,theRest=None):
1938 pre=None,iFun=None,theRest=None):
1929 """Handle input lines marked by python-mode."""
1939 """Handle input lines marked by python-mode."""
1930
1940
1931 # Currently, nothing is done. Later more functionality can be added
1941 # Currently, nothing is done. Later more functionality can be added
1932 # here if needed.
1942 # here if needed.
1933
1943
1934 # The input cache shouldn't be updated
1944 # The input cache shouldn't be updated
1935
1945
1936 return line
1946 return line
1937
1947
1938 def write(self,data):
1948 def write(self,data):
1939 """Write a string to the default output"""
1949 """Write a string to the default output"""
1940 Term.cout.write(data)
1950 Term.cout.write(data)
1941
1951
1942 def write_err(self,data):
1952 def write_err(self,data):
1943 """Write a string to the default error output"""
1953 """Write a string to the default error output"""
1944 Term.cerr.write(data)
1954 Term.cerr.write(data)
1945
1955
1946 def safe_execfile(self,fname,*where,**kw):
1956 def safe_execfile(self,fname,*where,**kw):
1947 fname = os.path.expanduser(fname)
1957 fname = os.path.expanduser(fname)
1948
1958
1949 # find things also in current directory
1959 # find things also in current directory
1950 dname = os.path.dirname(fname)
1960 dname = os.path.dirname(fname)
1951 if not sys.path.count(dname):
1961 if not sys.path.count(dname):
1952 sys.path.append(dname)
1962 sys.path.append(dname)
1953
1963
1954 try:
1964 try:
1955 xfile = open(fname)
1965 xfile = open(fname)
1956 except:
1966 except:
1957 print >> Term.cerr, \
1967 print >> Term.cerr, \
1958 'Could not open file <%s> for safe execution.' % fname
1968 'Could not open file <%s> for safe execution.' % fname
1959 return None
1969 return None
1960
1970
1961 kw.setdefault('islog',0)
1971 kw.setdefault('islog',0)
1962 kw.setdefault('quiet',1)
1972 kw.setdefault('quiet',1)
1963 kw.setdefault('exit_ignore',0)
1973 kw.setdefault('exit_ignore',0)
1964 first = xfile.readline()
1974 first = xfile.readline()
1965 _LOGHEAD = str(self.LOGHEAD).split('\n',1)[0].strip()
1975 _LOGHEAD = str(self.LOGHEAD).split('\n',1)[0].strip()
1966 xfile.close()
1976 xfile.close()
1967 # line by line execution
1977 # line by line execution
1968 if first.startswith(_LOGHEAD) or kw['islog']:
1978 if first.startswith(_LOGHEAD) or kw['islog']:
1969 print 'Loading log file <%s> one line at a time...' % fname
1979 print 'Loading log file <%s> one line at a time...' % fname
1970 if kw['quiet']:
1980 if kw['quiet']:
1971 stdout_save = sys.stdout
1981 stdout_save = sys.stdout
1972 sys.stdout = StringIO.StringIO()
1982 sys.stdout = StringIO.StringIO()
1973 try:
1983 try:
1974 globs,locs = where[0:2]
1984 globs,locs = where[0:2]
1975 except:
1985 except:
1976 try:
1986 try:
1977 globs = locs = where[0]
1987 globs = locs = where[0]
1978 except:
1988 except:
1979 globs = locs = globals()
1989 globs = locs = globals()
1980 badblocks = []
1990 badblocks = []
1981
1991
1982 # we also need to identify indented blocks of code when replaying
1992 # we also need to identify indented blocks of code when replaying
1983 # logs and put them together before passing them to an exec
1993 # logs and put them together before passing them to an exec
1984 # statement. This takes a bit of regexp and look-ahead work in the
1994 # statement. This takes a bit of regexp and look-ahead work in the
1985 # file. It's easiest if we swallow the whole thing in memory
1995 # file. It's easiest if we swallow the whole thing in memory
1986 # first, and manually walk through the lines list moving the
1996 # first, and manually walk through the lines list moving the
1987 # counter ourselves.
1997 # counter ourselves.
1988 indent_re = re.compile('\s+\S')
1998 indent_re = re.compile('\s+\S')
1989 xfile = open(fname)
1999 xfile = open(fname)
1990 filelines = xfile.readlines()
2000 filelines = xfile.readlines()
1991 xfile.close()
2001 xfile.close()
1992 nlines = len(filelines)
2002 nlines = len(filelines)
1993 lnum = 0
2003 lnum = 0
1994 while lnum < nlines:
2004 while lnum < nlines:
1995 line = filelines[lnum]
2005 line = filelines[lnum]
1996 lnum += 1
2006 lnum += 1
1997 # don't re-insert logger status info into cache
2007 # don't re-insert logger status info into cache
1998 if line.startswith('#log#'):
2008 if line.startswith('#log#'):
1999 continue
2009 continue
2000 elif line.startswith('#%s'% self.ESC_MAGIC):
2010 elif line.startswith('#%s'% self.ESC_MAGIC):
2001 self.update_cache(line[1:])
2011 self.update_cache(line[1:])
2002 line = magic2python(line)
2012 line = magic2python(line)
2003 elif line.startswith('#!'):
2013 elif line.startswith('#!'):
2004 self.update_cache(line[1:])
2014 self.update_cache(line[1:])
2005 else:
2015 else:
2006 # build a block of code (maybe a single line) for execution
2016 # build a block of code (maybe a single line) for execution
2007 block = line
2017 block = line
2008 try:
2018 try:
2009 next = filelines[lnum] # lnum has already incremented
2019 next = filelines[lnum] # lnum has already incremented
2010 except:
2020 except:
2011 next = None
2021 next = None
2012 while next and indent_re.match(next):
2022 while next and indent_re.match(next):
2013 block += next
2023 block += next
2014 lnum += 1
2024 lnum += 1
2015 try:
2025 try:
2016 next = filelines[lnum]
2026 next = filelines[lnum]
2017 except:
2027 except:
2018 next = None
2028 next = None
2019 # now execute the block of one or more lines
2029 # now execute the block of one or more lines
2020 try:
2030 try:
2021 exec block in globs,locs
2031 exec block in globs,locs
2022 self.update_cache(block.rstrip())
2032 self.update_cache(block.rstrip())
2023 except SystemExit:
2033 except SystemExit:
2024 pass
2034 pass
2025 except:
2035 except:
2026 badblocks.append(block.rstrip())
2036 badblocks.append(block.rstrip())
2027 if kw['quiet']: # restore stdout
2037 if kw['quiet']: # restore stdout
2028 sys.stdout.close()
2038 sys.stdout.close()
2029 sys.stdout = stdout_save
2039 sys.stdout = stdout_save
2030 print 'Finished replaying log file <%s>' % fname
2040 print 'Finished replaying log file <%s>' % fname
2031 if badblocks:
2041 if badblocks:
2032 print >> sys.stderr, \
2042 print >> sys.stderr, \
2033 '\nThe following lines/blocks in file <%s> reported errors:' \
2043 '\nThe following lines/blocks in file <%s> reported errors:' \
2034 % fname
2044 % fname
2035 for badline in badblocks:
2045 for badline in badblocks:
2036 print >> sys.stderr, badline
2046 print >> sys.stderr, badline
2037 else: # regular file execution
2047 else: # regular file execution
2038 try:
2048 try:
2039 execfile(fname,*where)
2049 execfile(fname,*where)
2040 except SyntaxError:
2050 except SyntaxError:
2041 etype, evalue = sys.exc_info()[0:2]
2051 etype, evalue = sys.exc_info()[0:2]
2042 self.SyntaxTB(etype,evalue,[])
2052 self.SyntaxTB(etype,evalue,[])
2043 warn('Failure executing file: <%s>' % fname)
2053 warn('Failure executing file: <%s>' % fname)
2044 except SystemExit,status:
2054 except SystemExit,status:
2045 if not kw['exit_ignore']:
2055 if not kw['exit_ignore']:
2046 self.InteractiveTB()
2056 self.InteractiveTB()
2047 warn('Failure executing file: <%s>' % fname)
2057 warn('Failure executing file: <%s>' % fname)
2048 except:
2058 except:
2049 self.InteractiveTB()
2059 self.InteractiveTB()
2050 warn('Failure executing file: <%s>' % fname)
2060 warn('Failure executing file: <%s>' % fname)
2051
2061
2052 #************************* end of file <iplib.py> *****************************
2062 #************************* end of file <iplib.py> *****************************
@@ -1,4430 +1,4443 b''
1 2005-11-12 <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
4 embedded instances. I added a user_global_ns attribute to the
5 InteractiveShell class to handle this.
6
7 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
8
9 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
10 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
11 (reported under win32, but may happen also in other platforms).
12 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
13
1 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
14 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2
15
3 * IPython/Magic.py (magic_psearch): new support for wildcard
16 * IPython/Magic.py (magic_psearch): new support for wildcard
4 patterns. Now, typing ?a*b will list all names which begin with a
17 patterns. Now, typing ?a*b will list all names which begin with a
5 and end in b, for example. The %psearch magic has full
18 and end in b, for example. The %psearch magic has full
6 docstrings. Many thanks to JΓΆrgen Stenarson
19 docstrings. Many thanks to JΓΆrgen Stenarson
7 <jorgen.stenarson-AT-bostream.nu>, author of the patches
20 <jorgen.stenarson-AT-bostream.nu>, author of the patches
8 implementing this functionality.
21 implementing this functionality.
9
22
10 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
23 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
11
24
12 * Manual: fixed long-standing annoyance of double-dashes (as in
25 * Manual: fixed long-standing annoyance of double-dashes (as in
13 --prefix=~, for example) being stripped in the HTML version. This
26 --prefix=~, for example) being stripped in the HTML version. This
14 is a latex2html bug, but a workaround was provided. Many thanks
27 is a latex2html bug, but a workaround was provided. Many thanks
15 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
28 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
16 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
29 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
17 rolling. This seemingly small issue had tripped a number of users
30 rolling. This seemingly small issue had tripped a number of users
18 when first installing, so I'm glad to see it gone.
31 when first installing, so I'm glad to see it gone.
19
32
20 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
33 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
21
34
22 * IPython/Extensions/numeric_formats.py: fix missing import,
35 * IPython/Extensions/numeric_formats.py: fix missing import,
23 reported by Stephen Walton.
36 reported by Stephen Walton.
24
37
25 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
38 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
26
39
27 * IPython/demo.py: finish demo module, fully documented now.
40 * IPython/demo.py: finish demo module, fully documented now.
28
41
29 * IPython/genutils.py (file_read): simple little utility to read a
42 * IPython/genutils.py (file_read): simple little utility to read a
30 file and ensure it's closed afterwards.
43 file and ensure it's closed afterwards.
31
44
32 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
45 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
33
46
34 * IPython/demo.py (Demo.__init__): added support for individually
47 * IPython/demo.py (Demo.__init__): added support for individually
35 tagging blocks for automatic execution.
48 tagging blocks for automatic execution.
36
49
37 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
50 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
38 syntax-highlighted python sources, requested by John.
51 syntax-highlighted python sources, requested by John.
39
52
40 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
53 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
41
54
42 * IPython/demo.py (Demo.again): fix bug where again() blocks after
55 * IPython/demo.py (Demo.again): fix bug where again() blocks after
43 finishing.
56 finishing.
44
57
45 * IPython/genutils.py (shlex_split): moved from Magic to here,
58 * IPython/genutils.py (shlex_split): moved from Magic to here,
46 where all 2.2 compatibility stuff lives. I needed it for demo.py.
59 where all 2.2 compatibility stuff lives. I needed it for demo.py.
47
60
48 * IPython/demo.py (Demo.__init__): added support for silent
61 * IPython/demo.py (Demo.__init__): added support for silent
49 blocks, improved marks as regexps, docstrings written.
62 blocks, improved marks as regexps, docstrings written.
50 (Demo.__init__): better docstring, added support for sys.argv.
63 (Demo.__init__): better docstring, added support for sys.argv.
51
64
52 * IPython/genutils.py (marquee): little utility used by the demo
65 * IPython/genutils.py (marquee): little utility used by the demo
53 code, handy in general.
66 code, handy in general.
54
67
55 * IPython/demo.py (Demo.__init__): new class for interactive
68 * IPython/demo.py (Demo.__init__): new class for interactive
56 demos. Not documented yet, I just wrote it in a hurry for
69 demos. Not documented yet, I just wrote it in a hurry for
57 scipy'05. Will docstring later.
70 scipy'05. Will docstring later.
58
71
59 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
72 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
60
73
61 * IPython/Shell.py (sigint_handler): Drastic simplification which
74 * IPython/Shell.py (sigint_handler): Drastic simplification which
62 also seems to make Ctrl-C work correctly across threads! This is
75 also seems to make Ctrl-C work correctly across threads! This is
63 so simple, that I can't beleive I'd missed it before. Needs more
76 so simple, that I can't beleive I'd missed it before. Needs more
64 testing, though.
77 testing, though.
65 (KBINT): Never mind, revert changes. I'm sure I'd tried something
78 (KBINT): Never mind, revert changes. I'm sure I'd tried something
66 like this before...
79 like this before...
67
80
68 * IPython/genutils.py (get_home_dir): add protection against
81 * IPython/genutils.py (get_home_dir): add protection against
69 non-dirs in win32 registry.
82 non-dirs in win32 registry.
70
83
71 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
84 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
72 bug where dict was mutated while iterating (pysh crash).
85 bug where dict was mutated while iterating (pysh crash).
73
86
74 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
87 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
75
88
76 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
89 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
77 spurious newlines added by this routine. After a report by
90 spurious newlines added by this routine. After a report by
78 F. Mantegazza.
91 F. Mantegazza.
79
92
80 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
93 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
81
94
82 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
95 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
83 calls. These were a leftover from the GTK 1.x days, and can cause
96 calls. These were a leftover from the GTK 1.x days, and can cause
84 problems in certain cases (after a report by John Hunter).
97 problems in certain cases (after a report by John Hunter).
85
98
86 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
99 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
87 os.getcwd() fails at init time. Thanks to patch from David Remahl
100 os.getcwd() fails at init time. Thanks to patch from David Remahl
88 <chmod007-AT-mac.com>.
101 <chmod007-AT-mac.com>.
89 (InteractiveShell.__init__): prevent certain special magics from
102 (InteractiveShell.__init__): prevent certain special magics from
90 being shadowed by aliases. Closes
103 being shadowed by aliases. Closes
91 http://www.scipy.net/roundup/ipython/issue41.
104 http://www.scipy.net/roundup/ipython/issue41.
92
105
93 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
106 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
94
107
95 * IPython/iplib.py (InteractiveShell.complete): Added new
108 * IPython/iplib.py (InteractiveShell.complete): Added new
96 top-level completion method to expose the completion mechanism
109 top-level completion method to expose the completion mechanism
97 beyond readline-based environments.
110 beyond readline-based environments.
98
111
99 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
112 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
100
113
101 * tools/ipsvnc (svnversion): fix svnversion capture.
114 * tools/ipsvnc (svnversion): fix svnversion capture.
102
115
103 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
116 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
104 attribute to self, which was missing. Before, it was set by a
117 attribute to self, which was missing. Before, it was set by a
105 routine which in certain cases wasn't being called, so the
118 routine which in certain cases wasn't being called, so the
106 instance could end up missing the attribute. This caused a crash.
119 instance could end up missing the attribute. This caused a crash.
107 Closes http://www.scipy.net/roundup/ipython/issue40.
120 Closes http://www.scipy.net/roundup/ipython/issue40.
108
121
109 2005-08-16 Fernando Perez <fperez@colorado.edu>
122 2005-08-16 Fernando Perez <fperez@colorado.edu>
110
123
111 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
124 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
112 contains non-string attribute. Closes
125 contains non-string attribute. Closes
113 http://www.scipy.net/roundup/ipython/issue38.
126 http://www.scipy.net/roundup/ipython/issue38.
114
127
115 2005-08-14 Fernando Perez <fperez@colorado.edu>
128 2005-08-14 Fernando Perez <fperez@colorado.edu>
116
129
117 * tools/ipsvnc: Minor improvements, to add changeset info.
130 * tools/ipsvnc: Minor improvements, to add changeset info.
118
131
119 2005-08-12 Fernando Perez <fperez@colorado.edu>
132 2005-08-12 Fernando Perez <fperez@colorado.edu>
120
133
121 * IPython/iplib.py (runsource): remove self.code_to_run_src
134 * IPython/iplib.py (runsource): remove self.code_to_run_src
122 attribute. I realized this is nothing more than
135 attribute. I realized this is nothing more than
123 '\n'.join(self.buffer), and having the same data in two different
136 '\n'.join(self.buffer), and having the same data in two different
124 places is just asking for synchronization bugs. This may impact
137 places is just asking for synchronization bugs. This may impact
125 people who have custom exception handlers, so I need to warn
138 people who have custom exception handlers, so I need to warn
126 ipython-dev about it (F. Mantegazza may use them).
139 ipython-dev about it (F. Mantegazza may use them).
127
140
128 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
141 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
129
142
130 * IPython/genutils.py: fix 2.2 compatibility (generators)
143 * IPython/genutils.py: fix 2.2 compatibility (generators)
131
144
132 2005-07-18 Fernando Perez <fperez@colorado.edu>
145 2005-07-18 Fernando Perez <fperez@colorado.edu>
133
146
134 * IPython/genutils.py (get_home_dir): fix to help users with
147 * IPython/genutils.py (get_home_dir): fix to help users with
135 invalid $HOME under win32.
148 invalid $HOME under win32.
136
149
137 2005-07-17 Fernando Perez <fperez@colorado.edu>
150 2005-07-17 Fernando Perez <fperez@colorado.edu>
138
151
139 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
152 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
140 some old hacks and clean up a bit other routines; code should be
153 some old hacks and clean up a bit other routines; code should be
141 simpler and a bit faster.
154 simpler and a bit faster.
142
155
143 * IPython/iplib.py (interact): removed some last-resort attempts
156 * IPython/iplib.py (interact): removed some last-resort attempts
144 to survive broken stdout/stderr. That code was only making it
157 to survive broken stdout/stderr. That code was only making it
145 harder to abstract out the i/o (necessary for gui integration),
158 harder to abstract out the i/o (necessary for gui integration),
146 and the crashes it could prevent were extremely rare in practice
159 and the crashes it could prevent were extremely rare in practice
147 (besides being fully user-induced in a pretty violent manner).
160 (besides being fully user-induced in a pretty violent manner).
148
161
149 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
162 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
150 Nothing major yet, but the code is simpler to read; this should
163 Nothing major yet, but the code is simpler to read; this should
151 make it easier to do more serious modifications in the future.
164 make it easier to do more serious modifications in the future.
152
165
153 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
166 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
154 which broke in .15 (thanks to a report by Ville).
167 which broke in .15 (thanks to a report by Ville).
155
168
156 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
169 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
157 be quite correct, I know next to nothing about unicode). This
170 be quite correct, I know next to nothing about unicode). This
158 will allow unicode strings to be used in prompts, amongst other
171 will allow unicode strings to be used in prompts, amongst other
159 cases. It also will prevent ipython from crashing when unicode
172 cases. It also will prevent ipython from crashing when unicode
160 shows up unexpectedly in many places. If ascii encoding fails, we
173 shows up unexpectedly in many places. If ascii encoding fails, we
161 assume utf_8. Currently the encoding is not a user-visible
174 assume utf_8. Currently the encoding is not a user-visible
162 setting, though it could be made so if there is demand for it.
175 setting, though it could be made so if there is demand for it.
163
176
164 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
177 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
165
178
166 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
179 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
167
180
168 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
181 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
169
182
170 * IPython/genutils.py: Add 2.2 compatibility here, so all other
183 * IPython/genutils.py: Add 2.2 compatibility here, so all other
171 code can work transparently for 2.2/2.3.
184 code can work transparently for 2.2/2.3.
172
185
173 2005-07-16 Fernando Perez <fperez@colorado.edu>
186 2005-07-16 Fernando Perez <fperez@colorado.edu>
174
187
175 * IPython/ultraTB.py (ExceptionColors): Make a global variable
188 * IPython/ultraTB.py (ExceptionColors): Make a global variable
176 out of the color scheme table used for coloring exception
189 out of the color scheme table used for coloring exception
177 tracebacks. This allows user code to add new schemes at runtime.
190 tracebacks. This allows user code to add new schemes at runtime.
178 This is a minimally modified version of the patch at
191 This is a minimally modified version of the patch at
179 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
192 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
180 for the contribution.
193 for the contribution.
181
194
182 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
195 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
183 slightly modified version of the patch in
196 slightly modified version of the patch in
184 http://www.scipy.net/roundup/ipython/issue34, which also allows me
197 http://www.scipy.net/roundup/ipython/issue34, which also allows me
185 to remove the previous try/except solution (which was costlier).
198 to remove the previous try/except solution (which was costlier).
186 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
199 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
187
200
188 2005-06-08 Fernando Perez <fperez@colorado.edu>
201 2005-06-08 Fernando Perez <fperez@colorado.edu>
189
202
190 * IPython/iplib.py (write/write_err): Add methods to abstract all
203 * IPython/iplib.py (write/write_err): Add methods to abstract all
191 I/O a bit more.
204 I/O a bit more.
192
205
193 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
206 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
194 warning, reported by Aric Hagberg, fix by JD Hunter.
207 warning, reported by Aric Hagberg, fix by JD Hunter.
195
208
196 2005-06-02 *** Released version 0.6.15
209 2005-06-02 *** Released version 0.6.15
197
210
198 2005-06-01 Fernando Perez <fperez@colorado.edu>
211 2005-06-01 Fernando Perez <fperez@colorado.edu>
199
212
200 * IPython/iplib.py (MagicCompleter.file_matches): Fix
213 * IPython/iplib.py (MagicCompleter.file_matches): Fix
201 tab-completion of filenames within open-quoted strings. Note that
214 tab-completion of filenames within open-quoted strings. Note that
202 this requires that in ~/.ipython/ipythonrc, users change the
215 this requires that in ~/.ipython/ipythonrc, users change the
203 readline delimiters configuration to read:
216 readline delimiters configuration to read:
204
217
205 readline_remove_delims -/~
218 readline_remove_delims -/~
206
219
207
220
208 2005-05-31 *** Released version 0.6.14
221 2005-05-31 *** Released version 0.6.14
209
222
210 2005-05-29 Fernando Perez <fperez@colorado.edu>
223 2005-05-29 Fernando Perez <fperez@colorado.edu>
211
224
212 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
225 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
213 with files not on the filesystem. Reported by Eliyahu Sandler
226 with files not on the filesystem. Reported by Eliyahu Sandler
214 <eli@gondolin.net>
227 <eli@gondolin.net>
215
228
216 2005-05-22 Fernando Perez <fperez@colorado.edu>
229 2005-05-22 Fernando Perez <fperez@colorado.edu>
217
230
218 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
231 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
219 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
232 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
220
233
221 2005-05-19 Fernando Perez <fperez@colorado.edu>
234 2005-05-19 Fernando Perez <fperez@colorado.edu>
222
235
223 * IPython/iplib.py (safe_execfile): close a file which could be
236 * IPython/iplib.py (safe_execfile): close a file which could be
224 left open (causing problems in win32, which locks open files).
237 left open (causing problems in win32, which locks open files).
225 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
238 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
226
239
227 2005-05-18 Fernando Perez <fperez@colorado.edu>
240 2005-05-18 Fernando Perez <fperez@colorado.edu>
228
241
229 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
242 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
230 keyword arguments correctly to safe_execfile().
243 keyword arguments correctly to safe_execfile().
231
244
232 2005-05-13 Fernando Perez <fperez@colorado.edu>
245 2005-05-13 Fernando Perez <fperez@colorado.edu>
233
246
234 * ipython.1: Added info about Qt to manpage, and threads warning
247 * ipython.1: Added info about Qt to manpage, and threads warning
235 to usage page (invoked with --help).
248 to usage page (invoked with --help).
236
249
237 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
250 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
238 new matcher (it goes at the end of the priority list) to do
251 new matcher (it goes at the end of the priority list) to do
239 tab-completion on named function arguments. Submitted by George
252 tab-completion on named function arguments. Submitted by George
240 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
253 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
241 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
254 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
242 for more details.
255 for more details.
243
256
244 * IPython/Magic.py (magic_run): Added new -e flag to ignore
257 * IPython/Magic.py (magic_run): Added new -e flag to ignore
245 SystemExit exceptions in the script being run. Thanks to a report
258 SystemExit exceptions in the script being run. Thanks to a report
246 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
259 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
247 producing very annoying behavior when running unit tests.
260 producing very annoying behavior when running unit tests.
248
261
249 2005-05-12 Fernando Perez <fperez@colorado.edu>
262 2005-05-12 Fernando Perez <fperez@colorado.edu>
250
263
251 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
264 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
252 which I'd broken (again) due to a changed regexp. In the process,
265 which I'd broken (again) due to a changed regexp. In the process,
253 added ';' as an escape to auto-quote the whole line without
266 added ';' as an escape to auto-quote the whole line without
254 splitting its arguments. Thanks to a report by Jerry McRae
267 splitting its arguments. Thanks to a report by Jerry McRae
255 <qrs0xyc02-AT-sneakemail.com>.
268 <qrs0xyc02-AT-sneakemail.com>.
256
269
257 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
270 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
258 possible crashes caused by a TokenError. Reported by Ed Schofield
271 possible crashes caused by a TokenError. Reported by Ed Schofield
259 <schofield-AT-ftw.at>.
272 <schofield-AT-ftw.at>.
260
273
261 2005-05-06 Fernando Perez <fperez@colorado.edu>
274 2005-05-06 Fernando Perez <fperez@colorado.edu>
262
275
263 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
276 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
264
277
265 2005-04-29 Fernando Perez <fperez@colorado.edu>
278 2005-04-29 Fernando Perez <fperez@colorado.edu>
266
279
267 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
280 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
268 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
281 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
269 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
282 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
270 which provides support for Qt interactive usage (similar to the
283 which provides support for Qt interactive usage (similar to the
271 existing one for WX and GTK). This had been often requested.
284 existing one for WX and GTK). This had been often requested.
272
285
273 2005-04-14 *** Released version 0.6.13
286 2005-04-14 *** Released version 0.6.13
274
287
275 2005-04-08 Fernando Perez <fperez@colorado.edu>
288 2005-04-08 Fernando Perez <fperez@colorado.edu>
276
289
277 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
290 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
278 from _ofind, which gets called on almost every input line. Now,
291 from _ofind, which gets called on almost every input line. Now,
279 we only try to get docstrings if they are actually going to be
292 we only try to get docstrings if they are actually going to be
280 used (the overhead of fetching unnecessary docstrings can be
293 used (the overhead of fetching unnecessary docstrings can be
281 noticeable for certain objects, such as Pyro proxies).
294 noticeable for certain objects, such as Pyro proxies).
282
295
283 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
296 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
284 for completers. For some reason I had been passing them the state
297 for completers. For some reason I had been passing them the state
285 variable, which completers never actually need, and was in
298 variable, which completers never actually need, and was in
286 conflict with the rlcompleter API. Custom completers ONLY need to
299 conflict with the rlcompleter API. Custom completers ONLY need to
287 take the text parameter.
300 take the text parameter.
288
301
289 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
302 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
290 work correctly in pysh. I've also moved all the logic which used
303 work correctly in pysh. I've also moved all the logic which used
291 to be in pysh.py here, which will prevent problems with future
304 to be in pysh.py here, which will prevent problems with future
292 upgrades. However, this time I must warn users to update their
305 upgrades. However, this time I must warn users to update their
293 pysh profile to include the line
306 pysh profile to include the line
294
307
295 import_all IPython.Extensions.InterpreterExec
308 import_all IPython.Extensions.InterpreterExec
296
309
297 because otherwise things won't work for them. They MUST also
310 because otherwise things won't work for them. They MUST also
298 delete pysh.py and the line
311 delete pysh.py and the line
299
312
300 execfile pysh.py
313 execfile pysh.py
301
314
302 from their ipythonrc-pysh.
315 from their ipythonrc-pysh.
303
316
304 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
317 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
305 robust in the face of objects whose dir() returns non-strings
318 robust in the face of objects whose dir() returns non-strings
306 (which it shouldn't, but some broken libs like ITK do). Thanks to
319 (which it shouldn't, but some broken libs like ITK do). Thanks to
307 a patch by John Hunter (implemented differently, though). Also
320 a patch by John Hunter (implemented differently, though). Also
308 minor improvements by using .extend instead of + on lists.
321 minor improvements by using .extend instead of + on lists.
309
322
310 * pysh.py:
323 * pysh.py:
311
324
312 2005-04-06 Fernando Perez <fperez@colorado.edu>
325 2005-04-06 Fernando Perez <fperez@colorado.edu>
313
326
314 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
327 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
315 by default, so that all users benefit from it. Those who don't
328 by default, so that all users benefit from it. Those who don't
316 want it can still turn it off.
329 want it can still turn it off.
317
330
318 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
331 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
319 config file, I'd forgotten about this, so users were getting it
332 config file, I'd forgotten about this, so users were getting it
320 off by default.
333 off by default.
321
334
322 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
335 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
323 consistency. Now magics can be called in multiline statements,
336 consistency. Now magics can be called in multiline statements,
324 and python variables can be expanded in magic calls via $var.
337 and python variables can be expanded in magic calls via $var.
325 This makes the magic system behave just like aliases or !system
338 This makes the magic system behave just like aliases or !system
326 calls.
339 calls.
327
340
328 2005-03-28 Fernando Perez <fperez@colorado.edu>
341 2005-03-28 Fernando Perez <fperez@colorado.edu>
329
342
330 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
343 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
331 expensive string additions for building command. Add support for
344 expensive string additions for building command. Add support for
332 trailing ';' when autocall is used.
345 trailing ';' when autocall is used.
333
346
334 2005-03-26 Fernando Perez <fperez@colorado.edu>
347 2005-03-26 Fernando Perez <fperez@colorado.edu>
335
348
336 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
349 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
337 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
350 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
338 ipython.el robust against prompts with any number of spaces
351 ipython.el robust against prompts with any number of spaces
339 (including 0) after the ':' character.
352 (including 0) after the ':' character.
340
353
341 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
354 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
342 continuation prompt, which misled users to think the line was
355 continuation prompt, which misled users to think the line was
343 already indented. Closes debian Bug#300847, reported to me by
356 already indented. Closes debian Bug#300847, reported to me by
344 Norbert Tretkowski <tretkowski-AT-inittab.de>.
357 Norbert Tretkowski <tretkowski-AT-inittab.de>.
345
358
346 2005-03-23 Fernando Perez <fperez@colorado.edu>
359 2005-03-23 Fernando Perez <fperez@colorado.edu>
347
360
348 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
361 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
349 properly aligned if they have embedded newlines.
362 properly aligned if they have embedded newlines.
350
363
351 * IPython/iplib.py (runlines): Add a public method to expose
364 * IPython/iplib.py (runlines): Add a public method to expose
352 IPython's code execution machinery, so that users can run strings
365 IPython's code execution machinery, so that users can run strings
353 as if they had been typed at the prompt interactively.
366 as if they had been typed at the prompt interactively.
354 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
367 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
355 methods which can call the system shell, but with python variable
368 methods which can call the system shell, but with python variable
356 expansion. The three such methods are: __IPYTHON__.system,
369 expansion. The three such methods are: __IPYTHON__.system,
357 .getoutput and .getoutputerror. These need to be documented in a
370 .getoutput and .getoutputerror. These need to be documented in a
358 'public API' section (to be written) of the manual.
371 'public API' section (to be written) of the manual.
359
372
360 2005-03-20 Fernando Perez <fperez@colorado.edu>
373 2005-03-20 Fernando Perez <fperez@colorado.edu>
361
374
362 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
375 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
363 for custom exception handling. This is quite powerful, and it
376 for custom exception handling. This is quite powerful, and it
364 allows for user-installable exception handlers which can trap
377 allows for user-installable exception handlers which can trap
365 custom exceptions at runtime and treat them separately from
378 custom exceptions at runtime and treat them separately from
366 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
379 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
367 Mantegazza <mantegazza-AT-ill.fr>.
380 Mantegazza <mantegazza-AT-ill.fr>.
368 (InteractiveShell.set_custom_completer): public API function to
381 (InteractiveShell.set_custom_completer): public API function to
369 add new completers at runtime.
382 add new completers at runtime.
370
383
371 2005-03-19 Fernando Perez <fperez@colorado.edu>
384 2005-03-19 Fernando Perez <fperez@colorado.edu>
372
385
373 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
386 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
374 allow objects which provide their docstrings via non-standard
387 allow objects which provide their docstrings via non-standard
375 mechanisms (like Pyro proxies) to still be inspected by ipython's
388 mechanisms (like Pyro proxies) to still be inspected by ipython's
376 ? system.
389 ? system.
377
390
378 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
391 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
379 automatic capture system. I tried quite hard to make it work
392 automatic capture system. I tried quite hard to make it work
380 reliably, and simply failed. I tried many combinations with the
393 reliably, and simply failed. I tried many combinations with the
381 subprocess module, but eventually nothing worked in all needed
394 subprocess module, but eventually nothing worked in all needed
382 cases (not blocking stdin for the child, duplicating stdout
395 cases (not blocking stdin for the child, duplicating stdout
383 without blocking, etc). The new %sc/%sx still do capture to these
396 without blocking, etc). The new %sc/%sx still do capture to these
384 magical list/string objects which make shell use much more
397 magical list/string objects which make shell use much more
385 conveninent, so not all is lost.
398 conveninent, so not all is lost.
386
399
387 XXX - FIX MANUAL for the change above!
400 XXX - FIX MANUAL for the change above!
388
401
389 (runsource): I copied code.py's runsource() into ipython to modify
402 (runsource): I copied code.py's runsource() into ipython to modify
390 it a bit. Now the code object and source to be executed are
403 it a bit. Now the code object and source to be executed are
391 stored in ipython. This makes this info accessible to third-party
404 stored in ipython. This makes this info accessible to third-party
392 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
405 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
393 Mantegazza <mantegazza-AT-ill.fr>.
406 Mantegazza <mantegazza-AT-ill.fr>.
394
407
395 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
408 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
396 history-search via readline (like C-p/C-n). I'd wanted this for a
409 history-search via readline (like C-p/C-n). I'd wanted this for a
397 long time, but only recently found out how to do it. For users
410 long time, but only recently found out how to do it. For users
398 who already have their ipythonrc files made and want this, just
411 who already have their ipythonrc files made and want this, just
399 add:
412 add:
400
413
401 readline_parse_and_bind "\e[A": history-search-backward
414 readline_parse_and_bind "\e[A": history-search-backward
402 readline_parse_and_bind "\e[B": history-search-forward
415 readline_parse_and_bind "\e[B": history-search-forward
403
416
404 2005-03-18 Fernando Perez <fperez@colorado.edu>
417 2005-03-18 Fernando Perez <fperez@colorado.edu>
405
418
406 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
419 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
407 LSString and SList classes which allow transparent conversions
420 LSString and SList classes which allow transparent conversions
408 between list mode and whitespace-separated string.
421 between list mode and whitespace-separated string.
409 (magic_r): Fix recursion problem in %r.
422 (magic_r): Fix recursion problem in %r.
410
423
411 * IPython/genutils.py (LSString): New class to be used for
424 * IPython/genutils.py (LSString): New class to be used for
412 automatic storage of the results of all alias/system calls in _o
425 automatic storage of the results of all alias/system calls in _o
413 and _e (stdout/err). These provide a .l/.list attribute which
426 and _e (stdout/err). These provide a .l/.list attribute which
414 does automatic splitting on newlines. This means that for most
427 does automatic splitting on newlines. This means that for most
415 uses, you'll never need to do capturing of output with %sc/%sx
428 uses, you'll never need to do capturing of output with %sc/%sx
416 anymore, since ipython keeps this always done for you. Note that
429 anymore, since ipython keeps this always done for you. Note that
417 only the LAST results are stored, the _o/e variables are
430 only the LAST results are stored, the _o/e variables are
418 overwritten on each call. If you need to save their contents
431 overwritten on each call. If you need to save their contents
419 further, simply bind them to any other name.
432 further, simply bind them to any other name.
420
433
421 2005-03-17 Fernando Perez <fperez@colorado.edu>
434 2005-03-17 Fernando Perez <fperez@colorado.edu>
422
435
423 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
436 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
424 prompt namespace handling.
437 prompt namespace handling.
425
438
426 2005-03-16 Fernando Perez <fperez@colorado.edu>
439 2005-03-16 Fernando Perez <fperez@colorado.edu>
427
440
428 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
441 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
429 classic prompts to be '>>> ' (final space was missing, and it
442 classic prompts to be '>>> ' (final space was missing, and it
430 trips the emacs python mode).
443 trips the emacs python mode).
431 (BasePrompt.__str__): Added safe support for dynamic prompt
444 (BasePrompt.__str__): Added safe support for dynamic prompt
432 strings. Now you can set your prompt string to be '$x', and the
445 strings. Now you can set your prompt string to be '$x', and the
433 value of x will be printed from your interactive namespace. The
446 value of x will be printed from your interactive namespace. The
434 interpolation syntax includes the full Itpl support, so
447 interpolation syntax includes the full Itpl support, so
435 ${foo()+x+bar()} is a valid prompt string now, and the function
448 ${foo()+x+bar()} is a valid prompt string now, and the function
436 calls will be made at runtime.
449 calls will be made at runtime.
437
450
438 2005-03-15 Fernando Perez <fperez@colorado.edu>
451 2005-03-15 Fernando Perez <fperez@colorado.edu>
439
452
440 * IPython/Magic.py (magic_history): renamed %hist to %history, to
453 * IPython/Magic.py (magic_history): renamed %hist to %history, to
441 avoid name clashes in pylab. %hist still works, it just forwards
454 avoid name clashes in pylab. %hist still works, it just forwards
442 the call to %history.
455 the call to %history.
443
456
444 2005-03-02 *** Released version 0.6.12
457 2005-03-02 *** Released version 0.6.12
445
458
446 2005-03-02 Fernando Perez <fperez@colorado.edu>
459 2005-03-02 Fernando Perez <fperez@colorado.edu>
447
460
448 * IPython/iplib.py (handle_magic): log magic calls properly as
461 * IPython/iplib.py (handle_magic): log magic calls properly as
449 ipmagic() function calls.
462 ipmagic() function calls.
450
463
451 * IPython/Magic.py (magic_time): Improved %time to support
464 * IPython/Magic.py (magic_time): Improved %time to support
452 statements and provide wall-clock as well as CPU time.
465 statements and provide wall-clock as well as CPU time.
453
466
454 2005-02-27 Fernando Perez <fperez@colorado.edu>
467 2005-02-27 Fernando Perez <fperez@colorado.edu>
455
468
456 * IPython/hooks.py: New hooks module, to expose user-modifiable
469 * IPython/hooks.py: New hooks module, to expose user-modifiable
457 IPython functionality in a clean manner. For now only the editor
470 IPython functionality in a clean manner. For now only the editor
458 hook is actually written, and other thigns which I intend to turn
471 hook is actually written, and other thigns which I intend to turn
459 into proper hooks aren't yet there. The display and prefilter
472 into proper hooks aren't yet there. The display and prefilter
460 stuff, for example, should be hooks. But at least now the
473 stuff, for example, should be hooks. But at least now the
461 framework is in place, and the rest can be moved here with more
474 framework is in place, and the rest can be moved here with more
462 time later. IPython had had a .hooks variable for a long time for
475 time later. IPython had had a .hooks variable for a long time for
463 this purpose, but I'd never actually used it for anything.
476 this purpose, but I'd never actually used it for anything.
464
477
465 2005-02-26 Fernando Perez <fperez@colorado.edu>
478 2005-02-26 Fernando Perez <fperez@colorado.edu>
466
479
467 * IPython/ipmaker.py (make_IPython): make the default ipython
480 * IPython/ipmaker.py (make_IPython): make the default ipython
468 directory be called _ipython under win32, to follow more the
481 directory be called _ipython under win32, to follow more the
469 naming peculiarities of that platform (where buggy software like
482 naming peculiarities of that platform (where buggy software like
470 Visual Sourcesafe breaks with .named directories). Reported by
483 Visual Sourcesafe breaks with .named directories). Reported by
471 Ville Vainio.
484 Ville Vainio.
472
485
473 2005-02-23 Fernando Perez <fperez@colorado.edu>
486 2005-02-23 Fernando Perez <fperez@colorado.edu>
474
487
475 * IPython/iplib.py (InteractiveShell.__init__): removed a few
488 * IPython/iplib.py (InteractiveShell.__init__): removed a few
476 auto_aliases for win32 which were causing problems. Users can
489 auto_aliases for win32 which were causing problems. Users can
477 define the ones they personally like.
490 define the ones they personally like.
478
491
479 2005-02-21 Fernando Perez <fperez@colorado.edu>
492 2005-02-21 Fernando Perez <fperez@colorado.edu>
480
493
481 * IPython/Magic.py (magic_time): new magic to time execution of
494 * IPython/Magic.py (magic_time): new magic to time execution of
482 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
495 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
483
496
484 2005-02-19 Fernando Perez <fperez@colorado.edu>
497 2005-02-19 Fernando Perez <fperez@colorado.edu>
485
498
486 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
499 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
487 into keys (for prompts, for example).
500 into keys (for prompts, for example).
488
501
489 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
502 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
490 prompts in case users want them. This introduces a small behavior
503 prompts in case users want them. This introduces a small behavior
491 change: ipython does not automatically add a space to all prompts
504 change: ipython does not automatically add a space to all prompts
492 anymore. To get the old prompts with a space, users should add it
505 anymore. To get the old prompts with a space, users should add it
493 manually to their ipythonrc file, so for example prompt_in1 should
506 manually to their ipythonrc file, so for example prompt_in1 should
494 now read 'In [\#]: ' instead of 'In [\#]:'.
507 now read 'In [\#]: ' instead of 'In [\#]:'.
495 (BasePrompt.__init__): New option prompts_pad_left (only in rc
508 (BasePrompt.__init__): New option prompts_pad_left (only in rc
496 file) to control left-padding of secondary prompts.
509 file) to control left-padding of secondary prompts.
497
510
498 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
511 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
499 the profiler can't be imported. Fix for Debian, which removed
512 the profiler can't be imported. Fix for Debian, which removed
500 profile.py because of License issues. I applied a slightly
513 profile.py because of License issues. I applied a slightly
501 modified version of the original Debian patch at
514 modified version of the original Debian patch at
502 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
515 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
503
516
504 2005-02-17 Fernando Perez <fperez@colorado.edu>
517 2005-02-17 Fernando Perez <fperez@colorado.edu>
505
518
506 * IPython/genutils.py (native_line_ends): Fix bug which would
519 * IPython/genutils.py (native_line_ends): Fix bug which would
507 cause improper line-ends under win32 b/c I was not opening files
520 cause improper line-ends under win32 b/c I was not opening files
508 in binary mode. Bug report and fix thanks to Ville.
521 in binary mode. Bug report and fix thanks to Ville.
509
522
510 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
523 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
511 trying to catch spurious foo[1] autocalls. My fix actually broke
524 trying to catch spurious foo[1] autocalls. My fix actually broke
512 ',/' autoquote/call with explicit escape (bad regexp).
525 ',/' autoquote/call with explicit escape (bad regexp).
513
526
514 2005-02-15 *** Released version 0.6.11
527 2005-02-15 *** Released version 0.6.11
515
528
516 2005-02-14 Fernando Perez <fperez@colorado.edu>
529 2005-02-14 Fernando Perez <fperez@colorado.edu>
517
530
518 * IPython/background_jobs.py: New background job management
531 * IPython/background_jobs.py: New background job management
519 subsystem. This is implemented via a new set of classes, and
532 subsystem. This is implemented via a new set of classes, and
520 IPython now provides a builtin 'jobs' object for background job
533 IPython now provides a builtin 'jobs' object for background job
521 execution. A convenience %bg magic serves as a lightweight
534 execution. A convenience %bg magic serves as a lightweight
522 frontend for starting the more common type of calls. This was
535 frontend for starting the more common type of calls. This was
523 inspired by discussions with B. Granger and the BackgroundCommand
536 inspired by discussions with B. Granger and the BackgroundCommand
524 class described in the book Python Scripting for Computational
537 class described in the book Python Scripting for Computational
525 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
538 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
526 (although ultimately no code from this text was used, as IPython's
539 (although ultimately no code from this text was used, as IPython's
527 system is a separate implementation).
540 system is a separate implementation).
528
541
529 * IPython/iplib.py (MagicCompleter.python_matches): add new option
542 * IPython/iplib.py (MagicCompleter.python_matches): add new option
530 to control the completion of single/double underscore names
543 to control the completion of single/double underscore names
531 separately. As documented in the example ipytonrc file, the
544 separately. As documented in the example ipytonrc file, the
532 readline_omit__names variable can now be set to 2, to omit even
545 readline_omit__names variable can now be set to 2, to omit even
533 single underscore names. Thanks to a patch by Brian Wong
546 single underscore names. Thanks to a patch by Brian Wong
534 <BrianWong-AT-AirgoNetworks.Com>.
547 <BrianWong-AT-AirgoNetworks.Com>.
535 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
548 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
536 be autocalled as foo([1]) if foo were callable. A problem for
549 be autocalled as foo([1]) if foo were callable. A problem for
537 things which are both callable and implement __getitem__.
550 things which are both callable and implement __getitem__.
538 (init_readline): Fix autoindentation for win32. Thanks to a patch
551 (init_readline): Fix autoindentation for win32. Thanks to a patch
539 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
552 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
540
553
541 2005-02-12 Fernando Perez <fperez@colorado.edu>
554 2005-02-12 Fernando Perez <fperez@colorado.edu>
542
555
543 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
556 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
544 which I had written long ago to sort out user error messages which
557 which I had written long ago to sort out user error messages which
545 may occur during startup. This seemed like a good idea initially,
558 may occur during startup. This seemed like a good idea initially,
546 but it has proven a disaster in retrospect. I don't want to
559 but it has proven a disaster in retrospect. I don't want to
547 change much code for now, so my fix is to set the internal 'debug'
560 change much code for now, so my fix is to set the internal 'debug'
548 flag to true everywhere, whose only job was precisely to control
561 flag to true everywhere, whose only job was precisely to control
549 this subsystem. This closes issue 28 (as well as avoiding all
562 this subsystem. This closes issue 28 (as well as avoiding all
550 sorts of strange hangups which occur from time to time).
563 sorts of strange hangups which occur from time to time).
551
564
552 2005-02-07 Fernando Perez <fperez@colorado.edu>
565 2005-02-07 Fernando Perez <fperez@colorado.edu>
553
566
554 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
567 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
555 previous call produced a syntax error.
568 previous call produced a syntax error.
556
569
557 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
570 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
558 classes without constructor.
571 classes without constructor.
559
572
560 2005-02-06 Fernando Perez <fperez@colorado.edu>
573 2005-02-06 Fernando Perez <fperez@colorado.edu>
561
574
562 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
575 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
563 completions with the results of each matcher, so we return results
576 completions with the results of each matcher, so we return results
564 to the user from all namespaces. This breaks with ipython
577 to the user from all namespaces. This breaks with ipython
565 tradition, but I think it's a nicer behavior. Now you get all
578 tradition, but I think it's a nicer behavior. Now you get all
566 possible completions listed, from all possible namespaces (python,
579 possible completions listed, from all possible namespaces (python,
567 filesystem, magics...) After a request by John Hunter
580 filesystem, magics...) After a request by John Hunter
568 <jdhunter-AT-nitace.bsd.uchicago.edu>.
581 <jdhunter-AT-nitace.bsd.uchicago.edu>.
569
582
570 2005-02-05 Fernando Perez <fperez@colorado.edu>
583 2005-02-05 Fernando Perez <fperez@colorado.edu>
571
584
572 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
585 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
573 the call had quote characters in it (the quotes were stripped).
586 the call had quote characters in it (the quotes were stripped).
574
587
575 2005-01-31 Fernando Perez <fperez@colorado.edu>
588 2005-01-31 Fernando Perez <fperez@colorado.edu>
576
589
577 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
590 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
578 Itpl.itpl() to make the code more robust against psyco
591 Itpl.itpl() to make the code more robust against psyco
579 optimizations.
592 optimizations.
580
593
581 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
594 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
582 of causing an exception. Quicker, cleaner.
595 of causing an exception. Quicker, cleaner.
583
596
584 2005-01-28 Fernando Perez <fperez@colorado.edu>
597 2005-01-28 Fernando Perez <fperez@colorado.edu>
585
598
586 * scripts/ipython_win_post_install.py (install): hardcode
599 * scripts/ipython_win_post_install.py (install): hardcode
587 sys.prefix+'python.exe' as the executable path. It turns out that
600 sys.prefix+'python.exe' as the executable path. It turns out that
588 during the post-installation run, sys.executable resolves to the
601 during the post-installation run, sys.executable resolves to the
589 name of the binary installer! I should report this as a distutils
602 name of the binary installer! I should report this as a distutils
590 bug, I think. I updated the .10 release with this tiny fix, to
603 bug, I think. I updated the .10 release with this tiny fix, to
591 avoid annoying the lists further.
604 avoid annoying the lists further.
592
605
593 2005-01-27 *** Released version 0.6.10
606 2005-01-27 *** Released version 0.6.10
594
607
595 2005-01-27 Fernando Perez <fperez@colorado.edu>
608 2005-01-27 Fernando Perez <fperez@colorado.edu>
596
609
597 * IPython/numutils.py (norm): Added 'inf' as optional name for
610 * IPython/numutils.py (norm): Added 'inf' as optional name for
598 L-infinity norm, included references to mathworld.com for vector
611 L-infinity norm, included references to mathworld.com for vector
599 norm definitions.
612 norm definitions.
600 (amin/amax): added amin/amax for array min/max. Similar to what
613 (amin/amax): added amin/amax for array min/max. Similar to what
601 pylab ships with after the recent reorganization of names.
614 pylab ships with after the recent reorganization of names.
602 (spike/spike_odd): removed deprecated spike/spike_odd functions.
615 (spike/spike_odd): removed deprecated spike/spike_odd functions.
603
616
604 * ipython.el: committed Alex's recent fixes and improvements.
617 * ipython.el: committed Alex's recent fixes and improvements.
605 Tested with python-mode from CVS, and it looks excellent. Since
618 Tested with python-mode from CVS, and it looks excellent. Since
606 python-mode hasn't released anything in a while, I'm temporarily
619 python-mode hasn't released anything in a while, I'm temporarily
607 putting a copy of today's CVS (v 4.70) of python-mode in:
620 putting a copy of today's CVS (v 4.70) of python-mode in:
608 http://ipython.scipy.org/tmp/python-mode.el
621 http://ipython.scipy.org/tmp/python-mode.el
609
622
610 * scripts/ipython_win_post_install.py (install): Win32 fix to use
623 * scripts/ipython_win_post_install.py (install): Win32 fix to use
611 sys.executable for the executable name, instead of assuming it's
624 sys.executable for the executable name, instead of assuming it's
612 called 'python.exe' (the post-installer would have produced broken
625 called 'python.exe' (the post-installer would have produced broken
613 setups on systems with a differently named python binary).
626 setups on systems with a differently named python binary).
614
627
615 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
628 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
616 references to os.linesep, to make the code more
629 references to os.linesep, to make the code more
617 platform-independent. This is also part of the win32 coloring
630 platform-independent. This is also part of the win32 coloring
618 fixes.
631 fixes.
619
632
620 * IPython/genutils.py (page_dumb): Remove attempts to chop long
633 * IPython/genutils.py (page_dumb): Remove attempts to chop long
621 lines, which actually cause coloring bugs because the length of
634 lines, which actually cause coloring bugs because the length of
622 the line is very difficult to correctly compute with embedded
635 the line is very difficult to correctly compute with embedded
623 escapes. This was the source of all the coloring problems under
636 escapes. This was the source of all the coloring problems under
624 Win32. I think that _finally_, Win32 users have a properly
637 Win32. I think that _finally_, Win32 users have a properly
625 working ipython in all respects. This would never have happened
638 working ipython in all respects. This would never have happened
626 if not for Gary Bishop and Viktor Ransmayr's great help and work.
639 if not for Gary Bishop and Viktor Ransmayr's great help and work.
627
640
628 2005-01-26 *** Released version 0.6.9
641 2005-01-26 *** Released version 0.6.9
629
642
630 2005-01-25 Fernando Perez <fperez@colorado.edu>
643 2005-01-25 Fernando Perez <fperez@colorado.edu>
631
644
632 * setup.py: finally, we have a true Windows installer, thanks to
645 * setup.py: finally, we have a true Windows installer, thanks to
633 the excellent work of Viktor Ransmayr
646 the excellent work of Viktor Ransmayr
634 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
647 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
635 Windows users. The setup routine is quite a bit cleaner thanks to
648 Windows users. The setup routine is quite a bit cleaner thanks to
636 this, and the post-install script uses the proper functions to
649 this, and the post-install script uses the proper functions to
637 allow a clean de-installation using the standard Windows Control
650 allow a clean de-installation using the standard Windows Control
638 Panel.
651 Panel.
639
652
640 * IPython/genutils.py (get_home_dir): changed to use the $HOME
653 * IPython/genutils.py (get_home_dir): changed to use the $HOME
641 environment variable under all OSes (including win32) if
654 environment variable under all OSes (including win32) if
642 available. This will give consistency to win32 users who have set
655 available. This will give consistency to win32 users who have set
643 this variable for any reason. If os.environ['HOME'] fails, the
656 this variable for any reason. If os.environ['HOME'] fails, the
644 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
657 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
645
658
646 2005-01-24 Fernando Perez <fperez@colorado.edu>
659 2005-01-24 Fernando Perez <fperez@colorado.edu>
647
660
648 * IPython/numutils.py (empty_like): add empty_like(), similar to
661 * IPython/numutils.py (empty_like): add empty_like(), similar to
649 zeros_like() but taking advantage of the new empty() Numeric routine.
662 zeros_like() but taking advantage of the new empty() Numeric routine.
650
663
651 2005-01-23 *** Released version 0.6.8
664 2005-01-23 *** Released version 0.6.8
652
665
653 2005-01-22 Fernando Perez <fperez@colorado.edu>
666 2005-01-22 Fernando Perez <fperez@colorado.edu>
654
667
655 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
668 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
656 automatic show() calls. After discussing things with JDH, it
669 automatic show() calls. After discussing things with JDH, it
657 turns out there are too many corner cases where this can go wrong.
670 turns out there are too many corner cases where this can go wrong.
658 It's best not to try to be 'too smart', and simply have ipython
671 It's best not to try to be 'too smart', and simply have ipython
659 reproduce as much as possible the default behavior of a normal
672 reproduce as much as possible the default behavior of a normal
660 python shell.
673 python shell.
661
674
662 * IPython/iplib.py (InteractiveShell.__init__): Modified the
675 * IPython/iplib.py (InteractiveShell.__init__): Modified the
663 line-splitting regexp and _prefilter() to avoid calling getattr()
676 line-splitting regexp and _prefilter() to avoid calling getattr()
664 on assignments. This closes
677 on assignments. This closes
665 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
678 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
666 readline uses getattr(), so a simple <TAB> keypress is still
679 readline uses getattr(), so a simple <TAB> keypress is still
667 enough to trigger getattr() calls on an object.
680 enough to trigger getattr() calls on an object.
668
681
669 2005-01-21 Fernando Perez <fperez@colorado.edu>
682 2005-01-21 Fernando Perez <fperez@colorado.edu>
670
683
671 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
684 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
672 docstring under pylab so it doesn't mask the original.
685 docstring under pylab so it doesn't mask the original.
673
686
674 2005-01-21 *** Released version 0.6.7
687 2005-01-21 *** Released version 0.6.7
675
688
676 2005-01-21 Fernando Perez <fperez@colorado.edu>
689 2005-01-21 Fernando Perez <fperez@colorado.edu>
677
690
678 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
691 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
679 signal handling for win32 users in multithreaded mode.
692 signal handling for win32 users in multithreaded mode.
680
693
681 2005-01-17 Fernando Perez <fperez@colorado.edu>
694 2005-01-17 Fernando Perez <fperez@colorado.edu>
682
695
683 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
696 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
684 instances with no __init__. After a crash report by Norbert Nemec
697 instances with no __init__. After a crash report by Norbert Nemec
685 <Norbert-AT-nemec-online.de>.
698 <Norbert-AT-nemec-online.de>.
686
699
687 2005-01-14 Fernando Perez <fperez@colorado.edu>
700 2005-01-14 Fernando Perez <fperez@colorado.edu>
688
701
689 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
702 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
690 names for verbose exceptions, when multiple dotted names and the
703 names for verbose exceptions, when multiple dotted names and the
691 'parent' object were present on the same line.
704 'parent' object were present on the same line.
692
705
693 2005-01-11 Fernando Perez <fperez@colorado.edu>
706 2005-01-11 Fernando Perez <fperez@colorado.edu>
694
707
695 * IPython/genutils.py (flag_calls): new utility to trap and flag
708 * IPython/genutils.py (flag_calls): new utility to trap and flag
696 calls in functions. I need it to clean up matplotlib support.
709 calls in functions. I need it to clean up matplotlib support.
697 Also removed some deprecated code in genutils.
710 Also removed some deprecated code in genutils.
698
711
699 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
712 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
700 that matplotlib scripts called with %run, which don't call show()
713 that matplotlib scripts called with %run, which don't call show()
701 themselves, still have their plotting windows open.
714 themselves, still have their plotting windows open.
702
715
703 2005-01-05 Fernando Perez <fperez@colorado.edu>
716 2005-01-05 Fernando Perez <fperez@colorado.edu>
704
717
705 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
718 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
706 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
719 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
707
720
708 2004-12-19 Fernando Perez <fperez@colorado.edu>
721 2004-12-19 Fernando Perez <fperez@colorado.edu>
709
722
710 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
723 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
711 parent_runcode, which was an eyesore. The same result can be
724 parent_runcode, which was an eyesore. The same result can be
712 obtained with Python's regular superclass mechanisms.
725 obtained with Python's regular superclass mechanisms.
713
726
714 2004-12-17 Fernando Perez <fperez@colorado.edu>
727 2004-12-17 Fernando Perez <fperez@colorado.edu>
715
728
716 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
729 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
717 reported by Prabhu.
730 reported by Prabhu.
718 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
731 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
719 sys.stderr) instead of explicitly calling sys.stderr. This helps
732 sys.stderr) instead of explicitly calling sys.stderr. This helps
720 maintain our I/O abstractions clean, for future GUI embeddings.
733 maintain our I/O abstractions clean, for future GUI embeddings.
721
734
722 * IPython/genutils.py (info): added new utility for sys.stderr
735 * IPython/genutils.py (info): added new utility for sys.stderr
723 unified info message handling (thin wrapper around warn()).
736 unified info message handling (thin wrapper around warn()).
724
737
725 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
738 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
726 composite (dotted) names on verbose exceptions.
739 composite (dotted) names on verbose exceptions.
727 (VerboseTB.nullrepr): harden against another kind of errors which
740 (VerboseTB.nullrepr): harden against another kind of errors which
728 Python's inspect module can trigger, and which were crashing
741 Python's inspect module can trigger, and which were crashing
729 IPython. Thanks to a report by Marco Lombardi
742 IPython. Thanks to a report by Marco Lombardi
730 <mlombard-AT-ma010192.hq.eso.org>.
743 <mlombard-AT-ma010192.hq.eso.org>.
731
744
732 2004-12-13 *** Released version 0.6.6
745 2004-12-13 *** Released version 0.6.6
733
746
734 2004-12-12 Fernando Perez <fperez@colorado.edu>
747 2004-12-12 Fernando Perez <fperez@colorado.edu>
735
748
736 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
749 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
737 generated by pygtk upon initialization if it was built without
750 generated by pygtk upon initialization if it was built without
738 threads (for matplotlib users). After a crash reported by
751 threads (for matplotlib users). After a crash reported by
739 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
752 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
740
753
741 * IPython/ipmaker.py (make_IPython): fix small bug in the
754 * IPython/ipmaker.py (make_IPython): fix small bug in the
742 import_some parameter for multiple imports.
755 import_some parameter for multiple imports.
743
756
744 * IPython/iplib.py (ipmagic): simplified the interface of
757 * IPython/iplib.py (ipmagic): simplified the interface of
745 ipmagic() to take a single string argument, just as it would be
758 ipmagic() to take a single string argument, just as it would be
746 typed at the IPython cmd line.
759 typed at the IPython cmd line.
747 (ipalias): Added new ipalias() with an interface identical to
760 (ipalias): Added new ipalias() with an interface identical to
748 ipmagic(). This completes exposing a pure python interface to the
761 ipmagic(). This completes exposing a pure python interface to the
749 alias and magic system, which can be used in loops or more complex
762 alias and magic system, which can be used in loops or more complex
750 code where IPython's automatic line mangling is not active.
763 code where IPython's automatic line mangling is not active.
751
764
752 * IPython/genutils.py (timing): changed interface of timing to
765 * IPython/genutils.py (timing): changed interface of timing to
753 simply run code once, which is the most common case. timings()
766 simply run code once, which is the most common case. timings()
754 remains unchanged, for the cases where you want multiple runs.
767 remains unchanged, for the cases where you want multiple runs.
755
768
756 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
769 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
757 bug where Python2.2 crashes with exec'ing code which does not end
770 bug where Python2.2 crashes with exec'ing code which does not end
758 in a single newline. Python 2.3 is OK, so I hadn't noticed this
771 in a single newline. Python 2.3 is OK, so I hadn't noticed this
759 before.
772 before.
760
773
761 2004-12-10 Fernando Perez <fperez@colorado.edu>
774 2004-12-10 Fernando Perez <fperez@colorado.edu>
762
775
763 * IPython/Magic.py (Magic.magic_prun): changed name of option from
776 * IPython/Magic.py (Magic.magic_prun): changed name of option from
764 -t to -T, to accomodate the new -t flag in %run (the %run and
777 -t to -T, to accomodate the new -t flag in %run (the %run and
765 %prun options are kind of intermixed, and it's not easy to change
778 %prun options are kind of intermixed, and it's not easy to change
766 this with the limitations of python's getopt).
779 this with the limitations of python's getopt).
767
780
768 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
781 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
769 the execution of scripts. It's not as fine-tuned as timeit.py,
782 the execution of scripts. It's not as fine-tuned as timeit.py,
770 but it works from inside ipython (and under 2.2, which lacks
783 but it works from inside ipython (and under 2.2, which lacks
771 timeit.py). Optionally a number of runs > 1 can be given for
784 timeit.py). Optionally a number of runs > 1 can be given for
772 timing very short-running code.
785 timing very short-running code.
773
786
774 * IPython/genutils.py (uniq_stable): new routine which returns a
787 * IPython/genutils.py (uniq_stable): new routine which returns a
775 list of unique elements in any iterable, but in stable order of
788 list of unique elements in any iterable, but in stable order of
776 appearance. I needed this for the ultraTB fixes, and it's a handy
789 appearance. I needed this for the ultraTB fixes, and it's a handy
777 utility.
790 utility.
778
791
779 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
792 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
780 dotted names in Verbose exceptions. This had been broken since
793 dotted names in Verbose exceptions. This had been broken since
781 the very start, now x.y will properly be printed in a Verbose
794 the very start, now x.y will properly be printed in a Verbose
782 traceback, instead of x being shown and y appearing always as an
795 traceback, instead of x being shown and y appearing always as an
783 'undefined global'. Getting this to work was a bit tricky,
796 'undefined global'. Getting this to work was a bit tricky,
784 because by default python tokenizers are stateless. Saved by
797 because by default python tokenizers are stateless. Saved by
785 python's ability to easily add a bit of state to an arbitrary
798 python's ability to easily add a bit of state to an arbitrary
786 function (without needing to build a full-blown callable object).
799 function (without needing to build a full-blown callable object).
787
800
788 Also big cleanup of this code, which had horrendous runtime
801 Also big cleanup of this code, which had horrendous runtime
789 lookups of zillions of attributes for colorization. Moved all
802 lookups of zillions of attributes for colorization. Moved all
790 this code into a few templates, which make it cleaner and quicker.
803 this code into a few templates, which make it cleaner and quicker.
791
804
792 Printout quality was also improved for Verbose exceptions: one
805 Printout quality was also improved for Verbose exceptions: one
793 variable per line, and memory addresses are printed (this can be
806 variable per line, and memory addresses are printed (this can be
794 quite handy in nasty debugging situations, which is what Verbose
807 quite handy in nasty debugging situations, which is what Verbose
795 is for).
808 is for).
796
809
797 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
810 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
798 the command line as scripts to be loaded by embedded instances.
811 the command line as scripts to be loaded by embedded instances.
799 Doing so has the potential for an infinite recursion if there are
812 Doing so has the potential for an infinite recursion if there are
800 exceptions thrown in the process. This fixes a strange crash
813 exceptions thrown in the process. This fixes a strange crash
801 reported by Philippe MULLER <muller-AT-irit.fr>.
814 reported by Philippe MULLER <muller-AT-irit.fr>.
802
815
803 2004-12-09 Fernando Perez <fperez@colorado.edu>
816 2004-12-09 Fernando Perez <fperez@colorado.edu>
804
817
805 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
818 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
806 to reflect new names in matplotlib, which now expose the
819 to reflect new names in matplotlib, which now expose the
807 matlab-compatible interface via a pylab module instead of the
820 matlab-compatible interface via a pylab module instead of the
808 'matlab' name. The new code is backwards compatible, so users of
821 'matlab' name. The new code is backwards compatible, so users of
809 all matplotlib versions are OK. Patch by J. Hunter.
822 all matplotlib versions are OK. Patch by J. Hunter.
810
823
811 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
824 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
812 of __init__ docstrings for instances (class docstrings are already
825 of __init__ docstrings for instances (class docstrings are already
813 automatically printed). Instances with customized docstrings
826 automatically printed). Instances with customized docstrings
814 (indep. of the class) are also recognized and all 3 separate
827 (indep. of the class) are also recognized and all 3 separate
815 docstrings are printed (instance, class, constructor). After some
828 docstrings are printed (instance, class, constructor). After some
816 comments/suggestions by J. Hunter.
829 comments/suggestions by J. Hunter.
817
830
818 2004-12-05 Fernando Perez <fperez@colorado.edu>
831 2004-12-05 Fernando Perez <fperez@colorado.edu>
819
832
820 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
833 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
821 warnings when tab-completion fails and triggers an exception.
834 warnings when tab-completion fails and triggers an exception.
822
835
823 2004-12-03 Fernando Perez <fperez@colorado.edu>
836 2004-12-03 Fernando Perez <fperez@colorado.edu>
824
837
825 * IPython/Magic.py (magic_prun): Fix bug where an exception would
838 * IPython/Magic.py (magic_prun): Fix bug where an exception would
826 be triggered when using 'run -p'. An incorrect option flag was
839 be triggered when using 'run -p'. An incorrect option flag was
827 being set ('d' instead of 'D').
840 being set ('d' instead of 'D').
828 (manpage): fix missing escaped \- sign.
841 (manpage): fix missing escaped \- sign.
829
842
830 2004-11-30 *** Released version 0.6.5
843 2004-11-30 *** Released version 0.6.5
831
844
832 2004-11-30 Fernando Perez <fperez@colorado.edu>
845 2004-11-30 Fernando Perez <fperez@colorado.edu>
833
846
834 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
847 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
835 setting with -d option.
848 setting with -d option.
836
849
837 * setup.py (docfiles): Fix problem where the doc glob I was using
850 * setup.py (docfiles): Fix problem where the doc glob I was using
838 was COMPLETELY BROKEN. It was giving the right files by pure
851 was COMPLETELY BROKEN. It was giving the right files by pure
839 accident, but failed once I tried to include ipython.el. Note:
852 accident, but failed once I tried to include ipython.el. Note:
840 glob() does NOT allow you to do exclusion on multiple endings!
853 glob() does NOT allow you to do exclusion on multiple endings!
841
854
842 2004-11-29 Fernando Perez <fperez@colorado.edu>
855 2004-11-29 Fernando Perez <fperez@colorado.edu>
843
856
844 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
857 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
845 the manpage as the source. Better formatting & consistency.
858 the manpage as the source. Better formatting & consistency.
846
859
847 * IPython/Magic.py (magic_run): Added new -d option, to run
860 * IPython/Magic.py (magic_run): Added new -d option, to run
848 scripts under the control of the python pdb debugger. Note that
861 scripts under the control of the python pdb debugger. Note that
849 this required changing the %prun option -d to -D, to avoid a clash
862 this required changing the %prun option -d to -D, to avoid a clash
850 (since %run must pass options to %prun, and getopt is too dumb to
863 (since %run must pass options to %prun, and getopt is too dumb to
851 handle options with string values with embedded spaces). Thanks
864 handle options with string values with embedded spaces). Thanks
852 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
865 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
853 (magic_who_ls): added type matching to %who and %whos, so that one
866 (magic_who_ls): added type matching to %who and %whos, so that one
854 can filter their output to only include variables of certain
867 can filter their output to only include variables of certain
855 types. Another suggestion by Matthew.
868 types. Another suggestion by Matthew.
856 (magic_whos): Added memory summaries in kb and Mb for arrays.
869 (magic_whos): Added memory summaries in kb and Mb for arrays.
857 (magic_who): Improve formatting (break lines every 9 vars).
870 (magic_who): Improve formatting (break lines every 9 vars).
858
871
859 2004-11-28 Fernando Perez <fperez@colorado.edu>
872 2004-11-28 Fernando Perez <fperez@colorado.edu>
860
873
861 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
874 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
862 cache when empty lines were present.
875 cache when empty lines were present.
863
876
864 2004-11-24 Fernando Perez <fperez@colorado.edu>
877 2004-11-24 Fernando Perez <fperez@colorado.edu>
865
878
866 * IPython/usage.py (__doc__): document the re-activated threading
879 * IPython/usage.py (__doc__): document the re-activated threading
867 options for WX and GTK.
880 options for WX and GTK.
868
881
869 2004-11-23 Fernando Perez <fperez@colorado.edu>
882 2004-11-23 Fernando Perez <fperez@colorado.edu>
870
883
871 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
884 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
872 the -wthread and -gthread options, along with a new -tk one to try
885 the -wthread and -gthread options, along with a new -tk one to try
873 and coordinate Tk threading with wx/gtk. The tk support is very
886 and coordinate Tk threading with wx/gtk. The tk support is very
874 platform dependent, since it seems to require Tcl and Tk to be
887 platform dependent, since it seems to require Tcl and Tk to be
875 built with threads (Fedora1/2 appears NOT to have it, but in
888 built with threads (Fedora1/2 appears NOT to have it, but in
876 Prabhu's Debian boxes it works OK). But even with some Tk
889 Prabhu's Debian boxes it works OK). But even with some Tk
877 limitations, this is a great improvement.
890 limitations, this is a great improvement.
878
891
879 * IPython/Prompts.py (prompt_specials_color): Added \t for time
892 * IPython/Prompts.py (prompt_specials_color): Added \t for time
880 info in user prompts. Patch by Prabhu.
893 info in user prompts. Patch by Prabhu.
881
894
882 2004-11-18 Fernando Perez <fperez@colorado.edu>
895 2004-11-18 Fernando Perez <fperez@colorado.edu>
883
896
884 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
897 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
885 EOFErrors and bail, to avoid infinite loops if a non-terminating
898 EOFErrors and bail, to avoid infinite loops if a non-terminating
886 file is fed into ipython. Patch submitted in issue 19 by user,
899 file is fed into ipython. Patch submitted in issue 19 by user,
887 many thanks.
900 many thanks.
888
901
889 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
902 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
890 autoquote/parens in continuation prompts, which can cause lots of
903 autoquote/parens in continuation prompts, which can cause lots of
891 problems. Closes roundup issue 20.
904 problems. Closes roundup issue 20.
892
905
893 2004-11-17 Fernando Perez <fperez@colorado.edu>
906 2004-11-17 Fernando Perez <fperez@colorado.edu>
894
907
895 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
908 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
896 reported as debian bug #280505. I'm not sure my local changelog
909 reported as debian bug #280505. I'm not sure my local changelog
897 entry has the proper debian format (Jack?).
910 entry has the proper debian format (Jack?).
898
911
899 2004-11-08 *** Released version 0.6.4
912 2004-11-08 *** Released version 0.6.4
900
913
901 2004-11-08 Fernando Perez <fperez@colorado.edu>
914 2004-11-08 Fernando Perez <fperez@colorado.edu>
902
915
903 * IPython/iplib.py (init_readline): Fix exit message for Windows
916 * IPython/iplib.py (init_readline): Fix exit message for Windows
904 when readline is active. Thanks to a report by Eric Jones
917 when readline is active. Thanks to a report by Eric Jones
905 <eric-AT-enthought.com>.
918 <eric-AT-enthought.com>.
906
919
907 2004-11-07 Fernando Perez <fperez@colorado.edu>
920 2004-11-07 Fernando Perez <fperez@colorado.edu>
908
921
909 * IPython/genutils.py (page): Add a trap for OSError exceptions,
922 * IPython/genutils.py (page): Add a trap for OSError exceptions,
910 sometimes seen by win2k/cygwin users.
923 sometimes seen by win2k/cygwin users.
911
924
912 2004-11-06 Fernando Perez <fperez@colorado.edu>
925 2004-11-06 Fernando Perez <fperez@colorado.edu>
913
926
914 * IPython/iplib.py (interact): Change the handling of %Exit from
927 * IPython/iplib.py (interact): Change the handling of %Exit from
915 trying to propagate a SystemExit to an internal ipython flag.
928 trying to propagate a SystemExit to an internal ipython flag.
916 This is less elegant than using Python's exception mechanism, but
929 This is less elegant than using Python's exception mechanism, but
917 I can't get that to work reliably with threads, so under -pylab
930 I can't get that to work reliably with threads, so under -pylab
918 %Exit was hanging IPython. Cross-thread exception handling is
931 %Exit was hanging IPython. Cross-thread exception handling is
919 really a bitch. Thaks to a bug report by Stephen Walton
932 really a bitch. Thaks to a bug report by Stephen Walton
920 <stephen.walton-AT-csun.edu>.
933 <stephen.walton-AT-csun.edu>.
921
934
922 2004-11-04 Fernando Perez <fperez@colorado.edu>
935 2004-11-04 Fernando Perez <fperez@colorado.edu>
923
936
924 * IPython/iplib.py (raw_input_original): store a pointer to the
937 * IPython/iplib.py (raw_input_original): store a pointer to the
925 true raw_input to harden against code which can modify it
938 true raw_input to harden against code which can modify it
926 (wx.py.PyShell does this and would otherwise crash ipython).
939 (wx.py.PyShell does this and would otherwise crash ipython).
927 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
940 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
928
941
929 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
942 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
930 Ctrl-C problem, which does not mess up the input line.
943 Ctrl-C problem, which does not mess up the input line.
931
944
932 2004-11-03 Fernando Perez <fperez@colorado.edu>
945 2004-11-03 Fernando Perez <fperez@colorado.edu>
933
946
934 * IPython/Release.py: Changed licensing to BSD, in all files.
947 * IPython/Release.py: Changed licensing to BSD, in all files.
935 (name): lowercase name for tarball/RPM release.
948 (name): lowercase name for tarball/RPM release.
936
949
937 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
950 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
938 use throughout ipython.
951 use throughout ipython.
939
952
940 * IPython/Magic.py (Magic._ofind): Switch to using the new
953 * IPython/Magic.py (Magic._ofind): Switch to using the new
941 OInspect.getdoc() function.
954 OInspect.getdoc() function.
942
955
943 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
956 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
944 of the line currently being canceled via Ctrl-C. It's extremely
957 of the line currently being canceled via Ctrl-C. It's extremely
945 ugly, but I don't know how to do it better (the problem is one of
958 ugly, but I don't know how to do it better (the problem is one of
946 handling cross-thread exceptions).
959 handling cross-thread exceptions).
947
960
948 2004-10-28 Fernando Perez <fperez@colorado.edu>
961 2004-10-28 Fernando Perez <fperez@colorado.edu>
949
962
950 * IPython/Shell.py (signal_handler): add signal handlers to trap
963 * IPython/Shell.py (signal_handler): add signal handlers to trap
951 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
964 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
952 report by Francesc Alted.
965 report by Francesc Alted.
953
966
954 2004-10-21 Fernando Perez <fperez@colorado.edu>
967 2004-10-21 Fernando Perez <fperez@colorado.edu>
955
968
956 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
969 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
957 to % for pysh syntax extensions.
970 to % for pysh syntax extensions.
958
971
959 2004-10-09 Fernando Perez <fperez@colorado.edu>
972 2004-10-09 Fernando Perez <fperez@colorado.edu>
960
973
961 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
974 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
962 arrays to print a more useful summary, without calling str(arr).
975 arrays to print a more useful summary, without calling str(arr).
963 This avoids the problem of extremely lengthy computations which
976 This avoids the problem of extremely lengthy computations which
964 occur if arr is large, and appear to the user as a system lockup
977 occur if arr is large, and appear to the user as a system lockup
965 with 100% cpu activity. After a suggestion by Kristian Sandberg
978 with 100% cpu activity. After a suggestion by Kristian Sandberg
966 <Kristian.Sandberg@colorado.edu>.
979 <Kristian.Sandberg@colorado.edu>.
967 (Magic.__init__): fix bug in global magic escapes not being
980 (Magic.__init__): fix bug in global magic escapes not being
968 correctly set.
981 correctly set.
969
982
970 2004-10-08 Fernando Perez <fperez@colorado.edu>
983 2004-10-08 Fernando Perez <fperez@colorado.edu>
971
984
972 * IPython/Magic.py (__license__): change to absolute imports of
985 * IPython/Magic.py (__license__): change to absolute imports of
973 ipython's own internal packages, to start adapting to the absolute
986 ipython's own internal packages, to start adapting to the absolute
974 import requirement of PEP-328.
987 import requirement of PEP-328.
975
988
976 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
989 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
977 files, and standardize author/license marks through the Release
990 files, and standardize author/license marks through the Release
978 module instead of having per/file stuff (except for files with
991 module instead of having per/file stuff (except for files with
979 particular licenses, like the MIT/PSF-licensed codes).
992 particular licenses, like the MIT/PSF-licensed codes).
980
993
981 * IPython/Debugger.py: remove dead code for python 2.1
994 * IPython/Debugger.py: remove dead code for python 2.1
982
995
983 2004-10-04 Fernando Perez <fperez@colorado.edu>
996 2004-10-04 Fernando Perez <fperez@colorado.edu>
984
997
985 * IPython/iplib.py (ipmagic): New function for accessing magics
998 * IPython/iplib.py (ipmagic): New function for accessing magics
986 via a normal python function call.
999 via a normal python function call.
987
1000
988 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1001 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
989 from '@' to '%', to accomodate the new @decorator syntax of python
1002 from '@' to '%', to accomodate the new @decorator syntax of python
990 2.4.
1003 2.4.
991
1004
992 2004-09-29 Fernando Perez <fperez@colorado.edu>
1005 2004-09-29 Fernando Perez <fperez@colorado.edu>
993
1006
994 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1007 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
995 matplotlib.use to prevent running scripts which try to switch
1008 matplotlib.use to prevent running scripts which try to switch
996 interactive backends from within ipython. This will just crash
1009 interactive backends from within ipython. This will just crash
997 the python interpreter, so we can't allow it (but a detailed error
1010 the python interpreter, so we can't allow it (but a detailed error
998 is given to the user).
1011 is given to the user).
999
1012
1000 2004-09-28 Fernando Perez <fperez@colorado.edu>
1013 2004-09-28 Fernando Perez <fperez@colorado.edu>
1001
1014
1002 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1015 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1003 matplotlib-related fixes so that using @run with non-matplotlib
1016 matplotlib-related fixes so that using @run with non-matplotlib
1004 scripts doesn't pop up spurious plot windows. This requires
1017 scripts doesn't pop up spurious plot windows. This requires
1005 matplotlib >= 0.63, where I had to make some changes as well.
1018 matplotlib >= 0.63, where I had to make some changes as well.
1006
1019
1007 * IPython/ipmaker.py (make_IPython): update version requirement to
1020 * IPython/ipmaker.py (make_IPython): update version requirement to
1008 python 2.2.
1021 python 2.2.
1009
1022
1010 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1023 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1011 banner arg for embedded customization.
1024 banner arg for embedded customization.
1012
1025
1013 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1026 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1014 explicit uses of __IP as the IPython's instance name. Now things
1027 explicit uses of __IP as the IPython's instance name. Now things
1015 are properly handled via the shell.name value. The actual code
1028 are properly handled via the shell.name value. The actual code
1016 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1029 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1017 is much better than before. I'll clean things completely when the
1030 is much better than before. I'll clean things completely when the
1018 magic stuff gets a real overhaul.
1031 magic stuff gets a real overhaul.
1019
1032
1020 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1033 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1021 minor changes to debian dir.
1034 minor changes to debian dir.
1022
1035
1023 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1036 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1024 pointer to the shell itself in the interactive namespace even when
1037 pointer to the shell itself in the interactive namespace even when
1025 a user-supplied dict is provided. This is needed for embedding
1038 a user-supplied dict is provided. This is needed for embedding
1026 purposes (found by tests with Michel Sanner).
1039 purposes (found by tests with Michel Sanner).
1027
1040
1028 2004-09-27 Fernando Perez <fperez@colorado.edu>
1041 2004-09-27 Fernando Perez <fperez@colorado.edu>
1029
1042
1030 * IPython/UserConfig/ipythonrc: remove []{} from
1043 * IPython/UserConfig/ipythonrc: remove []{} from
1031 readline_remove_delims, so that things like [modname.<TAB> do
1044 readline_remove_delims, so that things like [modname.<TAB> do
1032 proper completion. This disables [].TAB, but that's a less common
1045 proper completion. This disables [].TAB, but that's a less common
1033 case than module names in list comprehensions, for example.
1046 case than module names in list comprehensions, for example.
1034 Thanks to a report by Andrea Riciputi.
1047 Thanks to a report by Andrea Riciputi.
1035
1048
1036 2004-09-09 Fernando Perez <fperez@colorado.edu>
1049 2004-09-09 Fernando Perez <fperez@colorado.edu>
1037
1050
1038 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1051 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1039 blocking problems in win32 and osx. Fix by John.
1052 blocking problems in win32 and osx. Fix by John.
1040
1053
1041 2004-09-08 Fernando Perez <fperez@colorado.edu>
1054 2004-09-08 Fernando Perez <fperez@colorado.edu>
1042
1055
1043 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1056 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1044 for Win32 and OSX. Fix by John Hunter.
1057 for Win32 and OSX. Fix by John Hunter.
1045
1058
1046 2004-08-30 *** Released version 0.6.3
1059 2004-08-30 *** Released version 0.6.3
1047
1060
1048 2004-08-30 Fernando Perez <fperez@colorado.edu>
1061 2004-08-30 Fernando Perez <fperez@colorado.edu>
1049
1062
1050 * setup.py (isfile): Add manpages to list of dependent files to be
1063 * setup.py (isfile): Add manpages to list of dependent files to be
1051 updated.
1064 updated.
1052
1065
1053 2004-08-27 Fernando Perez <fperez@colorado.edu>
1066 2004-08-27 Fernando Perez <fperez@colorado.edu>
1054
1067
1055 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1068 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1056 for now. They don't really work with standalone WX/GTK code
1069 for now. They don't really work with standalone WX/GTK code
1057 (though matplotlib IS working fine with both of those backends).
1070 (though matplotlib IS working fine with both of those backends).
1058 This will neeed much more testing. I disabled most things with
1071 This will neeed much more testing. I disabled most things with
1059 comments, so turning it back on later should be pretty easy.
1072 comments, so turning it back on later should be pretty easy.
1060
1073
1061 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1074 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1062 autocalling of expressions like r'foo', by modifying the line
1075 autocalling of expressions like r'foo', by modifying the line
1063 split regexp. Closes
1076 split regexp. Closes
1064 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1077 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1065 Riley <ipythonbugs-AT-sabi.net>.
1078 Riley <ipythonbugs-AT-sabi.net>.
1066 (InteractiveShell.mainloop): honor --nobanner with banner
1079 (InteractiveShell.mainloop): honor --nobanner with banner
1067 extensions.
1080 extensions.
1068
1081
1069 * IPython/Shell.py: Significant refactoring of all classes, so
1082 * IPython/Shell.py: Significant refactoring of all classes, so
1070 that we can really support ALL matplotlib backends and threading
1083 that we can really support ALL matplotlib backends and threading
1071 models (John spotted a bug with Tk which required this). Now we
1084 models (John spotted a bug with Tk which required this). Now we
1072 should support single-threaded, WX-threads and GTK-threads, both
1085 should support single-threaded, WX-threads and GTK-threads, both
1073 for generic code and for matplotlib.
1086 for generic code and for matplotlib.
1074
1087
1075 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1088 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1076 -pylab, to simplify things for users. Will also remove the pylab
1089 -pylab, to simplify things for users. Will also remove the pylab
1077 profile, since now all of matplotlib configuration is directly
1090 profile, since now all of matplotlib configuration is directly
1078 handled here. This also reduces startup time.
1091 handled here. This also reduces startup time.
1079
1092
1080 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1093 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1081 shell wasn't being correctly called. Also in IPShellWX.
1094 shell wasn't being correctly called. Also in IPShellWX.
1082
1095
1083 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1096 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1084 fine-tune banner.
1097 fine-tune banner.
1085
1098
1086 * IPython/numutils.py (spike): Deprecate these spike functions,
1099 * IPython/numutils.py (spike): Deprecate these spike functions,
1087 delete (long deprecated) gnuplot_exec handler.
1100 delete (long deprecated) gnuplot_exec handler.
1088
1101
1089 2004-08-26 Fernando Perez <fperez@colorado.edu>
1102 2004-08-26 Fernando Perez <fperez@colorado.edu>
1090
1103
1091 * ipython.1: Update for threading options, plus some others which
1104 * ipython.1: Update for threading options, plus some others which
1092 were missing.
1105 were missing.
1093
1106
1094 * IPython/ipmaker.py (__call__): Added -wthread option for
1107 * IPython/ipmaker.py (__call__): Added -wthread option for
1095 wxpython thread handling. Make sure threading options are only
1108 wxpython thread handling. Make sure threading options are only
1096 valid at the command line.
1109 valid at the command line.
1097
1110
1098 * scripts/ipython: moved shell selection into a factory function
1111 * scripts/ipython: moved shell selection into a factory function
1099 in Shell.py, to keep the starter script to a minimum.
1112 in Shell.py, to keep the starter script to a minimum.
1100
1113
1101 2004-08-25 Fernando Perez <fperez@colorado.edu>
1114 2004-08-25 Fernando Perez <fperez@colorado.edu>
1102
1115
1103 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1116 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1104 John. Along with some recent changes he made to matplotlib, the
1117 John. Along with some recent changes he made to matplotlib, the
1105 next versions of both systems should work very well together.
1118 next versions of both systems should work very well together.
1106
1119
1107 2004-08-24 Fernando Perez <fperez@colorado.edu>
1120 2004-08-24 Fernando Perez <fperez@colorado.edu>
1108
1121
1109 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1122 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1110 tried to switch the profiling to using hotshot, but I'm getting
1123 tried to switch the profiling to using hotshot, but I'm getting
1111 strange errors from prof.runctx() there. I may be misreading the
1124 strange errors from prof.runctx() there. I may be misreading the
1112 docs, but it looks weird. For now the profiling code will
1125 docs, but it looks weird. For now the profiling code will
1113 continue to use the standard profiler.
1126 continue to use the standard profiler.
1114
1127
1115 2004-08-23 Fernando Perez <fperez@colorado.edu>
1128 2004-08-23 Fernando Perez <fperez@colorado.edu>
1116
1129
1117 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1130 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1118 threaded shell, by John Hunter. It's not quite ready yet, but
1131 threaded shell, by John Hunter. It's not quite ready yet, but
1119 close.
1132 close.
1120
1133
1121 2004-08-22 Fernando Perez <fperez@colorado.edu>
1134 2004-08-22 Fernando Perez <fperez@colorado.edu>
1122
1135
1123 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1136 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1124 in Magic and ultraTB.
1137 in Magic and ultraTB.
1125
1138
1126 * ipython.1: document threading options in manpage.
1139 * ipython.1: document threading options in manpage.
1127
1140
1128 * scripts/ipython: Changed name of -thread option to -gthread,
1141 * scripts/ipython: Changed name of -thread option to -gthread,
1129 since this is GTK specific. I want to leave the door open for a
1142 since this is GTK specific. I want to leave the door open for a
1130 -wthread option for WX, which will most likely be necessary. This
1143 -wthread option for WX, which will most likely be necessary. This
1131 change affects usage and ipmaker as well.
1144 change affects usage and ipmaker as well.
1132
1145
1133 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1146 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1134 handle the matplotlib shell issues. Code by John Hunter
1147 handle the matplotlib shell issues. Code by John Hunter
1135 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1148 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1136 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1149 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1137 broken (and disabled for end users) for now, but it puts the
1150 broken (and disabled for end users) for now, but it puts the
1138 infrastructure in place.
1151 infrastructure in place.
1139
1152
1140 2004-08-21 Fernando Perez <fperez@colorado.edu>
1153 2004-08-21 Fernando Perez <fperez@colorado.edu>
1141
1154
1142 * ipythonrc-pylab: Add matplotlib support.
1155 * ipythonrc-pylab: Add matplotlib support.
1143
1156
1144 * matplotlib_config.py: new files for matplotlib support, part of
1157 * matplotlib_config.py: new files for matplotlib support, part of
1145 the pylab profile.
1158 the pylab profile.
1146
1159
1147 * IPython/usage.py (__doc__): documented the threading options.
1160 * IPython/usage.py (__doc__): documented the threading options.
1148
1161
1149 2004-08-20 Fernando Perez <fperez@colorado.edu>
1162 2004-08-20 Fernando Perez <fperez@colorado.edu>
1150
1163
1151 * ipython: Modified the main calling routine to handle the -thread
1164 * ipython: Modified the main calling routine to handle the -thread
1152 and -mpthread options. This needs to be done as a top-level hack,
1165 and -mpthread options. This needs to be done as a top-level hack,
1153 because it determines which class to instantiate for IPython
1166 because it determines which class to instantiate for IPython
1154 itself.
1167 itself.
1155
1168
1156 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1169 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1157 classes to support multithreaded GTK operation without blocking,
1170 classes to support multithreaded GTK operation without blocking,
1158 and matplotlib with all backends. This is a lot of still very
1171 and matplotlib with all backends. This is a lot of still very
1159 experimental code, and threads are tricky. So it may still have a
1172 experimental code, and threads are tricky. So it may still have a
1160 few rough edges... This code owes a lot to
1173 few rough edges... This code owes a lot to
1161 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1174 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1162 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1175 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1163 to John Hunter for all the matplotlib work.
1176 to John Hunter for all the matplotlib work.
1164
1177
1165 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1178 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1166 options for gtk thread and matplotlib support.
1179 options for gtk thread and matplotlib support.
1167
1180
1168 2004-08-16 Fernando Perez <fperez@colorado.edu>
1181 2004-08-16 Fernando Perez <fperez@colorado.edu>
1169
1182
1170 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1183 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1171 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1184 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1172 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1185 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1173
1186
1174 2004-08-11 Fernando Perez <fperez@colorado.edu>
1187 2004-08-11 Fernando Perez <fperez@colorado.edu>
1175
1188
1176 * setup.py (isfile): Fix build so documentation gets updated for
1189 * setup.py (isfile): Fix build so documentation gets updated for
1177 rpms (it was only done for .tgz builds).
1190 rpms (it was only done for .tgz builds).
1178
1191
1179 2004-08-10 Fernando Perez <fperez@colorado.edu>
1192 2004-08-10 Fernando Perez <fperez@colorado.edu>
1180
1193
1181 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1194 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1182
1195
1183 * iplib.py : Silence syntax error exceptions in tab-completion.
1196 * iplib.py : Silence syntax error exceptions in tab-completion.
1184
1197
1185 2004-08-05 Fernando Perez <fperez@colorado.edu>
1198 2004-08-05 Fernando Perez <fperez@colorado.edu>
1186
1199
1187 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1200 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1188 'color off' mark for continuation prompts. This was causing long
1201 'color off' mark for continuation prompts. This was causing long
1189 continuation lines to mis-wrap.
1202 continuation lines to mis-wrap.
1190
1203
1191 2004-08-01 Fernando Perez <fperez@colorado.edu>
1204 2004-08-01 Fernando Perez <fperez@colorado.edu>
1192
1205
1193 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1206 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1194 for building ipython to be a parameter. All this is necessary
1207 for building ipython to be a parameter. All this is necessary
1195 right now to have a multithreaded version, but this insane
1208 right now to have a multithreaded version, but this insane
1196 non-design will be cleaned up soon. For now, it's a hack that
1209 non-design will be cleaned up soon. For now, it's a hack that
1197 works.
1210 works.
1198
1211
1199 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1212 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1200 args in various places. No bugs so far, but it's a dangerous
1213 args in various places. No bugs so far, but it's a dangerous
1201 practice.
1214 practice.
1202
1215
1203 2004-07-31 Fernando Perez <fperez@colorado.edu>
1216 2004-07-31 Fernando Perez <fperez@colorado.edu>
1204
1217
1205 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1218 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1206 fix completion of files with dots in their names under most
1219 fix completion of files with dots in their names under most
1207 profiles (pysh was OK because the completion order is different).
1220 profiles (pysh was OK because the completion order is different).
1208
1221
1209 2004-07-27 Fernando Perez <fperez@colorado.edu>
1222 2004-07-27 Fernando Perez <fperez@colorado.edu>
1210
1223
1211 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1224 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1212 keywords manually, b/c the one in keyword.py was removed in python
1225 keywords manually, b/c the one in keyword.py was removed in python
1213 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1226 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1214 This is NOT a bug under python 2.3 and earlier.
1227 This is NOT a bug under python 2.3 and earlier.
1215
1228
1216 2004-07-26 Fernando Perez <fperez@colorado.edu>
1229 2004-07-26 Fernando Perez <fperez@colorado.edu>
1217
1230
1218 * IPython/ultraTB.py (VerboseTB.text): Add another
1231 * IPython/ultraTB.py (VerboseTB.text): Add another
1219 linecache.checkcache() call to try to prevent inspect.py from
1232 linecache.checkcache() call to try to prevent inspect.py from
1220 crashing under python 2.3. I think this fixes
1233 crashing under python 2.3. I think this fixes
1221 http://www.scipy.net/roundup/ipython/issue17.
1234 http://www.scipy.net/roundup/ipython/issue17.
1222
1235
1223 2004-07-26 *** Released version 0.6.2
1236 2004-07-26 *** Released version 0.6.2
1224
1237
1225 2004-07-26 Fernando Perez <fperez@colorado.edu>
1238 2004-07-26 Fernando Perez <fperez@colorado.edu>
1226
1239
1227 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1240 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1228 fail for any number.
1241 fail for any number.
1229 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1242 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1230 empty bookmarks.
1243 empty bookmarks.
1231
1244
1232 2004-07-26 *** Released version 0.6.1
1245 2004-07-26 *** Released version 0.6.1
1233
1246
1234 2004-07-26 Fernando Perez <fperez@colorado.edu>
1247 2004-07-26 Fernando Perez <fperez@colorado.edu>
1235
1248
1236 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1249 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1237
1250
1238 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1251 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1239 escaping '()[]{}' in filenames.
1252 escaping '()[]{}' in filenames.
1240
1253
1241 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1254 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1242 Python 2.2 users who lack a proper shlex.split.
1255 Python 2.2 users who lack a proper shlex.split.
1243
1256
1244 2004-07-19 Fernando Perez <fperez@colorado.edu>
1257 2004-07-19 Fernando Perez <fperez@colorado.edu>
1245
1258
1246 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1259 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1247 for reading readline's init file. I follow the normal chain:
1260 for reading readline's init file. I follow the normal chain:
1248 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1261 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1249 report by Mike Heeter. This closes
1262 report by Mike Heeter. This closes
1250 http://www.scipy.net/roundup/ipython/issue16.
1263 http://www.scipy.net/roundup/ipython/issue16.
1251
1264
1252 2004-07-18 Fernando Perez <fperez@colorado.edu>
1265 2004-07-18 Fernando Perez <fperez@colorado.edu>
1253
1266
1254 * IPython/iplib.py (__init__): Add better handling of '\' under
1267 * IPython/iplib.py (__init__): Add better handling of '\' under
1255 Win32 for filenames. After a patch by Ville.
1268 Win32 for filenames. After a patch by Ville.
1256
1269
1257 2004-07-17 Fernando Perez <fperez@colorado.edu>
1270 2004-07-17 Fernando Perez <fperez@colorado.edu>
1258
1271
1259 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1272 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1260 autocalling would be triggered for 'foo is bar' if foo is
1273 autocalling would be triggered for 'foo is bar' if foo is
1261 callable. I also cleaned up the autocall detection code to use a
1274 callable. I also cleaned up the autocall detection code to use a
1262 regexp, which is faster. Bug reported by Alexander Schmolck.
1275 regexp, which is faster. Bug reported by Alexander Schmolck.
1263
1276
1264 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1277 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1265 '?' in them would confuse the help system. Reported by Alex
1278 '?' in them would confuse the help system. Reported by Alex
1266 Schmolck.
1279 Schmolck.
1267
1280
1268 2004-07-16 Fernando Perez <fperez@colorado.edu>
1281 2004-07-16 Fernando Perez <fperez@colorado.edu>
1269
1282
1270 * IPython/GnuplotInteractive.py (__all__): added plot2.
1283 * IPython/GnuplotInteractive.py (__all__): added plot2.
1271
1284
1272 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1285 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1273 plotting dictionaries, lists or tuples of 1d arrays.
1286 plotting dictionaries, lists or tuples of 1d arrays.
1274
1287
1275 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1288 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1276 optimizations.
1289 optimizations.
1277
1290
1278 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1291 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1279 the information which was there from Janko's original IPP code:
1292 the information which was there from Janko's original IPP code:
1280
1293
1281 03.05.99 20:53 porto.ifm.uni-kiel.de
1294 03.05.99 20:53 porto.ifm.uni-kiel.de
1282 --Started changelog.
1295 --Started changelog.
1283 --make clear do what it say it does
1296 --make clear do what it say it does
1284 --added pretty output of lines from inputcache
1297 --added pretty output of lines from inputcache
1285 --Made Logger a mixin class, simplifies handling of switches
1298 --Made Logger a mixin class, simplifies handling of switches
1286 --Added own completer class. .string<TAB> expands to last history
1299 --Added own completer class. .string<TAB> expands to last history
1287 line which starts with string. The new expansion is also present
1300 line which starts with string. The new expansion is also present
1288 with Ctrl-r from the readline library. But this shows, who this
1301 with Ctrl-r from the readline library. But this shows, who this
1289 can be done for other cases.
1302 can be done for other cases.
1290 --Added convention that all shell functions should accept a
1303 --Added convention that all shell functions should accept a
1291 parameter_string This opens the door for different behaviour for
1304 parameter_string This opens the door for different behaviour for
1292 each function. @cd is a good example of this.
1305 each function. @cd is a good example of this.
1293
1306
1294 04.05.99 12:12 porto.ifm.uni-kiel.de
1307 04.05.99 12:12 porto.ifm.uni-kiel.de
1295 --added logfile rotation
1308 --added logfile rotation
1296 --added new mainloop method which freezes first the namespace
1309 --added new mainloop method which freezes first the namespace
1297
1310
1298 07.05.99 21:24 porto.ifm.uni-kiel.de
1311 07.05.99 21:24 porto.ifm.uni-kiel.de
1299 --added the docreader classes. Now there is a help system.
1312 --added the docreader classes. Now there is a help system.
1300 -This is only a first try. Currently it's not easy to put new
1313 -This is only a first try. Currently it's not easy to put new
1301 stuff in the indices. But this is the way to go. Info would be
1314 stuff in the indices. But this is the way to go. Info would be
1302 better, but HTML is every where and not everybody has an info
1315 better, but HTML is every where and not everybody has an info
1303 system installed and it's not so easy to change html-docs to info.
1316 system installed and it's not so easy to change html-docs to info.
1304 --added global logfile option
1317 --added global logfile option
1305 --there is now a hook for object inspection method pinfo needs to
1318 --there is now a hook for object inspection method pinfo needs to
1306 be provided for this. Can be reached by two '??'.
1319 be provided for this. Can be reached by two '??'.
1307
1320
1308 08.05.99 20:51 porto.ifm.uni-kiel.de
1321 08.05.99 20:51 porto.ifm.uni-kiel.de
1309 --added a README
1322 --added a README
1310 --bug in rc file. Something has changed so functions in the rc
1323 --bug in rc file. Something has changed so functions in the rc
1311 file need to reference the shell and not self. Not clear if it's a
1324 file need to reference the shell and not self. Not clear if it's a
1312 bug or feature.
1325 bug or feature.
1313 --changed rc file for new behavior
1326 --changed rc file for new behavior
1314
1327
1315 2004-07-15 Fernando Perez <fperez@colorado.edu>
1328 2004-07-15 Fernando Perez <fperez@colorado.edu>
1316
1329
1317 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1330 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1318 cache was falling out of sync in bizarre manners when multi-line
1331 cache was falling out of sync in bizarre manners when multi-line
1319 input was present. Minor optimizations and cleanup.
1332 input was present. Minor optimizations and cleanup.
1320
1333
1321 (Logger): Remove old Changelog info for cleanup. This is the
1334 (Logger): Remove old Changelog info for cleanup. This is the
1322 information which was there from Janko's original code:
1335 information which was there from Janko's original code:
1323
1336
1324 Changes to Logger: - made the default log filename a parameter
1337 Changes to Logger: - made the default log filename a parameter
1325
1338
1326 - put a check for lines beginning with !@? in log(). Needed
1339 - put a check for lines beginning with !@? in log(). Needed
1327 (even if the handlers properly log their lines) for mid-session
1340 (even if the handlers properly log their lines) for mid-session
1328 logging activation to work properly. Without this, lines logged
1341 logging activation to work properly. Without this, lines logged
1329 in mid session, which get read from the cache, would end up
1342 in mid session, which get read from the cache, would end up
1330 'bare' (with !@? in the open) in the log. Now they are caught
1343 'bare' (with !@? in the open) in the log. Now they are caught
1331 and prepended with a #.
1344 and prepended with a #.
1332
1345
1333 * IPython/iplib.py (InteractiveShell.init_readline): added check
1346 * IPython/iplib.py (InteractiveShell.init_readline): added check
1334 in case MagicCompleter fails to be defined, so we don't crash.
1347 in case MagicCompleter fails to be defined, so we don't crash.
1335
1348
1336 2004-07-13 Fernando Perez <fperez@colorado.edu>
1349 2004-07-13 Fernando Perez <fperez@colorado.edu>
1337
1350
1338 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1351 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1339 of EPS if the requested filename ends in '.eps'.
1352 of EPS if the requested filename ends in '.eps'.
1340
1353
1341 2004-07-04 Fernando Perez <fperez@colorado.edu>
1354 2004-07-04 Fernando Perez <fperez@colorado.edu>
1342
1355
1343 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1356 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1344 escaping of quotes when calling the shell.
1357 escaping of quotes when calling the shell.
1345
1358
1346 2004-07-02 Fernando Perez <fperez@colorado.edu>
1359 2004-07-02 Fernando Perez <fperez@colorado.edu>
1347
1360
1348 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1361 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1349 gettext not working because we were clobbering '_'. Fixes
1362 gettext not working because we were clobbering '_'. Fixes
1350 http://www.scipy.net/roundup/ipython/issue6.
1363 http://www.scipy.net/roundup/ipython/issue6.
1351
1364
1352 2004-07-01 Fernando Perez <fperez@colorado.edu>
1365 2004-07-01 Fernando Perez <fperez@colorado.edu>
1353
1366
1354 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1367 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1355 into @cd. Patch by Ville.
1368 into @cd. Patch by Ville.
1356
1369
1357 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1370 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1358 new function to store things after ipmaker runs. Patch by Ville.
1371 new function to store things after ipmaker runs. Patch by Ville.
1359 Eventually this will go away once ipmaker is removed and the class
1372 Eventually this will go away once ipmaker is removed and the class
1360 gets cleaned up, but for now it's ok. Key functionality here is
1373 gets cleaned up, but for now it's ok. Key functionality here is
1361 the addition of the persistent storage mechanism, a dict for
1374 the addition of the persistent storage mechanism, a dict for
1362 keeping data across sessions (for now just bookmarks, but more can
1375 keeping data across sessions (for now just bookmarks, but more can
1363 be implemented later).
1376 be implemented later).
1364
1377
1365 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1378 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1366 persistent across sections. Patch by Ville, I modified it
1379 persistent across sections. Patch by Ville, I modified it
1367 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1380 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1368 added a '-l' option to list all bookmarks.
1381 added a '-l' option to list all bookmarks.
1369
1382
1370 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1383 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1371 center for cleanup. Registered with atexit.register(). I moved
1384 center for cleanup. Registered with atexit.register(). I moved
1372 here the old exit_cleanup(). After a patch by Ville.
1385 here the old exit_cleanup(). After a patch by Ville.
1373
1386
1374 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1387 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1375 characters in the hacked shlex_split for python 2.2.
1388 characters in the hacked shlex_split for python 2.2.
1376
1389
1377 * IPython/iplib.py (file_matches): more fixes to filenames with
1390 * IPython/iplib.py (file_matches): more fixes to filenames with
1378 whitespace in them. It's not perfect, but limitations in python's
1391 whitespace in them. It's not perfect, but limitations in python's
1379 readline make it impossible to go further.
1392 readline make it impossible to go further.
1380
1393
1381 2004-06-29 Fernando Perez <fperez@colorado.edu>
1394 2004-06-29 Fernando Perez <fperez@colorado.edu>
1382
1395
1383 * IPython/iplib.py (file_matches): escape whitespace correctly in
1396 * IPython/iplib.py (file_matches): escape whitespace correctly in
1384 filename completions. Bug reported by Ville.
1397 filename completions. Bug reported by Ville.
1385
1398
1386 2004-06-28 Fernando Perez <fperez@colorado.edu>
1399 2004-06-28 Fernando Perez <fperez@colorado.edu>
1387
1400
1388 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1401 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1389 the history file will be called 'history-PROFNAME' (or just
1402 the history file will be called 'history-PROFNAME' (or just
1390 'history' if no profile is loaded). I was getting annoyed at
1403 'history' if no profile is loaded). I was getting annoyed at
1391 getting my Numerical work history clobbered by pysh sessions.
1404 getting my Numerical work history clobbered by pysh sessions.
1392
1405
1393 * IPython/iplib.py (InteractiveShell.__init__): Internal
1406 * IPython/iplib.py (InteractiveShell.__init__): Internal
1394 getoutputerror() function so that we can honor the system_verbose
1407 getoutputerror() function so that we can honor the system_verbose
1395 flag for _all_ system calls. I also added escaping of #
1408 flag for _all_ system calls. I also added escaping of #
1396 characters here to avoid confusing Itpl.
1409 characters here to avoid confusing Itpl.
1397
1410
1398 * IPython/Magic.py (shlex_split): removed call to shell in
1411 * IPython/Magic.py (shlex_split): removed call to shell in
1399 parse_options and replaced it with shlex.split(). The annoying
1412 parse_options and replaced it with shlex.split(). The annoying
1400 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1413 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1401 to backport it from 2.3, with several frail hacks (the shlex
1414 to backport it from 2.3, with several frail hacks (the shlex
1402 module is rather limited in 2.2). Thanks to a suggestion by Ville
1415 module is rather limited in 2.2). Thanks to a suggestion by Ville
1403 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1416 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1404 problem.
1417 problem.
1405
1418
1406 (Magic.magic_system_verbose): new toggle to print the actual
1419 (Magic.magic_system_verbose): new toggle to print the actual
1407 system calls made by ipython. Mainly for debugging purposes.
1420 system calls made by ipython. Mainly for debugging purposes.
1408
1421
1409 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1422 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1410 doesn't support persistence. Reported (and fix suggested) by
1423 doesn't support persistence. Reported (and fix suggested) by
1411 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1424 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1412
1425
1413 2004-06-26 Fernando Perez <fperez@colorado.edu>
1426 2004-06-26 Fernando Perez <fperez@colorado.edu>
1414
1427
1415 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1428 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1416 continue prompts.
1429 continue prompts.
1417
1430
1418 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1431 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1419 function (basically a big docstring) and a few more things here to
1432 function (basically a big docstring) and a few more things here to
1420 speedup startup. pysh.py is now very lightweight. We want because
1433 speedup startup. pysh.py is now very lightweight. We want because
1421 it gets execfile'd, while InterpreterExec gets imported, so
1434 it gets execfile'd, while InterpreterExec gets imported, so
1422 byte-compilation saves time.
1435 byte-compilation saves time.
1423
1436
1424 2004-06-25 Fernando Perez <fperez@colorado.edu>
1437 2004-06-25 Fernando Perez <fperez@colorado.edu>
1425
1438
1426 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1439 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1427 -NUM', which was recently broken.
1440 -NUM', which was recently broken.
1428
1441
1429 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1442 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1430 in multi-line input (but not !!, which doesn't make sense there).
1443 in multi-line input (but not !!, which doesn't make sense there).
1431
1444
1432 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1445 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1433 It's just too useful, and people can turn it off in the less
1446 It's just too useful, and people can turn it off in the less
1434 common cases where it's a problem.
1447 common cases where it's a problem.
1435
1448
1436 2004-06-24 Fernando Perez <fperez@colorado.edu>
1449 2004-06-24 Fernando Perez <fperez@colorado.edu>
1437
1450
1438 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1451 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1439 special syntaxes (like alias calling) is now allied in multi-line
1452 special syntaxes (like alias calling) is now allied in multi-line
1440 input. This is still _very_ experimental, but it's necessary for
1453 input. This is still _very_ experimental, but it's necessary for
1441 efficient shell usage combining python looping syntax with system
1454 efficient shell usage combining python looping syntax with system
1442 calls. For now it's restricted to aliases, I don't think it
1455 calls. For now it's restricted to aliases, I don't think it
1443 really even makes sense to have this for magics.
1456 really even makes sense to have this for magics.
1444
1457
1445 2004-06-23 Fernando Perez <fperez@colorado.edu>
1458 2004-06-23 Fernando Perez <fperez@colorado.edu>
1446
1459
1447 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1460 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1448 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1461 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1449
1462
1450 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1463 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1451 extensions under Windows (after code sent by Gary Bishop). The
1464 extensions under Windows (after code sent by Gary Bishop). The
1452 extensions considered 'executable' are stored in IPython's rc
1465 extensions considered 'executable' are stored in IPython's rc
1453 structure as win_exec_ext.
1466 structure as win_exec_ext.
1454
1467
1455 * IPython/genutils.py (shell): new function, like system() but
1468 * IPython/genutils.py (shell): new function, like system() but
1456 without return value. Very useful for interactive shell work.
1469 without return value. Very useful for interactive shell work.
1457
1470
1458 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1471 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1459 delete aliases.
1472 delete aliases.
1460
1473
1461 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1474 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1462 sure that the alias table doesn't contain python keywords.
1475 sure that the alias table doesn't contain python keywords.
1463
1476
1464 2004-06-21 Fernando Perez <fperez@colorado.edu>
1477 2004-06-21 Fernando Perez <fperez@colorado.edu>
1465
1478
1466 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1479 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1467 non-existent items are found in $PATH. Reported by Thorsten.
1480 non-existent items are found in $PATH. Reported by Thorsten.
1468
1481
1469 2004-06-20 Fernando Perez <fperez@colorado.edu>
1482 2004-06-20 Fernando Perez <fperez@colorado.edu>
1470
1483
1471 * IPython/iplib.py (complete): modified the completer so that the
1484 * IPython/iplib.py (complete): modified the completer so that the
1472 order of priorities can be easily changed at runtime.
1485 order of priorities can be easily changed at runtime.
1473
1486
1474 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1487 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1475 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1488 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1476
1489
1477 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1490 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1478 expand Python variables prepended with $ in all system calls. The
1491 expand Python variables prepended with $ in all system calls. The
1479 same was done to InteractiveShell.handle_shell_escape. Now all
1492 same was done to InteractiveShell.handle_shell_escape. Now all
1480 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1493 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1481 expansion of python variables and expressions according to the
1494 expansion of python variables and expressions according to the
1482 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1495 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1483
1496
1484 Though PEP-215 has been rejected, a similar (but simpler) one
1497 Though PEP-215 has been rejected, a similar (but simpler) one
1485 seems like it will go into Python 2.4, PEP-292 -
1498 seems like it will go into Python 2.4, PEP-292 -
1486 http://www.python.org/peps/pep-0292.html.
1499 http://www.python.org/peps/pep-0292.html.
1487
1500
1488 I'll keep the full syntax of PEP-215, since IPython has since the
1501 I'll keep the full syntax of PEP-215, since IPython has since the
1489 start used Ka-Ping Yee's reference implementation discussed there
1502 start used Ka-Ping Yee's reference implementation discussed there
1490 (Itpl), and I actually like the powerful semantics it offers.
1503 (Itpl), and I actually like the powerful semantics it offers.
1491
1504
1492 In order to access normal shell variables, the $ has to be escaped
1505 In order to access normal shell variables, the $ has to be escaped
1493 via an extra $. For example:
1506 via an extra $. For example:
1494
1507
1495 In [7]: PATH='a python variable'
1508 In [7]: PATH='a python variable'
1496
1509
1497 In [8]: !echo $PATH
1510 In [8]: !echo $PATH
1498 a python variable
1511 a python variable
1499
1512
1500 In [9]: !echo $$PATH
1513 In [9]: !echo $$PATH
1501 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1514 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1502
1515
1503 (Magic.parse_options): escape $ so the shell doesn't evaluate
1516 (Magic.parse_options): escape $ so the shell doesn't evaluate
1504 things prematurely.
1517 things prematurely.
1505
1518
1506 * IPython/iplib.py (InteractiveShell.call_alias): added the
1519 * IPython/iplib.py (InteractiveShell.call_alias): added the
1507 ability for aliases to expand python variables via $.
1520 ability for aliases to expand python variables via $.
1508
1521
1509 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1522 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1510 system, now there's a @rehash/@rehashx pair of magics. These work
1523 system, now there's a @rehash/@rehashx pair of magics. These work
1511 like the csh rehash command, and can be invoked at any time. They
1524 like the csh rehash command, and can be invoked at any time. They
1512 build a table of aliases to everything in the user's $PATH
1525 build a table of aliases to everything in the user's $PATH
1513 (@rehash uses everything, @rehashx is slower but only adds
1526 (@rehash uses everything, @rehashx is slower but only adds
1514 executable files). With this, the pysh.py-based shell profile can
1527 executable files). With this, the pysh.py-based shell profile can
1515 now simply call rehash upon startup, and full access to all
1528 now simply call rehash upon startup, and full access to all
1516 programs in the user's path is obtained.
1529 programs in the user's path is obtained.
1517
1530
1518 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1531 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1519 functionality is now fully in place. I removed the old dynamic
1532 functionality is now fully in place. I removed the old dynamic
1520 code generation based approach, in favor of a much lighter one
1533 code generation based approach, in favor of a much lighter one
1521 based on a simple dict. The advantage is that this allows me to
1534 based on a simple dict. The advantage is that this allows me to
1522 now have thousands of aliases with negligible cost (unthinkable
1535 now have thousands of aliases with negligible cost (unthinkable
1523 with the old system).
1536 with the old system).
1524
1537
1525 2004-06-19 Fernando Perez <fperez@colorado.edu>
1538 2004-06-19 Fernando Perez <fperez@colorado.edu>
1526
1539
1527 * IPython/iplib.py (__init__): extended MagicCompleter class to
1540 * IPython/iplib.py (__init__): extended MagicCompleter class to
1528 also complete (last in priority) on user aliases.
1541 also complete (last in priority) on user aliases.
1529
1542
1530 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1543 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1531 call to eval.
1544 call to eval.
1532 (ItplNS.__init__): Added a new class which functions like Itpl,
1545 (ItplNS.__init__): Added a new class which functions like Itpl,
1533 but allows configuring the namespace for the evaluation to occur
1546 but allows configuring the namespace for the evaluation to occur
1534 in.
1547 in.
1535
1548
1536 2004-06-18 Fernando Perez <fperez@colorado.edu>
1549 2004-06-18 Fernando Perez <fperez@colorado.edu>
1537
1550
1538 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1551 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1539 better message when 'exit' or 'quit' are typed (a common newbie
1552 better message when 'exit' or 'quit' are typed (a common newbie
1540 confusion).
1553 confusion).
1541
1554
1542 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1555 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1543 check for Windows users.
1556 check for Windows users.
1544
1557
1545 * IPython/iplib.py (InteractiveShell.user_setup): removed
1558 * IPython/iplib.py (InteractiveShell.user_setup): removed
1546 disabling of colors for Windows. I'll test at runtime and issue a
1559 disabling of colors for Windows. I'll test at runtime and issue a
1547 warning if Gary's readline isn't found, as to nudge users to
1560 warning if Gary's readline isn't found, as to nudge users to
1548 download it.
1561 download it.
1549
1562
1550 2004-06-16 Fernando Perez <fperez@colorado.edu>
1563 2004-06-16 Fernando Perez <fperez@colorado.edu>
1551
1564
1552 * IPython/genutils.py (Stream.__init__): changed to print errors
1565 * IPython/genutils.py (Stream.__init__): changed to print errors
1553 to sys.stderr. I had a circular dependency here. Now it's
1566 to sys.stderr. I had a circular dependency here. Now it's
1554 possible to run ipython as IDLE's shell (consider this pre-alpha,
1567 possible to run ipython as IDLE's shell (consider this pre-alpha,
1555 since true stdout things end up in the starting terminal instead
1568 since true stdout things end up in the starting terminal instead
1556 of IDLE's out).
1569 of IDLE's out).
1557
1570
1558 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1571 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1559 users who haven't # updated their prompt_in2 definitions. Remove
1572 users who haven't # updated their prompt_in2 definitions. Remove
1560 eventually.
1573 eventually.
1561 (multiple_replace): added credit to original ASPN recipe.
1574 (multiple_replace): added credit to original ASPN recipe.
1562
1575
1563 2004-06-15 Fernando Perez <fperez@colorado.edu>
1576 2004-06-15 Fernando Perez <fperez@colorado.edu>
1564
1577
1565 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1578 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1566 list of auto-defined aliases.
1579 list of auto-defined aliases.
1567
1580
1568 2004-06-13 Fernando Perez <fperez@colorado.edu>
1581 2004-06-13 Fernando Perez <fperez@colorado.edu>
1569
1582
1570 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1583 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1571 install was really requested (so setup.py can be used for other
1584 install was really requested (so setup.py can be used for other
1572 things under Windows).
1585 things under Windows).
1573
1586
1574 2004-06-10 Fernando Perez <fperez@colorado.edu>
1587 2004-06-10 Fernando Perez <fperez@colorado.edu>
1575
1588
1576 * IPython/Logger.py (Logger.create_log): Manually remove any old
1589 * IPython/Logger.py (Logger.create_log): Manually remove any old
1577 backup, since os.remove may fail under Windows. Fixes bug
1590 backup, since os.remove may fail under Windows. Fixes bug
1578 reported by Thorsten.
1591 reported by Thorsten.
1579
1592
1580 2004-06-09 Fernando Perez <fperez@colorado.edu>
1593 2004-06-09 Fernando Perez <fperez@colorado.edu>
1581
1594
1582 * examples/example-embed.py: fixed all references to %n (replaced
1595 * examples/example-embed.py: fixed all references to %n (replaced
1583 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1596 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1584 for all examples and the manual as well.
1597 for all examples and the manual as well.
1585
1598
1586 2004-06-08 Fernando Perez <fperez@colorado.edu>
1599 2004-06-08 Fernando Perez <fperez@colorado.edu>
1587
1600
1588 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1601 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1589 alignment and color management. All 3 prompt subsystems now
1602 alignment and color management. All 3 prompt subsystems now
1590 inherit from BasePrompt.
1603 inherit from BasePrompt.
1591
1604
1592 * tools/release: updates for windows installer build and tag rpms
1605 * tools/release: updates for windows installer build and tag rpms
1593 with python version (since paths are fixed).
1606 with python version (since paths are fixed).
1594
1607
1595 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1608 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1596 which will become eventually obsolete. Also fixed the default
1609 which will become eventually obsolete. Also fixed the default
1597 prompt_in2 to use \D, so at least new users start with the correct
1610 prompt_in2 to use \D, so at least new users start with the correct
1598 defaults.
1611 defaults.
1599 WARNING: Users with existing ipythonrc files will need to apply
1612 WARNING: Users with existing ipythonrc files will need to apply
1600 this fix manually!
1613 this fix manually!
1601
1614
1602 * setup.py: make windows installer (.exe). This is finally the
1615 * setup.py: make windows installer (.exe). This is finally the
1603 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1616 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1604 which I hadn't included because it required Python 2.3 (or recent
1617 which I hadn't included because it required Python 2.3 (or recent
1605 distutils).
1618 distutils).
1606
1619
1607 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1620 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1608 usage of new '\D' escape.
1621 usage of new '\D' escape.
1609
1622
1610 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1623 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1611 lacks os.getuid())
1624 lacks os.getuid())
1612 (CachedOutput.set_colors): Added the ability to turn coloring
1625 (CachedOutput.set_colors): Added the ability to turn coloring
1613 on/off with @colors even for manually defined prompt colors. It
1626 on/off with @colors even for manually defined prompt colors. It
1614 uses a nasty global, but it works safely and via the generic color
1627 uses a nasty global, but it works safely and via the generic color
1615 handling mechanism.
1628 handling mechanism.
1616 (Prompt2.__init__): Introduced new escape '\D' for continuation
1629 (Prompt2.__init__): Introduced new escape '\D' for continuation
1617 prompts. It represents the counter ('\#') as dots.
1630 prompts. It represents the counter ('\#') as dots.
1618 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1631 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1619 need to update their ipythonrc files and replace '%n' with '\D' in
1632 need to update their ipythonrc files and replace '%n' with '\D' in
1620 their prompt_in2 settings everywhere. Sorry, but there's
1633 their prompt_in2 settings everywhere. Sorry, but there's
1621 otherwise no clean way to get all prompts to properly align. The
1634 otherwise no clean way to get all prompts to properly align. The
1622 ipythonrc shipped with IPython has been updated.
1635 ipythonrc shipped with IPython has been updated.
1623
1636
1624 2004-06-07 Fernando Perez <fperez@colorado.edu>
1637 2004-06-07 Fernando Perez <fperez@colorado.edu>
1625
1638
1626 * setup.py (isfile): Pass local_icons option to latex2html, so the
1639 * setup.py (isfile): Pass local_icons option to latex2html, so the
1627 resulting HTML file is self-contained. Thanks to
1640 resulting HTML file is self-contained. Thanks to
1628 dryice-AT-liu.com.cn for the tip.
1641 dryice-AT-liu.com.cn for the tip.
1629
1642
1630 * pysh.py: I created a new profile 'shell', which implements a
1643 * pysh.py: I created a new profile 'shell', which implements a
1631 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1644 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1632 system shell, nor will it become one anytime soon. It's mainly
1645 system shell, nor will it become one anytime soon. It's mainly
1633 meant to illustrate the use of the new flexible bash-like prompts.
1646 meant to illustrate the use of the new flexible bash-like prompts.
1634 I guess it could be used by hardy souls for true shell management,
1647 I guess it could be used by hardy souls for true shell management,
1635 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1648 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1636 profile. This uses the InterpreterExec extension provided by
1649 profile. This uses the InterpreterExec extension provided by
1637 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1650 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1638
1651
1639 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1652 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1640 auto-align itself with the length of the previous input prompt
1653 auto-align itself with the length of the previous input prompt
1641 (taking into account the invisible color escapes).
1654 (taking into account the invisible color escapes).
1642 (CachedOutput.__init__): Large restructuring of this class. Now
1655 (CachedOutput.__init__): Large restructuring of this class. Now
1643 all three prompts (primary1, primary2, output) are proper objects,
1656 all three prompts (primary1, primary2, output) are proper objects,
1644 managed by the 'parent' CachedOutput class. The code is still a
1657 managed by the 'parent' CachedOutput class. The code is still a
1645 bit hackish (all prompts share state via a pointer to the cache),
1658 bit hackish (all prompts share state via a pointer to the cache),
1646 but it's overall far cleaner than before.
1659 but it's overall far cleaner than before.
1647
1660
1648 * IPython/genutils.py (getoutputerror): modified to add verbose,
1661 * IPython/genutils.py (getoutputerror): modified to add verbose,
1649 debug and header options. This makes the interface of all getout*
1662 debug and header options. This makes the interface of all getout*
1650 functions uniform.
1663 functions uniform.
1651 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1664 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1652
1665
1653 * IPython/Magic.py (Magic.default_option): added a function to
1666 * IPython/Magic.py (Magic.default_option): added a function to
1654 allow registering default options for any magic command. This
1667 allow registering default options for any magic command. This
1655 makes it easy to have profiles which customize the magics globally
1668 makes it easy to have profiles which customize the magics globally
1656 for a certain use. The values set through this function are
1669 for a certain use. The values set through this function are
1657 picked up by the parse_options() method, which all magics should
1670 picked up by the parse_options() method, which all magics should
1658 use to parse their options.
1671 use to parse their options.
1659
1672
1660 * IPython/genutils.py (warn): modified the warnings framework to
1673 * IPython/genutils.py (warn): modified the warnings framework to
1661 use the Term I/O class. I'm trying to slowly unify all of
1674 use the Term I/O class. I'm trying to slowly unify all of
1662 IPython's I/O operations to pass through Term.
1675 IPython's I/O operations to pass through Term.
1663
1676
1664 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1677 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1665 the secondary prompt to correctly match the length of the primary
1678 the secondary prompt to correctly match the length of the primary
1666 one for any prompt. Now multi-line code will properly line up
1679 one for any prompt. Now multi-line code will properly line up
1667 even for path dependent prompts, such as the new ones available
1680 even for path dependent prompts, such as the new ones available
1668 via the prompt_specials.
1681 via the prompt_specials.
1669
1682
1670 2004-06-06 Fernando Perez <fperez@colorado.edu>
1683 2004-06-06 Fernando Perez <fperez@colorado.edu>
1671
1684
1672 * IPython/Prompts.py (prompt_specials): Added the ability to have
1685 * IPython/Prompts.py (prompt_specials): Added the ability to have
1673 bash-like special sequences in the prompts, which get
1686 bash-like special sequences in the prompts, which get
1674 automatically expanded. Things like hostname, current working
1687 automatically expanded. Things like hostname, current working
1675 directory and username are implemented already, but it's easy to
1688 directory and username are implemented already, but it's easy to
1676 add more in the future. Thanks to a patch by W.J. van der Laan
1689 add more in the future. Thanks to a patch by W.J. van der Laan
1677 <gnufnork-AT-hetdigitalegat.nl>
1690 <gnufnork-AT-hetdigitalegat.nl>
1678 (prompt_specials): Added color support for prompt strings, so
1691 (prompt_specials): Added color support for prompt strings, so
1679 users can define arbitrary color setups for their prompts.
1692 users can define arbitrary color setups for their prompts.
1680
1693
1681 2004-06-05 Fernando Perez <fperez@colorado.edu>
1694 2004-06-05 Fernando Perez <fperez@colorado.edu>
1682
1695
1683 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1696 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1684 code to load Gary Bishop's readline and configure it
1697 code to load Gary Bishop's readline and configure it
1685 automatically. Thanks to Gary for help on this.
1698 automatically. Thanks to Gary for help on this.
1686
1699
1687 2004-06-01 Fernando Perez <fperez@colorado.edu>
1700 2004-06-01 Fernando Perez <fperez@colorado.edu>
1688
1701
1689 * IPython/Logger.py (Logger.create_log): fix bug for logging
1702 * IPython/Logger.py (Logger.create_log): fix bug for logging
1690 with no filename (previous fix was incomplete).
1703 with no filename (previous fix was incomplete).
1691
1704
1692 2004-05-25 Fernando Perez <fperez@colorado.edu>
1705 2004-05-25 Fernando Perez <fperez@colorado.edu>
1693
1706
1694 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1707 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1695 parens would get passed to the shell.
1708 parens would get passed to the shell.
1696
1709
1697 2004-05-20 Fernando Perez <fperez@colorado.edu>
1710 2004-05-20 Fernando Perez <fperez@colorado.edu>
1698
1711
1699 * IPython/Magic.py (Magic.magic_prun): changed default profile
1712 * IPython/Magic.py (Magic.magic_prun): changed default profile
1700 sort order to 'time' (the more common profiling need).
1713 sort order to 'time' (the more common profiling need).
1701
1714
1702 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1715 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1703 so that source code shown is guaranteed in sync with the file on
1716 so that source code shown is guaranteed in sync with the file on
1704 disk (also changed in psource). Similar fix to the one for
1717 disk (also changed in psource). Similar fix to the one for
1705 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1718 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1706 <yann.ledu-AT-noos.fr>.
1719 <yann.ledu-AT-noos.fr>.
1707
1720
1708 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1721 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1709 with a single option would not be correctly parsed. Closes
1722 with a single option would not be correctly parsed. Closes
1710 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1723 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1711 introduced in 0.6.0 (on 2004-05-06).
1724 introduced in 0.6.0 (on 2004-05-06).
1712
1725
1713 2004-05-13 *** Released version 0.6.0
1726 2004-05-13 *** Released version 0.6.0
1714
1727
1715 2004-05-13 Fernando Perez <fperez@colorado.edu>
1728 2004-05-13 Fernando Perez <fperez@colorado.edu>
1716
1729
1717 * debian/: Added debian/ directory to CVS, so that debian support
1730 * debian/: Added debian/ directory to CVS, so that debian support
1718 is publicly accessible. The debian package is maintained by Jack
1731 is publicly accessible. The debian package is maintained by Jack
1719 Moffit <jack-AT-xiph.org>.
1732 Moffit <jack-AT-xiph.org>.
1720
1733
1721 * Documentation: included the notes about an ipython-based system
1734 * Documentation: included the notes about an ipython-based system
1722 shell (the hypothetical 'pysh') into the new_design.pdf document,
1735 shell (the hypothetical 'pysh') into the new_design.pdf document,
1723 so that these ideas get distributed to users along with the
1736 so that these ideas get distributed to users along with the
1724 official documentation.
1737 official documentation.
1725
1738
1726 2004-05-10 Fernando Perez <fperez@colorado.edu>
1739 2004-05-10 Fernando Perez <fperez@colorado.edu>
1727
1740
1728 * IPython/Logger.py (Logger.create_log): fix recently introduced
1741 * IPython/Logger.py (Logger.create_log): fix recently introduced
1729 bug (misindented line) where logstart would fail when not given an
1742 bug (misindented line) where logstart would fail when not given an
1730 explicit filename.
1743 explicit filename.
1731
1744
1732 2004-05-09 Fernando Perez <fperez@colorado.edu>
1745 2004-05-09 Fernando Perez <fperez@colorado.edu>
1733
1746
1734 * IPython/Magic.py (Magic.parse_options): skip system call when
1747 * IPython/Magic.py (Magic.parse_options): skip system call when
1735 there are no options to look for. Faster, cleaner for the common
1748 there are no options to look for. Faster, cleaner for the common
1736 case.
1749 case.
1737
1750
1738 * Documentation: many updates to the manual: describing Windows
1751 * Documentation: many updates to the manual: describing Windows
1739 support better, Gnuplot updates, credits, misc small stuff. Also
1752 support better, Gnuplot updates, credits, misc small stuff. Also
1740 updated the new_design doc a bit.
1753 updated the new_design doc a bit.
1741
1754
1742 2004-05-06 *** Released version 0.6.0.rc1
1755 2004-05-06 *** Released version 0.6.0.rc1
1743
1756
1744 2004-05-06 Fernando Perez <fperez@colorado.edu>
1757 2004-05-06 Fernando Perez <fperez@colorado.edu>
1745
1758
1746 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1759 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1747 operations to use the vastly more efficient list/''.join() method.
1760 operations to use the vastly more efficient list/''.join() method.
1748 (FormattedTB.text): Fix
1761 (FormattedTB.text): Fix
1749 http://www.scipy.net/roundup/ipython/issue12 - exception source
1762 http://www.scipy.net/roundup/ipython/issue12 - exception source
1750 extract not updated after reload. Thanks to Mike Salib
1763 extract not updated after reload. Thanks to Mike Salib
1751 <msalib-AT-mit.edu> for pinning the source of the problem.
1764 <msalib-AT-mit.edu> for pinning the source of the problem.
1752 Fortunately, the solution works inside ipython and doesn't require
1765 Fortunately, the solution works inside ipython and doesn't require
1753 any changes to python proper.
1766 any changes to python proper.
1754
1767
1755 * IPython/Magic.py (Magic.parse_options): Improved to process the
1768 * IPython/Magic.py (Magic.parse_options): Improved to process the
1756 argument list as a true shell would (by actually using the
1769 argument list as a true shell would (by actually using the
1757 underlying system shell). This way, all @magics automatically get
1770 underlying system shell). This way, all @magics automatically get
1758 shell expansion for variables. Thanks to a comment by Alex
1771 shell expansion for variables. Thanks to a comment by Alex
1759 Schmolck.
1772 Schmolck.
1760
1773
1761 2004-04-04 Fernando Perez <fperez@colorado.edu>
1774 2004-04-04 Fernando Perez <fperez@colorado.edu>
1762
1775
1763 * IPython/iplib.py (InteractiveShell.interact): Added a special
1776 * IPython/iplib.py (InteractiveShell.interact): Added a special
1764 trap for a debugger quit exception, which is basically impossible
1777 trap for a debugger quit exception, which is basically impossible
1765 to handle by normal mechanisms, given what pdb does to the stack.
1778 to handle by normal mechanisms, given what pdb does to the stack.
1766 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1779 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1767
1780
1768 2004-04-03 Fernando Perez <fperez@colorado.edu>
1781 2004-04-03 Fernando Perez <fperez@colorado.edu>
1769
1782
1770 * IPython/genutils.py (Term): Standardized the names of the Term
1783 * IPython/genutils.py (Term): Standardized the names of the Term
1771 class streams to cin/cout/cerr, following C++ naming conventions
1784 class streams to cin/cout/cerr, following C++ naming conventions
1772 (I can't use in/out/err because 'in' is not a valid attribute
1785 (I can't use in/out/err because 'in' is not a valid attribute
1773 name).
1786 name).
1774
1787
1775 * IPython/iplib.py (InteractiveShell.interact): don't increment
1788 * IPython/iplib.py (InteractiveShell.interact): don't increment
1776 the prompt if there's no user input. By Daniel 'Dang' Griffith
1789 the prompt if there's no user input. By Daniel 'Dang' Griffith
1777 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1790 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1778 Francois Pinard.
1791 Francois Pinard.
1779
1792
1780 2004-04-02 Fernando Perez <fperez@colorado.edu>
1793 2004-04-02 Fernando Perez <fperez@colorado.edu>
1781
1794
1782 * IPython/genutils.py (Stream.__init__): Modified to survive at
1795 * IPython/genutils.py (Stream.__init__): Modified to survive at
1783 least importing in contexts where stdin/out/err aren't true file
1796 least importing in contexts where stdin/out/err aren't true file
1784 objects, such as PyCrust (they lack fileno() and mode). However,
1797 objects, such as PyCrust (they lack fileno() and mode). However,
1785 the recovery facilities which rely on these things existing will
1798 the recovery facilities which rely on these things existing will
1786 not work.
1799 not work.
1787
1800
1788 2004-04-01 Fernando Perez <fperez@colorado.edu>
1801 2004-04-01 Fernando Perez <fperez@colorado.edu>
1789
1802
1790 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1803 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1791 use the new getoutputerror() function, so it properly
1804 use the new getoutputerror() function, so it properly
1792 distinguishes stdout/err.
1805 distinguishes stdout/err.
1793
1806
1794 * IPython/genutils.py (getoutputerror): added a function to
1807 * IPython/genutils.py (getoutputerror): added a function to
1795 capture separately the standard output and error of a command.
1808 capture separately the standard output and error of a command.
1796 After a comment from dang on the mailing lists. This code is
1809 After a comment from dang on the mailing lists. This code is
1797 basically a modified version of commands.getstatusoutput(), from
1810 basically a modified version of commands.getstatusoutput(), from
1798 the standard library.
1811 the standard library.
1799
1812
1800 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1813 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1801 '!!' as a special syntax (shorthand) to access @sx.
1814 '!!' as a special syntax (shorthand) to access @sx.
1802
1815
1803 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1816 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1804 command and return its output as a list split on '\n'.
1817 command and return its output as a list split on '\n'.
1805
1818
1806 2004-03-31 Fernando Perez <fperez@colorado.edu>
1819 2004-03-31 Fernando Perez <fperez@colorado.edu>
1807
1820
1808 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1821 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1809 method to dictionaries used as FakeModule instances if they lack
1822 method to dictionaries used as FakeModule instances if they lack
1810 it. At least pydoc in python2.3 breaks for runtime-defined
1823 it. At least pydoc in python2.3 breaks for runtime-defined
1811 functions without this hack. At some point I need to _really_
1824 functions without this hack. At some point I need to _really_
1812 understand what FakeModule is doing, because it's a gross hack.
1825 understand what FakeModule is doing, because it's a gross hack.
1813 But it solves Arnd's problem for now...
1826 But it solves Arnd's problem for now...
1814
1827
1815 2004-02-27 Fernando Perez <fperez@colorado.edu>
1828 2004-02-27 Fernando Perez <fperez@colorado.edu>
1816
1829
1817 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1830 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1818 mode would behave erratically. Also increased the number of
1831 mode would behave erratically. Also increased the number of
1819 possible logs in rotate mod to 999. Thanks to Rod Holland
1832 possible logs in rotate mod to 999. Thanks to Rod Holland
1820 <rhh@StructureLABS.com> for the report and fixes.
1833 <rhh@StructureLABS.com> for the report and fixes.
1821
1834
1822 2004-02-26 Fernando Perez <fperez@colorado.edu>
1835 2004-02-26 Fernando Perez <fperez@colorado.edu>
1823
1836
1824 * IPython/genutils.py (page): Check that the curses module really
1837 * IPython/genutils.py (page): Check that the curses module really
1825 has the initscr attribute before trying to use it. For some
1838 has the initscr attribute before trying to use it. For some
1826 reason, the Solaris curses module is missing this. I think this
1839 reason, the Solaris curses module is missing this. I think this
1827 should be considered a Solaris python bug, but I'm not sure.
1840 should be considered a Solaris python bug, but I'm not sure.
1828
1841
1829 2004-01-17 Fernando Perez <fperez@colorado.edu>
1842 2004-01-17 Fernando Perez <fperez@colorado.edu>
1830
1843
1831 * IPython/genutils.py (Stream.__init__): Changes to try to make
1844 * IPython/genutils.py (Stream.__init__): Changes to try to make
1832 ipython robust against stdin/out/err being closed by the user.
1845 ipython robust against stdin/out/err being closed by the user.
1833 This is 'user error' (and blocks a normal python session, at least
1846 This is 'user error' (and blocks a normal python session, at least
1834 the stdout case). However, Ipython should be able to survive such
1847 the stdout case). However, Ipython should be able to survive such
1835 instances of abuse as gracefully as possible. To simplify the
1848 instances of abuse as gracefully as possible. To simplify the
1836 coding and maintain compatibility with Gary Bishop's Term
1849 coding and maintain compatibility with Gary Bishop's Term
1837 contributions, I've made use of classmethods for this. I think
1850 contributions, I've made use of classmethods for this. I think
1838 this introduces a dependency on python 2.2.
1851 this introduces a dependency on python 2.2.
1839
1852
1840 2004-01-13 Fernando Perez <fperez@colorado.edu>
1853 2004-01-13 Fernando Perez <fperez@colorado.edu>
1841
1854
1842 * IPython/numutils.py (exp_safe): simplified the code a bit and
1855 * IPython/numutils.py (exp_safe): simplified the code a bit and
1843 removed the need for importing the kinds module altogether.
1856 removed the need for importing the kinds module altogether.
1844
1857
1845 2004-01-06 Fernando Perez <fperez@colorado.edu>
1858 2004-01-06 Fernando Perez <fperez@colorado.edu>
1846
1859
1847 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1860 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1848 a magic function instead, after some community feedback. No
1861 a magic function instead, after some community feedback. No
1849 special syntax will exist for it, but its name is deliberately
1862 special syntax will exist for it, but its name is deliberately
1850 very short.
1863 very short.
1851
1864
1852 2003-12-20 Fernando Perez <fperez@colorado.edu>
1865 2003-12-20 Fernando Perez <fperez@colorado.edu>
1853
1866
1854 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1867 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1855 new functionality, to automagically assign the result of a shell
1868 new functionality, to automagically assign the result of a shell
1856 command to a variable. I'll solicit some community feedback on
1869 command to a variable. I'll solicit some community feedback on
1857 this before making it permanent.
1870 this before making it permanent.
1858
1871
1859 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1872 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1860 requested about callables for which inspect couldn't obtain a
1873 requested about callables for which inspect couldn't obtain a
1861 proper argspec. Thanks to a crash report sent by Etienne
1874 proper argspec. Thanks to a crash report sent by Etienne
1862 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1875 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1863
1876
1864 2003-12-09 Fernando Perez <fperez@colorado.edu>
1877 2003-12-09 Fernando Perez <fperez@colorado.edu>
1865
1878
1866 * IPython/genutils.py (page): patch for the pager to work across
1879 * IPython/genutils.py (page): patch for the pager to work across
1867 various versions of Windows. By Gary Bishop.
1880 various versions of Windows. By Gary Bishop.
1868
1881
1869 2003-12-04 Fernando Perez <fperez@colorado.edu>
1882 2003-12-04 Fernando Perez <fperez@colorado.edu>
1870
1883
1871 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1884 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1872 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1885 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1873 While I tested this and it looks ok, there may still be corner
1886 While I tested this and it looks ok, there may still be corner
1874 cases I've missed.
1887 cases I've missed.
1875
1888
1876 2003-12-01 Fernando Perez <fperez@colorado.edu>
1889 2003-12-01 Fernando Perez <fperez@colorado.edu>
1877
1890
1878 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1891 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1879 where a line like 'p,q=1,2' would fail because the automagic
1892 where a line like 'p,q=1,2' would fail because the automagic
1880 system would be triggered for @p.
1893 system would be triggered for @p.
1881
1894
1882 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1895 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1883 cleanups, code unmodified.
1896 cleanups, code unmodified.
1884
1897
1885 * IPython/genutils.py (Term): added a class for IPython to handle
1898 * IPython/genutils.py (Term): added a class for IPython to handle
1886 output. In most cases it will just be a proxy for stdout/err, but
1899 output. In most cases it will just be a proxy for stdout/err, but
1887 having this allows modifications to be made for some platforms,
1900 having this allows modifications to be made for some platforms,
1888 such as handling color escapes under Windows. All of this code
1901 such as handling color escapes under Windows. All of this code
1889 was contributed by Gary Bishop, with minor modifications by me.
1902 was contributed by Gary Bishop, with minor modifications by me.
1890 The actual changes affect many files.
1903 The actual changes affect many files.
1891
1904
1892 2003-11-30 Fernando Perez <fperez@colorado.edu>
1905 2003-11-30 Fernando Perez <fperez@colorado.edu>
1893
1906
1894 * IPython/iplib.py (file_matches): new completion code, courtesy
1907 * IPython/iplib.py (file_matches): new completion code, courtesy
1895 of Jeff Collins. This enables filename completion again under
1908 of Jeff Collins. This enables filename completion again under
1896 python 2.3, which disabled it at the C level.
1909 python 2.3, which disabled it at the C level.
1897
1910
1898 2003-11-11 Fernando Perez <fperez@colorado.edu>
1911 2003-11-11 Fernando Perez <fperez@colorado.edu>
1899
1912
1900 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1913 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1901 for Numeric.array(map(...)), but often convenient.
1914 for Numeric.array(map(...)), but often convenient.
1902
1915
1903 2003-11-05 Fernando Perez <fperez@colorado.edu>
1916 2003-11-05 Fernando Perez <fperez@colorado.edu>
1904
1917
1905 * IPython/numutils.py (frange): Changed a call from int() to
1918 * IPython/numutils.py (frange): Changed a call from int() to
1906 int(round()) to prevent a problem reported with arange() in the
1919 int(round()) to prevent a problem reported with arange() in the
1907 numpy list.
1920 numpy list.
1908
1921
1909 2003-10-06 Fernando Perez <fperez@colorado.edu>
1922 2003-10-06 Fernando Perez <fperez@colorado.edu>
1910
1923
1911 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1924 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1912 prevent crashes if sys lacks an argv attribute (it happens with
1925 prevent crashes if sys lacks an argv attribute (it happens with
1913 embedded interpreters which build a bare-bones sys module).
1926 embedded interpreters which build a bare-bones sys module).
1914 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1927 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1915
1928
1916 2003-09-24 Fernando Perez <fperez@colorado.edu>
1929 2003-09-24 Fernando Perez <fperez@colorado.edu>
1917
1930
1918 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1931 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1919 to protect against poorly written user objects where __getattr__
1932 to protect against poorly written user objects where __getattr__
1920 raises exceptions other than AttributeError. Thanks to a bug
1933 raises exceptions other than AttributeError. Thanks to a bug
1921 report by Oliver Sander <osander-AT-gmx.de>.
1934 report by Oliver Sander <osander-AT-gmx.de>.
1922
1935
1923 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1936 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1924 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1937 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1925
1938
1926 2003-09-09 Fernando Perez <fperez@colorado.edu>
1939 2003-09-09 Fernando Perez <fperez@colorado.edu>
1927
1940
1928 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1941 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1929 unpacking a list whith a callable as first element would
1942 unpacking a list whith a callable as first element would
1930 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1943 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1931 Collins.
1944 Collins.
1932
1945
1933 2003-08-25 *** Released version 0.5.0
1946 2003-08-25 *** Released version 0.5.0
1934
1947
1935 2003-08-22 Fernando Perez <fperez@colorado.edu>
1948 2003-08-22 Fernando Perez <fperez@colorado.edu>
1936
1949
1937 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1950 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1938 improperly defined user exceptions. Thanks to feedback from Mark
1951 improperly defined user exceptions. Thanks to feedback from Mark
1939 Russell <mrussell-AT-verio.net>.
1952 Russell <mrussell-AT-verio.net>.
1940
1953
1941 2003-08-20 Fernando Perez <fperez@colorado.edu>
1954 2003-08-20 Fernando Perez <fperez@colorado.edu>
1942
1955
1943 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1956 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1944 printing so that it would print multi-line string forms starting
1957 printing so that it would print multi-line string forms starting
1945 with a new line. This way the formatting is better respected for
1958 with a new line. This way the formatting is better respected for
1946 objects which work hard to make nice string forms.
1959 objects which work hard to make nice string forms.
1947
1960
1948 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1961 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1949 autocall would overtake data access for objects with both
1962 autocall would overtake data access for objects with both
1950 __getitem__ and __call__.
1963 __getitem__ and __call__.
1951
1964
1952 2003-08-19 *** Released version 0.5.0-rc1
1965 2003-08-19 *** Released version 0.5.0-rc1
1953
1966
1954 2003-08-19 Fernando Perez <fperez@colorado.edu>
1967 2003-08-19 Fernando Perez <fperez@colorado.edu>
1955
1968
1956 * IPython/deep_reload.py (load_tail): single tiny change here
1969 * IPython/deep_reload.py (load_tail): single tiny change here
1957 seems to fix the long-standing bug of dreload() failing to work
1970 seems to fix the long-standing bug of dreload() failing to work
1958 for dotted names. But this module is pretty tricky, so I may have
1971 for dotted names. But this module is pretty tricky, so I may have
1959 missed some subtlety. Needs more testing!.
1972 missed some subtlety. Needs more testing!.
1960
1973
1961 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1974 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1962 exceptions which have badly implemented __str__ methods.
1975 exceptions which have badly implemented __str__ methods.
1963 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1976 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1964 which I've been getting reports about from Python 2.3 users. I
1977 which I've been getting reports about from Python 2.3 users. I
1965 wish I had a simple test case to reproduce the problem, so I could
1978 wish I had a simple test case to reproduce the problem, so I could
1966 either write a cleaner workaround or file a bug report if
1979 either write a cleaner workaround or file a bug report if
1967 necessary.
1980 necessary.
1968
1981
1969 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1982 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1970 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1983 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1971 a bug report by Tjabo Kloppenburg.
1984 a bug report by Tjabo Kloppenburg.
1972
1985
1973 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1986 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1974 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1987 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1975 seems rather unstable. Thanks to a bug report by Tjabo
1988 seems rather unstable. Thanks to a bug report by Tjabo
1976 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1989 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1977
1990
1978 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1991 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1979 this out soon because of the critical fixes in the inner loop for
1992 this out soon because of the critical fixes in the inner loop for
1980 generators.
1993 generators.
1981
1994
1982 * IPython/Magic.py (Magic.getargspec): removed. This (and
1995 * IPython/Magic.py (Magic.getargspec): removed. This (and
1983 _get_def) have been obsoleted by OInspect for a long time, I
1996 _get_def) have been obsoleted by OInspect for a long time, I
1984 hadn't noticed that they were dead code.
1997 hadn't noticed that they were dead code.
1985 (Magic._ofind): restored _ofind functionality for a few literals
1998 (Magic._ofind): restored _ofind functionality for a few literals
1986 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1999 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1987 for things like "hello".capitalize?, since that would require a
2000 for things like "hello".capitalize?, since that would require a
1988 potentially dangerous eval() again.
2001 potentially dangerous eval() again.
1989
2002
1990 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2003 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1991 logic a bit more to clean up the escapes handling and minimize the
2004 logic a bit more to clean up the escapes handling and minimize the
1992 use of _ofind to only necessary cases. The interactive 'feel' of
2005 use of _ofind to only necessary cases. The interactive 'feel' of
1993 IPython should have improved quite a bit with the changes in
2006 IPython should have improved quite a bit with the changes in
1994 _prefilter and _ofind (besides being far safer than before).
2007 _prefilter and _ofind (besides being far safer than before).
1995
2008
1996 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2009 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1997 obscure, never reported). Edit would fail to find the object to
2010 obscure, never reported). Edit would fail to find the object to
1998 edit under some circumstances.
2011 edit under some circumstances.
1999 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2012 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2000 which were causing double-calling of generators. Those eval calls
2013 which were causing double-calling of generators. Those eval calls
2001 were _very_ dangerous, since code with side effects could be
2014 were _very_ dangerous, since code with side effects could be
2002 triggered. As they say, 'eval is evil'... These were the
2015 triggered. As they say, 'eval is evil'... These were the
2003 nastiest evals in IPython. Besides, _ofind is now far simpler,
2016 nastiest evals in IPython. Besides, _ofind is now far simpler,
2004 and it should also be quite a bit faster. Its use of inspect is
2017 and it should also be quite a bit faster. Its use of inspect is
2005 also safer, so perhaps some of the inspect-related crashes I've
2018 also safer, so perhaps some of the inspect-related crashes I've
2006 seen lately with Python 2.3 might be taken care of. That will
2019 seen lately with Python 2.3 might be taken care of. That will
2007 need more testing.
2020 need more testing.
2008
2021
2009 2003-08-17 Fernando Perez <fperez@colorado.edu>
2022 2003-08-17 Fernando Perez <fperez@colorado.edu>
2010
2023
2011 * IPython/iplib.py (InteractiveShell._prefilter): significant
2024 * IPython/iplib.py (InteractiveShell._prefilter): significant
2012 simplifications to the logic for handling user escapes. Faster
2025 simplifications to the logic for handling user escapes. Faster
2013 and simpler code.
2026 and simpler code.
2014
2027
2015 2003-08-14 Fernando Perez <fperez@colorado.edu>
2028 2003-08-14 Fernando Perez <fperez@colorado.edu>
2016
2029
2017 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2030 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2018 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2031 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2019 but it should be quite a bit faster. And the recursive version
2032 but it should be quite a bit faster. And the recursive version
2020 generated O(log N) intermediate storage for all rank>1 arrays,
2033 generated O(log N) intermediate storage for all rank>1 arrays,
2021 even if they were contiguous.
2034 even if they were contiguous.
2022 (l1norm): Added this function.
2035 (l1norm): Added this function.
2023 (norm): Added this function for arbitrary norms (including
2036 (norm): Added this function for arbitrary norms (including
2024 l-infinity). l1 and l2 are still special cases for convenience
2037 l-infinity). l1 and l2 are still special cases for convenience
2025 and speed.
2038 and speed.
2026
2039
2027 2003-08-03 Fernando Perez <fperez@colorado.edu>
2040 2003-08-03 Fernando Perez <fperez@colorado.edu>
2028
2041
2029 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2042 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2030 exceptions, which now raise PendingDeprecationWarnings in Python
2043 exceptions, which now raise PendingDeprecationWarnings in Python
2031 2.3. There were some in Magic and some in Gnuplot2.
2044 2.3. There were some in Magic and some in Gnuplot2.
2032
2045
2033 2003-06-30 Fernando Perez <fperez@colorado.edu>
2046 2003-06-30 Fernando Perez <fperez@colorado.edu>
2034
2047
2035 * IPython/genutils.py (page): modified to call curses only for
2048 * IPython/genutils.py (page): modified to call curses only for
2036 terminals where TERM=='xterm'. After problems under many other
2049 terminals where TERM=='xterm'. After problems under many other
2037 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2050 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2038
2051
2039 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2052 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2040 would be triggered when readline was absent. This was just an old
2053 would be triggered when readline was absent. This was just an old
2041 debugging statement I'd forgotten to take out.
2054 debugging statement I'd forgotten to take out.
2042
2055
2043 2003-06-20 Fernando Perez <fperez@colorado.edu>
2056 2003-06-20 Fernando Perez <fperez@colorado.edu>
2044
2057
2045 * IPython/genutils.py (clock): modified to return only user time
2058 * IPython/genutils.py (clock): modified to return only user time
2046 (not counting system time), after a discussion on scipy. While
2059 (not counting system time), after a discussion on scipy. While
2047 system time may be a useful quantity occasionally, it may much
2060 system time may be a useful quantity occasionally, it may much
2048 more easily be skewed by occasional swapping or other similar
2061 more easily be skewed by occasional swapping or other similar
2049 activity.
2062 activity.
2050
2063
2051 2003-06-05 Fernando Perez <fperez@colorado.edu>
2064 2003-06-05 Fernando Perez <fperez@colorado.edu>
2052
2065
2053 * IPython/numutils.py (identity): new function, for building
2066 * IPython/numutils.py (identity): new function, for building
2054 arbitrary rank Kronecker deltas (mostly backwards compatible with
2067 arbitrary rank Kronecker deltas (mostly backwards compatible with
2055 Numeric.identity)
2068 Numeric.identity)
2056
2069
2057 2003-06-03 Fernando Perez <fperez@colorado.edu>
2070 2003-06-03 Fernando Perez <fperez@colorado.edu>
2058
2071
2059 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2072 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2060 arguments passed to magics with spaces, to allow trailing '\' to
2073 arguments passed to magics with spaces, to allow trailing '\' to
2061 work normally (mainly for Windows users).
2074 work normally (mainly for Windows users).
2062
2075
2063 2003-05-29 Fernando Perez <fperez@colorado.edu>
2076 2003-05-29 Fernando Perez <fperez@colorado.edu>
2064
2077
2065 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2078 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2066 instead of pydoc.help. This fixes a bizarre behavior where
2079 instead of pydoc.help. This fixes a bizarre behavior where
2067 printing '%s' % locals() would trigger the help system. Now
2080 printing '%s' % locals() would trigger the help system. Now
2068 ipython behaves like normal python does.
2081 ipython behaves like normal python does.
2069
2082
2070 Note that if one does 'from pydoc import help', the bizarre
2083 Note that if one does 'from pydoc import help', the bizarre
2071 behavior returns, but this will also happen in normal python, so
2084 behavior returns, but this will also happen in normal python, so
2072 it's not an ipython bug anymore (it has to do with how pydoc.help
2085 it's not an ipython bug anymore (it has to do with how pydoc.help
2073 is implemented).
2086 is implemented).
2074
2087
2075 2003-05-22 Fernando Perez <fperez@colorado.edu>
2088 2003-05-22 Fernando Perez <fperez@colorado.edu>
2076
2089
2077 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2090 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2078 return [] instead of None when nothing matches, also match to end
2091 return [] instead of None when nothing matches, also match to end
2079 of line. Patch by Gary Bishop.
2092 of line. Patch by Gary Bishop.
2080
2093
2081 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2094 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2082 protection as before, for files passed on the command line. This
2095 protection as before, for files passed on the command line. This
2083 prevents the CrashHandler from kicking in if user files call into
2096 prevents the CrashHandler from kicking in if user files call into
2084 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2097 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2085 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2098 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2086
2099
2087 2003-05-20 *** Released version 0.4.0
2100 2003-05-20 *** Released version 0.4.0
2088
2101
2089 2003-05-20 Fernando Perez <fperez@colorado.edu>
2102 2003-05-20 Fernando Perez <fperez@colorado.edu>
2090
2103
2091 * setup.py: added support for manpages. It's a bit hackish b/c of
2104 * setup.py: added support for manpages. It's a bit hackish b/c of
2092 a bug in the way the bdist_rpm distutils target handles gzipped
2105 a bug in the way the bdist_rpm distutils target handles gzipped
2093 manpages, but it works. After a patch by Jack.
2106 manpages, but it works. After a patch by Jack.
2094
2107
2095 2003-05-19 Fernando Perez <fperez@colorado.edu>
2108 2003-05-19 Fernando Perez <fperez@colorado.edu>
2096
2109
2097 * IPython/numutils.py: added a mockup of the kinds module, since
2110 * IPython/numutils.py: added a mockup of the kinds module, since
2098 it was recently removed from Numeric. This way, numutils will
2111 it was recently removed from Numeric. This way, numutils will
2099 work for all users even if they are missing kinds.
2112 work for all users even if they are missing kinds.
2100
2113
2101 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2114 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2102 failure, which can occur with SWIG-wrapped extensions. After a
2115 failure, which can occur with SWIG-wrapped extensions. After a
2103 crash report from Prabhu.
2116 crash report from Prabhu.
2104
2117
2105 2003-05-16 Fernando Perez <fperez@colorado.edu>
2118 2003-05-16 Fernando Perez <fperez@colorado.edu>
2106
2119
2107 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2120 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2108 protect ipython from user code which may call directly
2121 protect ipython from user code which may call directly
2109 sys.excepthook (this looks like an ipython crash to the user, even
2122 sys.excepthook (this looks like an ipython crash to the user, even
2110 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2123 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2111 This is especially important to help users of WxWindows, but may
2124 This is especially important to help users of WxWindows, but may
2112 also be useful in other cases.
2125 also be useful in other cases.
2113
2126
2114 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2127 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2115 an optional tb_offset to be specified, and to preserve exception
2128 an optional tb_offset to be specified, and to preserve exception
2116 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2129 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2117
2130
2118 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2131 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2119
2132
2120 2003-05-15 Fernando Perez <fperez@colorado.edu>
2133 2003-05-15 Fernando Perez <fperez@colorado.edu>
2121
2134
2122 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2135 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2123 installing for a new user under Windows.
2136 installing for a new user under Windows.
2124
2137
2125 2003-05-12 Fernando Perez <fperez@colorado.edu>
2138 2003-05-12 Fernando Perez <fperez@colorado.edu>
2126
2139
2127 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2140 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2128 handler for Emacs comint-based lines. Currently it doesn't do
2141 handler for Emacs comint-based lines. Currently it doesn't do
2129 much (but importantly, it doesn't update the history cache). In
2142 much (but importantly, it doesn't update the history cache). In
2130 the future it may be expanded if Alex needs more functionality
2143 the future it may be expanded if Alex needs more functionality
2131 there.
2144 there.
2132
2145
2133 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2146 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2134 info to crash reports.
2147 info to crash reports.
2135
2148
2136 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2149 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2137 just like Python's -c. Also fixed crash with invalid -color
2150 just like Python's -c. Also fixed crash with invalid -color
2138 option value at startup. Thanks to Will French
2151 option value at startup. Thanks to Will French
2139 <wfrench-AT-bestweb.net> for the bug report.
2152 <wfrench-AT-bestweb.net> for the bug report.
2140
2153
2141 2003-05-09 Fernando Perez <fperez@colorado.edu>
2154 2003-05-09 Fernando Perez <fperez@colorado.edu>
2142
2155
2143 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2156 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2144 to EvalDict (it's a mapping, after all) and simplified its code
2157 to EvalDict (it's a mapping, after all) and simplified its code
2145 quite a bit, after a nice discussion on c.l.py where Gustavo
2158 quite a bit, after a nice discussion on c.l.py where Gustavo
2146 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2159 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2147
2160
2148 2003-04-30 Fernando Perez <fperez@colorado.edu>
2161 2003-04-30 Fernando Perez <fperez@colorado.edu>
2149
2162
2150 * IPython/genutils.py (timings_out): modified it to reduce its
2163 * IPython/genutils.py (timings_out): modified it to reduce its
2151 overhead in the common reps==1 case.
2164 overhead in the common reps==1 case.
2152
2165
2153 2003-04-29 Fernando Perez <fperez@colorado.edu>
2166 2003-04-29 Fernando Perez <fperez@colorado.edu>
2154
2167
2155 * IPython/genutils.py (timings_out): Modified to use the resource
2168 * IPython/genutils.py (timings_out): Modified to use the resource
2156 module, which avoids the wraparound problems of time.clock().
2169 module, which avoids the wraparound problems of time.clock().
2157
2170
2158 2003-04-17 *** Released version 0.2.15pre4
2171 2003-04-17 *** Released version 0.2.15pre4
2159
2172
2160 2003-04-17 Fernando Perez <fperez@colorado.edu>
2173 2003-04-17 Fernando Perez <fperez@colorado.edu>
2161
2174
2162 * setup.py (scriptfiles): Split windows-specific stuff over to a
2175 * setup.py (scriptfiles): Split windows-specific stuff over to a
2163 separate file, in an attempt to have a Windows GUI installer.
2176 separate file, in an attempt to have a Windows GUI installer.
2164 That didn't work, but part of the groundwork is done.
2177 That didn't work, but part of the groundwork is done.
2165
2178
2166 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2179 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2167 indent/unindent with 4 spaces. Particularly useful in combination
2180 indent/unindent with 4 spaces. Particularly useful in combination
2168 with the new auto-indent option.
2181 with the new auto-indent option.
2169
2182
2170 2003-04-16 Fernando Perez <fperez@colorado.edu>
2183 2003-04-16 Fernando Perez <fperez@colorado.edu>
2171
2184
2172 * IPython/Magic.py: various replacements of self.rc for
2185 * IPython/Magic.py: various replacements of self.rc for
2173 self.shell.rc. A lot more remains to be done to fully disentangle
2186 self.shell.rc. A lot more remains to be done to fully disentangle
2174 this class from the main Shell class.
2187 this class from the main Shell class.
2175
2188
2176 * IPython/GnuplotRuntime.py: added checks for mouse support so
2189 * IPython/GnuplotRuntime.py: added checks for mouse support so
2177 that we don't try to enable it if the current gnuplot doesn't
2190 that we don't try to enable it if the current gnuplot doesn't
2178 really support it. Also added checks so that we don't try to
2191 really support it. Also added checks so that we don't try to
2179 enable persist under Windows (where Gnuplot doesn't recognize the
2192 enable persist under Windows (where Gnuplot doesn't recognize the
2180 option).
2193 option).
2181
2194
2182 * IPython/iplib.py (InteractiveShell.interact): Added optional
2195 * IPython/iplib.py (InteractiveShell.interact): Added optional
2183 auto-indenting code, after a patch by King C. Shu
2196 auto-indenting code, after a patch by King C. Shu
2184 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2197 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2185 get along well with pasting indented code. If I ever figure out
2198 get along well with pasting indented code. If I ever figure out
2186 how to make that part go well, it will become on by default.
2199 how to make that part go well, it will become on by default.
2187
2200
2188 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2201 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2189 crash ipython if there was an unmatched '%' in the user's prompt
2202 crash ipython if there was an unmatched '%' in the user's prompt
2190 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2203 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2191
2204
2192 * IPython/iplib.py (InteractiveShell.interact): removed the
2205 * IPython/iplib.py (InteractiveShell.interact): removed the
2193 ability to ask the user whether he wants to crash or not at the
2206 ability to ask the user whether he wants to crash or not at the
2194 'last line' exception handler. Calling functions at that point
2207 'last line' exception handler. Calling functions at that point
2195 changes the stack, and the error reports would have incorrect
2208 changes the stack, and the error reports would have incorrect
2196 tracebacks.
2209 tracebacks.
2197
2210
2198 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2211 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2199 pass through a peger a pretty-printed form of any object. After a
2212 pass through a peger a pretty-printed form of any object. After a
2200 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2213 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2201
2214
2202 2003-04-14 Fernando Perez <fperez@colorado.edu>
2215 2003-04-14 Fernando Perez <fperez@colorado.edu>
2203
2216
2204 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2217 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2205 all files in ~ would be modified at first install (instead of
2218 all files in ~ would be modified at first install (instead of
2206 ~/.ipython). This could be potentially disastrous, as the
2219 ~/.ipython). This could be potentially disastrous, as the
2207 modification (make line-endings native) could damage binary files.
2220 modification (make line-endings native) could damage binary files.
2208
2221
2209 2003-04-10 Fernando Perez <fperez@colorado.edu>
2222 2003-04-10 Fernando Perez <fperez@colorado.edu>
2210
2223
2211 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2224 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2212 handle only lines which are invalid python. This now means that
2225 handle only lines which are invalid python. This now means that
2213 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2226 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2214 for the bug report.
2227 for the bug report.
2215
2228
2216 2003-04-01 Fernando Perez <fperez@colorado.edu>
2229 2003-04-01 Fernando Perez <fperez@colorado.edu>
2217
2230
2218 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2231 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2219 where failing to set sys.last_traceback would crash pdb.pm().
2232 where failing to set sys.last_traceback would crash pdb.pm().
2220 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2233 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2221 report.
2234 report.
2222
2235
2223 2003-03-25 Fernando Perez <fperez@colorado.edu>
2236 2003-03-25 Fernando Perez <fperez@colorado.edu>
2224
2237
2225 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2238 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2226 before printing it (it had a lot of spurious blank lines at the
2239 before printing it (it had a lot of spurious blank lines at the
2227 end).
2240 end).
2228
2241
2229 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2242 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2230 output would be sent 21 times! Obviously people don't use this
2243 output would be sent 21 times! Obviously people don't use this
2231 too often, or I would have heard about it.
2244 too often, or I would have heard about it.
2232
2245
2233 2003-03-24 Fernando Perez <fperez@colorado.edu>
2246 2003-03-24 Fernando Perez <fperez@colorado.edu>
2234
2247
2235 * setup.py (scriptfiles): renamed the data_files parameter from
2248 * setup.py (scriptfiles): renamed the data_files parameter from
2236 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2249 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2237 for the patch.
2250 for the patch.
2238
2251
2239 2003-03-20 Fernando Perez <fperez@colorado.edu>
2252 2003-03-20 Fernando Perez <fperez@colorado.edu>
2240
2253
2241 * IPython/genutils.py (error): added error() and fatal()
2254 * IPython/genutils.py (error): added error() and fatal()
2242 functions.
2255 functions.
2243
2256
2244 2003-03-18 *** Released version 0.2.15pre3
2257 2003-03-18 *** Released version 0.2.15pre3
2245
2258
2246 2003-03-18 Fernando Perez <fperez@colorado.edu>
2259 2003-03-18 Fernando Perez <fperez@colorado.edu>
2247
2260
2248 * setupext/install_data_ext.py
2261 * setupext/install_data_ext.py
2249 (install_data_ext.initialize_options): Class contributed by Jack
2262 (install_data_ext.initialize_options): Class contributed by Jack
2250 Moffit for fixing the old distutils hack. He is sending this to
2263 Moffit for fixing the old distutils hack. He is sending this to
2251 the distutils folks so in the future we may not need it as a
2264 the distutils folks so in the future we may not need it as a
2252 private fix.
2265 private fix.
2253
2266
2254 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2267 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2255 changes for Debian packaging. See his patch for full details.
2268 changes for Debian packaging. See his patch for full details.
2256 The old distutils hack of making the ipythonrc* files carry a
2269 The old distutils hack of making the ipythonrc* files carry a
2257 bogus .py extension is gone, at last. Examples were moved to a
2270 bogus .py extension is gone, at last. Examples were moved to a
2258 separate subdir under doc/, and the separate executable scripts
2271 separate subdir under doc/, and the separate executable scripts
2259 now live in their own directory. Overall a great cleanup. The
2272 now live in their own directory. Overall a great cleanup. The
2260 manual was updated to use the new files, and setup.py has been
2273 manual was updated to use the new files, and setup.py has been
2261 fixed for this setup.
2274 fixed for this setup.
2262
2275
2263 * IPython/PyColorize.py (Parser.usage): made non-executable and
2276 * IPython/PyColorize.py (Parser.usage): made non-executable and
2264 created a pycolor wrapper around it to be included as a script.
2277 created a pycolor wrapper around it to be included as a script.
2265
2278
2266 2003-03-12 *** Released version 0.2.15pre2
2279 2003-03-12 *** Released version 0.2.15pre2
2267
2280
2268 2003-03-12 Fernando Perez <fperez@colorado.edu>
2281 2003-03-12 Fernando Perez <fperez@colorado.edu>
2269
2282
2270 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2283 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2271 long-standing problem with garbage characters in some terminals.
2284 long-standing problem with garbage characters in some terminals.
2272 The issue was really that the \001 and \002 escapes must _only_ be
2285 The issue was really that the \001 and \002 escapes must _only_ be
2273 passed to input prompts (which call readline), but _never_ to
2286 passed to input prompts (which call readline), but _never_ to
2274 normal text to be printed on screen. I changed ColorANSI to have
2287 normal text to be printed on screen. I changed ColorANSI to have
2275 two classes: TermColors and InputTermColors, each with the
2288 two classes: TermColors and InputTermColors, each with the
2276 appropriate escapes for input prompts or normal text. The code in
2289 appropriate escapes for input prompts or normal text. The code in
2277 Prompts.py got slightly more complicated, but this very old and
2290 Prompts.py got slightly more complicated, but this very old and
2278 annoying bug is finally fixed.
2291 annoying bug is finally fixed.
2279
2292
2280 All the credit for nailing down the real origin of this problem
2293 All the credit for nailing down the real origin of this problem
2281 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2294 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2282 *Many* thanks to him for spending quite a bit of effort on this.
2295 *Many* thanks to him for spending quite a bit of effort on this.
2283
2296
2284 2003-03-05 *** Released version 0.2.15pre1
2297 2003-03-05 *** Released version 0.2.15pre1
2285
2298
2286 2003-03-03 Fernando Perez <fperez@colorado.edu>
2299 2003-03-03 Fernando Perez <fperez@colorado.edu>
2287
2300
2288 * IPython/FakeModule.py: Moved the former _FakeModule to a
2301 * IPython/FakeModule.py: Moved the former _FakeModule to a
2289 separate file, because it's also needed by Magic (to fix a similar
2302 separate file, because it's also needed by Magic (to fix a similar
2290 pickle-related issue in @run).
2303 pickle-related issue in @run).
2291
2304
2292 2003-03-02 Fernando Perez <fperez@colorado.edu>
2305 2003-03-02 Fernando Perez <fperez@colorado.edu>
2293
2306
2294 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2307 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2295 the autocall option at runtime.
2308 the autocall option at runtime.
2296 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2309 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2297 across Magic.py to start separating Magic from InteractiveShell.
2310 across Magic.py to start separating Magic from InteractiveShell.
2298 (Magic._ofind): Fixed to return proper namespace for dotted
2311 (Magic._ofind): Fixed to return proper namespace for dotted
2299 names. Before, a dotted name would always return 'not currently
2312 names. Before, a dotted name would always return 'not currently
2300 defined', because it would find the 'parent'. s.x would be found,
2313 defined', because it would find the 'parent'. s.x would be found,
2301 but since 'x' isn't defined by itself, it would get confused.
2314 but since 'x' isn't defined by itself, it would get confused.
2302 (Magic.magic_run): Fixed pickling problems reported by Ralf
2315 (Magic.magic_run): Fixed pickling problems reported by Ralf
2303 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2316 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2304 that I'd used when Mike Heeter reported similar issues at the
2317 that I'd used when Mike Heeter reported similar issues at the
2305 top-level, but now for @run. It boils down to injecting the
2318 top-level, but now for @run. It boils down to injecting the
2306 namespace where code is being executed with something that looks
2319 namespace where code is being executed with something that looks
2307 enough like a module to fool pickle.dump(). Since a pickle stores
2320 enough like a module to fool pickle.dump(). Since a pickle stores
2308 a named reference to the importing module, we need this for
2321 a named reference to the importing module, we need this for
2309 pickles to save something sensible.
2322 pickles to save something sensible.
2310
2323
2311 * IPython/ipmaker.py (make_IPython): added an autocall option.
2324 * IPython/ipmaker.py (make_IPython): added an autocall option.
2312
2325
2313 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2326 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2314 the auto-eval code. Now autocalling is an option, and the code is
2327 the auto-eval code. Now autocalling is an option, and the code is
2315 also vastly safer. There is no more eval() involved at all.
2328 also vastly safer. There is no more eval() involved at all.
2316
2329
2317 2003-03-01 Fernando Perez <fperez@colorado.edu>
2330 2003-03-01 Fernando Perez <fperez@colorado.edu>
2318
2331
2319 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2332 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2320 dict with named keys instead of a tuple.
2333 dict with named keys instead of a tuple.
2321
2334
2322 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2335 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2323
2336
2324 * setup.py (make_shortcut): Fixed message about directories
2337 * setup.py (make_shortcut): Fixed message about directories
2325 created during Windows installation (the directories were ok, just
2338 created during Windows installation (the directories were ok, just
2326 the printed message was misleading). Thanks to Chris Liechti
2339 the printed message was misleading). Thanks to Chris Liechti
2327 <cliechti-AT-gmx.net> for the heads up.
2340 <cliechti-AT-gmx.net> for the heads up.
2328
2341
2329 2003-02-21 Fernando Perez <fperez@colorado.edu>
2342 2003-02-21 Fernando Perez <fperez@colorado.edu>
2330
2343
2331 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2344 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2332 of ValueError exception when checking for auto-execution. This
2345 of ValueError exception when checking for auto-execution. This
2333 one is raised by things like Numeric arrays arr.flat when the
2346 one is raised by things like Numeric arrays arr.flat when the
2334 array is non-contiguous.
2347 array is non-contiguous.
2335
2348
2336 2003-01-31 Fernando Perez <fperez@colorado.edu>
2349 2003-01-31 Fernando Perez <fperez@colorado.edu>
2337
2350
2338 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2351 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2339 not return any value at all (even though the command would get
2352 not return any value at all (even though the command would get
2340 executed).
2353 executed).
2341 (xsys): Flush stdout right after printing the command to ensure
2354 (xsys): Flush stdout right after printing the command to ensure
2342 proper ordering of commands and command output in the total
2355 proper ordering of commands and command output in the total
2343 output.
2356 output.
2344 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2357 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2345 system/getoutput as defaults. The old ones are kept for
2358 system/getoutput as defaults. The old ones are kept for
2346 compatibility reasons, so no code which uses this library needs
2359 compatibility reasons, so no code which uses this library needs
2347 changing.
2360 changing.
2348
2361
2349 2003-01-27 *** Released version 0.2.14
2362 2003-01-27 *** Released version 0.2.14
2350
2363
2351 2003-01-25 Fernando Perez <fperez@colorado.edu>
2364 2003-01-25 Fernando Perez <fperez@colorado.edu>
2352
2365
2353 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2366 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2354 functions defined in previous edit sessions could not be re-edited
2367 functions defined in previous edit sessions could not be re-edited
2355 (because the temp files were immediately removed). Now temp files
2368 (because the temp files were immediately removed). Now temp files
2356 are removed only at IPython's exit.
2369 are removed only at IPython's exit.
2357 (Magic.magic_run): Improved @run to perform shell-like expansions
2370 (Magic.magic_run): Improved @run to perform shell-like expansions
2358 on its arguments (~users and $VARS). With this, @run becomes more
2371 on its arguments (~users and $VARS). With this, @run becomes more
2359 like a normal command-line.
2372 like a normal command-line.
2360
2373
2361 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2374 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2362 bugs related to embedding and cleaned up that code. A fairly
2375 bugs related to embedding and cleaned up that code. A fairly
2363 important one was the impossibility to access the global namespace
2376 important one was the impossibility to access the global namespace
2364 through the embedded IPython (only local variables were visible).
2377 through the embedded IPython (only local variables were visible).
2365
2378
2366 2003-01-14 Fernando Perez <fperez@colorado.edu>
2379 2003-01-14 Fernando Perez <fperez@colorado.edu>
2367
2380
2368 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2381 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2369 auto-calling to be a bit more conservative. Now it doesn't get
2382 auto-calling to be a bit more conservative. Now it doesn't get
2370 triggered if any of '!=()<>' are in the rest of the input line, to
2383 triggered if any of '!=()<>' are in the rest of the input line, to
2371 allow comparing callables. Thanks to Alex for the heads up.
2384 allow comparing callables. Thanks to Alex for the heads up.
2372
2385
2373 2003-01-07 Fernando Perez <fperez@colorado.edu>
2386 2003-01-07 Fernando Perez <fperez@colorado.edu>
2374
2387
2375 * IPython/genutils.py (page): fixed estimation of the number of
2388 * IPython/genutils.py (page): fixed estimation of the number of
2376 lines in a string to be paged to simply count newlines. This
2389 lines in a string to be paged to simply count newlines. This
2377 prevents over-guessing due to embedded escape sequences. A better
2390 prevents over-guessing due to embedded escape sequences. A better
2378 long-term solution would involve stripping out the control chars
2391 long-term solution would involve stripping out the control chars
2379 for the count, but it's potentially so expensive I just don't
2392 for the count, but it's potentially so expensive I just don't
2380 think it's worth doing.
2393 think it's worth doing.
2381
2394
2382 2002-12-19 *** Released version 0.2.14pre50
2395 2002-12-19 *** Released version 0.2.14pre50
2383
2396
2384 2002-12-19 Fernando Perez <fperez@colorado.edu>
2397 2002-12-19 Fernando Perez <fperez@colorado.edu>
2385
2398
2386 * tools/release (version): Changed release scripts to inform
2399 * tools/release (version): Changed release scripts to inform
2387 Andrea and build a NEWS file with a list of recent changes.
2400 Andrea and build a NEWS file with a list of recent changes.
2388
2401
2389 * IPython/ColorANSI.py (__all__): changed terminal detection
2402 * IPython/ColorANSI.py (__all__): changed terminal detection
2390 code. Seems to work better for xterms without breaking
2403 code. Seems to work better for xterms without breaking
2391 konsole. Will need more testing to determine if WinXP and Mac OSX
2404 konsole. Will need more testing to determine if WinXP and Mac OSX
2392 also work ok.
2405 also work ok.
2393
2406
2394 2002-12-18 *** Released version 0.2.14pre49
2407 2002-12-18 *** Released version 0.2.14pre49
2395
2408
2396 2002-12-18 Fernando Perez <fperez@colorado.edu>
2409 2002-12-18 Fernando Perez <fperez@colorado.edu>
2397
2410
2398 * Docs: added new info about Mac OSX, from Andrea.
2411 * Docs: added new info about Mac OSX, from Andrea.
2399
2412
2400 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2413 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2401 allow direct plotting of python strings whose format is the same
2414 allow direct plotting of python strings whose format is the same
2402 of gnuplot data files.
2415 of gnuplot data files.
2403
2416
2404 2002-12-16 Fernando Perez <fperez@colorado.edu>
2417 2002-12-16 Fernando Perez <fperez@colorado.edu>
2405
2418
2406 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2419 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2407 value of exit question to be acknowledged.
2420 value of exit question to be acknowledged.
2408
2421
2409 2002-12-03 Fernando Perez <fperez@colorado.edu>
2422 2002-12-03 Fernando Perez <fperez@colorado.edu>
2410
2423
2411 * IPython/ipmaker.py: removed generators, which had been added
2424 * IPython/ipmaker.py: removed generators, which had been added
2412 by mistake in an earlier debugging run. This was causing trouble
2425 by mistake in an earlier debugging run. This was causing trouble
2413 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2426 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2414 for pointing this out.
2427 for pointing this out.
2415
2428
2416 2002-11-17 Fernando Perez <fperez@colorado.edu>
2429 2002-11-17 Fernando Perez <fperez@colorado.edu>
2417
2430
2418 * Manual: updated the Gnuplot section.
2431 * Manual: updated the Gnuplot section.
2419
2432
2420 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2433 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2421 a much better split of what goes in Runtime and what goes in
2434 a much better split of what goes in Runtime and what goes in
2422 Interactive.
2435 Interactive.
2423
2436
2424 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2437 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2425 being imported from iplib.
2438 being imported from iplib.
2426
2439
2427 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2440 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2428 for command-passing. Now the global Gnuplot instance is called
2441 for command-passing. Now the global Gnuplot instance is called
2429 'gp' instead of 'g', which was really a far too fragile and
2442 'gp' instead of 'g', which was really a far too fragile and
2430 common name.
2443 common name.
2431
2444
2432 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2445 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2433 bounding boxes generated by Gnuplot for square plots.
2446 bounding boxes generated by Gnuplot for square plots.
2434
2447
2435 * IPython/genutils.py (popkey): new function added. I should
2448 * IPython/genutils.py (popkey): new function added. I should
2436 suggest this on c.l.py as a dict method, it seems useful.
2449 suggest this on c.l.py as a dict method, it seems useful.
2437
2450
2438 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2451 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2439 to transparently handle PostScript generation. MUCH better than
2452 to transparently handle PostScript generation. MUCH better than
2440 the previous plot_eps/replot_eps (which I removed now). The code
2453 the previous plot_eps/replot_eps (which I removed now). The code
2441 is also fairly clean and well documented now (including
2454 is also fairly clean and well documented now (including
2442 docstrings).
2455 docstrings).
2443
2456
2444 2002-11-13 Fernando Perez <fperez@colorado.edu>
2457 2002-11-13 Fernando Perez <fperez@colorado.edu>
2445
2458
2446 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2459 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2447 (inconsistent with options).
2460 (inconsistent with options).
2448
2461
2449 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2462 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2450 manually disabled, I don't know why. Fixed it.
2463 manually disabled, I don't know why. Fixed it.
2451 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2464 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2452 eps output.
2465 eps output.
2453
2466
2454 2002-11-12 Fernando Perez <fperez@colorado.edu>
2467 2002-11-12 Fernando Perez <fperez@colorado.edu>
2455
2468
2456 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2469 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2457 don't propagate up to caller. Fixes crash reported by François
2470 don't propagate up to caller. Fixes crash reported by François
2458 Pinard.
2471 Pinard.
2459
2472
2460 2002-11-09 Fernando Perez <fperez@colorado.edu>
2473 2002-11-09 Fernando Perez <fperez@colorado.edu>
2461
2474
2462 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2475 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2463 history file for new users.
2476 history file for new users.
2464 (make_IPython): fixed bug where initial install would leave the
2477 (make_IPython): fixed bug where initial install would leave the
2465 user running in the .ipython dir.
2478 user running in the .ipython dir.
2466 (make_IPython): fixed bug where config dir .ipython would be
2479 (make_IPython): fixed bug where config dir .ipython would be
2467 created regardless of the given -ipythondir option. Thanks to Cory
2480 created regardless of the given -ipythondir option. Thanks to Cory
2468 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2481 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2469
2482
2470 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2483 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2471 type confirmations. Will need to use it in all of IPython's code
2484 type confirmations. Will need to use it in all of IPython's code
2472 consistently.
2485 consistently.
2473
2486
2474 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2487 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2475 context to print 31 lines instead of the default 5. This will make
2488 context to print 31 lines instead of the default 5. This will make
2476 the crash reports extremely detailed in case the problem is in
2489 the crash reports extremely detailed in case the problem is in
2477 libraries I don't have access to.
2490 libraries I don't have access to.
2478
2491
2479 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2492 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2480 line of defense' code to still crash, but giving users fair
2493 line of defense' code to still crash, but giving users fair
2481 warning. I don't want internal errors to go unreported: if there's
2494 warning. I don't want internal errors to go unreported: if there's
2482 an internal problem, IPython should crash and generate a full
2495 an internal problem, IPython should crash and generate a full
2483 report.
2496 report.
2484
2497
2485 2002-11-08 Fernando Perez <fperez@colorado.edu>
2498 2002-11-08 Fernando Perez <fperez@colorado.edu>
2486
2499
2487 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2500 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2488 otherwise uncaught exceptions which can appear if people set
2501 otherwise uncaught exceptions which can appear if people set
2489 sys.stdout to something badly broken. Thanks to a crash report
2502 sys.stdout to something badly broken. Thanks to a crash report
2490 from henni-AT-mail.brainbot.com.
2503 from henni-AT-mail.brainbot.com.
2491
2504
2492 2002-11-04 Fernando Perez <fperez@colorado.edu>
2505 2002-11-04 Fernando Perez <fperez@colorado.edu>
2493
2506
2494 * IPython/iplib.py (InteractiveShell.interact): added
2507 * IPython/iplib.py (InteractiveShell.interact): added
2495 __IPYTHON__active to the builtins. It's a flag which goes on when
2508 __IPYTHON__active to the builtins. It's a flag which goes on when
2496 the interaction starts and goes off again when it stops. This
2509 the interaction starts and goes off again when it stops. This
2497 allows embedding code to detect being inside IPython. Before this
2510 allows embedding code to detect being inside IPython. Before this
2498 was done via __IPYTHON__, but that only shows that an IPython
2511 was done via __IPYTHON__, but that only shows that an IPython
2499 instance has been created.
2512 instance has been created.
2500
2513
2501 * IPython/Magic.py (Magic.magic_env): I realized that in a
2514 * IPython/Magic.py (Magic.magic_env): I realized that in a
2502 UserDict, instance.data holds the data as a normal dict. So I
2515 UserDict, instance.data holds the data as a normal dict. So I
2503 modified @env to return os.environ.data instead of rebuilding a
2516 modified @env to return os.environ.data instead of rebuilding a
2504 dict by hand.
2517 dict by hand.
2505
2518
2506 2002-11-02 Fernando Perez <fperez@colorado.edu>
2519 2002-11-02 Fernando Perez <fperez@colorado.edu>
2507
2520
2508 * IPython/genutils.py (warn): changed so that level 1 prints no
2521 * IPython/genutils.py (warn): changed so that level 1 prints no
2509 header. Level 2 is now the default (with 'WARNING' header, as
2522 header. Level 2 is now the default (with 'WARNING' header, as
2510 before). I think I tracked all places where changes were needed in
2523 before). I think I tracked all places where changes were needed in
2511 IPython, but outside code using the old level numbering may have
2524 IPython, but outside code using the old level numbering may have
2512 broken.
2525 broken.
2513
2526
2514 * IPython/iplib.py (InteractiveShell.runcode): added this to
2527 * IPython/iplib.py (InteractiveShell.runcode): added this to
2515 handle the tracebacks in SystemExit traps correctly. The previous
2528 handle the tracebacks in SystemExit traps correctly. The previous
2516 code (through interact) was printing more of the stack than
2529 code (through interact) was printing more of the stack than
2517 necessary, showing IPython internal code to the user.
2530 necessary, showing IPython internal code to the user.
2518
2531
2519 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2532 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2520 default. Now that the default at the confirmation prompt is yes,
2533 default. Now that the default at the confirmation prompt is yes,
2521 it's not so intrusive. François' argument that ipython sessions
2534 it's not so intrusive. François' argument that ipython sessions
2522 tend to be complex enough not to lose them from an accidental C-d,
2535 tend to be complex enough not to lose them from an accidental C-d,
2523 is a valid one.
2536 is a valid one.
2524
2537
2525 * IPython/iplib.py (InteractiveShell.interact): added a
2538 * IPython/iplib.py (InteractiveShell.interact): added a
2526 showtraceback() call to the SystemExit trap, and modified the exit
2539 showtraceback() call to the SystemExit trap, and modified the exit
2527 confirmation to have yes as the default.
2540 confirmation to have yes as the default.
2528
2541
2529 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2542 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2530 this file. It's been gone from the code for a long time, this was
2543 this file. It's been gone from the code for a long time, this was
2531 simply leftover junk.
2544 simply leftover junk.
2532
2545
2533 2002-11-01 Fernando Perez <fperez@colorado.edu>
2546 2002-11-01 Fernando Perez <fperez@colorado.edu>
2534
2547
2535 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2548 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2536 added. If set, IPython now traps EOF and asks for
2549 added. If set, IPython now traps EOF and asks for
2537 confirmation. After a request by François Pinard.
2550 confirmation. After a request by François Pinard.
2538
2551
2539 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2552 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2540 of @abort, and with a new (better) mechanism for handling the
2553 of @abort, and with a new (better) mechanism for handling the
2541 exceptions.
2554 exceptions.
2542
2555
2543 2002-10-27 Fernando Perez <fperez@colorado.edu>
2556 2002-10-27 Fernando Perez <fperez@colorado.edu>
2544
2557
2545 * IPython/usage.py (__doc__): updated the --help information and
2558 * IPython/usage.py (__doc__): updated the --help information and
2546 the ipythonrc file to indicate that -log generates
2559 the ipythonrc file to indicate that -log generates
2547 ./ipython.log. Also fixed the corresponding info in @logstart.
2560 ./ipython.log. Also fixed the corresponding info in @logstart.
2548 This and several other fixes in the manuals thanks to reports by
2561 This and several other fixes in the manuals thanks to reports by
2549 François Pinard <pinard-AT-iro.umontreal.ca>.
2562 François Pinard <pinard-AT-iro.umontreal.ca>.
2550
2563
2551 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2564 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2552 refer to @logstart (instead of @log, which doesn't exist).
2565 refer to @logstart (instead of @log, which doesn't exist).
2553
2566
2554 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2567 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2555 AttributeError crash. Thanks to Christopher Armstrong
2568 AttributeError crash. Thanks to Christopher Armstrong
2556 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2569 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2557 introduced recently (in 0.2.14pre37) with the fix to the eval
2570 introduced recently (in 0.2.14pre37) with the fix to the eval
2558 problem mentioned below.
2571 problem mentioned below.
2559
2572
2560 2002-10-17 Fernando Perez <fperez@colorado.edu>
2573 2002-10-17 Fernando Perez <fperez@colorado.edu>
2561
2574
2562 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2575 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2563 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2576 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2564
2577
2565 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2578 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2566 this function to fix a problem reported by Alex Schmolck. He saw
2579 this function to fix a problem reported by Alex Schmolck. He saw
2567 it with list comprehensions and generators, which were getting
2580 it with list comprehensions and generators, which were getting
2568 called twice. The real problem was an 'eval' call in testing for
2581 called twice. The real problem was an 'eval' call in testing for
2569 automagic which was evaluating the input line silently.
2582 automagic which was evaluating the input line silently.
2570
2583
2571 This is a potentially very nasty bug, if the input has side
2584 This is a potentially very nasty bug, if the input has side
2572 effects which must not be repeated. The code is much cleaner now,
2585 effects which must not be repeated. The code is much cleaner now,
2573 without any blanket 'except' left and with a regexp test for
2586 without any blanket 'except' left and with a regexp test for
2574 actual function names.
2587 actual function names.
2575
2588
2576 But an eval remains, which I'm not fully comfortable with. I just
2589 But an eval remains, which I'm not fully comfortable with. I just
2577 don't know how to find out if an expression could be a callable in
2590 don't know how to find out if an expression could be a callable in
2578 the user's namespace without doing an eval on the string. However
2591 the user's namespace without doing an eval on the string. However
2579 that string is now much more strictly checked so that no code
2592 that string is now much more strictly checked so that no code
2580 slips by, so the eval should only happen for things that can
2593 slips by, so the eval should only happen for things that can
2581 really be only function/method names.
2594 really be only function/method names.
2582
2595
2583 2002-10-15 Fernando Perez <fperez@colorado.edu>
2596 2002-10-15 Fernando Perez <fperez@colorado.edu>
2584
2597
2585 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2598 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2586 OSX information to main manual, removed README_Mac_OSX file from
2599 OSX information to main manual, removed README_Mac_OSX file from
2587 distribution. Also updated credits for recent additions.
2600 distribution. Also updated credits for recent additions.
2588
2601
2589 2002-10-10 Fernando Perez <fperez@colorado.edu>
2602 2002-10-10 Fernando Perez <fperez@colorado.edu>
2590
2603
2591 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2604 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2592 terminal-related issues. Many thanks to Andrea Riciputi
2605 terminal-related issues. Many thanks to Andrea Riciputi
2593 <andrea.riciputi-AT-libero.it> for writing it.
2606 <andrea.riciputi-AT-libero.it> for writing it.
2594
2607
2595 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2608 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2596 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2609 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2597
2610
2598 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2611 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2599 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2612 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2600 <syver-en-AT-online.no> who both submitted patches for this problem.
2613 <syver-en-AT-online.no> who both submitted patches for this problem.
2601
2614
2602 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2615 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2603 global embedding to make sure that things don't overwrite user
2616 global embedding to make sure that things don't overwrite user
2604 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2617 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2605
2618
2606 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2619 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2607 compatibility. Thanks to Hayden Callow
2620 compatibility. Thanks to Hayden Callow
2608 <h.callow-AT-elec.canterbury.ac.nz>
2621 <h.callow-AT-elec.canterbury.ac.nz>
2609
2622
2610 2002-10-04 Fernando Perez <fperez@colorado.edu>
2623 2002-10-04 Fernando Perez <fperez@colorado.edu>
2611
2624
2612 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2625 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2613 Gnuplot.File objects.
2626 Gnuplot.File objects.
2614
2627
2615 2002-07-23 Fernando Perez <fperez@colorado.edu>
2628 2002-07-23 Fernando Perez <fperez@colorado.edu>
2616
2629
2617 * IPython/genutils.py (timing): Added timings() and timing() for
2630 * IPython/genutils.py (timing): Added timings() and timing() for
2618 quick access to the most commonly needed data, the execution
2631 quick access to the most commonly needed data, the execution
2619 times. Old timing() renamed to timings_out().
2632 times. Old timing() renamed to timings_out().
2620
2633
2621 2002-07-18 Fernando Perez <fperez@colorado.edu>
2634 2002-07-18 Fernando Perez <fperez@colorado.edu>
2622
2635
2623 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2636 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2624 bug with nested instances disrupting the parent's tab completion.
2637 bug with nested instances disrupting the parent's tab completion.
2625
2638
2626 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2639 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2627 all_completions code to begin the emacs integration.
2640 all_completions code to begin the emacs integration.
2628
2641
2629 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2642 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2630 argument to allow titling individual arrays when plotting.
2643 argument to allow titling individual arrays when plotting.
2631
2644
2632 2002-07-15 Fernando Perez <fperez@colorado.edu>
2645 2002-07-15 Fernando Perez <fperez@colorado.edu>
2633
2646
2634 * setup.py (make_shortcut): changed to retrieve the value of
2647 * setup.py (make_shortcut): changed to retrieve the value of
2635 'Program Files' directory from the registry (this value changes in
2648 'Program Files' directory from the registry (this value changes in
2636 non-english versions of Windows). Thanks to Thomas Fanslau
2649 non-english versions of Windows). Thanks to Thomas Fanslau
2637 <tfanslau-AT-gmx.de> for the report.
2650 <tfanslau-AT-gmx.de> for the report.
2638
2651
2639 2002-07-10 Fernando Perez <fperez@colorado.edu>
2652 2002-07-10 Fernando Perez <fperez@colorado.edu>
2640
2653
2641 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2654 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2642 a bug in pdb, which crashes if a line with only whitespace is
2655 a bug in pdb, which crashes if a line with only whitespace is
2643 entered. Bug report submitted to sourceforge.
2656 entered. Bug report submitted to sourceforge.
2644
2657
2645 2002-07-09 Fernando Perez <fperez@colorado.edu>
2658 2002-07-09 Fernando Perez <fperez@colorado.edu>
2646
2659
2647 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2660 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2648 reporting exceptions (it's a bug in inspect.py, I just set a
2661 reporting exceptions (it's a bug in inspect.py, I just set a
2649 workaround).
2662 workaround).
2650
2663
2651 2002-07-08 Fernando Perez <fperez@colorado.edu>
2664 2002-07-08 Fernando Perez <fperez@colorado.edu>
2652
2665
2653 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2666 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2654 __IPYTHON__ in __builtins__ to show up in user_ns.
2667 __IPYTHON__ in __builtins__ to show up in user_ns.
2655
2668
2656 2002-07-03 Fernando Perez <fperez@colorado.edu>
2669 2002-07-03 Fernando Perez <fperez@colorado.edu>
2657
2670
2658 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2671 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2659 name from @gp_set_instance to @gp_set_default.
2672 name from @gp_set_instance to @gp_set_default.
2660
2673
2661 * IPython/ipmaker.py (make_IPython): default editor value set to
2674 * IPython/ipmaker.py (make_IPython): default editor value set to
2662 '0' (a string), to match the rc file. Otherwise will crash when
2675 '0' (a string), to match the rc file. Otherwise will crash when
2663 .strip() is called on it.
2676 .strip() is called on it.
2664
2677
2665
2678
2666 2002-06-28 Fernando Perez <fperez@colorado.edu>
2679 2002-06-28 Fernando Perez <fperez@colorado.edu>
2667
2680
2668 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2681 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2669 of files in current directory when a file is executed via
2682 of files in current directory when a file is executed via
2670 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2683 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2671
2684
2672 * setup.py (manfiles): fix for rpm builds, submitted by RA
2685 * setup.py (manfiles): fix for rpm builds, submitted by RA
2673 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2686 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2674
2687
2675 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2688 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2676 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2689 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2677 string!). A. Schmolck caught this one.
2690 string!). A. Schmolck caught this one.
2678
2691
2679 2002-06-27 Fernando Perez <fperez@colorado.edu>
2692 2002-06-27 Fernando Perez <fperez@colorado.edu>
2680
2693
2681 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2694 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2682 defined files at the cmd line. __name__ wasn't being set to
2695 defined files at the cmd line. __name__ wasn't being set to
2683 __main__.
2696 __main__.
2684
2697
2685 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2698 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2686 regular lists and tuples besides Numeric arrays.
2699 regular lists and tuples besides Numeric arrays.
2687
2700
2688 * IPython/Prompts.py (CachedOutput.__call__): Added output
2701 * IPython/Prompts.py (CachedOutput.__call__): Added output
2689 supression for input ending with ';'. Similar to Mathematica and
2702 supression for input ending with ';'. Similar to Mathematica and
2690 Matlab. The _* vars and Out[] list are still updated, just like
2703 Matlab. The _* vars and Out[] list are still updated, just like
2691 Mathematica behaves.
2704 Mathematica behaves.
2692
2705
2693 2002-06-25 Fernando Perez <fperez@colorado.edu>
2706 2002-06-25 Fernando Perez <fperez@colorado.edu>
2694
2707
2695 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2708 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2696 .ini extensions for profiels under Windows.
2709 .ini extensions for profiels under Windows.
2697
2710
2698 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2711 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2699 string form. Fix contributed by Alexander Schmolck
2712 string form. Fix contributed by Alexander Schmolck
2700 <a.schmolck-AT-gmx.net>
2713 <a.schmolck-AT-gmx.net>
2701
2714
2702 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2715 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2703 pre-configured Gnuplot instance.
2716 pre-configured Gnuplot instance.
2704
2717
2705 2002-06-21 Fernando Perez <fperez@colorado.edu>
2718 2002-06-21 Fernando Perez <fperez@colorado.edu>
2706
2719
2707 * IPython/numutils.py (exp_safe): new function, works around the
2720 * IPython/numutils.py (exp_safe): new function, works around the
2708 underflow problems in Numeric.
2721 underflow problems in Numeric.
2709 (log2): New fn. Safe log in base 2: returns exact integer answer
2722 (log2): New fn. Safe log in base 2: returns exact integer answer
2710 for exact integer powers of 2.
2723 for exact integer powers of 2.
2711
2724
2712 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2725 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2713 properly.
2726 properly.
2714
2727
2715 2002-06-20 Fernando Perez <fperez@colorado.edu>
2728 2002-06-20 Fernando Perez <fperez@colorado.edu>
2716
2729
2717 * IPython/genutils.py (timing): new function like
2730 * IPython/genutils.py (timing): new function like
2718 Mathematica's. Similar to time_test, but returns more info.
2731 Mathematica's. Similar to time_test, but returns more info.
2719
2732
2720 2002-06-18 Fernando Perez <fperez@colorado.edu>
2733 2002-06-18 Fernando Perez <fperez@colorado.edu>
2721
2734
2722 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2735 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2723 according to Mike Heeter's suggestions.
2736 according to Mike Heeter's suggestions.
2724
2737
2725 2002-06-16 Fernando Perez <fperez@colorado.edu>
2738 2002-06-16 Fernando Perez <fperez@colorado.edu>
2726
2739
2727 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2740 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2728 system. GnuplotMagic is gone as a user-directory option. New files
2741 system. GnuplotMagic is gone as a user-directory option. New files
2729 make it easier to use all the gnuplot stuff both from external
2742 make it easier to use all the gnuplot stuff both from external
2730 programs as well as from IPython. Had to rewrite part of
2743 programs as well as from IPython. Had to rewrite part of
2731 hardcopy() b/c of a strange bug: often the ps files simply don't
2744 hardcopy() b/c of a strange bug: often the ps files simply don't
2732 get created, and require a repeat of the command (often several
2745 get created, and require a repeat of the command (often several
2733 times).
2746 times).
2734
2747
2735 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2748 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2736 resolve output channel at call time, so that if sys.stderr has
2749 resolve output channel at call time, so that if sys.stderr has
2737 been redirected by user this gets honored.
2750 been redirected by user this gets honored.
2738
2751
2739 2002-06-13 Fernando Perez <fperez@colorado.edu>
2752 2002-06-13 Fernando Perez <fperez@colorado.edu>
2740
2753
2741 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2754 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2742 IPShell. Kept a copy with the old names to avoid breaking people's
2755 IPShell. Kept a copy with the old names to avoid breaking people's
2743 embedded code.
2756 embedded code.
2744
2757
2745 * IPython/ipython: simplified it to the bare minimum after
2758 * IPython/ipython: simplified it to the bare minimum after
2746 Holger's suggestions. Added info about how to use it in
2759 Holger's suggestions. Added info about how to use it in
2747 PYTHONSTARTUP.
2760 PYTHONSTARTUP.
2748
2761
2749 * IPython/Shell.py (IPythonShell): changed the options passing
2762 * IPython/Shell.py (IPythonShell): changed the options passing
2750 from a string with funky %s replacements to a straight list. Maybe
2763 from a string with funky %s replacements to a straight list. Maybe
2751 a bit more typing, but it follows sys.argv conventions, so there's
2764 a bit more typing, but it follows sys.argv conventions, so there's
2752 less special-casing to remember.
2765 less special-casing to remember.
2753
2766
2754 2002-06-12 Fernando Perez <fperez@colorado.edu>
2767 2002-06-12 Fernando Perez <fperez@colorado.edu>
2755
2768
2756 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2769 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2757 command. Thanks to a suggestion by Mike Heeter.
2770 command. Thanks to a suggestion by Mike Heeter.
2758 (Magic.magic_pfile): added behavior to look at filenames if given
2771 (Magic.magic_pfile): added behavior to look at filenames if given
2759 arg is not a defined object.
2772 arg is not a defined object.
2760 (Magic.magic_save): New @save function to save code snippets. Also
2773 (Magic.magic_save): New @save function to save code snippets. Also
2761 a Mike Heeter idea.
2774 a Mike Heeter idea.
2762
2775
2763 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2776 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2764 plot() and replot(). Much more convenient now, especially for
2777 plot() and replot(). Much more convenient now, especially for
2765 interactive use.
2778 interactive use.
2766
2779
2767 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2780 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2768 filenames.
2781 filenames.
2769
2782
2770 2002-06-02 Fernando Perez <fperez@colorado.edu>
2783 2002-06-02 Fernando Perez <fperez@colorado.edu>
2771
2784
2772 * IPython/Struct.py (Struct.__init__): modified to admit
2785 * IPython/Struct.py (Struct.__init__): modified to admit
2773 initialization via another struct.
2786 initialization via another struct.
2774
2787
2775 * IPython/genutils.py (SystemExec.__init__): New stateful
2788 * IPython/genutils.py (SystemExec.__init__): New stateful
2776 interface to xsys and bq. Useful for writing system scripts.
2789 interface to xsys and bq. Useful for writing system scripts.
2777
2790
2778 2002-05-30 Fernando Perez <fperez@colorado.edu>
2791 2002-05-30 Fernando Perez <fperez@colorado.edu>
2779
2792
2780 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2793 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2781 documents. This will make the user download smaller (it's getting
2794 documents. This will make the user download smaller (it's getting
2782 too big).
2795 too big).
2783
2796
2784 2002-05-29 Fernando Perez <fperez@colorado.edu>
2797 2002-05-29 Fernando Perez <fperez@colorado.edu>
2785
2798
2786 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2799 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2787 fix problems with shelve and pickle. Seems to work, but I don't
2800 fix problems with shelve and pickle. Seems to work, but I don't
2788 know if corner cases break it. Thanks to Mike Heeter
2801 know if corner cases break it. Thanks to Mike Heeter
2789 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2802 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2790
2803
2791 2002-05-24 Fernando Perez <fperez@colorado.edu>
2804 2002-05-24 Fernando Perez <fperez@colorado.edu>
2792
2805
2793 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2806 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2794 macros having broken.
2807 macros having broken.
2795
2808
2796 2002-05-21 Fernando Perez <fperez@colorado.edu>
2809 2002-05-21 Fernando Perez <fperez@colorado.edu>
2797
2810
2798 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2811 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2799 introduced logging bug: all history before logging started was
2812 introduced logging bug: all history before logging started was
2800 being written one character per line! This came from the redesign
2813 being written one character per line! This came from the redesign
2801 of the input history as a special list which slices to strings,
2814 of the input history as a special list which slices to strings,
2802 not to lists.
2815 not to lists.
2803
2816
2804 2002-05-20 Fernando Perez <fperez@colorado.edu>
2817 2002-05-20 Fernando Perez <fperez@colorado.edu>
2805
2818
2806 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2819 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2807 be an attribute of all classes in this module. The design of these
2820 be an attribute of all classes in this module. The design of these
2808 classes needs some serious overhauling.
2821 classes needs some serious overhauling.
2809
2822
2810 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2823 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2811 which was ignoring '_' in option names.
2824 which was ignoring '_' in option names.
2812
2825
2813 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2826 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2814 'Verbose_novars' to 'Context' and made it the new default. It's a
2827 'Verbose_novars' to 'Context' and made it the new default. It's a
2815 bit more readable and also safer than verbose.
2828 bit more readable and also safer than verbose.
2816
2829
2817 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2830 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2818 triple-quoted strings.
2831 triple-quoted strings.
2819
2832
2820 * IPython/OInspect.py (__all__): new module exposing the object
2833 * IPython/OInspect.py (__all__): new module exposing the object
2821 introspection facilities. Now the corresponding magics are dummy
2834 introspection facilities. Now the corresponding magics are dummy
2822 wrappers around this. Having this module will make it much easier
2835 wrappers around this. Having this module will make it much easier
2823 to put these functions into our modified pdb.
2836 to put these functions into our modified pdb.
2824 This new object inspector system uses the new colorizing module,
2837 This new object inspector system uses the new colorizing module,
2825 so source code and other things are nicely syntax highlighted.
2838 so source code and other things are nicely syntax highlighted.
2826
2839
2827 2002-05-18 Fernando Perez <fperez@colorado.edu>
2840 2002-05-18 Fernando Perez <fperez@colorado.edu>
2828
2841
2829 * IPython/ColorANSI.py: Split the coloring tools into a separate
2842 * IPython/ColorANSI.py: Split the coloring tools into a separate
2830 module so I can use them in other code easier (they were part of
2843 module so I can use them in other code easier (they were part of
2831 ultraTB).
2844 ultraTB).
2832
2845
2833 2002-05-17 Fernando Perez <fperez@colorado.edu>
2846 2002-05-17 Fernando Perez <fperez@colorado.edu>
2834
2847
2835 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2848 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2836 fixed it to set the global 'g' also to the called instance, as
2849 fixed it to set the global 'g' also to the called instance, as
2837 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2850 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2838 user's 'g' variables).
2851 user's 'g' variables).
2839
2852
2840 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2853 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2841 global variables (aliases to _ih,_oh) so that users which expect
2854 global variables (aliases to _ih,_oh) so that users which expect
2842 In[5] or Out[7] to work aren't unpleasantly surprised.
2855 In[5] or Out[7] to work aren't unpleasantly surprised.
2843 (InputList.__getslice__): new class to allow executing slices of
2856 (InputList.__getslice__): new class to allow executing slices of
2844 input history directly. Very simple class, complements the use of
2857 input history directly. Very simple class, complements the use of
2845 macros.
2858 macros.
2846
2859
2847 2002-05-16 Fernando Perez <fperez@colorado.edu>
2860 2002-05-16 Fernando Perez <fperez@colorado.edu>
2848
2861
2849 * setup.py (docdirbase): make doc directory be just doc/IPython
2862 * setup.py (docdirbase): make doc directory be just doc/IPython
2850 without version numbers, it will reduce clutter for users.
2863 without version numbers, it will reduce clutter for users.
2851
2864
2852 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2865 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2853 execfile call to prevent possible memory leak. See for details:
2866 execfile call to prevent possible memory leak. See for details:
2854 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2867 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2855
2868
2856 2002-05-15 Fernando Perez <fperez@colorado.edu>
2869 2002-05-15 Fernando Perez <fperez@colorado.edu>
2857
2870
2858 * IPython/Magic.py (Magic.magic_psource): made the object
2871 * IPython/Magic.py (Magic.magic_psource): made the object
2859 introspection names be more standard: pdoc, pdef, pfile and
2872 introspection names be more standard: pdoc, pdef, pfile and
2860 psource. They all print/page their output, and it makes
2873 psource. They all print/page their output, and it makes
2861 remembering them easier. Kept old names for compatibility as
2874 remembering them easier. Kept old names for compatibility as
2862 aliases.
2875 aliases.
2863
2876
2864 2002-05-14 Fernando Perez <fperez@colorado.edu>
2877 2002-05-14 Fernando Perez <fperez@colorado.edu>
2865
2878
2866 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2879 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2867 what the mouse problem was. The trick is to use gnuplot with temp
2880 what the mouse problem was. The trick is to use gnuplot with temp
2868 files and NOT with pipes (for data communication), because having
2881 files and NOT with pipes (for data communication), because having
2869 both pipes and the mouse on is bad news.
2882 both pipes and the mouse on is bad news.
2870
2883
2871 2002-05-13 Fernando Perez <fperez@colorado.edu>
2884 2002-05-13 Fernando Perez <fperez@colorado.edu>
2872
2885
2873 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2886 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2874 bug. Information would be reported about builtins even when
2887 bug. Information would be reported about builtins even when
2875 user-defined functions overrode them.
2888 user-defined functions overrode them.
2876
2889
2877 2002-05-11 Fernando Perez <fperez@colorado.edu>
2890 2002-05-11 Fernando Perez <fperez@colorado.edu>
2878
2891
2879 * IPython/__init__.py (__all__): removed FlexCompleter from
2892 * IPython/__init__.py (__all__): removed FlexCompleter from
2880 __all__ so that things don't fail in platforms without readline.
2893 __all__ so that things don't fail in platforms without readline.
2881
2894
2882 2002-05-10 Fernando Perez <fperez@colorado.edu>
2895 2002-05-10 Fernando Perez <fperez@colorado.edu>
2883
2896
2884 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2897 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2885 it requires Numeric, effectively making Numeric a dependency for
2898 it requires Numeric, effectively making Numeric a dependency for
2886 IPython.
2899 IPython.
2887
2900
2888 * Released 0.2.13
2901 * Released 0.2.13
2889
2902
2890 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2903 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2891 profiler interface. Now all the major options from the profiler
2904 profiler interface. Now all the major options from the profiler
2892 module are directly supported in IPython, both for single
2905 module are directly supported in IPython, both for single
2893 expressions (@prun) and for full programs (@run -p).
2906 expressions (@prun) and for full programs (@run -p).
2894
2907
2895 2002-05-09 Fernando Perez <fperez@colorado.edu>
2908 2002-05-09 Fernando Perez <fperez@colorado.edu>
2896
2909
2897 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2910 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2898 magic properly formatted for screen.
2911 magic properly formatted for screen.
2899
2912
2900 * setup.py (make_shortcut): Changed things to put pdf version in
2913 * setup.py (make_shortcut): Changed things to put pdf version in
2901 doc/ instead of doc/manual (had to change lyxport a bit).
2914 doc/ instead of doc/manual (had to change lyxport a bit).
2902
2915
2903 * IPython/Magic.py (Profile.string_stats): made profile runs go
2916 * IPython/Magic.py (Profile.string_stats): made profile runs go
2904 through pager (they are long and a pager allows searching, saving,
2917 through pager (they are long and a pager allows searching, saving,
2905 etc.)
2918 etc.)
2906
2919
2907 2002-05-08 Fernando Perez <fperez@colorado.edu>
2920 2002-05-08 Fernando Perez <fperez@colorado.edu>
2908
2921
2909 * Released 0.2.12
2922 * Released 0.2.12
2910
2923
2911 2002-05-06 Fernando Perez <fperez@colorado.edu>
2924 2002-05-06 Fernando Perez <fperez@colorado.edu>
2912
2925
2913 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2926 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2914 introduced); 'hist n1 n2' was broken.
2927 introduced); 'hist n1 n2' was broken.
2915 (Magic.magic_pdb): added optional on/off arguments to @pdb
2928 (Magic.magic_pdb): added optional on/off arguments to @pdb
2916 (Magic.magic_run): added option -i to @run, which executes code in
2929 (Magic.magic_run): added option -i to @run, which executes code in
2917 the IPython namespace instead of a clean one. Also added @irun as
2930 the IPython namespace instead of a clean one. Also added @irun as
2918 an alias to @run -i.
2931 an alias to @run -i.
2919
2932
2920 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2933 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2921 fixed (it didn't really do anything, the namespaces were wrong).
2934 fixed (it didn't really do anything, the namespaces were wrong).
2922
2935
2923 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2936 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2924
2937
2925 * IPython/__init__.py (__all__): Fixed package namespace, now
2938 * IPython/__init__.py (__all__): Fixed package namespace, now
2926 'import IPython' does give access to IPython.<all> as
2939 'import IPython' does give access to IPython.<all> as
2927 expected. Also renamed __release__ to Release.
2940 expected. Also renamed __release__ to Release.
2928
2941
2929 * IPython/Debugger.py (__license__): created new Pdb class which
2942 * IPython/Debugger.py (__license__): created new Pdb class which
2930 functions like a drop-in for the normal pdb.Pdb but does NOT
2943 functions like a drop-in for the normal pdb.Pdb but does NOT
2931 import readline by default. This way it doesn't muck up IPython's
2944 import readline by default. This way it doesn't muck up IPython's
2932 readline handling, and now tab-completion finally works in the
2945 readline handling, and now tab-completion finally works in the
2933 debugger -- sort of. It completes things globally visible, but the
2946 debugger -- sort of. It completes things globally visible, but the
2934 completer doesn't track the stack as pdb walks it. That's a bit
2947 completer doesn't track the stack as pdb walks it. That's a bit
2935 tricky, and I'll have to implement it later.
2948 tricky, and I'll have to implement it later.
2936
2949
2937 2002-05-05 Fernando Perez <fperez@colorado.edu>
2950 2002-05-05 Fernando Perez <fperez@colorado.edu>
2938
2951
2939 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2952 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2940 magic docstrings when printed via ? (explicit \'s were being
2953 magic docstrings when printed via ? (explicit \'s were being
2941 printed).
2954 printed).
2942
2955
2943 * IPython/ipmaker.py (make_IPython): fixed namespace
2956 * IPython/ipmaker.py (make_IPython): fixed namespace
2944 identification bug. Now variables loaded via logs or command-line
2957 identification bug. Now variables loaded via logs or command-line
2945 files are recognized in the interactive namespace by @who.
2958 files are recognized in the interactive namespace by @who.
2946
2959
2947 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2960 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2948 log replay system stemming from the string form of Structs.
2961 log replay system stemming from the string form of Structs.
2949
2962
2950 * IPython/Magic.py (Macro.__init__): improved macros to properly
2963 * IPython/Magic.py (Macro.__init__): improved macros to properly
2951 handle magic commands in them.
2964 handle magic commands in them.
2952 (Magic.magic_logstart): usernames are now expanded so 'logstart
2965 (Magic.magic_logstart): usernames are now expanded so 'logstart
2953 ~/mylog' now works.
2966 ~/mylog' now works.
2954
2967
2955 * IPython/iplib.py (complete): fixed bug where paths starting with
2968 * IPython/iplib.py (complete): fixed bug where paths starting with
2956 '/' would be completed as magic names.
2969 '/' would be completed as magic names.
2957
2970
2958 2002-05-04 Fernando Perez <fperez@colorado.edu>
2971 2002-05-04 Fernando Perez <fperez@colorado.edu>
2959
2972
2960 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2973 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2961 allow running full programs under the profiler's control.
2974 allow running full programs under the profiler's control.
2962
2975
2963 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2976 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2964 mode to report exceptions verbosely but without formatting
2977 mode to report exceptions verbosely but without formatting
2965 variables. This addresses the issue of ipython 'freezing' (it's
2978 variables. This addresses the issue of ipython 'freezing' (it's
2966 not frozen, but caught in an expensive formatting loop) when huge
2979 not frozen, but caught in an expensive formatting loop) when huge
2967 variables are in the context of an exception.
2980 variables are in the context of an exception.
2968 (VerboseTB.text): Added '--->' markers at line where exception was
2981 (VerboseTB.text): Added '--->' markers at line where exception was
2969 triggered. Much clearer to read, especially in NoColor modes.
2982 triggered. Much clearer to read, especially in NoColor modes.
2970
2983
2971 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2984 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2972 implemented in reverse when changing to the new parse_options().
2985 implemented in reverse when changing to the new parse_options().
2973
2986
2974 2002-05-03 Fernando Perez <fperez@colorado.edu>
2987 2002-05-03 Fernando Perez <fperez@colorado.edu>
2975
2988
2976 * IPython/Magic.py (Magic.parse_options): new function so that
2989 * IPython/Magic.py (Magic.parse_options): new function so that
2977 magics can parse options easier.
2990 magics can parse options easier.
2978 (Magic.magic_prun): new function similar to profile.run(),
2991 (Magic.magic_prun): new function similar to profile.run(),
2979 suggested by Chris Hart.
2992 suggested by Chris Hart.
2980 (Magic.magic_cd): fixed behavior so that it only changes if
2993 (Magic.magic_cd): fixed behavior so that it only changes if
2981 directory actually is in history.
2994 directory actually is in history.
2982
2995
2983 * IPython/usage.py (__doc__): added information about potential
2996 * IPython/usage.py (__doc__): added information about potential
2984 slowness of Verbose exception mode when there are huge data
2997 slowness of Verbose exception mode when there are huge data
2985 structures to be formatted (thanks to Archie Paulson).
2998 structures to be formatted (thanks to Archie Paulson).
2986
2999
2987 * IPython/ipmaker.py (make_IPython): Changed default logging
3000 * IPython/ipmaker.py (make_IPython): Changed default logging
2988 (when simply called with -log) to use curr_dir/ipython.log in
3001 (when simply called with -log) to use curr_dir/ipython.log in
2989 rotate mode. Fixed crash which was occuring with -log before
3002 rotate mode. Fixed crash which was occuring with -log before
2990 (thanks to Jim Boyle).
3003 (thanks to Jim Boyle).
2991
3004
2992 2002-05-01 Fernando Perez <fperez@colorado.edu>
3005 2002-05-01 Fernando Perez <fperez@colorado.edu>
2993
3006
2994 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3007 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2995 was nasty -- though somewhat of a corner case).
3008 was nasty -- though somewhat of a corner case).
2996
3009
2997 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3010 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2998 text (was a bug).
3011 text (was a bug).
2999
3012
3000 2002-04-30 Fernando Perez <fperez@colorado.edu>
3013 2002-04-30 Fernando Perez <fperez@colorado.edu>
3001
3014
3002 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3015 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3003 a print after ^D or ^C from the user so that the In[] prompt
3016 a print after ^D or ^C from the user so that the In[] prompt
3004 doesn't over-run the gnuplot one.
3017 doesn't over-run the gnuplot one.
3005
3018
3006 2002-04-29 Fernando Perez <fperez@colorado.edu>
3019 2002-04-29 Fernando Perez <fperez@colorado.edu>
3007
3020
3008 * Released 0.2.10
3021 * Released 0.2.10
3009
3022
3010 * IPython/__release__.py (version): get date dynamically.
3023 * IPython/__release__.py (version): get date dynamically.
3011
3024
3012 * Misc. documentation updates thanks to Arnd's comments. Also ran
3025 * Misc. documentation updates thanks to Arnd's comments. Also ran
3013 a full spellcheck on the manual (hadn't been done in a while).
3026 a full spellcheck on the manual (hadn't been done in a while).
3014
3027
3015 2002-04-27 Fernando Perez <fperez@colorado.edu>
3028 2002-04-27 Fernando Perez <fperez@colorado.edu>
3016
3029
3017 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3030 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3018 starting a log in mid-session would reset the input history list.
3031 starting a log in mid-session would reset the input history list.
3019
3032
3020 2002-04-26 Fernando Perez <fperez@colorado.edu>
3033 2002-04-26 Fernando Perez <fperez@colorado.edu>
3021
3034
3022 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3035 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3023 all files were being included in an update. Now anything in
3036 all files were being included in an update. Now anything in
3024 UserConfig that matches [A-Za-z]*.py will go (this excludes
3037 UserConfig that matches [A-Za-z]*.py will go (this excludes
3025 __init__.py)
3038 __init__.py)
3026
3039
3027 2002-04-25 Fernando Perez <fperez@colorado.edu>
3040 2002-04-25 Fernando Perez <fperez@colorado.edu>
3028
3041
3029 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3042 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3030 to __builtins__ so that any form of embedded or imported code can
3043 to __builtins__ so that any form of embedded or imported code can
3031 test for being inside IPython.
3044 test for being inside IPython.
3032
3045
3033 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3046 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3034 changed to GnuplotMagic because it's now an importable module,
3047 changed to GnuplotMagic because it's now an importable module,
3035 this makes the name follow that of the standard Gnuplot module.
3048 this makes the name follow that of the standard Gnuplot module.
3036 GnuplotMagic can now be loaded at any time in mid-session.
3049 GnuplotMagic can now be loaded at any time in mid-session.
3037
3050
3038 2002-04-24 Fernando Perez <fperez@colorado.edu>
3051 2002-04-24 Fernando Perez <fperez@colorado.edu>
3039
3052
3040 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3053 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3041 the globals (IPython has its own namespace) and the
3054 the globals (IPython has its own namespace) and the
3042 PhysicalQuantity stuff is much better anyway.
3055 PhysicalQuantity stuff is much better anyway.
3043
3056
3044 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3057 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3045 embedding example to standard user directory for
3058 embedding example to standard user directory for
3046 distribution. Also put it in the manual.
3059 distribution. Also put it in the manual.
3047
3060
3048 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3061 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3049 instance as first argument (so it doesn't rely on some obscure
3062 instance as first argument (so it doesn't rely on some obscure
3050 hidden global).
3063 hidden global).
3051
3064
3052 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3065 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3053 delimiters. While it prevents ().TAB from working, it allows
3066 delimiters. While it prevents ().TAB from working, it allows
3054 completions in open (... expressions. This is by far a more common
3067 completions in open (... expressions. This is by far a more common
3055 case.
3068 case.
3056
3069
3057 2002-04-23 Fernando Perez <fperez@colorado.edu>
3070 2002-04-23 Fernando Perez <fperez@colorado.edu>
3058
3071
3059 * IPython/Extensions/InterpreterPasteInput.py: new
3072 * IPython/Extensions/InterpreterPasteInput.py: new
3060 syntax-processing module for pasting lines with >>> or ... at the
3073 syntax-processing module for pasting lines with >>> or ... at the
3061 start.
3074 start.
3062
3075
3063 * IPython/Extensions/PhysicalQ_Interactive.py
3076 * IPython/Extensions/PhysicalQ_Interactive.py
3064 (PhysicalQuantityInteractive.__int__): fixed to work with either
3077 (PhysicalQuantityInteractive.__int__): fixed to work with either
3065 Numeric or math.
3078 Numeric or math.
3066
3079
3067 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3080 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3068 provided profiles. Now we have:
3081 provided profiles. Now we have:
3069 -math -> math module as * and cmath with its own namespace.
3082 -math -> math module as * and cmath with its own namespace.
3070 -numeric -> Numeric as *, plus gnuplot & grace
3083 -numeric -> Numeric as *, plus gnuplot & grace
3071 -physics -> same as before
3084 -physics -> same as before
3072
3085
3073 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3086 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3074 user-defined magics wouldn't be found by @magic if they were
3087 user-defined magics wouldn't be found by @magic if they were
3075 defined as class methods. Also cleaned up the namespace search
3088 defined as class methods. Also cleaned up the namespace search
3076 logic and the string building (to use %s instead of many repeated
3089 logic and the string building (to use %s instead of many repeated
3077 string adds).
3090 string adds).
3078
3091
3079 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3092 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3080 of user-defined magics to operate with class methods (cleaner, in
3093 of user-defined magics to operate with class methods (cleaner, in
3081 line with the gnuplot code).
3094 line with the gnuplot code).
3082
3095
3083 2002-04-22 Fernando Perez <fperez@colorado.edu>
3096 2002-04-22 Fernando Perez <fperez@colorado.edu>
3084
3097
3085 * setup.py: updated dependency list so that manual is updated when
3098 * setup.py: updated dependency list so that manual is updated when
3086 all included files change.
3099 all included files change.
3087
3100
3088 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3101 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3089 the delimiter removal option (the fix is ugly right now).
3102 the delimiter removal option (the fix is ugly right now).
3090
3103
3091 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3104 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3092 all of the math profile (quicker loading, no conflict between
3105 all of the math profile (quicker loading, no conflict between
3093 g-9.8 and g-gnuplot).
3106 g-9.8 and g-gnuplot).
3094
3107
3095 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3108 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3096 name of post-mortem files to IPython_crash_report.txt.
3109 name of post-mortem files to IPython_crash_report.txt.
3097
3110
3098 * Cleanup/update of the docs. Added all the new readline info and
3111 * Cleanup/update of the docs. Added all the new readline info and
3099 formatted all lists as 'real lists'.
3112 formatted all lists as 'real lists'.
3100
3113
3101 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3114 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3102 tab-completion options, since the full readline parse_and_bind is
3115 tab-completion options, since the full readline parse_and_bind is
3103 now accessible.
3116 now accessible.
3104
3117
3105 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3118 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3106 handling of readline options. Now users can specify any string to
3119 handling of readline options. Now users can specify any string to
3107 be passed to parse_and_bind(), as well as the delimiters to be
3120 be passed to parse_and_bind(), as well as the delimiters to be
3108 removed.
3121 removed.
3109 (InteractiveShell.__init__): Added __name__ to the global
3122 (InteractiveShell.__init__): Added __name__ to the global
3110 namespace so that things like Itpl which rely on its existence
3123 namespace so that things like Itpl which rely on its existence
3111 don't crash.
3124 don't crash.
3112 (InteractiveShell._prefilter): Defined the default with a _ so
3125 (InteractiveShell._prefilter): Defined the default with a _ so
3113 that prefilter() is easier to override, while the default one
3126 that prefilter() is easier to override, while the default one
3114 remains available.
3127 remains available.
3115
3128
3116 2002-04-18 Fernando Perez <fperez@colorado.edu>
3129 2002-04-18 Fernando Perez <fperez@colorado.edu>
3117
3130
3118 * Added information about pdb in the docs.
3131 * Added information about pdb in the docs.
3119
3132
3120 2002-04-17 Fernando Perez <fperez@colorado.edu>
3133 2002-04-17 Fernando Perez <fperez@colorado.edu>
3121
3134
3122 * IPython/ipmaker.py (make_IPython): added rc_override option to
3135 * IPython/ipmaker.py (make_IPython): added rc_override option to
3123 allow passing config options at creation time which may override
3136 allow passing config options at creation time which may override
3124 anything set in the config files or command line. This is
3137 anything set in the config files or command line. This is
3125 particularly useful for configuring embedded instances.
3138 particularly useful for configuring embedded instances.
3126
3139
3127 2002-04-15 Fernando Perez <fperez@colorado.edu>
3140 2002-04-15 Fernando Perez <fperez@colorado.edu>
3128
3141
3129 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3142 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3130 crash embedded instances because of the input cache falling out of
3143 crash embedded instances because of the input cache falling out of
3131 sync with the output counter.
3144 sync with the output counter.
3132
3145
3133 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3146 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3134 mode which calls pdb after an uncaught exception in IPython itself.
3147 mode which calls pdb after an uncaught exception in IPython itself.
3135
3148
3136 2002-04-14 Fernando Perez <fperez@colorado.edu>
3149 2002-04-14 Fernando Perez <fperez@colorado.edu>
3137
3150
3138 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3151 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3139 readline, fix it back after each call.
3152 readline, fix it back after each call.
3140
3153
3141 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3154 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3142 method to force all access via __call__(), which guarantees that
3155 method to force all access via __call__(), which guarantees that
3143 traceback references are properly deleted.
3156 traceback references are properly deleted.
3144
3157
3145 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3158 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3146 improve printing when pprint is in use.
3159 improve printing when pprint is in use.
3147
3160
3148 2002-04-13 Fernando Perez <fperez@colorado.edu>
3161 2002-04-13 Fernando Perez <fperez@colorado.edu>
3149
3162
3150 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3163 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3151 exceptions aren't caught anymore. If the user triggers one, he
3164 exceptions aren't caught anymore. If the user triggers one, he
3152 should know why he's doing it and it should go all the way up,
3165 should know why he's doing it and it should go all the way up,
3153 just like any other exception. So now @abort will fully kill the
3166 just like any other exception. So now @abort will fully kill the
3154 embedded interpreter and the embedding code (unless that happens
3167 embedded interpreter and the embedding code (unless that happens
3155 to catch SystemExit).
3168 to catch SystemExit).
3156
3169
3157 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3170 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3158 and a debugger() method to invoke the interactive pdb debugger
3171 and a debugger() method to invoke the interactive pdb debugger
3159 after printing exception information. Also added the corresponding
3172 after printing exception information. Also added the corresponding
3160 -pdb option and @pdb magic to control this feature, and updated
3173 -pdb option and @pdb magic to control this feature, and updated
3161 the docs. After a suggestion from Christopher Hart
3174 the docs. After a suggestion from Christopher Hart
3162 (hart-AT-caltech.edu).
3175 (hart-AT-caltech.edu).
3163
3176
3164 2002-04-12 Fernando Perez <fperez@colorado.edu>
3177 2002-04-12 Fernando Perez <fperez@colorado.edu>
3165
3178
3166 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3179 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3167 the exception handlers defined by the user (not the CrashHandler)
3180 the exception handlers defined by the user (not the CrashHandler)
3168 so that user exceptions don't trigger an ipython bug report.
3181 so that user exceptions don't trigger an ipython bug report.
3169
3182
3170 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3183 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3171 configurable (it should have always been so).
3184 configurable (it should have always been so).
3172
3185
3173 2002-03-26 Fernando Perez <fperez@colorado.edu>
3186 2002-03-26 Fernando Perez <fperez@colorado.edu>
3174
3187
3175 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3188 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3176 and there to fix embedding namespace issues. This should all be
3189 and there to fix embedding namespace issues. This should all be
3177 done in a more elegant way.
3190 done in a more elegant way.
3178
3191
3179 2002-03-25 Fernando Perez <fperez@colorado.edu>
3192 2002-03-25 Fernando Perez <fperez@colorado.edu>
3180
3193
3181 * IPython/genutils.py (get_home_dir): Try to make it work under
3194 * IPython/genutils.py (get_home_dir): Try to make it work under
3182 win9x also.
3195 win9x also.
3183
3196
3184 2002-03-20 Fernando Perez <fperez@colorado.edu>
3197 2002-03-20 Fernando Perez <fperez@colorado.edu>
3185
3198
3186 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3199 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3187 sys.displayhook untouched upon __init__.
3200 sys.displayhook untouched upon __init__.
3188
3201
3189 2002-03-19 Fernando Perez <fperez@colorado.edu>
3202 2002-03-19 Fernando Perez <fperez@colorado.edu>
3190
3203
3191 * Released 0.2.9 (for embedding bug, basically).
3204 * Released 0.2.9 (for embedding bug, basically).
3192
3205
3193 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3206 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3194 exceptions so that enclosing shell's state can be restored.
3207 exceptions so that enclosing shell's state can be restored.
3195
3208
3196 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3209 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3197 naming conventions in the .ipython/ dir.
3210 naming conventions in the .ipython/ dir.
3198
3211
3199 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3212 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3200 from delimiters list so filenames with - in them get expanded.
3213 from delimiters list so filenames with - in them get expanded.
3201
3214
3202 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3215 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3203 sys.displayhook not being properly restored after an embedded call.
3216 sys.displayhook not being properly restored after an embedded call.
3204
3217
3205 2002-03-18 Fernando Perez <fperez@colorado.edu>
3218 2002-03-18 Fernando Perez <fperez@colorado.edu>
3206
3219
3207 * Released 0.2.8
3220 * Released 0.2.8
3208
3221
3209 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3222 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3210 some files weren't being included in a -upgrade.
3223 some files weren't being included in a -upgrade.
3211 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3224 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3212 on' so that the first tab completes.
3225 on' so that the first tab completes.
3213 (InteractiveShell.handle_magic): fixed bug with spaces around
3226 (InteractiveShell.handle_magic): fixed bug with spaces around
3214 quotes breaking many magic commands.
3227 quotes breaking many magic commands.
3215
3228
3216 * setup.py: added note about ignoring the syntax error messages at
3229 * setup.py: added note about ignoring the syntax error messages at
3217 installation.
3230 installation.
3218
3231
3219 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3232 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3220 streamlining the gnuplot interface, now there's only one magic @gp.
3233 streamlining the gnuplot interface, now there's only one magic @gp.
3221
3234
3222 2002-03-17 Fernando Perez <fperez@colorado.edu>
3235 2002-03-17 Fernando Perez <fperez@colorado.edu>
3223
3236
3224 * IPython/UserConfig/magic_gnuplot.py: new name for the
3237 * IPython/UserConfig/magic_gnuplot.py: new name for the
3225 example-magic_pm.py file. Much enhanced system, now with a shell
3238 example-magic_pm.py file. Much enhanced system, now with a shell
3226 for communicating directly with gnuplot, one command at a time.
3239 for communicating directly with gnuplot, one command at a time.
3227
3240
3228 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3241 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3229 setting __name__=='__main__'.
3242 setting __name__=='__main__'.
3230
3243
3231 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3244 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3232 mini-shell for accessing gnuplot from inside ipython. Should
3245 mini-shell for accessing gnuplot from inside ipython. Should
3233 extend it later for grace access too. Inspired by Arnd's
3246 extend it later for grace access too. Inspired by Arnd's
3234 suggestion.
3247 suggestion.
3235
3248
3236 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3249 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3237 calling magic functions with () in their arguments. Thanks to Arnd
3250 calling magic functions with () in their arguments. Thanks to Arnd
3238 Baecker for pointing this to me.
3251 Baecker for pointing this to me.
3239
3252
3240 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3253 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3241 infinitely for integer or complex arrays (only worked with floats).
3254 infinitely for integer or complex arrays (only worked with floats).
3242
3255
3243 2002-03-16 Fernando Perez <fperez@colorado.edu>
3256 2002-03-16 Fernando Perez <fperez@colorado.edu>
3244
3257
3245 * setup.py: Merged setup and setup_windows into a single script
3258 * setup.py: Merged setup and setup_windows into a single script
3246 which properly handles things for windows users.
3259 which properly handles things for windows users.
3247
3260
3248 2002-03-15 Fernando Perez <fperez@colorado.edu>
3261 2002-03-15 Fernando Perez <fperez@colorado.edu>
3249
3262
3250 * Big change to the manual: now the magics are all automatically
3263 * Big change to the manual: now the magics are all automatically
3251 documented. This information is generated from their docstrings
3264 documented. This information is generated from their docstrings
3252 and put in a latex file included by the manual lyx file. This way
3265 and put in a latex file included by the manual lyx file. This way
3253 we get always up to date information for the magics. The manual
3266 we get always up to date information for the magics. The manual
3254 now also has proper version information, also auto-synced.
3267 now also has proper version information, also auto-synced.
3255
3268
3256 For this to work, an undocumented --magic_docstrings option was added.
3269 For this to work, an undocumented --magic_docstrings option was added.
3257
3270
3258 2002-03-13 Fernando Perez <fperez@colorado.edu>
3271 2002-03-13 Fernando Perez <fperez@colorado.edu>
3259
3272
3260 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3273 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3261 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3274 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3262
3275
3263 2002-03-12 Fernando Perez <fperez@colorado.edu>
3276 2002-03-12 Fernando Perez <fperez@colorado.edu>
3264
3277
3265 * IPython/ultraTB.py (TermColors): changed color escapes again to
3278 * IPython/ultraTB.py (TermColors): changed color escapes again to
3266 fix the (old, reintroduced) line-wrapping bug. Basically, if
3279 fix the (old, reintroduced) line-wrapping bug. Basically, if
3267 \001..\002 aren't given in the color escapes, lines get wrapped
3280 \001..\002 aren't given in the color escapes, lines get wrapped
3268 weirdly. But giving those screws up old xterms and emacs terms. So
3281 weirdly. But giving those screws up old xterms and emacs terms. So
3269 I added some logic for emacs terms to be ok, but I can't identify old
3282 I added some logic for emacs terms to be ok, but I can't identify old
3270 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3283 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3271
3284
3272 2002-03-10 Fernando Perez <fperez@colorado.edu>
3285 2002-03-10 Fernando Perez <fperez@colorado.edu>
3273
3286
3274 * IPython/usage.py (__doc__): Various documentation cleanups and
3287 * IPython/usage.py (__doc__): Various documentation cleanups and
3275 updates, both in usage docstrings and in the manual.
3288 updates, both in usage docstrings and in the manual.
3276
3289
3277 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3290 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3278 handling of caching. Set minimum acceptabe value for having a
3291 handling of caching. Set minimum acceptabe value for having a
3279 cache at 20 values.
3292 cache at 20 values.
3280
3293
3281 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3294 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3282 install_first_time function to a method, renamed it and added an
3295 install_first_time function to a method, renamed it and added an
3283 'upgrade' mode. Now people can update their config directory with
3296 'upgrade' mode. Now people can update their config directory with
3284 a simple command line switch (-upgrade, also new).
3297 a simple command line switch (-upgrade, also new).
3285
3298
3286 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3299 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3287 @file (convenient for automagic users under Python >= 2.2).
3300 @file (convenient for automagic users under Python >= 2.2).
3288 Removed @files (it seemed more like a plural than an abbrev. of
3301 Removed @files (it seemed more like a plural than an abbrev. of
3289 'file show').
3302 'file show').
3290
3303
3291 * IPython/iplib.py (install_first_time): Fixed crash if there were
3304 * IPython/iplib.py (install_first_time): Fixed crash if there were
3292 backup files ('~') in .ipython/ install directory.
3305 backup files ('~') in .ipython/ install directory.
3293
3306
3294 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3307 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3295 system. Things look fine, but these changes are fairly
3308 system. Things look fine, but these changes are fairly
3296 intrusive. Test them for a few days.
3309 intrusive. Test them for a few days.
3297
3310
3298 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3311 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3299 the prompts system. Now all in/out prompt strings are user
3312 the prompts system. Now all in/out prompt strings are user
3300 controllable. This is particularly useful for embedding, as one
3313 controllable. This is particularly useful for embedding, as one
3301 can tag embedded instances with particular prompts.
3314 can tag embedded instances with particular prompts.
3302
3315
3303 Also removed global use of sys.ps1/2, which now allows nested
3316 Also removed global use of sys.ps1/2, which now allows nested
3304 embeddings without any problems. Added command-line options for
3317 embeddings without any problems. Added command-line options for
3305 the prompt strings.
3318 the prompt strings.
3306
3319
3307 2002-03-08 Fernando Perez <fperez@colorado.edu>
3320 2002-03-08 Fernando Perez <fperez@colorado.edu>
3308
3321
3309 * IPython/UserConfig/example-embed-short.py (ipshell): added
3322 * IPython/UserConfig/example-embed-short.py (ipshell): added
3310 example file with the bare minimum code for embedding.
3323 example file with the bare minimum code for embedding.
3311
3324
3312 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3325 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3313 functionality for the embeddable shell to be activated/deactivated
3326 functionality for the embeddable shell to be activated/deactivated
3314 either globally or at each call.
3327 either globally or at each call.
3315
3328
3316 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3329 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3317 rewriting the prompt with '--->' for auto-inputs with proper
3330 rewriting the prompt with '--->' for auto-inputs with proper
3318 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3331 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3319 this is handled by the prompts class itself, as it should.
3332 this is handled by the prompts class itself, as it should.
3320
3333
3321 2002-03-05 Fernando Perez <fperez@colorado.edu>
3334 2002-03-05 Fernando Perez <fperez@colorado.edu>
3322
3335
3323 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3336 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3324 @logstart to avoid name clashes with the math log function.
3337 @logstart to avoid name clashes with the math log function.
3325
3338
3326 * Big updates to X/Emacs section of the manual.
3339 * Big updates to X/Emacs section of the manual.
3327
3340
3328 * Removed ipython_emacs. Milan explained to me how to pass
3341 * Removed ipython_emacs. Milan explained to me how to pass
3329 arguments to ipython through Emacs. Some day I'm going to end up
3342 arguments to ipython through Emacs. Some day I'm going to end up
3330 learning some lisp...
3343 learning some lisp...
3331
3344
3332 2002-03-04 Fernando Perez <fperez@colorado.edu>
3345 2002-03-04 Fernando Perez <fperez@colorado.edu>
3333
3346
3334 * IPython/ipython_emacs: Created script to be used as the
3347 * IPython/ipython_emacs: Created script to be used as the
3335 py-python-command Emacs variable so we can pass IPython
3348 py-python-command Emacs variable so we can pass IPython
3336 parameters. I can't figure out how to tell Emacs directly to pass
3349 parameters. I can't figure out how to tell Emacs directly to pass
3337 parameters to IPython, so a dummy shell script will do it.
3350 parameters to IPython, so a dummy shell script will do it.
3338
3351
3339 Other enhancements made for things to work better under Emacs'
3352 Other enhancements made for things to work better under Emacs'
3340 various types of terminals. Many thanks to Milan Zamazal
3353 various types of terminals. Many thanks to Milan Zamazal
3341 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3354 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3342
3355
3343 2002-03-01 Fernando Perez <fperez@colorado.edu>
3356 2002-03-01 Fernando Perez <fperez@colorado.edu>
3344
3357
3345 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3358 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3346 that loading of readline is now optional. This gives better
3359 that loading of readline is now optional. This gives better
3347 control to emacs users.
3360 control to emacs users.
3348
3361
3349 * IPython/ultraTB.py (__date__): Modified color escape sequences
3362 * IPython/ultraTB.py (__date__): Modified color escape sequences
3350 and now things work fine under xterm and in Emacs' term buffers
3363 and now things work fine under xterm and in Emacs' term buffers
3351 (though not shell ones). Well, in emacs you get colors, but all
3364 (though not shell ones). Well, in emacs you get colors, but all
3352 seem to be 'light' colors (no difference between dark and light
3365 seem to be 'light' colors (no difference between dark and light
3353 ones). But the garbage chars are gone, and also in xterms. It
3366 ones). But the garbage chars are gone, and also in xterms. It
3354 seems that now I'm using 'cleaner' ansi sequences.
3367 seems that now I'm using 'cleaner' ansi sequences.
3355
3368
3356 2002-02-21 Fernando Perez <fperez@colorado.edu>
3369 2002-02-21 Fernando Perez <fperez@colorado.edu>
3357
3370
3358 * Released 0.2.7 (mainly to publish the scoping fix).
3371 * Released 0.2.7 (mainly to publish the scoping fix).
3359
3372
3360 * IPython/Logger.py (Logger.logstate): added. A corresponding
3373 * IPython/Logger.py (Logger.logstate): added. A corresponding
3361 @logstate magic was created.
3374 @logstate magic was created.
3362
3375
3363 * IPython/Magic.py: fixed nested scoping problem under Python
3376 * IPython/Magic.py: fixed nested scoping problem under Python
3364 2.1.x (automagic wasn't working).
3377 2.1.x (automagic wasn't working).
3365
3378
3366 2002-02-20 Fernando Perez <fperez@colorado.edu>
3379 2002-02-20 Fernando Perez <fperez@colorado.edu>
3367
3380
3368 * Released 0.2.6.
3381 * Released 0.2.6.
3369
3382
3370 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3383 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3371 option so that logs can come out without any headers at all.
3384 option so that logs can come out without any headers at all.
3372
3385
3373 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3386 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3374 SciPy.
3387 SciPy.
3375
3388
3376 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3389 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3377 that embedded IPython calls don't require vars() to be explicitly
3390 that embedded IPython calls don't require vars() to be explicitly
3378 passed. Now they are extracted from the caller's frame (code
3391 passed. Now they are extracted from the caller's frame (code
3379 snatched from Eric Jones' weave). Added better documentation to
3392 snatched from Eric Jones' weave). Added better documentation to
3380 the section on embedding and the example file.
3393 the section on embedding and the example file.
3381
3394
3382 * IPython/genutils.py (page): Changed so that under emacs, it just
3395 * IPython/genutils.py (page): Changed so that under emacs, it just
3383 prints the string. You can then page up and down in the emacs
3396 prints the string. You can then page up and down in the emacs
3384 buffer itself. This is how the builtin help() works.
3397 buffer itself. This is how the builtin help() works.
3385
3398
3386 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3399 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3387 macro scoping: macros need to be executed in the user's namespace
3400 macro scoping: macros need to be executed in the user's namespace
3388 to work as if they had been typed by the user.
3401 to work as if they had been typed by the user.
3389
3402
3390 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3403 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3391 execute automatically (no need to type 'exec...'). They then
3404 execute automatically (no need to type 'exec...'). They then
3392 behave like 'true macros'. The printing system was also modified
3405 behave like 'true macros'. The printing system was also modified
3393 for this to work.
3406 for this to work.
3394
3407
3395 2002-02-19 Fernando Perez <fperez@colorado.edu>
3408 2002-02-19 Fernando Perez <fperez@colorado.edu>
3396
3409
3397 * IPython/genutils.py (page_file): new function for paging files
3410 * IPython/genutils.py (page_file): new function for paging files
3398 in an OS-independent way. Also necessary for file viewing to work
3411 in an OS-independent way. Also necessary for file viewing to work
3399 well inside Emacs buffers.
3412 well inside Emacs buffers.
3400 (page): Added checks for being in an emacs buffer.
3413 (page): Added checks for being in an emacs buffer.
3401 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3414 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3402 same bug in iplib.
3415 same bug in iplib.
3403
3416
3404 2002-02-18 Fernando Perez <fperez@colorado.edu>
3417 2002-02-18 Fernando Perez <fperez@colorado.edu>
3405
3418
3406 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3419 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3407 of readline so that IPython can work inside an Emacs buffer.
3420 of readline so that IPython can work inside an Emacs buffer.
3408
3421
3409 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3422 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3410 method signatures (they weren't really bugs, but it looks cleaner
3423 method signatures (they weren't really bugs, but it looks cleaner
3411 and keeps PyChecker happy).
3424 and keeps PyChecker happy).
3412
3425
3413 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3426 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3414 for implementing various user-defined hooks. Currently only
3427 for implementing various user-defined hooks. Currently only
3415 display is done.
3428 display is done.
3416
3429
3417 * IPython/Prompts.py (CachedOutput._display): changed display
3430 * IPython/Prompts.py (CachedOutput._display): changed display
3418 functions so that they can be dynamically changed by users easily.
3431 functions so that they can be dynamically changed by users easily.
3419
3432
3420 * IPython/Extensions/numeric_formats.py (num_display): added an
3433 * IPython/Extensions/numeric_formats.py (num_display): added an
3421 extension for printing NumPy arrays in flexible manners. It
3434 extension for printing NumPy arrays in flexible manners. It
3422 doesn't do anything yet, but all the structure is in
3435 doesn't do anything yet, but all the structure is in
3423 place. Ultimately the plan is to implement output format control
3436 place. Ultimately the plan is to implement output format control
3424 like in Octave.
3437 like in Octave.
3425
3438
3426 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3439 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3427 methods are found at run-time by all the automatic machinery.
3440 methods are found at run-time by all the automatic machinery.
3428
3441
3429 2002-02-17 Fernando Perez <fperez@colorado.edu>
3442 2002-02-17 Fernando Perez <fperez@colorado.edu>
3430
3443
3431 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3444 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3432 whole file a little.
3445 whole file a little.
3433
3446
3434 * ToDo: closed this document. Now there's a new_design.lyx
3447 * ToDo: closed this document. Now there's a new_design.lyx
3435 document for all new ideas. Added making a pdf of it for the
3448 document for all new ideas. Added making a pdf of it for the
3436 end-user distro.
3449 end-user distro.
3437
3450
3438 * IPython/Logger.py (Logger.switch_log): Created this to replace
3451 * IPython/Logger.py (Logger.switch_log): Created this to replace
3439 logon() and logoff(). It also fixes a nasty crash reported by
3452 logon() and logoff(). It also fixes a nasty crash reported by
3440 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3453 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3441
3454
3442 * IPython/iplib.py (complete): got auto-completion to work with
3455 * IPython/iplib.py (complete): got auto-completion to work with
3443 automagic (I had wanted this for a long time).
3456 automagic (I had wanted this for a long time).
3444
3457
3445 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3458 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3446 to @file, since file() is now a builtin and clashes with automagic
3459 to @file, since file() is now a builtin and clashes with automagic
3447 for @file.
3460 for @file.
3448
3461
3449 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3462 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3450 of this was previously in iplib, which had grown to more than 2000
3463 of this was previously in iplib, which had grown to more than 2000
3451 lines, way too long. No new functionality, but it makes managing
3464 lines, way too long. No new functionality, but it makes managing
3452 the code a bit easier.
3465 the code a bit easier.
3453
3466
3454 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3467 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3455 information to crash reports.
3468 information to crash reports.
3456
3469
3457 2002-02-12 Fernando Perez <fperez@colorado.edu>
3470 2002-02-12 Fernando Perez <fperez@colorado.edu>
3458
3471
3459 * Released 0.2.5.
3472 * Released 0.2.5.
3460
3473
3461 2002-02-11 Fernando Perez <fperez@colorado.edu>
3474 2002-02-11 Fernando Perez <fperez@colorado.edu>
3462
3475
3463 * Wrote a relatively complete Windows installer. It puts
3476 * Wrote a relatively complete Windows installer. It puts
3464 everything in place, creates Start Menu entries and fixes the
3477 everything in place, creates Start Menu entries and fixes the
3465 color issues. Nothing fancy, but it works.
3478 color issues. Nothing fancy, but it works.
3466
3479
3467 2002-02-10 Fernando Perez <fperez@colorado.edu>
3480 2002-02-10 Fernando Perez <fperez@colorado.edu>
3468
3481
3469 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3482 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3470 os.path.expanduser() call so that we can type @run ~/myfile.py and
3483 os.path.expanduser() call so that we can type @run ~/myfile.py and
3471 have thigs work as expected.
3484 have thigs work as expected.
3472
3485
3473 * IPython/genutils.py (page): fixed exception handling so things
3486 * IPython/genutils.py (page): fixed exception handling so things
3474 work both in Unix and Windows correctly. Quitting a pager triggers
3487 work both in Unix and Windows correctly. Quitting a pager triggers
3475 an IOError/broken pipe in Unix, and in windows not finding a pager
3488 an IOError/broken pipe in Unix, and in windows not finding a pager
3476 is also an IOError, so I had to actually look at the return value
3489 is also an IOError, so I had to actually look at the return value
3477 of the exception, not just the exception itself. Should be ok now.
3490 of the exception, not just the exception itself. Should be ok now.
3478
3491
3479 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3492 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3480 modified to allow case-insensitive color scheme changes.
3493 modified to allow case-insensitive color scheme changes.
3481
3494
3482 2002-02-09 Fernando Perez <fperez@colorado.edu>
3495 2002-02-09 Fernando Perez <fperez@colorado.edu>
3483
3496
3484 * IPython/genutils.py (native_line_ends): new function to leave
3497 * IPython/genutils.py (native_line_ends): new function to leave
3485 user config files with os-native line-endings.
3498 user config files with os-native line-endings.
3486
3499
3487 * README and manual updates.
3500 * README and manual updates.
3488
3501
3489 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3502 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3490 instead of StringType to catch Unicode strings.
3503 instead of StringType to catch Unicode strings.
3491
3504
3492 * IPython/genutils.py (filefind): fixed bug for paths with
3505 * IPython/genutils.py (filefind): fixed bug for paths with
3493 embedded spaces (very common in Windows).
3506 embedded spaces (very common in Windows).
3494
3507
3495 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3508 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3496 files under Windows, so that they get automatically associated
3509 files under Windows, so that they get automatically associated
3497 with a text editor. Windows makes it a pain to handle
3510 with a text editor. Windows makes it a pain to handle
3498 extension-less files.
3511 extension-less files.
3499
3512
3500 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3513 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3501 warning about readline only occur for Posix. In Windows there's no
3514 warning about readline only occur for Posix. In Windows there's no
3502 way to get readline, so why bother with the warning.
3515 way to get readline, so why bother with the warning.
3503
3516
3504 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3517 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3505 for __str__ instead of dir(self), since dir() changed in 2.2.
3518 for __str__ instead of dir(self), since dir() changed in 2.2.
3506
3519
3507 * Ported to Windows! Tested on XP, I suspect it should work fine
3520 * Ported to Windows! Tested on XP, I suspect it should work fine
3508 on NT/2000, but I don't think it will work on 98 et al. That
3521 on NT/2000, but I don't think it will work on 98 et al. That
3509 series of Windows is such a piece of junk anyway that I won't try
3522 series of Windows is such a piece of junk anyway that I won't try
3510 porting it there. The XP port was straightforward, showed a few
3523 porting it there. The XP port was straightforward, showed a few
3511 bugs here and there (fixed all), in particular some string
3524 bugs here and there (fixed all), in particular some string
3512 handling stuff which required considering Unicode strings (which
3525 handling stuff which required considering Unicode strings (which
3513 Windows uses). This is good, but hasn't been too tested :) No
3526 Windows uses). This is good, but hasn't been too tested :) No
3514 fancy installer yet, I'll put a note in the manual so people at
3527 fancy installer yet, I'll put a note in the manual so people at
3515 least make manually a shortcut.
3528 least make manually a shortcut.
3516
3529
3517 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3530 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3518 into a single one, "colors". This now controls both prompt and
3531 into a single one, "colors". This now controls both prompt and
3519 exception color schemes, and can be changed both at startup
3532 exception color schemes, and can be changed both at startup
3520 (either via command-line switches or via ipythonrc files) and at
3533 (either via command-line switches or via ipythonrc files) and at
3521 runtime, with @colors.
3534 runtime, with @colors.
3522 (Magic.magic_run): renamed @prun to @run and removed the old
3535 (Magic.magic_run): renamed @prun to @run and removed the old
3523 @run. The two were too similar to warrant keeping both.
3536 @run. The two were too similar to warrant keeping both.
3524
3537
3525 2002-02-03 Fernando Perez <fperez@colorado.edu>
3538 2002-02-03 Fernando Perez <fperez@colorado.edu>
3526
3539
3527 * IPython/iplib.py (install_first_time): Added comment on how to
3540 * IPython/iplib.py (install_first_time): Added comment on how to
3528 configure the color options for first-time users. Put a <return>
3541 configure the color options for first-time users. Put a <return>
3529 request at the end so that small-terminal users get a chance to
3542 request at the end so that small-terminal users get a chance to
3530 read the startup info.
3543 read the startup info.
3531
3544
3532 2002-01-23 Fernando Perez <fperez@colorado.edu>
3545 2002-01-23 Fernando Perez <fperez@colorado.edu>
3533
3546
3534 * IPython/iplib.py (CachedOutput.update): Changed output memory
3547 * IPython/iplib.py (CachedOutput.update): Changed output memory
3535 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3548 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3536 input history we still use _i. Did this b/c these variable are
3549 input history we still use _i. Did this b/c these variable are
3537 very commonly used in interactive work, so the less we need to
3550 very commonly used in interactive work, so the less we need to
3538 type the better off we are.
3551 type the better off we are.
3539 (Magic.magic_prun): updated @prun to better handle the namespaces
3552 (Magic.magic_prun): updated @prun to better handle the namespaces
3540 the file will run in, including a fix for __name__ not being set
3553 the file will run in, including a fix for __name__ not being set
3541 before.
3554 before.
3542
3555
3543 2002-01-20 Fernando Perez <fperez@colorado.edu>
3556 2002-01-20 Fernando Perez <fperez@colorado.edu>
3544
3557
3545 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3558 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3546 extra garbage for Python 2.2. Need to look more carefully into
3559 extra garbage for Python 2.2. Need to look more carefully into
3547 this later.
3560 this later.
3548
3561
3549 2002-01-19 Fernando Perez <fperez@colorado.edu>
3562 2002-01-19 Fernando Perez <fperez@colorado.edu>
3550
3563
3551 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3564 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3552 display SyntaxError exceptions properly formatted when they occur
3565 display SyntaxError exceptions properly formatted when they occur
3553 (they can be triggered by imported code).
3566 (they can be triggered by imported code).
3554
3567
3555 2002-01-18 Fernando Perez <fperez@colorado.edu>
3568 2002-01-18 Fernando Perez <fperez@colorado.edu>
3556
3569
3557 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3570 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3558 SyntaxError exceptions are reported nicely formatted, instead of
3571 SyntaxError exceptions are reported nicely formatted, instead of
3559 spitting out only offset information as before.
3572 spitting out only offset information as before.
3560 (Magic.magic_prun): Added the @prun function for executing
3573 (Magic.magic_prun): Added the @prun function for executing
3561 programs with command line args inside IPython.
3574 programs with command line args inside IPython.
3562
3575
3563 2002-01-16 Fernando Perez <fperez@colorado.edu>
3576 2002-01-16 Fernando Perez <fperez@colorado.edu>
3564
3577
3565 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3578 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3566 to *not* include the last item given in a range. This brings their
3579 to *not* include the last item given in a range. This brings their
3567 behavior in line with Python's slicing:
3580 behavior in line with Python's slicing:
3568 a[n1:n2] -> a[n1]...a[n2-1]
3581 a[n1:n2] -> a[n1]...a[n2-1]
3569 It may be a bit less convenient, but I prefer to stick to Python's
3582 It may be a bit less convenient, but I prefer to stick to Python's
3570 conventions *everywhere*, so users never have to wonder.
3583 conventions *everywhere*, so users never have to wonder.
3571 (Magic.magic_macro): Added @macro function to ease the creation of
3584 (Magic.magic_macro): Added @macro function to ease the creation of
3572 macros.
3585 macros.
3573
3586
3574 2002-01-05 Fernando Perez <fperez@colorado.edu>
3587 2002-01-05 Fernando Perez <fperez@colorado.edu>
3575
3588
3576 * Released 0.2.4.
3589 * Released 0.2.4.
3577
3590
3578 * IPython/iplib.py (Magic.magic_pdef):
3591 * IPython/iplib.py (Magic.magic_pdef):
3579 (InteractiveShell.safe_execfile): report magic lines and error
3592 (InteractiveShell.safe_execfile): report magic lines and error
3580 lines without line numbers so one can easily copy/paste them for
3593 lines without line numbers so one can easily copy/paste them for
3581 re-execution.
3594 re-execution.
3582
3595
3583 * Updated manual with recent changes.
3596 * Updated manual with recent changes.
3584
3597
3585 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3598 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3586 docstring printing when class? is called. Very handy for knowing
3599 docstring printing when class? is called. Very handy for knowing
3587 how to create class instances (as long as __init__ is well
3600 how to create class instances (as long as __init__ is well
3588 documented, of course :)
3601 documented, of course :)
3589 (Magic.magic_doc): print both class and constructor docstrings.
3602 (Magic.magic_doc): print both class and constructor docstrings.
3590 (Magic.magic_pdef): give constructor info if passed a class and
3603 (Magic.magic_pdef): give constructor info if passed a class and
3591 __call__ info for callable object instances.
3604 __call__ info for callable object instances.
3592
3605
3593 2002-01-04 Fernando Perez <fperez@colorado.edu>
3606 2002-01-04 Fernando Perez <fperez@colorado.edu>
3594
3607
3595 * Made deep_reload() off by default. It doesn't always work
3608 * Made deep_reload() off by default. It doesn't always work
3596 exactly as intended, so it's probably safer to have it off. It's
3609 exactly as intended, so it's probably safer to have it off. It's
3597 still available as dreload() anyway, so nothing is lost.
3610 still available as dreload() anyway, so nothing is lost.
3598
3611
3599 2002-01-02 Fernando Perez <fperez@colorado.edu>
3612 2002-01-02 Fernando Perez <fperez@colorado.edu>
3600
3613
3601 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3614 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3602 so I wanted an updated release).
3615 so I wanted an updated release).
3603
3616
3604 2001-12-27 Fernando Perez <fperez@colorado.edu>
3617 2001-12-27 Fernando Perez <fperez@colorado.edu>
3605
3618
3606 * IPython/iplib.py (InteractiveShell.interact): Added the original
3619 * IPython/iplib.py (InteractiveShell.interact): Added the original
3607 code from 'code.py' for this module in order to change the
3620 code from 'code.py' for this module in order to change the
3608 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3621 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3609 the history cache would break when the user hit Ctrl-C, and
3622 the history cache would break when the user hit Ctrl-C, and
3610 interact() offers no way to add any hooks to it.
3623 interact() offers no way to add any hooks to it.
3611
3624
3612 2001-12-23 Fernando Perez <fperez@colorado.edu>
3625 2001-12-23 Fernando Perez <fperez@colorado.edu>
3613
3626
3614 * setup.py: added check for 'MANIFEST' before trying to remove
3627 * setup.py: added check for 'MANIFEST' before trying to remove
3615 it. Thanks to Sean Reifschneider.
3628 it. Thanks to Sean Reifschneider.
3616
3629
3617 2001-12-22 Fernando Perez <fperez@colorado.edu>
3630 2001-12-22 Fernando Perez <fperez@colorado.edu>
3618
3631
3619 * Released 0.2.2.
3632 * Released 0.2.2.
3620
3633
3621 * Finished (reasonably) writing the manual. Later will add the
3634 * Finished (reasonably) writing the manual. Later will add the
3622 python-standard navigation stylesheets, but for the time being
3635 python-standard navigation stylesheets, but for the time being
3623 it's fairly complete. Distribution will include html and pdf
3636 it's fairly complete. Distribution will include html and pdf
3624 versions.
3637 versions.
3625
3638
3626 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3639 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3627 (MayaVi author).
3640 (MayaVi author).
3628
3641
3629 2001-12-21 Fernando Perez <fperez@colorado.edu>
3642 2001-12-21 Fernando Perez <fperez@colorado.edu>
3630
3643
3631 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3644 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3632 good public release, I think (with the manual and the distutils
3645 good public release, I think (with the manual and the distutils
3633 installer). The manual can use some work, but that can go
3646 installer). The manual can use some work, but that can go
3634 slowly. Otherwise I think it's quite nice for end users. Next
3647 slowly. Otherwise I think it's quite nice for end users. Next
3635 summer, rewrite the guts of it...
3648 summer, rewrite the guts of it...
3636
3649
3637 * Changed format of ipythonrc files to use whitespace as the
3650 * Changed format of ipythonrc files to use whitespace as the
3638 separator instead of an explicit '='. Cleaner.
3651 separator instead of an explicit '='. Cleaner.
3639
3652
3640 2001-12-20 Fernando Perez <fperez@colorado.edu>
3653 2001-12-20 Fernando Perez <fperez@colorado.edu>
3641
3654
3642 * Started a manual in LyX. For now it's just a quick merge of the
3655 * Started a manual in LyX. For now it's just a quick merge of the
3643 various internal docstrings and READMEs. Later it may grow into a
3656 various internal docstrings and READMEs. Later it may grow into a
3644 nice, full-blown manual.
3657 nice, full-blown manual.
3645
3658
3646 * Set up a distutils based installer. Installation should now be
3659 * Set up a distutils based installer. Installation should now be
3647 trivially simple for end-users.
3660 trivially simple for end-users.
3648
3661
3649 2001-12-11 Fernando Perez <fperez@colorado.edu>
3662 2001-12-11 Fernando Perez <fperez@colorado.edu>
3650
3663
3651 * Released 0.2.0. First public release, announced it at
3664 * Released 0.2.0. First public release, announced it at
3652 comp.lang.python. From now on, just bugfixes...
3665 comp.lang.python. From now on, just bugfixes...
3653
3666
3654 * Went through all the files, set copyright/license notices and
3667 * Went through all the files, set copyright/license notices and
3655 cleaned up things. Ready for release.
3668 cleaned up things. Ready for release.
3656
3669
3657 2001-12-10 Fernando Perez <fperez@colorado.edu>
3670 2001-12-10 Fernando Perez <fperez@colorado.edu>
3658
3671
3659 * Changed the first-time installer not to use tarfiles. It's more
3672 * Changed the first-time installer not to use tarfiles. It's more
3660 robust now and less unix-dependent. Also makes it easier for
3673 robust now and less unix-dependent. Also makes it easier for
3661 people to later upgrade versions.
3674 people to later upgrade versions.
3662
3675
3663 * Changed @exit to @abort to reflect the fact that it's pretty
3676 * Changed @exit to @abort to reflect the fact that it's pretty
3664 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3677 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3665 becomes significant only when IPyhton is embedded: in that case,
3678 becomes significant only when IPyhton is embedded: in that case,
3666 C-D closes IPython only, but @abort kills the enclosing program
3679 C-D closes IPython only, but @abort kills the enclosing program
3667 too (unless it had called IPython inside a try catching
3680 too (unless it had called IPython inside a try catching
3668 SystemExit).
3681 SystemExit).
3669
3682
3670 * Created Shell module which exposes the actuall IPython Shell
3683 * Created Shell module which exposes the actuall IPython Shell
3671 classes, currently the normal and the embeddable one. This at
3684 classes, currently the normal and the embeddable one. This at
3672 least offers a stable interface we won't need to change when
3685 least offers a stable interface we won't need to change when
3673 (later) the internals are rewritten. That rewrite will be confined
3686 (later) the internals are rewritten. That rewrite will be confined
3674 to iplib and ipmaker, but the Shell interface should remain as is.
3687 to iplib and ipmaker, but the Shell interface should remain as is.
3675
3688
3676 * Added embed module which offers an embeddable IPShell object,
3689 * Added embed module which offers an embeddable IPShell object,
3677 useful to fire up IPython *inside* a running program. Great for
3690 useful to fire up IPython *inside* a running program. Great for
3678 debugging or dynamical data analysis.
3691 debugging or dynamical data analysis.
3679
3692
3680 2001-12-08 Fernando Perez <fperez@colorado.edu>
3693 2001-12-08 Fernando Perez <fperez@colorado.edu>
3681
3694
3682 * Fixed small bug preventing seeing info from methods of defined
3695 * Fixed small bug preventing seeing info from methods of defined
3683 objects (incorrect namespace in _ofind()).
3696 objects (incorrect namespace in _ofind()).
3684
3697
3685 * Documentation cleanup. Moved the main usage docstrings to a
3698 * Documentation cleanup. Moved the main usage docstrings to a
3686 separate file, usage.py (cleaner to maintain, and hopefully in the
3699 separate file, usage.py (cleaner to maintain, and hopefully in the
3687 future some perlpod-like way of producing interactive, man and
3700 future some perlpod-like way of producing interactive, man and
3688 html docs out of it will be found).
3701 html docs out of it will be found).
3689
3702
3690 * Added @profile to see your profile at any time.
3703 * Added @profile to see your profile at any time.
3691
3704
3692 * Added @p as an alias for 'print'. It's especially convenient if
3705 * Added @p as an alias for 'print'. It's especially convenient if
3693 using automagic ('p x' prints x).
3706 using automagic ('p x' prints x).
3694
3707
3695 * Small cleanups and fixes after a pychecker run.
3708 * Small cleanups and fixes after a pychecker run.
3696
3709
3697 * Changed the @cd command to handle @cd - and @cd -<n> for
3710 * Changed the @cd command to handle @cd - and @cd -<n> for
3698 visiting any directory in _dh.
3711 visiting any directory in _dh.
3699
3712
3700 * Introduced _dh, a history of visited directories. @dhist prints
3713 * Introduced _dh, a history of visited directories. @dhist prints
3701 it out with numbers.
3714 it out with numbers.
3702
3715
3703 2001-12-07 Fernando Perez <fperez@colorado.edu>
3716 2001-12-07 Fernando Perez <fperez@colorado.edu>
3704
3717
3705 * Released 0.1.22
3718 * Released 0.1.22
3706
3719
3707 * Made initialization a bit more robust against invalid color
3720 * Made initialization a bit more robust against invalid color
3708 options in user input (exit, not traceback-crash).
3721 options in user input (exit, not traceback-crash).
3709
3722
3710 * Changed the bug crash reporter to write the report only in the
3723 * Changed the bug crash reporter to write the report only in the
3711 user's .ipython directory. That way IPython won't litter people's
3724 user's .ipython directory. That way IPython won't litter people's
3712 hard disks with crash files all over the place. Also print on
3725 hard disks with crash files all over the place. Also print on
3713 screen the necessary mail command.
3726 screen the necessary mail command.
3714
3727
3715 * With the new ultraTB, implemented LightBG color scheme for light
3728 * With the new ultraTB, implemented LightBG color scheme for light
3716 background terminals. A lot of people like white backgrounds, so I
3729 background terminals. A lot of people like white backgrounds, so I
3717 guess we should at least give them something readable.
3730 guess we should at least give them something readable.
3718
3731
3719 2001-12-06 Fernando Perez <fperez@colorado.edu>
3732 2001-12-06 Fernando Perez <fperez@colorado.edu>
3720
3733
3721 * Modified the structure of ultraTB. Now there's a proper class
3734 * Modified the structure of ultraTB. Now there's a proper class
3722 for tables of color schemes which allow adding schemes easily and
3735 for tables of color schemes which allow adding schemes easily and
3723 switching the active scheme without creating a new instance every
3736 switching the active scheme without creating a new instance every
3724 time (which was ridiculous). The syntax for creating new schemes
3737 time (which was ridiculous). The syntax for creating new schemes
3725 is also cleaner. I think ultraTB is finally done, with a clean
3738 is also cleaner. I think ultraTB is finally done, with a clean
3726 class structure. Names are also much cleaner (now there's proper
3739 class structure. Names are also much cleaner (now there's proper
3727 color tables, no need for every variable to also have 'color' in
3740 color tables, no need for every variable to also have 'color' in
3728 its name).
3741 its name).
3729
3742
3730 * Broke down genutils into separate files. Now genutils only
3743 * Broke down genutils into separate files. Now genutils only
3731 contains utility functions, and classes have been moved to their
3744 contains utility functions, and classes have been moved to their
3732 own files (they had enough independent functionality to warrant
3745 own files (they had enough independent functionality to warrant
3733 it): ConfigLoader, OutputTrap, Struct.
3746 it): ConfigLoader, OutputTrap, Struct.
3734
3747
3735 2001-12-05 Fernando Perez <fperez@colorado.edu>
3748 2001-12-05 Fernando Perez <fperez@colorado.edu>
3736
3749
3737 * IPython turns 21! Released version 0.1.21, as a candidate for
3750 * IPython turns 21! Released version 0.1.21, as a candidate for
3738 public consumption. If all goes well, release in a few days.
3751 public consumption. If all goes well, release in a few days.
3739
3752
3740 * Fixed path bug (files in Extensions/ directory wouldn't be found
3753 * Fixed path bug (files in Extensions/ directory wouldn't be found
3741 unless IPython/ was explicitly in sys.path).
3754 unless IPython/ was explicitly in sys.path).
3742
3755
3743 * Extended the FlexCompleter class as MagicCompleter to allow
3756 * Extended the FlexCompleter class as MagicCompleter to allow
3744 completion of @-starting lines.
3757 completion of @-starting lines.
3745
3758
3746 * Created __release__.py file as a central repository for release
3759 * Created __release__.py file as a central repository for release
3747 info that other files can read from.
3760 info that other files can read from.
3748
3761
3749 * Fixed small bug in logging: when logging was turned on in
3762 * Fixed small bug in logging: when logging was turned on in
3750 mid-session, old lines with special meanings (!@?) were being
3763 mid-session, old lines with special meanings (!@?) were being
3751 logged without the prepended comment, which is necessary since
3764 logged without the prepended comment, which is necessary since
3752 they are not truly valid python syntax. This should make session
3765 they are not truly valid python syntax. This should make session
3753 restores produce less errors.
3766 restores produce less errors.
3754
3767
3755 * The namespace cleanup forced me to make a FlexCompleter class
3768 * The namespace cleanup forced me to make a FlexCompleter class
3756 which is nothing but a ripoff of rlcompleter, but with selectable
3769 which is nothing but a ripoff of rlcompleter, but with selectable
3757 namespace (rlcompleter only works in __main__.__dict__). I'll try
3770 namespace (rlcompleter only works in __main__.__dict__). I'll try
3758 to submit a note to the authors to see if this change can be
3771 to submit a note to the authors to see if this change can be
3759 incorporated in future rlcompleter releases (Dec.6: done)
3772 incorporated in future rlcompleter releases (Dec.6: done)
3760
3773
3761 * More fixes to namespace handling. It was a mess! Now all
3774 * More fixes to namespace handling. It was a mess! Now all
3762 explicit references to __main__.__dict__ are gone (except when
3775 explicit references to __main__.__dict__ are gone (except when
3763 really needed) and everything is handled through the namespace
3776 really needed) and everything is handled through the namespace
3764 dicts in the IPython instance. We seem to be getting somewhere
3777 dicts in the IPython instance. We seem to be getting somewhere
3765 with this, finally...
3778 with this, finally...
3766
3779
3767 * Small documentation updates.
3780 * Small documentation updates.
3768
3781
3769 * Created the Extensions directory under IPython (with an
3782 * Created the Extensions directory under IPython (with an
3770 __init__.py). Put the PhysicalQ stuff there. This directory should
3783 __init__.py). Put the PhysicalQ stuff there. This directory should
3771 be used for all special-purpose extensions.
3784 be used for all special-purpose extensions.
3772
3785
3773 * File renaming:
3786 * File renaming:
3774 ipythonlib --> ipmaker
3787 ipythonlib --> ipmaker
3775 ipplib --> iplib
3788 ipplib --> iplib
3776 This makes a bit more sense in terms of what these files actually do.
3789 This makes a bit more sense in terms of what these files actually do.
3777
3790
3778 * Moved all the classes and functions in ipythonlib to ipplib, so
3791 * Moved all the classes and functions in ipythonlib to ipplib, so
3779 now ipythonlib only has make_IPython(). This will ease up its
3792 now ipythonlib only has make_IPython(). This will ease up its
3780 splitting in smaller functional chunks later.
3793 splitting in smaller functional chunks later.
3781
3794
3782 * Cleaned up (done, I think) output of @whos. Better column
3795 * Cleaned up (done, I think) output of @whos. Better column
3783 formatting, and now shows str(var) for as much as it can, which is
3796 formatting, and now shows str(var) for as much as it can, which is
3784 typically what one gets with a 'print var'.
3797 typically what one gets with a 'print var'.
3785
3798
3786 2001-12-04 Fernando Perez <fperez@colorado.edu>
3799 2001-12-04 Fernando Perez <fperez@colorado.edu>
3787
3800
3788 * Fixed namespace problems. Now builtin/IPyhton/user names get
3801 * Fixed namespace problems. Now builtin/IPyhton/user names get
3789 properly reported in their namespace. Internal namespace handling
3802 properly reported in their namespace. Internal namespace handling
3790 is finally getting decent (not perfect yet, but much better than
3803 is finally getting decent (not perfect yet, but much better than
3791 the ad-hoc mess we had).
3804 the ad-hoc mess we had).
3792
3805
3793 * Removed -exit option. If people just want to run a python
3806 * Removed -exit option. If people just want to run a python
3794 script, that's what the normal interpreter is for. Less
3807 script, that's what the normal interpreter is for. Less
3795 unnecessary options, less chances for bugs.
3808 unnecessary options, less chances for bugs.
3796
3809
3797 * Added a crash handler which generates a complete post-mortem if
3810 * Added a crash handler which generates a complete post-mortem if
3798 IPython crashes. This will help a lot in tracking bugs down the
3811 IPython crashes. This will help a lot in tracking bugs down the
3799 road.
3812 road.
3800
3813
3801 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3814 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3802 which were boud to functions being reassigned would bypass the
3815 which were boud to functions being reassigned would bypass the
3803 logger, breaking the sync of _il with the prompt counter. This
3816 logger, breaking the sync of _il with the prompt counter. This
3804 would then crash IPython later when a new line was logged.
3817 would then crash IPython later when a new line was logged.
3805
3818
3806 2001-12-02 Fernando Perez <fperez@colorado.edu>
3819 2001-12-02 Fernando Perez <fperez@colorado.edu>
3807
3820
3808 * Made IPython a package. This means people don't have to clutter
3821 * Made IPython a package. This means people don't have to clutter
3809 their sys.path with yet another directory. Changed the INSTALL
3822 their sys.path with yet another directory. Changed the INSTALL
3810 file accordingly.
3823 file accordingly.
3811
3824
3812 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3825 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3813 sorts its output (so @who shows it sorted) and @whos formats the
3826 sorts its output (so @who shows it sorted) and @whos formats the
3814 table according to the width of the first column. Nicer, easier to
3827 table according to the width of the first column. Nicer, easier to
3815 read. Todo: write a generic table_format() which takes a list of
3828 read. Todo: write a generic table_format() which takes a list of
3816 lists and prints it nicely formatted, with optional row/column
3829 lists and prints it nicely formatted, with optional row/column
3817 separators and proper padding and justification.
3830 separators and proper padding and justification.
3818
3831
3819 * Released 0.1.20
3832 * Released 0.1.20
3820
3833
3821 * Fixed bug in @log which would reverse the inputcache list (a
3834 * Fixed bug in @log which would reverse the inputcache list (a
3822 copy operation was missing).
3835 copy operation was missing).
3823
3836
3824 * Code cleanup. @config was changed to use page(). Better, since
3837 * Code cleanup. @config was changed to use page(). Better, since
3825 its output is always quite long.
3838 its output is always quite long.
3826
3839
3827 * Itpl is back as a dependency. I was having too many problems
3840 * Itpl is back as a dependency. I was having too many problems
3828 getting the parametric aliases to work reliably, and it's just
3841 getting the parametric aliases to work reliably, and it's just
3829 easier to code weird string operations with it than playing %()s
3842 easier to code weird string operations with it than playing %()s
3830 games. It's only ~6k, so I don't think it's too big a deal.
3843 games. It's only ~6k, so I don't think it's too big a deal.
3831
3844
3832 * Found (and fixed) a very nasty bug with history. !lines weren't
3845 * Found (and fixed) a very nasty bug with history. !lines weren't
3833 getting cached, and the out of sync caches would crash
3846 getting cached, and the out of sync caches would crash
3834 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3847 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3835 division of labor a bit better. Bug fixed, cleaner structure.
3848 division of labor a bit better. Bug fixed, cleaner structure.
3836
3849
3837 2001-12-01 Fernando Perez <fperez@colorado.edu>
3850 2001-12-01 Fernando Perez <fperez@colorado.edu>
3838
3851
3839 * Released 0.1.19
3852 * Released 0.1.19
3840
3853
3841 * Added option -n to @hist to prevent line number printing. Much
3854 * Added option -n to @hist to prevent line number printing. Much
3842 easier to copy/paste code this way.
3855 easier to copy/paste code this way.
3843
3856
3844 * Created global _il to hold the input list. Allows easy
3857 * Created global _il to hold the input list. Allows easy
3845 re-execution of blocks of code by slicing it (inspired by Janko's
3858 re-execution of blocks of code by slicing it (inspired by Janko's
3846 comment on 'macros').
3859 comment on 'macros').
3847
3860
3848 * Small fixes and doc updates.
3861 * Small fixes and doc updates.
3849
3862
3850 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3863 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3851 much too fragile with automagic. Handles properly multi-line
3864 much too fragile with automagic. Handles properly multi-line
3852 statements and takes parameters.
3865 statements and takes parameters.
3853
3866
3854 2001-11-30 Fernando Perez <fperez@colorado.edu>
3867 2001-11-30 Fernando Perez <fperez@colorado.edu>
3855
3868
3856 * Version 0.1.18 released.
3869 * Version 0.1.18 released.
3857
3870
3858 * Fixed nasty namespace bug in initial module imports.
3871 * Fixed nasty namespace bug in initial module imports.
3859
3872
3860 * Added copyright/license notes to all code files (except
3873 * Added copyright/license notes to all code files (except
3861 DPyGetOpt). For the time being, LGPL. That could change.
3874 DPyGetOpt). For the time being, LGPL. That could change.
3862
3875
3863 * Rewrote a much nicer README, updated INSTALL, cleaned up
3876 * Rewrote a much nicer README, updated INSTALL, cleaned up
3864 ipythonrc-* samples.
3877 ipythonrc-* samples.
3865
3878
3866 * Overall code/documentation cleanup. Basically ready for
3879 * Overall code/documentation cleanup. Basically ready for
3867 release. Only remaining thing: licence decision (LGPL?).
3880 release. Only remaining thing: licence decision (LGPL?).
3868
3881
3869 * Converted load_config to a class, ConfigLoader. Now recursion
3882 * Converted load_config to a class, ConfigLoader. Now recursion
3870 control is better organized. Doesn't include the same file twice.
3883 control is better organized. Doesn't include the same file twice.
3871
3884
3872 2001-11-29 Fernando Perez <fperez@colorado.edu>
3885 2001-11-29 Fernando Perez <fperez@colorado.edu>
3873
3886
3874 * Got input history working. Changed output history variables from
3887 * Got input history working. Changed output history variables from
3875 _p to _o so that _i is for input and _o for output. Just cleaner
3888 _p to _o so that _i is for input and _o for output. Just cleaner
3876 convention.
3889 convention.
3877
3890
3878 * Implemented parametric aliases. This pretty much allows the
3891 * Implemented parametric aliases. This pretty much allows the
3879 alias system to offer full-blown shell convenience, I think.
3892 alias system to offer full-blown shell convenience, I think.
3880
3893
3881 * Version 0.1.17 released, 0.1.18 opened.
3894 * Version 0.1.17 released, 0.1.18 opened.
3882
3895
3883 * dot_ipython/ipythonrc (alias): added documentation.
3896 * dot_ipython/ipythonrc (alias): added documentation.
3884 (xcolor): Fixed small bug (xcolors -> xcolor)
3897 (xcolor): Fixed small bug (xcolors -> xcolor)
3885
3898
3886 * Changed the alias system. Now alias is a magic command to define
3899 * Changed the alias system. Now alias is a magic command to define
3887 aliases just like the shell. Rationale: the builtin magics should
3900 aliases just like the shell. Rationale: the builtin magics should
3888 be there for things deeply connected to IPython's
3901 be there for things deeply connected to IPython's
3889 architecture. And this is a much lighter system for what I think
3902 architecture. And this is a much lighter system for what I think
3890 is the really important feature: allowing users to define quickly
3903 is the really important feature: allowing users to define quickly
3891 magics that will do shell things for them, so they can customize
3904 magics that will do shell things for them, so they can customize
3892 IPython easily to match their work habits. If someone is really
3905 IPython easily to match their work habits. If someone is really
3893 desperate to have another name for a builtin alias, they can
3906 desperate to have another name for a builtin alias, they can
3894 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3907 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3895 works.
3908 works.
3896
3909
3897 2001-11-28 Fernando Perez <fperez@colorado.edu>
3910 2001-11-28 Fernando Perez <fperez@colorado.edu>
3898
3911
3899 * Changed @file so that it opens the source file at the proper
3912 * Changed @file so that it opens the source file at the proper
3900 line. Since it uses less, if your EDITOR environment is
3913 line. Since it uses less, if your EDITOR environment is
3901 configured, typing v will immediately open your editor of choice
3914 configured, typing v will immediately open your editor of choice
3902 right at the line where the object is defined. Not as quick as
3915 right at the line where the object is defined. Not as quick as
3903 having a direct @edit command, but for all intents and purposes it
3916 having a direct @edit command, but for all intents and purposes it
3904 works. And I don't have to worry about writing @edit to deal with
3917 works. And I don't have to worry about writing @edit to deal with
3905 all the editors, less does that.
3918 all the editors, less does that.
3906
3919
3907 * Version 0.1.16 released, 0.1.17 opened.
3920 * Version 0.1.16 released, 0.1.17 opened.
3908
3921
3909 * Fixed some nasty bugs in the page/page_dumb combo that could
3922 * Fixed some nasty bugs in the page/page_dumb combo that could
3910 crash IPython.
3923 crash IPython.
3911
3924
3912 2001-11-27 Fernando Perez <fperez@colorado.edu>
3925 2001-11-27 Fernando Perez <fperez@colorado.edu>
3913
3926
3914 * Version 0.1.15 released, 0.1.16 opened.
3927 * Version 0.1.15 released, 0.1.16 opened.
3915
3928
3916 * Finally got ? and ?? to work for undefined things: now it's
3929 * Finally got ? and ?? to work for undefined things: now it's
3917 possible to type {}.get? and get information about the get method
3930 possible to type {}.get? and get information about the get method
3918 of dicts, or os.path? even if only os is defined (so technically
3931 of dicts, or os.path? even if only os is defined (so technically
3919 os.path isn't). Works at any level. For example, after import os,
3932 os.path isn't). Works at any level. For example, after import os,
3920 os?, os.path?, os.path.abspath? all work. This is great, took some
3933 os?, os.path?, os.path.abspath? all work. This is great, took some
3921 work in _ofind.
3934 work in _ofind.
3922
3935
3923 * Fixed more bugs with logging. The sanest way to do it was to add
3936 * Fixed more bugs with logging. The sanest way to do it was to add
3924 to @log a 'mode' parameter. Killed two in one shot (this mode
3937 to @log a 'mode' parameter. Killed two in one shot (this mode
3925 option was a request of Janko's). I think it's finally clean
3938 option was a request of Janko's). I think it's finally clean
3926 (famous last words).
3939 (famous last words).
3927
3940
3928 * Added a page_dumb() pager which does a decent job of paging on
3941 * Added a page_dumb() pager which does a decent job of paging on
3929 screen, if better things (like less) aren't available. One less
3942 screen, if better things (like less) aren't available. One less
3930 unix dependency (someday maybe somebody will port this to
3943 unix dependency (someday maybe somebody will port this to
3931 windows).
3944 windows).
3932
3945
3933 * Fixed problem in magic_log: would lock of logging out if log
3946 * Fixed problem in magic_log: would lock of logging out if log
3934 creation failed (because it would still think it had succeeded).
3947 creation failed (because it would still think it had succeeded).
3935
3948
3936 * Improved the page() function using curses to auto-detect screen
3949 * Improved the page() function using curses to auto-detect screen
3937 size. Now it can make a much better decision on whether to print
3950 size. Now it can make a much better decision on whether to print
3938 or page a string. Option screen_length was modified: a value 0
3951 or page a string. Option screen_length was modified: a value 0
3939 means auto-detect, and that's the default now.
3952 means auto-detect, and that's the default now.
3940
3953
3941 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3954 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3942 go out. I'll test it for a few days, then talk to Janko about
3955 go out. I'll test it for a few days, then talk to Janko about
3943 licences and announce it.
3956 licences and announce it.
3944
3957
3945 * Fixed the length of the auto-generated ---> prompt which appears
3958 * Fixed the length of the auto-generated ---> prompt which appears
3946 for auto-parens and auto-quotes. Getting this right isn't trivial,
3959 for auto-parens and auto-quotes. Getting this right isn't trivial,
3947 with all the color escapes, different prompt types and optional
3960 with all the color escapes, different prompt types and optional
3948 separators. But it seems to be working in all the combinations.
3961 separators. But it seems to be working in all the combinations.
3949
3962
3950 2001-11-26 Fernando Perez <fperez@colorado.edu>
3963 2001-11-26 Fernando Perez <fperez@colorado.edu>
3951
3964
3952 * Wrote a regexp filter to get option types from the option names
3965 * Wrote a regexp filter to get option types from the option names
3953 string. This eliminates the need to manually keep two duplicate
3966 string. This eliminates the need to manually keep two duplicate
3954 lists.
3967 lists.
3955
3968
3956 * Removed the unneeded check_option_names. Now options are handled
3969 * Removed the unneeded check_option_names. Now options are handled
3957 in a much saner manner and it's easy to visually check that things
3970 in a much saner manner and it's easy to visually check that things
3958 are ok.
3971 are ok.
3959
3972
3960 * Updated version numbers on all files I modified to carry a
3973 * Updated version numbers on all files I modified to carry a
3961 notice so Janko and Nathan have clear version markers.
3974 notice so Janko and Nathan have clear version markers.
3962
3975
3963 * Updated docstring for ultraTB with my changes. I should send
3976 * Updated docstring for ultraTB with my changes. I should send
3964 this to Nathan.
3977 this to Nathan.
3965
3978
3966 * Lots of small fixes. Ran everything through pychecker again.
3979 * Lots of small fixes. Ran everything through pychecker again.
3967
3980
3968 * Made loading of deep_reload an cmd line option. If it's not too
3981 * Made loading of deep_reload an cmd line option. If it's not too
3969 kosher, now people can just disable it. With -nodeep_reload it's
3982 kosher, now people can just disable it. With -nodeep_reload it's
3970 still available as dreload(), it just won't overwrite reload().
3983 still available as dreload(), it just won't overwrite reload().
3971
3984
3972 * Moved many options to the no| form (-opt and -noopt
3985 * Moved many options to the no| form (-opt and -noopt
3973 accepted). Cleaner.
3986 accepted). Cleaner.
3974
3987
3975 * Changed magic_log so that if called with no parameters, it uses
3988 * Changed magic_log so that if called with no parameters, it uses
3976 'rotate' mode. That way auto-generated logs aren't automatically
3989 'rotate' mode. That way auto-generated logs aren't automatically
3977 over-written. For normal logs, now a backup is made if it exists
3990 over-written. For normal logs, now a backup is made if it exists
3978 (only 1 level of backups). A new 'backup' mode was added to the
3991 (only 1 level of backups). A new 'backup' mode was added to the
3979 Logger class to support this. This was a request by Janko.
3992 Logger class to support this. This was a request by Janko.
3980
3993
3981 * Added @logoff/@logon to stop/restart an active log.
3994 * Added @logoff/@logon to stop/restart an active log.
3982
3995
3983 * Fixed a lot of bugs in log saving/replay. It was pretty
3996 * Fixed a lot of bugs in log saving/replay. It was pretty
3984 broken. Now special lines (!@,/) appear properly in the command
3997 broken. Now special lines (!@,/) appear properly in the command
3985 history after a log replay.
3998 history after a log replay.
3986
3999
3987 * Tried and failed to implement full session saving via pickle. My
4000 * Tried and failed to implement full session saving via pickle. My
3988 idea was to pickle __main__.__dict__, but modules can't be
4001 idea was to pickle __main__.__dict__, but modules can't be
3989 pickled. This would be a better alternative to replaying logs, but
4002 pickled. This would be a better alternative to replaying logs, but
3990 seems quite tricky to get to work. Changed -session to be called
4003 seems quite tricky to get to work. Changed -session to be called
3991 -logplay, which more accurately reflects what it does. And if we
4004 -logplay, which more accurately reflects what it does. And if we
3992 ever get real session saving working, -session is now available.
4005 ever get real session saving working, -session is now available.
3993
4006
3994 * Implemented color schemes for prompts also. As for tracebacks,
4007 * Implemented color schemes for prompts also. As for tracebacks,
3995 currently only NoColor and Linux are supported. But now the
4008 currently only NoColor and Linux are supported. But now the
3996 infrastructure is in place, based on a generic ColorScheme
4009 infrastructure is in place, based on a generic ColorScheme
3997 class. So writing and activating new schemes both for the prompts
4010 class. So writing and activating new schemes both for the prompts
3998 and the tracebacks should be straightforward.
4011 and the tracebacks should be straightforward.
3999
4012
4000 * Version 0.1.13 released, 0.1.14 opened.
4013 * Version 0.1.13 released, 0.1.14 opened.
4001
4014
4002 * Changed handling of options for output cache. Now counter is
4015 * Changed handling of options for output cache. Now counter is
4003 hardwired starting at 1 and one specifies the maximum number of
4016 hardwired starting at 1 and one specifies the maximum number of
4004 entries *in the outcache* (not the max prompt counter). This is
4017 entries *in the outcache* (not the max prompt counter). This is
4005 much better, since many statements won't increase the cache
4018 much better, since many statements won't increase the cache
4006 count. It also eliminated some confusing options, now there's only
4019 count. It also eliminated some confusing options, now there's only
4007 one: cache_size.
4020 one: cache_size.
4008
4021
4009 * Added 'alias' magic function and magic_alias option in the
4022 * Added 'alias' magic function and magic_alias option in the
4010 ipythonrc file. Now the user can easily define whatever names he
4023 ipythonrc file. Now the user can easily define whatever names he
4011 wants for the magic functions without having to play weird
4024 wants for the magic functions without having to play weird
4012 namespace games. This gives IPython a real shell-like feel.
4025 namespace games. This gives IPython a real shell-like feel.
4013
4026
4014 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4027 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4015 @ or not).
4028 @ or not).
4016
4029
4017 This was one of the last remaining 'visible' bugs (that I know
4030 This was one of the last remaining 'visible' bugs (that I know
4018 of). I think if I can clean up the session loading so it works
4031 of). I think if I can clean up the session loading so it works
4019 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4032 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4020 about licensing).
4033 about licensing).
4021
4034
4022 2001-11-25 Fernando Perez <fperez@colorado.edu>
4035 2001-11-25 Fernando Perez <fperez@colorado.edu>
4023
4036
4024 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4037 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4025 there's a cleaner distinction between what ? and ?? show.
4038 there's a cleaner distinction between what ? and ?? show.
4026
4039
4027 * Added screen_length option. Now the user can define his own
4040 * Added screen_length option. Now the user can define his own
4028 screen size for page() operations.
4041 screen size for page() operations.
4029
4042
4030 * Implemented magic shell-like functions with automatic code
4043 * Implemented magic shell-like functions with automatic code
4031 generation. Now adding another function is just a matter of adding
4044 generation. Now adding another function is just a matter of adding
4032 an entry to a dict, and the function is dynamically generated at
4045 an entry to a dict, and the function is dynamically generated at
4033 run-time. Python has some really cool features!
4046 run-time. Python has some really cool features!
4034
4047
4035 * Renamed many options to cleanup conventions a little. Now all
4048 * Renamed many options to cleanup conventions a little. Now all
4036 are lowercase, and only underscores where needed. Also in the code
4049 are lowercase, and only underscores where needed. Also in the code
4037 option name tables are clearer.
4050 option name tables are clearer.
4038
4051
4039 * Changed prompts a little. Now input is 'In [n]:' instead of
4052 * Changed prompts a little. Now input is 'In [n]:' instead of
4040 'In[n]:='. This allows it the numbers to be aligned with the
4053 'In[n]:='. This allows it the numbers to be aligned with the
4041 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4054 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4042 Python (it was a Mathematica thing). The '...' continuation prompt
4055 Python (it was a Mathematica thing). The '...' continuation prompt
4043 was also changed a little to align better.
4056 was also changed a little to align better.
4044
4057
4045 * Fixed bug when flushing output cache. Not all _p<n> variables
4058 * Fixed bug when flushing output cache. Not all _p<n> variables
4046 exist, so their deletion needs to be wrapped in a try:
4059 exist, so their deletion needs to be wrapped in a try:
4047
4060
4048 * Figured out how to properly use inspect.formatargspec() (it
4061 * Figured out how to properly use inspect.formatargspec() (it
4049 requires the args preceded by *). So I removed all the code from
4062 requires the args preceded by *). So I removed all the code from
4050 _get_pdef in Magic, which was just replicating that.
4063 _get_pdef in Magic, which was just replicating that.
4051
4064
4052 * Added test to prefilter to allow redefining magic function names
4065 * Added test to prefilter to allow redefining magic function names
4053 as variables. This is ok, since the @ form is always available,
4066 as variables. This is ok, since the @ form is always available,
4054 but whe should allow the user to define a variable called 'ls' if
4067 but whe should allow the user to define a variable called 'ls' if
4055 he needs it.
4068 he needs it.
4056
4069
4057 * Moved the ToDo information from README into a separate ToDo.
4070 * Moved the ToDo information from README into a separate ToDo.
4058
4071
4059 * General code cleanup and small bugfixes. I think it's close to a
4072 * General code cleanup and small bugfixes. I think it's close to a
4060 state where it can be released, obviously with a big 'beta'
4073 state where it can be released, obviously with a big 'beta'
4061 warning on it.
4074 warning on it.
4062
4075
4063 * Got the magic function split to work. Now all magics are defined
4076 * Got the magic function split to work. Now all magics are defined
4064 in a separate class. It just organizes things a bit, and now
4077 in a separate class. It just organizes things a bit, and now
4065 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4078 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4066 was too long).
4079 was too long).
4067
4080
4068 * Changed @clear to @reset to avoid potential confusions with
4081 * Changed @clear to @reset to avoid potential confusions with
4069 the shell command clear. Also renamed @cl to @clear, which does
4082 the shell command clear. Also renamed @cl to @clear, which does
4070 exactly what people expect it to from their shell experience.
4083 exactly what people expect it to from their shell experience.
4071
4084
4072 Added a check to the @reset command (since it's so
4085 Added a check to the @reset command (since it's so
4073 destructive, it's probably a good idea to ask for confirmation).
4086 destructive, it's probably a good idea to ask for confirmation).
4074 But now reset only works for full namespace resetting. Since the
4087 But now reset only works for full namespace resetting. Since the
4075 del keyword is already there for deleting a few specific
4088 del keyword is already there for deleting a few specific
4076 variables, I don't see the point of having a redundant magic
4089 variables, I don't see the point of having a redundant magic
4077 function for the same task.
4090 function for the same task.
4078
4091
4079 2001-11-24 Fernando Perez <fperez@colorado.edu>
4092 2001-11-24 Fernando Perez <fperez@colorado.edu>
4080
4093
4081 * Updated the builtin docs (esp. the ? ones).
4094 * Updated the builtin docs (esp. the ? ones).
4082
4095
4083 * Ran all the code through pychecker. Not terribly impressed with
4096 * Ran all the code through pychecker. Not terribly impressed with
4084 it: lots of spurious warnings and didn't really find anything of
4097 it: lots of spurious warnings and didn't really find anything of
4085 substance (just a few modules being imported and not used).
4098 substance (just a few modules being imported and not used).
4086
4099
4087 * Implemented the new ultraTB functionality into IPython. New
4100 * Implemented the new ultraTB functionality into IPython. New
4088 option: xcolors. This chooses color scheme. xmode now only selects
4101 option: xcolors. This chooses color scheme. xmode now only selects
4089 between Plain and Verbose. Better orthogonality.
4102 between Plain and Verbose. Better orthogonality.
4090
4103
4091 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4104 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4092 mode and color scheme for the exception handlers. Now it's
4105 mode and color scheme for the exception handlers. Now it's
4093 possible to have the verbose traceback with no coloring.
4106 possible to have the verbose traceback with no coloring.
4094
4107
4095 2001-11-23 Fernando Perez <fperez@colorado.edu>
4108 2001-11-23 Fernando Perez <fperez@colorado.edu>
4096
4109
4097 * Version 0.1.12 released, 0.1.13 opened.
4110 * Version 0.1.12 released, 0.1.13 opened.
4098
4111
4099 * Removed option to set auto-quote and auto-paren escapes by
4112 * Removed option to set auto-quote and auto-paren escapes by
4100 user. The chances of breaking valid syntax are just too high. If
4113 user. The chances of breaking valid syntax are just too high. If
4101 someone *really* wants, they can always dig into the code.
4114 someone *really* wants, they can always dig into the code.
4102
4115
4103 * Made prompt separators configurable.
4116 * Made prompt separators configurable.
4104
4117
4105 2001-11-22 Fernando Perez <fperez@colorado.edu>
4118 2001-11-22 Fernando Perez <fperez@colorado.edu>
4106
4119
4107 * Small bugfixes in many places.
4120 * Small bugfixes in many places.
4108
4121
4109 * Removed the MyCompleter class from ipplib. It seemed redundant
4122 * Removed the MyCompleter class from ipplib. It seemed redundant
4110 with the C-p,C-n history search functionality. Less code to
4123 with the C-p,C-n history search functionality. Less code to
4111 maintain.
4124 maintain.
4112
4125
4113 * Moved all the original ipython.py code into ipythonlib.py. Right
4126 * Moved all the original ipython.py code into ipythonlib.py. Right
4114 now it's just one big dump into a function called make_IPython, so
4127 now it's just one big dump into a function called make_IPython, so
4115 no real modularity has been gained. But at least it makes the
4128 no real modularity has been gained. But at least it makes the
4116 wrapper script tiny, and since ipythonlib is a module, it gets
4129 wrapper script tiny, and since ipythonlib is a module, it gets
4117 compiled and startup is much faster.
4130 compiled and startup is much faster.
4118
4131
4119 This is a reasobably 'deep' change, so we should test it for a
4132 This is a reasobably 'deep' change, so we should test it for a
4120 while without messing too much more with the code.
4133 while without messing too much more with the code.
4121
4134
4122 2001-11-21 Fernando Perez <fperez@colorado.edu>
4135 2001-11-21 Fernando Perez <fperez@colorado.edu>
4123
4136
4124 * Version 0.1.11 released, 0.1.12 opened for further work.
4137 * Version 0.1.11 released, 0.1.12 opened for further work.
4125
4138
4126 * Removed dependency on Itpl. It was only needed in one place. It
4139 * Removed dependency on Itpl. It was only needed in one place. It
4127 would be nice if this became part of python, though. It makes life
4140 would be nice if this became part of python, though. It makes life
4128 *a lot* easier in some cases.
4141 *a lot* easier in some cases.
4129
4142
4130 * Simplified the prefilter code a bit. Now all handlers are
4143 * Simplified the prefilter code a bit. Now all handlers are
4131 expected to explicitly return a value (at least a blank string).
4144 expected to explicitly return a value (at least a blank string).
4132
4145
4133 * Heavy edits in ipplib. Removed the help system altogether. Now
4146 * Heavy edits in ipplib. Removed the help system altogether. Now
4134 obj?/?? is used for inspecting objects, a magic @doc prints
4147 obj?/?? is used for inspecting objects, a magic @doc prints
4135 docstrings, and full-blown Python help is accessed via the 'help'
4148 docstrings, and full-blown Python help is accessed via the 'help'
4136 keyword. This cleans up a lot of code (less to maintain) and does
4149 keyword. This cleans up a lot of code (less to maintain) and does
4137 the job. Since 'help' is now a standard Python component, might as
4150 the job. Since 'help' is now a standard Python component, might as
4138 well use it and remove duplicate functionality.
4151 well use it and remove duplicate functionality.
4139
4152
4140 Also removed the option to use ipplib as a standalone program. By
4153 Also removed the option to use ipplib as a standalone program. By
4141 now it's too dependent on other parts of IPython to function alone.
4154 now it's too dependent on other parts of IPython to function alone.
4142
4155
4143 * Fixed bug in genutils.pager. It would crash if the pager was
4156 * Fixed bug in genutils.pager. It would crash if the pager was
4144 exited immediately after opening (broken pipe).
4157 exited immediately after opening (broken pipe).
4145
4158
4146 * Trimmed down the VerboseTB reporting a little. The header is
4159 * Trimmed down the VerboseTB reporting a little. The header is
4147 much shorter now and the repeated exception arguments at the end
4160 much shorter now and the repeated exception arguments at the end
4148 have been removed. For interactive use the old header seemed a bit
4161 have been removed. For interactive use the old header seemed a bit
4149 excessive.
4162 excessive.
4150
4163
4151 * Fixed small bug in output of @whos for variables with multi-word
4164 * Fixed small bug in output of @whos for variables with multi-word
4152 types (only first word was displayed).
4165 types (only first word was displayed).
4153
4166
4154 2001-11-17 Fernando Perez <fperez@colorado.edu>
4167 2001-11-17 Fernando Perez <fperez@colorado.edu>
4155
4168
4156 * Version 0.1.10 released, 0.1.11 opened for further work.
4169 * Version 0.1.10 released, 0.1.11 opened for further work.
4157
4170
4158 * Modified dirs and friends. dirs now *returns* the stack (not
4171 * Modified dirs and friends. dirs now *returns* the stack (not
4159 prints), so one can manipulate it as a variable. Convenient to
4172 prints), so one can manipulate it as a variable. Convenient to
4160 travel along many directories.
4173 travel along many directories.
4161
4174
4162 * Fixed bug in magic_pdef: would only work with functions with
4175 * Fixed bug in magic_pdef: would only work with functions with
4163 arguments with default values.
4176 arguments with default values.
4164
4177
4165 2001-11-14 Fernando Perez <fperez@colorado.edu>
4178 2001-11-14 Fernando Perez <fperez@colorado.edu>
4166
4179
4167 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4180 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4168 example with IPython. Various other minor fixes and cleanups.
4181 example with IPython. Various other minor fixes and cleanups.
4169
4182
4170 * Version 0.1.9 released, 0.1.10 opened for further work.
4183 * Version 0.1.9 released, 0.1.10 opened for further work.
4171
4184
4172 * Added sys.path to the list of directories searched in the
4185 * Added sys.path to the list of directories searched in the
4173 execfile= option. It used to be the current directory and the
4186 execfile= option. It used to be the current directory and the
4174 user's IPYTHONDIR only.
4187 user's IPYTHONDIR only.
4175
4188
4176 2001-11-13 Fernando Perez <fperez@colorado.edu>
4189 2001-11-13 Fernando Perez <fperez@colorado.edu>
4177
4190
4178 * Reinstated the raw_input/prefilter separation that Janko had
4191 * Reinstated the raw_input/prefilter separation that Janko had
4179 initially. This gives a more convenient setup for extending the
4192 initially. This gives a more convenient setup for extending the
4180 pre-processor from the outside: raw_input always gets a string,
4193 pre-processor from the outside: raw_input always gets a string,
4181 and prefilter has to process it. We can then redefine prefilter
4194 and prefilter has to process it. We can then redefine prefilter
4182 from the outside and implement extensions for special
4195 from the outside and implement extensions for special
4183 purposes.
4196 purposes.
4184
4197
4185 Today I got one for inputting PhysicalQuantity objects
4198 Today I got one for inputting PhysicalQuantity objects
4186 (from Scientific) without needing any function calls at
4199 (from Scientific) without needing any function calls at
4187 all. Extremely convenient, and it's all done as a user-level
4200 all. Extremely convenient, and it's all done as a user-level
4188 extension (no IPython code was touched). Now instead of:
4201 extension (no IPython code was touched). Now instead of:
4189 a = PhysicalQuantity(4.2,'m/s**2')
4202 a = PhysicalQuantity(4.2,'m/s**2')
4190 one can simply say
4203 one can simply say
4191 a = 4.2 m/s**2
4204 a = 4.2 m/s**2
4192 or even
4205 or even
4193 a = 4.2 m/s^2
4206 a = 4.2 m/s^2
4194
4207
4195 I use this, but it's also a proof of concept: IPython really is
4208 I use this, but it's also a proof of concept: IPython really is
4196 fully user-extensible, even at the level of the parsing of the
4209 fully user-extensible, even at the level of the parsing of the
4197 command line. It's not trivial, but it's perfectly doable.
4210 command line. It's not trivial, but it's perfectly doable.
4198
4211
4199 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4212 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4200 the problem of modules being loaded in the inverse order in which
4213 the problem of modules being loaded in the inverse order in which
4201 they were defined in
4214 they were defined in
4202
4215
4203 * Version 0.1.8 released, 0.1.9 opened for further work.
4216 * Version 0.1.8 released, 0.1.9 opened for further work.
4204
4217
4205 * Added magics pdef, source and file. They respectively show the
4218 * Added magics pdef, source and file. They respectively show the
4206 definition line ('prototype' in C), source code and full python
4219 definition line ('prototype' in C), source code and full python
4207 file for any callable object. The object inspector oinfo uses
4220 file for any callable object. The object inspector oinfo uses
4208 these to show the same information.
4221 these to show the same information.
4209
4222
4210 * Version 0.1.7 released, 0.1.8 opened for further work.
4223 * Version 0.1.7 released, 0.1.8 opened for further work.
4211
4224
4212 * Separated all the magic functions into a class called Magic. The
4225 * Separated all the magic functions into a class called Magic. The
4213 InteractiveShell class was becoming too big for Xemacs to handle
4226 InteractiveShell class was becoming too big for Xemacs to handle
4214 (de-indenting a line would lock it up for 10 seconds while it
4227 (de-indenting a line would lock it up for 10 seconds while it
4215 backtracked on the whole class!)
4228 backtracked on the whole class!)
4216
4229
4217 FIXME: didn't work. It can be done, but right now namespaces are
4230 FIXME: didn't work. It can be done, but right now namespaces are
4218 all messed up. Do it later (reverted it for now, so at least
4231 all messed up. Do it later (reverted it for now, so at least
4219 everything works as before).
4232 everything works as before).
4220
4233
4221 * Got the object introspection system (magic_oinfo) working! I
4234 * Got the object introspection system (magic_oinfo) working! I
4222 think this is pretty much ready for release to Janko, so he can
4235 think this is pretty much ready for release to Janko, so he can
4223 test it for a while and then announce it. Pretty much 100% of what
4236 test it for a while and then announce it. Pretty much 100% of what
4224 I wanted for the 'phase 1' release is ready. Happy, tired.
4237 I wanted for the 'phase 1' release is ready. Happy, tired.
4225
4238
4226 2001-11-12 Fernando Perez <fperez@colorado.edu>
4239 2001-11-12 Fernando Perez <fperez@colorado.edu>
4227
4240
4228 * Version 0.1.6 released, 0.1.7 opened for further work.
4241 * Version 0.1.6 released, 0.1.7 opened for further work.
4229
4242
4230 * Fixed bug in printing: it used to test for truth before
4243 * Fixed bug in printing: it used to test for truth before
4231 printing, so 0 wouldn't print. Now checks for None.
4244 printing, so 0 wouldn't print. Now checks for None.
4232
4245
4233 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4246 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4234 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4247 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4235 reaches by hand into the outputcache. Think of a better way to do
4248 reaches by hand into the outputcache. Think of a better way to do
4236 this later.
4249 this later.
4237
4250
4238 * Various small fixes thanks to Nathan's comments.
4251 * Various small fixes thanks to Nathan's comments.
4239
4252
4240 * Changed magic_pprint to magic_Pprint. This way it doesn't
4253 * Changed magic_pprint to magic_Pprint. This way it doesn't
4241 collide with pprint() and the name is consistent with the command
4254 collide with pprint() and the name is consistent with the command
4242 line option.
4255 line option.
4243
4256
4244 * Changed prompt counter behavior to be fully like
4257 * Changed prompt counter behavior to be fully like
4245 Mathematica's. That is, even input that doesn't return a result
4258 Mathematica's. That is, even input that doesn't return a result
4246 raises the prompt counter. The old behavior was kind of confusing
4259 raises the prompt counter. The old behavior was kind of confusing
4247 (getting the same prompt number several times if the operation
4260 (getting the same prompt number several times if the operation
4248 didn't return a result).
4261 didn't return a result).
4249
4262
4250 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4263 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4251
4264
4252 * Fixed -Classic mode (wasn't working anymore).
4265 * Fixed -Classic mode (wasn't working anymore).
4253
4266
4254 * Added colored prompts using Nathan's new code. Colors are
4267 * Added colored prompts using Nathan's new code. Colors are
4255 currently hardwired, they can be user-configurable. For
4268 currently hardwired, they can be user-configurable. For
4256 developers, they can be chosen in file ipythonlib.py, at the
4269 developers, they can be chosen in file ipythonlib.py, at the
4257 beginning of the CachedOutput class def.
4270 beginning of the CachedOutput class def.
4258
4271
4259 2001-11-11 Fernando Perez <fperez@colorado.edu>
4272 2001-11-11 Fernando Perez <fperez@colorado.edu>
4260
4273
4261 * Version 0.1.5 released, 0.1.6 opened for further work.
4274 * Version 0.1.5 released, 0.1.6 opened for further work.
4262
4275
4263 * Changed magic_env to *return* the environment as a dict (not to
4276 * Changed magic_env to *return* the environment as a dict (not to
4264 print it). This way it prints, but it can also be processed.
4277 print it). This way it prints, but it can also be processed.
4265
4278
4266 * Added Verbose exception reporting to interactive
4279 * Added Verbose exception reporting to interactive
4267 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4280 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4268 traceback. Had to make some changes to the ultraTB file. This is
4281 traceback. Had to make some changes to the ultraTB file. This is
4269 probably the last 'big' thing in my mental todo list. This ties
4282 probably the last 'big' thing in my mental todo list. This ties
4270 in with the next entry:
4283 in with the next entry:
4271
4284
4272 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4285 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4273 has to specify is Plain, Color or Verbose for all exception
4286 has to specify is Plain, Color or Verbose for all exception
4274 handling.
4287 handling.
4275
4288
4276 * Removed ShellServices option. All this can really be done via
4289 * Removed ShellServices option. All this can really be done via
4277 the magic system. It's easier to extend, cleaner and has automatic
4290 the magic system. It's easier to extend, cleaner and has automatic
4278 namespace protection and documentation.
4291 namespace protection and documentation.
4279
4292
4280 2001-11-09 Fernando Perez <fperez@colorado.edu>
4293 2001-11-09 Fernando Perez <fperez@colorado.edu>
4281
4294
4282 * Fixed bug in output cache flushing (missing parameter to
4295 * Fixed bug in output cache flushing (missing parameter to
4283 __init__). Other small bugs fixed (found using pychecker).
4296 __init__). Other small bugs fixed (found using pychecker).
4284
4297
4285 * Version 0.1.4 opened for bugfixing.
4298 * Version 0.1.4 opened for bugfixing.
4286
4299
4287 2001-11-07 Fernando Perez <fperez@colorado.edu>
4300 2001-11-07 Fernando Perez <fperez@colorado.edu>
4288
4301
4289 * Version 0.1.3 released, mainly because of the raw_input bug.
4302 * Version 0.1.3 released, mainly because of the raw_input bug.
4290
4303
4291 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4304 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4292 and when testing for whether things were callable, a call could
4305 and when testing for whether things were callable, a call could
4293 actually be made to certain functions. They would get called again
4306 actually be made to certain functions. They would get called again
4294 once 'really' executed, with a resulting double call. A disaster
4307 once 'really' executed, with a resulting double call. A disaster
4295 in many cases (list.reverse() would never work!).
4308 in many cases (list.reverse() would never work!).
4296
4309
4297 * Removed prefilter() function, moved its code to raw_input (which
4310 * Removed prefilter() function, moved its code to raw_input (which
4298 after all was just a near-empty caller for prefilter). This saves
4311 after all was just a near-empty caller for prefilter). This saves
4299 a function call on every prompt, and simplifies the class a tiny bit.
4312 a function call on every prompt, and simplifies the class a tiny bit.
4300
4313
4301 * Fix _ip to __ip name in magic example file.
4314 * Fix _ip to __ip name in magic example file.
4302
4315
4303 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4316 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4304 work with non-gnu versions of tar.
4317 work with non-gnu versions of tar.
4305
4318
4306 2001-11-06 Fernando Perez <fperez@colorado.edu>
4319 2001-11-06 Fernando Perez <fperez@colorado.edu>
4307
4320
4308 * Version 0.1.2. Just to keep track of the recent changes.
4321 * Version 0.1.2. Just to keep track of the recent changes.
4309
4322
4310 * Fixed nasty bug in output prompt routine. It used to check 'if
4323 * Fixed nasty bug in output prompt routine. It used to check 'if
4311 arg != None...'. Problem is, this fails if arg implements a
4324 arg != None...'. Problem is, this fails if arg implements a
4312 special comparison (__cmp__) which disallows comparing to
4325 special comparison (__cmp__) which disallows comparing to
4313 None. Found it when trying to use the PhysicalQuantity module from
4326 None. Found it when trying to use the PhysicalQuantity module from
4314 ScientificPython.
4327 ScientificPython.
4315
4328
4316 2001-11-05 Fernando Perez <fperez@colorado.edu>
4329 2001-11-05 Fernando Perez <fperez@colorado.edu>
4317
4330
4318 * Also added dirs. Now the pushd/popd/dirs family functions
4331 * Also added dirs. Now the pushd/popd/dirs family functions
4319 basically like the shell, with the added convenience of going home
4332 basically like the shell, with the added convenience of going home
4320 when called with no args.
4333 when called with no args.
4321
4334
4322 * pushd/popd slightly modified to mimic shell behavior more
4335 * pushd/popd slightly modified to mimic shell behavior more
4323 closely.
4336 closely.
4324
4337
4325 * Added env,pushd,popd from ShellServices as magic functions. I
4338 * Added env,pushd,popd from ShellServices as magic functions. I
4326 think the cleanest will be to port all desired functions from
4339 think the cleanest will be to port all desired functions from
4327 ShellServices as magics and remove ShellServices altogether. This
4340 ShellServices as magics and remove ShellServices altogether. This
4328 will provide a single, clean way of adding functionality
4341 will provide a single, clean way of adding functionality
4329 (shell-type or otherwise) to IP.
4342 (shell-type or otherwise) to IP.
4330
4343
4331 2001-11-04 Fernando Perez <fperez@colorado.edu>
4344 2001-11-04 Fernando Perez <fperez@colorado.edu>
4332
4345
4333 * Added .ipython/ directory to sys.path. This way users can keep
4346 * Added .ipython/ directory to sys.path. This way users can keep
4334 customizations there and access them via import.
4347 customizations there and access them via import.
4335
4348
4336 2001-11-03 Fernando Perez <fperez@colorado.edu>
4349 2001-11-03 Fernando Perez <fperez@colorado.edu>
4337
4350
4338 * Opened version 0.1.1 for new changes.
4351 * Opened version 0.1.1 for new changes.
4339
4352
4340 * Changed version number to 0.1.0: first 'public' release, sent to
4353 * Changed version number to 0.1.0: first 'public' release, sent to
4341 Nathan and Janko.
4354 Nathan and Janko.
4342
4355
4343 * Lots of small fixes and tweaks.
4356 * Lots of small fixes and tweaks.
4344
4357
4345 * Minor changes to whos format. Now strings are shown, snipped if
4358 * Minor changes to whos format. Now strings are shown, snipped if
4346 too long.
4359 too long.
4347
4360
4348 * Changed ShellServices to work on __main__ so they show up in @who
4361 * Changed ShellServices to work on __main__ so they show up in @who
4349
4362
4350 * Help also works with ? at the end of a line:
4363 * Help also works with ? at the end of a line:
4351 ?sin and sin?
4364 ?sin and sin?
4352 both produce the same effect. This is nice, as often I use the
4365 both produce the same effect. This is nice, as often I use the
4353 tab-complete to find the name of a method, but I used to then have
4366 tab-complete to find the name of a method, but I used to then have
4354 to go to the beginning of the line to put a ? if I wanted more
4367 to go to the beginning of the line to put a ? if I wanted more
4355 info. Now I can just add the ? and hit return. Convenient.
4368 info. Now I can just add the ? and hit return. Convenient.
4356
4369
4357 2001-11-02 Fernando Perez <fperez@colorado.edu>
4370 2001-11-02 Fernando Perez <fperez@colorado.edu>
4358
4371
4359 * Python version check (>=2.1) added.
4372 * Python version check (>=2.1) added.
4360
4373
4361 * Added LazyPython documentation. At this point the docs are quite
4374 * Added LazyPython documentation. At this point the docs are quite
4362 a mess. A cleanup is in order.
4375 a mess. A cleanup is in order.
4363
4376
4364 * Auto-installer created. For some bizarre reason, the zipfiles
4377 * Auto-installer created. For some bizarre reason, the zipfiles
4365 module isn't working on my system. So I made a tar version
4378 module isn't working on my system. So I made a tar version
4366 (hopefully the command line options in various systems won't kill
4379 (hopefully the command line options in various systems won't kill
4367 me).
4380 me).
4368
4381
4369 * Fixes to Struct in genutils. Now all dictionary-like methods are
4382 * Fixes to Struct in genutils. Now all dictionary-like methods are
4370 protected (reasonably).
4383 protected (reasonably).
4371
4384
4372 * Added pager function to genutils and changed ? to print usage
4385 * Added pager function to genutils and changed ? to print usage
4373 note through it (it was too long).
4386 note through it (it was too long).
4374
4387
4375 * Added the LazyPython functionality. Works great! I changed the
4388 * Added the LazyPython functionality. Works great! I changed the
4376 auto-quote escape to ';', it's on home row and next to '. But
4389 auto-quote escape to ';', it's on home row and next to '. But
4377 both auto-quote and auto-paren (still /) escapes are command-line
4390 both auto-quote and auto-paren (still /) escapes are command-line
4378 parameters.
4391 parameters.
4379
4392
4380
4393
4381 2001-11-01 Fernando Perez <fperez@colorado.edu>
4394 2001-11-01 Fernando Perez <fperez@colorado.edu>
4382
4395
4383 * Version changed to 0.0.7. Fairly large change: configuration now
4396 * Version changed to 0.0.7. Fairly large change: configuration now
4384 is all stored in a directory, by default .ipython. There, all
4397 is all stored in a directory, by default .ipython. There, all
4385 config files have normal looking names (not .names)
4398 config files have normal looking names (not .names)
4386
4399
4387 * Version 0.0.6 Released first to Lucas and Archie as a test
4400 * Version 0.0.6 Released first to Lucas and Archie as a test
4388 run. Since it's the first 'semi-public' release, change version to
4401 run. Since it's the first 'semi-public' release, change version to
4389 > 0.0.6 for any changes now.
4402 > 0.0.6 for any changes now.
4390
4403
4391 * Stuff I had put in the ipplib.py changelog:
4404 * Stuff I had put in the ipplib.py changelog:
4392
4405
4393 Changes to InteractiveShell:
4406 Changes to InteractiveShell:
4394
4407
4395 - Made the usage message a parameter.
4408 - Made the usage message a parameter.
4396
4409
4397 - Require the name of the shell variable to be given. It's a bit
4410 - Require the name of the shell variable to be given. It's a bit
4398 of a hack, but allows the name 'shell' not to be hardwire in the
4411 of a hack, but allows the name 'shell' not to be hardwire in the
4399 magic (@) handler, which is problematic b/c it requires
4412 magic (@) handler, which is problematic b/c it requires
4400 polluting the global namespace with 'shell'. This in turn is
4413 polluting the global namespace with 'shell'. This in turn is
4401 fragile: if a user redefines a variable called shell, things
4414 fragile: if a user redefines a variable called shell, things
4402 break.
4415 break.
4403
4416
4404 - magic @: all functions available through @ need to be defined
4417 - magic @: all functions available through @ need to be defined
4405 as magic_<name>, even though they can be called simply as
4418 as magic_<name>, even though they can be called simply as
4406 @<name>. This allows the special command @magic to gather
4419 @<name>. This allows the special command @magic to gather
4407 information automatically about all existing magic functions,
4420 information automatically about all existing magic functions,
4408 even if they are run-time user extensions, by parsing the shell
4421 even if they are run-time user extensions, by parsing the shell
4409 instance __dict__ looking for special magic_ names.
4422 instance __dict__ looking for special magic_ names.
4410
4423
4411 - mainloop: added *two* local namespace parameters. This allows
4424 - mainloop: added *two* local namespace parameters. This allows
4412 the class to differentiate between parameters which were there
4425 the class to differentiate between parameters which were there
4413 before and after command line initialization was processed. This
4426 before and after command line initialization was processed. This
4414 way, later @who can show things loaded at startup by the
4427 way, later @who can show things loaded at startup by the
4415 user. This trick was necessary to make session saving/reloading
4428 user. This trick was necessary to make session saving/reloading
4416 really work: ideally after saving/exiting/reloading a session,
4429 really work: ideally after saving/exiting/reloading a session,
4417 *everythin* should look the same, including the output of @who. I
4430 *everythin* should look the same, including the output of @who. I
4418 was only able to make this work with this double namespace
4431 was only able to make this work with this double namespace
4419 trick.
4432 trick.
4420
4433
4421 - added a header to the logfile which allows (almost) full
4434 - added a header to the logfile which allows (almost) full
4422 session restoring.
4435 session restoring.
4423
4436
4424 - prepend lines beginning with @ or !, with a and log
4437 - prepend lines beginning with @ or !, with a and log
4425 them. Why? !lines: may be useful to know what you did @lines:
4438 them. Why? !lines: may be useful to know what you did @lines:
4426 they may affect session state. So when restoring a session, at
4439 they may affect session state. So when restoring a session, at
4427 least inform the user of their presence. I couldn't quite get
4440 least inform the user of their presence. I couldn't quite get
4428 them to properly re-execute, but at least the user is warned.
4441 them to properly re-execute, but at least the user is warned.
4429
4442
4430 * Started ChangeLog.
4443 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now