##// END OF EJS Templates
Add support for set_trace-like functionality, but with IPython's enhanced...
fperez -
Show More
@@ -1,416 +1,497 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 Pdb debugger class.
3 Pdb debugger class.
4
4
5 Modified from the standard pdb.Pdb class to avoid including readline, so that
5 Modified from the standard pdb.Pdb class to avoid including readline, so that
6 the command line completion of other programs which include this isn't
6 the command line completion of other programs which include this isn't
7 damaged.
7 damaged.
8
8
9 In the future, this class will be expanded with improvements over the standard
9 In the future, this class will be expanded with improvements over the standard
10 pdb.
10 pdb.
11
11
12 The code in this file is mainly lifted out of cmd.py in Python 2.2, with minor
12 The code in this file is mainly lifted out of cmd.py in Python 2.2, with minor
13 changes. Licensing should therefore be under the standard Python terms. For
13 changes. Licensing should therefore be under the standard Python terms. For
14 details on the PSF (Python Software Foundation) standard license, see:
14 details on the PSF (Python Software Foundation) standard license, see:
15
15
16 http://www.python.org/2.2.3/license.html
16 http://www.python.org/2.2.3/license.html
17
17
18 $Id: Debugger.py 1961 2006-12-05 21:02:40Z vivainio $"""
18 $Id: Debugger.py 2014 2007-01-05 10:36:58Z fperez $"""
19
19
20 #*****************************************************************************
20 #*****************************************************************************
21 #
21 #
22 # Since this file is essentially a modified copy of the pdb module which is
22 # Since this file is essentially a modified copy of the pdb module which is
23 # part of the standard Python distribution, I assume that the proper procedure
23 # part of the standard Python distribution, I assume that the proper procedure
24 # is to maintain its copyright as belonging to the Python Software Foundation
24 # is to maintain its copyright as belonging to the Python Software Foundation
25 # (in addition to my own, for all new code).
25 # (in addition to my own, for all new code).
26 #
26 #
27 # Copyright (C) 2001 Python Software Foundation, www.python.org
27 # Copyright (C) 2001 Python Software Foundation, www.python.org
28 # Copyright (C) 2005-2006 Fernando Perez. <fperez@colorado.edu>
28 # Copyright (C) 2005-2006 Fernando Perez. <fperez@colorado.edu>
29 #
29 #
30 # Distributed under the terms of the BSD License. The full license is in
30 # Distributed under the terms of the BSD License. The full license is in
31 # the file COPYING, distributed as part of this software.
31 # the file COPYING, distributed as part of this software.
32 #
32 #
33 #*****************************************************************************
33 #*****************************************************************************
34
34
35 from IPython import Release
35 from IPython import Release
36 __author__ = '%s <%s>' % Release.authors['Fernando']
36 __author__ = '%s <%s>' % Release.authors['Fernando']
37 __license__ = 'Python'
37 __license__ = 'Python'
38
38
39 import bdb
39 import bdb
40 import cmd
40 import cmd
41 import linecache
41 import linecache
42 import os
42 import os
43 import sys
43 import sys
44
44
45 from IPython import PyColorize, ColorANSI
45 from IPython import PyColorize, ColorANSI, ipapi
46 from IPython.genutils import Term
46 from IPython.genutils import Term
47 from IPython.excolors import ExceptionColors
47 from IPython.excolors import ExceptionColors
48
48
49 # See if we can use pydb.
49 # See if we can use pydb.
50 has_pydb = False
50 has_pydb = False
51 prompt = 'ipdb>'
51 prompt = 'ipdb>'
52 try:
52 try:
53 import pydb
53 import pydb
54 if hasattr(pydb.pydb, "runl"):
54 if hasattr(pydb.pydb, "runl"):
55 has_pydb = True
55 has_pydb = True
56 from pydb import Pdb as OldPdb
56 from pydb import Pdb as OldPdb
57 prompt = 'ipydb>'
57 prompt = 'ipydb>'
58 except ImportError:
58 except ImportError:
59 pass
59 pass
60
60
61 if has_pydb:
61 if has_pydb:
62 from pydb import Pdb as OldPdb
62 from pydb import Pdb as OldPdb
63 else:
63 else:
64 from pdb import Pdb as OldPdb
64 from pdb import Pdb as OldPdb
65
65
66 # Allow the set_trace code to operate outside of an ipython instance, even if
67 # it does so with some limitations. The rest of this support is implemented in
68 # the Tracer constructor.
69 def BdbQuit_excepthook(et,ev,tb):
70 if et==bdb.BdbQuit:
71 print 'Exiting Debugger.'
72 else:
73 ehook.excepthook_ori(et,ev,tb)
74
75 def BdbQuit_IPython_excepthook(self,et,ev,tb):
76 print 'Exiting Debugger.'
77
78 class Tracer(object):
79 """Class for local debugging, similar to pdb.set_trace.
80
81 Instances of this class, when called, behave like pdb.set_trace, but
82 providing IPython's enhanced capabilities.
83
84 This is implemented as a class which must be initialized in your own code
85 and not as a standalone function because we need to detect at runtime
86 whether IPython is already active or not. That detection is done in the
87 constructor, ensuring that this code plays nicely with a running IPython,
88 while functioning acceptably (though with limitations) if outside of it.
89 """
90
91 def __init__(self,colors=None):
92 """Create a local debugger instance.
93
94 :Parameters:
95
96 - `colors` (None): a string containing the name of the color scheme to
97 use, it must be one of IPython's valid color schemes. If not given, the
98 function will default to the current IPython scheme when running inside
99 IPython, and to 'NoColor' otherwise.
100
101 Usage example:
102
103 from IPython.Debugger import Tracer; debug_here = Tracer()
104
105 ... later in your code
106 debug_here() # -> will open up the debugger at that point.
107
108 Once the debugger activates, you can use all of its regular commands to
109 step through code, set breakpoints, etc. See the pdb documentation
110 from the Python standard library for usage details.
111 """
112
113 global __IPYTHON__
114 try:
115 __IPYTHON__
116 except NameError:
117 # Outside of ipython, we set our own exception hook manually
118 __IPYTHON__ = ipapi.get(True,False)
119 BdbQuit_excepthook.excepthook_ori = sys.excepthook
120 sys.excepthook = BdbQuit_excepthook
121 def_colors = 'NoColor'
122 try:
123 # Limited tab completion support
124 import rlcompleter,readline
125 readline.parse_and_bind('tab: complete')
126 except ImportError:
127 pass
128 else:
129 # In ipython, we use its custom exception handler mechanism
130 ip = ipapi.get()
131 def_colors = ip.options.colors
132 ip.set_custom_exc((bdb.BdbQuit,),BdbQuit_IPython_excepthook)
133
134 if colors is None:
135 colors = def_colors
136 self.debugger = Pdb(colors)
137
138 def __call__(self):
139 """Starts an interactive debugger at the point where called.
140
141 This is similar to the pdb.set_trace() function from the std lib, but
142 using IPython's enhanced debugger."""
143
144 self.debugger.set_trace(sys._getframe().f_back)
145
66 def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):
146 def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):
67 """Make new_fn have old_fn's doc string. This is particularly useful
147 """Make new_fn have old_fn's doc string. This is particularly useful
68 for the do_... commands that hook into the help system.
148 for the do_... commands that hook into the help system.
69 Adapted from from a comp.lang.python posting
149 Adapted from from a comp.lang.python posting
70 by Duncan Booth."""
150 by Duncan Booth."""
71 def wrapper(*args, **kw):
151 def wrapper(*args, **kw):
72 return new_fn(*args, **kw)
152 return new_fn(*args, **kw)
73 if old_fn.__doc__:
153 if old_fn.__doc__:
74 wrapper.__doc__ = old_fn.__doc__ + additional_text
154 wrapper.__doc__ = old_fn.__doc__ + additional_text
75 return wrapper
155 return wrapper
76
156
77 def _file_lines(fname):
157 def _file_lines(fname):
78 """Return the contents of a named file as a list of lines.
158 """Return the contents of a named file as a list of lines.
79
159
80 This function never raises an IOError exception: if the file can't be
160 This function never raises an IOError exception: if the file can't be
81 read, it simply returns an empty list."""
161 read, it simply returns an empty list."""
82
162
83 try:
163 try:
84 outfile = open(fname)
164 outfile = open(fname)
85 except IOError:
165 except IOError:
86 return []
166 return []
87 else:
167 else:
88 out = outfile.readlines()
168 out = outfile.readlines()
89 outfile.close()
169 outfile.close()
90 return out
170 return out
91
171
92 class Pdb(OldPdb):
172 class Pdb(OldPdb):
93 """Modified Pdb class, does not load readline."""
173 """Modified Pdb class, does not load readline."""
94
174
95 if sys.version[:3] >= '2.5' or has_pydb:
175 if sys.version[:3] >= '2.5' or has_pydb:
96 def __init__(self,color_scheme='NoColor',completekey=None,
176 def __init__(self,color_scheme='NoColor',completekey=None,
97 stdin=None, stdout=None):
177 stdin=None, stdout=None):
98
178
99 # Parent constructor:
179 # Parent constructor:
100 if has_pydb and completekey is None:
180 if has_pydb and completekey is None:
101 OldPdb.__init__(self,stdin=stdin,stdout=stdout)
181 OldPdb.__init__(self,stdin=stdin,stdout=stdout)
102 else:
182 else:
103 OldPdb.__init__(self,completekey,stdin,stdout)
183 OldPdb.__init__(self,completekey,stdin,stdout)
104 self.prompt = prompt # The default prompt is '(Pdb)'
184 self.prompt = prompt # The default prompt is '(Pdb)'
105
185
106 # IPython changes...
186 # IPython changes...
107 self.is_pydb = has_pydb
187 self.is_pydb = has_pydb
108
188
109 if self.is_pydb:
189 if self.is_pydb:
110
190
111 # iplib.py's ipalias seems to want pdb's checkline
191 # iplib.py's ipalias seems to want pdb's checkline
112 # which located in pydb.fn
192 # which located in pydb.fn
113 import pydb.fns
193 import pydb.fns
114 self.checkline = lambda filename, lineno: \
194 self.checkline = lambda filename, lineno: \
115 pydb.fns.checkline(self, filename, lineno)
195 pydb.fns.checkline(self, filename, lineno)
116
196
117 self.curframe = None
197 self.curframe = None
118 self.do_restart = self.new_do_restart
198 self.do_restart = self.new_do_restart
119
199
120 self.old_all_completions = __IPYTHON__.Completer.all_completions
200 self.old_all_completions = __IPYTHON__.Completer.all_completions
121 __IPYTHON__.Completer.all_completions=self.all_completions
201 __IPYTHON__.Completer.all_completions=self.all_completions
122
202
123 self.do_list = decorate_fn_with_doc(self.list_command_pydb,
203 self.do_list = decorate_fn_with_doc(self.list_command_pydb,
124 OldPdb.do_list)
204 OldPdb.do_list)
125 self.do_l = self.do_list
205 self.do_l = self.do_list
126 self.do_frame = decorate_fn_with_doc(self.new_do_frame,
206 self.do_frame = decorate_fn_with_doc(self.new_do_frame,
127 OldPdb.do_frame)
207 OldPdb.do_frame)
128
208
129 self.aliases = {}
209 self.aliases = {}
130
210
131 # Create color table: we copy the default one from the traceback
211 # Create color table: we copy the default one from the traceback
132 # module and add a few attributes needed for debugging
212 # module and add a few attributes needed for debugging
133 self.color_scheme_table = ExceptionColors.copy()
213 self.color_scheme_table = ExceptionColors.copy()
134
214
135 # shorthands
215 # shorthands
136 C = ColorANSI.TermColors
216 C = ColorANSI.TermColors
137 cst = self.color_scheme_table
217 cst = self.color_scheme_table
138
218
139 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
219 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
140 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
220 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
141
221
142 cst['Linux'].colors.breakpoint_enabled = C.LightRed
222 cst['Linux'].colors.breakpoint_enabled = C.LightRed
143 cst['Linux'].colors.breakpoint_disabled = C.Red
223 cst['Linux'].colors.breakpoint_disabled = C.Red
144
224
145 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
225 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
146 cst['LightBG'].colors.breakpoint_disabled = C.Red
226 cst['LightBG'].colors.breakpoint_disabled = C.Red
147
227
148 self.set_colors(color_scheme)
228 self.set_colors(color_scheme)
149
229
150 else:
230 else:
151 # Ugly hack: for Python 2.3-2.4, we can't call the parent constructor,
231 # Ugly hack: for Python 2.3-2.4, we can't call the parent constructor,
152 # because it binds readline and breaks tab-completion. This means we
232 # because it binds readline and breaks tab-completion. This means we
153 # have to COPY the constructor here.
233 # have to COPY the constructor here.
154 def __init__(self,color_scheme='NoColor'):
234 def __init__(self,color_scheme='NoColor'):
155 bdb.Bdb.__init__(self)
235 bdb.Bdb.__init__(self)
156 cmd.Cmd.__init__(self,completekey=None) # don't load readline
236 cmd.Cmd.__init__(self,completekey=None) # don't load readline
157 self.prompt = 'ipdb> ' # The default prompt is '(Pdb)'
237 self.prompt = 'ipdb> ' # The default prompt is '(Pdb)'
158 self.aliases = {}
238 self.aliases = {}
159
239
160 # These two lines are part of the py2.4 constructor, let's put them
240 # These two lines are part of the py2.4 constructor, let's put them
161 # unconditionally here as they won't cause any problems in 2.3.
241 # unconditionally here as they won't cause any problems in 2.3.
162 self.mainpyfile = ''
242 self.mainpyfile = ''
163 self._wait_for_mainpyfile = 0
243 self._wait_for_mainpyfile = 0
164
244
165 # Read $HOME/.pdbrc and ./.pdbrc
245 # Read $HOME/.pdbrc and ./.pdbrc
166 try:
246 try:
167 self.rcLines = _file_lines(os.path.join(os.environ['HOME'],
247 self.rcLines = _file_lines(os.path.join(os.environ['HOME'],
168 ".pdbrc"))
248 ".pdbrc"))
169 except KeyError:
249 except KeyError:
170 self.rcLines = []
250 self.rcLines = []
171 self.rcLines.extend(_file_lines(".pdbrc"))
251 self.rcLines.extend(_file_lines(".pdbrc"))
172
252
173 # Create color table: we copy the default one from the traceback
253 # Create color table: we copy the default one from the traceback
174 # module and add a few attributes needed for debugging
254 # module and add a few attributes needed for debugging
255 ExceptionColors.set_active_scheme(color_scheme)
175 self.color_scheme_table = ExceptionColors.copy()
256 self.color_scheme_table = ExceptionColors.copy()
176
257
177 # shorthands
258 # shorthands
178 C = ColorANSI.TermColors
259 C = ColorANSI.TermColors
179 cst = self.color_scheme_table
260 cst = self.color_scheme_table
180
261
181 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
262 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
182 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
263 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
183
264
184 cst['Linux'].colors.breakpoint_enabled = C.LightRed
265 cst['Linux'].colors.breakpoint_enabled = C.LightRed
185 cst['Linux'].colors.breakpoint_disabled = C.Red
266 cst['Linux'].colors.breakpoint_disabled = C.Red
186
267
187 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
268 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
188 cst['LightBG'].colors.breakpoint_disabled = C.Red
269 cst['LightBG'].colors.breakpoint_disabled = C.Red
189
270
190 self.set_colors(color_scheme)
271 self.set_colors(color_scheme)
191
272
192 def set_colors(self, scheme):
273 def set_colors(self, scheme):
193 """Shorthand access to the color table scheme selector method."""
274 """Shorthand access to the color table scheme selector method."""
194 self.color_scheme_table.set_active_scheme(scheme)
275 self.color_scheme_table.set_active_scheme(scheme)
195
276
196 def interaction(self, frame, traceback):
277 def interaction(self, frame, traceback):
197 __IPYTHON__.set_completer_frame(frame)
278 __IPYTHON__.set_completer_frame(frame)
198 OldPdb.interaction(self, frame, traceback)
279 OldPdb.interaction(self, frame, traceback)
199
280
200 def new_do_up(self, arg):
281 def new_do_up(self, arg):
201 OldPdb.do_up(self, arg)
282 OldPdb.do_up(self, arg)
202 __IPYTHON__.set_completer_frame(self.curframe)
283 __IPYTHON__.set_completer_frame(self.curframe)
203 do_u = do_up = decorate_fn_with_doc(new_do_up, OldPdb.do_up)
284 do_u = do_up = decorate_fn_with_doc(new_do_up, OldPdb.do_up)
204
285
205 def new_do_down(self, arg):
286 def new_do_down(self, arg):
206 OldPdb.do_down(self, arg)
287 OldPdb.do_down(self, arg)
207 __IPYTHON__.set_completer_frame(self.curframe)
288 __IPYTHON__.set_completer_frame(self.curframe)
208
289
209 do_d = do_down = decorate_fn_with_doc(new_do_down, OldPdb.do_down)
290 do_d = do_down = decorate_fn_with_doc(new_do_down, OldPdb.do_down)
210
291
211 def new_do_frame(self, arg):
292 def new_do_frame(self, arg):
212 OldPdb.do_frame(self, arg)
293 OldPdb.do_frame(self, arg)
213 __IPYTHON__.set_completer_frame(self.curframe)
294 __IPYTHON__.set_completer_frame(self.curframe)
214
295
215 def new_do_quit(self, arg):
296 def new_do_quit(self, arg):
216
297
217 if hasattr(self, 'old_all_completions'):
298 if hasattr(self, 'old_all_completions'):
218 __IPYTHON__.Completer.all_completions=self.old_all_completions
299 __IPYTHON__.Completer.all_completions=self.old_all_completions
219
300
220
301
221 return OldPdb.do_quit(self, arg)
302 return OldPdb.do_quit(self, arg)
222
303
223 do_q = do_quit = decorate_fn_with_doc(new_do_quit, OldPdb.do_quit)
304 do_q = do_quit = decorate_fn_with_doc(new_do_quit, OldPdb.do_quit)
224
305
225 def new_do_restart(self, arg):
306 def new_do_restart(self, arg):
226 """Restart command. In the context of ipython this is exactly the same
307 """Restart command. In the context of ipython this is exactly the same
227 thing as 'quit'."""
308 thing as 'quit'."""
228 self.msg("Restart doesn't make sense here. Using 'quit' instead.")
309 self.msg("Restart doesn't make sense here. Using 'quit' instead.")
229 return self.do_quit(arg)
310 return self.do_quit(arg)
230
311
231 def postloop(self):
312 def postloop(self):
232 __IPYTHON__.set_completer_frame(None)
313 __IPYTHON__.set_completer_frame(None)
233
314
234 def print_stack_trace(self):
315 def print_stack_trace(self):
235 try:
316 try:
236 for frame_lineno in self.stack:
317 for frame_lineno in self.stack:
237 self.print_stack_entry(frame_lineno, context = 5)
318 self.print_stack_entry(frame_lineno, context = 5)
238 except KeyboardInterrupt:
319 except KeyboardInterrupt:
239 pass
320 pass
240
321
241 def print_stack_entry(self,frame_lineno,prompt_prefix='\n-> ',
322 def print_stack_entry(self,frame_lineno,prompt_prefix='\n-> ',
242 context = 3):
323 context = 3):
243 frame, lineno = frame_lineno
324 frame, lineno = frame_lineno
244 print >>Term.cout, self.format_stack_entry(frame_lineno, '', context)
325 print >>Term.cout, self.format_stack_entry(frame_lineno, '', context)
245
326
246 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
327 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
247 import linecache, repr
328 import linecache, repr
248
329
249 ret = []
330 ret = []
250
331
251 Colors = self.color_scheme_table.active_colors
332 Colors = self.color_scheme_table.active_colors
252 ColorsNormal = Colors.Normal
333 ColorsNormal = Colors.Normal
253 tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal)
334 tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal)
254 tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
335 tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
255 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
336 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
256 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
337 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
257 ColorsNormal)
338 ColorsNormal)
258
339
259 frame, lineno = frame_lineno
340 frame, lineno = frame_lineno
260
341
261 return_value = ''
342 return_value = ''
262 if '__return__' in frame.f_locals:
343 if '__return__' in frame.f_locals:
263 rv = frame.f_locals['__return__']
344 rv = frame.f_locals['__return__']
264 #return_value += '->'
345 #return_value += '->'
265 return_value += repr.repr(rv) + '\n'
346 return_value += repr.repr(rv) + '\n'
266 ret.append(return_value)
347 ret.append(return_value)
267
348
268 #s = filename + '(' + `lineno` + ')'
349 #s = filename + '(' + `lineno` + ')'
269 filename = self.canonic(frame.f_code.co_filename)
350 filename = self.canonic(frame.f_code.co_filename)
270 link = tpl_link % filename
351 link = tpl_link % filename
271
352
272 if frame.f_code.co_name:
353 if frame.f_code.co_name:
273 func = frame.f_code.co_name
354 func = frame.f_code.co_name
274 else:
355 else:
275 func = "<lambda>"
356 func = "<lambda>"
276
357
277 call = ''
358 call = ''
278 if func != '?':
359 if func != '?':
279 if '__args__' in frame.f_locals:
360 if '__args__' in frame.f_locals:
280 args = repr.repr(frame.f_locals['__args__'])
361 args = repr.repr(frame.f_locals['__args__'])
281 else:
362 else:
282 args = '()'
363 args = '()'
283 call = tpl_call % (func, args)
364 call = tpl_call % (func, args)
284
365
285 # The level info should be generated in the same format pdb uses, to
366 # The level info should be generated in the same format pdb uses, to
286 # avoid breaking the pdbtrack functionality of python-mode in *emacs.
367 # avoid breaking the pdbtrack functionality of python-mode in *emacs.
287 ret.append('> %s(%s)%s\n' % (link,lineno,call))
368 ret.append('> %s(%s)%s\n' % (link,lineno,call))
288
369
289 start = lineno - 1 - context//2
370 start = lineno - 1 - context//2
290 lines = linecache.getlines(filename)
371 lines = linecache.getlines(filename)
291 start = max(start, 0)
372 start = max(start, 0)
292 start = min(start, len(lines) - context)
373 start = min(start, len(lines) - context)
293 lines = lines[start : start + context]
374 lines = lines[start : start + context]
294
375
295 for i,line in enumerate(lines):
376 for i,line in enumerate(lines):
296 show_arrow = (start + 1 + i == lineno)
377 show_arrow = (start + 1 + i == lineno)
297 ret.append(self.__format_line(tpl_line_em, filename,
378 ret.append(self.__format_line(tpl_line_em, filename,
298 start + 1 + i, line,
379 start + 1 + i, line,
299 arrow = show_arrow) )
380 arrow = show_arrow) )
300
381
301 return ''.join(ret)
382 return ''.join(ret)
302
383
303 def __format_line(self, tpl_line, filename, lineno, line, arrow = False):
384 def __format_line(self, tpl_line, filename, lineno, line, arrow = False):
304 bp_mark = ""
385 bp_mark = ""
305 bp_mark_color = ""
386 bp_mark_color = ""
306
387
307 bp = None
388 bp = None
308 if lineno in self.get_file_breaks(filename):
389 if lineno in self.get_file_breaks(filename):
309 bps = self.get_breaks(filename, lineno)
390 bps = self.get_breaks(filename, lineno)
310 bp = bps[-1]
391 bp = bps[-1]
311
392
312 if bp:
393 if bp:
313 Colors = self.color_scheme_table.active_colors
394 Colors = self.color_scheme_table.active_colors
314 bp_mark = str(bp.number)
395 bp_mark = str(bp.number)
315 bp_mark_color = Colors.breakpoint_enabled
396 bp_mark_color = Colors.breakpoint_enabled
316 if not bp.enabled:
397 if not bp.enabled:
317 bp_mark_color = Colors.breakpoint_disabled
398 bp_mark_color = Colors.breakpoint_disabled
318
399
319 numbers_width = 7
400 numbers_width = 7
320 if arrow:
401 if arrow:
321 # This is the line with the error
402 # This is the line with the error
322 pad = numbers_width - len(str(lineno)) - len(bp_mark)
403 pad = numbers_width - len(str(lineno)) - len(bp_mark)
323 if pad >= 3:
404 if pad >= 3:
324 marker = '-'*(pad-3) + '-> '
405 marker = '-'*(pad-3) + '-> '
325 elif pad == 2:
406 elif pad == 2:
326 marker = '> '
407 marker = '> '
327 elif pad == 1:
408 elif pad == 1:
328 marker = '>'
409 marker = '>'
329 else:
410 else:
330 marker = ''
411 marker = ''
331 num = '%s%s' % (marker, str(lineno))
412 num = '%s%s' % (marker, str(lineno))
332 line = tpl_line % (bp_mark_color + bp_mark, num, line)
413 line = tpl_line % (bp_mark_color + bp_mark, num, line)
333 else:
414 else:
334 num = '%*s' % (numbers_width - len(bp_mark), str(lineno))
415 num = '%*s' % (numbers_width - len(bp_mark), str(lineno))
335 line = tpl_line % (bp_mark_color + bp_mark, num, line)
416 line = tpl_line % (bp_mark_color + bp_mark, num, line)
336
417
337 return line
418 return line
338
419
339 def list_command_pydb(self, arg):
420 def list_command_pydb(self, arg):
340 """List command to use if we have a newer pydb installed"""
421 """List command to use if we have a newer pydb installed"""
341 filename, first, last = OldPdb.parse_list_cmd(self, arg)
422 filename, first, last = OldPdb.parse_list_cmd(self, arg)
342 if filename is not None:
423 if filename is not None:
343 self.print_list_lines(filename, first, last)
424 self.print_list_lines(filename, first, last)
344
425
345 def print_list_lines(self, filename, first, last):
426 def print_list_lines(self, filename, first, last):
346 """The printing (as opposed to the parsing part of a 'list'
427 """The printing (as opposed to the parsing part of a 'list'
347 command."""
428 command."""
348 try:
429 try:
349 Colors = self.color_scheme_table.active_colors
430 Colors = self.color_scheme_table.active_colors
350 ColorsNormal = Colors.Normal
431 ColorsNormal = Colors.Normal
351 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
432 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
352 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal)
433 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal)
353 src = []
434 src = []
354 for lineno in range(first, last+1):
435 for lineno in range(first, last+1):
355 line = linecache.getline(filename, lineno)
436 line = linecache.getline(filename, lineno)
356 if not line:
437 if not line:
357 break
438 break
358
439
359 if lineno == self.curframe.f_lineno:
440 if lineno == self.curframe.f_lineno:
360 line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True)
441 line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True)
361 else:
442 else:
362 line = self.__format_line(tpl_line, filename, lineno, line, arrow = False)
443 line = self.__format_line(tpl_line, filename, lineno, line, arrow = False)
363
444
364 src.append(line)
445 src.append(line)
365 self.lineno = lineno
446 self.lineno = lineno
366
447
367 print >>Term.cout, ''.join(src)
448 print >>Term.cout, ''.join(src)
368
449
369 except KeyboardInterrupt:
450 except KeyboardInterrupt:
370 pass
451 pass
371
452
372 def do_list(self, arg):
453 def do_list(self, arg):
373 self.lastcmd = 'list'
454 self.lastcmd = 'list'
374 last = None
455 last = None
375 if arg:
456 if arg:
376 try:
457 try:
377 x = eval(arg, {}, {})
458 x = eval(arg, {}, {})
378 if type(x) == type(()):
459 if type(x) == type(()):
379 first, last = x
460 first, last = x
380 first = int(first)
461 first = int(first)
381 last = int(last)
462 last = int(last)
382 if last < first:
463 if last < first:
383 # Assume it's a count
464 # Assume it's a count
384 last = first + last
465 last = first + last
385 else:
466 else:
386 first = max(1, int(x) - 5)
467 first = max(1, int(x) - 5)
387 except:
468 except:
388 print '*** Error in argument:', `arg`
469 print '*** Error in argument:', `arg`
389 return
470 return
390 elif self.lineno is None:
471 elif self.lineno is None:
391 first = max(1, self.curframe.f_lineno - 5)
472 first = max(1, self.curframe.f_lineno - 5)
392 else:
473 else:
393 first = self.lineno + 1
474 first = self.lineno + 1
394 if last is None:
475 if last is None:
395 last = first + 10
476 last = first + 10
396 self.print_list_lines(self.curframe.f_code.co_filename, first, last)
477 self.print_list_lines(self.curframe.f_code.co_filename, first, last)
397
478
398 do_l = do_list
479 do_l = do_list
399
480
400 def do_pdef(self, arg):
481 def do_pdef(self, arg):
401 """The debugger interface to magic_pdef"""
482 """The debugger interface to magic_pdef"""
402 namespaces = [('Locals', self.curframe.f_locals),
483 namespaces = [('Locals', self.curframe.f_locals),
403 ('Globals', self.curframe.f_globals)]
484 ('Globals', self.curframe.f_globals)]
404 __IPYTHON__.magic_pdef(arg, namespaces=namespaces)
485 __IPYTHON__.magic_pdef(arg, namespaces=namespaces)
405
486
406 def do_pdoc(self, arg):
487 def do_pdoc(self, arg):
407 """The debugger interface to magic_pdoc"""
488 """The debugger interface to magic_pdoc"""
408 namespaces = [('Locals', self.curframe.f_locals),
489 namespaces = [('Locals', self.curframe.f_locals),
409 ('Globals', self.curframe.f_globals)]
490 ('Globals', self.curframe.f_globals)]
410 __IPYTHON__.magic_pdoc(arg, namespaces=namespaces)
491 __IPYTHON__.magic_pdoc(arg, namespaces=namespaces)
411
492
412 def do_pinfo(self, arg):
493 def do_pinfo(self, arg):
413 """The debugger equivalant of ?obj"""
494 """The debugger equivalant of ?obj"""
414 namespaces = [('Locals', self.curframe.f_locals),
495 namespaces = [('Locals', self.curframe.f_locals),
415 ('Globals', self.curframe.f_globals)]
496 ('Globals', self.curframe.f_globals)]
416 __IPYTHON__.magic_pinfo("pinfo %s" % arg, namespaces=namespaces)
497 __IPYTHON__.magic_pinfo("pinfo %s" % arg, namespaces=namespaces)
@@ -1,351 +1,364 b''
1 ''' IPython customization API
1 ''' IPython customization API
2
2
3 Your one-stop module for configuring & extending ipython
3 Your one-stop module for configuring & extending ipython
4
4
5 The API will probably break when ipython 1.0 is released, but so
5 The API will probably break when ipython 1.0 is released, but so
6 will the other configuration method (rc files).
6 will the other configuration method (rc files).
7
7
8 All names prefixed by underscores are for internal use, not part
8 All names prefixed by underscores are for internal use, not part
9 of the public api.
9 of the public api.
10
10
11 Below is an example that you can just put to a module and import from ipython.
11 Below is an example that you can just put to a module and import from ipython.
12
12
13 A good practice is to install the config script below as e.g.
13 A good practice is to install the config script below as e.g.
14
14
15 ~/.ipython/my_private_conf.py
15 ~/.ipython/my_private_conf.py
16
16
17 And do
17 And do
18
18
19 import_mod my_private_conf
19 import_mod my_private_conf
20
20
21 in ~/.ipython/ipythonrc
21 in ~/.ipython/ipythonrc
22
22
23 That way the module is imported at startup and you can have all your
23 That way the module is imported at startup and you can have all your
24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
25 stuff) in there.
25 stuff) in there.
26
26
27 -----------------------------------------------
27 -----------------------------------------------
28 import IPython.ipapi
28 import IPython.ipapi
29 ip = IPython.ipapi.get()
29 ip = IPython.ipapi.get()
30
30
31 def ankka_f(self, arg):
31 def ankka_f(self, arg):
32 print "Ankka",self,"says uppercase:",arg.upper()
32 print "Ankka",self,"says uppercase:",arg.upper()
33
33
34 ip.expose_magic("ankka",ankka_f)
34 ip.expose_magic("ankka",ankka_f)
35
35
36 ip.magic('alias sayhi echo "Testing, hi ok"')
36 ip.magic('alias sayhi echo "Testing, hi ok"')
37 ip.magic('alias helloworld echo "Hello world"')
37 ip.magic('alias helloworld echo "Hello world"')
38 ip.system('pwd')
38 ip.system('pwd')
39
39
40 ip.ex('import re')
40 ip.ex('import re')
41 ip.ex("""
41 ip.ex("""
42 def funcci(a,b):
42 def funcci(a,b):
43 print a+b
43 print a+b
44 print funcci(3,4)
44 print funcci(3,4)
45 """)
45 """)
46 ip.ex("funcci(348,9)")
46 ip.ex("funcci(348,9)")
47
47
48 def jed_editor(self,filename, linenum=None):
48 def jed_editor(self,filename, linenum=None):
49 print "Calling my own editor, jed ... via hook!"
49 print "Calling my own editor, jed ... via hook!"
50 import os
50 import os
51 if linenum is None: linenum = 0
51 if linenum is None: linenum = 0
52 os.system('jed +%d %s' % (linenum, filename))
52 os.system('jed +%d %s' % (linenum, filename))
53 print "exiting jed"
53 print "exiting jed"
54
54
55 ip.set_hook('editor',jed_editor)
55 ip.set_hook('editor',jed_editor)
56
56
57 o = ip.options
57 o = ip.options
58 o.autocall = 2 # FULL autocall mode
58 o.autocall = 2 # FULL autocall mode
59
59
60 print "done!"
60 print "done!"
61 '''
61 '''
62
62
63 # stdlib imports
63 # stdlib imports
64 import __builtin__
64 import __builtin__
65 import sys
65 import sys
66
66
67 # our own
67 # our own
68 from IPython.genutils import warn,error
68 from IPython.genutils import warn,error
69
69
70 class TryNext(Exception):
70 class TryNext(Exception):
71 """Try next hook exception.
71 """Try next hook exception.
72
72
73 Raise this in your hook function to indicate that the next hook handler
73 Raise this in your hook function to indicate that the next hook handler
74 should be used to handle the operation. If you pass arguments to the
74 should be used to handle the operation. If you pass arguments to the
75 constructor those arguments will be used by the next hook instead of the
75 constructor those arguments will be used by the next hook instead of the
76 original ones.
76 original ones.
77 """
77 """
78
78
79 def __init__(self, *args, **kwargs):
79 def __init__(self, *args, **kwargs):
80 self.args = args
80 self.args = args
81 self.kwargs = kwargs
81 self.kwargs = kwargs
82
82
83 # contains the most recently instantiated IPApi
83 # contains the most recently instantiated IPApi
84
84
85 class IPythonNotRunning:
85 class IPythonNotRunning:
86 """Dummy do-nothing class.
86 """Dummy do-nothing class.
87
87
88 Instances of this class return a dummy attribute on all accesses, which
88 Instances of this class return a dummy attribute on all accesses, which
89 can be called and warns. This makes it easier to write scripts which use
89 can be called and warns. This makes it easier to write scripts which use
90 the ipapi.get() object for informational purposes to operate both with and
90 the ipapi.get() object for informational purposes to operate both with and
91 without ipython. Obviously code which uses the ipython object for
91 without ipython. Obviously code which uses the ipython object for
92 computations will not work, but this allows a wider range of code to
92 computations will not work, but this allows a wider range of code to
93 transparently work whether ipython is being used or not."""
93 transparently work whether ipython is being used or not."""
94
95 def __init__(self,warn=True):
96 if warn:
97 self.dummy = self._dummy_warn
98 else:
99 self.dummy = self._dummy_silent
94
100
95 def __str__(self):
101 def __str__(self):
96 return "<IPythonNotRunning>"
102 return "<IPythonNotRunning>"
97
103
98 __repr__ = __str__
104 __repr__ = __str__
99
105
100 def __getattr__(self,name):
106 def __getattr__(self,name):
101 return self.dummy
107 return self.dummy
102
108
103 def dummy(self,*args,**kw):
109 def _dummy_warn(self,*args,**kw):
104 """Dummy function, which doesn't do anything but warn."""
110 """Dummy function, which doesn't do anything but warn."""
111
105 warn("IPython is not running, this is a dummy no-op function")
112 warn("IPython is not running, this is a dummy no-op function")
106
113
114 def _dummy_silent(self,*args,**kw):
115 """Dummy function, which doesn't do anything and emits no warnings."""
116 pass
117
107 _recent = None
118 _recent = None
108
119
109
120
110 def get(allow_dummy=False):
121 def get(allow_dummy=False,dummy_warn=True):
111 """Get an IPApi object.
122 """Get an IPApi object.
112
123
113 If allow_dummy is true, returns an instance of IPythonNotRunning
124 If allow_dummy is true, returns an instance of IPythonNotRunning
114 instead of None if not running under IPython.
125 instead of None if not running under IPython.
115
126
127 If dummy_warn is false, the dummy instance will be completely silent.
128
116 Running this should be the first thing you do when writing extensions that
129 Running this should be the first thing you do when writing extensions that
117 can be imported as normal modules. You can then direct all the
130 can be imported as normal modules. You can then direct all the
118 configuration operations against the returned object.
131 configuration operations against the returned object.
119 """
132 """
120 global _recent
133 global _recent
121 if allow_dummy and not _recent:
134 if allow_dummy and not _recent:
122 _recent = IPythonNotRunning()
135 _recent = IPythonNotRunning(dummy_warn)
123 return _recent
136 return _recent
124
137
125 class IPApi:
138 class IPApi:
126 """ The actual API class for configuring IPython
139 """ The actual API class for configuring IPython
127
140
128 You should do all of the IPython configuration by getting an IPApi object
141 You should do all of the IPython configuration by getting an IPApi object
129 with IPython.ipapi.get() and using the attributes and methods of the
142 with IPython.ipapi.get() and using the attributes and methods of the
130 returned object."""
143 returned object."""
131
144
132 def __init__(self,ip):
145 def __init__(self,ip):
133
146
134 # All attributes exposed here are considered to be the public API of
147 # All attributes exposed here are considered to be the public API of
135 # IPython. As needs dictate, some of these may be wrapped as
148 # IPython. As needs dictate, some of these may be wrapped as
136 # properties.
149 # properties.
137
150
138 self.magic = ip.ipmagic
151 self.magic = ip.ipmagic
139
152
140 self.system = ip.ipsystem
153 self.system = ip.ipsystem
141
154
142 self.set_hook = ip.set_hook
155 self.set_hook = ip.set_hook
143
156
144 self.set_custom_exc = ip.set_custom_exc
157 self.set_custom_exc = ip.set_custom_exc
145
158
146 self.user_ns = ip.user_ns
159 self.user_ns = ip.user_ns
147
160
148 self.set_crash_handler = ip.set_crash_handler
161 self.set_crash_handler = ip.set_crash_handler
149
162
150 # Session-specific data store, which can be used to store
163 # Session-specific data store, which can be used to store
151 # data that should persist through the ipython session.
164 # data that should persist through the ipython session.
152 self.meta = ip.meta
165 self.meta = ip.meta
153
166
154 # The ipython instance provided
167 # The ipython instance provided
155 self.IP = ip
168 self.IP = ip
156
169
157 global _recent
170 global _recent
158 _recent = self
171 _recent = self
159
172
160 # Use a property for some things which are added to the instance very
173 # Use a property for some things which are added to the instance very
161 # late. I don't have time right now to disentangle the initialization
174 # late. I don't have time right now to disentangle the initialization
162 # order issues, so a property lets us delay item extraction while
175 # order issues, so a property lets us delay item extraction while
163 # providing a normal attribute API.
176 # providing a normal attribute API.
164 def get_db(self):
177 def get_db(self):
165 """A handle to persistent dict-like database (a PickleShareDB object)"""
178 """A handle to persistent dict-like database (a PickleShareDB object)"""
166 return self.IP.db
179 return self.IP.db
167
180
168 db = property(get_db,None,None,get_db.__doc__)
181 db = property(get_db,None,None,get_db.__doc__)
169
182
170 def get_options(self):
183 def get_options(self):
171 """All configurable variables."""
184 """All configurable variables."""
172
185
173 # catch typos by disabling new attribute creation. If new attr creation
186 # catch typos by disabling new attribute creation. If new attr creation
174 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
187 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
175 # for the received rc struct.
188 # for the received rc struct.
176
189
177 self.IP.rc.allow_new_attr(False)
190 self.IP.rc.allow_new_attr(False)
178 return self.IP.rc
191 return self.IP.rc
179
192
180 options = property(get_options,None,None,get_options.__doc__)
193 options = property(get_options,None,None,get_options.__doc__)
181
194
182 def expose_magic(self,magicname, func):
195 def expose_magic(self,magicname, func):
183 ''' Expose own function as magic function for ipython
196 ''' Expose own function as magic function for ipython
184
197
185 def foo_impl(self,parameter_s=''):
198 def foo_impl(self,parameter_s=''):
186 """My very own magic!. (Use docstrings, IPython reads them)."""
199 """My very own magic!. (Use docstrings, IPython reads them)."""
187 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
200 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
188 print 'The self object is:',self
201 print 'The self object is:',self
189
202
190 ipapi.expose_magic("foo",foo_impl)
203 ipapi.expose_magic("foo",foo_impl)
191 '''
204 '''
192
205
193 import new
206 import new
194 im = new.instancemethod(func,self.IP, self.IP.__class__)
207 im = new.instancemethod(func,self.IP, self.IP.__class__)
195 setattr(self.IP, "magic_" + magicname, im)
208 setattr(self.IP, "magic_" + magicname, im)
196
209
197 def ex(self,cmd):
210 def ex(self,cmd):
198 """ Execute a normal python statement in user namespace """
211 """ Execute a normal python statement in user namespace """
199 exec cmd in self.user_ns
212 exec cmd in self.user_ns
200
213
201 def ev(self,expr):
214 def ev(self,expr):
202 """ Evaluate python expression expr in user namespace
215 """ Evaluate python expression expr in user namespace
203
216
204 Returns the result of evaluation"""
217 Returns the result of evaluation"""
205 return eval(expr,self.user_ns)
218 return eval(expr,self.user_ns)
206
219
207 def runlines(self,lines):
220 def runlines(self,lines):
208 """ Run the specified lines in interpreter, honoring ipython directives.
221 """ Run the specified lines in interpreter, honoring ipython directives.
209
222
210 This allows %magic and !shell escape notations.
223 This allows %magic and !shell escape notations.
211
224
212 Takes either all lines in one string or list of lines.
225 Takes either all lines in one string or list of lines.
213 """
226 """
214 if isinstance(lines,basestring):
227 if isinstance(lines,basestring):
215 self.IP.runlines(lines)
228 self.IP.runlines(lines)
216 else:
229 else:
217 self.IP.runlines('\n'.join(lines))
230 self.IP.runlines('\n'.join(lines))
218
231
219 def to_user_ns(self,vars):
232 def to_user_ns(self,vars):
220 """Inject a group of variables into the IPython user namespace.
233 """Inject a group of variables into the IPython user namespace.
221
234
222 Inputs:
235 Inputs:
223
236
224 - vars: string with variable names separated by whitespace
237 - vars: string with variable names separated by whitespace
225
238
226 This utility routine is meant to ease interactive debugging work,
239 This utility routine is meant to ease interactive debugging work,
227 where you want to easily propagate some internal variable in your code
240 where you want to easily propagate some internal variable in your code
228 up to the interactive namespace for further exploration.
241 up to the interactive namespace for further exploration.
229
242
230 When you run code via %run, globals in your script become visible at
243 When you run code via %run, globals in your script become visible at
231 the interactive prompt, but this doesn't happen for locals inside your
244 the interactive prompt, but this doesn't happen for locals inside your
232 own functions and methods. Yet when debugging, it is common to want
245 own functions and methods. Yet when debugging, it is common to want
233 to explore some internal variables further at the interactive propmt.
246 to explore some internal variables further at the interactive propmt.
234
247
235 Examples:
248 Examples:
236
249
237 To use this, you first must obtain a handle on the ipython object as
250 To use this, you first must obtain a handle on the ipython object as
238 indicated above, via:
251 indicated above, via:
239
252
240 import IPython.ipapi
253 import IPython.ipapi
241 ip = IPython.ipapi.get()
254 ip = IPython.ipapi.get()
242
255
243 Once this is done, inside a routine foo() where you want to expose
256 Once this is done, inside a routine foo() where you want to expose
244 variables x and y, you do the following:
257 variables x and y, you do the following:
245
258
246 def foo():
259 def foo():
247 ...
260 ...
248 x = your_computation()
261 x = your_computation()
249 y = something_else()
262 y = something_else()
250
263
251 # This pushes x and y to the interactive prompt immediately, even
264 # This pushes x and y to the interactive prompt immediately, even
252 # if this routine crashes on the next line after:
265 # if this routine crashes on the next line after:
253 ip.to_user_ns('x y')
266 ip.to_user_ns('x y')
254 ...
267 ...
255 # return
268 # return
256
269
257 If you need to rename variables, just use ip.user_ns with dict
270 If you need to rename variables, just use ip.user_ns with dict
258 and update:
271 and update:
259
272
260 # exposes variables 'foo' as 'x' and 'bar' as 'y' in IPython
273 # exposes variables 'foo' as 'x' and 'bar' as 'y' in IPython
261 # user namespace
274 # user namespace
262 ip.user_ns.update(dict(x=foo,y=bar))
275 ip.user_ns.update(dict(x=foo,y=bar))
263 """
276 """
264
277
265 # print 'vars given:',vars # dbg
278 # print 'vars given:',vars # dbg
266 # Get the caller's frame to evaluate the given names in
279 # Get the caller's frame to evaluate the given names in
267 cf = sys._getframe(1)
280 cf = sys._getframe(1)
268
281
269 user_ns = self.user_ns
282 user_ns = self.user_ns
270
283
271 for name in vars.split():
284 for name in vars.split():
272 try:
285 try:
273 user_ns[name] = eval(name,cf.f_globals,cf.f_locals)
286 user_ns[name] = eval(name,cf.f_globals,cf.f_locals)
274 except:
287 except:
275 error('could not get var. %s from %s' %
288 error('could not get var. %s from %s' %
276 (name,cf.f_code.co_name))
289 (name,cf.f_code.co_name))
277
290
278 def expand_alias(self,line):
291 def expand_alias(self,line):
279 """ Expand an alias in the command line
292 """ Expand an alias in the command line
280
293
281 Returns the provided command line, possibly with the first word
294 Returns the provided command line, possibly with the first word
282 (command) translated according to alias expansion rules.
295 (command) translated according to alias expansion rules.
283
296
284 [ipython]|16> _ip.expand_aliases("np myfile.txt")
297 [ipython]|16> _ip.expand_aliases("np myfile.txt")
285 <16> 'q:/opt/np/notepad++.exe myfile.txt'
298 <16> 'q:/opt/np/notepad++.exe myfile.txt'
286 """
299 """
287
300
288 pre,fn,rest = self.IP.split_user_input(line)
301 pre,fn,rest = self.IP.split_user_input(line)
289 res = pre + self.IP.expand_aliases(fn,rest)
302 res = pre + self.IP.expand_aliases(fn,rest)
290
303
291
304
292
305
293 def launch_new_instance(user_ns = None):
306 def launch_new_instance(user_ns = None):
294 """ Make and start a new ipython instance.
307 """ Make and start a new ipython instance.
295
308
296 This can be called even without having an already initialized
309 This can be called even without having an already initialized
297 ipython session running.
310 ipython session running.
298
311
299 This is also used as the egg entry point for the 'ipython' script.
312 This is also used as the egg entry point for the 'ipython' script.
300
313
301 """
314 """
302 ses = make_session(user_ns)
315 ses = make_session(user_ns)
303 ses.mainloop()
316 ses.mainloop()
304
317
305
318
306 def make_user_ns(user_ns = None):
319 def make_user_ns(user_ns = None):
307 """Return a valid user interactive namespace.
320 """Return a valid user interactive namespace.
308
321
309 This builds a dict with the minimal information needed to operate as a
322 This builds a dict with the minimal information needed to operate as a
310 valid IPython user namespace, which you can pass to the various embedding
323 valid IPython user namespace, which you can pass to the various embedding
311 classes in ipython.
324 classes in ipython.
312 """
325 """
313
326
314 if user_ns is None:
327 if user_ns is None:
315 # Set __name__ to __main__ to better match the behavior of the
328 # Set __name__ to __main__ to better match the behavior of the
316 # normal interpreter.
329 # normal interpreter.
317 user_ns = {'__name__' :'__main__',
330 user_ns = {'__name__' :'__main__',
318 '__builtins__' : __builtin__,
331 '__builtins__' : __builtin__,
319 }
332 }
320 else:
333 else:
321 user_ns.setdefault('__name__','__main__')
334 user_ns.setdefault('__name__','__main__')
322 user_ns.setdefault('__builtins__',__builtin__)
335 user_ns.setdefault('__builtins__',__builtin__)
323
336
324 return user_ns
337 return user_ns
325
338
326
339
327 def make_user_global_ns(ns = None):
340 def make_user_global_ns(ns = None):
328 """Return a valid user global namespace.
341 """Return a valid user global namespace.
329
342
330 Similar to make_user_ns(), but global namespaces are really only needed in
343 Similar to make_user_ns(), but global namespaces are really only needed in
331 embedded applications, where there is a distinction between the user's
344 embedded applications, where there is a distinction between the user's
332 interactive namespace and the global one where ipython is running."""
345 interactive namespace and the global one where ipython is running."""
333
346
334 if ns is None: ns = {}
347 if ns is None: ns = {}
335 return ns
348 return ns
336
349
337
350
338 def make_session(user_ns = None):
351 def make_session(user_ns = None):
339 """Makes, but does not launch an IPython session.
352 """Makes, but does not launch an IPython session.
340
353
341 Later on you can call obj.mainloop() on the returned object.
354 Later on you can call obj.mainloop() on the returned object.
342
355
343 Inputs:
356 Inputs:
344
357
345 - user_ns(None): a dict to be used as the user's namespace with initial
358 - user_ns(None): a dict to be used as the user's namespace with initial
346 data.
359 data.
347
360
348 WARNING: This should *not* be run when a session exists already."""
361 WARNING: This should *not* be run when a session exists already."""
349
362
350 import IPython
363 import IPython
351 return IPython.Shell.start(user_ns)
364 return IPython.Shell.start(user_ns)
@@ -1,2538 +1,2542 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.3 or newer.
5 Requires Python 2.3 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 1977 2006-12-11 16:52:12Z fperez $
9 $Id: iplib.py 2014 2007-01-05 10:36:58Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pydoc
50 import pydoc
51 import re
51 import re
52 import shutil
52 import shutil
53 import string
53 import string
54 import sys
54 import sys
55 import tempfile
55 import tempfile
56 import traceback
56 import traceback
57 import types
57 import types
58 import pickleshare
58 import pickleshare
59 from sets import Set
59 from sets import Set
60 from pprint import pprint, pformat
60 from pprint import pprint, pformat
61
61
62 # IPython's own modules
62 # IPython's own modules
63 import IPython
63 import IPython
64 from IPython import OInspect,PyColorize,ultraTB
64 from IPython import OInspect,PyColorize,ultraTB
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.FakeModule import FakeModule
66 from IPython.FakeModule import FakeModule
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Logger import Logger
68 from IPython.Logger import Logger
69 from IPython.Magic import Magic
69 from IPython.Magic import Magic
70 from IPython.Prompts import CachedOutput
70 from IPython.Prompts import CachedOutput
71 from IPython.ipstruct import Struct
71 from IPython.ipstruct import Struct
72 from IPython.background_jobs import BackgroundJobManager
72 from IPython.background_jobs import BackgroundJobManager
73 from IPython.usage import cmd_line_usage,interactive_usage
73 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.genutils import *
74 from IPython.genutils import *
75 from IPython.strdispatch import StrDispatch
75 from IPython.strdispatch import StrDispatch
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class Quitter(object):
129 class Quitter(object):
130 """Simple class to handle exit, similar to Python 2.5's.
130 """Simple class to handle exit, similar to Python 2.5's.
131
131
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
133 doesn't do (obviously, since it doesn't know about ipython)."""
133 doesn't do (obviously, since it doesn't know about ipython)."""
134
134
135 def __init__(self,shell,name):
135 def __init__(self,shell,name):
136 self.shell = shell
136 self.shell = shell
137 self.name = name
137 self.name = name
138
138
139 def __repr__(self):
139 def __repr__(self):
140 return 'Type %s() to exit.' % self.name
140 return 'Type %s() to exit.' % self.name
141 __str__ = __repr__
141 __str__ = __repr__
142
142
143 def __call__(self):
143 def __call__(self):
144 self.shell.exit()
144 self.shell.exit()
145
145
146 class InputList(list):
146 class InputList(list):
147 """Class to store user input.
147 """Class to store user input.
148
148
149 It's basically a list, but slices return a string instead of a list, thus
149 It's basically a list, but slices return a string instead of a list, thus
150 allowing things like (assuming 'In' is an instance):
150 allowing things like (assuming 'In' is an instance):
151
151
152 exec In[4:7]
152 exec In[4:7]
153
153
154 or
154 or
155
155
156 exec In[5:9] + In[14] + In[21:25]"""
156 exec In[5:9] + In[14] + In[21:25]"""
157
157
158 def __getslice__(self,i,j):
158 def __getslice__(self,i,j):
159 return ''.join(list.__getslice__(self,i,j))
159 return ''.join(list.__getslice__(self,i,j))
160
160
161 class SyntaxTB(ultraTB.ListTB):
161 class SyntaxTB(ultraTB.ListTB):
162 """Extension which holds some state: the last exception value"""
162 """Extension which holds some state: the last exception value"""
163
163
164 def __init__(self,color_scheme = 'NoColor'):
164 def __init__(self,color_scheme = 'NoColor'):
165 ultraTB.ListTB.__init__(self,color_scheme)
165 ultraTB.ListTB.__init__(self,color_scheme)
166 self.last_syntax_error = None
166 self.last_syntax_error = None
167
167
168 def __call__(self, etype, value, elist):
168 def __call__(self, etype, value, elist):
169 self.last_syntax_error = value
169 self.last_syntax_error = value
170 ultraTB.ListTB.__call__(self,etype,value,elist)
170 ultraTB.ListTB.__call__(self,etype,value,elist)
171
171
172 def clear_err_state(self):
172 def clear_err_state(self):
173 """Return the current error state and clear it"""
173 """Return the current error state and clear it"""
174 e = self.last_syntax_error
174 e = self.last_syntax_error
175 self.last_syntax_error = None
175 self.last_syntax_error = None
176 return e
176 return e
177
177
178 #****************************************************************************
178 #****************************************************************************
179 # Main IPython class
179 # Main IPython class
180
180
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
182 # until a full rewrite is made. I've cleaned all cross-class uses of
182 # until a full rewrite is made. I've cleaned all cross-class uses of
183 # attributes and methods, but too much user code out there relies on the
183 # attributes and methods, but too much user code out there relies on the
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
185 #
185 #
186 # But at least now, all the pieces have been separated and we could, in
186 # But at least now, all the pieces have been separated and we could, in
187 # principle, stop using the mixin. This will ease the transition to the
187 # principle, stop using the mixin. This will ease the transition to the
188 # chainsaw branch.
188 # chainsaw branch.
189
189
190 # For reference, the following is the list of 'self.foo' uses in the Magic
190 # For reference, the following is the list of 'self.foo' uses in the Magic
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
192 # class, to prevent clashes.
192 # class, to prevent clashes.
193
193
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 # 'self.value']
197 # 'self.value']
198
198
199 class InteractiveShell(object,Magic):
199 class InteractiveShell(object,Magic):
200 """An enhanced console for Python."""
200 """An enhanced console for Python."""
201
201
202 # class attribute to indicate whether the class supports threads or not.
202 # class attribute to indicate whether the class supports threads or not.
203 # Subclasses with thread support should override this as needed.
203 # Subclasses with thread support should override this as needed.
204 isthreaded = False
204 isthreaded = False
205
205
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
207 user_ns = None,user_global_ns=None,banner2='',
207 user_ns = None,user_global_ns=None,banner2='',
208 custom_exceptions=((),None),embedded=False):
208 custom_exceptions=((),None),embedded=False):
209
209
210 # log system
210 # log system
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212
212
213 # some minimal strict typechecks. For some core data structures, I
213 # some minimal strict typechecks. For some core data structures, I
214 # want actual basic python types, not just anything that looks like
214 # want actual basic python types, not just anything that looks like
215 # one. This is especially true for namespaces.
215 # one. This is especially true for namespaces.
216 for ns in (user_ns,user_global_ns):
216 for ns in (user_ns,user_global_ns):
217 if ns is not None and type(ns) != types.DictType:
217 if ns is not None and type(ns) != types.DictType:
218 raise TypeError,'namespace must be a dictionary'
218 raise TypeError,'namespace must be a dictionary'
219
219
220 # Job manager (for jobs run as background threads)
220 # Job manager (for jobs run as background threads)
221 self.jobs = BackgroundJobManager()
221 self.jobs = BackgroundJobManager()
222
222
223 # Store the actual shell's name
223 # Store the actual shell's name
224 self.name = name
224 self.name = name
225
225
226 # We need to know whether the instance is meant for embedding, since
226 # We need to know whether the instance is meant for embedding, since
227 # global/local namespaces need to be handled differently in that case
227 # global/local namespaces need to be handled differently in that case
228 self.embedded = embedded
228 self.embedded = embedded
229
229
230 # command compiler
230 # command compiler
231 self.compile = codeop.CommandCompiler()
231 self.compile = codeop.CommandCompiler()
232
232
233 # User input buffer
233 # User input buffer
234 self.buffer = []
234 self.buffer = []
235
235
236 # Default name given in compilation of code
236 # Default name given in compilation of code
237 self.filename = '<ipython console>'
237 self.filename = '<ipython console>'
238
238
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
241 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.exit = Quitter(self,'exit')
242 __builtin__.quit = Quitter(self,'quit')
242 __builtin__.quit = Quitter(self,'quit')
243
243
244 # Make an empty namespace, which extension writers can rely on both
244 # Make an empty namespace, which extension writers can rely on both
245 # existing and NEVER being used by ipython itself. This gives them a
245 # existing and NEVER being used by ipython itself. This gives them a
246 # convenient location for storing additional information and state
246 # convenient location for storing additional information and state
247 # their extensions may require, without fear of collisions with other
247 # their extensions may require, without fear of collisions with other
248 # ipython names that may develop later.
248 # ipython names that may develop later.
249 self.meta = Struct()
249 self.meta = Struct()
250
250
251 # Create the namespace where the user will operate. user_ns is
251 # Create the namespace where the user will operate. user_ns is
252 # normally the only one used, and it is passed to the exec calls as
252 # normally the only one used, and it is passed to the exec calls as
253 # the locals argument. But we do carry a user_global_ns namespace
253 # the locals argument. But we do carry a user_global_ns namespace
254 # given as the exec 'globals' argument, This is useful in embedding
254 # given as the exec 'globals' argument, This is useful in embedding
255 # situations where the ipython shell opens in a context where the
255 # situations where the ipython shell opens in a context where the
256 # distinction between locals and globals is meaningful.
256 # distinction between locals and globals is meaningful.
257
257
258 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # FIXME. For some strange reason, __builtins__ is showing up at user
259 # level as a dict instead of a module. This is a manual fix, but I
259 # level as a dict instead of a module. This is a manual fix, but I
260 # should really track down where the problem is coming from. Alex
260 # should really track down where the problem is coming from. Alex
261 # Schmolck reported this problem first.
261 # Schmolck reported this problem first.
262
262
263 # A useful post by Alex Martelli on this topic:
263 # A useful post by Alex Martelli on this topic:
264 # Re: inconsistent value from __builtins__
264 # Re: inconsistent value from __builtins__
265 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Von: Alex Martelli <aleaxit@yahoo.com>
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 # Gruppen: comp.lang.python
267 # Gruppen: comp.lang.python
268
268
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 # > <type 'dict'>
271 # > <type 'dict'>
272 # > >>> print type(__builtins__)
272 # > >>> print type(__builtins__)
273 # > <type 'module'>
273 # > <type 'module'>
274 # > Is this difference in return value intentional?
274 # > Is this difference in return value intentional?
275
275
276 # Well, it's documented that '__builtins__' can be either a dictionary
276 # Well, it's documented that '__builtins__' can be either a dictionary
277 # or a module, and it's been that way for a long time. Whether it's
277 # or a module, and it's been that way for a long time. Whether it's
278 # intentional (or sensible), I don't know. In any case, the idea is
278 # intentional (or sensible), I don't know. In any case, the idea is
279 # that if you need to access the built-in namespace directly, you
279 # that if you need to access the built-in namespace directly, you
280 # should start with "import __builtin__" (note, no 's') which will
280 # should start with "import __builtin__" (note, no 's') which will
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282
282
283 # These routines return properly built dicts as needed by the rest of
283 # These routines return properly built dicts as needed by the rest of
284 # the code, and can also be used by extension writers to generate
284 # the code, and can also be used by extension writers to generate
285 # properly initialized namespaces.
285 # properly initialized namespaces.
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
288
288
289 # Assign namespaces
289 # Assign namespaces
290 # This is the namespace where all normal user variables live
290 # This is the namespace where all normal user variables live
291 self.user_ns = user_ns
291 self.user_ns = user_ns
292 # Embedded instances require a separate namespace for globals.
292 # Embedded instances require a separate namespace for globals.
293 # Normally this one is unused by non-embedded instances.
293 # Normally this one is unused by non-embedded instances.
294 self.user_global_ns = user_global_ns
294 self.user_global_ns = user_global_ns
295 # A namespace to keep track of internal data structures to prevent
295 # A namespace to keep track of internal data structures to prevent
296 # them from cluttering user-visible stuff. Will be updated later
296 # them from cluttering user-visible stuff. Will be updated later
297 self.internal_ns = {}
297 self.internal_ns = {}
298
298
299 # Namespace of system aliases. Each entry in the alias
299 # Namespace of system aliases. Each entry in the alias
300 # table must be a 2-tuple of the form (N,name), where N is the number
300 # table must be a 2-tuple of the form (N,name), where N is the number
301 # of positional arguments of the alias.
301 # of positional arguments of the alias.
302 self.alias_table = {}
302 self.alias_table = {}
303
303
304 # A table holding all the namespaces IPython deals with, so that
304 # A table holding all the namespaces IPython deals with, so that
305 # introspection facilities can search easily.
305 # introspection facilities can search easily.
306 self.ns_table = {'user':user_ns,
306 self.ns_table = {'user':user_ns,
307 'user_global':user_global_ns,
307 'user_global':user_global_ns,
308 'alias':self.alias_table,
308 'alias':self.alias_table,
309 'internal':self.internal_ns,
309 'internal':self.internal_ns,
310 'builtin':__builtin__.__dict__
310 'builtin':__builtin__.__dict__
311 }
311 }
312
312
313 # The user namespace MUST have a pointer to the shell itself.
313 # The user namespace MUST have a pointer to the shell itself.
314 self.user_ns[name] = self
314 self.user_ns[name] = self
315
315
316 # We need to insert into sys.modules something that looks like a
316 # We need to insert into sys.modules something that looks like a
317 # module but which accesses the IPython namespace, for shelve and
317 # module but which accesses the IPython namespace, for shelve and
318 # pickle to work interactively. Normally they rely on getting
318 # pickle to work interactively. Normally they rely on getting
319 # everything out of __main__, but for embedding purposes each IPython
319 # everything out of __main__, but for embedding purposes each IPython
320 # instance has its own private namespace, so we can't go shoving
320 # instance has its own private namespace, so we can't go shoving
321 # everything into __main__.
321 # everything into __main__.
322
322
323 # note, however, that we should only do this for non-embedded
323 # note, however, that we should only do this for non-embedded
324 # ipythons, which really mimic the __main__.__dict__ with their own
324 # ipythons, which really mimic the __main__.__dict__ with their own
325 # namespace. Embedded instances, on the other hand, should not do
325 # namespace. Embedded instances, on the other hand, should not do
326 # this because they need to manage the user local/global namespaces
326 # this because they need to manage the user local/global namespaces
327 # only, but they live within a 'normal' __main__ (meaning, they
327 # only, but they live within a 'normal' __main__ (meaning, they
328 # shouldn't overtake the execution environment of the script they're
328 # shouldn't overtake the execution environment of the script they're
329 # embedded in).
329 # embedded in).
330
330
331 if not embedded:
331 if not embedded:
332 try:
332 try:
333 main_name = self.user_ns['__name__']
333 main_name = self.user_ns['__name__']
334 except KeyError:
334 except KeyError:
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 else:
336 else:
337 #print "pickle hack in place" # dbg
337 #print "pickle hack in place" # dbg
338 #print 'main_name:',main_name # dbg
338 #print 'main_name:',main_name # dbg
339 sys.modules[main_name] = FakeModule(self.user_ns)
339 sys.modules[main_name] = FakeModule(self.user_ns)
340
340
341 # List of input with multi-line handling.
341 # List of input with multi-line handling.
342 # Fill its zero entry, user counter starts at 1
342 # Fill its zero entry, user counter starts at 1
343 self.input_hist = InputList(['\n'])
343 self.input_hist = InputList(['\n'])
344 # This one will hold the 'raw' input history, without any
344 # This one will hold the 'raw' input history, without any
345 # pre-processing. This will allow users to retrieve the input just as
345 # pre-processing. This will allow users to retrieve the input just as
346 # it was exactly typed in by the user, with %hist -r.
346 # it was exactly typed in by the user, with %hist -r.
347 self.input_hist_raw = InputList(['\n'])
347 self.input_hist_raw = InputList(['\n'])
348
348
349 # list of visited directories
349 # list of visited directories
350 try:
350 try:
351 self.dir_hist = [os.getcwd()]
351 self.dir_hist = [os.getcwd()]
352 except IOError, e:
352 except IOError, e:
353 self.dir_hist = []
353 self.dir_hist = []
354
354
355 # dict of output history
355 # dict of output history
356 self.output_hist = {}
356 self.output_hist = {}
357
357
358 # dict of things NOT to alias (keywords, builtins and some magics)
358 # dict of things NOT to alias (keywords, builtins and some magics)
359 no_alias = {}
359 no_alias = {}
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 for key in keyword.kwlist + no_alias_magics:
361 for key in keyword.kwlist + no_alias_magics:
362 no_alias[key] = 1
362 no_alias[key] = 1
363 no_alias.update(__builtin__.__dict__)
363 no_alias.update(__builtin__.__dict__)
364 self.no_alias = no_alias
364 self.no_alias = no_alias
365
365
366 # make global variables for user access to these
366 # make global variables for user access to these
367 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_ih'] = self.input_hist
368 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_oh'] = self.output_hist
369 self.user_ns['_dh'] = self.dir_hist
369 self.user_ns['_dh'] = self.dir_hist
370
370
371 # user aliases to input and output histories
371 # user aliases to input and output histories
372 self.user_ns['In'] = self.input_hist
372 self.user_ns['In'] = self.input_hist
373 self.user_ns['Out'] = self.output_hist
373 self.user_ns['Out'] = self.output_hist
374
374
375 # Object variable to store code object waiting execution. This is
375 # Object variable to store code object waiting execution. This is
376 # used mainly by the multithreaded shells, but it can come in handy in
376 # used mainly by the multithreaded shells, but it can come in handy in
377 # other situations. No need to use a Queue here, since it's a single
377 # other situations. No need to use a Queue here, since it's a single
378 # item which gets cleared once run.
378 # item which gets cleared once run.
379 self.code_to_run = None
379 self.code_to_run = None
380
380
381 # escapes for automatic behavior on the command line
381 # escapes for automatic behavior on the command line
382 self.ESC_SHELL = '!'
382 self.ESC_SHELL = '!'
383 self.ESC_HELP = '?'
383 self.ESC_HELP = '?'
384 self.ESC_MAGIC = '%'
384 self.ESC_MAGIC = '%'
385 self.ESC_QUOTE = ','
385 self.ESC_QUOTE = ','
386 self.ESC_QUOTE2 = ';'
386 self.ESC_QUOTE2 = ';'
387 self.ESC_PAREN = '/'
387 self.ESC_PAREN = '/'
388
388
389 # And their associated handlers
389 # And their associated handlers
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
393 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_MAGIC : self.handle_magic,
394 self.ESC_HELP : self.handle_help,
394 self.ESC_HELP : self.handle_help,
395 self.ESC_SHELL : self.handle_shell_escape,
395 self.ESC_SHELL : self.handle_shell_escape,
396 }
396 }
397
397
398 # class initializations
398 # class initializations
399 Magic.__init__(self,self)
399 Magic.__init__(self,self)
400
400
401 # Python source parser/formatter for syntax highlighting
401 # Python source parser/formatter for syntax highlighting
402 pyformat = PyColorize.Parser().format
402 pyformat = PyColorize.Parser().format
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404
404
405 # hooks holds pointers used for user-side customizations
405 # hooks holds pointers used for user-side customizations
406 self.hooks = Struct()
406 self.hooks = Struct()
407
407
408 self.strdispatchers = {}
408 self.strdispatchers = {}
409
409
410 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
411 hooks = IPython.hooks
411 hooks = IPython.hooks
412 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 #print "bound hook",hook_name
415 #print "bound hook",hook_name
416
416
417 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
418 self.exit_now = False
418 self.exit_now = False
419
419
420 self.usage_min = """\
420 self.usage_min = """\
421 An enhanced console for Python.
421 An enhanced console for Python.
422 Some of its features are:
422 Some of its features are:
423 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
424 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
425 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
426 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 """
430 """
431 if usage: self.usage = usage
431 if usage: self.usage = usage
432 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
433
433
434 # Storage
434 # Storage
435 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
436 self.pager = 'less'
436 self.pager = 'less'
437 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
438 self.tempfiles = []
438 self.tempfiles = []
439
439
440 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
441 self.has_readline = False
441 self.has_readline = False
442
442
443 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
444 # logstart method.
444 # logstart method.
445 self.loghead_tpl = \
445 self.loghead_tpl = \
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 #log# opts = %s
448 #log# opts = %s
449 #log# args = %s
449 #log# args = %s
450 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
451 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
452 """
452 """
453 # for pushd/popd management
453 # for pushd/popd management
454 try:
454 try:
455 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
456 except HomeDirError,msg:
456 except HomeDirError,msg:
457 fatal(msg)
457 fatal(msg)
458
458
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460
460
461 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
462
462
463 # The first is similar to os.system, but it doesn't return a value,
463 # The first is similar to os.system, but it doesn't return a value,
464 # and it allows interpolation of variables in the user's namespace.
464 # and it allows interpolation of variables in the user's namespace.
465 self.system = lambda cmd: \
465 self.system = lambda cmd: \
466 shell(self.var_expand(cmd,depth=2),
466 shell(self.var_expand(cmd,depth=2),
467 header=self.rc.system_header,
467 header=self.rc.system_header,
468 verbose=self.rc.system_verbose)
468 verbose=self.rc.system_verbose)
469
469
470 # These are for getoutput and getoutputerror:
470 # These are for getoutput and getoutputerror:
471 self.getoutput = lambda cmd: \
471 self.getoutput = lambda cmd: \
472 getoutput(self.var_expand(cmd,depth=2),
472 getoutput(self.var_expand(cmd,depth=2),
473 header=self.rc.system_header,
473 header=self.rc.system_header,
474 verbose=self.rc.system_verbose)
474 verbose=self.rc.system_verbose)
475
475
476 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
477 getoutputerror(self.var_expand(cmd,depth=2),
477 getoutputerror(self.var_expand(cmd,depth=2),
478 header=self.rc.system_header,
478 header=self.rc.system_header,
479 verbose=self.rc.system_verbose)
479 verbose=self.rc.system_verbose)
480
480
481 # RegExp for splitting line contents into pre-char//first
481 # RegExp for splitting line contents into pre-char//first
482 # word-method//rest. For clarity, each group in on one line.
482 # word-method//rest. For clarity, each group in on one line.
483
483
484 # WARNING: update the regexp if the above escapes are changed, as they
484 # WARNING: update the regexp if the above escapes are changed, as they
485 # are hardwired in.
485 # are hardwired in.
486
486
487 # Don't get carried away with trying to make the autocalling catch too
487 # Don't get carried away with trying to make the autocalling catch too
488 # much: it's better to be conservative rather than to trigger hidden
488 # much: it's better to be conservative rather than to trigger hidden
489 # evals() somewhere and end up causing side effects.
489 # evals() somewhere and end up causing side effects.
490
490
491 self.line_split = re.compile(r'^([\s*,;/])'
491 self.line_split = re.compile(r'^([\s*,;/])'
492 r'([\?\w\.]+\w*\s*)'
492 r'([\?\w\.]+\w*\s*)'
493 r'(\(?.*$)')
493 r'(\(?.*$)')
494
494
495 # Original re, keep around for a while in case changes break something
495 # Original re, keep around for a while in case changes break something
496 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
496 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
497 # r'(\s*[\?\w\.]+\w*\s*)'
497 # r'(\s*[\?\w\.]+\w*\s*)'
498 # r'(\(?.*$)')
498 # r'(\(?.*$)')
499
499
500 # RegExp to identify potential function names
500 # RegExp to identify potential function names
501 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
501 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
502
502
503 # RegExp to exclude strings with this start from autocalling. In
503 # RegExp to exclude strings with this start from autocalling. In
504 # particular, all binary operators should be excluded, so that if foo
504 # particular, all binary operators should be excluded, so that if foo
505 # is callable, foo OP bar doesn't become foo(OP bar), which is
505 # is callable, foo OP bar doesn't become foo(OP bar), which is
506 # invalid. The characters '!=()' don't need to be checked for, as the
506 # invalid. The characters '!=()' don't need to be checked for, as the
507 # _prefilter routine explicitely does so, to catch direct calls and
507 # _prefilter routine explicitely does so, to catch direct calls and
508 # rebindings of existing names.
508 # rebindings of existing names.
509
509
510 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
510 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
511 # it affects the rest of the group in square brackets.
511 # it affects the rest of the group in square brackets.
512 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
512 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
513 '|^is |^not |^in |^and |^or ')
513 '|^is |^not |^in |^and |^or ')
514
514
515 # try to catch also methods for stuff in lists/tuples/dicts: off
515 # try to catch also methods for stuff in lists/tuples/dicts: off
516 # (experimental). For this to work, the line_split regexp would need
516 # (experimental). For this to work, the line_split regexp would need
517 # to be modified so it wouldn't break things at '['. That line is
517 # to be modified so it wouldn't break things at '['. That line is
518 # nasty enough that I shouldn't change it until I can test it _well_.
518 # nasty enough that I shouldn't change it until I can test it _well_.
519 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
519 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
520
520
521 # keep track of where we started running (mainly for crash post-mortem)
521 # keep track of where we started running (mainly for crash post-mortem)
522 self.starting_dir = os.getcwd()
522 self.starting_dir = os.getcwd()
523
523
524 # Various switches which can be set
524 # Various switches which can be set
525 self.CACHELENGTH = 5000 # this is cheap, it's just text
525 self.CACHELENGTH = 5000 # this is cheap, it's just text
526 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
526 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
527 self.banner2 = banner2
527 self.banner2 = banner2
528
528
529 # TraceBack handlers:
529 # TraceBack handlers:
530
530
531 # Syntax error handler.
531 # Syntax error handler.
532 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
532 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
533
533
534 # The interactive one is initialized with an offset, meaning we always
534 # The interactive one is initialized with an offset, meaning we always
535 # want to remove the topmost item in the traceback, which is our own
535 # want to remove the topmost item in the traceback, which is our own
536 # internal code. Valid modes: ['Plain','Context','Verbose']
536 # internal code. Valid modes: ['Plain','Context','Verbose']
537 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
537 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
538 color_scheme='NoColor',
538 color_scheme='NoColor',
539 tb_offset = 1)
539 tb_offset = 1)
540
540
541 # IPython itself shouldn't crash. This will produce a detailed
541 # IPython itself shouldn't crash. This will produce a detailed
542 # post-mortem if it does. But we only install the crash handler for
542 # post-mortem if it does. But we only install the crash handler for
543 # non-threaded shells, the threaded ones use a normal verbose reporter
543 # non-threaded shells, the threaded ones use a normal verbose reporter
544 # and lose the crash handler. This is because exceptions in the main
544 # and lose the crash handler. This is because exceptions in the main
545 # thread (such as in GUI code) propagate directly to sys.excepthook,
545 # thread (such as in GUI code) propagate directly to sys.excepthook,
546 # and there's no point in printing crash dumps for every user exception.
546 # and there's no point in printing crash dumps for every user exception.
547 if self.isthreaded:
547 if self.isthreaded:
548 ipCrashHandler = ultraTB.FormattedTB()
548 ipCrashHandler = ultraTB.FormattedTB()
549 else:
549 else:
550 from IPython import CrashHandler
550 from IPython import CrashHandler
551 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
551 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
552 self.set_crash_handler(ipCrashHandler)
552 self.set_crash_handler(ipCrashHandler)
553
553
554 # and add any custom exception handlers the user may have specified
554 # and add any custom exception handlers the user may have specified
555 self.set_custom_exc(*custom_exceptions)
555 self.set_custom_exc(*custom_exceptions)
556
556
557 # indentation management
557 # indentation management
558 self.autoindent = False
558 self.autoindent = False
559 self.indent_current_nsp = 0
559 self.indent_current_nsp = 0
560
560
561 # Make some aliases automatically
561 # Make some aliases automatically
562 # Prepare list of shell aliases to auto-define
562 # Prepare list of shell aliases to auto-define
563 if os.name == 'posix':
563 if os.name == 'posix':
564 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
564 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
565 'mv mv -i','rm rm -i','cp cp -i',
565 'mv mv -i','rm rm -i','cp cp -i',
566 'cat cat','less less','clear clear',
566 'cat cat','less less','clear clear',
567 # a better ls
567 # a better ls
568 'ls ls -F',
568 'ls ls -F',
569 # long ls
569 # long ls
570 'll ls -lF')
570 'll ls -lF')
571 # Extra ls aliases with color, which need special treatment on BSD
571 # Extra ls aliases with color, which need special treatment on BSD
572 # variants
572 # variants
573 ls_extra = ( # color ls
573 ls_extra = ( # color ls
574 'lc ls -F -o --color',
574 'lc ls -F -o --color',
575 # ls normal files only
575 # ls normal files only
576 'lf ls -F -o --color %l | grep ^-',
576 'lf ls -F -o --color %l | grep ^-',
577 # ls symbolic links
577 # ls symbolic links
578 'lk ls -F -o --color %l | grep ^l',
578 'lk ls -F -o --color %l | grep ^l',
579 # directories or links to directories,
579 # directories or links to directories,
580 'ldir ls -F -o --color %l | grep /$',
580 'ldir ls -F -o --color %l | grep /$',
581 # things which are executable
581 # things which are executable
582 'lx ls -F -o --color %l | grep ^-..x',
582 'lx ls -F -o --color %l | grep ^-..x',
583 )
583 )
584 # The BSDs don't ship GNU ls, so they don't understand the
584 # The BSDs don't ship GNU ls, so they don't understand the
585 # --color switch out of the box
585 # --color switch out of the box
586 if 'bsd' in sys.platform:
586 if 'bsd' in sys.platform:
587 ls_extra = ( # ls normal files only
587 ls_extra = ( # ls normal files only
588 'lf ls -lF | grep ^-',
588 'lf ls -lF | grep ^-',
589 # ls symbolic links
589 # ls symbolic links
590 'lk ls -lF | grep ^l',
590 'lk ls -lF | grep ^l',
591 # directories or links to directories,
591 # directories or links to directories,
592 'ldir ls -lF | grep /$',
592 'ldir ls -lF | grep /$',
593 # things which are executable
593 # things which are executable
594 'lx ls -lF | grep ^-..x',
594 'lx ls -lF | grep ^-..x',
595 )
595 )
596 auto_alias = auto_alias + ls_extra
596 auto_alias = auto_alias + ls_extra
597 elif os.name in ['nt','dos']:
597 elif os.name in ['nt','dos']:
598 auto_alias = ('dir dir /on', 'ls dir /on',
598 auto_alias = ('dir dir /on', 'ls dir /on',
599 'ddir dir /ad /on', 'ldir dir /ad /on',
599 'ddir dir /ad /on', 'ldir dir /ad /on',
600 'mkdir mkdir','rmdir rmdir','echo echo',
600 'mkdir mkdir','rmdir rmdir','echo echo',
601 'ren ren','cls cls','copy copy')
601 'ren ren','cls cls','copy copy')
602 else:
602 else:
603 auto_alias = ()
603 auto_alias = ()
604 self.auto_alias = [s.split(None,1) for s in auto_alias]
604 self.auto_alias = [s.split(None,1) for s in auto_alias]
605 # Call the actual (public) initializer
605 # Call the actual (public) initializer
606 self.init_auto_alias()
606 self.init_auto_alias()
607
607
608 # Produce a public API instance
608 # Produce a public API instance
609 self.api = IPython.ipapi.IPApi(self)
609 self.api = IPython.ipapi.IPApi(self)
610
610
611 # track which builtins we add, so we can clean up later
611 # track which builtins we add, so we can clean up later
612 self.builtins_added = {}
612 self.builtins_added = {}
613 # This method will add the necessary builtins for operation, but
613 # This method will add the necessary builtins for operation, but
614 # tracking what it did via the builtins_added dict.
614 # tracking what it did via the builtins_added dict.
615 self.add_builtins()
615 self.add_builtins()
616
616
617 # end __init__
617 # end __init__
618
618
619 def var_expand(self,cmd,depth=0):
619 def var_expand(self,cmd,depth=0):
620 """Expand python variables in a string.
620 """Expand python variables in a string.
621
621
622 The depth argument indicates how many frames above the caller should
622 The depth argument indicates how many frames above the caller should
623 be walked to look for the local namespace where to expand variables.
623 be walked to look for the local namespace where to expand variables.
624
624
625 The global namespace for expansion is always the user's interactive
625 The global namespace for expansion is always the user's interactive
626 namespace.
626 namespace.
627 """
627 """
628
628
629 return str(ItplNS(cmd.replace('#','\#'),
629 return str(ItplNS(cmd.replace('#','\#'),
630 self.user_ns, # globals
630 self.user_ns, # globals
631 # Skip our own frame in searching for locals:
631 # Skip our own frame in searching for locals:
632 sys._getframe(depth+1).f_locals # locals
632 sys._getframe(depth+1).f_locals # locals
633 ))
633 ))
634
634
635 def pre_config_initialization(self):
635 def pre_config_initialization(self):
636 """Pre-configuration init method
636 """Pre-configuration init method
637
637
638 This is called before the configuration files are processed to
638 This is called before the configuration files are processed to
639 prepare the services the config files might need.
639 prepare the services the config files might need.
640
640
641 self.rc already has reasonable default values at this point.
641 self.rc already has reasonable default values at this point.
642 """
642 """
643 rc = self.rc
643 rc = self.rc
644
644
645 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
645 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
646
646
647 def post_config_initialization(self):
647 def post_config_initialization(self):
648 """Post configuration init method
648 """Post configuration init method
649
649
650 This is called after the configuration files have been processed to
650 This is called after the configuration files have been processed to
651 'finalize' the initialization."""
651 'finalize' the initialization."""
652
652
653 rc = self.rc
653 rc = self.rc
654
654
655 # Object inspector
655 # Object inspector
656 self.inspector = OInspect.Inspector(OInspect.InspectColors,
656 self.inspector = OInspect.Inspector(OInspect.InspectColors,
657 PyColorize.ANSICodeColors,
657 PyColorize.ANSICodeColors,
658 'NoColor',
658 'NoColor',
659 rc.object_info_string_level)
659 rc.object_info_string_level)
660
660
661 # Load readline proper
661 # Load readline proper
662 if rc.readline:
662 if rc.readline:
663 self.init_readline()
663 self.init_readline()
664
664
665 # local shortcut, this is used a LOT
665 # local shortcut, this is used a LOT
666 self.log = self.logger.log
666 self.log = self.logger.log
667
667
668 # Initialize cache, set in/out prompts and printing system
668 # Initialize cache, set in/out prompts and printing system
669 self.outputcache = CachedOutput(self,
669 self.outputcache = CachedOutput(self,
670 rc.cache_size,
670 rc.cache_size,
671 rc.pprint,
671 rc.pprint,
672 input_sep = rc.separate_in,
672 input_sep = rc.separate_in,
673 output_sep = rc.separate_out,
673 output_sep = rc.separate_out,
674 output_sep2 = rc.separate_out2,
674 output_sep2 = rc.separate_out2,
675 ps1 = rc.prompt_in1,
675 ps1 = rc.prompt_in1,
676 ps2 = rc.prompt_in2,
676 ps2 = rc.prompt_in2,
677 ps_out = rc.prompt_out,
677 ps_out = rc.prompt_out,
678 pad_left = rc.prompts_pad_left)
678 pad_left = rc.prompts_pad_left)
679
679
680 # user may have over-ridden the default print hook:
680 # user may have over-ridden the default print hook:
681 try:
681 try:
682 self.outputcache.__class__.display = self.hooks.display
682 self.outputcache.__class__.display = self.hooks.display
683 except AttributeError:
683 except AttributeError:
684 pass
684 pass
685
685
686 # I don't like assigning globally to sys, because it means when
686 # I don't like assigning globally to sys, because it means when
687 # embedding instances, each embedded instance overrides the previous
687 # embedding instances, each embedded instance overrides the previous
688 # choice. But sys.displayhook seems to be called internally by exec,
688 # choice. But sys.displayhook seems to be called internally by exec,
689 # so I don't see a way around it. We first save the original and then
689 # so I don't see a way around it. We first save the original and then
690 # overwrite it.
690 # overwrite it.
691 self.sys_displayhook = sys.displayhook
691 self.sys_displayhook = sys.displayhook
692 sys.displayhook = self.outputcache
692 sys.displayhook = self.outputcache
693
693
694 # Set user colors (don't do it in the constructor above so that it
694 # Set user colors (don't do it in the constructor above so that it
695 # doesn't crash if colors option is invalid)
695 # doesn't crash if colors option is invalid)
696 self.magic_colors(rc.colors)
696 self.magic_colors(rc.colors)
697
697
698 # Set calling of pdb on exceptions
698 # Set calling of pdb on exceptions
699 self.call_pdb = rc.pdb
699 self.call_pdb = rc.pdb
700
700
701 # Load user aliases
701 # Load user aliases
702 for alias in rc.alias:
702 for alias in rc.alias:
703 self.magic_alias(alias)
703 self.magic_alias(alias)
704 self.hooks.late_startup_hook()
704 self.hooks.late_startup_hook()
705
705
706 batchrun = False
706 batchrun = False
707 for batchfile in [path(arg) for arg in self.rc.args
707 for batchfile in [path(arg) for arg in self.rc.args
708 if arg.lower().endswith('.ipy')]:
708 if arg.lower().endswith('.ipy')]:
709 if not batchfile.isfile():
709 if not batchfile.isfile():
710 print "No such batch file:", batchfile
710 print "No such batch file:", batchfile
711 continue
711 continue
712 self.api.runlines(batchfile.text())
712 self.api.runlines(batchfile.text())
713 batchrun = True
713 batchrun = True
714 if batchrun:
714 if batchrun:
715 self.exit_now = True
715 self.exit_now = True
716
716
717 def add_builtins(self):
717 def add_builtins(self):
718 """Store ipython references into the builtin namespace.
718 """Store ipython references into the builtin namespace.
719
719
720 Some parts of ipython operate via builtins injected here, which hold a
720 Some parts of ipython operate via builtins injected here, which hold a
721 reference to IPython itself."""
721 reference to IPython itself."""
722
722
723 # TODO: deprecate all except _ip; 'jobs' should be installed
723 # TODO: deprecate all except _ip; 'jobs' should be installed
724 # by an extension and the rest are under _ip, ipalias is redundant
724 # by an extension and the rest are under _ip, ipalias is redundant
725 builtins_new = dict(__IPYTHON__ = self,
725 builtins_new = dict(__IPYTHON__ = self,
726 ip_set_hook = self.set_hook,
726 ip_set_hook = self.set_hook,
727 jobs = self.jobs,
727 jobs = self.jobs,
728 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
728 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
729 ipalias = wrap_deprecated(self.ipalias),
729 ipalias = wrap_deprecated(self.ipalias),
730 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
730 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
731 _ip = self.api
731 _ip = self.api
732 )
732 )
733 for biname,bival in builtins_new.items():
733 for biname,bival in builtins_new.items():
734 try:
734 try:
735 # store the orignal value so we can restore it
735 # store the orignal value so we can restore it
736 self.builtins_added[biname] = __builtin__.__dict__[biname]
736 self.builtins_added[biname] = __builtin__.__dict__[biname]
737 except KeyError:
737 except KeyError:
738 # or mark that it wasn't defined, and we'll just delete it at
738 # or mark that it wasn't defined, and we'll just delete it at
739 # cleanup
739 # cleanup
740 self.builtins_added[biname] = Undefined
740 self.builtins_added[biname] = Undefined
741 __builtin__.__dict__[biname] = bival
741 __builtin__.__dict__[biname] = bival
742
742
743 # Keep in the builtins a flag for when IPython is active. We set it
743 # Keep in the builtins a flag for when IPython is active. We set it
744 # with setdefault so that multiple nested IPythons don't clobber one
744 # with setdefault so that multiple nested IPythons don't clobber one
745 # another. Each will increase its value by one upon being activated,
745 # another. Each will increase its value by one upon being activated,
746 # which also gives us a way to determine the nesting level.
746 # which also gives us a way to determine the nesting level.
747 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
747 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
748
748
749 def clean_builtins(self):
749 def clean_builtins(self):
750 """Remove any builtins which might have been added by add_builtins, or
750 """Remove any builtins which might have been added by add_builtins, or
751 restore overwritten ones to their previous values."""
751 restore overwritten ones to their previous values."""
752 for biname,bival in self.builtins_added.items():
752 for biname,bival in self.builtins_added.items():
753 if bival is Undefined:
753 if bival is Undefined:
754 del __builtin__.__dict__[biname]
754 del __builtin__.__dict__[biname]
755 else:
755 else:
756 __builtin__.__dict__[biname] = bival
756 __builtin__.__dict__[biname] = bival
757 self.builtins_added.clear()
757 self.builtins_added.clear()
758
758
759 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
759 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
760 """set_hook(name,hook) -> sets an internal IPython hook.
760 """set_hook(name,hook) -> sets an internal IPython hook.
761
761
762 IPython exposes some of its internal API as user-modifiable hooks. By
762 IPython exposes some of its internal API as user-modifiable hooks. By
763 adding your function to one of these hooks, you can modify IPython's
763 adding your function to one of these hooks, you can modify IPython's
764 behavior to call at runtime your own routines."""
764 behavior to call at runtime your own routines."""
765
765
766 # At some point in the future, this should validate the hook before it
766 # At some point in the future, this should validate the hook before it
767 # accepts it. Probably at least check that the hook takes the number
767 # accepts it. Probably at least check that the hook takes the number
768 # of args it's supposed to.
768 # of args it's supposed to.
769
769
770 f = new.instancemethod(hook,self,self.__class__)
770 f = new.instancemethod(hook,self,self.__class__)
771
771
772 # check if the hook is for strdispatcher first
772 # check if the hook is for strdispatcher first
773 if str_key is not None:
773 if str_key is not None:
774 sdp = self.strdispatchers.get(name, StrDispatch())
774 sdp = self.strdispatchers.get(name, StrDispatch())
775 sdp.add_s(str_key, f, priority )
775 sdp.add_s(str_key, f, priority )
776 self.strdispatchers[name] = sdp
776 self.strdispatchers[name] = sdp
777 return
777 return
778 if re_key is not None:
778 if re_key is not None:
779 sdp = self.strdispatchers.get(name, StrDispatch())
779 sdp = self.strdispatchers.get(name, StrDispatch())
780 sdp.add_re(re.compile(re_key), f, priority )
780 sdp.add_re(re.compile(re_key), f, priority )
781 self.strdispatchers[name] = sdp
781 self.strdispatchers[name] = sdp
782 return
782 return
783
783
784 dp = getattr(self.hooks, name, None)
784 dp = getattr(self.hooks, name, None)
785 if name not in IPython.hooks.__all__:
785 if name not in IPython.hooks.__all__:
786 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
786 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
787 if not dp:
787 if not dp:
788 dp = IPython.hooks.CommandChainDispatcher()
788 dp = IPython.hooks.CommandChainDispatcher()
789
789
790 try:
790 try:
791 dp.add(f,priority)
791 dp.add(f,priority)
792 except AttributeError:
792 except AttributeError:
793 # it was not commandchain, plain old func - replace
793 # it was not commandchain, plain old func - replace
794 dp = f
794 dp = f
795
795
796 setattr(self.hooks,name, dp)
796 setattr(self.hooks,name, dp)
797
797
798
798
799 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
799 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
800
800
801 def set_crash_handler(self,crashHandler):
801 def set_crash_handler(self,crashHandler):
802 """Set the IPython crash handler.
802 """Set the IPython crash handler.
803
803
804 This must be a callable with a signature suitable for use as
804 This must be a callable with a signature suitable for use as
805 sys.excepthook."""
805 sys.excepthook."""
806
806
807 # Install the given crash handler as the Python exception hook
807 # Install the given crash handler as the Python exception hook
808 sys.excepthook = crashHandler
808 sys.excepthook = crashHandler
809
809
810 # The instance will store a pointer to this, so that runtime code
810 # The instance will store a pointer to this, so that runtime code
811 # (such as magics) can access it. This is because during the
811 # (such as magics) can access it. This is because during the
812 # read-eval loop, it gets temporarily overwritten (to deal with GUI
812 # read-eval loop, it gets temporarily overwritten (to deal with GUI
813 # frameworks).
813 # frameworks).
814 self.sys_excepthook = sys.excepthook
814 self.sys_excepthook = sys.excepthook
815
815
816
816
817 def set_custom_exc(self,exc_tuple,handler):
817 def set_custom_exc(self,exc_tuple,handler):
818 """set_custom_exc(exc_tuple,handler)
818 """set_custom_exc(exc_tuple,handler)
819
819
820 Set a custom exception handler, which will be called if any of the
820 Set a custom exception handler, which will be called if any of the
821 exceptions in exc_tuple occur in the mainloop (specifically, in the
821 exceptions in exc_tuple occur in the mainloop (specifically, in the
822 runcode() method.
822 runcode() method.
823
823
824 Inputs:
824 Inputs:
825
825
826 - exc_tuple: a *tuple* of valid exceptions to call the defined
826 - exc_tuple: a *tuple* of valid exceptions to call the defined
827 handler for. It is very important that you use a tuple, and NOT A
827 handler for. It is very important that you use a tuple, and NOT A
828 LIST here, because of the way Python's except statement works. If
828 LIST here, because of the way Python's except statement works. If
829 you only want to trap a single exception, use a singleton tuple:
829 you only want to trap a single exception, use a singleton tuple:
830
830
831 exc_tuple == (MyCustomException,)
831 exc_tuple == (MyCustomException,)
832
832
833 - handler: this must be defined as a function with the following
833 - handler: this must be defined as a function with the following
834 basic interface: def my_handler(self,etype,value,tb).
834 basic interface: def my_handler(self,etype,value,tb).
835
835
836 This will be made into an instance method (via new.instancemethod)
836 This will be made into an instance method (via new.instancemethod)
837 of IPython itself, and it will be called if any of the exceptions
837 of IPython itself, and it will be called if any of the exceptions
838 listed in the exc_tuple are caught. If the handler is None, an
838 listed in the exc_tuple are caught. If the handler is None, an
839 internal basic one is used, which just prints basic info.
839 internal basic one is used, which just prints basic info.
840
840
841 WARNING: by putting in your own exception handler into IPython's main
841 WARNING: by putting in your own exception handler into IPython's main
842 execution loop, you run a very good chance of nasty crashes. This
842 execution loop, you run a very good chance of nasty crashes. This
843 facility should only be used if you really know what you are doing."""
843 facility should only be used if you really know what you are doing."""
844
844
845 assert type(exc_tuple)==type(()) , \
845 assert type(exc_tuple)==type(()) , \
846 "The custom exceptions must be given AS A TUPLE."
846 "The custom exceptions must be given AS A TUPLE."
847
847
848 def dummy_handler(self,etype,value,tb):
848 def dummy_handler(self,etype,value,tb):
849 print '*** Simple custom exception handler ***'
849 print '*** Simple custom exception handler ***'
850 print 'Exception type :',etype
850 print 'Exception type :',etype
851 print 'Exception value:',value
851 print 'Exception value:',value
852 print 'Traceback :',tb
852 print 'Traceback :',tb
853 print 'Source code :','\n'.join(self.buffer)
853 print 'Source code :','\n'.join(self.buffer)
854
854
855 if handler is None: handler = dummy_handler
855 if handler is None: handler = dummy_handler
856
856
857 self.CustomTB = new.instancemethod(handler,self,self.__class__)
857 self.CustomTB = new.instancemethod(handler,self,self.__class__)
858 self.custom_exceptions = exc_tuple
858 self.custom_exceptions = exc_tuple
859
859
860 def set_custom_completer(self,completer,pos=0):
860 def set_custom_completer(self,completer,pos=0):
861 """set_custom_completer(completer,pos=0)
861 """set_custom_completer(completer,pos=0)
862
862
863 Adds a new custom completer function.
863 Adds a new custom completer function.
864
864
865 The position argument (defaults to 0) is the index in the completers
865 The position argument (defaults to 0) is the index in the completers
866 list where you want the completer to be inserted."""
866 list where you want the completer to be inserted."""
867
867
868 newcomp = new.instancemethod(completer,self.Completer,
868 newcomp = new.instancemethod(completer,self.Completer,
869 self.Completer.__class__)
869 self.Completer.__class__)
870 self.Completer.matchers.insert(pos,newcomp)
870 self.Completer.matchers.insert(pos,newcomp)
871
871
872 def _get_call_pdb(self):
872 def _get_call_pdb(self):
873 return self._call_pdb
873 return self._call_pdb
874
874
875 def _set_call_pdb(self,val):
875 def _set_call_pdb(self,val):
876
876
877 if val not in (0,1,False,True):
877 if val not in (0,1,False,True):
878 raise ValueError,'new call_pdb value must be boolean'
878 raise ValueError,'new call_pdb value must be boolean'
879
879
880 # store value in instance
880 # store value in instance
881 self._call_pdb = val
881 self._call_pdb = val
882
882
883 # notify the actual exception handlers
883 # notify the actual exception handlers
884 self.InteractiveTB.call_pdb = val
884 self.InteractiveTB.call_pdb = val
885 if self.isthreaded:
885 if self.isthreaded:
886 try:
886 try:
887 self.sys_excepthook.call_pdb = val
887 self.sys_excepthook.call_pdb = val
888 except:
888 except:
889 warn('Failed to activate pdb for threaded exception handler')
889 warn('Failed to activate pdb for threaded exception handler')
890
890
891 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
891 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
892 'Control auto-activation of pdb at exceptions')
892 'Control auto-activation of pdb at exceptions')
893
893
894
894
895 # These special functions get installed in the builtin namespace, to
895 # These special functions get installed in the builtin namespace, to
896 # provide programmatic (pure python) access to magics, aliases and system
896 # provide programmatic (pure python) access to magics, aliases and system
897 # calls. This is important for logging, user scripting, and more.
897 # calls. This is important for logging, user scripting, and more.
898
898
899 # We are basically exposing, via normal python functions, the three
899 # We are basically exposing, via normal python functions, the three
900 # mechanisms in which ipython offers special call modes (magics for
900 # mechanisms in which ipython offers special call modes (magics for
901 # internal control, aliases for direct system access via pre-selected
901 # internal control, aliases for direct system access via pre-selected
902 # names, and !cmd for calling arbitrary system commands).
902 # names, and !cmd for calling arbitrary system commands).
903
903
904 def ipmagic(self,arg_s):
904 def ipmagic(self,arg_s):
905 """Call a magic function by name.
905 """Call a magic function by name.
906
906
907 Input: a string containing the name of the magic function to call and any
907 Input: a string containing the name of the magic function to call and any
908 additional arguments to be passed to the magic.
908 additional arguments to be passed to the magic.
909
909
910 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
910 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
911 prompt:
911 prompt:
912
912
913 In[1]: %name -opt foo bar
913 In[1]: %name -opt foo bar
914
914
915 To call a magic without arguments, simply use ipmagic('name').
915 To call a magic without arguments, simply use ipmagic('name').
916
916
917 This provides a proper Python function to call IPython's magics in any
917 This provides a proper Python function to call IPython's magics in any
918 valid Python code you can type at the interpreter, including loops and
918 valid Python code you can type at the interpreter, including loops and
919 compound statements. It is added by IPython to the Python builtin
919 compound statements. It is added by IPython to the Python builtin
920 namespace upon initialization."""
920 namespace upon initialization."""
921
921
922 args = arg_s.split(' ',1)
922 args = arg_s.split(' ',1)
923 magic_name = args[0]
923 magic_name = args[0]
924 magic_name = magic_name.lstrip(self.ESC_MAGIC)
924 magic_name = magic_name.lstrip(self.ESC_MAGIC)
925
925
926 try:
926 try:
927 magic_args = args[1]
927 magic_args = args[1]
928 except IndexError:
928 except IndexError:
929 magic_args = ''
929 magic_args = ''
930 fn = getattr(self,'magic_'+magic_name,None)
930 fn = getattr(self,'magic_'+magic_name,None)
931 if fn is None:
931 if fn is None:
932 error("Magic function `%s` not found." % magic_name)
932 error("Magic function `%s` not found." % magic_name)
933 else:
933 else:
934 magic_args = self.var_expand(magic_args,1)
934 magic_args = self.var_expand(magic_args,1)
935 return fn(magic_args)
935 return fn(magic_args)
936
936
937 def ipalias(self,arg_s):
937 def ipalias(self,arg_s):
938 """Call an alias by name.
938 """Call an alias by name.
939
939
940 Input: a string containing the name of the alias to call and any
940 Input: a string containing the name of the alias to call and any
941 additional arguments to be passed to the magic.
941 additional arguments to be passed to the magic.
942
942
943 ipalias('name -opt foo bar') is equivalent to typing at the ipython
943 ipalias('name -opt foo bar') is equivalent to typing at the ipython
944 prompt:
944 prompt:
945
945
946 In[1]: name -opt foo bar
946 In[1]: name -opt foo bar
947
947
948 To call an alias without arguments, simply use ipalias('name').
948 To call an alias without arguments, simply use ipalias('name').
949
949
950 This provides a proper Python function to call IPython's aliases in any
950 This provides a proper Python function to call IPython's aliases in any
951 valid Python code you can type at the interpreter, including loops and
951 valid Python code you can type at the interpreter, including loops and
952 compound statements. It is added by IPython to the Python builtin
952 compound statements. It is added by IPython to the Python builtin
953 namespace upon initialization."""
953 namespace upon initialization."""
954
954
955 args = arg_s.split(' ',1)
955 args = arg_s.split(' ',1)
956 alias_name = args[0]
956 alias_name = args[0]
957 try:
957 try:
958 alias_args = args[1]
958 alias_args = args[1]
959 except IndexError:
959 except IndexError:
960 alias_args = ''
960 alias_args = ''
961 if alias_name in self.alias_table:
961 if alias_name in self.alias_table:
962 self.call_alias(alias_name,alias_args)
962 self.call_alias(alias_name,alias_args)
963 else:
963 else:
964 error("Alias `%s` not found." % alias_name)
964 error("Alias `%s` not found." % alias_name)
965
965
966 def ipsystem(self,arg_s):
966 def ipsystem(self,arg_s):
967 """Make a system call, using IPython."""
967 """Make a system call, using IPython."""
968
968
969 self.system(arg_s)
969 self.system(arg_s)
970
970
971 def complete(self,text):
971 def complete(self,text):
972 """Return a sorted list of all possible completions on text.
972 """Return a sorted list of all possible completions on text.
973
973
974 Inputs:
974 Inputs:
975
975
976 - text: a string of text to be completed on.
976 - text: a string of text to be completed on.
977
977
978 This is a wrapper around the completion mechanism, similar to what
978 This is a wrapper around the completion mechanism, similar to what
979 readline does at the command line when the TAB key is hit. By
979 readline does at the command line when the TAB key is hit. By
980 exposing it as a method, it can be used by other non-readline
980 exposing it as a method, it can be used by other non-readline
981 environments (such as GUIs) for text completion.
981 environments (such as GUIs) for text completion.
982
982
983 Simple usage example:
983 Simple usage example:
984
984
985 In [1]: x = 'hello'
985 In [1]: x = 'hello'
986
986
987 In [2]: __IP.complete('x.l')
987 In [2]: __IP.complete('x.l')
988 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
988 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
989
989
990 complete = self.Completer.complete
990 complete = self.Completer.complete
991 state = 0
991 state = 0
992 # use a dict so we get unique keys, since ipyhton's multiple
992 # use a dict so we get unique keys, since ipyhton's multiple
993 # completers can return duplicates.
993 # completers can return duplicates.
994 comps = {}
994 comps = {}
995 while True:
995 while True:
996 newcomp = complete(text,state)
996 newcomp = complete(text,state)
997 if newcomp is None:
997 if newcomp is None:
998 break
998 break
999 comps[newcomp] = 1
999 comps[newcomp] = 1
1000 state += 1
1000 state += 1
1001 outcomps = comps.keys()
1001 outcomps = comps.keys()
1002 outcomps.sort()
1002 outcomps.sort()
1003 return outcomps
1003 return outcomps
1004
1004
1005 def set_completer_frame(self, frame=None):
1005 def set_completer_frame(self, frame=None):
1006 if frame:
1006 if frame:
1007 self.Completer.namespace = frame.f_locals
1007 self.Completer.namespace = frame.f_locals
1008 self.Completer.global_namespace = frame.f_globals
1008 self.Completer.global_namespace = frame.f_globals
1009 else:
1009 else:
1010 self.Completer.namespace = self.user_ns
1010 self.Completer.namespace = self.user_ns
1011 self.Completer.global_namespace = self.user_global_ns
1011 self.Completer.global_namespace = self.user_global_ns
1012
1012
1013 def init_auto_alias(self):
1013 def init_auto_alias(self):
1014 """Define some aliases automatically.
1014 """Define some aliases automatically.
1015
1015
1016 These are ALL parameter-less aliases"""
1016 These are ALL parameter-less aliases"""
1017
1017
1018 for alias,cmd in self.auto_alias:
1018 for alias,cmd in self.auto_alias:
1019 self.alias_table[alias] = (0,cmd)
1019 self.alias_table[alias] = (0,cmd)
1020
1020
1021 def alias_table_validate(self,verbose=0):
1021 def alias_table_validate(self,verbose=0):
1022 """Update information about the alias table.
1022 """Update information about the alias table.
1023
1023
1024 In particular, make sure no Python keywords/builtins are in it."""
1024 In particular, make sure no Python keywords/builtins are in it."""
1025
1025
1026 no_alias = self.no_alias
1026 no_alias = self.no_alias
1027 for k in self.alias_table.keys():
1027 for k in self.alias_table.keys():
1028 if k in no_alias:
1028 if k in no_alias:
1029 del self.alias_table[k]
1029 del self.alias_table[k]
1030 if verbose:
1030 if verbose:
1031 print ("Deleting alias <%s>, it's a Python "
1031 print ("Deleting alias <%s>, it's a Python "
1032 "keyword or builtin." % k)
1032 "keyword or builtin." % k)
1033
1033
1034 def set_autoindent(self,value=None):
1034 def set_autoindent(self,value=None):
1035 """Set the autoindent flag, checking for readline support.
1035 """Set the autoindent flag, checking for readline support.
1036
1036
1037 If called with no arguments, it acts as a toggle."""
1037 If called with no arguments, it acts as a toggle."""
1038
1038
1039 if not self.has_readline:
1039 if not self.has_readline:
1040 if os.name == 'posix':
1040 if os.name == 'posix':
1041 warn("The auto-indent feature requires the readline library")
1041 warn("The auto-indent feature requires the readline library")
1042 self.autoindent = 0
1042 self.autoindent = 0
1043 return
1043 return
1044 if value is None:
1044 if value is None:
1045 self.autoindent = not self.autoindent
1045 self.autoindent = not self.autoindent
1046 else:
1046 else:
1047 self.autoindent = value
1047 self.autoindent = value
1048
1048
1049 def rc_set_toggle(self,rc_field,value=None):
1049 def rc_set_toggle(self,rc_field,value=None):
1050 """Set or toggle a field in IPython's rc config. structure.
1050 """Set or toggle a field in IPython's rc config. structure.
1051
1051
1052 If called with no arguments, it acts as a toggle.
1052 If called with no arguments, it acts as a toggle.
1053
1053
1054 If called with a non-existent field, the resulting AttributeError
1054 If called with a non-existent field, the resulting AttributeError
1055 exception will propagate out."""
1055 exception will propagate out."""
1056
1056
1057 rc_val = getattr(self.rc,rc_field)
1057 rc_val = getattr(self.rc,rc_field)
1058 if value is None:
1058 if value is None:
1059 value = not rc_val
1059 value = not rc_val
1060 setattr(self.rc,rc_field,value)
1060 setattr(self.rc,rc_field,value)
1061
1061
1062 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1062 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1063 """Install the user configuration directory.
1063 """Install the user configuration directory.
1064
1064
1065 Can be called when running for the first time or to upgrade the user's
1065 Can be called when running for the first time or to upgrade the user's
1066 .ipython/ directory with the mode parameter. Valid modes are 'install'
1066 .ipython/ directory with the mode parameter. Valid modes are 'install'
1067 and 'upgrade'."""
1067 and 'upgrade'."""
1068
1068
1069 def wait():
1069 def wait():
1070 try:
1070 try:
1071 raw_input("Please press <RETURN> to start IPython.")
1071 raw_input("Please press <RETURN> to start IPython.")
1072 except EOFError:
1072 except EOFError:
1073 print >> Term.cout
1073 print >> Term.cout
1074 print '*'*70
1074 print '*'*70
1075
1075
1076 cwd = os.getcwd() # remember where we started
1076 cwd = os.getcwd() # remember where we started
1077 glb = glob.glob
1077 glb = glob.glob
1078 print '*'*70
1078 print '*'*70
1079 if mode == 'install':
1079 if mode == 'install':
1080 print \
1080 print \
1081 """Welcome to IPython. I will try to create a personal configuration directory
1081 """Welcome to IPython. I will try to create a personal configuration directory
1082 where you can customize many aspects of IPython's functionality in:\n"""
1082 where you can customize many aspects of IPython's functionality in:\n"""
1083 else:
1083 else:
1084 print 'I am going to upgrade your configuration in:'
1084 print 'I am going to upgrade your configuration in:'
1085
1085
1086 print ipythondir
1086 print ipythondir
1087
1087
1088 rcdirend = os.path.join('IPython','UserConfig')
1088 rcdirend = os.path.join('IPython','UserConfig')
1089 cfg = lambda d: os.path.join(d,rcdirend)
1089 cfg = lambda d: os.path.join(d,rcdirend)
1090 try:
1090 try:
1091 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1091 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1092 except IOError:
1092 except IOError:
1093 warning = """
1093 warning = """
1094 Installation error. IPython's directory was not found.
1094 Installation error. IPython's directory was not found.
1095
1095
1096 Check the following:
1096 Check the following:
1097
1097
1098 The ipython/IPython directory should be in a directory belonging to your
1098 The ipython/IPython directory should be in a directory belonging to your
1099 PYTHONPATH environment variable (that is, it should be in a directory
1099 PYTHONPATH environment variable (that is, it should be in a directory
1100 belonging to sys.path). You can copy it explicitly there or just link to it.
1100 belonging to sys.path). You can copy it explicitly there or just link to it.
1101
1101
1102 IPython will proceed with builtin defaults.
1102 IPython will proceed with builtin defaults.
1103 """
1103 """
1104 warn(warning)
1104 warn(warning)
1105 wait()
1105 wait()
1106 return
1106 return
1107
1107
1108 if mode == 'install':
1108 if mode == 'install':
1109 try:
1109 try:
1110 shutil.copytree(rcdir,ipythondir)
1110 shutil.copytree(rcdir,ipythondir)
1111 os.chdir(ipythondir)
1111 os.chdir(ipythondir)
1112 rc_files = glb("ipythonrc*")
1112 rc_files = glb("ipythonrc*")
1113 for rc_file in rc_files:
1113 for rc_file in rc_files:
1114 os.rename(rc_file,rc_file+rc_suffix)
1114 os.rename(rc_file,rc_file+rc_suffix)
1115 except:
1115 except:
1116 warning = """
1116 warning = """
1117
1117
1118 There was a problem with the installation:
1118 There was a problem with the installation:
1119 %s
1119 %s
1120 Try to correct it or contact the developers if you think it's a bug.
1120 Try to correct it or contact the developers if you think it's a bug.
1121 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1121 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1122 warn(warning)
1122 warn(warning)
1123 wait()
1123 wait()
1124 return
1124 return
1125
1125
1126 elif mode == 'upgrade':
1126 elif mode == 'upgrade':
1127 try:
1127 try:
1128 os.chdir(ipythondir)
1128 os.chdir(ipythondir)
1129 except:
1129 except:
1130 print """
1130 print """
1131 Can not upgrade: changing to directory %s failed. Details:
1131 Can not upgrade: changing to directory %s failed. Details:
1132 %s
1132 %s
1133 """ % (ipythondir,sys.exc_info()[1])
1133 """ % (ipythondir,sys.exc_info()[1])
1134 wait()
1134 wait()
1135 return
1135 return
1136 else:
1136 else:
1137 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1137 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1138 for new_full_path in sources:
1138 for new_full_path in sources:
1139 new_filename = os.path.basename(new_full_path)
1139 new_filename = os.path.basename(new_full_path)
1140 if new_filename.startswith('ipythonrc'):
1140 if new_filename.startswith('ipythonrc'):
1141 new_filename = new_filename + rc_suffix
1141 new_filename = new_filename + rc_suffix
1142 # The config directory should only contain files, skip any
1142 # The config directory should only contain files, skip any
1143 # directories which may be there (like CVS)
1143 # directories which may be there (like CVS)
1144 if os.path.isdir(new_full_path):
1144 if os.path.isdir(new_full_path):
1145 continue
1145 continue
1146 if os.path.exists(new_filename):
1146 if os.path.exists(new_filename):
1147 old_file = new_filename+'.old'
1147 old_file = new_filename+'.old'
1148 if os.path.exists(old_file):
1148 if os.path.exists(old_file):
1149 os.remove(old_file)
1149 os.remove(old_file)
1150 os.rename(new_filename,old_file)
1150 os.rename(new_filename,old_file)
1151 shutil.copy(new_full_path,new_filename)
1151 shutil.copy(new_full_path,new_filename)
1152 else:
1152 else:
1153 raise ValueError,'unrecognized mode for install:',`mode`
1153 raise ValueError,'unrecognized mode for install:',`mode`
1154
1154
1155 # Fix line-endings to those native to each platform in the config
1155 # Fix line-endings to those native to each platform in the config
1156 # directory.
1156 # directory.
1157 try:
1157 try:
1158 os.chdir(ipythondir)
1158 os.chdir(ipythondir)
1159 except:
1159 except:
1160 print """
1160 print """
1161 Problem: changing to directory %s failed.
1161 Problem: changing to directory %s failed.
1162 Details:
1162 Details:
1163 %s
1163 %s
1164
1164
1165 Some configuration files may have incorrect line endings. This should not
1165 Some configuration files may have incorrect line endings. This should not
1166 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1166 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1167 wait()
1167 wait()
1168 else:
1168 else:
1169 for fname in glb('ipythonrc*'):
1169 for fname in glb('ipythonrc*'):
1170 try:
1170 try:
1171 native_line_ends(fname,backup=0)
1171 native_line_ends(fname,backup=0)
1172 except IOError:
1172 except IOError:
1173 pass
1173 pass
1174
1174
1175 if mode == 'install':
1175 if mode == 'install':
1176 print """
1176 print """
1177 Successful installation!
1177 Successful installation!
1178
1178
1179 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1179 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1180 IPython manual (there are both HTML and PDF versions supplied with the
1180 IPython manual (there are both HTML and PDF versions supplied with the
1181 distribution) to make sure that your system environment is properly configured
1181 distribution) to make sure that your system environment is properly configured
1182 to take advantage of IPython's features.
1182 to take advantage of IPython's features.
1183
1183
1184 Important note: the configuration system has changed! The old system is
1184 Important note: the configuration system has changed! The old system is
1185 still in place, but its setting may be partly overridden by the settings in
1185 still in place, but its setting may be partly overridden by the settings in
1186 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1186 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1187 if some of the new settings bother you.
1187 if some of the new settings bother you.
1188
1188
1189 """
1189 """
1190 else:
1190 else:
1191 print """
1191 print """
1192 Successful upgrade!
1192 Successful upgrade!
1193
1193
1194 All files in your directory:
1194 All files in your directory:
1195 %(ipythondir)s
1195 %(ipythondir)s
1196 which would have been overwritten by the upgrade were backed up with a .old
1196 which would have been overwritten by the upgrade were backed up with a .old
1197 extension. If you had made particular customizations in those files you may
1197 extension. If you had made particular customizations in those files you may
1198 want to merge them back into the new files.""" % locals()
1198 want to merge them back into the new files.""" % locals()
1199 wait()
1199 wait()
1200 os.chdir(cwd)
1200 os.chdir(cwd)
1201 # end user_setup()
1201 # end user_setup()
1202
1202
1203 def atexit_operations(self):
1203 def atexit_operations(self):
1204 """This will be executed at the time of exit.
1204 """This will be executed at the time of exit.
1205
1205
1206 Saving of persistent data should be performed here. """
1206 Saving of persistent data should be performed here. """
1207
1207
1208 #print '*** IPython exit cleanup ***' # dbg
1208 #print '*** IPython exit cleanup ***' # dbg
1209 # input history
1209 # input history
1210 self.savehist()
1210 self.savehist()
1211
1211
1212 # Cleanup all tempfiles left around
1212 # Cleanup all tempfiles left around
1213 for tfile in self.tempfiles:
1213 for tfile in self.tempfiles:
1214 try:
1214 try:
1215 os.unlink(tfile)
1215 os.unlink(tfile)
1216 except OSError:
1216 except OSError:
1217 pass
1217 pass
1218
1218
1219 # save the "persistent data" catch-all dictionary
1219 # save the "persistent data" catch-all dictionary
1220 self.hooks.shutdown_hook()
1220 self.hooks.shutdown_hook()
1221
1221
1222 def savehist(self):
1222 def savehist(self):
1223 """Save input history to a file (via readline library)."""
1223 """Save input history to a file (via readline library)."""
1224 try:
1224 try:
1225 self.readline.write_history_file(self.histfile)
1225 self.readline.write_history_file(self.histfile)
1226 except:
1226 except:
1227 print 'Unable to save IPython command history to file: ' + \
1227 print 'Unable to save IPython command history to file: ' + \
1228 `self.histfile`
1228 `self.histfile`
1229
1229
1230 def history_saving_wrapper(self, func):
1230 def history_saving_wrapper(self, func):
1231 """ Wrap func for readline history saving
1231 """ Wrap func for readline history saving
1232
1232
1233 Convert func into callable that saves & restores
1233 Convert func into callable that saves & restores
1234 history around the call """
1234 history around the call """
1235
1235
1236 if not self.has_readline:
1236 if not self.has_readline:
1237 return func
1237 return func
1238
1238
1239 def wrapper():
1239 def wrapper():
1240 self.savehist()
1240 self.savehist()
1241 try:
1241 try:
1242 func()
1242 func()
1243 finally:
1243 finally:
1244 readline.read_history_file(self.histfile)
1244 readline.read_history_file(self.histfile)
1245 return wrapper
1245 return wrapper
1246
1246
1247
1247
1248 def pre_readline(self):
1248 def pre_readline(self):
1249 """readline hook to be used at the start of each line.
1249 """readline hook to be used at the start of each line.
1250
1250
1251 Currently it handles auto-indent only."""
1251 Currently it handles auto-indent only."""
1252
1252
1253 #debugx('self.indent_current_nsp','pre_readline:')
1253 #debugx('self.indent_current_nsp','pre_readline:')
1254 self.readline.insert_text(self.indent_current_str())
1254 self.readline.insert_text(self.indent_current_str())
1255
1255
1256 def init_readline(self):
1256 def init_readline(self):
1257 """Command history completion/saving/reloading."""
1257 """Command history completion/saving/reloading."""
1258
1258
1259 import IPython.rlineimpl as readline
1259 import IPython.rlineimpl as readline
1260 if not readline.have_readline:
1260 if not readline.have_readline:
1261 self.has_readline = 0
1261 self.has_readline = 0
1262 self.readline = None
1262 self.readline = None
1263 # no point in bugging windows users with this every time:
1263 # no point in bugging windows users with this every time:
1264 warn('Readline services not available on this platform.')
1264 warn('Readline services not available on this platform.')
1265 else:
1265 else:
1266 sys.modules['readline'] = readline
1266 sys.modules['readline'] = readline
1267 import atexit
1267 import atexit
1268 from IPython.completer import IPCompleter
1268 from IPython.completer import IPCompleter
1269 self.Completer = IPCompleter(self,
1269 self.Completer = IPCompleter(self,
1270 self.user_ns,
1270 self.user_ns,
1271 self.user_global_ns,
1271 self.user_global_ns,
1272 self.rc.readline_omit__names,
1272 self.rc.readline_omit__names,
1273 self.alias_table)
1273 self.alias_table)
1274 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1274 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1275 self.strdispatchers['complete_command'] = sdisp
1275 self.strdispatchers['complete_command'] = sdisp
1276 self.Completer.custom_completers = sdisp
1276 self.Completer.custom_completers = sdisp
1277 # Platform-specific configuration
1277 # Platform-specific configuration
1278 if os.name == 'nt':
1278 if os.name == 'nt':
1279 self.readline_startup_hook = readline.set_pre_input_hook
1279 self.readline_startup_hook = readline.set_pre_input_hook
1280 else:
1280 else:
1281 self.readline_startup_hook = readline.set_startup_hook
1281 self.readline_startup_hook = readline.set_startup_hook
1282
1282
1283 # Load user's initrc file (readline config)
1283 # Load user's initrc file (readline config)
1284 inputrc_name = os.environ.get('INPUTRC')
1284 inputrc_name = os.environ.get('INPUTRC')
1285 if inputrc_name is None:
1285 if inputrc_name is None:
1286 home_dir = get_home_dir()
1286 home_dir = get_home_dir()
1287 if home_dir is not None:
1287 if home_dir is not None:
1288 inputrc_name = os.path.join(home_dir,'.inputrc')
1288 inputrc_name = os.path.join(home_dir,'.inputrc')
1289 if os.path.isfile(inputrc_name):
1289 if os.path.isfile(inputrc_name):
1290 try:
1290 try:
1291 readline.read_init_file(inputrc_name)
1291 readline.read_init_file(inputrc_name)
1292 except:
1292 except:
1293 warn('Problems reading readline initialization file <%s>'
1293 warn('Problems reading readline initialization file <%s>'
1294 % inputrc_name)
1294 % inputrc_name)
1295
1295
1296 self.has_readline = 1
1296 self.has_readline = 1
1297 self.readline = readline
1297 self.readline = readline
1298 # save this in sys so embedded copies can restore it properly
1298 # save this in sys so embedded copies can restore it properly
1299 sys.ipcompleter = self.Completer.complete
1299 sys.ipcompleter = self.Completer.complete
1300 readline.set_completer(self.Completer.complete)
1300 readline.set_completer(self.Completer.complete)
1301
1301
1302 # Configure readline according to user's prefs
1302 # Configure readline according to user's prefs
1303 for rlcommand in self.rc.readline_parse_and_bind:
1303 for rlcommand in self.rc.readline_parse_and_bind:
1304 readline.parse_and_bind(rlcommand)
1304 readline.parse_and_bind(rlcommand)
1305
1305
1306 # remove some chars from the delimiters list
1306 # remove some chars from the delimiters list
1307 delims = readline.get_completer_delims()
1307 delims = readline.get_completer_delims()
1308 delims = delims.translate(string._idmap,
1308 delims = delims.translate(string._idmap,
1309 self.rc.readline_remove_delims)
1309 self.rc.readline_remove_delims)
1310 readline.set_completer_delims(delims)
1310 readline.set_completer_delims(delims)
1311 # otherwise we end up with a monster history after a while:
1311 # otherwise we end up with a monster history after a while:
1312 readline.set_history_length(1000)
1312 readline.set_history_length(1000)
1313 try:
1313 try:
1314 #print '*** Reading readline history' # dbg
1314 #print '*** Reading readline history' # dbg
1315 readline.read_history_file(self.histfile)
1315 readline.read_history_file(self.histfile)
1316 except IOError:
1316 except IOError:
1317 pass # It doesn't exist yet.
1317 pass # It doesn't exist yet.
1318
1318
1319 atexit.register(self.atexit_operations)
1319 atexit.register(self.atexit_operations)
1320 del atexit
1320 del atexit
1321
1321
1322 # Configure auto-indent for all platforms
1322 # Configure auto-indent for all platforms
1323 self.set_autoindent(self.rc.autoindent)
1323 self.set_autoindent(self.rc.autoindent)
1324
1324
1325 def ask_yes_no(self,prompt,default=True):
1325 def ask_yes_no(self,prompt,default=True):
1326 if self.rc.quiet:
1326 if self.rc.quiet:
1327 return True
1327 return True
1328 return ask_yes_no(prompt,default)
1328 return ask_yes_no(prompt,default)
1329
1329
1330 def _should_recompile(self,e):
1330 def _should_recompile(self,e):
1331 """Utility routine for edit_syntax_error"""
1331 """Utility routine for edit_syntax_error"""
1332
1332
1333 if e.filename in ('<ipython console>','<input>','<string>',
1333 if e.filename in ('<ipython console>','<input>','<string>',
1334 '<console>','<BackgroundJob compilation>',
1334 '<console>','<BackgroundJob compilation>',
1335 None):
1335 None):
1336
1336
1337 return False
1337 return False
1338 try:
1338 try:
1339 if (self.rc.autoedit_syntax and
1339 if (self.rc.autoedit_syntax and
1340 not self.ask_yes_no('Return to editor to correct syntax error? '
1340 not self.ask_yes_no('Return to editor to correct syntax error? '
1341 '[Y/n] ','y')):
1341 '[Y/n] ','y')):
1342 return False
1342 return False
1343 except EOFError:
1343 except EOFError:
1344 return False
1344 return False
1345
1345
1346 def int0(x):
1346 def int0(x):
1347 try:
1347 try:
1348 return int(x)
1348 return int(x)
1349 except TypeError:
1349 except TypeError:
1350 return 0
1350 return 0
1351 # always pass integer line and offset values to editor hook
1351 # always pass integer line and offset values to editor hook
1352 self.hooks.fix_error_editor(e.filename,
1352 self.hooks.fix_error_editor(e.filename,
1353 int0(e.lineno),int0(e.offset),e.msg)
1353 int0(e.lineno),int0(e.offset),e.msg)
1354 return True
1354 return True
1355
1355
1356 def edit_syntax_error(self):
1356 def edit_syntax_error(self):
1357 """The bottom half of the syntax error handler called in the main loop.
1357 """The bottom half of the syntax error handler called in the main loop.
1358
1358
1359 Loop until syntax error is fixed or user cancels.
1359 Loop until syntax error is fixed or user cancels.
1360 """
1360 """
1361
1361
1362 while self.SyntaxTB.last_syntax_error:
1362 while self.SyntaxTB.last_syntax_error:
1363 # copy and clear last_syntax_error
1363 # copy and clear last_syntax_error
1364 err = self.SyntaxTB.clear_err_state()
1364 err = self.SyntaxTB.clear_err_state()
1365 if not self._should_recompile(err):
1365 if not self._should_recompile(err):
1366 return
1366 return
1367 try:
1367 try:
1368 # may set last_syntax_error again if a SyntaxError is raised
1368 # may set last_syntax_error again if a SyntaxError is raised
1369 self.safe_execfile(err.filename,self.user_ns)
1369 self.safe_execfile(err.filename,self.user_ns)
1370 except:
1370 except:
1371 self.showtraceback()
1371 self.showtraceback()
1372 else:
1372 else:
1373 try:
1373 try:
1374 f = file(err.filename)
1374 f = file(err.filename)
1375 try:
1375 try:
1376 sys.displayhook(f.read())
1376 sys.displayhook(f.read())
1377 finally:
1377 finally:
1378 f.close()
1378 f.close()
1379 except:
1379 except:
1380 self.showtraceback()
1380 self.showtraceback()
1381
1381
1382 def showsyntaxerror(self, filename=None):
1382 def showsyntaxerror(self, filename=None):
1383 """Display the syntax error that just occurred.
1383 """Display the syntax error that just occurred.
1384
1384
1385 This doesn't display a stack trace because there isn't one.
1385 This doesn't display a stack trace because there isn't one.
1386
1386
1387 If a filename is given, it is stuffed in the exception instead
1387 If a filename is given, it is stuffed in the exception instead
1388 of what was there before (because Python's parser always uses
1388 of what was there before (because Python's parser always uses
1389 "<string>" when reading from a string).
1389 "<string>" when reading from a string).
1390 """
1390 """
1391 etype, value, last_traceback = sys.exc_info()
1391 etype, value, last_traceback = sys.exc_info()
1392
1392
1393 # See note about these variables in showtraceback() below
1393 # See note about these variables in showtraceback() below
1394 sys.last_type = etype
1394 sys.last_type = etype
1395 sys.last_value = value
1395 sys.last_value = value
1396 sys.last_traceback = last_traceback
1396 sys.last_traceback = last_traceback
1397
1397
1398 if filename and etype is SyntaxError:
1398 if filename and etype is SyntaxError:
1399 # Work hard to stuff the correct filename in the exception
1399 # Work hard to stuff the correct filename in the exception
1400 try:
1400 try:
1401 msg, (dummy_filename, lineno, offset, line) = value
1401 msg, (dummy_filename, lineno, offset, line) = value
1402 except:
1402 except:
1403 # Not the format we expect; leave it alone
1403 # Not the format we expect; leave it alone
1404 pass
1404 pass
1405 else:
1405 else:
1406 # Stuff in the right filename
1406 # Stuff in the right filename
1407 try:
1407 try:
1408 # Assume SyntaxError is a class exception
1408 # Assume SyntaxError is a class exception
1409 value = SyntaxError(msg, (filename, lineno, offset, line))
1409 value = SyntaxError(msg, (filename, lineno, offset, line))
1410 except:
1410 except:
1411 # If that failed, assume SyntaxError is a string
1411 # If that failed, assume SyntaxError is a string
1412 value = msg, (filename, lineno, offset, line)
1412 value = msg, (filename, lineno, offset, line)
1413 self.SyntaxTB(etype,value,[])
1413 self.SyntaxTB(etype,value,[])
1414
1414
1415 def debugger(self,force=False):
1415 def debugger(self,force=False):
1416 """Call the pydb/pdb debugger.
1416 """Call the pydb/pdb debugger.
1417
1417
1418 Keywords:
1418 Keywords:
1419
1419
1420 - force(False): by default, this routine checks the instance call_pdb
1420 - force(False): by default, this routine checks the instance call_pdb
1421 flag and does not actually invoke the debugger if the flag is false.
1421 flag and does not actually invoke the debugger if the flag is false.
1422 The 'force' option forces the debugger to activate even if the flag
1422 The 'force' option forces the debugger to activate even if the flag
1423 is false.
1423 is false.
1424 """
1424 """
1425
1425
1426 if not (force or self.call_pdb):
1426 if not (force or self.call_pdb):
1427 return
1427 return
1428
1428
1429 if not hasattr(sys,'last_traceback'):
1429 if not hasattr(sys,'last_traceback'):
1430 error('No traceback has been produced, nothing to debug.')
1430 error('No traceback has been produced, nothing to debug.')
1431 return
1431 return
1432
1432
1433 have_pydb = False
1433 have_pydb = False
1434 # use pydb if available
1434 # use pydb if available
1435 try:
1435 try:
1436 from pydb import pm
1436 from pydb import pm
1437 have_pydb = True
1437 have_pydb = True
1438 except ImportError:
1438 except ImportError:
1439 pass
1439 pass
1440 if not have_pydb:
1440 if not have_pydb:
1441 # fallback to our internal debugger
1441 # fallback to our internal debugger
1442 pm = lambda : self.InteractiveTB.debugger(force=True)
1442 pm = lambda : self.InteractiveTB.debugger(force=True)
1443 self.history_saving_wrapper(pm)()
1443 self.history_saving_wrapper(pm)()
1444
1444
1445 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1445 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1446 """Display the exception that just occurred.
1446 """Display the exception that just occurred.
1447
1447
1448 If nothing is known about the exception, this is the method which
1448 If nothing is known about the exception, this is the method which
1449 should be used throughout the code for presenting user tracebacks,
1449 should be used throughout the code for presenting user tracebacks,
1450 rather than directly invoking the InteractiveTB object.
1450 rather than directly invoking the InteractiveTB object.
1451
1451
1452 A specific showsyntaxerror() also exists, but this method can take
1452 A specific showsyntaxerror() also exists, but this method can take
1453 care of calling it if needed, so unless you are explicitly catching a
1453 care of calling it if needed, so unless you are explicitly catching a
1454 SyntaxError exception, don't try to analyze the stack manually and
1454 SyntaxError exception, don't try to analyze the stack manually and
1455 simply call this method."""
1455 simply call this method."""
1456
1456
1457 # Though this won't be called by syntax errors in the input line,
1457 # Though this won't be called by syntax errors in the input line,
1458 # there may be SyntaxError cases whith imported code.
1458 # there may be SyntaxError cases whith imported code.
1459 if exc_tuple is None:
1459 if exc_tuple is None:
1460 etype, value, tb = sys.exc_info()
1460 etype, value, tb = sys.exc_info()
1461 else:
1461 else:
1462 etype, value, tb = exc_tuple
1462 etype, value, tb = exc_tuple
1463
1463 if etype is SyntaxError:
1464 if etype is SyntaxError:
1464 self.showsyntaxerror(filename)
1465 self.showsyntaxerror(filename)
1465 else:
1466 else:
1466 # WARNING: these variables are somewhat deprecated and not
1467 # WARNING: these variables are somewhat deprecated and not
1467 # necessarily safe to use in a threaded environment, but tools
1468 # necessarily safe to use in a threaded environment, but tools
1468 # like pdb depend on their existence, so let's set them. If we
1469 # like pdb depend on their existence, so let's set them. If we
1469 # find problems in the field, we'll need to revisit their use.
1470 # find problems in the field, we'll need to revisit their use.
1470 sys.last_type = etype
1471 sys.last_type = etype
1471 sys.last_value = value
1472 sys.last_value = value
1472 sys.last_traceback = tb
1473 sys.last_traceback = tb
1473
1474
1474 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1475 if etype in self.custom_exceptions:
1475 if self.InteractiveTB.call_pdb and self.has_readline:
1476 self.CustomTB(etype,value,tb)
1476 # pdb mucks up readline, fix it back
1477 else:
1477 self.readline.set_completer(self.Completer.complete)
1478 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1479 if self.InteractiveTB.call_pdb and self.has_readline:
1480 # pdb mucks up readline, fix it back
1481 self.readline.set_completer(self.Completer.complete)
1478
1482
1479 def mainloop(self,banner=None):
1483 def mainloop(self,banner=None):
1480 """Creates the local namespace and starts the mainloop.
1484 """Creates the local namespace and starts the mainloop.
1481
1485
1482 If an optional banner argument is given, it will override the
1486 If an optional banner argument is given, it will override the
1483 internally created default banner."""
1487 internally created default banner."""
1484
1488
1485 if self.rc.c: # Emulate Python's -c option
1489 if self.rc.c: # Emulate Python's -c option
1486 self.exec_init_cmd()
1490 self.exec_init_cmd()
1487 if banner is None:
1491 if banner is None:
1488 if not self.rc.banner:
1492 if not self.rc.banner:
1489 banner = ''
1493 banner = ''
1490 # banner is string? Use it directly!
1494 # banner is string? Use it directly!
1491 elif isinstance(self.rc.banner,basestring):
1495 elif isinstance(self.rc.banner,basestring):
1492 banner = self.rc.banner
1496 banner = self.rc.banner
1493 else:
1497 else:
1494 banner = self.BANNER+self.banner2
1498 banner = self.BANNER+self.banner2
1495
1499
1496 self.interact(banner)
1500 self.interact(banner)
1497
1501
1498 def exec_init_cmd(self):
1502 def exec_init_cmd(self):
1499 """Execute a command given at the command line.
1503 """Execute a command given at the command line.
1500
1504
1501 This emulates Python's -c option."""
1505 This emulates Python's -c option."""
1502
1506
1503 #sys.argv = ['-c']
1507 #sys.argv = ['-c']
1504 self.push(self.rc.c)
1508 self.push(self.rc.c)
1505
1509
1506 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1510 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1507 """Embeds IPython into a running python program.
1511 """Embeds IPython into a running python program.
1508
1512
1509 Input:
1513 Input:
1510
1514
1511 - header: An optional header message can be specified.
1515 - header: An optional header message can be specified.
1512
1516
1513 - local_ns, global_ns: working namespaces. If given as None, the
1517 - local_ns, global_ns: working namespaces. If given as None, the
1514 IPython-initialized one is updated with __main__.__dict__, so that
1518 IPython-initialized one is updated with __main__.__dict__, so that
1515 program variables become visible but user-specific configuration
1519 program variables become visible but user-specific configuration
1516 remains possible.
1520 remains possible.
1517
1521
1518 - stack_depth: specifies how many levels in the stack to go to
1522 - stack_depth: specifies how many levels in the stack to go to
1519 looking for namespaces (when local_ns and global_ns are None). This
1523 looking for namespaces (when local_ns and global_ns are None). This
1520 allows an intermediate caller to make sure that this function gets
1524 allows an intermediate caller to make sure that this function gets
1521 the namespace from the intended level in the stack. By default (0)
1525 the namespace from the intended level in the stack. By default (0)
1522 it will get its locals and globals from the immediate caller.
1526 it will get its locals and globals from the immediate caller.
1523
1527
1524 Warning: it's possible to use this in a program which is being run by
1528 Warning: it's possible to use this in a program which is being run by
1525 IPython itself (via %run), but some funny things will happen (a few
1529 IPython itself (via %run), but some funny things will happen (a few
1526 globals get overwritten). In the future this will be cleaned up, as
1530 globals get overwritten). In the future this will be cleaned up, as
1527 there is no fundamental reason why it can't work perfectly."""
1531 there is no fundamental reason why it can't work perfectly."""
1528
1532
1529 # Get locals and globals from caller
1533 # Get locals and globals from caller
1530 if local_ns is None or global_ns is None:
1534 if local_ns is None or global_ns is None:
1531 call_frame = sys._getframe(stack_depth).f_back
1535 call_frame = sys._getframe(stack_depth).f_back
1532
1536
1533 if local_ns is None:
1537 if local_ns is None:
1534 local_ns = call_frame.f_locals
1538 local_ns = call_frame.f_locals
1535 if global_ns is None:
1539 if global_ns is None:
1536 global_ns = call_frame.f_globals
1540 global_ns = call_frame.f_globals
1537
1541
1538 # Update namespaces and fire up interpreter
1542 # Update namespaces and fire up interpreter
1539
1543
1540 # The global one is easy, we can just throw it in
1544 # The global one is easy, we can just throw it in
1541 self.user_global_ns = global_ns
1545 self.user_global_ns = global_ns
1542
1546
1543 # but the user/local one is tricky: ipython needs it to store internal
1547 # but the user/local one is tricky: ipython needs it to store internal
1544 # data, but we also need the locals. We'll copy locals in the user
1548 # data, but we also need the locals. We'll copy locals in the user
1545 # one, but will track what got copied so we can delete them at exit.
1549 # one, but will track what got copied so we can delete them at exit.
1546 # This is so that a later embedded call doesn't see locals from a
1550 # This is so that a later embedded call doesn't see locals from a
1547 # previous call (which most likely existed in a separate scope).
1551 # previous call (which most likely existed in a separate scope).
1548 local_varnames = local_ns.keys()
1552 local_varnames = local_ns.keys()
1549 self.user_ns.update(local_ns)
1553 self.user_ns.update(local_ns)
1550
1554
1551 # Patch for global embedding to make sure that things don't overwrite
1555 # Patch for global embedding to make sure that things don't overwrite
1552 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1556 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1553 # FIXME. Test this a bit more carefully (the if.. is new)
1557 # FIXME. Test this a bit more carefully (the if.. is new)
1554 if local_ns is None and global_ns is None:
1558 if local_ns is None and global_ns is None:
1555 self.user_global_ns.update(__main__.__dict__)
1559 self.user_global_ns.update(__main__.__dict__)
1556
1560
1557 # make sure the tab-completer has the correct frame information, so it
1561 # make sure the tab-completer has the correct frame information, so it
1558 # actually completes using the frame's locals/globals
1562 # actually completes using the frame's locals/globals
1559 self.set_completer_frame()
1563 self.set_completer_frame()
1560
1564
1561 # before activating the interactive mode, we need to make sure that
1565 # before activating the interactive mode, we need to make sure that
1562 # all names in the builtin namespace needed by ipython point to
1566 # all names in the builtin namespace needed by ipython point to
1563 # ourselves, and not to other instances.
1567 # ourselves, and not to other instances.
1564 self.add_builtins()
1568 self.add_builtins()
1565
1569
1566 self.interact(header)
1570 self.interact(header)
1567
1571
1568 # now, purge out the user namespace from anything we might have added
1572 # now, purge out the user namespace from anything we might have added
1569 # from the caller's local namespace
1573 # from the caller's local namespace
1570 delvar = self.user_ns.pop
1574 delvar = self.user_ns.pop
1571 for var in local_varnames:
1575 for var in local_varnames:
1572 delvar(var,None)
1576 delvar(var,None)
1573 # and clean builtins we may have overridden
1577 # and clean builtins we may have overridden
1574 self.clean_builtins()
1578 self.clean_builtins()
1575
1579
1576 def interact(self, banner=None):
1580 def interact(self, banner=None):
1577 """Closely emulate the interactive Python console.
1581 """Closely emulate the interactive Python console.
1578
1582
1579 The optional banner argument specify the banner to print
1583 The optional banner argument specify the banner to print
1580 before the first interaction; by default it prints a banner
1584 before the first interaction; by default it prints a banner
1581 similar to the one printed by the real Python interpreter,
1585 similar to the one printed by the real Python interpreter,
1582 followed by the current class name in parentheses (so as not
1586 followed by the current class name in parentheses (so as not
1583 to confuse this with the real interpreter -- since it's so
1587 to confuse this with the real interpreter -- since it's so
1584 close!).
1588 close!).
1585
1589
1586 """
1590 """
1587
1591
1588 if self.exit_now:
1592 if self.exit_now:
1589 # batch run -> do not interact
1593 # batch run -> do not interact
1590 return
1594 return
1591 cprt = 'Type "copyright", "credits" or "license" for more information.'
1595 cprt = 'Type "copyright", "credits" or "license" for more information.'
1592 if banner is None:
1596 if banner is None:
1593 self.write("Python %s on %s\n%s\n(%s)\n" %
1597 self.write("Python %s on %s\n%s\n(%s)\n" %
1594 (sys.version, sys.platform, cprt,
1598 (sys.version, sys.platform, cprt,
1595 self.__class__.__name__))
1599 self.__class__.__name__))
1596 else:
1600 else:
1597 self.write(banner)
1601 self.write(banner)
1598
1602
1599 more = 0
1603 more = 0
1600
1604
1601 # Mark activity in the builtins
1605 # Mark activity in the builtins
1602 __builtin__.__dict__['__IPYTHON__active'] += 1
1606 __builtin__.__dict__['__IPYTHON__active'] += 1
1603
1607
1604 # exit_now is set by a call to %Exit or %Quit
1608 # exit_now is set by a call to %Exit or %Quit
1605 while not self.exit_now:
1609 while not self.exit_now:
1606 if more:
1610 if more:
1607 prompt = self.hooks.generate_prompt(True)
1611 prompt = self.hooks.generate_prompt(True)
1608 if self.autoindent:
1612 if self.autoindent:
1609 self.readline_startup_hook(self.pre_readline)
1613 self.readline_startup_hook(self.pre_readline)
1610 else:
1614 else:
1611 prompt = self.hooks.generate_prompt(False)
1615 prompt = self.hooks.generate_prompt(False)
1612 try:
1616 try:
1613 line = self.raw_input(prompt,more)
1617 line = self.raw_input(prompt,more)
1614 if self.exit_now:
1618 if self.exit_now:
1615 # quick exit on sys.std[in|out] close
1619 # quick exit on sys.std[in|out] close
1616 break
1620 break
1617 if self.autoindent:
1621 if self.autoindent:
1618 self.readline_startup_hook(None)
1622 self.readline_startup_hook(None)
1619 except KeyboardInterrupt:
1623 except KeyboardInterrupt:
1620 self.write('\nKeyboardInterrupt\n')
1624 self.write('\nKeyboardInterrupt\n')
1621 self.resetbuffer()
1625 self.resetbuffer()
1622 # keep cache in sync with the prompt counter:
1626 # keep cache in sync with the prompt counter:
1623 self.outputcache.prompt_count -= 1
1627 self.outputcache.prompt_count -= 1
1624
1628
1625 if self.autoindent:
1629 if self.autoindent:
1626 self.indent_current_nsp = 0
1630 self.indent_current_nsp = 0
1627 more = 0
1631 more = 0
1628 except EOFError:
1632 except EOFError:
1629 if self.autoindent:
1633 if self.autoindent:
1630 self.readline_startup_hook(None)
1634 self.readline_startup_hook(None)
1631 self.write('\n')
1635 self.write('\n')
1632 self.exit()
1636 self.exit()
1633 except bdb.BdbQuit:
1637 except bdb.BdbQuit:
1634 warn('The Python debugger has exited with a BdbQuit exception.\n'
1638 warn('The Python debugger has exited with a BdbQuit exception.\n'
1635 'Because of how pdb handles the stack, it is impossible\n'
1639 'Because of how pdb handles the stack, it is impossible\n'
1636 'for IPython to properly format this particular exception.\n'
1640 'for IPython to properly format this particular exception.\n'
1637 'IPython will resume normal operation.')
1641 'IPython will resume normal operation.')
1638 except:
1642 except:
1639 # exceptions here are VERY RARE, but they can be triggered
1643 # exceptions here are VERY RARE, but they can be triggered
1640 # asynchronously by signal handlers, for example.
1644 # asynchronously by signal handlers, for example.
1641 self.showtraceback()
1645 self.showtraceback()
1642 else:
1646 else:
1643 more = self.push(line)
1647 more = self.push(line)
1644 if (self.SyntaxTB.last_syntax_error and
1648 if (self.SyntaxTB.last_syntax_error and
1645 self.rc.autoedit_syntax):
1649 self.rc.autoedit_syntax):
1646 self.edit_syntax_error()
1650 self.edit_syntax_error()
1647
1651
1648 # We are off again...
1652 # We are off again...
1649 __builtin__.__dict__['__IPYTHON__active'] -= 1
1653 __builtin__.__dict__['__IPYTHON__active'] -= 1
1650
1654
1651 def excepthook(self, etype, value, tb):
1655 def excepthook(self, etype, value, tb):
1652 """One more defense for GUI apps that call sys.excepthook.
1656 """One more defense for GUI apps that call sys.excepthook.
1653
1657
1654 GUI frameworks like wxPython trap exceptions and call
1658 GUI frameworks like wxPython trap exceptions and call
1655 sys.excepthook themselves. I guess this is a feature that
1659 sys.excepthook themselves. I guess this is a feature that
1656 enables them to keep running after exceptions that would
1660 enables them to keep running after exceptions that would
1657 otherwise kill their mainloop. This is a bother for IPython
1661 otherwise kill their mainloop. This is a bother for IPython
1658 which excepts to catch all of the program exceptions with a try:
1662 which excepts to catch all of the program exceptions with a try:
1659 except: statement.
1663 except: statement.
1660
1664
1661 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1665 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1662 any app directly invokes sys.excepthook, it will look to the user like
1666 any app directly invokes sys.excepthook, it will look to the user like
1663 IPython crashed. In order to work around this, we can disable the
1667 IPython crashed. In order to work around this, we can disable the
1664 CrashHandler and replace it with this excepthook instead, which prints a
1668 CrashHandler and replace it with this excepthook instead, which prints a
1665 regular traceback using our InteractiveTB. In this fashion, apps which
1669 regular traceback using our InteractiveTB. In this fashion, apps which
1666 call sys.excepthook will generate a regular-looking exception from
1670 call sys.excepthook will generate a regular-looking exception from
1667 IPython, and the CrashHandler will only be triggered by real IPython
1671 IPython, and the CrashHandler will only be triggered by real IPython
1668 crashes.
1672 crashes.
1669
1673
1670 This hook should be used sparingly, only in places which are not likely
1674 This hook should be used sparingly, only in places which are not likely
1671 to be true IPython errors.
1675 to be true IPython errors.
1672 """
1676 """
1673 self.showtraceback((etype,value,tb),tb_offset=0)
1677 self.showtraceback((etype,value,tb),tb_offset=0)
1674
1678
1675 def expand_aliases(self,fn,rest):
1679 def expand_aliases(self,fn,rest):
1676 """ Expand multiple levels of aliases:
1680 """ Expand multiple levels of aliases:
1677
1681
1678 if:
1682 if:
1679
1683
1680 alias foo bar /tmp
1684 alias foo bar /tmp
1681 alias baz foo
1685 alias baz foo
1682
1686
1683 then:
1687 then:
1684
1688
1685 baz huhhahhei -> bar /tmp huhhahhei
1689 baz huhhahhei -> bar /tmp huhhahhei
1686
1690
1687 """
1691 """
1688 line = fn + " " + rest
1692 line = fn + " " + rest
1689
1693
1690 done = Set()
1694 done = Set()
1691 while 1:
1695 while 1:
1692 pre,fn,rest = self.split_user_input(line)
1696 pre,fn,rest = self.split_user_input(line)
1693 if fn in self.alias_table:
1697 if fn in self.alias_table:
1694 if fn in done:
1698 if fn in done:
1695 warn("Cyclic alias definition, repeated '%s'" % fn)
1699 warn("Cyclic alias definition, repeated '%s'" % fn)
1696 return ""
1700 return ""
1697 done.add(fn)
1701 done.add(fn)
1698
1702
1699 l2 = self.transform_alias(fn,rest)
1703 l2 = self.transform_alias(fn,rest)
1700 # dir -> dir
1704 # dir -> dir
1701 # print "alias",line, "->",l2 #dbg
1705 # print "alias",line, "->",l2 #dbg
1702 if l2 == line:
1706 if l2 == line:
1703 break
1707 break
1704 # ls -> ls -F should not recurse forever
1708 # ls -> ls -F should not recurse forever
1705 if l2.split(None,1)[0] == line.split(None,1)[0]:
1709 if l2.split(None,1)[0] == line.split(None,1)[0]:
1706 line = l2
1710 line = l2
1707 break
1711 break
1708
1712
1709 line=l2
1713 line=l2
1710
1714
1711
1715
1712 # print "al expand to",line #dbg
1716 # print "al expand to",line #dbg
1713 else:
1717 else:
1714 break
1718 break
1715
1719
1716 return line
1720 return line
1717
1721
1718 def transform_alias(self, alias,rest=''):
1722 def transform_alias(self, alias,rest=''):
1719 """ Transform alias to system command string.
1723 """ Transform alias to system command string.
1720 """
1724 """
1721 nargs,cmd = self.alias_table[alias]
1725 nargs,cmd = self.alias_table[alias]
1722 if ' ' in cmd and os.path.isfile(cmd):
1726 if ' ' in cmd and os.path.isfile(cmd):
1723 cmd = '"%s"' % cmd
1727 cmd = '"%s"' % cmd
1724
1728
1725 # Expand the %l special to be the user's input line
1729 # Expand the %l special to be the user's input line
1726 if cmd.find('%l') >= 0:
1730 if cmd.find('%l') >= 0:
1727 cmd = cmd.replace('%l',rest)
1731 cmd = cmd.replace('%l',rest)
1728 rest = ''
1732 rest = ''
1729 if nargs==0:
1733 if nargs==0:
1730 # Simple, argument-less aliases
1734 # Simple, argument-less aliases
1731 cmd = '%s %s' % (cmd,rest)
1735 cmd = '%s %s' % (cmd,rest)
1732 else:
1736 else:
1733 # Handle aliases with positional arguments
1737 # Handle aliases with positional arguments
1734 args = rest.split(None,nargs)
1738 args = rest.split(None,nargs)
1735 if len(args)< nargs:
1739 if len(args)< nargs:
1736 error('Alias <%s> requires %s arguments, %s given.' %
1740 error('Alias <%s> requires %s arguments, %s given.' %
1737 (alias,nargs,len(args)))
1741 (alias,nargs,len(args)))
1738 return None
1742 return None
1739 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1743 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1740 # Now call the macro, evaluating in the user's namespace
1744 # Now call the macro, evaluating in the user's namespace
1741 #print 'new command: <%r>' % cmd # dbg
1745 #print 'new command: <%r>' % cmd # dbg
1742 return cmd
1746 return cmd
1743
1747
1744 def call_alias(self,alias,rest=''):
1748 def call_alias(self,alias,rest=''):
1745 """Call an alias given its name and the rest of the line.
1749 """Call an alias given its name and the rest of the line.
1746
1750
1747 This is only used to provide backwards compatibility for users of
1751 This is only used to provide backwards compatibility for users of
1748 ipalias(), use of which is not recommended for anymore."""
1752 ipalias(), use of which is not recommended for anymore."""
1749
1753
1750 # Now call the macro, evaluating in the user's namespace
1754 # Now call the macro, evaluating in the user's namespace
1751 cmd = self.transform_alias(alias, rest)
1755 cmd = self.transform_alias(alias, rest)
1752 try:
1756 try:
1753 self.system(cmd)
1757 self.system(cmd)
1754 except:
1758 except:
1755 self.showtraceback()
1759 self.showtraceback()
1756
1760
1757 def indent_current_str(self):
1761 def indent_current_str(self):
1758 """return the current level of indentation as a string"""
1762 """return the current level of indentation as a string"""
1759 return self.indent_current_nsp * ' '
1763 return self.indent_current_nsp * ' '
1760
1764
1761 def autoindent_update(self,line):
1765 def autoindent_update(self,line):
1762 """Keep track of the indent level."""
1766 """Keep track of the indent level."""
1763
1767
1764 #debugx('line')
1768 #debugx('line')
1765 #debugx('self.indent_current_nsp')
1769 #debugx('self.indent_current_nsp')
1766 if self.autoindent:
1770 if self.autoindent:
1767 if line:
1771 if line:
1768 inisp = num_ini_spaces(line)
1772 inisp = num_ini_spaces(line)
1769 if inisp < self.indent_current_nsp:
1773 if inisp < self.indent_current_nsp:
1770 self.indent_current_nsp = inisp
1774 self.indent_current_nsp = inisp
1771
1775
1772 if line[-1] == ':':
1776 if line[-1] == ':':
1773 self.indent_current_nsp += 4
1777 self.indent_current_nsp += 4
1774 elif dedent_re.match(line):
1778 elif dedent_re.match(line):
1775 self.indent_current_nsp -= 4
1779 self.indent_current_nsp -= 4
1776 else:
1780 else:
1777 self.indent_current_nsp = 0
1781 self.indent_current_nsp = 0
1778
1782
1779 def runlines(self,lines):
1783 def runlines(self,lines):
1780 """Run a string of one or more lines of source.
1784 """Run a string of one or more lines of source.
1781
1785
1782 This method is capable of running a string containing multiple source
1786 This method is capable of running a string containing multiple source
1783 lines, as if they had been entered at the IPython prompt. Since it
1787 lines, as if they had been entered at the IPython prompt. Since it
1784 exposes IPython's processing machinery, the given strings can contain
1788 exposes IPython's processing machinery, the given strings can contain
1785 magic calls (%magic), special shell access (!cmd), etc."""
1789 magic calls (%magic), special shell access (!cmd), etc."""
1786
1790
1787 # We must start with a clean buffer, in case this is run from an
1791 # We must start with a clean buffer, in case this is run from an
1788 # interactive IPython session (via a magic, for example).
1792 # interactive IPython session (via a magic, for example).
1789 self.resetbuffer()
1793 self.resetbuffer()
1790 lines = lines.split('\n')
1794 lines = lines.split('\n')
1791 more = 0
1795 more = 0
1792 for line in lines:
1796 for line in lines:
1793 # skip blank lines so we don't mess up the prompt counter, but do
1797 # skip blank lines so we don't mess up the prompt counter, but do
1794 # NOT skip even a blank line if we are in a code block (more is
1798 # NOT skip even a blank line if we are in a code block (more is
1795 # true)
1799 # true)
1796 if line or more:
1800 if line or more:
1797 more = self.push(self.prefilter(line,more))
1801 more = self.push(self.prefilter(line,more))
1798 # IPython's runsource returns None if there was an error
1802 # IPython's runsource returns None if there was an error
1799 # compiling the code. This allows us to stop processing right
1803 # compiling the code. This allows us to stop processing right
1800 # away, so the user gets the error message at the right place.
1804 # away, so the user gets the error message at the right place.
1801 if more is None:
1805 if more is None:
1802 break
1806 break
1803 # final newline in case the input didn't have it, so that the code
1807 # final newline in case the input didn't have it, so that the code
1804 # actually does get executed
1808 # actually does get executed
1805 if more:
1809 if more:
1806 self.push('\n')
1810 self.push('\n')
1807
1811
1808 def runsource(self, source, filename='<input>', symbol='single'):
1812 def runsource(self, source, filename='<input>', symbol='single'):
1809 """Compile and run some source in the interpreter.
1813 """Compile and run some source in the interpreter.
1810
1814
1811 Arguments are as for compile_command().
1815 Arguments are as for compile_command().
1812
1816
1813 One several things can happen:
1817 One several things can happen:
1814
1818
1815 1) The input is incorrect; compile_command() raised an
1819 1) The input is incorrect; compile_command() raised an
1816 exception (SyntaxError or OverflowError). A syntax traceback
1820 exception (SyntaxError or OverflowError). A syntax traceback
1817 will be printed by calling the showsyntaxerror() method.
1821 will be printed by calling the showsyntaxerror() method.
1818
1822
1819 2) The input is incomplete, and more input is required;
1823 2) The input is incomplete, and more input is required;
1820 compile_command() returned None. Nothing happens.
1824 compile_command() returned None. Nothing happens.
1821
1825
1822 3) The input is complete; compile_command() returned a code
1826 3) The input is complete; compile_command() returned a code
1823 object. The code is executed by calling self.runcode() (which
1827 object. The code is executed by calling self.runcode() (which
1824 also handles run-time exceptions, except for SystemExit).
1828 also handles run-time exceptions, except for SystemExit).
1825
1829
1826 The return value is:
1830 The return value is:
1827
1831
1828 - True in case 2
1832 - True in case 2
1829
1833
1830 - False in the other cases, unless an exception is raised, where
1834 - False in the other cases, unless an exception is raised, where
1831 None is returned instead. This can be used by external callers to
1835 None is returned instead. This can be used by external callers to
1832 know whether to continue feeding input or not.
1836 know whether to continue feeding input or not.
1833
1837
1834 The return value can be used to decide whether to use sys.ps1 or
1838 The return value can be used to decide whether to use sys.ps1 or
1835 sys.ps2 to prompt the next line."""
1839 sys.ps2 to prompt the next line."""
1836
1840
1837 # if the source code has leading blanks, add 'if 1:\n' to it
1841 # if the source code has leading blanks, add 'if 1:\n' to it
1838 # this allows execution of indented pasted code. It is tempting
1842 # this allows execution of indented pasted code. It is tempting
1839 # to add '\n' at the end of source to run commands like ' a=1'
1843 # to add '\n' at the end of source to run commands like ' a=1'
1840 # directly, but this fails for more complicated scenarios
1844 # directly, but this fails for more complicated scenarios
1841 if source[:1] in [' ', '\t']:
1845 if source[:1] in [' ', '\t']:
1842 source = 'if 1:\n%s' % source
1846 source = 'if 1:\n%s' % source
1843
1847
1844 try:
1848 try:
1845 code = self.compile(source,filename,symbol)
1849 code = self.compile(source,filename,symbol)
1846 except (OverflowError, SyntaxError, ValueError):
1850 except (OverflowError, SyntaxError, ValueError):
1847 # Case 1
1851 # Case 1
1848 self.showsyntaxerror(filename)
1852 self.showsyntaxerror(filename)
1849 return None
1853 return None
1850
1854
1851 if code is None:
1855 if code is None:
1852 # Case 2
1856 # Case 2
1853 return True
1857 return True
1854
1858
1855 # Case 3
1859 # Case 3
1856 # We store the code object so that threaded shells and
1860 # We store the code object so that threaded shells and
1857 # custom exception handlers can access all this info if needed.
1861 # custom exception handlers can access all this info if needed.
1858 # The source corresponding to this can be obtained from the
1862 # The source corresponding to this can be obtained from the
1859 # buffer attribute as '\n'.join(self.buffer).
1863 # buffer attribute as '\n'.join(self.buffer).
1860 self.code_to_run = code
1864 self.code_to_run = code
1861 # now actually execute the code object
1865 # now actually execute the code object
1862 if self.runcode(code) == 0:
1866 if self.runcode(code) == 0:
1863 return False
1867 return False
1864 else:
1868 else:
1865 return None
1869 return None
1866
1870
1867 def runcode(self,code_obj):
1871 def runcode(self,code_obj):
1868 """Execute a code object.
1872 """Execute a code object.
1869
1873
1870 When an exception occurs, self.showtraceback() is called to display a
1874 When an exception occurs, self.showtraceback() is called to display a
1871 traceback.
1875 traceback.
1872
1876
1873 Return value: a flag indicating whether the code to be run completed
1877 Return value: a flag indicating whether the code to be run completed
1874 successfully:
1878 successfully:
1875
1879
1876 - 0: successful execution.
1880 - 0: successful execution.
1877 - 1: an error occurred.
1881 - 1: an error occurred.
1878 """
1882 """
1879
1883
1880 # Set our own excepthook in case the user code tries to call it
1884 # Set our own excepthook in case the user code tries to call it
1881 # directly, so that the IPython crash handler doesn't get triggered
1885 # directly, so that the IPython crash handler doesn't get triggered
1882 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1886 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1883
1887
1884 # we save the original sys.excepthook in the instance, in case config
1888 # we save the original sys.excepthook in the instance, in case config
1885 # code (such as magics) needs access to it.
1889 # code (such as magics) needs access to it.
1886 self.sys_excepthook = old_excepthook
1890 self.sys_excepthook = old_excepthook
1887 outflag = 1 # happens in more places, so it's easier as default
1891 outflag = 1 # happens in more places, so it's easier as default
1888 try:
1892 try:
1889 try:
1893 try:
1890 # Embedded instances require separate global/local namespaces
1894 # Embedded instances require separate global/local namespaces
1891 # so they can see both the surrounding (local) namespace and
1895 # so they can see both the surrounding (local) namespace and
1892 # the module-level globals when called inside another function.
1896 # the module-level globals when called inside another function.
1893 if self.embedded:
1897 if self.embedded:
1894 exec code_obj in self.user_global_ns, self.user_ns
1898 exec code_obj in self.user_global_ns, self.user_ns
1895 # Normal (non-embedded) instances should only have a single
1899 # Normal (non-embedded) instances should only have a single
1896 # namespace for user code execution, otherwise functions won't
1900 # namespace for user code execution, otherwise functions won't
1897 # see interactive top-level globals.
1901 # see interactive top-level globals.
1898 else:
1902 else:
1899 exec code_obj in self.user_ns
1903 exec code_obj in self.user_ns
1900 finally:
1904 finally:
1901 # Reset our crash handler in place
1905 # Reset our crash handler in place
1902 sys.excepthook = old_excepthook
1906 sys.excepthook = old_excepthook
1903 except SystemExit:
1907 except SystemExit:
1904 self.resetbuffer()
1908 self.resetbuffer()
1905 self.showtraceback()
1909 self.showtraceback()
1906 warn("Type %exit or %quit to exit IPython "
1910 warn("Type %exit or %quit to exit IPython "
1907 "(%Exit or %Quit do so unconditionally).",level=1)
1911 "(%Exit or %Quit do so unconditionally).",level=1)
1908 except self.custom_exceptions:
1912 except self.custom_exceptions:
1909 etype,value,tb = sys.exc_info()
1913 etype,value,tb = sys.exc_info()
1910 self.CustomTB(etype,value,tb)
1914 self.CustomTB(etype,value,tb)
1911 except:
1915 except:
1912 self.showtraceback()
1916 self.showtraceback()
1913 else:
1917 else:
1914 outflag = 0
1918 outflag = 0
1915 if softspace(sys.stdout, 0):
1919 if softspace(sys.stdout, 0):
1916 print
1920 print
1917 # Flush out code object which has been run (and source)
1921 # Flush out code object which has been run (and source)
1918 self.code_to_run = None
1922 self.code_to_run = None
1919 return outflag
1923 return outflag
1920
1924
1921 def push(self, line):
1925 def push(self, line):
1922 """Push a line to the interpreter.
1926 """Push a line to the interpreter.
1923
1927
1924 The line should not have a trailing newline; it may have
1928 The line should not have a trailing newline; it may have
1925 internal newlines. The line is appended to a buffer and the
1929 internal newlines. The line is appended to a buffer and the
1926 interpreter's runsource() method is called with the
1930 interpreter's runsource() method is called with the
1927 concatenated contents of the buffer as source. If this
1931 concatenated contents of the buffer as source. If this
1928 indicates that the command was executed or invalid, the buffer
1932 indicates that the command was executed or invalid, the buffer
1929 is reset; otherwise, the command is incomplete, and the buffer
1933 is reset; otherwise, the command is incomplete, and the buffer
1930 is left as it was after the line was appended. The return
1934 is left as it was after the line was appended. The return
1931 value is 1 if more input is required, 0 if the line was dealt
1935 value is 1 if more input is required, 0 if the line was dealt
1932 with in some way (this is the same as runsource()).
1936 with in some way (this is the same as runsource()).
1933 """
1937 """
1934
1938
1935 # autoindent management should be done here, and not in the
1939 # autoindent management should be done here, and not in the
1936 # interactive loop, since that one is only seen by keyboard input. We
1940 # interactive loop, since that one is only seen by keyboard input. We
1937 # need this done correctly even for code run via runlines (which uses
1941 # need this done correctly even for code run via runlines (which uses
1938 # push).
1942 # push).
1939
1943
1940 #print 'push line: <%s>' % line # dbg
1944 #print 'push line: <%s>' % line # dbg
1941 for subline in line.splitlines():
1945 for subline in line.splitlines():
1942 self.autoindent_update(subline)
1946 self.autoindent_update(subline)
1943 self.buffer.append(line)
1947 self.buffer.append(line)
1944 more = self.runsource('\n'.join(self.buffer), self.filename)
1948 more = self.runsource('\n'.join(self.buffer), self.filename)
1945 if not more:
1949 if not more:
1946 self.resetbuffer()
1950 self.resetbuffer()
1947 return more
1951 return more
1948
1952
1949 def resetbuffer(self):
1953 def resetbuffer(self):
1950 """Reset the input buffer."""
1954 """Reset the input buffer."""
1951 self.buffer[:] = []
1955 self.buffer[:] = []
1952
1956
1953 def raw_input(self,prompt='',continue_prompt=False):
1957 def raw_input(self,prompt='',continue_prompt=False):
1954 """Write a prompt and read a line.
1958 """Write a prompt and read a line.
1955
1959
1956 The returned line does not include the trailing newline.
1960 The returned line does not include the trailing newline.
1957 When the user enters the EOF key sequence, EOFError is raised.
1961 When the user enters the EOF key sequence, EOFError is raised.
1958
1962
1959 Optional inputs:
1963 Optional inputs:
1960
1964
1961 - prompt(''): a string to be printed to prompt the user.
1965 - prompt(''): a string to be printed to prompt the user.
1962
1966
1963 - continue_prompt(False): whether this line is the first one or a
1967 - continue_prompt(False): whether this line is the first one or a
1964 continuation in a sequence of inputs.
1968 continuation in a sequence of inputs.
1965 """
1969 """
1966
1970
1967 try:
1971 try:
1968 line = raw_input_original(prompt)
1972 line = raw_input_original(prompt)
1969 except ValueError:
1973 except ValueError:
1970 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1974 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1971 self.exit_now = True
1975 self.exit_now = True
1972 return ""
1976 return ""
1973
1977
1974
1978
1975 # Try to be reasonably smart about not re-indenting pasted input more
1979 # Try to be reasonably smart about not re-indenting pasted input more
1976 # than necessary. We do this by trimming out the auto-indent initial
1980 # than necessary. We do this by trimming out the auto-indent initial
1977 # spaces, if the user's actual input started itself with whitespace.
1981 # spaces, if the user's actual input started itself with whitespace.
1978 #debugx('self.buffer[-1]')
1982 #debugx('self.buffer[-1]')
1979
1983
1980 if self.autoindent:
1984 if self.autoindent:
1981 if num_ini_spaces(line) > self.indent_current_nsp:
1985 if num_ini_spaces(line) > self.indent_current_nsp:
1982 line = line[self.indent_current_nsp:]
1986 line = line[self.indent_current_nsp:]
1983 self.indent_current_nsp = 0
1987 self.indent_current_nsp = 0
1984
1988
1985 # store the unfiltered input before the user has any chance to modify
1989 # store the unfiltered input before the user has any chance to modify
1986 # it.
1990 # it.
1987 if line.strip():
1991 if line.strip():
1988 if continue_prompt:
1992 if continue_prompt:
1989 self.input_hist_raw[-1] += '%s\n' % line
1993 self.input_hist_raw[-1] += '%s\n' % line
1990 if self.has_readline: # and some config option is set?
1994 if self.has_readline: # and some config option is set?
1991 try:
1995 try:
1992 histlen = self.readline.get_current_history_length()
1996 histlen = self.readline.get_current_history_length()
1993 newhist = self.input_hist_raw[-1].rstrip()
1997 newhist = self.input_hist_raw[-1].rstrip()
1994 self.readline.remove_history_item(histlen-1)
1998 self.readline.remove_history_item(histlen-1)
1995 self.readline.replace_history_item(histlen-2,newhist)
1999 self.readline.replace_history_item(histlen-2,newhist)
1996 except AttributeError:
2000 except AttributeError:
1997 pass # re{move,place}_history_item are new in 2.4.
2001 pass # re{move,place}_history_item are new in 2.4.
1998 else:
2002 else:
1999 self.input_hist_raw.append('%s\n' % line)
2003 self.input_hist_raw.append('%s\n' % line)
2000
2004
2001 try:
2005 try:
2002 lineout = self.prefilter(line,continue_prompt)
2006 lineout = self.prefilter(line,continue_prompt)
2003 except:
2007 except:
2004 # blanket except, in case a user-defined prefilter crashes, so it
2008 # blanket except, in case a user-defined prefilter crashes, so it
2005 # can't take all of ipython with it.
2009 # can't take all of ipython with it.
2006 self.showtraceback()
2010 self.showtraceback()
2007 return ''
2011 return ''
2008 else:
2012 else:
2009 return lineout
2013 return lineout
2010
2014
2011 def split_user_input(self,line):
2015 def split_user_input(self,line):
2012 """Split user input into pre-char, function part and rest."""
2016 """Split user input into pre-char, function part and rest."""
2013
2017
2014 lsplit = self.line_split.match(line)
2018 lsplit = self.line_split.match(line)
2015 if lsplit is None: # no regexp match returns None
2019 if lsplit is None: # no regexp match returns None
2016 try:
2020 try:
2017 iFun,theRest = line.split(None,1)
2021 iFun,theRest = line.split(None,1)
2018 except ValueError:
2022 except ValueError:
2019 iFun,theRest = line,''
2023 iFun,theRest = line,''
2020 pre = re.match('^(\s*)(.*)',line).groups()[0]
2024 pre = re.match('^(\s*)(.*)',line).groups()[0]
2021 else:
2025 else:
2022 pre,iFun,theRest = lsplit.groups()
2026 pre,iFun,theRest = lsplit.groups()
2023
2027
2024 #print 'line:<%s>' % line # dbg
2028 #print 'line:<%s>' % line # dbg
2025 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2029 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2026 return pre,iFun.strip(),theRest
2030 return pre,iFun.strip(),theRest
2027
2031
2028 def _prefilter(self, line, continue_prompt):
2032 def _prefilter(self, line, continue_prompt):
2029 """Calls different preprocessors, depending on the form of line."""
2033 """Calls different preprocessors, depending on the form of line."""
2030
2034
2031 # All handlers *must* return a value, even if it's blank ('').
2035 # All handlers *must* return a value, even if it's blank ('').
2032
2036
2033 # Lines are NOT logged here. Handlers should process the line as
2037 # Lines are NOT logged here. Handlers should process the line as
2034 # needed, update the cache AND log it (so that the input cache array
2038 # needed, update the cache AND log it (so that the input cache array
2035 # stays synced).
2039 # stays synced).
2036
2040
2037 # This function is _very_ delicate, and since it's also the one which
2041 # This function is _very_ delicate, and since it's also the one which
2038 # determines IPython's response to user input, it must be as efficient
2042 # determines IPython's response to user input, it must be as efficient
2039 # as possible. For this reason it has _many_ returns in it, trying
2043 # as possible. For this reason it has _many_ returns in it, trying
2040 # always to exit as quickly as it can figure out what it needs to do.
2044 # always to exit as quickly as it can figure out what it needs to do.
2041
2045
2042 # This function is the main responsible for maintaining IPython's
2046 # This function is the main responsible for maintaining IPython's
2043 # behavior respectful of Python's semantics. So be _very_ careful if
2047 # behavior respectful of Python's semantics. So be _very_ careful if
2044 # making changes to anything here.
2048 # making changes to anything here.
2045
2049
2046 #.....................................................................
2050 #.....................................................................
2047 # Code begins
2051 # Code begins
2048
2052
2049 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2053 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2050
2054
2051 # save the line away in case we crash, so the post-mortem handler can
2055 # save the line away in case we crash, so the post-mortem handler can
2052 # record it
2056 # record it
2053 self._last_input_line = line
2057 self._last_input_line = line
2054
2058
2055 #print '***line: <%s>' % line # dbg
2059 #print '***line: <%s>' % line # dbg
2056
2060
2057 # the input history needs to track even empty lines
2061 # the input history needs to track even empty lines
2058 stripped = line.strip()
2062 stripped = line.strip()
2059
2063
2060 if not stripped:
2064 if not stripped:
2061 if not continue_prompt:
2065 if not continue_prompt:
2062 self.outputcache.prompt_count -= 1
2066 self.outputcache.prompt_count -= 1
2063 return self.handle_normal(line,continue_prompt)
2067 return self.handle_normal(line,continue_prompt)
2064 #return self.handle_normal('',continue_prompt)
2068 #return self.handle_normal('',continue_prompt)
2065
2069
2066 # print '***cont',continue_prompt # dbg
2070 # print '***cont',continue_prompt # dbg
2067 # special handlers are only allowed for single line statements
2071 # special handlers are only allowed for single line statements
2068 if continue_prompt and not self.rc.multi_line_specials:
2072 if continue_prompt and not self.rc.multi_line_specials:
2069 return self.handle_normal(line,continue_prompt)
2073 return self.handle_normal(line,continue_prompt)
2070
2074
2071
2075
2072 # For the rest, we need the structure of the input
2076 # For the rest, we need the structure of the input
2073 pre,iFun,theRest = self.split_user_input(line)
2077 pre,iFun,theRest = self.split_user_input(line)
2074
2078
2075 # See whether any pre-existing handler can take care of it
2079 # See whether any pre-existing handler can take care of it
2076
2080
2077 rewritten = self.hooks.input_prefilter(stripped)
2081 rewritten = self.hooks.input_prefilter(stripped)
2078 if rewritten != stripped: # ok, some prefilter did something
2082 if rewritten != stripped: # ok, some prefilter did something
2079 rewritten = pre + rewritten # add indentation
2083 rewritten = pre + rewritten # add indentation
2080 return self.handle_normal(rewritten)
2084 return self.handle_normal(rewritten)
2081
2085
2082 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2086 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2083
2087
2084 # First check for explicit escapes in the last/first character
2088 # First check for explicit escapes in the last/first character
2085 handler = None
2089 handler = None
2086 if line[-1] == self.ESC_HELP:
2090 if line[-1] == self.ESC_HELP:
2087 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2091 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2088 if handler is None:
2092 if handler is None:
2089 # look at the first character of iFun, NOT of line, so we skip
2093 # look at the first character of iFun, NOT of line, so we skip
2090 # leading whitespace in multiline input
2094 # leading whitespace in multiline input
2091 handler = self.esc_handlers.get(iFun[0:1])
2095 handler = self.esc_handlers.get(iFun[0:1])
2092 if handler is not None:
2096 if handler is not None:
2093 return handler(line,continue_prompt,pre,iFun,theRest)
2097 return handler(line,continue_prompt,pre,iFun,theRest)
2094 # Emacs ipython-mode tags certain input lines
2098 # Emacs ipython-mode tags certain input lines
2095 if line.endswith('# PYTHON-MODE'):
2099 if line.endswith('# PYTHON-MODE'):
2096 return self.handle_emacs(line,continue_prompt)
2100 return self.handle_emacs(line,continue_prompt)
2097
2101
2098 # Next, check if we can automatically execute this thing
2102 # Next, check if we can automatically execute this thing
2099
2103
2100 # Allow ! in multi-line statements if multi_line_specials is on:
2104 # Allow ! in multi-line statements if multi_line_specials is on:
2101 if continue_prompt and self.rc.multi_line_specials and \
2105 if continue_prompt and self.rc.multi_line_specials and \
2102 iFun.startswith(self.ESC_SHELL):
2106 iFun.startswith(self.ESC_SHELL):
2103 return self.handle_shell_escape(line,continue_prompt,
2107 return self.handle_shell_escape(line,continue_prompt,
2104 pre=pre,iFun=iFun,
2108 pre=pre,iFun=iFun,
2105 theRest=theRest)
2109 theRest=theRest)
2106
2110
2107 # Let's try to find if the input line is a magic fn
2111 # Let's try to find if the input line is a magic fn
2108 oinfo = None
2112 oinfo = None
2109 if hasattr(self,'magic_'+iFun):
2113 if hasattr(self,'magic_'+iFun):
2110 # WARNING: _ofind uses getattr(), so it can consume generators and
2114 # WARNING: _ofind uses getattr(), so it can consume generators and
2111 # cause other side effects.
2115 # cause other side effects.
2112 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2116 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2113 if oinfo['ismagic']:
2117 if oinfo['ismagic']:
2114 # Be careful not to call magics when a variable assignment is
2118 # Be careful not to call magics when a variable assignment is
2115 # being made (ls='hi', for example)
2119 # being made (ls='hi', for example)
2116 if self.rc.automagic and \
2120 if self.rc.automagic and \
2117 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2121 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2118 (self.rc.multi_line_specials or not continue_prompt):
2122 (self.rc.multi_line_specials or not continue_prompt):
2119 return self.handle_magic(line,continue_prompt,
2123 return self.handle_magic(line,continue_prompt,
2120 pre,iFun,theRest)
2124 pre,iFun,theRest)
2121 else:
2125 else:
2122 return self.handle_normal(line,continue_prompt)
2126 return self.handle_normal(line,continue_prompt)
2123
2127
2124 # If the rest of the line begins with an (in)equality, assginment or
2128 # If the rest of the line begins with an (in)equality, assginment or
2125 # function call, we should not call _ofind but simply execute it.
2129 # function call, we should not call _ofind but simply execute it.
2126 # This avoids spurious geattr() accesses on objects upon assignment.
2130 # This avoids spurious geattr() accesses on objects upon assignment.
2127 #
2131 #
2128 # It also allows users to assign to either alias or magic names true
2132 # It also allows users to assign to either alias or magic names true
2129 # python variables (the magic/alias systems always take second seat to
2133 # python variables (the magic/alias systems always take second seat to
2130 # true python code).
2134 # true python code).
2131 if theRest and theRest[0] in '!=()':
2135 if theRest and theRest[0] in '!=()':
2132 return self.handle_normal(line,continue_prompt)
2136 return self.handle_normal(line,continue_prompt)
2133
2137
2134 if oinfo is None:
2138 if oinfo is None:
2135 # let's try to ensure that _oinfo is ONLY called when autocall is
2139 # let's try to ensure that _oinfo is ONLY called when autocall is
2136 # on. Since it has inevitable potential side effects, at least
2140 # on. Since it has inevitable potential side effects, at least
2137 # having autocall off should be a guarantee to the user that no
2141 # having autocall off should be a guarantee to the user that no
2138 # weird things will happen.
2142 # weird things will happen.
2139
2143
2140 if self.rc.autocall:
2144 if self.rc.autocall:
2141 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2145 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2142 else:
2146 else:
2143 # in this case, all that's left is either an alias or
2147 # in this case, all that's left is either an alias or
2144 # processing the line normally.
2148 # processing the line normally.
2145 if iFun in self.alias_table:
2149 if iFun in self.alias_table:
2146 # if autocall is off, by not running _ofind we won't know
2150 # if autocall is off, by not running _ofind we won't know
2147 # whether the given name may also exist in one of the
2151 # whether the given name may also exist in one of the
2148 # user's namespace. At this point, it's best to do a
2152 # user's namespace. At this point, it's best to do a
2149 # quick check just to be sure that we don't let aliases
2153 # quick check just to be sure that we don't let aliases
2150 # shadow variables.
2154 # shadow variables.
2151 head = iFun.split('.',1)[0]
2155 head = iFun.split('.',1)[0]
2152 if head in self.user_ns or head in self.internal_ns \
2156 if head in self.user_ns or head in self.internal_ns \
2153 or head in __builtin__.__dict__:
2157 or head in __builtin__.__dict__:
2154 return self.handle_normal(line,continue_prompt)
2158 return self.handle_normal(line,continue_prompt)
2155 else:
2159 else:
2156 return self.handle_alias(line,continue_prompt,
2160 return self.handle_alias(line,continue_prompt,
2157 pre,iFun,theRest)
2161 pre,iFun,theRest)
2158
2162
2159 else:
2163 else:
2160 return self.handle_normal(line,continue_prompt)
2164 return self.handle_normal(line,continue_prompt)
2161
2165
2162 if not oinfo['found']:
2166 if not oinfo['found']:
2163 return self.handle_normal(line,continue_prompt)
2167 return self.handle_normal(line,continue_prompt)
2164 else:
2168 else:
2165 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2169 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2166 if oinfo['isalias']:
2170 if oinfo['isalias']:
2167 return self.handle_alias(line,continue_prompt,
2171 return self.handle_alias(line,continue_prompt,
2168 pre,iFun,theRest)
2172 pre,iFun,theRest)
2169
2173
2170 if (self.rc.autocall
2174 if (self.rc.autocall
2171 and
2175 and
2172 (
2176 (
2173 #only consider exclusion re if not "," or ";" autoquoting
2177 #only consider exclusion re if not "," or ";" autoquoting
2174 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2178 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2175 or pre == self.ESC_PAREN) or
2179 or pre == self.ESC_PAREN) or
2176 (not self.re_exclude_auto.match(theRest)))
2180 (not self.re_exclude_auto.match(theRest)))
2177 and
2181 and
2178 self.re_fun_name.match(iFun) and
2182 self.re_fun_name.match(iFun) and
2179 callable(oinfo['obj'])) :
2183 callable(oinfo['obj'])) :
2180 #print 'going auto' # dbg
2184 #print 'going auto' # dbg
2181 return self.handle_auto(line,continue_prompt,
2185 return self.handle_auto(line,continue_prompt,
2182 pre,iFun,theRest,oinfo['obj'])
2186 pre,iFun,theRest,oinfo['obj'])
2183 else:
2187 else:
2184 #print 'was callable?', callable(oinfo['obj']) # dbg
2188 #print 'was callable?', callable(oinfo['obj']) # dbg
2185 return self.handle_normal(line,continue_prompt)
2189 return self.handle_normal(line,continue_prompt)
2186
2190
2187 # If we get here, we have a normal Python line. Log and return.
2191 # If we get here, we have a normal Python line. Log and return.
2188 return self.handle_normal(line,continue_prompt)
2192 return self.handle_normal(line,continue_prompt)
2189
2193
2190 def _prefilter_dumb(self, line, continue_prompt):
2194 def _prefilter_dumb(self, line, continue_prompt):
2191 """simple prefilter function, for debugging"""
2195 """simple prefilter function, for debugging"""
2192 return self.handle_normal(line,continue_prompt)
2196 return self.handle_normal(line,continue_prompt)
2193
2197
2194
2198
2195 def multiline_prefilter(self, line, continue_prompt):
2199 def multiline_prefilter(self, line, continue_prompt):
2196 """ Run _prefilter for each line of input
2200 """ Run _prefilter for each line of input
2197
2201
2198 Covers cases where there are multiple lines in the user entry,
2202 Covers cases where there are multiple lines in the user entry,
2199 which is the case when the user goes back to a multiline history
2203 which is the case when the user goes back to a multiline history
2200 entry and presses enter.
2204 entry and presses enter.
2201
2205
2202 """
2206 """
2203 out = []
2207 out = []
2204 for l in line.rstrip('\n').split('\n'):
2208 for l in line.rstrip('\n').split('\n'):
2205 out.append(self._prefilter(l, continue_prompt))
2209 out.append(self._prefilter(l, continue_prompt))
2206 return '\n'.join(out)
2210 return '\n'.join(out)
2207
2211
2208 # Set the default prefilter() function (this can be user-overridden)
2212 # Set the default prefilter() function (this can be user-overridden)
2209 prefilter = multiline_prefilter
2213 prefilter = multiline_prefilter
2210
2214
2211 def handle_normal(self,line,continue_prompt=None,
2215 def handle_normal(self,line,continue_prompt=None,
2212 pre=None,iFun=None,theRest=None):
2216 pre=None,iFun=None,theRest=None):
2213 """Handle normal input lines. Use as a template for handlers."""
2217 """Handle normal input lines. Use as a template for handlers."""
2214
2218
2215 # With autoindent on, we need some way to exit the input loop, and I
2219 # With autoindent on, we need some way to exit the input loop, and I
2216 # don't want to force the user to have to backspace all the way to
2220 # don't want to force the user to have to backspace all the way to
2217 # clear the line. The rule will be in this case, that either two
2221 # clear the line. The rule will be in this case, that either two
2218 # lines of pure whitespace in a row, or a line of pure whitespace but
2222 # lines of pure whitespace in a row, or a line of pure whitespace but
2219 # of a size different to the indent level, will exit the input loop.
2223 # of a size different to the indent level, will exit the input loop.
2220
2224
2221 if (continue_prompt and self.autoindent and line.isspace() and
2225 if (continue_prompt and self.autoindent and line.isspace() and
2222 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2226 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2223 (self.buffer[-1]).isspace() )):
2227 (self.buffer[-1]).isspace() )):
2224 line = ''
2228 line = ''
2225
2229
2226 self.log(line,line,continue_prompt)
2230 self.log(line,line,continue_prompt)
2227 return line
2231 return line
2228
2232
2229 def handle_alias(self,line,continue_prompt=None,
2233 def handle_alias(self,line,continue_prompt=None,
2230 pre=None,iFun=None,theRest=None):
2234 pre=None,iFun=None,theRest=None):
2231 """Handle alias input lines. """
2235 """Handle alias input lines. """
2232
2236
2233 # pre is needed, because it carries the leading whitespace. Otherwise
2237 # pre is needed, because it carries the leading whitespace. Otherwise
2234 # aliases won't work in indented sections.
2238 # aliases won't work in indented sections.
2235 transformed = self.expand_aliases(iFun, theRest)
2239 transformed = self.expand_aliases(iFun, theRest)
2236 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2240 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2237 self.log(line,line_out,continue_prompt)
2241 self.log(line,line_out,continue_prompt)
2238 #print 'line out:',line_out # dbg
2242 #print 'line out:',line_out # dbg
2239 return line_out
2243 return line_out
2240
2244
2241 def handle_shell_escape(self, line, continue_prompt=None,
2245 def handle_shell_escape(self, line, continue_prompt=None,
2242 pre=None,iFun=None,theRest=None):
2246 pre=None,iFun=None,theRest=None):
2243 """Execute the line in a shell, empty return value"""
2247 """Execute the line in a shell, empty return value"""
2244
2248
2245 #print 'line in :', `line` # dbg
2249 #print 'line in :', `line` # dbg
2246 # Example of a special handler. Others follow a similar pattern.
2250 # Example of a special handler. Others follow a similar pattern.
2247 if line.lstrip().startswith('!!'):
2251 if line.lstrip().startswith('!!'):
2248 # rewrite iFun/theRest to properly hold the call to %sx and
2252 # rewrite iFun/theRest to properly hold the call to %sx and
2249 # the actual command to be executed, so handle_magic can work
2253 # the actual command to be executed, so handle_magic can work
2250 # correctly
2254 # correctly
2251 theRest = '%s %s' % (iFun[2:],theRest)
2255 theRest = '%s %s' % (iFun[2:],theRest)
2252 iFun = 'sx'
2256 iFun = 'sx'
2253 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2257 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2254 line.lstrip()[2:]),
2258 line.lstrip()[2:]),
2255 continue_prompt,pre,iFun,theRest)
2259 continue_prompt,pre,iFun,theRest)
2256 else:
2260 else:
2257 cmd=line.lstrip().lstrip('!')
2261 cmd=line.lstrip().lstrip('!')
2258 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2262 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2259 # update cache/log and return
2263 # update cache/log and return
2260 self.log(line,line_out,continue_prompt)
2264 self.log(line,line_out,continue_prompt)
2261 return line_out
2265 return line_out
2262
2266
2263 def handle_magic(self, line, continue_prompt=None,
2267 def handle_magic(self, line, continue_prompt=None,
2264 pre=None,iFun=None,theRest=None):
2268 pre=None,iFun=None,theRest=None):
2265 """Execute magic functions."""
2269 """Execute magic functions."""
2266
2270
2267
2271
2268 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2272 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2269 self.log(line,cmd,continue_prompt)
2273 self.log(line,cmd,continue_prompt)
2270 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2274 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2271 return cmd
2275 return cmd
2272
2276
2273 def handle_auto(self, line, continue_prompt=None,
2277 def handle_auto(self, line, continue_prompt=None,
2274 pre=None,iFun=None,theRest=None,obj=None):
2278 pre=None,iFun=None,theRest=None,obj=None):
2275 """Hande lines which can be auto-executed, quoting if requested."""
2279 """Hande lines which can be auto-executed, quoting if requested."""
2276
2280
2277 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2281 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2278
2282
2279 # This should only be active for single-line input!
2283 # This should only be active for single-line input!
2280 if continue_prompt:
2284 if continue_prompt:
2281 self.log(line,line,continue_prompt)
2285 self.log(line,line,continue_prompt)
2282 return line
2286 return line
2283
2287
2284 auto_rewrite = True
2288 auto_rewrite = True
2285
2289
2286 if pre == self.ESC_QUOTE:
2290 if pre == self.ESC_QUOTE:
2287 # Auto-quote splitting on whitespace
2291 # Auto-quote splitting on whitespace
2288 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2292 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2289 elif pre == self.ESC_QUOTE2:
2293 elif pre == self.ESC_QUOTE2:
2290 # Auto-quote whole string
2294 # Auto-quote whole string
2291 newcmd = '%s("%s")' % (iFun,theRest)
2295 newcmd = '%s("%s")' % (iFun,theRest)
2292 elif pre == self.ESC_PAREN:
2296 elif pre == self.ESC_PAREN:
2293 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2297 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2294 else:
2298 else:
2295 # Auto-paren.
2299 # Auto-paren.
2296 # We only apply it to argument-less calls if the autocall
2300 # We only apply it to argument-less calls if the autocall
2297 # parameter is set to 2. We only need to check that autocall is <
2301 # parameter is set to 2. We only need to check that autocall is <
2298 # 2, since this function isn't called unless it's at least 1.
2302 # 2, since this function isn't called unless it's at least 1.
2299 if not theRest and (self.rc.autocall < 2):
2303 if not theRest and (self.rc.autocall < 2):
2300 newcmd = '%s %s' % (iFun,theRest)
2304 newcmd = '%s %s' % (iFun,theRest)
2301 auto_rewrite = False
2305 auto_rewrite = False
2302 else:
2306 else:
2303 if theRest.startswith('['):
2307 if theRest.startswith('['):
2304 if hasattr(obj,'__getitem__'):
2308 if hasattr(obj,'__getitem__'):
2305 # Don't autocall in this case: item access for an object
2309 # Don't autocall in this case: item access for an object
2306 # which is BOTH callable and implements __getitem__.
2310 # which is BOTH callable and implements __getitem__.
2307 newcmd = '%s %s' % (iFun,theRest)
2311 newcmd = '%s %s' % (iFun,theRest)
2308 auto_rewrite = False
2312 auto_rewrite = False
2309 else:
2313 else:
2310 # if the object doesn't support [] access, go ahead and
2314 # if the object doesn't support [] access, go ahead and
2311 # autocall
2315 # autocall
2312 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2316 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2313 elif theRest.endswith(';'):
2317 elif theRest.endswith(';'):
2314 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2318 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2315 else:
2319 else:
2316 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2320 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2317
2321
2318 if auto_rewrite:
2322 if auto_rewrite:
2319 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2323 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2320 # log what is now valid Python, not the actual user input (without the
2324 # log what is now valid Python, not the actual user input (without the
2321 # final newline)
2325 # final newline)
2322 self.log(line,newcmd,continue_prompt)
2326 self.log(line,newcmd,continue_prompt)
2323 return newcmd
2327 return newcmd
2324
2328
2325 def handle_help(self, line, continue_prompt=None,
2329 def handle_help(self, line, continue_prompt=None,
2326 pre=None,iFun=None,theRest=None):
2330 pre=None,iFun=None,theRest=None):
2327 """Try to get some help for the object.
2331 """Try to get some help for the object.
2328
2332
2329 obj? or ?obj -> basic information.
2333 obj? or ?obj -> basic information.
2330 obj?? or ??obj -> more details.
2334 obj?? or ??obj -> more details.
2331 """
2335 """
2332
2336
2333 # We need to make sure that we don't process lines which would be
2337 # We need to make sure that we don't process lines which would be
2334 # otherwise valid python, such as "x=1 # what?"
2338 # otherwise valid python, such as "x=1 # what?"
2335 try:
2339 try:
2336 codeop.compile_command(line)
2340 codeop.compile_command(line)
2337 except SyntaxError:
2341 except SyntaxError:
2338 # We should only handle as help stuff which is NOT valid syntax
2342 # We should only handle as help stuff which is NOT valid syntax
2339 if line[0]==self.ESC_HELP:
2343 if line[0]==self.ESC_HELP:
2340 line = line[1:]
2344 line = line[1:]
2341 elif line[-1]==self.ESC_HELP:
2345 elif line[-1]==self.ESC_HELP:
2342 line = line[:-1]
2346 line = line[:-1]
2343 self.log(line,'#?'+line,continue_prompt)
2347 self.log(line,'#?'+line,continue_prompt)
2344 if line:
2348 if line:
2345 self.magic_pinfo(line)
2349 self.magic_pinfo(line)
2346 else:
2350 else:
2347 page(self.usage,screen_lines=self.rc.screen_length)
2351 page(self.usage,screen_lines=self.rc.screen_length)
2348 return '' # Empty string is needed here!
2352 return '' # Empty string is needed here!
2349 except:
2353 except:
2350 # Pass any other exceptions through to the normal handler
2354 # Pass any other exceptions through to the normal handler
2351 return self.handle_normal(line,continue_prompt)
2355 return self.handle_normal(line,continue_prompt)
2352 else:
2356 else:
2353 # If the code compiles ok, we should handle it normally
2357 # If the code compiles ok, we should handle it normally
2354 return self.handle_normal(line,continue_prompt)
2358 return self.handle_normal(line,continue_prompt)
2355
2359
2356 def getapi(self):
2360 def getapi(self):
2357 """ Get an IPApi object for this shell instance
2361 """ Get an IPApi object for this shell instance
2358
2362
2359 Getting an IPApi object is always preferable to accessing the shell
2363 Getting an IPApi object is always preferable to accessing the shell
2360 directly, but this holds true especially for extensions.
2364 directly, but this holds true especially for extensions.
2361
2365
2362 It should always be possible to implement an extension with IPApi
2366 It should always be possible to implement an extension with IPApi
2363 alone. If not, contact maintainer to request an addition.
2367 alone. If not, contact maintainer to request an addition.
2364
2368
2365 """
2369 """
2366 return self.api
2370 return self.api
2367
2371
2368 def handle_emacs(self,line,continue_prompt=None,
2372 def handle_emacs(self,line,continue_prompt=None,
2369 pre=None,iFun=None,theRest=None):
2373 pre=None,iFun=None,theRest=None):
2370 """Handle input lines marked by python-mode."""
2374 """Handle input lines marked by python-mode."""
2371
2375
2372 # Currently, nothing is done. Later more functionality can be added
2376 # Currently, nothing is done. Later more functionality can be added
2373 # here if needed.
2377 # here if needed.
2374
2378
2375 # The input cache shouldn't be updated
2379 # The input cache shouldn't be updated
2376
2380
2377 return line
2381 return line
2378
2382
2379 def mktempfile(self,data=None):
2383 def mktempfile(self,data=None):
2380 """Make a new tempfile and return its filename.
2384 """Make a new tempfile and return its filename.
2381
2385
2382 This makes a call to tempfile.mktemp, but it registers the created
2386 This makes a call to tempfile.mktemp, but it registers the created
2383 filename internally so ipython cleans it up at exit time.
2387 filename internally so ipython cleans it up at exit time.
2384
2388
2385 Optional inputs:
2389 Optional inputs:
2386
2390
2387 - data(None): if data is given, it gets written out to the temp file
2391 - data(None): if data is given, it gets written out to the temp file
2388 immediately, and the file is closed again."""
2392 immediately, and the file is closed again."""
2389
2393
2390 filename = tempfile.mktemp('.py','ipython_edit_')
2394 filename = tempfile.mktemp('.py','ipython_edit_')
2391 self.tempfiles.append(filename)
2395 self.tempfiles.append(filename)
2392
2396
2393 if data:
2397 if data:
2394 tmp_file = open(filename,'w')
2398 tmp_file = open(filename,'w')
2395 tmp_file.write(data)
2399 tmp_file.write(data)
2396 tmp_file.close()
2400 tmp_file.close()
2397 return filename
2401 return filename
2398
2402
2399 def write(self,data):
2403 def write(self,data):
2400 """Write a string to the default output"""
2404 """Write a string to the default output"""
2401 Term.cout.write(data)
2405 Term.cout.write(data)
2402
2406
2403 def write_err(self,data):
2407 def write_err(self,data):
2404 """Write a string to the default error output"""
2408 """Write a string to the default error output"""
2405 Term.cerr.write(data)
2409 Term.cerr.write(data)
2406
2410
2407 def exit(self):
2411 def exit(self):
2408 """Handle interactive exit.
2412 """Handle interactive exit.
2409
2413
2410 This method sets the exit_now attribute."""
2414 This method sets the exit_now attribute."""
2411
2415
2412 if self.rc.confirm_exit:
2416 if self.rc.confirm_exit:
2413 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2417 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2414 self.exit_now = True
2418 self.exit_now = True
2415 else:
2419 else:
2416 self.exit_now = True
2420 self.exit_now = True
2417
2421
2418 def safe_execfile(self,fname,*where,**kw):
2422 def safe_execfile(self,fname,*where,**kw):
2419 """A safe version of the builtin execfile().
2423 """A safe version of the builtin execfile().
2420
2424
2421 This version will never throw an exception, and knows how to handle
2425 This version will never throw an exception, and knows how to handle
2422 ipython logs as well."""
2426 ipython logs as well."""
2423
2427
2424 def syspath_cleanup():
2428 def syspath_cleanup():
2425 """Internal cleanup routine for sys.path."""
2429 """Internal cleanup routine for sys.path."""
2426 if add_dname:
2430 if add_dname:
2427 try:
2431 try:
2428 sys.path.remove(dname)
2432 sys.path.remove(dname)
2429 except ValueError:
2433 except ValueError:
2430 # For some reason the user has already removed it, ignore.
2434 # For some reason the user has already removed it, ignore.
2431 pass
2435 pass
2432
2436
2433 fname = os.path.expanduser(fname)
2437 fname = os.path.expanduser(fname)
2434
2438
2435 # Find things also in current directory. This is needed to mimic the
2439 # Find things also in current directory. This is needed to mimic the
2436 # behavior of running a script from the system command line, where
2440 # behavior of running a script from the system command line, where
2437 # Python inserts the script's directory into sys.path
2441 # Python inserts the script's directory into sys.path
2438 dname = os.path.dirname(os.path.abspath(fname))
2442 dname = os.path.dirname(os.path.abspath(fname))
2439 add_dname = False
2443 add_dname = False
2440 if dname not in sys.path:
2444 if dname not in sys.path:
2441 sys.path.insert(0,dname)
2445 sys.path.insert(0,dname)
2442 add_dname = True
2446 add_dname = True
2443
2447
2444 try:
2448 try:
2445 xfile = open(fname)
2449 xfile = open(fname)
2446 except:
2450 except:
2447 print >> Term.cerr, \
2451 print >> Term.cerr, \
2448 'Could not open file <%s> for safe execution.' % fname
2452 'Could not open file <%s> for safe execution.' % fname
2449 syspath_cleanup()
2453 syspath_cleanup()
2450 return None
2454 return None
2451
2455
2452 kw.setdefault('islog',0)
2456 kw.setdefault('islog',0)
2453 kw.setdefault('quiet',1)
2457 kw.setdefault('quiet',1)
2454 kw.setdefault('exit_ignore',0)
2458 kw.setdefault('exit_ignore',0)
2455 first = xfile.readline()
2459 first = xfile.readline()
2456 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2460 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2457 xfile.close()
2461 xfile.close()
2458 # line by line execution
2462 # line by line execution
2459 if first.startswith(loghead) or kw['islog']:
2463 if first.startswith(loghead) or kw['islog']:
2460 print 'Loading log file <%s> one line at a time...' % fname
2464 print 'Loading log file <%s> one line at a time...' % fname
2461 if kw['quiet']:
2465 if kw['quiet']:
2462 stdout_save = sys.stdout
2466 stdout_save = sys.stdout
2463 sys.stdout = StringIO.StringIO()
2467 sys.stdout = StringIO.StringIO()
2464 try:
2468 try:
2465 globs,locs = where[0:2]
2469 globs,locs = where[0:2]
2466 except:
2470 except:
2467 try:
2471 try:
2468 globs = locs = where[0]
2472 globs = locs = where[0]
2469 except:
2473 except:
2470 globs = locs = globals()
2474 globs = locs = globals()
2471 badblocks = []
2475 badblocks = []
2472
2476
2473 # we also need to identify indented blocks of code when replaying
2477 # we also need to identify indented blocks of code when replaying
2474 # logs and put them together before passing them to an exec
2478 # logs and put them together before passing them to an exec
2475 # statement. This takes a bit of regexp and look-ahead work in the
2479 # statement. This takes a bit of regexp and look-ahead work in the
2476 # file. It's easiest if we swallow the whole thing in memory
2480 # file. It's easiest if we swallow the whole thing in memory
2477 # first, and manually walk through the lines list moving the
2481 # first, and manually walk through the lines list moving the
2478 # counter ourselves.
2482 # counter ourselves.
2479 indent_re = re.compile('\s+\S')
2483 indent_re = re.compile('\s+\S')
2480 xfile = open(fname)
2484 xfile = open(fname)
2481 filelines = xfile.readlines()
2485 filelines = xfile.readlines()
2482 xfile.close()
2486 xfile.close()
2483 nlines = len(filelines)
2487 nlines = len(filelines)
2484 lnum = 0
2488 lnum = 0
2485 while lnum < nlines:
2489 while lnum < nlines:
2486 line = filelines[lnum]
2490 line = filelines[lnum]
2487 lnum += 1
2491 lnum += 1
2488 # don't re-insert logger status info into cache
2492 # don't re-insert logger status info into cache
2489 if line.startswith('#log#'):
2493 if line.startswith('#log#'):
2490 continue
2494 continue
2491 else:
2495 else:
2492 # build a block of code (maybe a single line) for execution
2496 # build a block of code (maybe a single line) for execution
2493 block = line
2497 block = line
2494 try:
2498 try:
2495 next = filelines[lnum] # lnum has already incremented
2499 next = filelines[lnum] # lnum has already incremented
2496 except:
2500 except:
2497 next = None
2501 next = None
2498 while next and indent_re.match(next):
2502 while next and indent_re.match(next):
2499 block += next
2503 block += next
2500 lnum += 1
2504 lnum += 1
2501 try:
2505 try:
2502 next = filelines[lnum]
2506 next = filelines[lnum]
2503 except:
2507 except:
2504 next = None
2508 next = None
2505 # now execute the block of one or more lines
2509 # now execute the block of one or more lines
2506 try:
2510 try:
2507 exec block in globs,locs
2511 exec block in globs,locs
2508 except SystemExit:
2512 except SystemExit:
2509 pass
2513 pass
2510 except:
2514 except:
2511 badblocks.append(block.rstrip())
2515 badblocks.append(block.rstrip())
2512 if kw['quiet']: # restore stdout
2516 if kw['quiet']: # restore stdout
2513 sys.stdout.close()
2517 sys.stdout.close()
2514 sys.stdout = stdout_save
2518 sys.stdout = stdout_save
2515 print 'Finished replaying log file <%s>' % fname
2519 print 'Finished replaying log file <%s>' % fname
2516 if badblocks:
2520 if badblocks:
2517 print >> sys.stderr, ('\nThe following lines/blocks in file '
2521 print >> sys.stderr, ('\nThe following lines/blocks in file '
2518 '<%s> reported errors:' % fname)
2522 '<%s> reported errors:' % fname)
2519
2523
2520 for badline in badblocks:
2524 for badline in badblocks:
2521 print >> sys.stderr, badline
2525 print >> sys.stderr, badline
2522 else: # regular file execution
2526 else: # regular file execution
2523 try:
2527 try:
2524 execfile(fname,*where)
2528 execfile(fname,*where)
2525 except SyntaxError:
2529 except SyntaxError:
2526 self.showsyntaxerror()
2530 self.showsyntaxerror()
2527 warn('Failure executing file: <%s>' % fname)
2531 warn('Failure executing file: <%s>' % fname)
2528 except SystemExit,status:
2532 except SystemExit,status:
2529 if not kw['exit_ignore']:
2533 if not kw['exit_ignore']:
2530 self.showtraceback()
2534 self.showtraceback()
2531 warn('Failure executing file: <%s>' % fname)
2535 warn('Failure executing file: <%s>' % fname)
2532 except:
2536 except:
2533 self.showtraceback()
2537 self.showtraceback()
2534 warn('Failure executing file: <%s>' % fname)
2538 warn('Failure executing file: <%s>' % fname)
2535
2539
2536 syspath_cleanup()
2540 syspath_cleanup()
2537
2541
2538 #************************* end of file <iplib.py> *****************************
2542 #************************* end of file <iplib.py> *****************************
@@ -1,6141 +1,6150 b''
1 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (showtraceback): ensure that we correctly call
4 custom handlers in all cases (some with pdb were slipping through,
5 but I'm not exactly sure why).
6
7 * IPython/Debugger.py (Tracer.__init__): added new class to
8 support set_trace-like usage of IPython's enhanced debugger.
9
1 2006-12-24 Ville Vainio <vivainio@gmail.com>
10 2006-12-24 Ville Vainio <vivainio@gmail.com>
2
11
3 * ipmaker.py: more informative message when ipy_user_conf
12 * ipmaker.py: more informative message when ipy_user_conf
4 import fails (suggest running %upgrade).
13 import fails (suggest running %upgrade).
5
14
6 * tools/run_ipy_in_profiler.py: Utility to see where
15 * tools/run_ipy_in_profiler.py: Utility to see where
7 the time during IPython startup is spent.
16 the time during IPython startup is spent.
8
17
9 2006-12-20 Ville Vainio <vivainio@gmail.com>
18 2006-12-20 Ville Vainio <vivainio@gmail.com>
10
19
11 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
20 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
12
21
13 * ipapi.py: Add new ipapi method, expand_alias.
22 * ipapi.py: Add new ipapi method, expand_alias.
14
23
15 * Release.py: Bump up version to 0.7.4.svn
24 * Release.py: Bump up version to 0.7.4.svn
16
25
17 2006-12-17 Ville Vainio <vivainio@gmail.com>
26 2006-12-17 Ville Vainio <vivainio@gmail.com>
18
27
19 * Extensions/jobctrl.py: Fixed &cmd arg arg...
28 * Extensions/jobctrl.py: Fixed &cmd arg arg...
20 to work properly on posix too
29 to work properly on posix too
21
30
22 * Release.py: Update revnum (version is still just 0.7.3).
31 * Release.py: Update revnum (version is still just 0.7.3).
23
32
24 2006-12-15 Ville Vainio <vivainio@gmail.com>
33 2006-12-15 Ville Vainio <vivainio@gmail.com>
25
34
26 * scripts/ipython_win_post_install: create ipython.py in
35 * scripts/ipython_win_post_install: create ipython.py in
27 prefix + "/scripts".
36 prefix + "/scripts".
28
37
29 * Release.py: Update version to 0.7.3.
38 * Release.py: Update version to 0.7.3.
30
39
31 2006-12-14 Ville Vainio <vivainio@gmail.com>
40 2006-12-14 Ville Vainio <vivainio@gmail.com>
32
41
33 * scripts/ipython_win_post_install: Overwrite old shortcuts
42 * scripts/ipython_win_post_install: Overwrite old shortcuts
34 if they already exist
43 if they already exist
35
44
36 * Release.py: release 0.7.3rc2
45 * Release.py: release 0.7.3rc2
37
46
38 2006-12-13 Ville Vainio <vivainio@gmail.com>
47 2006-12-13 Ville Vainio <vivainio@gmail.com>
39
48
40 * Branch and update Release.py for 0.7.3rc1
49 * Branch and update Release.py for 0.7.3rc1
41
50
42 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
51 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
43
52
44 * IPython/Shell.py (IPShellWX): update for current WX naming
53 * IPython/Shell.py (IPShellWX): update for current WX naming
45 conventions, to avoid a deprecation warning with current WX
54 conventions, to avoid a deprecation warning with current WX
46 versions. Thanks to a report by Danny Shevitz.
55 versions. Thanks to a report by Danny Shevitz.
47
56
48 2006-12-12 Ville Vainio <vivainio@gmail.com>
57 2006-12-12 Ville Vainio <vivainio@gmail.com>
49
58
50 * ipmaker.py: apply david cournapeau's patch to make
59 * ipmaker.py: apply david cournapeau's patch to make
51 import_some work properly even when ipythonrc does
60 import_some work properly even when ipythonrc does
52 import_some on empty list (it was an old bug!).
61 import_some on empty list (it was an old bug!).
53
62
54 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
63 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
55 Add deprecation note to ipythonrc and a url to wiki
64 Add deprecation note to ipythonrc and a url to wiki
56 in ipy_user_conf.py
65 in ipy_user_conf.py
57
66
58
67
59 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
68 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
60 as if it was typed on IPython command prompt, i.e.
69 as if it was typed on IPython command prompt, i.e.
61 as IPython script.
70 as IPython script.
62
71
63 * example-magic.py, magic_grepl.py: remove outdated examples
72 * example-magic.py, magic_grepl.py: remove outdated examples
64
73
65 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
74 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
66
75
67 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
76 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
68 is called before any exception has occurred.
77 is called before any exception has occurred.
69
78
70 2006-12-08 Ville Vainio <vivainio@gmail.com>
79 2006-12-08 Ville Vainio <vivainio@gmail.com>
71
80
72 * Extensions/ipy_stock_completers.py.py: fix cd completer
81 * Extensions/ipy_stock_completers.py.py: fix cd completer
73 to translate /'s to \'s again.
82 to translate /'s to \'s again.
74
83
75 * completer.py: prevent traceback on file completions w/
84 * completer.py: prevent traceback on file completions w/
76 backslash.
85 backslash.
77
86
78 * Release.py: Update release number to 0.7.3b3 for release
87 * Release.py: Update release number to 0.7.3b3 for release
79
88
80 2006-12-07 Ville Vainio <vivainio@gmail.com>
89 2006-12-07 Ville Vainio <vivainio@gmail.com>
81
90
82 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
91 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
83 while executing external code. Provides more shell-like behaviour
92 while executing external code. Provides more shell-like behaviour
84 and overall better response to ctrl + C / ctrl + break.
93 and overall better response to ctrl + C / ctrl + break.
85
94
86 * tools/make_tarball.py: new script to create tarball straight from svn
95 * tools/make_tarball.py: new script to create tarball straight from svn
87 (setup.py sdist doesn't work on win32).
96 (setup.py sdist doesn't work on win32).
88
97
89 * Extensions/ipy_stock_completers.py: fix cd completer to give up
98 * Extensions/ipy_stock_completers.py: fix cd completer to give up
90 on dirnames with spaces and use the default completer instead.
99 on dirnames with spaces and use the default completer instead.
91
100
92 * Revision.py: Change version to 0.7.3b2 for release.
101 * Revision.py: Change version to 0.7.3b2 for release.
93
102
94 2006-12-05 Ville Vainio <vivainio@gmail.com>
103 2006-12-05 Ville Vainio <vivainio@gmail.com>
95
104
96 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
105 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
97 pydb patch 4 (rm debug printing, py 2.5 checking)
106 pydb patch 4 (rm debug printing, py 2.5 checking)
98
107
99 2006-11-30 Walter Doerwald <walter@livinglogic.de>
108 2006-11-30 Walter Doerwald <walter@livinglogic.de>
100 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
109 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
101 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
110 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
102 "refreshfind" (mapped to "R") does the same but tries to go back to the same
111 "refreshfind" (mapped to "R") does the same but tries to go back to the same
103 object the cursor was on before the refresh. The command "markrange" is
112 object the cursor was on before the refresh. The command "markrange" is
104 mapped to "%" now.
113 mapped to "%" now.
105 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
114 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
106
115
107 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
116 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
108
117
109 * IPython/Magic.py (magic_debug): new %debug magic to activate the
118 * IPython/Magic.py (magic_debug): new %debug magic to activate the
110 interactive debugger on the last traceback, without having to call
119 interactive debugger on the last traceback, without having to call
111 %pdb and rerun your code. Made minor changes in various modules,
120 %pdb and rerun your code. Made minor changes in various modules,
112 should automatically recognize pydb if available.
121 should automatically recognize pydb if available.
113
122
114 2006-11-28 Ville Vainio <vivainio@gmail.com>
123 2006-11-28 Ville Vainio <vivainio@gmail.com>
115
124
116 * completer.py: If the text start with !, show file completions
125 * completer.py: If the text start with !, show file completions
117 properly. This helps when trying to complete command name
126 properly. This helps when trying to complete command name
118 for shell escapes.
127 for shell escapes.
119
128
120 2006-11-27 Ville Vainio <vivainio@gmail.com>
129 2006-11-27 Ville Vainio <vivainio@gmail.com>
121
130
122 * ipy_stock_completers.py: bzr completer submitted by Stefan van
131 * ipy_stock_completers.py: bzr completer submitted by Stefan van
123 der Walt. Clean up svn and hg completers by using a common
132 der Walt. Clean up svn and hg completers by using a common
124 vcs_completer.
133 vcs_completer.
125
134
126 2006-11-26 Ville Vainio <vivainio@gmail.com>
135 2006-11-26 Ville Vainio <vivainio@gmail.com>
127
136
128 * Remove ipconfig and %config; you should use _ip.options structure
137 * Remove ipconfig and %config; you should use _ip.options structure
129 directly instead!
138 directly instead!
130
139
131 * genutils.py: add wrap_deprecated function for deprecating callables
140 * genutils.py: add wrap_deprecated function for deprecating callables
132
141
133 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
142 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
134 _ip.system instead. ipalias is redundant.
143 _ip.system instead. ipalias is redundant.
135
144
136 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
145 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
137 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
146 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
138 explicit.
147 explicit.
139
148
140 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
149 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
141 completer. Try it by entering 'hg ' and pressing tab.
150 completer. Try it by entering 'hg ' and pressing tab.
142
151
143 * macro.py: Give Macro a useful __repr__ method
152 * macro.py: Give Macro a useful __repr__ method
144
153
145 * Magic.py: %whos abbreviates the typename of Macro for brevity.
154 * Magic.py: %whos abbreviates the typename of Macro for brevity.
146
155
147 2006-11-24 Walter Doerwald <walter@livinglogic.de>
156 2006-11-24 Walter Doerwald <walter@livinglogic.de>
148 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
157 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
149 we don't get a duplicate ipipe module, where registration of the xrepr
158 we don't get a duplicate ipipe module, where registration of the xrepr
150 implementation for Text is useless.
159 implementation for Text is useless.
151
160
152 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
161 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
153
162
154 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
163 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
155
164
156 2006-11-24 Ville Vainio <vivainio@gmail.com>
165 2006-11-24 Ville Vainio <vivainio@gmail.com>
157
166
158 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
167 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
159 try to use "cProfile" instead of the slower pure python
168 try to use "cProfile" instead of the slower pure python
160 "profile"
169 "profile"
161
170
162 2006-11-23 Ville Vainio <vivainio@gmail.com>
171 2006-11-23 Ville Vainio <vivainio@gmail.com>
163
172
164 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
173 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
165 Qt+IPython+Designer link in documentation.
174 Qt+IPython+Designer link in documentation.
166
175
167 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
176 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
168 correct Pdb object to %pydb.
177 correct Pdb object to %pydb.
169
178
170
179
171 2006-11-22 Walter Doerwald <walter@livinglogic.de>
180 2006-11-22 Walter Doerwald <walter@livinglogic.de>
172 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
181 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
173 generic xrepr(), otherwise the list implementation would kick in.
182 generic xrepr(), otherwise the list implementation would kick in.
174
183
175 2006-11-21 Ville Vainio <vivainio@gmail.com>
184 2006-11-21 Ville Vainio <vivainio@gmail.com>
176
185
177 * upgrade_dir.py: Now actually overwrites a nonmodified user file
186 * upgrade_dir.py: Now actually overwrites a nonmodified user file
178 with one from UserConfig.
187 with one from UserConfig.
179
188
180 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
189 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
181 it was missing which broke the sh profile.
190 it was missing which broke the sh profile.
182
191
183 * completer.py: file completer now uses explicit '/' instead
192 * completer.py: file completer now uses explicit '/' instead
184 of os.path.join, expansion of 'foo' was broken on win32
193 of os.path.join, expansion of 'foo' was broken on win32
185 if there was one directory with name 'foobar'.
194 if there was one directory with name 'foobar'.
186
195
187 * A bunch of patches from Kirill Smelkov:
196 * A bunch of patches from Kirill Smelkov:
188
197
189 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
198 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
190
199
191 * [patch 7/9] Implement %page -r (page in raw mode) -
200 * [patch 7/9] Implement %page -r (page in raw mode) -
192
201
193 * [patch 5/9] ScientificPython webpage has moved
202 * [patch 5/9] ScientificPython webpage has moved
194
203
195 * [patch 4/9] The manual mentions %ds, should be %dhist
204 * [patch 4/9] The manual mentions %ds, should be %dhist
196
205
197 * [patch 3/9] Kill old bits from %prun doc.
206 * [patch 3/9] Kill old bits from %prun doc.
198
207
199 * [patch 1/9] Fix typos here and there.
208 * [patch 1/9] Fix typos here and there.
200
209
201 2006-11-08 Ville Vainio <vivainio@gmail.com>
210 2006-11-08 Ville Vainio <vivainio@gmail.com>
202
211
203 * completer.py (attr_matches): catch all exceptions raised
212 * completer.py (attr_matches): catch all exceptions raised
204 by eval of expr with dots.
213 by eval of expr with dots.
205
214
206 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
215 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
207
216
208 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
217 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
209 input if it starts with whitespace. This allows you to paste
218 input if it starts with whitespace. This allows you to paste
210 indented input from any editor without manually having to type in
219 indented input from any editor without manually having to type in
211 the 'if 1:', which is convenient when working interactively.
220 the 'if 1:', which is convenient when working interactively.
212 Slightly modifed version of a patch by Bo Peng
221 Slightly modifed version of a patch by Bo Peng
213 <bpeng-AT-rice.edu>.
222 <bpeng-AT-rice.edu>.
214
223
215 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
224 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
216
225
217 * IPython/irunner.py (main): modified irunner so it automatically
226 * IPython/irunner.py (main): modified irunner so it automatically
218 recognizes the right runner to use based on the extension (.py for
227 recognizes the right runner to use based on the extension (.py for
219 python, .ipy for ipython and .sage for sage).
228 python, .ipy for ipython and .sage for sage).
220
229
221 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
230 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
222 visible in ipapi as ip.config(), to programatically control the
231 visible in ipapi as ip.config(), to programatically control the
223 internal rc object. There's an accompanying %config magic for
232 internal rc object. There's an accompanying %config magic for
224 interactive use, which has been enhanced to match the
233 interactive use, which has been enhanced to match the
225 funtionality in ipconfig.
234 funtionality in ipconfig.
226
235
227 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
236 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
228 so it's not just a toggle, it now takes an argument. Add support
237 so it's not just a toggle, it now takes an argument. Add support
229 for a customizable header when making system calls, as the new
238 for a customizable header when making system calls, as the new
230 system_header variable in the ipythonrc file.
239 system_header variable in the ipythonrc file.
231
240
232 2006-11-03 Walter Doerwald <walter@livinglogic.de>
241 2006-11-03 Walter Doerwald <walter@livinglogic.de>
233
242
234 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
243 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
235 generic functions (using Philip J. Eby's simplegeneric package).
244 generic functions (using Philip J. Eby's simplegeneric package).
236 This makes it possible to customize the display of third-party classes
245 This makes it possible to customize the display of third-party classes
237 without having to monkeypatch them. xiter() no longer supports a mode
246 without having to monkeypatch them. xiter() no longer supports a mode
238 argument and the XMode class has been removed. The same functionality can
247 argument and the XMode class has been removed. The same functionality can
239 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
248 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
240 One consequence of the switch to generic functions is that xrepr() and
249 One consequence of the switch to generic functions is that xrepr() and
241 xattrs() implementation must define the default value for the mode
250 xattrs() implementation must define the default value for the mode
242 argument themselves and xattrs() implementations must return real
251 argument themselves and xattrs() implementations must return real
243 descriptors.
252 descriptors.
244
253
245 * IPython/external: This new subpackage will contain all third-party
254 * IPython/external: This new subpackage will contain all third-party
246 packages that are bundled with IPython. (The first one is simplegeneric).
255 packages that are bundled with IPython. (The first one is simplegeneric).
247
256
248 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
257 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
249 directory which as been dropped in r1703.
258 directory which as been dropped in r1703.
250
259
251 * IPython/Extensions/ipipe.py (iless): Fixed.
260 * IPython/Extensions/ipipe.py (iless): Fixed.
252
261
253 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
262 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
254
263
255 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
264 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
256
265
257 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
266 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
258 handling in variable expansion so that shells and magics recognize
267 handling in variable expansion so that shells and magics recognize
259 function local scopes correctly. Bug reported by Brian.
268 function local scopes correctly. Bug reported by Brian.
260
269
261 * scripts/ipython: remove the very first entry in sys.path which
270 * scripts/ipython: remove the very first entry in sys.path which
262 Python auto-inserts for scripts, so that sys.path under IPython is
271 Python auto-inserts for scripts, so that sys.path under IPython is
263 as similar as possible to that under plain Python.
272 as similar as possible to that under plain Python.
264
273
265 * IPython/completer.py (IPCompleter.file_matches): Fix
274 * IPython/completer.py (IPCompleter.file_matches): Fix
266 tab-completion so that quotes are not closed unless the completion
275 tab-completion so that quotes are not closed unless the completion
267 is unambiguous. After a request by Stefan. Minor cleanups in
276 is unambiguous. After a request by Stefan. Minor cleanups in
268 ipy_stock_completers.
277 ipy_stock_completers.
269
278
270 2006-11-02 Ville Vainio <vivainio@gmail.com>
279 2006-11-02 Ville Vainio <vivainio@gmail.com>
271
280
272 * ipy_stock_completers.py: Add %run and %cd completers.
281 * ipy_stock_completers.py: Add %run and %cd completers.
273
282
274 * completer.py: Try running custom completer for both
283 * completer.py: Try running custom completer for both
275 "foo" and "%foo" if the command is just "foo". Ignore case
284 "foo" and "%foo" if the command is just "foo". Ignore case
276 when filtering possible completions.
285 when filtering possible completions.
277
286
278 * UserConfig/ipy_user_conf.py: install stock completers as default
287 * UserConfig/ipy_user_conf.py: install stock completers as default
279
288
280 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
289 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
281 simplified readline history save / restore through a wrapper
290 simplified readline history save / restore through a wrapper
282 function
291 function
283
292
284
293
285 2006-10-31 Ville Vainio <vivainio@gmail.com>
294 2006-10-31 Ville Vainio <vivainio@gmail.com>
286
295
287 * strdispatch.py, completer.py, ipy_stock_completers.py:
296 * strdispatch.py, completer.py, ipy_stock_completers.py:
288 Allow str_key ("command") in completer hooks. Implement
297 Allow str_key ("command") in completer hooks. Implement
289 trivial completer for 'import' (stdlib modules only). Rename
298 trivial completer for 'import' (stdlib modules only). Rename
290 ipy_linux_package_managers.py to ipy_stock_completers.py.
299 ipy_linux_package_managers.py to ipy_stock_completers.py.
291 SVN completer.
300 SVN completer.
292
301
293 * Extensions/ledit.py: %magic line editor for easily and
302 * Extensions/ledit.py: %magic line editor for easily and
294 incrementally manipulating lists of strings. The magic command
303 incrementally manipulating lists of strings. The magic command
295 name is %led.
304 name is %led.
296
305
297 2006-10-30 Ville Vainio <vivainio@gmail.com>
306 2006-10-30 Ville Vainio <vivainio@gmail.com>
298
307
299 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
308 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
300 Bernsteins's patches for pydb integration.
309 Bernsteins's patches for pydb integration.
301 http://bashdb.sourceforge.net/pydb/
310 http://bashdb.sourceforge.net/pydb/
302
311
303 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
312 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
304 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
313 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
305 custom completer hook to allow the users to implement their own
314 custom completer hook to allow the users to implement their own
306 completers. See ipy_linux_package_managers.py for example. The
315 completers. See ipy_linux_package_managers.py for example. The
307 hook name is 'complete_command'.
316 hook name is 'complete_command'.
308
317
309 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
318 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
310
319
311 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
320 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
312 Numeric leftovers.
321 Numeric leftovers.
313
322
314 * ipython.el (py-execute-region): apply Stefan's patch to fix
323 * ipython.el (py-execute-region): apply Stefan's patch to fix
315 garbled results if the python shell hasn't been previously started.
324 garbled results if the python shell hasn't been previously started.
316
325
317 * IPython/genutils.py (arg_split): moved to genutils, since it's a
326 * IPython/genutils.py (arg_split): moved to genutils, since it's a
318 pretty generic function and useful for other things.
327 pretty generic function and useful for other things.
319
328
320 * IPython/OInspect.py (getsource): Add customizable source
329 * IPython/OInspect.py (getsource): Add customizable source
321 extractor. After a request/patch form W. Stein (SAGE).
330 extractor. After a request/patch form W. Stein (SAGE).
322
331
323 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
332 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
324 window size to a more reasonable value from what pexpect does,
333 window size to a more reasonable value from what pexpect does,
325 since their choice causes wrapping bugs with long input lines.
334 since their choice causes wrapping bugs with long input lines.
326
335
327 2006-10-28 Ville Vainio <vivainio@gmail.com>
336 2006-10-28 Ville Vainio <vivainio@gmail.com>
328
337
329 * Magic.py (%run): Save and restore the readline history from
338 * Magic.py (%run): Save and restore the readline history from
330 file around %run commands to prevent side effects from
339 file around %run commands to prevent side effects from
331 %runned programs that might use readline (e.g. pydb).
340 %runned programs that might use readline (e.g. pydb).
332
341
333 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
342 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
334 invoking the pydb enhanced debugger.
343 invoking the pydb enhanced debugger.
335
344
336 2006-10-23 Walter Doerwald <walter@livinglogic.de>
345 2006-10-23 Walter Doerwald <walter@livinglogic.de>
337
346
338 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
347 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
339 call the base class method and propagate the return value to
348 call the base class method and propagate the return value to
340 ifile. This is now done by path itself.
349 ifile. This is now done by path itself.
341
350
342 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
351 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
343
352
344 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
353 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
345 api: set_crash_handler(), to expose the ability to change the
354 api: set_crash_handler(), to expose the ability to change the
346 internal crash handler.
355 internal crash handler.
347
356
348 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
357 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
349 the various parameters of the crash handler so that apps using
358 the various parameters of the crash handler so that apps using
350 IPython as their engine can customize crash handling. Ipmlemented
359 IPython as their engine can customize crash handling. Ipmlemented
351 at the request of SAGE.
360 at the request of SAGE.
352
361
353 2006-10-14 Ville Vainio <vivainio@gmail.com>
362 2006-10-14 Ville Vainio <vivainio@gmail.com>
354
363
355 * Magic.py, ipython.el: applied first "safe" part of Rocky
364 * Magic.py, ipython.el: applied first "safe" part of Rocky
356 Bernstein's patch set for pydb integration.
365 Bernstein's patch set for pydb integration.
357
366
358 * Magic.py (%unalias, %alias): %store'd aliases can now be
367 * Magic.py (%unalias, %alias): %store'd aliases can now be
359 removed with '%unalias'. %alias w/o args now shows most
368 removed with '%unalias'. %alias w/o args now shows most
360 interesting (stored / manually defined) aliases last
369 interesting (stored / manually defined) aliases last
361 where they catch the eye w/o scrolling.
370 where they catch the eye w/o scrolling.
362
371
363 * Magic.py (%rehashx), ext_rehashdir.py: files with
372 * Magic.py (%rehashx), ext_rehashdir.py: files with
364 'py' extension are always considered executable, even
373 'py' extension are always considered executable, even
365 when not in PATHEXT environment variable.
374 when not in PATHEXT environment variable.
366
375
367 2006-10-12 Ville Vainio <vivainio@gmail.com>
376 2006-10-12 Ville Vainio <vivainio@gmail.com>
368
377
369 * jobctrl.py: Add new "jobctrl" extension for spawning background
378 * jobctrl.py: Add new "jobctrl" extension for spawning background
370 processes with "&find /". 'import jobctrl' to try it out. Requires
379 processes with "&find /". 'import jobctrl' to try it out. Requires
371 'subprocess' module, standard in python 2.4+.
380 'subprocess' module, standard in python 2.4+.
372
381
373 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
382 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
374 so if foo -> bar and bar -> baz, then foo -> baz.
383 so if foo -> bar and bar -> baz, then foo -> baz.
375
384
376 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
385 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
377
386
378 * IPython/Magic.py (Magic.parse_options): add a new posix option
387 * IPython/Magic.py (Magic.parse_options): add a new posix option
379 to allow parsing of input args in magics that doesn't strip quotes
388 to allow parsing of input args in magics that doesn't strip quotes
380 (if posix=False). This also closes %timeit bug reported by
389 (if posix=False). This also closes %timeit bug reported by
381 Stefan.
390 Stefan.
382
391
383 2006-10-03 Ville Vainio <vivainio@gmail.com>
392 2006-10-03 Ville Vainio <vivainio@gmail.com>
384
393
385 * iplib.py (raw_input, interact): Return ValueError catching for
394 * iplib.py (raw_input, interact): Return ValueError catching for
386 raw_input. Fixes infinite loop for sys.stdin.close() or
395 raw_input. Fixes infinite loop for sys.stdin.close() or
387 sys.stdout.close().
396 sys.stdout.close().
388
397
389 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
398 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
390
399
391 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
400 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
392 to help in handling doctests. irunner is now pretty useful for
401 to help in handling doctests. irunner is now pretty useful for
393 running standalone scripts and simulate a full interactive session
402 running standalone scripts and simulate a full interactive session
394 in a format that can be then pasted as a doctest.
403 in a format that can be then pasted as a doctest.
395
404
396 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
405 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
397 on top of the default (useless) ones. This also fixes the nasty
406 on top of the default (useless) ones. This also fixes the nasty
398 way in which 2.5's Quitter() exits (reverted [1785]).
407 way in which 2.5's Quitter() exits (reverted [1785]).
399
408
400 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
409 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
401 2.5.
410 2.5.
402
411
403 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
412 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
404 color scheme is updated as well when color scheme is changed
413 color scheme is updated as well when color scheme is changed
405 interactively.
414 interactively.
406
415
407 2006-09-27 Ville Vainio <vivainio@gmail.com>
416 2006-09-27 Ville Vainio <vivainio@gmail.com>
408
417
409 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
418 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
410 infinite loop and just exit. It's a hack, but will do for a while.
419 infinite loop and just exit. It's a hack, but will do for a while.
411
420
412 2006-08-25 Walter Doerwald <walter@livinglogic.de>
421 2006-08-25 Walter Doerwald <walter@livinglogic.de>
413
422
414 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
423 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
415 the constructor, this makes it possible to get a list of only directories
424 the constructor, this makes it possible to get a list of only directories
416 or only files.
425 or only files.
417
426
418 2006-08-12 Ville Vainio <vivainio@gmail.com>
427 2006-08-12 Ville Vainio <vivainio@gmail.com>
419
428
420 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
429 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
421 they broke unittest
430 they broke unittest
422
431
423 2006-08-11 Ville Vainio <vivainio@gmail.com>
432 2006-08-11 Ville Vainio <vivainio@gmail.com>
424
433
425 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
434 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
426 by resolving issue properly, i.e. by inheriting FakeModule
435 by resolving issue properly, i.e. by inheriting FakeModule
427 from types.ModuleType. Pickling ipython interactive data
436 from types.ModuleType. Pickling ipython interactive data
428 should still work as usual (testing appreciated).
437 should still work as usual (testing appreciated).
429
438
430 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
439 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
431
440
432 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
441 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
433 running under python 2.3 with code from 2.4 to fix a bug with
442 running under python 2.3 with code from 2.4 to fix a bug with
434 help(). Reported by the Debian maintainers, Norbert Tretkowski
443 help(). Reported by the Debian maintainers, Norbert Tretkowski
435 <norbert-AT-tretkowski.de> and Alexandre Fayolle
444 <norbert-AT-tretkowski.de> and Alexandre Fayolle
436 <afayolle-AT-debian.org>.
445 <afayolle-AT-debian.org>.
437
446
438 2006-08-04 Walter Doerwald <walter@livinglogic.de>
447 2006-08-04 Walter Doerwald <walter@livinglogic.de>
439
448
440 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
449 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
441 (which was displaying "quit" twice).
450 (which was displaying "quit" twice).
442
451
443 2006-07-28 Walter Doerwald <walter@livinglogic.de>
452 2006-07-28 Walter Doerwald <walter@livinglogic.de>
444
453
445 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
454 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
446 the mode argument).
455 the mode argument).
447
456
448 2006-07-27 Walter Doerwald <walter@livinglogic.de>
457 2006-07-27 Walter Doerwald <walter@livinglogic.de>
449
458
450 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
459 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
451 not running under IPython.
460 not running under IPython.
452
461
453 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
462 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
454 and make it iterable (iterating over the attribute itself). Add two new
463 and make it iterable (iterating over the attribute itself). Add two new
455 magic strings for __xattrs__(): If the string starts with "-", the attribute
464 magic strings for __xattrs__(): If the string starts with "-", the attribute
456 will not be displayed in ibrowse's detail view (but it can still be
465 will not be displayed in ibrowse's detail view (but it can still be
457 iterated over). This makes it possible to add attributes that are large
466 iterated over). This makes it possible to add attributes that are large
458 lists or generator methods to the detail view. Replace magic attribute names
467 lists or generator methods to the detail view. Replace magic attribute names
459 and _attrname() and _getattr() with "descriptors": For each type of magic
468 and _attrname() and _getattr() with "descriptors": For each type of magic
460 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
469 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
461 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
470 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
462 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
471 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
463 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
472 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
464 are still supported.
473 are still supported.
465
474
466 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
475 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
467 fails in ibrowse.fetch(), the exception object is added as the last item
476 fails in ibrowse.fetch(), the exception object is added as the last item
468 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
477 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
469 a generator throws an exception midway through execution.
478 a generator throws an exception midway through execution.
470
479
471 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
480 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
472 encoding into methods.
481 encoding into methods.
473
482
474 2006-07-26 Ville Vainio <vivainio@gmail.com>
483 2006-07-26 Ville Vainio <vivainio@gmail.com>
475
484
476 * iplib.py: history now stores multiline input as single
485 * iplib.py: history now stores multiline input as single
477 history entries. Patch by Jorgen Cederlof.
486 history entries. Patch by Jorgen Cederlof.
478
487
479 2006-07-18 Walter Doerwald <walter@livinglogic.de>
488 2006-07-18 Walter Doerwald <walter@livinglogic.de>
480
489
481 * IPython/Extensions/ibrowse.py: Make cursor visible over
490 * IPython/Extensions/ibrowse.py: Make cursor visible over
482 non existing attributes.
491 non existing attributes.
483
492
484 2006-07-14 Walter Doerwald <walter@livinglogic.de>
493 2006-07-14 Walter Doerwald <walter@livinglogic.de>
485
494
486 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
495 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
487 error output of the running command doesn't mess up the screen.
496 error output of the running command doesn't mess up the screen.
488
497
489 2006-07-13 Walter Doerwald <walter@livinglogic.de>
498 2006-07-13 Walter Doerwald <walter@livinglogic.de>
490
499
491 * IPython/Extensions/ipipe.py (isort): Make isort usable without
500 * IPython/Extensions/ipipe.py (isort): Make isort usable without
492 argument. This sorts the items themselves.
501 argument. This sorts the items themselves.
493
502
494 2006-07-12 Walter Doerwald <walter@livinglogic.de>
503 2006-07-12 Walter Doerwald <walter@livinglogic.de>
495
504
496 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
505 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
497 Compile expression strings into code objects. This should speed
506 Compile expression strings into code objects. This should speed
498 up ifilter and friends somewhat.
507 up ifilter and friends somewhat.
499
508
500 2006-07-08 Ville Vainio <vivainio@gmail.com>
509 2006-07-08 Ville Vainio <vivainio@gmail.com>
501
510
502 * Magic.py: %cpaste now strips > from the beginning of lines
511 * Magic.py: %cpaste now strips > from the beginning of lines
503 to ease pasting quoted code from emails. Contributed by
512 to ease pasting quoted code from emails. Contributed by
504 Stefan van der Walt.
513 Stefan van der Walt.
505
514
506 2006-06-29 Ville Vainio <vivainio@gmail.com>
515 2006-06-29 Ville Vainio <vivainio@gmail.com>
507
516
508 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
517 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
509 mode, patch contributed by Darren Dale. NEEDS TESTING!
518 mode, patch contributed by Darren Dale. NEEDS TESTING!
510
519
511 2006-06-28 Walter Doerwald <walter@livinglogic.de>
520 2006-06-28 Walter Doerwald <walter@livinglogic.de>
512
521
513 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
522 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
514 a blue background. Fix fetching new display rows when the browser
523 a blue background. Fix fetching new display rows when the browser
515 scrolls more than a screenful (e.g. by using the goto command).
524 scrolls more than a screenful (e.g. by using the goto command).
516
525
517 2006-06-27 Ville Vainio <vivainio@gmail.com>
526 2006-06-27 Ville Vainio <vivainio@gmail.com>
518
527
519 * Magic.py (_inspect, _ofind) Apply David Huard's
528 * Magic.py (_inspect, _ofind) Apply David Huard's
520 patch for displaying the correct docstring for 'property'
529 patch for displaying the correct docstring for 'property'
521 attributes.
530 attributes.
522
531
523 2006-06-23 Walter Doerwald <walter@livinglogic.de>
532 2006-06-23 Walter Doerwald <walter@livinglogic.de>
524
533
525 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
534 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
526 commands into the methods implementing them.
535 commands into the methods implementing them.
527
536
528 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
537 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
529
538
530 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
539 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
531 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
540 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
532 autoindent support was authored by Jin Liu.
541 autoindent support was authored by Jin Liu.
533
542
534 2006-06-22 Walter Doerwald <walter@livinglogic.de>
543 2006-06-22 Walter Doerwald <walter@livinglogic.de>
535
544
536 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
545 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
537 for keymaps with a custom class that simplifies handling.
546 for keymaps with a custom class that simplifies handling.
538
547
539 2006-06-19 Walter Doerwald <walter@livinglogic.de>
548 2006-06-19 Walter Doerwald <walter@livinglogic.de>
540
549
541 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
550 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
542 resizing. This requires Python 2.5 to work.
551 resizing. This requires Python 2.5 to work.
543
552
544 2006-06-16 Walter Doerwald <walter@livinglogic.de>
553 2006-06-16 Walter Doerwald <walter@livinglogic.de>
545
554
546 * IPython/Extensions/ibrowse.py: Add two new commands to
555 * IPython/Extensions/ibrowse.py: Add two new commands to
547 ibrowse: "hideattr" (mapped to "h") hides the attribute under
556 ibrowse: "hideattr" (mapped to "h") hides the attribute under
548 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
557 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
549 attributes again. Remapped the help command to "?". Display
558 attributes again. Remapped the help command to "?". Display
550 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
559 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
551 as keys for the "home" and "end" commands. Add three new commands
560 as keys for the "home" and "end" commands. Add three new commands
552 to the input mode for "find" and friends: "delend" (CTRL-K)
561 to the input mode for "find" and friends: "delend" (CTRL-K)
553 deletes to the end of line. "incsearchup" searches upwards in the
562 deletes to the end of line. "incsearchup" searches upwards in the
554 command history for an input that starts with the text before the cursor.
563 command history for an input that starts with the text before the cursor.
555 "incsearchdown" does the same downwards. Removed a bogus mapping of
564 "incsearchdown" does the same downwards. Removed a bogus mapping of
556 the x key to "delete".
565 the x key to "delete".
557
566
558 2006-06-15 Ville Vainio <vivainio@gmail.com>
567 2006-06-15 Ville Vainio <vivainio@gmail.com>
559
568
560 * iplib.py, hooks.py: Added new generate_prompt hook that can be
569 * iplib.py, hooks.py: Added new generate_prompt hook that can be
561 used to create prompts dynamically, instead of the "old" way of
570 used to create prompts dynamically, instead of the "old" way of
562 assigning "magic" strings to prompt_in1 and prompt_in2. The old
571 assigning "magic" strings to prompt_in1 and prompt_in2. The old
563 way still works (it's invoked by the default hook), of course.
572 way still works (it's invoked by the default hook), of course.
564
573
565 * Prompts.py: added generate_output_prompt hook for altering output
574 * Prompts.py: added generate_output_prompt hook for altering output
566 prompt
575 prompt
567
576
568 * Release.py: Changed version string to 0.7.3.svn.
577 * Release.py: Changed version string to 0.7.3.svn.
569
578
570 2006-06-15 Walter Doerwald <walter@livinglogic.de>
579 2006-06-15 Walter Doerwald <walter@livinglogic.de>
571
580
572 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
581 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
573 the call to fetch() always tries to fetch enough data for at least one
582 the call to fetch() always tries to fetch enough data for at least one
574 full screen. This makes it possible to simply call moveto(0,0,True) in
583 full screen. This makes it possible to simply call moveto(0,0,True) in
575 the constructor. Fix typos and removed the obsolete goto attribute.
584 the constructor. Fix typos and removed the obsolete goto attribute.
576
585
577 2006-06-12 Ville Vainio <vivainio@gmail.com>
586 2006-06-12 Ville Vainio <vivainio@gmail.com>
578
587
579 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
588 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
580 allowing $variable interpolation within multiline statements,
589 allowing $variable interpolation within multiline statements,
581 though so far only with "sh" profile for a testing period.
590 though so far only with "sh" profile for a testing period.
582 The patch also enables splitting long commands with \ but it
591 The patch also enables splitting long commands with \ but it
583 doesn't work properly yet.
592 doesn't work properly yet.
584
593
585 2006-06-12 Walter Doerwald <walter@livinglogic.de>
594 2006-06-12 Walter Doerwald <walter@livinglogic.de>
586
595
587 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
596 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
588 input history and the position of the cursor in the input history for
597 input history and the position of the cursor in the input history for
589 the find, findbackwards and goto command.
598 the find, findbackwards and goto command.
590
599
591 2006-06-10 Walter Doerwald <walter@livinglogic.de>
600 2006-06-10 Walter Doerwald <walter@livinglogic.de>
592
601
593 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
602 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
594 implements the basic functionality of browser commands that require
603 implements the basic functionality of browser commands that require
595 input. Reimplement the goto, find and findbackwards commands as
604 input. Reimplement the goto, find and findbackwards commands as
596 subclasses of _CommandInput. Add an input history and keymaps to those
605 subclasses of _CommandInput. Add an input history and keymaps to those
597 commands. Add "\r" as a keyboard shortcut for the enterdefault and
606 commands. Add "\r" as a keyboard shortcut for the enterdefault and
598 execute commands.
607 execute commands.
599
608
600 2006-06-07 Ville Vainio <vivainio@gmail.com>
609 2006-06-07 Ville Vainio <vivainio@gmail.com>
601
610
602 * iplib.py: ipython mybatch.ipy exits ipython immediately after
611 * iplib.py: ipython mybatch.ipy exits ipython immediately after
603 running the batch files instead of leaving the session open.
612 running the batch files instead of leaving the session open.
604
613
605 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
614 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
606
615
607 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
616 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
608 the original fix was incomplete. Patch submitted by W. Maier.
617 the original fix was incomplete. Patch submitted by W. Maier.
609
618
610 2006-06-07 Ville Vainio <vivainio@gmail.com>
619 2006-06-07 Ville Vainio <vivainio@gmail.com>
611
620
612 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
621 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
613 Confirmation prompts can be supressed by 'quiet' option.
622 Confirmation prompts can be supressed by 'quiet' option.
614 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
623 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
615
624
616 2006-06-06 *** Released version 0.7.2
625 2006-06-06 *** Released version 0.7.2
617
626
618 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
627 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
619
628
620 * IPython/Release.py (version): Made 0.7.2 final for release.
629 * IPython/Release.py (version): Made 0.7.2 final for release.
621 Repo tagged and release cut.
630 Repo tagged and release cut.
622
631
623 2006-06-05 Ville Vainio <vivainio@gmail.com>
632 2006-06-05 Ville Vainio <vivainio@gmail.com>
624
633
625 * Magic.py (magic_rehashx): Honor no_alias list earlier in
634 * Magic.py (magic_rehashx): Honor no_alias list earlier in
626 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
635 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
627
636
628 * upgrade_dir.py: try import 'path' module a bit harder
637 * upgrade_dir.py: try import 'path' module a bit harder
629 (for %upgrade)
638 (for %upgrade)
630
639
631 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
640 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
632
641
633 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
642 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
634 instead of looping 20 times.
643 instead of looping 20 times.
635
644
636 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
645 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
637 correctly at initialization time. Bug reported by Krishna Mohan
646 correctly at initialization time. Bug reported by Krishna Mohan
638 Gundu <gkmohan-AT-gmail.com> on the user list.
647 Gundu <gkmohan-AT-gmail.com> on the user list.
639
648
640 * IPython/Release.py (version): Mark 0.7.2 version to start
649 * IPython/Release.py (version): Mark 0.7.2 version to start
641 testing for release on 06/06.
650 testing for release on 06/06.
642
651
643 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
652 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
644
653
645 * scripts/irunner: thin script interface so users don't have to
654 * scripts/irunner: thin script interface so users don't have to
646 find the module and call it as an executable, since modules rarely
655 find the module and call it as an executable, since modules rarely
647 live in people's PATH.
656 live in people's PATH.
648
657
649 * IPython/irunner.py (InteractiveRunner.__init__): added
658 * IPython/irunner.py (InteractiveRunner.__init__): added
650 delaybeforesend attribute to control delays with newer versions of
659 delaybeforesend attribute to control delays with newer versions of
651 pexpect. Thanks to detailed help from pexpect's author, Noah
660 pexpect. Thanks to detailed help from pexpect's author, Noah
652 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
661 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
653 correctly (it works in NoColor mode).
662 correctly (it works in NoColor mode).
654
663
655 * IPython/iplib.py (handle_normal): fix nasty crash reported on
664 * IPython/iplib.py (handle_normal): fix nasty crash reported on
656 SAGE list, from improper log() calls.
665 SAGE list, from improper log() calls.
657
666
658 2006-05-31 Ville Vainio <vivainio@gmail.com>
667 2006-05-31 Ville Vainio <vivainio@gmail.com>
659
668
660 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
669 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
661 with args in parens to work correctly with dirs that have spaces.
670 with args in parens to work correctly with dirs that have spaces.
662
671
663 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
672 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
664
673
665 * IPython/Logger.py (Logger.logstart): add option to log raw input
674 * IPython/Logger.py (Logger.logstart): add option to log raw input
666 instead of the processed one. A -r flag was added to the
675 instead of the processed one. A -r flag was added to the
667 %logstart magic used for controlling logging.
676 %logstart magic used for controlling logging.
668
677
669 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
678 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
670
679
671 * IPython/iplib.py (InteractiveShell.__init__): add check for the
680 * IPython/iplib.py (InteractiveShell.__init__): add check for the
672 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
681 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
673 recognize the option. After a bug report by Will Maier. This
682 recognize the option. After a bug report by Will Maier. This
674 closes #64 (will do it after confirmation from W. Maier).
683 closes #64 (will do it after confirmation from W. Maier).
675
684
676 * IPython/irunner.py: New module to run scripts as if manually
685 * IPython/irunner.py: New module to run scripts as if manually
677 typed into an interactive environment, based on pexpect. After a
686 typed into an interactive environment, based on pexpect. After a
678 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
687 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
679 ipython-user list. Simple unittests in the tests/ directory.
688 ipython-user list. Simple unittests in the tests/ directory.
680
689
681 * tools/release: add Will Maier, OpenBSD port maintainer, to
690 * tools/release: add Will Maier, OpenBSD port maintainer, to
682 recepients list. We are now officially part of the OpenBSD ports:
691 recepients list. We are now officially part of the OpenBSD ports:
683 http://www.openbsd.org/ports.html ! Many thanks to Will for the
692 http://www.openbsd.org/ports.html ! Many thanks to Will for the
684 work.
693 work.
685
694
686 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
695 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
687
696
688 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
697 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
689 so that it doesn't break tkinter apps.
698 so that it doesn't break tkinter apps.
690
699
691 * IPython/iplib.py (_prefilter): fix bug where aliases would
700 * IPython/iplib.py (_prefilter): fix bug where aliases would
692 shadow variables when autocall was fully off. Reported by SAGE
701 shadow variables when autocall was fully off. Reported by SAGE
693 author William Stein.
702 author William Stein.
694
703
695 * IPython/OInspect.py (Inspector.__init__): add a flag to control
704 * IPython/OInspect.py (Inspector.__init__): add a flag to control
696 at what detail level strings are computed when foo? is requested.
705 at what detail level strings are computed when foo? is requested.
697 This allows users to ask for example that the string form of an
706 This allows users to ask for example that the string form of an
698 object is only computed when foo?? is called, or even never, by
707 object is only computed when foo?? is called, or even never, by
699 setting the object_info_string_level >= 2 in the configuration
708 setting the object_info_string_level >= 2 in the configuration
700 file. This new option has been added and documented. After a
709 file. This new option has been added and documented. After a
701 request by SAGE to be able to control the printing of very large
710 request by SAGE to be able to control the printing of very large
702 objects more easily.
711 objects more easily.
703
712
704 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
713 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
705
714
706 * IPython/ipmaker.py (make_IPython): remove the ipython call path
715 * IPython/ipmaker.py (make_IPython): remove the ipython call path
707 from sys.argv, to be 100% consistent with how Python itself works
716 from sys.argv, to be 100% consistent with how Python itself works
708 (as seen for example with python -i file.py). After a bug report
717 (as seen for example with python -i file.py). After a bug report
709 by Jeffrey Collins.
718 by Jeffrey Collins.
710
719
711 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
720 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
712 nasty bug which was preventing custom namespaces with -pylab,
721 nasty bug which was preventing custom namespaces with -pylab,
713 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
722 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
714 compatibility (long gone from mpl).
723 compatibility (long gone from mpl).
715
724
716 * IPython/ipapi.py (make_session): name change: create->make. We
725 * IPython/ipapi.py (make_session): name change: create->make. We
717 use make in other places (ipmaker,...), it's shorter and easier to
726 use make in other places (ipmaker,...), it's shorter and easier to
718 type and say, etc. I'm trying to clean things before 0.7.2 so
727 type and say, etc. I'm trying to clean things before 0.7.2 so
719 that I can keep things stable wrt to ipapi in the chainsaw branch.
728 that I can keep things stable wrt to ipapi in the chainsaw branch.
720
729
721 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
730 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
722 python-mode recognizes our debugger mode. Add support for
731 python-mode recognizes our debugger mode. Add support for
723 autoindent inside (X)emacs. After a patch sent in by Jin Liu
732 autoindent inside (X)emacs. After a patch sent in by Jin Liu
724 <m.liu.jin-AT-gmail.com> originally written by
733 <m.liu.jin-AT-gmail.com> originally written by
725 doxgen-AT-newsmth.net (with minor modifications for xemacs
734 doxgen-AT-newsmth.net (with minor modifications for xemacs
726 compatibility)
735 compatibility)
727
736
728 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
737 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
729 tracebacks when walking the stack so that the stack tracking system
738 tracebacks when walking the stack so that the stack tracking system
730 in emacs' python-mode can identify the frames correctly.
739 in emacs' python-mode can identify the frames correctly.
731
740
732 * IPython/ipmaker.py (make_IPython): make the internal (and
741 * IPython/ipmaker.py (make_IPython): make the internal (and
733 default config) autoedit_syntax value false by default. Too many
742 default config) autoedit_syntax value false by default. Too many
734 users have complained to me (both on and off-list) about problems
743 users have complained to me (both on and off-list) about problems
735 with this option being on by default, so I'm making it default to
744 with this option being on by default, so I'm making it default to
736 off. It can still be enabled by anyone via the usual mechanisms.
745 off. It can still be enabled by anyone via the usual mechanisms.
737
746
738 * IPython/completer.py (Completer.attr_matches): add support for
747 * IPython/completer.py (Completer.attr_matches): add support for
739 PyCrust-style _getAttributeNames magic method. Patch contributed
748 PyCrust-style _getAttributeNames magic method. Patch contributed
740 by <mscott-AT-goldenspud.com>. Closes #50.
749 by <mscott-AT-goldenspud.com>. Closes #50.
741
750
742 * IPython/iplib.py (InteractiveShell.__init__): remove the
751 * IPython/iplib.py (InteractiveShell.__init__): remove the
743 deletion of exit/quit from __builtin__, which can break
752 deletion of exit/quit from __builtin__, which can break
744 third-party tools like the Zope debugging console. The
753 third-party tools like the Zope debugging console. The
745 %exit/%quit magics remain. In general, it's probably a good idea
754 %exit/%quit magics remain. In general, it's probably a good idea
746 not to delete anything from __builtin__, since we never know what
755 not to delete anything from __builtin__, since we never know what
747 that will break. In any case, python now (for 2.5) will support
756 that will break. In any case, python now (for 2.5) will support
748 'real' exit/quit, so this issue is moot. Closes #55.
757 'real' exit/quit, so this issue is moot. Closes #55.
749
758
750 * IPython/genutils.py (with_obj): rename the 'with' function to
759 * IPython/genutils.py (with_obj): rename the 'with' function to
751 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
760 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
752 becomes a language keyword. Closes #53.
761 becomes a language keyword. Closes #53.
753
762
754 * IPython/FakeModule.py (FakeModule.__init__): add a proper
763 * IPython/FakeModule.py (FakeModule.__init__): add a proper
755 __file__ attribute to this so it fools more things into thinking
764 __file__ attribute to this so it fools more things into thinking
756 it is a real module. Closes #59.
765 it is a real module. Closes #59.
757
766
758 * IPython/Magic.py (magic_edit): add -n option to open the editor
767 * IPython/Magic.py (magic_edit): add -n option to open the editor
759 at a specific line number. After a patch by Stefan van der Walt.
768 at a specific line number. After a patch by Stefan van der Walt.
760
769
761 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
770 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
762
771
763 * IPython/iplib.py (edit_syntax_error): fix crash when for some
772 * IPython/iplib.py (edit_syntax_error): fix crash when for some
764 reason the file could not be opened. After automatic crash
773 reason the file could not be opened. After automatic crash
765 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
774 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
766 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
775 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
767 (_should_recompile): Don't fire editor if using %bg, since there
776 (_should_recompile): Don't fire editor if using %bg, since there
768 is no file in the first place. From the same report as above.
777 is no file in the first place. From the same report as above.
769 (raw_input): protect against faulty third-party prefilters. After
778 (raw_input): protect against faulty third-party prefilters. After
770 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
779 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
771 while running under SAGE.
780 while running under SAGE.
772
781
773 2006-05-23 Ville Vainio <vivainio@gmail.com>
782 2006-05-23 Ville Vainio <vivainio@gmail.com>
774
783
775 * ipapi.py: Stripped down ip.to_user_ns() to work only as
784 * ipapi.py: Stripped down ip.to_user_ns() to work only as
776 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
785 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
777 now returns None (again), unless dummy is specifically allowed by
786 now returns None (again), unless dummy is specifically allowed by
778 ipapi.get(allow_dummy=True).
787 ipapi.get(allow_dummy=True).
779
788
780 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
789 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
781
790
782 * IPython: remove all 2.2-compatibility objects and hacks from
791 * IPython: remove all 2.2-compatibility objects and hacks from
783 everywhere, since we only support 2.3 at this point. Docs
792 everywhere, since we only support 2.3 at this point. Docs
784 updated.
793 updated.
785
794
786 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
795 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
787 Anything requiring extra validation can be turned into a Python
796 Anything requiring extra validation can be turned into a Python
788 property in the future. I used a property for the db one b/c
797 property in the future. I used a property for the db one b/c
789 there was a nasty circularity problem with the initialization
798 there was a nasty circularity problem with the initialization
790 order, which right now I don't have time to clean up.
799 order, which right now I don't have time to clean up.
791
800
792 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
801 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
793 another locking bug reported by Jorgen. I'm not 100% sure though,
802 another locking bug reported by Jorgen. I'm not 100% sure though,
794 so more testing is needed...
803 so more testing is needed...
795
804
796 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
805 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
797
806
798 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
807 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
799 local variables from any routine in user code (typically executed
808 local variables from any routine in user code (typically executed
800 with %run) directly into the interactive namespace. Very useful
809 with %run) directly into the interactive namespace. Very useful
801 when doing complex debugging.
810 when doing complex debugging.
802 (IPythonNotRunning): Changed the default None object to a dummy
811 (IPythonNotRunning): Changed the default None object to a dummy
803 whose attributes can be queried as well as called without
812 whose attributes can be queried as well as called without
804 exploding, to ease writing code which works transparently both in
813 exploding, to ease writing code which works transparently both in
805 and out of ipython and uses some of this API.
814 and out of ipython and uses some of this API.
806
815
807 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
816 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
808
817
809 * IPython/hooks.py (result_display): Fix the fact that our display
818 * IPython/hooks.py (result_display): Fix the fact that our display
810 hook was using str() instead of repr(), as the default python
819 hook was using str() instead of repr(), as the default python
811 console does. This had gone unnoticed b/c it only happened if
820 console does. This had gone unnoticed b/c it only happened if
812 %Pprint was off, but the inconsistency was there.
821 %Pprint was off, but the inconsistency was there.
813
822
814 2006-05-15 Ville Vainio <vivainio@gmail.com>
823 2006-05-15 Ville Vainio <vivainio@gmail.com>
815
824
816 * Oinspect.py: Only show docstring for nonexisting/binary files
825 * Oinspect.py: Only show docstring for nonexisting/binary files
817 when doing object??, closing ticket #62
826 when doing object??, closing ticket #62
818
827
819 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
828 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
820
829
821 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
830 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
822 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
831 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
823 was being released in a routine which hadn't checked if it had
832 was being released in a routine which hadn't checked if it had
824 been the one to acquire it.
833 been the one to acquire it.
825
834
826 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
835 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
827
836
828 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
837 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
829
838
830 2006-04-11 Ville Vainio <vivainio@gmail.com>
839 2006-04-11 Ville Vainio <vivainio@gmail.com>
831
840
832 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
841 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
833 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
842 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
834 prefilters, allowing stuff like magics and aliases in the file.
843 prefilters, allowing stuff like magics and aliases in the file.
835
844
836 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
845 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
837 added. Supported now are "%clear in" and "%clear out" (clear input and
846 added. Supported now are "%clear in" and "%clear out" (clear input and
838 output history, respectively). Also fixed CachedOutput.flush to
847 output history, respectively). Also fixed CachedOutput.flush to
839 properly flush the output cache.
848 properly flush the output cache.
840
849
841 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
850 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
842 half-success (and fail explicitly).
851 half-success (and fail explicitly).
843
852
844 2006-03-28 Ville Vainio <vivainio@gmail.com>
853 2006-03-28 Ville Vainio <vivainio@gmail.com>
845
854
846 * iplib.py: Fix quoting of aliases so that only argless ones
855 * iplib.py: Fix quoting of aliases so that only argless ones
847 are quoted
856 are quoted
848
857
849 2006-03-28 Ville Vainio <vivainio@gmail.com>
858 2006-03-28 Ville Vainio <vivainio@gmail.com>
850
859
851 * iplib.py: Quote aliases with spaces in the name.
860 * iplib.py: Quote aliases with spaces in the name.
852 "c:\program files\blah\bin" is now legal alias target.
861 "c:\program files\blah\bin" is now legal alias target.
853
862
854 * ext_rehashdir.py: Space no longer allowed as arg
863 * ext_rehashdir.py: Space no longer allowed as arg
855 separator, since space is legal in path names.
864 separator, since space is legal in path names.
856
865
857 2006-03-16 Ville Vainio <vivainio@gmail.com>
866 2006-03-16 Ville Vainio <vivainio@gmail.com>
858
867
859 * upgrade_dir.py: Take path.py from Extensions, correcting
868 * upgrade_dir.py: Take path.py from Extensions, correcting
860 %upgrade magic
869 %upgrade magic
861
870
862 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
871 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
863
872
864 * hooks.py: Only enclose editor binary in quotes if legal and
873 * hooks.py: Only enclose editor binary in quotes if legal and
865 necessary (space in the name, and is an existing file). Fixes a bug
874 necessary (space in the name, and is an existing file). Fixes a bug
866 reported by Zachary Pincus.
875 reported by Zachary Pincus.
867
876
868 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
877 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
869
878
870 * Manual: thanks to a tip on proper color handling for Emacs, by
879 * Manual: thanks to a tip on proper color handling for Emacs, by
871 Eric J Haywiser <ejh1-AT-MIT.EDU>.
880 Eric J Haywiser <ejh1-AT-MIT.EDU>.
872
881
873 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
882 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
874 by applying the provided patch. Thanks to Liu Jin
883 by applying the provided patch. Thanks to Liu Jin
875 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
884 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
876 XEmacs/Linux, I'm trusting the submitter that it actually helps
885 XEmacs/Linux, I'm trusting the submitter that it actually helps
877 under win32/GNU Emacs. Will revisit if any problems are reported.
886 under win32/GNU Emacs. Will revisit if any problems are reported.
878
887
879 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
888 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
880
889
881 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
890 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
882 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
891 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
883
892
884 2006-03-12 Ville Vainio <vivainio@gmail.com>
893 2006-03-12 Ville Vainio <vivainio@gmail.com>
885
894
886 * Magic.py (magic_timeit): Added %timeit magic, contributed by
895 * Magic.py (magic_timeit): Added %timeit magic, contributed by
887 Torsten Marek.
896 Torsten Marek.
888
897
889 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
898 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
890
899
891 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
900 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
892 line ranges works again.
901 line ranges works again.
893
902
894 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
903 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
895
904
896 * IPython/iplib.py (showtraceback): add back sys.last_traceback
905 * IPython/iplib.py (showtraceback): add back sys.last_traceback
897 and friends, after a discussion with Zach Pincus on ipython-user.
906 and friends, after a discussion with Zach Pincus on ipython-user.
898 I'm not 100% sure, but after thinking about it quite a bit, it may
907 I'm not 100% sure, but after thinking about it quite a bit, it may
899 be OK. Testing with the multithreaded shells didn't reveal any
908 be OK. Testing with the multithreaded shells didn't reveal any
900 problems, but let's keep an eye out.
909 problems, but let's keep an eye out.
901
910
902 In the process, I fixed a few things which were calling
911 In the process, I fixed a few things which were calling
903 self.InteractiveTB() directly (like safe_execfile), which is a
912 self.InteractiveTB() directly (like safe_execfile), which is a
904 mistake: ALL exception reporting should be done by calling
913 mistake: ALL exception reporting should be done by calling
905 self.showtraceback(), which handles state and tab-completion and
914 self.showtraceback(), which handles state and tab-completion and
906 more.
915 more.
907
916
908 2006-03-01 Ville Vainio <vivainio@gmail.com>
917 2006-03-01 Ville Vainio <vivainio@gmail.com>
909
918
910 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
919 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
911 To use, do "from ipipe import *".
920 To use, do "from ipipe import *".
912
921
913 2006-02-24 Ville Vainio <vivainio@gmail.com>
922 2006-02-24 Ville Vainio <vivainio@gmail.com>
914
923
915 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
924 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
916 "cleanly" and safely than the older upgrade mechanism.
925 "cleanly" and safely than the older upgrade mechanism.
917
926
918 2006-02-21 Ville Vainio <vivainio@gmail.com>
927 2006-02-21 Ville Vainio <vivainio@gmail.com>
919
928
920 * Magic.py: %save works again.
929 * Magic.py: %save works again.
921
930
922 2006-02-15 Ville Vainio <vivainio@gmail.com>
931 2006-02-15 Ville Vainio <vivainio@gmail.com>
923
932
924 * Magic.py: %Pprint works again
933 * Magic.py: %Pprint works again
925
934
926 * Extensions/ipy_sane_defaults.py: Provide everything provided
935 * Extensions/ipy_sane_defaults.py: Provide everything provided
927 in default ipythonrc, to make it possible to have a completely empty
936 in default ipythonrc, to make it possible to have a completely empty
928 ipythonrc (and thus completely rc-file free configuration)
937 ipythonrc (and thus completely rc-file free configuration)
929
938
930 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
939 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
931
940
932 * IPython/hooks.py (editor): quote the call to the editor command,
941 * IPython/hooks.py (editor): quote the call to the editor command,
933 to allow commands with spaces in them. Problem noted by watching
942 to allow commands with spaces in them. Problem noted by watching
934 Ian Oswald's video about textpad under win32 at
943 Ian Oswald's video about textpad under win32 at
935 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
944 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
936
945
937 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
946 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
938 describing magics (we haven't used @ for a loong time).
947 describing magics (we haven't used @ for a loong time).
939
948
940 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
949 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
941 contributed by marienz to close
950 contributed by marienz to close
942 http://www.scipy.net/roundup/ipython/issue53.
951 http://www.scipy.net/roundup/ipython/issue53.
943
952
944 2006-02-10 Ville Vainio <vivainio@gmail.com>
953 2006-02-10 Ville Vainio <vivainio@gmail.com>
945
954
946 * genutils.py: getoutput now works in win32 too
955 * genutils.py: getoutput now works in win32 too
947
956
948 * completer.py: alias and magic completion only invoked
957 * completer.py: alias and magic completion only invoked
949 at the first "item" in the line, to avoid "cd %store"
958 at the first "item" in the line, to avoid "cd %store"
950 nonsense.
959 nonsense.
951
960
952 2006-02-09 Ville Vainio <vivainio@gmail.com>
961 2006-02-09 Ville Vainio <vivainio@gmail.com>
953
962
954 * test/*: Added a unit testing framework (finally).
963 * test/*: Added a unit testing framework (finally).
955 '%run runtests.py' to run test_*.
964 '%run runtests.py' to run test_*.
956
965
957 * ipapi.py: Exposed runlines and set_custom_exc
966 * ipapi.py: Exposed runlines and set_custom_exc
958
967
959 2006-02-07 Ville Vainio <vivainio@gmail.com>
968 2006-02-07 Ville Vainio <vivainio@gmail.com>
960
969
961 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
970 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
962 instead use "f(1 2)" as before.
971 instead use "f(1 2)" as before.
963
972
964 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
973 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
965
974
966 * IPython/demo.py (IPythonDemo): Add new classes to the demo
975 * IPython/demo.py (IPythonDemo): Add new classes to the demo
967 facilities, for demos processed by the IPython input filter
976 facilities, for demos processed by the IPython input filter
968 (IPythonDemo), and for running a script one-line-at-a-time as a
977 (IPythonDemo), and for running a script one-line-at-a-time as a
969 demo, both for pure Python (LineDemo) and for IPython-processed
978 demo, both for pure Python (LineDemo) and for IPython-processed
970 input (IPythonLineDemo). After a request by Dave Kohel, from the
979 input (IPythonLineDemo). After a request by Dave Kohel, from the
971 SAGE team.
980 SAGE team.
972 (Demo.edit): added an edit() method to the demo objects, to edit
981 (Demo.edit): added an edit() method to the demo objects, to edit
973 the in-memory copy of the last executed block.
982 the in-memory copy of the last executed block.
974
983
975 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
984 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
976 processing to %edit, %macro and %save. These commands can now be
985 processing to %edit, %macro and %save. These commands can now be
977 invoked on the unprocessed input as it was typed by the user
986 invoked on the unprocessed input as it was typed by the user
978 (without any prefilters applied). After requests by the SAGE team
987 (without any prefilters applied). After requests by the SAGE team
979 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
988 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
980
989
981 2006-02-01 Ville Vainio <vivainio@gmail.com>
990 2006-02-01 Ville Vainio <vivainio@gmail.com>
982
991
983 * setup.py, eggsetup.py: easy_install ipython==dev works
992 * setup.py, eggsetup.py: easy_install ipython==dev works
984 correctly now (on Linux)
993 correctly now (on Linux)
985
994
986 * ipy_user_conf,ipmaker: user config changes, removed spurious
995 * ipy_user_conf,ipmaker: user config changes, removed spurious
987 warnings
996 warnings
988
997
989 * iplib: if rc.banner is string, use it as is.
998 * iplib: if rc.banner is string, use it as is.
990
999
991 * Magic: %pycat accepts a string argument and pages it's contents.
1000 * Magic: %pycat accepts a string argument and pages it's contents.
992
1001
993
1002
994 2006-01-30 Ville Vainio <vivainio@gmail.com>
1003 2006-01-30 Ville Vainio <vivainio@gmail.com>
995
1004
996 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1005 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
997 Now %store and bookmarks work through PickleShare, meaning that
1006 Now %store and bookmarks work through PickleShare, meaning that
998 concurrent access is possible and all ipython sessions see the
1007 concurrent access is possible and all ipython sessions see the
999 same database situation all the time, instead of snapshot of
1008 same database situation all the time, instead of snapshot of
1000 the situation when the session was started. Hence, %bookmark
1009 the situation when the session was started. Hence, %bookmark
1001 results are immediately accessible from othes sessions. The database
1010 results are immediately accessible from othes sessions. The database
1002 is also available for use by user extensions. See:
1011 is also available for use by user extensions. See:
1003 http://www.python.org/pypi/pickleshare
1012 http://www.python.org/pypi/pickleshare
1004
1013
1005 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1014 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1006
1015
1007 * aliases can now be %store'd
1016 * aliases can now be %store'd
1008
1017
1009 * path.py moved to Extensions so that pickleshare does not need
1018 * path.py moved to Extensions so that pickleshare does not need
1010 IPython-specific import. Extensions added to pythonpath right
1019 IPython-specific import. Extensions added to pythonpath right
1011 at __init__.
1020 at __init__.
1012
1021
1013 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1022 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1014 called with _ip.system and the pre-transformed command string.
1023 called with _ip.system and the pre-transformed command string.
1015
1024
1016 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1025 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1017
1026
1018 * IPython/iplib.py (interact): Fix that we were not catching
1027 * IPython/iplib.py (interact): Fix that we were not catching
1019 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1028 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1020 logic here had to change, but it's fixed now.
1029 logic here had to change, but it's fixed now.
1021
1030
1022 2006-01-29 Ville Vainio <vivainio@gmail.com>
1031 2006-01-29 Ville Vainio <vivainio@gmail.com>
1023
1032
1024 * iplib.py: Try to import pyreadline on Windows.
1033 * iplib.py: Try to import pyreadline on Windows.
1025
1034
1026 2006-01-27 Ville Vainio <vivainio@gmail.com>
1035 2006-01-27 Ville Vainio <vivainio@gmail.com>
1027
1036
1028 * iplib.py: Expose ipapi as _ip in builtin namespace.
1037 * iplib.py: Expose ipapi as _ip in builtin namespace.
1029 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1038 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1030 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1039 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1031 syntax now produce _ip.* variant of the commands.
1040 syntax now produce _ip.* variant of the commands.
1032
1041
1033 * "_ip.options().autoedit_syntax = 2" automatically throws
1042 * "_ip.options().autoedit_syntax = 2" automatically throws
1034 user to editor for syntax error correction without prompting.
1043 user to editor for syntax error correction without prompting.
1035
1044
1036 2006-01-27 Ville Vainio <vivainio@gmail.com>
1045 2006-01-27 Ville Vainio <vivainio@gmail.com>
1037
1046
1038 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1047 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1039 'ipython' at argv[0]) executed through command line.
1048 'ipython' at argv[0]) executed through command line.
1040 NOTE: this DEPRECATES calling ipython with multiple scripts
1049 NOTE: this DEPRECATES calling ipython with multiple scripts
1041 ("ipython a.py b.py c.py")
1050 ("ipython a.py b.py c.py")
1042
1051
1043 * iplib.py, hooks.py: Added configurable input prefilter,
1052 * iplib.py, hooks.py: Added configurable input prefilter,
1044 named 'input_prefilter'. See ext_rescapture.py for example
1053 named 'input_prefilter'. See ext_rescapture.py for example
1045 usage.
1054 usage.
1046
1055
1047 * ext_rescapture.py, Magic.py: Better system command output capture
1056 * ext_rescapture.py, Magic.py: Better system command output capture
1048 through 'var = !ls' (deprecates user-visible %sc). Same notation
1057 through 'var = !ls' (deprecates user-visible %sc). Same notation
1049 applies for magics, 'var = %alias' assigns alias list to var.
1058 applies for magics, 'var = %alias' assigns alias list to var.
1050
1059
1051 * ipapi.py: added meta() for accessing extension-usable data store.
1060 * ipapi.py: added meta() for accessing extension-usable data store.
1052
1061
1053 * iplib.py: added InteractiveShell.getapi(). New magics should be
1062 * iplib.py: added InteractiveShell.getapi(). New magics should be
1054 written doing self.getapi() instead of using the shell directly.
1063 written doing self.getapi() instead of using the shell directly.
1055
1064
1056 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1065 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1057 %store foo >> ~/myfoo.txt to store variables to files (in clean
1066 %store foo >> ~/myfoo.txt to store variables to files (in clean
1058 textual form, not a restorable pickle).
1067 textual form, not a restorable pickle).
1059
1068
1060 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1069 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1061
1070
1062 * usage.py, Magic.py: added %quickref
1071 * usage.py, Magic.py: added %quickref
1063
1072
1064 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1073 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1065
1074
1066 * GetoptErrors when invoking magics etc. with wrong args
1075 * GetoptErrors when invoking magics etc. with wrong args
1067 are now more helpful:
1076 are now more helpful:
1068 GetoptError: option -l not recognized (allowed: "qb" )
1077 GetoptError: option -l not recognized (allowed: "qb" )
1069
1078
1070 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1079 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1071
1080
1072 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1081 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1073 computationally intensive blocks don't appear to stall the demo.
1082 computationally intensive blocks don't appear to stall the demo.
1074
1083
1075 2006-01-24 Ville Vainio <vivainio@gmail.com>
1084 2006-01-24 Ville Vainio <vivainio@gmail.com>
1076
1085
1077 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1086 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1078 value to manipulate resulting history entry.
1087 value to manipulate resulting history entry.
1079
1088
1080 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1089 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1081 to instance methods of IPApi class, to make extending an embedded
1090 to instance methods of IPApi class, to make extending an embedded
1082 IPython feasible. See ext_rehashdir.py for example usage.
1091 IPython feasible. See ext_rehashdir.py for example usage.
1083
1092
1084 * Merged 1071-1076 from branches/0.7.1
1093 * Merged 1071-1076 from branches/0.7.1
1085
1094
1086
1095
1087 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1096 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1088
1097
1089 * tools/release (daystamp): Fix build tools to use the new
1098 * tools/release (daystamp): Fix build tools to use the new
1090 eggsetup.py script to build lightweight eggs.
1099 eggsetup.py script to build lightweight eggs.
1091
1100
1092 * Applied changesets 1062 and 1064 before 0.7.1 release.
1101 * Applied changesets 1062 and 1064 before 0.7.1 release.
1093
1102
1094 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1103 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1095 see the raw input history (without conversions like %ls ->
1104 see the raw input history (without conversions like %ls ->
1096 ipmagic("ls")). After a request from W. Stein, SAGE
1105 ipmagic("ls")). After a request from W. Stein, SAGE
1097 (http://modular.ucsd.edu/sage) developer. This information is
1106 (http://modular.ucsd.edu/sage) developer. This information is
1098 stored in the input_hist_raw attribute of the IPython instance, so
1107 stored in the input_hist_raw attribute of the IPython instance, so
1099 developers can access it if needed (it's an InputList instance).
1108 developers can access it if needed (it's an InputList instance).
1100
1109
1101 * Versionstring = 0.7.2.svn
1110 * Versionstring = 0.7.2.svn
1102
1111
1103 * eggsetup.py: A separate script for constructing eggs, creates
1112 * eggsetup.py: A separate script for constructing eggs, creates
1104 proper launch scripts even on Windows (an .exe file in
1113 proper launch scripts even on Windows (an .exe file in
1105 \python24\scripts).
1114 \python24\scripts).
1106
1115
1107 * ipapi.py: launch_new_instance, launch entry point needed for the
1116 * ipapi.py: launch_new_instance, launch entry point needed for the
1108 egg.
1117 egg.
1109
1118
1110 2006-01-23 Ville Vainio <vivainio@gmail.com>
1119 2006-01-23 Ville Vainio <vivainio@gmail.com>
1111
1120
1112 * Added %cpaste magic for pasting python code
1121 * Added %cpaste magic for pasting python code
1113
1122
1114 2006-01-22 Ville Vainio <vivainio@gmail.com>
1123 2006-01-22 Ville Vainio <vivainio@gmail.com>
1115
1124
1116 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1125 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1117
1126
1118 * Versionstring = 0.7.2.svn
1127 * Versionstring = 0.7.2.svn
1119
1128
1120 * eggsetup.py: A separate script for constructing eggs, creates
1129 * eggsetup.py: A separate script for constructing eggs, creates
1121 proper launch scripts even on Windows (an .exe file in
1130 proper launch scripts even on Windows (an .exe file in
1122 \python24\scripts).
1131 \python24\scripts).
1123
1132
1124 * ipapi.py: launch_new_instance, launch entry point needed for the
1133 * ipapi.py: launch_new_instance, launch entry point needed for the
1125 egg.
1134 egg.
1126
1135
1127 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1136 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1128
1137
1129 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1138 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1130 %pfile foo would print the file for foo even if it was a binary.
1139 %pfile foo would print the file for foo even if it was a binary.
1131 Now, extensions '.so' and '.dll' are skipped.
1140 Now, extensions '.so' and '.dll' are skipped.
1132
1141
1133 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1142 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1134 bug, where macros would fail in all threaded modes. I'm not 100%
1143 bug, where macros would fail in all threaded modes. I'm not 100%
1135 sure, so I'm going to put out an rc instead of making a release
1144 sure, so I'm going to put out an rc instead of making a release
1136 today, and wait for feedback for at least a few days.
1145 today, and wait for feedback for at least a few days.
1137
1146
1138 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1147 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1139 it...) the handling of pasting external code with autoindent on.
1148 it...) the handling of pasting external code with autoindent on.
1140 To get out of a multiline input, the rule will appear for most
1149 To get out of a multiline input, the rule will appear for most
1141 users unchanged: two blank lines or change the indent level
1150 users unchanged: two blank lines or change the indent level
1142 proposed by IPython. But there is a twist now: you can
1151 proposed by IPython. But there is a twist now: you can
1143 add/subtract only *one or two spaces*. If you add/subtract three
1152 add/subtract only *one or two spaces*. If you add/subtract three
1144 or more (unless you completely delete the line), IPython will
1153 or more (unless you completely delete the line), IPython will
1145 accept that line, and you'll need to enter a second one of pure
1154 accept that line, and you'll need to enter a second one of pure
1146 whitespace. I know it sounds complicated, but I can't find a
1155 whitespace. I know it sounds complicated, but I can't find a
1147 different solution that covers all the cases, with the right
1156 different solution that covers all the cases, with the right
1148 heuristics. Hopefully in actual use, nobody will really notice
1157 heuristics. Hopefully in actual use, nobody will really notice
1149 all these strange rules and things will 'just work'.
1158 all these strange rules and things will 'just work'.
1150
1159
1151 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1160 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1152
1161
1153 * IPython/iplib.py (interact): catch exceptions which can be
1162 * IPython/iplib.py (interact): catch exceptions which can be
1154 triggered asynchronously by signal handlers. Thanks to an
1163 triggered asynchronously by signal handlers. Thanks to an
1155 automatic crash report, submitted by Colin Kingsley
1164 automatic crash report, submitted by Colin Kingsley
1156 <tercel-AT-gentoo.org>.
1165 <tercel-AT-gentoo.org>.
1157
1166
1158 2006-01-20 Ville Vainio <vivainio@gmail.com>
1167 2006-01-20 Ville Vainio <vivainio@gmail.com>
1159
1168
1160 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1169 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1161 (%rehashdir, very useful, try it out) of how to extend ipython
1170 (%rehashdir, very useful, try it out) of how to extend ipython
1162 with new magics. Also added Extensions dir to pythonpath to make
1171 with new magics. Also added Extensions dir to pythonpath to make
1163 importing extensions easy.
1172 importing extensions easy.
1164
1173
1165 * %store now complains when trying to store interactively declared
1174 * %store now complains when trying to store interactively declared
1166 classes / instances of those classes.
1175 classes / instances of those classes.
1167
1176
1168 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1177 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1169 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1178 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1170 if they exist, and ipy_user_conf.py with some defaults is created for
1179 if they exist, and ipy_user_conf.py with some defaults is created for
1171 the user.
1180 the user.
1172
1181
1173 * Startup rehashing done by the config file, not InterpreterExec.
1182 * Startup rehashing done by the config file, not InterpreterExec.
1174 This means system commands are available even without selecting the
1183 This means system commands are available even without selecting the
1175 pysh profile. It's the sensible default after all.
1184 pysh profile. It's the sensible default after all.
1176
1185
1177 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1186 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1178
1187
1179 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1188 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1180 multiline code with autoindent on working. But I am really not
1189 multiline code with autoindent on working. But I am really not
1181 sure, so this needs more testing. Will commit a debug-enabled
1190 sure, so this needs more testing. Will commit a debug-enabled
1182 version for now, while I test it some more, so that Ville and
1191 version for now, while I test it some more, so that Ville and
1183 others may also catch any problems. Also made
1192 others may also catch any problems. Also made
1184 self.indent_current_str() a method, to ensure that there's no
1193 self.indent_current_str() a method, to ensure that there's no
1185 chance of the indent space count and the corresponding string
1194 chance of the indent space count and the corresponding string
1186 falling out of sync. All code needing the string should just call
1195 falling out of sync. All code needing the string should just call
1187 the method.
1196 the method.
1188
1197
1189 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1198 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1190
1199
1191 * IPython/Magic.py (magic_edit): fix check for when users don't
1200 * IPython/Magic.py (magic_edit): fix check for when users don't
1192 save their output files, the try/except was in the wrong section.
1201 save their output files, the try/except was in the wrong section.
1193
1202
1194 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1203 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1195
1204
1196 * IPython/Magic.py (magic_run): fix __file__ global missing from
1205 * IPython/Magic.py (magic_run): fix __file__ global missing from
1197 script's namespace when executed via %run. After a report by
1206 script's namespace when executed via %run. After a report by
1198 Vivian.
1207 Vivian.
1199
1208
1200 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1209 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1201 when using python 2.4. The parent constructor changed in 2.4, and
1210 when using python 2.4. The parent constructor changed in 2.4, and
1202 we need to track it directly (we can't call it, as it messes up
1211 we need to track it directly (we can't call it, as it messes up
1203 readline and tab-completion inside our pdb would stop working).
1212 readline and tab-completion inside our pdb would stop working).
1204 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1213 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1205
1214
1206 2006-01-16 Ville Vainio <vivainio@gmail.com>
1215 2006-01-16 Ville Vainio <vivainio@gmail.com>
1207
1216
1208 * Ipython/magic.py: Reverted back to old %edit functionality
1217 * Ipython/magic.py: Reverted back to old %edit functionality
1209 that returns file contents on exit.
1218 that returns file contents on exit.
1210
1219
1211 * IPython/path.py: Added Jason Orendorff's "path" module to
1220 * IPython/path.py: Added Jason Orendorff's "path" module to
1212 IPython tree, http://www.jorendorff.com/articles/python/path/.
1221 IPython tree, http://www.jorendorff.com/articles/python/path/.
1213 You can get path objects conveniently through %sc, and !!, e.g.:
1222 You can get path objects conveniently through %sc, and !!, e.g.:
1214 sc files=ls
1223 sc files=ls
1215 for p in files.paths: # or files.p
1224 for p in files.paths: # or files.p
1216 print p,p.mtime
1225 print p,p.mtime
1217
1226
1218 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1227 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1219 now work again without considering the exclusion regexp -
1228 now work again without considering the exclusion regexp -
1220 hence, things like ',foo my/path' turn to 'foo("my/path")'
1229 hence, things like ',foo my/path' turn to 'foo("my/path")'
1221 instead of syntax error.
1230 instead of syntax error.
1222
1231
1223
1232
1224 2006-01-14 Ville Vainio <vivainio@gmail.com>
1233 2006-01-14 Ville Vainio <vivainio@gmail.com>
1225
1234
1226 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1235 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1227 ipapi decorators for python 2.4 users, options() provides access to rc
1236 ipapi decorators for python 2.4 users, options() provides access to rc
1228 data.
1237 data.
1229
1238
1230 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1239 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1231 as path separators (even on Linux ;-). Space character after
1240 as path separators (even on Linux ;-). Space character after
1232 backslash (as yielded by tab completer) is still space;
1241 backslash (as yielded by tab completer) is still space;
1233 "%cd long\ name" works as expected.
1242 "%cd long\ name" works as expected.
1234
1243
1235 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1244 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1236 as "chain of command", with priority. API stays the same,
1245 as "chain of command", with priority. API stays the same,
1237 TryNext exception raised by a hook function signals that
1246 TryNext exception raised by a hook function signals that
1238 current hook failed and next hook should try handling it, as
1247 current hook failed and next hook should try handling it, as
1239 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
1248 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
1240 requested configurable display hook, which is now implemented.
1249 requested configurable display hook, which is now implemented.
1241
1250
1242 2006-01-13 Ville Vainio <vivainio@gmail.com>
1251 2006-01-13 Ville Vainio <vivainio@gmail.com>
1243
1252
1244 * IPython/platutils*.py: platform specific utility functions,
1253 * IPython/platutils*.py: platform specific utility functions,
1245 so far only set_term_title is implemented (change terminal
1254 so far only set_term_title is implemented (change terminal
1246 label in windowing systems). %cd now changes the title to
1255 label in windowing systems). %cd now changes the title to
1247 current dir.
1256 current dir.
1248
1257
1249 * IPython/Release.py: Added myself to "authors" list,
1258 * IPython/Release.py: Added myself to "authors" list,
1250 had to create new files.
1259 had to create new files.
1251
1260
1252 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1261 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1253 shell escape; not a known bug but had potential to be one in the
1262 shell escape; not a known bug but had potential to be one in the
1254 future.
1263 future.
1255
1264
1256 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1265 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1257 extension API for IPython! See the module for usage example. Fix
1266 extension API for IPython! See the module for usage example. Fix
1258 OInspect for docstring-less magic functions.
1267 OInspect for docstring-less magic functions.
1259
1268
1260
1269
1261 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1270 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1262
1271
1263 * IPython/iplib.py (raw_input): temporarily deactivate all
1272 * IPython/iplib.py (raw_input): temporarily deactivate all
1264 attempts at allowing pasting of code with autoindent on. It
1273 attempts at allowing pasting of code with autoindent on. It
1265 introduced bugs (reported by Prabhu) and I can't seem to find a
1274 introduced bugs (reported by Prabhu) and I can't seem to find a
1266 robust combination which works in all cases. Will have to revisit
1275 robust combination which works in all cases. Will have to revisit
1267 later.
1276 later.
1268
1277
1269 * IPython/genutils.py: remove isspace() function. We've dropped
1278 * IPython/genutils.py: remove isspace() function. We've dropped
1270 2.2 compatibility, so it's OK to use the string method.
1279 2.2 compatibility, so it's OK to use the string method.
1271
1280
1272 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1281 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1273
1282
1274 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1283 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1275 matching what NOT to autocall on, to include all python binary
1284 matching what NOT to autocall on, to include all python binary
1276 operators (including things like 'and', 'or', 'is' and 'in').
1285 operators (including things like 'and', 'or', 'is' and 'in').
1277 Prompted by a bug report on 'foo & bar', but I realized we had
1286 Prompted by a bug report on 'foo & bar', but I realized we had
1278 many more potential bug cases with other operators. The regexp is
1287 many more potential bug cases with other operators. The regexp is
1279 self.re_exclude_auto, it's fairly commented.
1288 self.re_exclude_auto, it's fairly commented.
1280
1289
1281 2006-01-12 Ville Vainio <vivainio@gmail.com>
1290 2006-01-12 Ville Vainio <vivainio@gmail.com>
1282
1291
1283 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1292 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1284 Prettified and hardened string/backslash quoting with ipsystem(),
1293 Prettified and hardened string/backslash quoting with ipsystem(),
1285 ipalias() and ipmagic(). Now even \ characters are passed to
1294 ipalias() and ipmagic(). Now even \ characters are passed to
1286 %magics, !shell escapes and aliases exactly as they are in the
1295 %magics, !shell escapes and aliases exactly as they are in the
1287 ipython command line. Should improve backslash experience,
1296 ipython command line. Should improve backslash experience,
1288 particularly in Windows (path delimiter for some commands that
1297 particularly in Windows (path delimiter for some commands that
1289 won't understand '/'), but Unix benefits as well (regexps). %cd
1298 won't understand '/'), but Unix benefits as well (regexps). %cd
1290 magic still doesn't support backslash path delimiters, though. Also
1299 magic still doesn't support backslash path delimiters, though. Also
1291 deleted all pretense of supporting multiline command strings in
1300 deleted all pretense of supporting multiline command strings in
1292 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1301 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1293
1302
1294 * doc/build_doc_instructions.txt added. Documentation on how to
1303 * doc/build_doc_instructions.txt added. Documentation on how to
1295 use doc/update_manual.py, added yesterday. Both files contributed
1304 use doc/update_manual.py, added yesterday. Both files contributed
1296 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1305 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1297 doc/*.sh for deprecation at a later date.
1306 doc/*.sh for deprecation at a later date.
1298
1307
1299 * /ipython.py Added ipython.py to root directory for
1308 * /ipython.py Added ipython.py to root directory for
1300 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1309 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1301 ipython.py) and development convenience (no need to keep doing
1310 ipython.py) and development convenience (no need to keep doing
1302 "setup.py install" between changes).
1311 "setup.py install" between changes).
1303
1312
1304 * Made ! and !! shell escapes work (again) in multiline expressions:
1313 * Made ! and !! shell escapes work (again) in multiline expressions:
1305 if 1:
1314 if 1:
1306 !ls
1315 !ls
1307 !!ls
1316 !!ls
1308
1317
1309 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1318 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1310
1319
1311 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1320 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1312 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1321 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1313 module in case-insensitive installation. Was causing crashes
1322 module in case-insensitive installation. Was causing crashes
1314 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1323 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1315
1324
1316 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1325 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1317 <marienz-AT-gentoo.org>, closes
1326 <marienz-AT-gentoo.org>, closes
1318 http://www.scipy.net/roundup/ipython/issue51.
1327 http://www.scipy.net/roundup/ipython/issue51.
1319
1328
1320 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1329 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1321
1330
1322 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1331 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1323 problem of excessive CPU usage under *nix and keyboard lag under
1332 problem of excessive CPU usage under *nix and keyboard lag under
1324 win32.
1333 win32.
1325
1334
1326 2006-01-10 *** Released version 0.7.0
1335 2006-01-10 *** Released version 0.7.0
1327
1336
1328 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1337 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1329
1338
1330 * IPython/Release.py (revision): tag version number to 0.7.0,
1339 * IPython/Release.py (revision): tag version number to 0.7.0,
1331 ready for release.
1340 ready for release.
1332
1341
1333 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1342 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1334 it informs the user of the name of the temp. file used. This can
1343 it informs the user of the name of the temp. file used. This can
1335 help if you decide later to reuse that same file, so you know
1344 help if you decide later to reuse that same file, so you know
1336 where to copy the info from.
1345 where to copy the info from.
1337
1346
1338 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1347 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1339
1348
1340 * setup_bdist_egg.py: little script to build an egg. Added
1349 * setup_bdist_egg.py: little script to build an egg. Added
1341 support in the release tools as well.
1350 support in the release tools as well.
1342
1351
1343 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1352 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1344
1353
1345 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1354 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1346 version selection (new -wxversion command line and ipythonrc
1355 version selection (new -wxversion command line and ipythonrc
1347 parameter). Patch contributed by Arnd Baecker
1356 parameter). Patch contributed by Arnd Baecker
1348 <arnd.baecker-AT-web.de>.
1357 <arnd.baecker-AT-web.de>.
1349
1358
1350 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1359 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1351 embedded instances, for variables defined at the interactive
1360 embedded instances, for variables defined at the interactive
1352 prompt of the embedded ipython. Reported by Arnd.
1361 prompt of the embedded ipython. Reported by Arnd.
1353
1362
1354 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1363 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1355 it can be used as a (stateful) toggle, or with a direct parameter.
1364 it can be used as a (stateful) toggle, or with a direct parameter.
1356
1365
1357 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1366 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1358 could be triggered in certain cases and cause the traceback
1367 could be triggered in certain cases and cause the traceback
1359 printer not to work.
1368 printer not to work.
1360
1369
1361 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1370 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1362
1371
1363 * IPython/iplib.py (_should_recompile): Small fix, closes
1372 * IPython/iplib.py (_should_recompile): Small fix, closes
1364 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1373 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1365
1374
1366 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1375 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1367
1376
1368 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1377 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1369 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1378 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1370 Moad for help with tracking it down.
1379 Moad for help with tracking it down.
1371
1380
1372 * IPython/iplib.py (handle_auto): fix autocall handling for
1381 * IPython/iplib.py (handle_auto): fix autocall handling for
1373 objects which support BOTH __getitem__ and __call__ (so that f [x]
1382 objects which support BOTH __getitem__ and __call__ (so that f [x]
1374 is left alone, instead of becoming f([x]) automatically).
1383 is left alone, instead of becoming f([x]) automatically).
1375
1384
1376 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1385 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1377 Ville's patch.
1386 Ville's patch.
1378
1387
1379 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1388 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1380
1389
1381 * IPython/iplib.py (handle_auto): changed autocall semantics to
1390 * IPython/iplib.py (handle_auto): changed autocall semantics to
1382 include 'smart' mode, where the autocall transformation is NOT
1391 include 'smart' mode, where the autocall transformation is NOT
1383 applied if there are no arguments on the line. This allows you to
1392 applied if there are no arguments on the line. This allows you to
1384 just type 'foo' if foo is a callable to see its internal form,
1393 just type 'foo' if foo is a callable to see its internal form,
1385 instead of having it called with no arguments (typically a
1394 instead of having it called with no arguments (typically a
1386 mistake). The old 'full' autocall still exists: for that, you
1395 mistake). The old 'full' autocall still exists: for that, you
1387 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1396 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1388
1397
1389 * IPython/completer.py (Completer.attr_matches): add
1398 * IPython/completer.py (Completer.attr_matches): add
1390 tab-completion support for Enthoughts' traits. After a report by
1399 tab-completion support for Enthoughts' traits. After a report by
1391 Arnd and a patch by Prabhu.
1400 Arnd and a patch by Prabhu.
1392
1401
1393 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1402 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1394
1403
1395 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1404 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1396 Schmolck's patch to fix inspect.getinnerframes().
1405 Schmolck's patch to fix inspect.getinnerframes().
1397
1406
1398 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1407 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1399 for embedded instances, regarding handling of namespaces and items
1408 for embedded instances, regarding handling of namespaces and items
1400 added to the __builtin__ one. Multiple embedded instances and
1409 added to the __builtin__ one. Multiple embedded instances and
1401 recursive embeddings should work better now (though I'm not sure
1410 recursive embeddings should work better now (though I'm not sure
1402 I've got all the corner cases fixed, that code is a bit of a brain
1411 I've got all the corner cases fixed, that code is a bit of a brain
1403 twister).
1412 twister).
1404
1413
1405 * IPython/Magic.py (magic_edit): added support to edit in-memory
1414 * IPython/Magic.py (magic_edit): added support to edit in-memory
1406 macros (automatically creates the necessary temp files). %edit
1415 macros (automatically creates the necessary temp files). %edit
1407 also doesn't return the file contents anymore, it's just noise.
1416 also doesn't return the file contents anymore, it's just noise.
1408
1417
1409 * IPython/completer.py (Completer.attr_matches): revert change to
1418 * IPython/completer.py (Completer.attr_matches): revert change to
1410 complete only on attributes listed in __all__. I realized it
1419 complete only on attributes listed in __all__. I realized it
1411 cripples the tab-completion system as a tool for exploring the
1420 cripples the tab-completion system as a tool for exploring the
1412 internals of unknown libraries (it renders any non-__all__
1421 internals of unknown libraries (it renders any non-__all__
1413 attribute off-limits). I got bit by this when trying to see
1422 attribute off-limits). I got bit by this when trying to see
1414 something inside the dis module.
1423 something inside the dis module.
1415
1424
1416 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1425 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1417
1426
1418 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1427 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1419 namespace for users and extension writers to hold data in. This
1428 namespace for users and extension writers to hold data in. This
1420 follows the discussion in
1429 follows the discussion in
1421 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1430 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1422
1431
1423 * IPython/completer.py (IPCompleter.complete): small patch to help
1432 * IPython/completer.py (IPCompleter.complete): small patch to help
1424 tab-completion under Emacs, after a suggestion by John Barnard
1433 tab-completion under Emacs, after a suggestion by John Barnard
1425 <barnarj-AT-ccf.org>.
1434 <barnarj-AT-ccf.org>.
1426
1435
1427 * IPython/Magic.py (Magic.extract_input_slices): added support for
1436 * IPython/Magic.py (Magic.extract_input_slices): added support for
1428 the slice notation in magics to use N-M to represent numbers N...M
1437 the slice notation in magics to use N-M to represent numbers N...M
1429 (closed endpoints). This is used by %macro and %save.
1438 (closed endpoints). This is used by %macro and %save.
1430
1439
1431 * IPython/completer.py (Completer.attr_matches): for modules which
1440 * IPython/completer.py (Completer.attr_matches): for modules which
1432 define __all__, complete only on those. After a patch by Jeffrey
1441 define __all__, complete only on those. After a patch by Jeffrey
1433 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1442 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1434 speed up this routine.
1443 speed up this routine.
1435
1444
1436 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1445 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1437 don't know if this is the end of it, but the behavior now is
1446 don't know if this is the end of it, but the behavior now is
1438 certainly much more correct. Note that coupled with macros,
1447 certainly much more correct. Note that coupled with macros,
1439 slightly surprising (at first) behavior may occur: a macro will in
1448 slightly surprising (at first) behavior may occur: a macro will in
1440 general expand to multiple lines of input, so upon exiting, the
1449 general expand to multiple lines of input, so upon exiting, the
1441 in/out counters will both be bumped by the corresponding amount
1450 in/out counters will both be bumped by the corresponding amount
1442 (as if the macro's contents had been typed interactively). Typing
1451 (as if the macro's contents had been typed interactively). Typing
1443 %hist will reveal the intermediate (silently processed) lines.
1452 %hist will reveal the intermediate (silently processed) lines.
1444
1453
1445 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1454 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1446 pickle to fail (%run was overwriting __main__ and not restoring
1455 pickle to fail (%run was overwriting __main__ and not restoring
1447 it, but pickle relies on __main__ to operate).
1456 it, but pickle relies on __main__ to operate).
1448
1457
1449 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1458 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1450 using properties, but forgot to make the main InteractiveShell
1459 using properties, but forgot to make the main InteractiveShell
1451 class a new-style class. Properties fail silently, and
1460 class a new-style class. Properties fail silently, and
1452 mysteriously, with old-style class (getters work, but
1461 mysteriously, with old-style class (getters work, but
1453 setters don't do anything).
1462 setters don't do anything).
1454
1463
1455 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1464 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1456
1465
1457 * IPython/Magic.py (magic_history): fix history reporting bug (I
1466 * IPython/Magic.py (magic_history): fix history reporting bug (I
1458 know some nasties are still there, I just can't seem to find a
1467 know some nasties are still there, I just can't seem to find a
1459 reproducible test case to track them down; the input history is
1468 reproducible test case to track them down; the input history is
1460 falling out of sync...)
1469 falling out of sync...)
1461
1470
1462 * IPython/iplib.py (handle_shell_escape): fix bug where both
1471 * IPython/iplib.py (handle_shell_escape): fix bug where both
1463 aliases and system accesses where broken for indented code (such
1472 aliases and system accesses where broken for indented code (such
1464 as loops).
1473 as loops).
1465
1474
1466 * IPython/genutils.py (shell): fix small but critical bug for
1475 * IPython/genutils.py (shell): fix small but critical bug for
1467 win32 system access.
1476 win32 system access.
1468
1477
1469 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1478 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1470
1479
1471 * IPython/iplib.py (showtraceback): remove use of the
1480 * IPython/iplib.py (showtraceback): remove use of the
1472 sys.last_{type/value/traceback} structures, which are non
1481 sys.last_{type/value/traceback} structures, which are non
1473 thread-safe.
1482 thread-safe.
1474 (_prefilter): change control flow to ensure that we NEVER
1483 (_prefilter): change control flow to ensure that we NEVER
1475 introspect objects when autocall is off. This will guarantee that
1484 introspect objects when autocall is off. This will guarantee that
1476 having an input line of the form 'x.y', where access to attribute
1485 having an input line of the form 'x.y', where access to attribute
1477 'y' has side effects, doesn't trigger the side effect TWICE. It
1486 'y' has side effects, doesn't trigger the side effect TWICE. It
1478 is important to note that, with autocall on, these side effects
1487 is important to note that, with autocall on, these side effects
1479 can still happen.
1488 can still happen.
1480 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1489 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1481 trio. IPython offers these three kinds of special calls which are
1490 trio. IPython offers these three kinds of special calls which are
1482 not python code, and it's a good thing to have their call method
1491 not python code, and it's a good thing to have their call method
1483 be accessible as pure python functions (not just special syntax at
1492 be accessible as pure python functions (not just special syntax at
1484 the command line). It gives us a better internal implementation
1493 the command line). It gives us a better internal implementation
1485 structure, as well as exposing these for user scripting more
1494 structure, as well as exposing these for user scripting more
1486 cleanly.
1495 cleanly.
1487
1496
1488 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1497 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1489 file. Now that they'll be more likely to be used with the
1498 file. Now that they'll be more likely to be used with the
1490 persistance system (%store), I want to make sure their module path
1499 persistance system (%store), I want to make sure their module path
1491 doesn't change in the future, so that we don't break things for
1500 doesn't change in the future, so that we don't break things for
1492 users' persisted data.
1501 users' persisted data.
1493
1502
1494 * IPython/iplib.py (autoindent_update): move indentation
1503 * IPython/iplib.py (autoindent_update): move indentation
1495 management into the _text_ processing loop, not the keyboard
1504 management into the _text_ processing loop, not the keyboard
1496 interactive one. This is necessary to correctly process non-typed
1505 interactive one. This is necessary to correctly process non-typed
1497 multiline input (such as macros).
1506 multiline input (such as macros).
1498
1507
1499 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1508 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1500 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1509 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1501 which was producing problems in the resulting manual.
1510 which was producing problems in the resulting manual.
1502 (magic_whos): improve reporting of instances (show their class,
1511 (magic_whos): improve reporting of instances (show their class,
1503 instead of simply printing 'instance' which isn't terribly
1512 instead of simply printing 'instance' which isn't terribly
1504 informative).
1513 informative).
1505
1514
1506 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1515 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1507 (minor mods) to support network shares under win32.
1516 (minor mods) to support network shares under win32.
1508
1517
1509 * IPython/winconsole.py (get_console_size): add new winconsole
1518 * IPython/winconsole.py (get_console_size): add new winconsole
1510 module and fixes to page_dumb() to improve its behavior under
1519 module and fixes to page_dumb() to improve its behavior under
1511 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1520 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1512
1521
1513 * IPython/Magic.py (Macro): simplified Macro class to just
1522 * IPython/Magic.py (Macro): simplified Macro class to just
1514 subclass list. We've had only 2.2 compatibility for a very long
1523 subclass list. We've had only 2.2 compatibility for a very long
1515 time, yet I was still avoiding subclassing the builtin types. No
1524 time, yet I was still avoiding subclassing the builtin types. No
1516 more (I'm also starting to use properties, though I won't shift to
1525 more (I'm also starting to use properties, though I won't shift to
1517 2.3-specific features quite yet).
1526 2.3-specific features quite yet).
1518 (magic_store): added Ville's patch for lightweight variable
1527 (magic_store): added Ville's patch for lightweight variable
1519 persistence, after a request on the user list by Matt Wilkie
1528 persistence, after a request on the user list by Matt Wilkie
1520 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1529 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1521 details.
1530 details.
1522
1531
1523 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1532 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1524 changed the default logfile name from 'ipython.log' to
1533 changed the default logfile name from 'ipython.log' to
1525 'ipython_log.py'. These logs are real python files, and now that
1534 'ipython_log.py'. These logs are real python files, and now that
1526 we have much better multiline support, people are more likely to
1535 we have much better multiline support, people are more likely to
1527 want to use them as such. Might as well name them correctly.
1536 want to use them as such. Might as well name them correctly.
1528
1537
1529 * IPython/Magic.py: substantial cleanup. While we can't stop
1538 * IPython/Magic.py: substantial cleanup. While we can't stop
1530 using magics as mixins, due to the existing customizations 'out
1539 using magics as mixins, due to the existing customizations 'out
1531 there' which rely on the mixin naming conventions, at least I
1540 there' which rely on the mixin naming conventions, at least I
1532 cleaned out all cross-class name usage. So once we are OK with
1541 cleaned out all cross-class name usage. So once we are OK with
1533 breaking compatibility, the two systems can be separated.
1542 breaking compatibility, the two systems can be separated.
1534
1543
1535 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1544 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1536 anymore, and the class is a fair bit less hideous as well. New
1545 anymore, and the class is a fair bit less hideous as well. New
1537 features were also introduced: timestamping of input, and logging
1546 features were also introduced: timestamping of input, and logging
1538 of output results. These are user-visible with the -t and -o
1547 of output results. These are user-visible with the -t and -o
1539 options to %logstart. Closes
1548 options to %logstart. Closes
1540 http://www.scipy.net/roundup/ipython/issue11 and a request by
1549 http://www.scipy.net/roundup/ipython/issue11 and a request by
1541 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1550 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1542
1551
1543 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1552 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1544
1553
1545 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1554 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1546 better handle backslashes in paths. See the thread 'More Windows
1555 better handle backslashes in paths. See the thread 'More Windows
1547 questions part 2 - \/ characters revisited' on the iypthon user
1556 questions part 2 - \/ characters revisited' on the iypthon user
1548 list:
1557 list:
1549 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1558 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1550
1559
1551 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1560 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1552
1561
1553 (InteractiveShell.__init__): change threaded shells to not use the
1562 (InteractiveShell.__init__): change threaded shells to not use the
1554 ipython crash handler. This was causing more problems than not,
1563 ipython crash handler. This was causing more problems than not,
1555 as exceptions in the main thread (GUI code, typically) would
1564 as exceptions in the main thread (GUI code, typically) would
1556 always show up as a 'crash', when they really weren't.
1565 always show up as a 'crash', when they really weren't.
1557
1566
1558 The colors and exception mode commands (%colors/%xmode) have been
1567 The colors and exception mode commands (%colors/%xmode) have been
1559 synchronized to also take this into account, so users can get
1568 synchronized to also take this into account, so users can get
1560 verbose exceptions for their threaded code as well. I also added
1569 verbose exceptions for their threaded code as well. I also added
1561 support for activating pdb inside this exception handler as well,
1570 support for activating pdb inside this exception handler as well,
1562 so now GUI authors can use IPython's enhanced pdb at runtime.
1571 so now GUI authors can use IPython's enhanced pdb at runtime.
1563
1572
1564 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1573 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1565 true by default, and add it to the shipped ipythonrc file. Since
1574 true by default, and add it to the shipped ipythonrc file. Since
1566 this asks the user before proceeding, I think it's OK to make it
1575 this asks the user before proceeding, I think it's OK to make it
1567 true by default.
1576 true by default.
1568
1577
1569 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1578 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1570 of the previous special-casing of input in the eval loop. I think
1579 of the previous special-casing of input in the eval loop. I think
1571 this is cleaner, as they really are commands and shouldn't have
1580 this is cleaner, as they really are commands and shouldn't have
1572 a special role in the middle of the core code.
1581 a special role in the middle of the core code.
1573
1582
1574 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1583 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1575
1584
1576 * IPython/iplib.py (edit_syntax_error): added support for
1585 * IPython/iplib.py (edit_syntax_error): added support for
1577 automatically reopening the editor if the file had a syntax error
1586 automatically reopening the editor if the file had a syntax error
1578 in it. Thanks to scottt who provided the patch at:
1587 in it. Thanks to scottt who provided the patch at:
1579 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1588 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1580 version committed).
1589 version committed).
1581
1590
1582 * IPython/iplib.py (handle_normal): add suport for multi-line
1591 * IPython/iplib.py (handle_normal): add suport for multi-line
1583 input with emtpy lines. This fixes
1592 input with emtpy lines. This fixes
1584 http://www.scipy.net/roundup/ipython/issue43 and a similar
1593 http://www.scipy.net/roundup/ipython/issue43 and a similar
1585 discussion on the user list.
1594 discussion on the user list.
1586
1595
1587 WARNING: a behavior change is necessarily introduced to support
1596 WARNING: a behavior change is necessarily introduced to support
1588 blank lines: now a single blank line with whitespace does NOT
1597 blank lines: now a single blank line with whitespace does NOT
1589 break the input loop, which means that when autoindent is on, by
1598 break the input loop, which means that when autoindent is on, by
1590 default hitting return on the next (indented) line does NOT exit.
1599 default hitting return on the next (indented) line does NOT exit.
1591
1600
1592 Instead, to exit a multiline input you can either have:
1601 Instead, to exit a multiline input you can either have:
1593
1602
1594 - TWO whitespace lines (just hit return again), or
1603 - TWO whitespace lines (just hit return again), or
1595 - a single whitespace line of a different length than provided
1604 - a single whitespace line of a different length than provided
1596 by the autoindent (add or remove a space).
1605 by the autoindent (add or remove a space).
1597
1606
1598 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1607 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1599 module to better organize all readline-related functionality.
1608 module to better organize all readline-related functionality.
1600 I've deleted FlexCompleter and put all completion clases here.
1609 I've deleted FlexCompleter and put all completion clases here.
1601
1610
1602 * IPython/iplib.py (raw_input): improve indentation management.
1611 * IPython/iplib.py (raw_input): improve indentation management.
1603 It is now possible to paste indented code with autoindent on, and
1612 It is now possible to paste indented code with autoindent on, and
1604 the code is interpreted correctly (though it still looks bad on
1613 the code is interpreted correctly (though it still looks bad on
1605 screen, due to the line-oriented nature of ipython).
1614 screen, due to the line-oriented nature of ipython).
1606 (MagicCompleter.complete): change behavior so that a TAB key on an
1615 (MagicCompleter.complete): change behavior so that a TAB key on an
1607 otherwise empty line actually inserts a tab, instead of completing
1616 otherwise empty line actually inserts a tab, instead of completing
1608 on the entire global namespace. This makes it easier to use the
1617 on the entire global namespace. This makes it easier to use the
1609 TAB key for indentation. After a request by Hans Meine
1618 TAB key for indentation. After a request by Hans Meine
1610 <hans_meine-AT-gmx.net>
1619 <hans_meine-AT-gmx.net>
1611 (_prefilter): add support so that typing plain 'exit' or 'quit'
1620 (_prefilter): add support so that typing plain 'exit' or 'quit'
1612 does a sensible thing. Originally I tried to deviate as little as
1621 does a sensible thing. Originally I tried to deviate as little as
1613 possible from the default python behavior, but even that one may
1622 possible from the default python behavior, but even that one may
1614 change in this direction (thread on python-dev to that effect).
1623 change in this direction (thread on python-dev to that effect).
1615 Regardless, ipython should do the right thing even if CPython's
1624 Regardless, ipython should do the right thing even if CPython's
1616 '>>>' prompt doesn't.
1625 '>>>' prompt doesn't.
1617 (InteractiveShell): removed subclassing code.InteractiveConsole
1626 (InteractiveShell): removed subclassing code.InteractiveConsole
1618 class. By now we'd overridden just about all of its methods: I've
1627 class. By now we'd overridden just about all of its methods: I've
1619 copied the remaining two over, and now ipython is a standalone
1628 copied the remaining two over, and now ipython is a standalone
1620 class. This will provide a clearer picture for the chainsaw
1629 class. This will provide a clearer picture for the chainsaw
1621 branch refactoring.
1630 branch refactoring.
1622
1631
1623 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1632 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1624
1633
1625 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1634 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1626 failures for objects which break when dir() is called on them.
1635 failures for objects which break when dir() is called on them.
1627
1636
1628 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1637 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1629 distinct local and global namespaces in the completer API. This
1638 distinct local and global namespaces in the completer API. This
1630 change allows us to properly handle completion with distinct
1639 change allows us to properly handle completion with distinct
1631 scopes, including in embedded instances (this had never really
1640 scopes, including in embedded instances (this had never really
1632 worked correctly).
1641 worked correctly).
1633
1642
1634 Note: this introduces a change in the constructor for
1643 Note: this introduces a change in the constructor for
1635 MagicCompleter, as a new global_namespace parameter is now the
1644 MagicCompleter, as a new global_namespace parameter is now the
1636 second argument (the others were bumped one position).
1645 second argument (the others were bumped one position).
1637
1646
1638 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1647 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1639
1648
1640 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1649 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1641 embedded instances (which can be done now thanks to Vivian's
1650 embedded instances (which can be done now thanks to Vivian's
1642 frame-handling fixes for pdb).
1651 frame-handling fixes for pdb).
1643 (InteractiveShell.__init__): Fix namespace handling problem in
1652 (InteractiveShell.__init__): Fix namespace handling problem in
1644 embedded instances. We were overwriting __main__ unconditionally,
1653 embedded instances. We were overwriting __main__ unconditionally,
1645 and this should only be done for 'full' (non-embedded) IPython;
1654 and this should only be done for 'full' (non-embedded) IPython;
1646 embedded instances must respect the caller's __main__. Thanks to
1655 embedded instances must respect the caller's __main__. Thanks to
1647 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1656 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1648
1657
1649 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1658 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1650
1659
1651 * setup.py: added download_url to setup(). This registers the
1660 * setup.py: added download_url to setup(). This registers the
1652 download address at PyPI, which is not only useful to humans
1661 download address at PyPI, which is not only useful to humans
1653 browsing the site, but is also picked up by setuptools (the Eggs
1662 browsing the site, but is also picked up by setuptools (the Eggs
1654 machinery). Thanks to Ville and R. Kern for the info/discussion
1663 machinery). Thanks to Ville and R. Kern for the info/discussion
1655 on this.
1664 on this.
1656
1665
1657 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1666 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1658
1667
1659 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1668 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1660 This brings a lot of nice functionality to the pdb mode, which now
1669 This brings a lot of nice functionality to the pdb mode, which now
1661 has tab-completion, syntax highlighting, and better stack handling
1670 has tab-completion, syntax highlighting, and better stack handling
1662 than before. Many thanks to Vivian De Smedt
1671 than before. Many thanks to Vivian De Smedt
1663 <vivian-AT-vdesmedt.com> for the original patches.
1672 <vivian-AT-vdesmedt.com> for the original patches.
1664
1673
1665 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1674 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1666
1675
1667 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1676 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1668 sequence to consistently accept the banner argument. The
1677 sequence to consistently accept the banner argument. The
1669 inconsistency was tripping SAGE, thanks to Gary Zablackis
1678 inconsistency was tripping SAGE, thanks to Gary Zablackis
1670 <gzabl-AT-yahoo.com> for the report.
1679 <gzabl-AT-yahoo.com> for the report.
1671
1680
1672 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1681 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1673
1682
1674 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1683 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1675 Fix bug where a naked 'alias' call in the ipythonrc file would
1684 Fix bug where a naked 'alias' call in the ipythonrc file would
1676 cause a crash. Bug reported by Jorgen Stenarson.
1685 cause a crash. Bug reported by Jorgen Stenarson.
1677
1686
1678 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1687 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1679
1688
1680 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1689 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1681 startup time.
1690 startup time.
1682
1691
1683 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1692 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1684 instances had introduced a bug with globals in normal code. Now
1693 instances had introduced a bug with globals in normal code. Now
1685 it's working in all cases.
1694 it's working in all cases.
1686
1695
1687 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1696 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1688 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1697 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1689 has been introduced to set the default case sensitivity of the
1698 has been introduced to set the default case sensitivity of the
1690 searches. Users can still select either mode at runtime on a
1699 searches. Users can still select either mode at runtime on a
1691 per-search basis.
1700 per-search basis.
1692
1701
1693 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1702 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1694
1703
1695 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1704 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1696 attributes in wildcard searches for subclasses. Modified version
1705 attributes in wildcard searches for subclasses. Modified version
1697 of a patch by Jorgen.
1706 of a patch by Jorgen.
1698
1707
1699 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1708 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1700
1709
1701 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1710 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1702 embedded instances. I added a user_global_ns attribute to the
1711 embedded instances. I added a user_global_ns attribute to the
1703 InteractiveShell class to handle this.
1712 InteractiveShell class to handle this.
1704
1713
1705 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1714 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1706
1715
1707 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1716 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1708 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1717 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1709 (reported under win32, but may happen also in other platforms).
1718 (reported under win32, but may happen also in other platforms).
1710 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1719 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1711
1720
1712 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1721 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1713
1722
1714 * IPython/Magic.py (magic_psearch): new support for wildcard
1723 * IPython/Magic.py (magic_psearch): new support for wildcard
1715 patterns. Now, typing ?a*b will list all names which begin with a
1724 patterns. Now, typing ?a*b will list all names which begin with a
1716 and end in b, for example. The %psearch magic has full
1725 and end in b, for example. The %psearch magic has full
1717 docstrings. Many thanks to Jörgen Stenarson
1726 docstrings. Many thanks to Jörgen Stenarson
1718 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1727 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1719 implementing this functionality.
1728 implementing this functionality.
1720
1729
1721 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1730 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1722
1731
1723 * Manual: fixed long-standing annoyance of double-dashes (as in
1732 * Manual: fixed long-standing annoyance of double-dashes (as in
1724 --prefix=~, for example) being stripped in the HTML version. This
1733 --prefix=~, for example) being stripped in the HTML version. This
1725 is a latex2html bug, but a workaround was provided. Many thanks
1734 is a latex2html bug, but a workaround was provided. Many thanks
1726 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1735 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1727 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1736 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1728 rolling. This seemingly small issue had tripped a number of users
1737 rolling. This seemingly small issue had tripped a number of users
1729 when first installing, so I'm glad to see it gone.
1738 when first installing, so I'm glad to see it gone.
1730
1739
1731 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1740 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1732
1741
1733 * IPython/Extensions/numeric_formats.py: fix missing import,
1742 * IPython/Extensions/numeric_formats.py: fix missing import,
1734 reported by Stephen Walton.
1743 reported by Stephen Walton.
1735
1744
1736 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1745 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1737
1746
1738 * IPython/demo.py: finish demo module, fully documented now.
1747 * IPython/demo.py: finish demo module, fully documented now.
1739
1748
1740 * IPython/genutils.py (file_read): simple little utility to read a
1749 * IPython/genutils.py (file_read): simple little utility to read a
1741 file and ensure it's closed afterwards.
1750 file and ensure it's closed afterwards.
1742
1751
1743 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1752 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1744
1753
1745 * IPython/demo.py (Demo.__init__): added support for individually
1754 * IPython/demo.py (Demo.__init__): added support for individually
1746 tagging blocks for automatic execution.
1755 tagging blocks for automatic execution.
1747
1756
1748 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1757 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1749 syntax-highlighted python sources, requested by John.
1758 syntax-highlighted python sources, requested by John.
1750
1759
1751 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1760 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1752
1761
1753 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1762 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1754 finishing.
1763 finishing.
1755
1764
1756 * IPython/genutils.py (shlex_split): moved from Magic to here,
1765 * IPython/genutils.py (shlex_split): moved from Magic to here,
1757 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1766 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1758
1767
1759 * IPython/demo.py (Demo.__init__): added support for silent
1768 * IPython/demo.py (Demo.__init__): added support for silent
1760 blocks, improved marks as regexps, docstrings written.
1769 blocks, improved marks as regexps, docstrings written.
1761 (Demo.__init__): better docstring, added support for sys.argv.
1770 (Demo.__init__): better docstring, added support for sys.argv.
1762
1771
1763 * IPython/genutils.py (marquee): little utility used by the demo
1772 * IPython/genutils.py (marquee): little utility used by the demo
1764 code, handy in general.
1773 code, handy in general.
1765
1774
1766 * IPython/demo.py (Demo.__init__): new class for interactive
1775 * IPython/demo.py (Demo.__init__): new class for interactive
1767 demos. Not documented yet, I just wrote it in a hurry for
1776 demos. Not documented yet, I just wrote it in a hurry for
1768 scipy'05. Will docstring later.
1777 scipy'05. Will docstring later.
1769
1778
1770 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1779 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1771
1780
1772 * IPython/Shell.py (sigint_handler): Drastic simplification which
1781 * IPython/Shell.py (sigint_handler): Drastic simplification which
1773 also seems to make Ctrl-C work correctly across threads! This is
1782 also seems to make Ctrl-C work correctly across threads! This is
1774 so simple, that I can't beleive I'd missed it before. Needs more
1783 so simple, that I can't beleive I'd missed it before. Needs more
1775 testing, though.
1784 testing, though.
1776 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1785 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1777 like this before...
1786 like this before...
1778
1787
1779 * IPython/genutils.py (get_home_dir): add protection against
1788 * IPython/genutils.py (get_home_dir): add protection against
1780 non-dirs in win32 registry.
1789 non-dirs in win32 registry.
1781
1790
1782 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1791 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1783 bug where dict was mutated while iterating (pysh crash).
1792 bug where dict was mutated while iterating (pysh crash).
1784
1793
1785 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1794 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1786
1795
1787 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1796 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1788 spurious newlines added by this routine. After a report by
1797 spurious newlines added by this routine. After a report by
1789 F. Mantegazza.
1798 F. Mantegazza.
1790
1799
1791 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1800 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1792
1801
1793 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1802 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1794 calls. These were a leftover from the GTK 1.x days, and can cause
1803 calls. These were a leftover from the GTK 1.x days, and can cause
1795 problems in certain cases (after a report by John Hunter).
1804 problems in certain cases (after a report by John Hunter).
1796
1805
1797 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1806 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1798 os.getcwd() fails at init time. Thanks to patch from David Remahl
1807 os.getcwd() fails at init time. Thanks to patch from David Remahl
1799 <chmod007-AT-mac.com>.
1808 <chmod007-AT-mac.com>.
1800 (InteractiveShell.__init__): prevent certain special magics from
1809 (InteractiveShell.__init__): prevent certain special magics from
1801 being shadowed by aliases. Closes
1810 being shadowed by aliases. Closes
1802 http://www.scipy.net/roundup/ipython/issue41.
1811 http://www.scipy.net/roundup/ipython/issue41.
1803
1812
1804 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1813 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1805
1814
1806 * IPython/iplib.py (InteractiveShell.complete): Added new
1815 * IPython/iplib.py (InteractiveShell.complete): Added new
1807 top-level completion method to expose the completion mechanism
1816 top-level completion method to expose the completion mechanism
1808 beyond readline-based environments.
1817 beyond readline-based environments.
1809
1818
1810 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1819 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1811
1820
1812 * tools/ipsvnc (svnversion): fix svnversion capture.
1821 * tools/ipsvnc (svnversion): fix svnversion capture.
1813
1822
1814 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1823 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1815 attribute to self, which was missing. Before, it was set by a
1824 attribute to self, which was missing. Before, it was set by a
1816 routine which in certain cases wasn't being called, so the
1825 routine which in certain cases wasn't being called, so the
1817 instance could end up missing the attribute. This caused a crash.
1826 instance could end up missing the attribute. This caused a crash.
1818 Closes http://www.scipy.net/roundup/ipython/issue40.
1827 Closes http://www.scipy.net/roundup/ipython/issue40.
1819
1828
1820 2005-08-16 Fernando Perez <fperez@colorado.edu>
1829 2005-08-16 Fernando Perez <fperez@colorado.edu>
1821
1830
1822 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1831 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1823 contains non-string attribute. Closes
1832 contains non-string attribute. Closes
1824 http://www.scipy.net/roundup/ipython/issue38.
1833 http://www.scipy.net/roundup/ipython/issue38.
1825
1834
1826 2005-08-14 Fernando Perez <fperez@colorado.edu>
1835 2005-08-14 Fernando Perez <fperez@colorado.edu>
1827
1836
1828 * tools/ipsvnc: Minor improvements, to add changeset info.
1837 * tools/ipsvnc: Minor improvements, to add changeset info.
1829
1838
1830 2005-08-12 Fernando Perez <fperez@colorado.edu>
1839 2005-08-12 Fernando Perez <fperez@colorado.edu>
1831
1840
1832 * IPython/iplib.py (runsource): remove self.code_to_run_src
1841 * IPython/iplib.py (runsource): remove self.code_to_run_src
1833 attribute. I realized this is nothing more than
1842 attribute. I realized this is nothing more than
1834 '\n'.join(self.buffer), and having the same data in two different
1843 '\n'.join(self.buffer), and having the same data in two different
1835 places is just asking for synchronization bugs. This may impact
1844 places is just asking for synchronization bugs. This may impact
1836 people who have custom exception handlers, so I need to warn
1845 people who have custom exception handlers, so I need to warn
1837 ipython-dev about it (F. Mantegazza may use them).
1846 ipython-dev about it (F. Mantegazza may use them).
1838
1847
1839 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1848 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1840
1849
1841 * IPython/genutils.py: fix 2.2 compatibility (generators)
1850 * IPython/genutils.py: fix 2.2 compatibility (generators)
1842
1851
1843 2005-07-18 Fernando Perez <fperez@colorado.edu>
1852 2005-07-18 Fernando Perez <fperez@colorado.edu>
1844
1853
1845 * IPython/genutils.py (get_home_dir): fix to help users with
1854 * IPython/genutils.py (get_home_dir): fix to help users with
1846 invalid $HOME under win32.
1855 invalid $HOME under win32.
1847
1856
1848 2005-07-17 Fernando Perez <fperez@colorado.edu>
1857 2005-07-17 Fernando Perez <fperez@colorado.edu>
1849
1858
1850 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1859 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1851 some old hacks and clean up a bit other routines; code should be
1860 some old hacks and clean up a bit other routines; code should be
1852 simpler and a bit faster.
1861 simpler and a bit faster.
1853
1862
1854 * IPython/iplib.py (interact): removed some last-resort attempts
1863 * IPython/iplib.py (interact): removed some last-resort attempts
1855 to survive broken stdout/stderr. That code was only making it
1864 to survive broken stdout/stderr. That code was only making it
1856 harder to abstract out the i/o (necessary for gui integration),
1865 harder to abstract out the i/o (necessary for gui integration),
1857 and the crashes it could prevent were extremely rare in practice
1866 and the crashes it could prevent were extremely rare in practice
1858 (besides being fully user-induced in a pretty violent manner).
1867 (besides being fully user-induced in a pretty violent manner).
1859
1868
1860 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1869 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1861 Nothing major yet, but the code is simpler to read; this should
1870 Nothing major yet, but the code is simpler to read; this should
1862 make it easier to do more serious modifications in the future.
1871 make it easier to do more serious modifications in the future.
1863
1872
1864 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1873 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1865 which broke in .15 (thanks to a report by Ville).
1874 which broke in .15 (thanks to a report by Ville).
1866
1875
1867 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1876 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1868 be quite correct, I know next to nothing about unicode). This
1877 be quite correct, I know next to nothing about unicode). This
1869 will allow unicode strings to be used in prompts, amongst other
1878 will allow unicode strings to be used in prompts, amongst other
1870 cases. It also will prevent ipython from crashing when unicode
1879 cases. It also will prevent ipython from crashing when unicode
1871 shows up unexpectedly in many places. If ascii encoding fails, we
1880 shows up unexpectedly in many places. If ascii encoding fails, we
1872 assume utf_8. Currently the encoding is not a user-visible
1881 assume utf_8. Currently the encoding is not a user-visible
1873 setting, though it could be made so if there is demand for it.
1882 setting, though it could be made so if there is demand for it.
1874
1883
1875 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1884 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1876
1885
1877 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1886 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1878
1887
1879 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1888 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1880
1889
1881 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1890 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1882 code can work transparently for 2.2/2.3.
1891 code can work transparently for 2.2/2.3.
1883
1892
1884 2005-07-16 Fernando Perez <fperez@colorado.edu>
1893 2005-07-16 Fernando Perez <fperez@colorado.edu>
1885
1894
1886 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1895 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1887 out of the color scheme table used for coloring exception
1896 out of the color scheme table used for coloring exception
1888 tracebacks. This allows user code to add new schemes at runtime.
1897 tracebacks. This allows user code to add new schemes at runtime.
1889 This is a minimally modified version of the patch at
1898 This is a minimally modified version of the patch at
1890 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1899 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1891 for the contribution.
1900 for the contribution.
1892
1901
1893 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1902 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1894 slightly modified version of the patch in
1903 slightly modified version of the patch in
1895 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1904 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1896 to remove the previous try/except solution (which was costlier).
1905 to remove the previous try/except solution (which was costlier).
1897 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1906 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1898
1907
1899 2005-06-08 Fernando Perez <fperez@colorado.edu>
1908 2005-06-08 Fernando Perez <fperez@colorado.edu>
1900
1909
1901 * IPython/iplib.py (write/write_err): Add methods to abstract all
1910 * IPython/iplib.py (write/write_err): Add methods to abstract all
1902 I/O a bit more.
1911 I/O a bit more.
1903
1912
1904 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1913 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1905 warning, reported by Aric Hagberg, fix by JD Hunter.
1914 warning, reported by Aric Hagberg, fix by JD Hunter.
1906
1915
1907 2005-06-02 *** Released version 0.6.15
1916 2005-06-02 *** Released version 0.6.15
1908
1917
1909 2005-06-01 Fernando Perez <fperez@colorado.edu>
1918 2005-06-01 Fernando Perez <fperez@colorado.edu>
1910
1919
1911 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1920 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1912 tab-completion of filenames within open-quoted strings. Note that
1921 tab-completion of filenames within open-quoted strings. Note that
1913 this requires that in ~/.ipython/ipythonrc, users change the
1922 this requires that in ~/.ipython/ipythonrc, users change the
1914 readline delimiters configuration to read:
1923 readline delimiters configuration to read:
1915
1924
1916 readline_remove_delims -/~
1925 readline_remove_delims -/~
1917
1926
1918
1927
1919 2005-05-31 *** Released version 0.6.14
1928 2005-05-31 *** Released version 0.6.14
1920
1929
1921 2005-05-29 Fernando Perez <fperez@colorado.edu>
1930 2005-05-29 Fernando Perez <fperez@colorado.edu>
1922
1931
1923 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1932 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1924 with files not on the filesystem. Reported by Eliyahu Sandler
1933 with files not on the filesystem. Reported by Eliyahu Sandler
1925 <eli@gondolin.net>
1934 <eli@gondolin.net>
1926
1935
1927 2005-05-22 Fernando Perez <fperez@colorado.edu>
1936 2005-05-22 Fernando Perez <fperez@colorado.edu>
1928
1937
1929 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1938 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1930 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1939 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1931
1940
1932 2005-05-19 Fernando Perez <fperez@colorado.edu>
1941 2005-05-19 Fernando Perez <fperez@colorado.edu>
1933
1942
1934 * IPython/iplib.py (safe_execfile): close a file which could be
1943 * IPython/iplib.py (safe_execfile): close a file which could be
1935 left open (causing problems in win32, which locks open files).
1944 left open (causing problems in win32, which locks open files).
1936 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1945 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1937
1946
1938 2005-05-18 Fernando Perez <fperez@colorado.edu>
1947 2005-05-18 Fernando Perez <fperez@colorado.edu>
1939
1948
1940 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1949 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1941 keyword arguments correctly to safe_execfile().
1950 keyword arguments correctly to safe_execfile().
1942
1951
1943 2005-05-13 Fernando Perez <fperez@colorado.edu>
1952 2005-05-13 Fernando Perez <fperez@colorado.edu>
1944
1953
1945 * ipython.1: Added info about Qt to manpage, and threads warning
1954 * ipython.1: Added info about Qt to manpage, and threads warning
1946 to usage page (invoked with --help).
1955 to usage page (invoked with --help).
1947
1956
1948 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1957 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1949 new matcher (it goes at the end of the priority list) to do
1958 new matcher (it goes at the end of the priority list) to do
1950 tab-completion on named function arguments. Submitted by George
1959 tab-completion on named function arguments. Submitted by George
1951 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1960 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1952 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1961 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1953 for more details.
1962 for more details.
1954
1963
1955 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1964 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1956 SystemExit exceptions in the script being run. Thanks to a report
1965 SystemExit exceptions in the script being run. Thanks to a report
1957 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1966 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1958 producing very annoying behavior when running unit tests.
1967 producing very annoying behavior when running unit tests.
1959
1968
1960 2005-05-12 Fernando Perez <fperez@colorado.edu>
1969 2005-05-12 Fernando Perez <fperez@colorado.edu>
1961
1970
1962 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1971 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1963 which I'd broken (again) due to a changed regexp. In the process,
1972 which I'd broken (again) due to a changed regexp. In the process,
1964 added ';' as an escape to auto-quote the whole line without
1973 added ';' as an escape to auto-quote the whole line without
1965 splitting its arguments. Thanks to a report by Jerry McRae
1974 splitting its arguments. Thanks to a report by Jerry McRae
1966 <qrs0xyc02-AT-sneakemail.com>.
1975 <qrs0xyc02-AT-sneakemail.com>.
1967
1976
1968 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1977 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1969 possible crashes caused by a TokenError. Reported by Ed Schofield
1978 possible crashes caused by a TokenError. Reported by Ed Schofield
1970 <schofield-AT-ftw.at>.
1979 <schofield-AT-ftw.at>.
1971
1980
1972 2005-05-06 Fernando Perez <fperez@colorado.edu>
1981 2005-05-06 Fernando Perez <fperez@colorado.edu>
1973
1982
1974 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1983 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1975
1984
1976 2005-04-29 Fernando Perez <fperez@colorado.edu>
1985 2005-04-29 Fernando Perez <fperez@colorado.edu>
1977
1986
1978 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1987 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1979 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1988 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1980 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1989 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1981 which provides support for Qt interactive usage (similar to the
1990 which provides support for Qt interactive usage (similar to the
1982 existing one for WX and GTK). This had been often requested.
1991 existing one for WX and GTK). This had been often requested.
1983
1992
1984 2005-04-14 *** Released version 0.6.13
1993 2005-04-14 *** Released version 0.6.13
1985
1994
1986 2005-04-08 Fernando Perez <fperez@colorado.edu>
1995 2005-04-08 Fernando Perez <fperez@colorado.edu>
1987
1996
1988 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1997 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1989 from _ofind, which gets called on almost every input line. Now,
1998 from _ofind, which gets called on almost every input line. Now,
1990 we only try to get docstrings if they are actually going to be
1999 we only try to get docstrings if they are actually going to be
1991 used (the overhead of fetching unnecessary docstrings can be
2000 used (the overhead of fetching unnecessary docstrings can be
1992 noticeable for certain objects, such as Pyro proxies).
2001 noticeable for certain objects, such as Pyro proxies).
1993
2002
1994 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2003 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1995 for completers. For some reason I had been passing them the state
2004 for completers. For some reason I had been passing them the state
1996 variable, which completers never actually need, and was in
2005 variable, which completers never actually need, and was in
1997 conflict with the rlcompleter API. Custom completers ONLY need to
2006 conflict with the rlcompleter API. Custom completers ONLY need to
1998 take the text parameter.
2007 take the text parameter.
1999
2008
2000 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2009 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2001 work correctly in pysh. I've also moved all the logic which used
2010 work correctly in pysh. I've also moved all the logic which used
2002 to be in pysh.py here, which will prevent problems with future
2011 to be in pysh.py here, which will prevent problems with future
2003 upgrades. However, this time I must warn users to update their
2012 upgrades. However, this time I must warn users to update their
2004 pysh profile to include the line
2013 pysh profile to include the line
2005
2014
2006 import_all IPython.Extensions.InterpreterExec
2015 import_all IPython.Extensions.InterpreterExec
2007
2016
2008 because otherwise things won't work for them. They MUST also
2017 because otherwise things won't work for them. They MUST also
2009 delete pysh.py and the line
2018 delete pysh.py and the line
2010
2019
2011 execfile pysh.py
2020 execfile pysh.py
2012
2021
2013 from their ipythonrc-pysh.
2022 from their ipythonrc-pysh.
2014
2023
2015 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2024 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2016 robust in the face of objects whose dir() returns non-strings
2025 robust in the face of objects whose dir() returns non-strings
2017 (which it shouldn't, but some broken libs like ITK do). Thanks to
2026 (which it shouldn't, but some broken libs like ITK do). Thanks to
2018 a patch by John Hunter (implemented differently, though). Also
2027 a patch by John Hunter (implemented differently, though). Also
2019 minor improvements by using .extend instead of + on lists.
2028 minor improvements by using .extend instead of + on lists.
2020
2029
2021 * pysh.py:
2030 * pysh.py:
2022
2031
2023 2005-04-06 Fernando Perez <fperez@colorado.edu>
2032 2005-04-06 Fernando Perez <fperez@colorado.edu>
2024
2033
2025 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2034 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2026 by default, so that all users benefit from it. Those who don't
2035 by default, so that all users benefit from it. Those who don't
2027 want it can still turn it off.
2036 want it can still turn it off.
2028
2037
2029 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2038 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2030 config file, I'd forgotten about this, so users were getting it
2039 config file, I'd forgotten about this, so users were getting it
2031 off by default.
2040 off by default.
2032
2041
2033 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2042 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2034 consistency. Now magics can be called in multiline statements,
2043 consistency. Now magics can be called in multiline statements,
2035 and python variables can be expanded in magic calls via $var.
2044 and python variables can be expanded in magic calls via $var.
2036 This makes the magic system behave just like aliases or !system
2045 This makes the magic system behave just like aliases or !system
2037 calls.
2046 calls.
2038
2047
2039 2005-03-28 Fernando Perez <fperez@colorado.edu>
2048 2005-03-28 Fernando Perez <fperez@colorado.edu>
2040
2049
2041 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2050 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2042 expensive string additions for building command. Add support for
2051 expensive string additions for building command. Add support for
2043 trailing ';' when autocall is used.
2052 trailing ';' when autocall is used.
2044
2053
2045 2005-03-26 Fernando Perez <fperez@colorado.edu>
2054 2005-03-26 Fernando Perez <fperez@colorado.edu>
2046
2055
2047 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2056 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2048 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2057 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2049 ipython.el robust against prompts with any number of spaces
2058 ipython.el robust against prompts with any number of spaces
2050 (including 0) after the ':' character.
2059 (including 0) after the ':' character.
2051
2060
2052 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2061 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2053 continuation prompt, which misled users to think the line was
2062 continuation prompt, which misled users to think the line was
2054 already indented. Closes debian Bug#300847, reported to me by
2063 already indented. Closes debian Bug#300847, reported to me by
2055 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2064 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2056
2065
2057 2005-03-23 Fernando Perez <fperez@colorado.edu>
2066 2005-03-23 Fernando Perez <fperez@colorado.edu>
2058
2067
2059 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2068 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2060 properly aligned if they have embedded newlines.
2069 properly aligned if they have embedded newlines.
2061
2070
2062 * IPython/iplib.py (runlines): Add a public method to expose
2071 * IPython/iplib.py (runlines): Add a public method to expose
2063 IPython's code execution machinery, so that users can run strings
2072 IPython's code execution machinery, so that users can run strings
2064 as if they had been typed at the prompt interactively.
2073 as if they had been typed at the prompt interactively.
2065 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2074 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2066 methods which can call the system shell, but with python variable
2075 methods which can call the system shell, but with python variable
2067 expansion. The three such methods are: __IPYTHON__.system,
2076 expansion. The three such methods are: __IPYTHON__.system,
2068 .getoutput and .getoutputerror. These need to be documented in a
2077 .getoutput and .getoutputerror. These need to be documented in a
2069 'public API' section (to be written) of the manual.
2078 'public API' section (to be written) of the manual.
2070
2079
2071 2005-03-20 Fernando Perez <fperez@colorado.edu>
2080 2005-03-20 Fernando Perez <fperez@colorado.edu>
2072
2081
2073 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2082 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2074 for custom exception handling. This is quite powerful, and it
2083 for custom exception handling. This is quite powerful, and it
2075 allows for user-installable exception handlers which can trap
2084 allows for user-installable exception handlers which can trap
2076 custom exceptions at runtime and treat them separately from
2085 custom exceptions at runtime and treat them separately from
2077 IPython's default mechanisms. At the request of Frédéric
2086 IPython's default mechanisms. At the request of Frédéric
2078 Mantegazza <mantegazza-AT-ill.fr>.
2087 Mantegazza <mantegazza-AT-ill.fr>.
2079 (InteractiveShell.set_custom_completer): public API function to
2088 (InteractiveShell.set_custom_completer): public API function to
2080 add new completers at runtime.
2089 add new completers at runtime.
2081
2090
2082 2005-03-19 Fernando Perez <fperez@colorado.edu>
2091 2005-03-19 Fernando Perez <fperez@colorado.edu>
2083
2092
2084 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2093 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2085 allow objects which provide their docstrings via non-standard
2094 allow objects which provide their docstrings via non-standard
2086 mechanisms (like Pyro proxies) to still be inspected by ipython's
2095 mechanisms (like Pyro proxies) to still be inspected by ipython's
2087 ? system.
2096 ? system.
2088
2097
2089 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2098 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2090 automatic capture system. I tried quite hard to make it work
2099 automatic capture system. I tried quite hard to make it work
2091 reliably, and simply failed. I tried many combinations with the
2100 reliably, and simply failed. I tried many combinations with the
2092 subprocess module, but eventually nothing worked in all needed
2101 subprocess module, but eventually nothing worked in all needed
2093 cases (not blocking stdin for the child, duplicating stdout
2102 cases (not blocking stdin for the child, duplicating stdout
2094 without blocking, etc). The new %sc/%sx still do capture to these
2103 without blocking, etc). The new %sc/%sx still do capture to these
2095 magical list/string objects which make shell use much more
2104 magical list/string objects which make shell use much more
2096 conveninent, so not all is lost.
2105 conveninent, so not all is lost.
2097
2106
2098 XXX - FIX MANUAL for the change above!
2107 XXX - FIX MANUAL for the change above!
2099
2108
2100 (runsource): I copied code.py's runsource() into ipython to modify
2109 (runsource): I copied code.py's runsource() into ipython to modify
2101 it a bit. Now the code object and source to be executed are
2110 it a bit. Now the code object and source to be executed are
2102 stored in ipython. This makes this info accessible to third-party
2111 stored in ipython. This makes this info accessible to third-party
2103 tools, like custom exception handlers. After a request by Frédéric
2112 tools, like custom exception handlers. After a request by Frédéric
2104 Mantegazza <mantegazza-AT-ill.fr>.
2113 Mantegazza <mantegazza-AT-ill.fr>.
2105
2114
2106 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2115 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2107 history-search via readline (like C-p/C-n). I'd wanted this for a
2116 history-search via readline (like C-p/C-n). I'd wanted this for a
2108 long time, but only recently found out how to do it. For users
2117 long time, but only recently found out how to do it. For users
2109 who already have their ipythonrc files made and want this, just
2118 who already have their ipythonrc files made and want this, just
2110 add:
2119 add:
2111
2120
2112 readline_parse_and_bind "\e[A": history-search-backward
2121 readline_parse_and_bind "\e[A": history-search-backward
2113 readline_parse_and_bind "\e[B": history-search-forward
2122 readline_parse_and_bind "\e[B": history-search-forward
2114
2123
2115 2005-03-18 Fernando Perez <fperez@colorado.edu>
2124 2005-03-18 Fernando Perez <fperez@colorado.edu>
2116
2125
2117 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2126 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2118 LSString and SList classes which allow transparent conversions
2127 LSString and SList classes which allow transparent conversions
2119 between list mode and whitespace-separated string.
2128 between list mode and whitespace-separated string.
2120 (magic_r): Fix recursion problem in %r.
2129 (magic_r): Fix recursion problem in %r.
2121
2130
2122 * IPython/genutils.py (LSString): New class to be used for
2131 * IPython/genutils.py (LSString): New class to be used for
2123 automatic storage of the results of all alias/system calls in _o
2132 automatic storage of the results of all alias/system calls in _o
2124 and _e (stdout/err). These provide a .l/.list attribute which
2133 and _e (stdout/err). These provide a .l/.list attribute which
2125 does automatic splitting on newlines. This means that for most
2134 does automatic splitting on newlines. This means that for most
2126 uses, you'll never need to do capturing of output with %sc/%sx
2135 uses, you'll never need to do capturing of output with %sc/%sx
2127 anymore, since ipython keeps this always done for you. Note that
2136 anymore, since ipython keeps this always done for you. Note that
2128 only the LAST results are stored, the _o/e variables are
2137 only the LAST results are stored, the _o/e variables are
2129 overwritten on each call. If you need to save their contents
2138 overwritten on each call. If you need to save their contents
2130 further, simply bind them to any other name.
2139 further, simply bind them to any other name.
2131
2140
2132 2005-03-17 Fernando Perez <fperez@colorado.edu>
2141 2005-03-17 Fernando Perez <fperez@colorado.edu>
2133
2142
2134 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2143 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2135 prompt namespace handling.
2144 prompt namespace handling.
2136
2145
2137 2005-03-16 Fernando Perez <fperez@colorado.edu>
2146 2005-03-16 Fernando Perez <fperez@colorado.edu>
2138
2147
2139 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2148 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2140 classic prompts to be '>>> ' (final space was missing, and it
2149 classic prompts to be '>>> ' (final space was missing, and it
2141 trips the emacs python mode).
2150 trips the emacs python mode).
2142 (BasePrompt.__str__): Added safe support for dynamic prompt
2151 (BasePrompt.__str__): Added safe support for dynamic prompt
2143 strings. Now you can set your prompt string to be '$x', and the
2152 strings. Now you can set your prompt string to be '$x', and the
2144 value of x will be printed from your interactive namespace. The
2153 value of x will be printed from your interactive namespace. The
2145 interpolation syntax includes the full Itpl support, so
2154 interpolation syntax includes the full Itpl support, so
2146 ${foo()+x+bar()} is a valid prompt string now, and the function
2155 ${foo()+x+bar()} is a valid prompt string now, and the function
2147 calls will be made at runtime.
2156 calls will be made at runtime.
2148
2157
2149 2005-03-15 Fernando Perez <fperez@colorado.edu>
2158 2005-03-15 Fernando Perez <fperez@colorado.edu>
2150
2159
2151 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2160 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2152 avoid name clashes in pylab. %hist still works, it just forwards
2161 avoid name clashes in pylab. %hist still works, it just forwards
2153 the call to %history.
2162 the call to %history.
2154
2163
2155 2005-03-02 *** Released version 0.6.12
2164 2005-03-02 *** Released version 0.6.12
2156
2165
2157 2005-03-02 Fernando Perez <fperez@colorado.edu>
2166 2005-03-02 Fernando Perez <fperez@colorado.edu>
2158
2167
2159 * IPython/iplib.py (handle_magic): log magic calls properly as
2168 * IPython/iplib.py (handle_magic): log magic calls properly as
2160 ipmagic() function calls.
2169 ipmagic() function calls.
2161
2170
2162 * IPython/Magic.py (magic_time): Improved %time to support
2171 * IPython/Magic.py (magic_time): Improved %time to support
2163 statements and provide wall-clock as well as CPU time.
2172 statements and provide wall-clock as well as CPU time.
2164
2173
2165 2005-02-27 Fernando Perez <fperez@colorado.edu>
2174 2005-02-27 Fernando Perez <fperez@colorado.edu>
2166
2175
2167 * IPython/hooks.py: New hooks module, to expose user-modifiable
2176 * IPython/hooks.py: New hooks module, to expose user-modifiable
2168 IPython functionality in a clean manner. For now only the editor
2177 IPython functionality in a clean manner. For now only the editor
2169 hook is actually written, and other thigns which I intend to turn
2178 hook is actually written, and other thigns which I intend to turn
2170 into proper hooks aren't yet there. The display and prefilter
2179 into proper hooks aren't yet there. The display and prefilter
2171 stuff, for example, should be hooks. But at least now the
2180 stuff, for example, should be hooks. But at least now the
2172 framework is in place, and the rest can be moved here with more
2181 framework is in place, and the rest can be moved here with more
2173 time later. IPython had had a .hooks variable for a long time for
2182 time later. IPython had had a .hooks variable for a long time for
2174 this purpose, but I'd never actually used it for anything.
2183 this purpose, but I'd never actually used it for anything.
2175
2184
2176 2005-02-26 Fernando Perez <fperez@colorado.edu>
2185 2005-02-26 Fernando Perez <fperez@colorado.edu>
2177
2186
2178 * IPython/ipmaker.py (make_IPython): make the default ipython
2187 * IPython/ipmaker.py (make_IPython): make the default ipython
2179 directory be called _ipython under win32, to follow more the
2188 directory be called _ipython under win32, to follow more the
2180 naming peculiarities of that platform (where buggy software like
2189 naming peculiarities of that platform (where buggy software like
2181 Visual Sourcesafe breaks with .named directories). Reported by
2190 Visual Sourcesafe breaks with .named directories). Reported by
2182 Ville Vainio.
2191 Ville Vainio.
2183
2192
2184 2005-02-23 Fernando Perez <fperez@colorado.edu>
2193 2005-02-23 Fernando Perez <fperez@colorado.edu>
2185
2194
2186 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2195 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2187 auto_aliases for win32 which were causing problems. Users can
2196 auto_aliases for win32 which were causing problems. Users can
2188 define the ones they personally like.
2197 define the ones they personally like.
2189
2198
2190 2005-02-21 Fernando Perez <fperez@colorado.edu>
2199 2005-02-21 Fernando Perez <fperez@colorado.edu>
2191
2200
2192 * IPython/Magic.py (magic_time): new magic to time execution of
2201 * IPython/Magic.py (magic_time): new magic to time execution of
2193 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2202 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2194
2203
2195 2005-02-19 Fernando Perez <fperez@colorado.edu>
2204 2005-02-19 Fernando Perez <fperez@colorado.edu>
2196
2205
2197 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2206 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2198 into keys (for prompts, for example).
2207 into keys (for prompts, for example).
2199
2208
2200 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2209 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2201 prompts in case users want them. This introduces a small behavior
2210 prompts in case users want them. This introduces a small behavior
2202 change: ipython does not automatically add a space to all prompts
2211 change: ipython does not automatically add a space to all prompts
2203 anymore. To get the old prompts with a space, users should add it
2212 anymore. To get the old prompts with a space, users should add it
2204 manually to their ipythonrc file, so for example prompt_in1 should
2213 manually to their ipythonrc file, so for example prompt_in1 should
2205 now read 'In [\#]: ' instead of 'In [\#]:'.
2214 now read 'In [\#]: ' instead of 'In [\#]:'.
2206 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2215 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2207 file) to control left-padding of secondary prompts.
2216 file) to control left-padding of secondary prompts.
2208
2217
2209 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2218 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2210 the profiler can't be imported. Fix for Debian, which removed
2219 the profiler can't be imported. Fix for Debian, which removed
2211 profile.py because of License issues. I applied a slightly
2220 profile.py because of License issues. I applied a slightly
2212 modified version of the original Debian patch at
2221 modified version of the original Debian patch at
2213 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2222 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2214
2223
2215 2005-02-17 Fernando Perez <fperez@colorado.edu>
2224 2005-02-17 Fernando Perez <fperez@colorado.edu>
2216
2225
2217 * IPython/genutils.py (native_line_ends): Fix bug which would
2226 * IPython/genutils.py (native_line_ends): Fix bug which would
2218 cause improper line-ends under win32 b/c I was not opening files
2227 cause improper line-ends under win32 b/c I was not opening files
2219 in binary mode. Bug report and fix thanks to Ville.
2228 in binary mode. Bug report and fix thanks to Ville.
2220
2229
2221 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2230 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2222 trying to catch spurious foo[1] autocalls. My fix actually broke
2231 trying to catch spurious foo[1] autocalls. My fix actually broke
2223 ',/' autoquote/call with explicit escape (bad regexp).
2232 ',/' autoquote/call with explicit escape (bad regexp).
2224
2233
2225 2005-02-15 *** Released version 0.6.11
2234 2005-02-15 *** Released version 0.6.11
2226
2235
2227 2005-02-14 Fernando Perez <fperez@colorado.edu>
2236 2005-02-14 Fernando Perez <fperez@colorado.edu>
2228
2237
2229 * IPython/background_jobs.py: New background job management
2238 * IPython/background_jobs.py: New background job management
2230 subsystem. This is implemented via a new set of classes, and
2239 subsystem. This is implemented via a new set of classes, and
2231 IPython now provides a builtin 'jobs' object for background job
2240 IPython now provides a builtin 'jobs' object for background job
2232 execution. A convenience %bg magic serves as a lightweight
2241 execution. A convenience %bg magic serves as a lightweight
2233 frontend for starting the more common type of calls. This was
2242 frontend for starting the more common type of calls. This was
2234 inspired by discussions with B. Granger and the BackgroundCommand
2243 inspired by discussions with B. Granger and the BackgroundCommand
2235 class described in the book Python Scripting for Computational
2244 class described in the book Python Scripting for Computational
2236 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2245 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2237 (although ultimately no code from this text was used, as IPython's
2246 (although ultimately no code from this text was used, as IPython's
2238 system is a separate implementation).
2247 system is a separate implementation).
2239
2248
2240 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2249 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2241 to control the completion of single/double underscore names
2250 to control the completion of single/double underscore names
2242 separately. As documented in the example ipytonrc file, the
2251 separately. As documented in the example ipytonrc file, the
2243 readline_omit__names variable can now be set to 2, to omit even
2252 readline_omit__names variable can now be set to 2, to omit even
2244 single underscore names. Thanks to a patch by Brian Wong
2253 single underscore names. Thanks to a patch by Brian Wong
2245 <BrianWong-AT-AirgoNetworks.Com>.
2254 <BrianWong-AT-AirgoNetworks.Com>.
2246 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2255 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2247 be autocalled as foo([1]) if foo were callable. A problem for
2256 be autocalled as foo([1]) if foo were callable. A problem for
2248 things which are both callable and implement __getitem__.
2257 things which are both callable and implement __getitem__.
2249 (init_readline): Fix autoindentation for win32. Thanks to a patch
2258 (init_readline): Fix autoindentation for win32. Thanks to a patch
2250 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2259 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2251
2260
2252 2005-02-12 Fernando Perez <fperez@colorado.edu>
2261 2005-02-12 Fernando Perez <fperez@colorado.edu>
2253
2262
2254 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2263 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2255 which I had written long ago to sort out user error messages which
2264 which I had written long ago to sort out user error messages which
2256 may occur during startup. This seemed like a good idea initially,
2265 may occur during startup. This seemed like a good idea initially,
2257 but it has proven a disaster in retrospect. I don't want to
2266 but it has proven a disaster in retrospect. I don't want to
2258 change much code for now, so my fix is to set the internal 'debug'
2267 change much code for now, so my fix is to set the internal 'debug'
2259 flag to true everywhere, whose only job was precisely to control
2268 flag to true everywhere, whose only job was precisely to control
2260 this subsystem. This closes issue 28 (as well as avoiding all
2269 this subsystem. This closes issue 28 (as well as avoiding all
2261 sorts of strange hangups which occur from time to time).
2270 sorts of strange hangups which occur from time to time).
2262
2271
2263 2005-02-07 Fernando Perez <fperez@colorado.edu>
2272 2005-02-07 Fernando Perez <fperez@colorado.edu>
2264
2273
2265 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2274 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2266 previous call produced a syntax error.
2275 previous call produced a syntax error.
2267
2276
2268 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2277 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2269 classes without constructor.
2278 classes without constructor.
2270
2279
2271 2005-02-06 Fernando Perez <fperez@colorado.edu>
2280 2005-02-06 Fernando Perez <fperez@colorado.edu>
2272
2281
2273 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2282 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2274 completions with the results of each matcher, so we return results
2283 completions with the results of each matcher, so we return results
2275 to the user from all namespaces. This breaks with ipython
2284 to the user from all namespaces. This breaks with ipython
2276 tradition, but I think it's a nicer behavior. Now you get all
2285 tradition, but I think it's a nicer behavior. Now you get all
2277 possible completions listed, from all possible namespaces (python,
2286 possible completions listed, from all possible namespaces (python,
2278 filesystem, magics...) After a request by John Hunter
2287 filesystem, magics...) After a request by John Hunter
2279 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2288 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2280
2289
2281 2005-02-05 Fernando Perez <fperez@colorado.edu>
2290 2005-02-05 Fernando Perez <fperez@colorado.edu>
2282
2291
2283 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2292 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2284 the call had quote characters in it (the quotes were stripped).
2293 the call had quote characters in it (the quotes were stripped).
2285
2294
2286 2005-01-31 Fernando Perez <fperez@colorado.edu>
2295 2005-01-31 Fernando Perez <fperez@colorado.edu>
2287
2296
2288 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2297 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2289 Itpl.itpl() to make the code more robust against psyco
2298 Itpl.itpl() to make the code more robust against psyco
2290 optimizations.
2299 optimizations.
2291
2300
2292 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2301 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2293 of causing an exception. Quicker, cleaner.
2302 of causing an exception. Quicker, cleaner.
2294
2303
2295 2005-01-28 Fernando Perez <fperez@colorado.edu>
2304 2005-01-28 Fernando Perez <fperez@colorado.edu>
2296
2305
2297 * scripts/ipython_win_post_install.py (install): hardcode
2306 * scripts/ipython_win_post_install.py (install): hardcode
2298 sys.prefix+'python.exe' as the executable path. It turns out that
2307 sys.prefix+'python.exe' as the executable path. It turns out that
2299 during the post-installation run, sys.executable resolves to the
2308 during the post-installation run, sys.executable resolves to the
2300 name of the binary installer! I should report this as a distutils
2309 name of the binary installer! I should report this as a distutils
2301 bug, I think. I updated the .10 release with this tiny fix, to
2310 bug, I think. I updated the .10 release with this tiny fix, to
2302 avoid annoying the lists further.
2311 avoid annoying the lists further.
2303
2312
2304 2005-01-27 *** Released version 0.6.10
2313 2005-01-27 *** Released version 0.6.10
2305
2314
2306 2005-01-27 Fernando Perez <fperez@colorado.edu>
2315 2005-01-27 Fernando Perez <fperez@colorado.edu>
2307
2316
2308 * IPython/numutils.py (norm): Added 'inf' as optional name for
2317 * IPython/numutils.py (norm): Added 'inf' as optional name for
2309 L-infinity norm, included references to mathworld.com for vector
2318 L-infinity norm, included references to mathworld.com for vector
2310 norm definitions.
2319 norm definitions.
2311 (amin/amax): added amin/amax for array min/max. Similar to what
2320 (amin/amax): added amin/amax for array min/max. Similar to what
2312 pylab ships with after the recent reorganization of names.
2321 pylab ships with after the recent reorganization of names.
2313 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2322 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2314
2323
2315 * ipython.el: committed Alex's recent fixes and improvements.
2324 * ipython.el: committed Alex's recent fixes and improvements.
2316 Tested with python-mode from CVS, and it looks excellent. Since
2325 Tested with python-mode from CVS, and it looks excellent. Since
2317 python-mode hasn't released anything in a while, I'm temporarily
2326 python-mode hasn't released anything in a while, I'm temporarily
2318 putting a copy of today's CVS (v 4.70) of python-mode in:
2327 putting a copy of today's CVS (v 4.70) of python-mode in:
2319 http://ipython.scipy.org/tmp/python-mode.el
2328 http://ipython.scipy.org/tmp/python-mode.el
2320
2329
2321 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2330 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2322 sys.executable for the executable name, instead of assuming it's
2331 sys.executable for the executable name, instead of assuming it's
2323 called 'python.exe' (the post-installer would have produced broken
2332 called 'python.exe' (the post-installer would have produced broken
2324 setups on systems with a differently named python binary).
2333 setups on systems with a differently named python binary).
2325
2334
2326 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2335 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2327 references to os.linesep, to make the code more
2336 references to os.linesep, to make the code more
2328 platform-independent. This is also part of the win32 coloring
2337 platform-independent. This is also part of the win32 coloring
2329 fixes.
2338 fixes.
2330
2339
2331 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2340 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2332 lines, which actually cause coloring bugs because the length of
2341 lines, which actually cause coloring bugs because the length of
2333 the line is very difficult to correctly compute with embedded
2342 the line is very difficult to correctly compute with embedded
2334 escapes. This was the source of all the coloring problems under
2343 escapes. This was the source of all the coloring problems under
2335 Win32. I think that _finally_, Win32 users have a properly
2344 Win32. I think that _finally_, Win32 users have a properly
2336 working ipython in all respects. This would never have happened
2345 working ipython in all respects. This would never have happened
2337 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2346 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2338
2347
2339 2005-01-26 *** Released version 0.6.9
2348 2005-01-26 *** Released version 0.6.9
2340
2349
2341 2005-01-25 Fernando Perez <fperez@colorado.edu>
2350 2005-01-25 Fernando Perez <fperez@colorado.edu>
2342
2351
2343 * setup.py: finally, we have a true Windows installer, thanks to
2352 * setup.py: finally, we have a true Windows installer, thanks to
2344 the excellent work of Viktor Ransmayr
2353 the excellent work of Viktor Ransmayr
2345 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2354 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2346 Windows users. The setup routine is quite a bit cleaner thanks to
2355 Windows users. The setup routine is quite a bit cleaner thanks to
2347 this, and the post-install script uses the proper functions to
2356 this, and the post-install script uses the proper functions to
2348 allow a clean de-installation using the standard Windows Control
2357 allow a clean de-installation using the standard Windows Control
2349 Panel.
2358 Panel.
2350
2359
2351 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2360 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2352 environment variable under all OSes (including win32) if
2361 environment variable under all OSes (including win32) if
2353 available. This will give consistency to win32 users who have set
2362 available. This will give consistency to win32 users who have set
2354 this variable for any reason. If os.environ['HOME'] fails, the
2363 this variable for any reason. If os.environ['HOME'] fails, the
2355 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2364 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2356
2365
2357 2005-01-24 Fernando Perez <fperez@colorado.edu>
2366 2005-01-24 Fernando Perez <fperez@colorado.edu>
2358
2367
2359 * IPython/numutils.py (empty_like): add empty_like(), similar to
2368 * IPython/numutils.py (empty_like): add empty_like(), similar to
2360 zeros_like() but taking advantage of the new empty() Numeric routine.
2369 zeros_like() but taking advantage of the new empty() Numeric routine.
2361
2370
2362 2005-01-23 *** Released version 0.6.8
2371 2005-01-23 *** Released version 0.6.8
2363
2372
2364 2005-01-22 Fernando Perez <fperez@colorado.edu>
2373 2005-01-22 Fernando Perez <fperez@colorado.edu>
2365
2374
2366 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2375 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2367 automatic show() calls. After discussing things with JDH, it
2376 automatic show() calls. After discussing things with JDH, it
2368 turns out there are too many corner cases where this can go wrong.
2377 turns out there are too many corner cases where this can go wrong.
2369 It's best not to try to be 'too smart', and simply have ipython
2378 It's best not to try to be 'too smart', and simply have ipython
2370 reproduce as much as possible the default behavior of a normal
2379 reproduce as much as possible the default behavior of a normal
2371 python shell.
2380 python shell.
2372
2381
2373 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2382 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2374 line-splitting regexp and _prefilter() to avoid calling getattr()
2383 line-splitting regexp and _prefilter() to avoid calling getattr()
2375 on assignments. This closes
2384 on assignments. This closes
2376 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2385 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2377 readline uses getattr(), so a simple <TAB> keypress is still
2386 readline uses getattr(), so a simple <TAB> keypress is still
2378 enough to trigger getattr() calls on an object.
2387 enough to trigger getattr() calls on an object.
2379
2388
2380 2005-01-21 Fernando Perez <fperez@colorado.edu>
2389 2005-01-21 Fernando Perez <fperez@colorado.edu>
2381
2390
2382 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2391 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2383 docstring under pylab so it doesn't mask the original.
2392 docstring under pylab so it doesn't mask the original.
2384
2393
2385 2005-01-21 *** Released version 0.6.7
2394 2005-01-21 *** Released version 0.6.7
2386
2395
2387 2005-01-21 Fernando Perez <fperez@colorado.edu>
2396 2005-01-21 Fernando Perez <fperez@colorado.edu>
2388
2397
2389 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2398 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2390 signal handling for win32 users in multithreaded mode.
2399 signal handling for win32 users in multithreaded mode.
2391
2400
2392 2005-01-17 Fernando Perez <fperez@colorado.edu>
2401 2005-01-17 Fernando Perez <fperez@colorado.edu>
2393
2402
2394 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2403 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2395 instances with no __init__. After a crash report by Norbert Nemec
2404 instances with no __init__. After a crash report by Norbert Nemec
2396 <Norbert-AT-nemec-online.de>.
2405 <Norbert-AT-nemec-online.de>.
2397
2406
2398 2005-01-14 Fernando Perez <fperez@colorado.edu>
2407 2005-01-14 Fernando Perez <fperez@colorado.edu>
2399
2408
2400 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2409 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2401 names for verbose exceptions, when multiple dotted names and the
2410 names for verbose exceptions, when multiple dotted names and the
2402 'parent' object were present on the same line.
2411 'parent' object were present on the same line.
2403
2412
2404 2005-01-11 Fernando Perez <fperez@colorado.edu>
2413 2005-01-11 Fernando Perez <fperez@colorado.edu>
2405
2414
2406 * IPython/genutils.py (flag_calls): new utility to trap and flag
2415 * IPython/genutils.py (flag_calls): new utility to trap and flag
2407 calls in functions. I need it to clean up matplotlib support.
2416 calls in functions. I need it to clean up matplotlib support.
2408 Also removed some deprecated code in genutils.
2417 Also removed some deprecated code in genutils.
2409
2418
2410 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2419 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2411 that matplotlib scripts called with %run, which don't call show()
2420 that matplotlib scripts called with %run, which don't call show()
2412 themselves, still have their plotting windows open.
2421 themselves, still have their plotting windows open.
2413
2422
2414 2005-01-05 Fernando Perez <fperez@colorado.edu>
2423 2005-01-05 Fernando Perez <fperez@colorado.edu>
2415
2424
2416 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2425 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2417 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2426 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2418
2427
2419 2004-12-19 Fernando Perez <fperez@colorado.edu>
2428 2004-12-19 Fernando Perez <fperez@colorado.edu>
2420
2429
2421 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2430 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2422 parent_runcode, which was an eyesore. The same result can be
2431 parent_runcode, which was an eyesore. The same result can be
2423 obtained with Python's regular superclass mechanisms.
2432 obtained with Python's regular superclass mechanisms.
2424
2433
2425 2004-12-17 Fernando Perez <fperez@colorado.edu>
2434 2004-12-17 Fernando Perez <fperez@colorado.edu>
2426
2435
2427 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2436 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2428 reported by Prabhu.
2437 reported by Prabhu.
2429 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2438 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2430 sys.stderr) instead of explicitly calling sys.stderr. This helps
2439 sys.stderr) instead of explicitly calling sys.stderr. This helps
2431 maintain our I/O abstractions clean, for future GUI embeddings.
2440 maintain our I/O abstractions clean, for future GUI embeddings.
2432
2441
2433 * IPython/genutils.py (info): added new utility for sys.stderr
2442 * IPython/genutils.py (info): added new utility for sys.stderr
2434 unified info message handling (thin wrapper around warn()).
2443 unified info message handling (thin wrapper around warn()).
2435
2444
2436 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2445 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2437 composite (dotted) names on verbose exceptions.
2446 composite (dotted) names on verbose exceptions.
2438 (VerboseTB.nullrepr): harden against another kind of errors which
2447 (VerboseTB.nullrepr): harden against another kind of errors which
2439 Python's inspect module can trigger, and which were crashing
2448 Python's inspect module can trigger, and which were crashing
2440 IPython. Thanks to a report by Marco Lombardi
2449 IPython. Thanks to a report by Marco Lombardi
2441 <mlombard-AT-ma010192.hq.eso.org>.
2450 <mlombard-AT-ma010192.hq.eso.org>.
2442
2451
2443 2004-12-13 *** Released version 0.6.6
2452 2004-12-13 *** Released version 0.6.6
2444
2453
2445 2004-12-12 Fernando Perez <fperez@colorado.edu>
2454 2004-12-12 Fernando Perez <fperez@colorado.edu>
2446
2455
2447 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2456 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2448 generated by pygtk upon initialization if it was built without
2457 generated by pygtk upon initialization if it was built without
2449 threads (for matplotlib users). After a crash reported by
2458 threads (for matplotlib users). After a crash reported by
2450 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2459 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2451
2460
2452 * IPython/ipmaker.py (make_IPython): fix small bug in the
2461 * IPython/ipmaker.py (make_IPython): fix small bug in the
2453 import_some parameter for multiple imports.
2462 import_some parameter for multiple imports.
2454
2463
2455 * IPython/iplib.py (ipmagic): simplified the interface of
2464 * IPython/iplib.py (ipmagic): simplified the interface of
2456 ipmagic() to take a single string argument, just as it would be
2465 ipmagic() to take a single string argument, just as it would be
2457 typed at the IPython cmd line.
2466 typed at the IPython cmd line.
2458 (ipalias): Added new ipalias() with an interface identical to
2467 (ipalias): Added new ipalias() with an interface identical to
2459 ipmagic(). This completes exposing a pure python interface to the
2468 ipmagic(). This completes exposing a pure python interface to the
2460 alias and magic system, which can be used in loops or more complex
2469 alias and magic system, which can be used in loops or more complex
2461 code where IPython's automatic line mangling is not active.
2470 code where IPython's automatic line mangling is not active.
2462
2471
2463 * IPython/genutils.py (timing): changed interface of timing to
2472 * IPython/genutils.py (timing): changed interface of timing to
2464 simply run code once, which is the most common case. timings()
2473 simply run code once, which is the most common case. timings()
2465 remains unchanged, for the cases where you want multiple runs.
2474 remains unchanged, for the cases where you want multiple runs.
2466
2475
2467 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2476 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2468 bug where Python2.2 crashes with exec'ing code which does not end
2477 bug where Python2.2 crashes with exec'ing code which does not end
2469 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2478 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2470 before.
2479 before.
2471
2480
2472 2004-12-10 Fernando Perez <fperez@colorado.edu>
2481 2004-12-10 Fernando Perez <fperez@colorado.edu>
2473
2482
2474 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2483 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2475 -t to -T, to accomodate the new -t flag in %run (the %run and
2484 -t to -T, to accomodate the new -t flag in %run (the %run and
2476 %prun options are kind of intermixed, and it's not easy to change
2485 %prun options are kind of intermixed, and it's not easy to change
2477 this with the limitations of python's getopt).
2486 this with the limitations of python's getopt).
2478
2487
2479 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2488 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2480 the execution of scripts. It's not as fine-tuned as timeit.py,
2489 the execution of scripts. It's not as fine-tuned as timeit.py,
2481 but it works from inside ipython (and under 2.2, which lacks
2490 but it works from inside ipython (and under 2.2, which lacks
2482 timeit.py). Optionally a number of runs > 1 can be given for
2491 timeit.py). Optionally a number of runs > 1 can be given for
2483 timing very short-running code.
2492 timing very short-running code.
2484
2493
2485 * IPython/genutils.py (uniq_stable): new routine which returns a
2494 * IPython/genutils.py (uniq_stable): new routine which returns a
2486 list of unique elements in any iterable, but in stable order of
2495 list of unique elements in any iterable, but in stable order of
2487 appearance. I needed this for the ultraTB fixes, and it's a handy
2496 appearance. I needed this for the ultraTB fixes, and it's a handy
2488 utility.
2497 utility.
2489
2498
2490 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2499 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2491 dotted names in Verbose exceptions. This had been broken since
2500 dotted names in Verbose exceptions. This had been broken since
2492 the very start, now x.y will properly be printed in a Verbose
2501 the very start, now x.y will properly be printed in a Verbose
2493 traceback, instead of x being shown and y appearing always as an
2502 traceback, instead of x being shown and y appearing always as an
2494 'undefined global'. Getting this to work was a bit tricky,
2503 'undefined global'. Getting this to work was a bit tricky,
2495 because by default python tokenizers are stateless. Saved by
2504 because by default python tokenizers are stateless. Saved by
2496 python's ability to easily add a bit of state to an arbitrary
2505 python's ability to easily add a bit of state to an arbitrary
2497 function (without needing to build a full-blown callable object).
2506 function (without needing to build a full-blown callable object).
2498
2507
2499 Also big cleanup of this code, which had horrendous runtime
2508 Also big cleanup of this code, which had horrendous runtime
2500 lookups of zillions of attributes for colorization. Moved all
2509 lookups of zillions of attributes for colorization. Moved all
2501 this code into a few templates, which make it cleaner and quicker.
2510 this code into a few templates, which make it cleaner and quicker.
2502
2511
2503 Printout quality was also improved for Verbose exceptions: one
2512 Printout quality was also improved for Verbose exceptions: one
2504 variable per line, and memory addresses are printed (this can be
2513 variable per line, and memory addresses are printed (this can be
2505 quite handy in nasty debugging situations, which is what Verbose
2514 quite handy in nasty debugging situations, which is what Verbose
2506 is for).
2515 is for).
2507
2516
2508 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2517 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2509 the command line as scripts to be loaded by embedded instances.
2518 the command line as scripts to be loaded by embedded instances.
2510 Doing so has the potential for an infinite recursion if there are
2519 Doing so has the potential for an infinite recursion if there are
2511 exceptions thrown in the process. This fixes a strange crash
2520 exceptions thrown in the process. This fixes a strange crash
2512 reported by Philippe MULLER <muller-AT-irit.fr>.
2521 reported by Philippe MULLER <muller-AT-irit.fr>.
2513
2522
2514 2004-12-09 Fernando Perez <fperez@colorado.edu>
2523 2004-12-09 Fernando Perez <fperez@colorado.edu>
2515
2524
2516 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2525 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2517 to reflect new names in matplotlib, which now expose the
2526 to reflect new names in matplotlib, which now expose the
2518 matlab-compatible interface via a pylab module instead of the
2527 matlab-compatible interface via a pylab module instead of the
2519 'matlab' name. The new code is backwards compatible, so users of
2528 'matlab' name. The new code is backwards compatible, so users of
2520 all matplotlib versions are OK. Patch by J. Hunter.
2529 all matplotlib versions are OK. Patch by J. Hunter.
2521
2530
2522 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2531 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2523 of __init__ docstrings for instances (class docstrings are already
2532 of __init__ docstrings for instances (class docstrings are already
2524 automatically printed). Instances with customized docstrings
2533 automatically printed). Instances with customized docstrings
2525 (indep. of the class) are also recognized and all 3 separate
2534 (indep. of the class) are also recognized and all 3 separate
2526 docstrings are printed (instance, class, constructor). After some
2535 docstrings are printed (instance, class, constructor). After some
2527 comments/suggestions by J. Hunter.
2536 comments/suggestions by J. Hunter.
2528
2537
2529 2004-12-05 Fernando Perez <fperez@colorado.edu>
2538 2004-12-05 Fernando Perez <fperez@colorado.edu>
2530
2539
2531 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2540 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2532 warnings when tab-completion fails and triggers an exception.
2541 warnings when tab-completion fails and triggers an exception.
2533
2542
2534 2004-12-03 Fernando Perez <fperez@colorado.edu>
2543 2004-12-03 Fernando Perez <fperez@colorado.edu>
2535
2544
2536 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2545 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2537 be triggered when using 'run -p'. An incorrect option flag was
2546 be triggered when using 'run -p'. An incorrect option flag was
2538 being set ('d' instead of 'D').
2547 being set ('d' instead of 'D').
2539 (manpage): fix missing escaped \- sign.
2548 (manpage): fix missing escaped \- sign.
2540
2549
2541 2004-11-30 *** Released version 0.6.5
2550 2004-11-30 *** Released version 0.6.5
2542
2551
2543 2004-11-30 Fernando Perez <fperez@colorado.edu>
2552 2004-11-30 Fernando Perez <fperez@colorado.edu>
2544
2553
2545 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2554 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2546 setting with -d option.
2555 setting with -d option.
2547
2556
2548 * setup.py (docfiles): Fix problem where the doc glob I was using
2557 * setup.py (docfiles): Fix problem where the doc glob I was using
2549 was COMPLETELY BROKEN. It was giving the right files by pure
2558 was COMPLETELY BROKEN. It was giving the right files by pure
2550 accident, but failed once I tried to include ipython.el. Note:
2559 accident, but failed once I tried to include ipython.el. Note:
2551 glob() does NOT allow you to do exclusion on multiple endings!
2560 glob() does NOT allow you to do exclusion on multiple endings!
2552
2561
2553 2004-11-29 Fernando Perez <fperez@colorado.edu>
2562 2004-11-29 Fernando Perez <fperez@colorado.edu>
2554
2563
2555 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2564 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2556 the manpage as the source. Better formatting & consistency.
2565 the manpage as the source. Better formatting & consistency.
2557
2566
2558 * IPython/Magic.py (magic_run): Added new -d option, to run
2567 * IPython/Magic.py (magic_run): Added new -d option, to run
2559 scripts under the control of the python pdb debugger. Note that
2568 scripts under the control of the python pdb debugger. Note that
2560 this required changing the %prun option -d to -D, to avoid a clash
2569 this required changing the %prun option -d to -D, to avoid a clash
2561 (since %run must pass options to %prun, and getopt is too dumb to
2570 (since %run must pass options to %prun, and getopt is too dumb to
2562 handle options with string values with embedded spaces). Thanks
2571 handle options with string values with embedded spaces). Thanks
2563 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2572 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2564 (magic_who_ls): added type matching to %who and %whos, so that one
2573 (magic_who_ls): added type matching to %who and %whos, so that one
2565 can filter their output to only include variables of certain
2574 can filter their output to only include variables of certain
2566 types. Another suggestion by Matthew.
2575 types. Another suggestion by Matthew.
2567 (magic_whos): Added memory summaries in kb and Mb for arrays.
2576 (magic_whos): Added memory summaries in kb and Mb for arrays.
2568 (magic_who): Improve formatting (break lines every 9 vars).
2577 (magic_who): Improve formatting (break lines every 9 vars).
2569
2578
2570 2004-11-28 Fernando Perez <fperez@colorado.edu>
2579 2004-11-28 Fernando Perez <fperez@colorado.edu>
2571
2580
2572 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2581 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2573 cache when empty lines were present.
2582 cache when empty lines were present.
2574
2583
2575 2004-11-24 Fernando Perez <fperez@colorado.edu>
2584 2004-11-24 Fernando Perez <fperez@colorado.edu>
2576
2585
2577 * IPython/usage.py (__doc__): document the re-activated threading
2586 * IPython/usage.py (__doc__): document the re-activated threading
2578 options for WX and GTK.
2587 options for WX and GTK.
2579
2588
2580 2004-11-23 Fernando Perez <fperez@colorado.edu>
2589 2004-11-23 Fernando Perez <fperez@colorado.edu>
2581
2590
2582 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2591 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2583 the -wthread and -gthread options, along with a new -tk one to try
2592 the -wthread and -gthread options, along with a new -tk one to try
2584 and coordinate Tk threading with wx/gtk. The tk support is very
2593 and coordinate Tk threading with wx/gtk. The tk support is very
2585 platform dependent, since it seems to require Tcl and Tk to be
2594 platform dependent, since it seems to require Tcl and Tk to be
2586 built with threads (Fedora1/2 appears NOT to have it, but in
2595 built with threads (Fedora1/2 appears NOT to have it, but in
2587 Prabhu's Debian boxes it works OK). But even with some Tk
2596 Prabhu's Debian boxes it works OK). But even with some Tk
2588 limitations, this is a great improvement.
2597 limitations, this is a great improvement.
2589
2598
2590 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2599 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2591 info in user prompts. Patch by Prabhu.
2600 info in user prompts. Patch by Prabhu.
2592
2601
2593 2004-11-18 Fernando Perez <fperez@colorado.edu>
2602 2004-11-18 Fernando Perez <fperez@colorado.edu>
2594
2603
2595 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2604 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2596 EOFErrors and bail, to avoid infinite loops if a non-terminating
2605 EOFErrors and bail, to avoid infinite loops if a non-terminating
2597 file is fed into ipython. Patch submitted in issue 19 by user,
2606 file is fed into ipython. Patch submitted in issue 19 by user,
2598 many thanks.
2607 many thanks.
2599
2608
2600 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2609 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2601 autoquote/parens in continuation prompts, which can cause lots of
2610 autoquote/parens in continuation prompts, which can cause lots of
2602 problems. Closes roundup issue 20.
2611 problems. Closes roundup issue 20.
2603
2612
2604 2004-11-17 Fernando Perez <fperez@colorado.edu>
2613 2004-11-17 Fernando Perez <fperez@colorado.edu>
2605
2614
2606 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2615 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2607 reported as debian bug #280505. I'm not sure my local changelog
2616 reported as debian bug #280505. I'm not sure my local changelog
2608 entry has the proper debian format (Jack?).
2617 entry has the proper debian format (Jack?).
2609
2618
2610 2004-11-08 *** Released version 0.6.4
2619 2004-11-08 *** Released version 0.6.4
2611
2620
2612 2004-11-08 Fernando Perez <fperez@colorado.edu>
2621 2004-11-08 Fernando Perez <fperez@colorado.edu>
2613
2622
2614 * IPython/iplib.py (init_readline): Fix exit message for Windows
2623 * IPython/iplib.py (init_readline): Fix exit message for Windows
2615 when readline is active. Thanks to a report by Eric Jones
2624 when readline is active. Thanks to a report by Eric Jones
2616 <eric-AT-enthought.com>.
2625 <eric-AT-enthought.com>.
2617
2626
2618 2004-11-07 Fernando Perez <fperez@colorado.edu>
2627 2004-11-07 Fernando Perez <fperez@colorado.edu>
2619
2628
2620 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2629 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2621 sometimes seen by win2k/cygwin users.
2630 sometimes seen by win2k/cygwin users.
2622
2631
2623 2004-11-06 Fernando Perez <fperez@colorado.edu>
2632 2004-11-06 Fernando Perez <fperez@colorado.edu>
2624
2633
2625 * IPython/iplib.py (interact): Change the handling of %Exit from
2634 * IPython/iplib.py (interact): Change the handling of %Exit from
2626 trying to propagate a SystemExit to an internal ipython flag.
2635 trying to propagate a SystemExit to an internal ipython flag.
2627 This is less elegant than using Python's exception mechanism, but
2636 This is less elegant than using Python's exception mechanism, but
2628 I can't get that to work reliably with threads, so under -pylab
2637 I can't get that to work reliably with threads, so under -pylab
2629 %Exit was hanging IPython. Cross-thread exception handling is
2638 %Exit was hanging IPython. Cross-thread exception handling is
2630 really a bitch. Thaks to a bug report by Stephen Walton
2639 really a bitch. Thaks to a bug report by Stephen Walton
2631 <stephen.walton-AT-csun.edu>.
2640 <stephen.walton-AT-csun.edu>.
2632
2641
2633 2004-11-04 Fernando Perez <fperez@colorado.edu>
2642 2004-11-04 Fernando Perez <fperez@colorado.edu>
2634
2643
2635 * IPython/iplib.py (raw_input_original): store a pointer to the
2644 * IPython/iplib.py (raw_input_original): store a pointer to the
2636 true raw_input to harden against code which can modify it
2645 true raw_input to harden against code which can modify it
2637 (wx.py.PyShell does this and would otherwise crash ipython).
2646 (wx.py.PyShell does this and would otherwise crash ipython).
2638 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2647 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2639
2648
2640 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2649 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2641 Ctrl-C problem, which does not mess up the input line.
2650 Ctrl-C problem, which does not mess up the input line.
2642
2651
2643 2004-11-03 Fernando Perez <fperez@colorado.edu>
2652 2004-11-03 Fernando Perez <fperez@colorado.edu>
2644
2653
2645 * IPython/Release.py: Changed licensing to BSD, in all files.
2654 * IPython/Release.py: Changed licensing to BSD, in all files.
2646 (name): lowercase name for tarball/RPM release.
2655 (name): lowercase name for tarball/RPM release.
2647
2656
2648 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2657 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2649 use throughout ipython.
2658 use throughout ipython.
2650
2659
2651 * IPython/Magic.py (Magic._ofind): Switch to using the new
2660 * IPython/Magic.py (Magic._ofind): Switch to using the new
2652 OInspect.getdoc() function.
2661 OInspect.getdoc() function.
2653
2662
2654 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2663 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2655 of the line currently being canceled via Ctrl-C. It's extremely
2664 of the line currently being canceled via Ctrl-C. It's extremely
2656 ugly, but I don't know how to do it better (the problem is one of
2665 ugly, but I don't know how to do it better (the problem is one of
2657 handling cross-thread exceptions).
2666 handling cross-thread exceptions).
2658
2667
2659 2004-10-28 Fernando Perez <fperez@colorado.edu>
2668 2004-10-28 Fernando Perez <fperez@colorado.edu>
2660
2669
2661 * IPython/Shell.py (signal_handler): add signal handlers to trap
2670 * IPython/Shell.py (signal_handler): add signal handlers to trap
2662 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2671 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2663 report by Francesc Alted.
2672 report by Francesc Alted.
2664
2673
2665 2004-10-21 Fernando Perez <fperez@colorado.edu>
2674 2004-10-21 Fernando Perez <fperez@colorado.edu>
2666
2675
2667 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2676 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2668 to % for pysh syntax extensions.
2677 to % for pysh syntax extensions.
2669
2678
2670 2004-10-09 Fernando Perez <fperez@colorado.edu>
2679 2004-10-09 Fernando Perez <fperez@colorado.edu>
2671
2680
2672 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2681 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2673 arrays to print a more useful summary, without calling str(arr).
2682 arrays to print a more useful summary, without calling str(arr).
2674 This avoids the problem of extremely lengthy computations which
2683 This avoids the problem of extremely lengthy computations which
2675 occur if arr is large, and appear to the user as a system lockup
2684 occur if arr is large, and appear to the user as a system lockup
2676 with 100% cpu activity. After a suggestion by Kristian Sandberg
2685 with 100% cpu activity. After a suggestion by Kristian Sandberg
2677 <Kristian.Sandberg@colorado.edu>.
2686 <Kristian.Sandberg@colorado.edu>.
2678 (Magic.__init__): fix bug in global magic escapes not being
2687 (Magic.__init__): fix bug in global magic escapes not being
2679 correctly set.
2688 correctly set.
2680
2689
2681 2004-10-08 Fernando Perez <fperez@colorado.edu>
2690 2004-10-08 Fernando Perez <fperez@colorado.edu>
2682
2691
2683 * IPython/Magic.py (__license__): change to absolute imports of
2692 * IPython/Magic.py (__license__): change to absolute imports of
2684 ipython's own internal packages, to start adapting to the absolute
2693 ipython's own internal packages, to start adapting to the absolute
2685 import requirement of PEP-328.
2694 import requirement of PEP-328.
2686
2695
2687 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2696 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2688 files, and standardize author/license marks through the Release
2697 files, and standardize author/license marks through the Release
2689 module instead of having per/file stuff (except for files with
2698 module instead of having per/file stuff (except for files with
2690 particular licenses, like the MIT/PSF-licensed codes).
2699 particular licenses, like the MIT/PSF-licensed codes).
2691
2700
2692 * IPython/Debugger.py: remove dead code for python 2.1
2701 * IPython/Debugger.py: remove dead code for python 2.1
2693
2702
2694 2004-10-04 Fernando Perez <fperez@colorado.edu>
2703 2004-10-04 Fernando Perez <fperez@colorado.edu>
2695
2704
2696 * IPython/iplib.py (ipmagic): New function for accessing magics
2705 * IPython/iplib.py (ipmagic): New function for accessing magics
2697 via a normal python function call.
2706 via a normal python function call.
2698
2707
2699 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2708 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2700 from '@' to '%', to accomodate the new @decorator syntax of python
2709 from '@' to '%', to accomodate the new @decorator syntax of python
2701 2.4.
2710 2.4.
2702
2711
2703 2004-09-29 Fernando Perez <fperez@colorado.edu>
2712 2004-09-29 Fernando Perez <fperez@colorado.edu>
2704
2713
2705 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2714 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2706 matplotlib.use to prevent running scripts which try to switch
2715 matplotlib.use to prevent running scripts which try to switch
2707 interactive backends from within ipython. This will just crash
2716 interactive backends from within ipython. This will just crash
2708 the python interpreter, so we can't allow it (but a detailed error
2717 the python interpreter, so we can't allow it (but a detailed error
2709 is given to the user).
2718 is given to the user).
2710
2719
2711 2004-09-28 Fernando Perez <fperez@colorado.edu>
2720 2004-09-28 Fernando Perez <fperez@colorado.edu>
2712
2721
2713 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2722 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2714 matplotlib-related fixes so that using @run with non-matplotlib
2723 matplotlib-related fixes so that using @run with non-matplotlib
2715 scripts doesn't pop up spurious plot windows. This requires
2724 scripts doesn't pop up spurious plot windows. This requires
2716 matplotlib >= 0.63, where I had to make some changes as well.
2725 matplotlib >= 0.63, where I had to make some changes as well.
2717
2726
2718 * IPython/ipmaker.py (make_IPython): update version requirement to
2727 * IPython/ipmaker.py (make_IPython): update version requirement to
2719 python 2.2.
2728 python 2.2.
2720
2729
2721 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2730 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2722 banner arg for embedded customization.
2731 banner arg for embedded customization.
2723
2732
2724 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2733 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2725 explicit uses of __IP as the IPython's instance name. Now things
2734 explicit uses of __IP as the IPython's instance name. Now things
2726 are properly handled via the shell.name value. The actual code
2735 are properly handled via the shell.name value. The actual code
2727 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2736 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2728 is much better than before. I'll clean things completely when the
2737 is much better than before. I'll clean things completely when the
2729 magic stuff gets a real overhaul.
2738 magic stuff gets a real overhaul.
2730
2739
2731 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2740 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2732 minor changes to debian dir.
2741 minor changes to debian dir.
2733
2742
2734 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2743 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2735 pointer to the shell itself in the interactive namespace even when
2744 pointer to the shell itself in the interactive namespace even when
2736 a user-supplied dict is provided. This is needed for embedding
2745 a user-supplied dict is provided. This is needed for embedding
2737 purposes (found by tests with Michel Sanner).
2746 purposes (found by tests with Michel Sanner).
2738
2747
2739 2004-09-27 Fernando Perez <fperez@colorado.edu>
2748 2004-09-27 Fernando Perez <fperez@colorado.edu>
2740
2749
2741 * IPython/UserConfig/ipythonrc: remove []{} from
2750 * IPython/UserConfig/ipythonrc: remove []{} from
2742 readline_remove_delims, so that things like [modname.<TAB> do
2751 readline_remove_delims, so that things like [modname.<TAB> do
2743 proper completion. This disables [].TAB, but that's a less common
2752 proper completion. This disables [].TAB, but that's a less common
2744 case than module names in list comprehensions, for example.
2753 case than module names in list comprehensions, for example.
2745 Thanks to a report by Andrea Riciputi.
2754 Thanks to a report by Andrea Riciputi.
2746
2755
2747 2004-09-09 Fernando Perez <fperez@colorado.edu>
2756 2004-09-09 Fernando Perez <fperez@colorado.edu>
2748
2757
2749 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2758 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2750 blocking problems in win32 and osx. Fix by John.
2759 blocking problems in win32 and osx. Fix by John.
2751
2760
2752 2004-09-08 Fernando Perez <fperez@colorado.edu>
2761 2004-09-08 Fernando Perez <fperez@colorado.edu>
2753
2762
2754 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2763 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2755 for Win32 and OSX. Fix by John Hunter.
2764 for Win32 and OSX. Fix by John Hunter.
2756
2765
2757 2004-08-30 *** Released version 0.6.3
2766 2004-08-30 *** Released version 0.6.3
2758
2767
2759 2004-08-30 Fernando Perez <fperez@colorado.edu>
2768 2004-08-30 Fernando Perez <fperez@colorado.edu>
2760
2769
2761 * setup.py (isfile): Add manpages to list of dependent files to be
2770 * setup.py (isfile): Add manpages to list of dependent files to be
2762 updated.
2771 updated.
2763
2772
2764 2004-08-27 Fernando Perez <fperez@colorado.edu>
2773 2004-08-27 Fernando Perez <fperez@colorado.edu>
2765
2774
2766 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2775 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2767 for now. They don't really work with standalone WX/GTK code
2776 for now. They don't really work with standalone WX/GTK code
2768 (though matplotlib IS working fine with both of those backends).
2777 (though matplotlib IS working fine with both of those backends).
2769 This will neeed much more testing. I disabled most things with
2778 This will neeed much more testing. I disabled most things with
2770 comments, so turning it back on later should be pretty easy.
2779 comments, so turning it back on later should be pretty easy.
2771
2780
2772 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2781 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2773 autocalling of expressions like r'foo', by modifying the line
2782 autocalling of expressions like r'foo', by modifying the line
2774 split regexp. Closes
2783 split regexp. Closes
2775 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2784 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2776 Riley <ipythonbugs-AT-sabi.net>.
2785 Riley <ipythonbugs-AT-sabi.net>.
2777 (InteractiveShell.mainloop): honor --nobanner with banner
2786 (InteractiveShell.mainloop): honor --nobanner with banner
2778 extensions.
2787 extensions.
2779
2788
2780 * IPython/Shell.py: Significant refactoring of all classes, so
2789 * IPython/Shell.py: Significant refactoring of all classes, so
2781 that we can really support ALL matplotlib backends and threading
2790 that we can really support ALL matplotlib backends and threading
2782 models (John spotted a bug with Tk which required this). Now we
2791 models (John spotted a bug with Tk which required this). Now we
2783 should support single-threaded, WX-threads and GTK-threads, both
2792 should support single-threaded, WX-threads and GTK-threads, both
2784 for generic code and for matplotlib.
2793 for generic code and for matplotlib.
2785
2794
2786 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2795 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2787 -pylab, to simplify things for users. Will also remove the pylab
2796 -pylab, to simplify things for users. Will also remove the pylab
2788 profile, since now all of matplotlib configuration is directly
2797 profile, since now all of matplotlib configuration is directly
2789 handled here. This also reduces startup time.
2798 handled here. This also reduces startup time.
2790
2799
2791 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2800 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2792 shell wasn't being correctly called. Also in IPShellWX.
2801 shell wasn't being correctly called. Also in IPShellWX.
2793
2802
2794 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2803 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2795 fine-tune banner.
2804 fine-tune banner.
2796
2805
2797 * IPython/numutils.py (spike): Deprecate these spike functions,
2806 * IPython/numutils.py (spike): Deprecate these spike functions,
2798 delete (long deprecated) gnuplot_exec handler.
2807 delete (long deprecated) gnuplot_exec handler.
2799
2808
2800 2004-08-26 Fernando Perez <fperez@colorado.edu>
2809 2004-08-26 Fernando Perez <fperez@colorado.edu>
2801
2810
2802 * ipython.1: Update for threading options, plus some others which
2811 * ipython.1: Update for threading options, plus some others which
2803 were missing.
2812 were missing.
2804
2813
2805 * IPython/ipmaker.py (__call__): Added -wthread option for
2814 * IPython/ipmaker.py (__call__): Added -wthread option for
2806 wxpython thread handling. Make sure threading options are only
2815 wxpython thread handling. Make sure threading options are only
2807 valid at the command line.
2816 valid at the command line.
2808
2817
2809 * scripts/ipython: moved shell selection into a factory function
2818 * scripts/ipython: moved shell selection into a factory function
2810 in Shell.py, to keep the starter script to a minimum.
2819 in Shell.py, to keep the starter script to a minimum.
2811
2820
2812 2004-08-25 Fernando Perez <fperez@colorado.edu>
2821 2004-08-25 Fernando Perez <fperez@colorado.edu>
2813
2822
2814 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2823 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2815 John. Along with some recent changes he made to matplotlib, the
2824 John. Along with some recent changes he made to matplotlib, the
2816 next versions of both systems should work very well together.
2825 next versions of both systems should work very well together.
2817
2826
2818 2004-08-24 Fernando Perez <fperez@colorado.edu>
2827 2004-08-24 Fernando Perez <fperez@colorado.edu>
2819
2828
2820 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2829 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2821 tried to switch the profiling to using hotshot, but I'm getting
2830 tried to switch the profiling to using hotshot, but I'm getting
2822 strange errors from prof.runctx() there. I may be misreading the
2831 strange errors from prof.runctx() there. I may be misreading the
2823 docs, but it looks weird. For now the profiling code will
2832 docs, but it looks weird. For now the profiling code will
2824 continue to use the standard profiler.
2833 continue to use the standard profiler.
2825
2834
2826 2004-08-23 Fernando Perez <fperez@colorado.edu>
2835 2004-08-23 Fernando Perez <fperez@colorado.edu>
2827
2836
2828 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2837 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2829 threaded shell, by John Hunter. It's not quite ready yet, but
2838 threaded shell, by John Hunter. It's not quite ready yet, but
2830 close.
2839 close.
2831
2840
2832 2004-08-22 Fernando Perez <fperez@colorado.edu>
2841 2004-08-22 Fernando Perez <fperez@colorado.edu>
2833
2842
2834 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2843 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2835 in Magic and ultraTB.
2844 in Magic and ultraTB.
2836
2845
2837 * ipython.1: document threading options in manpage.
2846 * ipython.1: document threading options in manpage.
2838
2847
2839 * scripts/ipython: Changed name of -thread option to -gthread,
2848 * scripts/ipython: Changed name of -thread option to -gthread,
2840 since this is GTK specific. I want to leave the door open for a
2849 since this is GTK specific. I want to leave the door open for a
2841 -wthread option for WX, which will most likely be necessary. This
2850 -wthread option for WX, which will most likely be necessary. This
2842 change affects usage and ipmaker as well.
2851 change affects usage and ipmaker as well.
2843
2852
2844 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2853 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2845 handle the matplotlib shell issues. Code by John Hunter
2854 handle the matplotlib shell issues. Code by John Hunter
2846 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2855 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2847 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2856 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2848 broken (and disabled for end users) for now, but it puts the
2857 broken (and disabled for end users) for now, but it puts the
2849 infrastructure in place.
2858 infrastructure in place.
2850
2859
2851 2004-08-21 Fernando Perez <fperez@colorado.edu>
2860 2004-08-21 Fernando Perez <fperez@colorado.edu>
2852
2861
2853 * ipythonrc-pylab: Add matplotlib support.
2862 * ipythonrc-pylab: Add matplotlib support.
2854
2863
2855 * matplotlib_config.py: new files for matplotlib support, part of
2864 * matplotlib_config.py: new files for matplotlib support, part of
2856 the pylab profile.
2865 the pylab profile.
2857
2866
2858 * IPython/usage.py (__doc__): documented the threading options.
2867 * IPython/usage.py (__doc__): documented the threading options.
2859
2868
2860 2004-08-20 Fernando Perez <fperez@colorado.edu>
2869 2004-08-20 Fernando Perez <fperez@colorado.edu>
2861
2870
2862 * ipython: Modified the main calling routine to handle the -thread
2871 * ipython: Modified the main calling routine to handle the -thread
2863 and -mpthread options. This needs to be done as a top-level hack,
2872 and -mpthread options. This needs to be done as a top-level hack,
2864 because it determines which class to instantiate for IPython
2873 because it determines which class to instantiate for IPython
2865 itself.
2874 itself.
2866
2875
2867 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2876 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2868 classes to support multithreaded GTK operation without blocking,
2877 classes to support multithreaded GTK operation without blocking,
2869 and matplotlib with all backends. This is a lot of still very
2878 and matplotlib with all backends. This is a lot of still very
2870 experimental code, and threads are tricky. So it may still have a
2879 experimental code, and threads are tricky. So it may still have a
2871 few rough edges... This code owes a lot to
2880 few rough edges... This code owes a lot to
2872 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2881 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2873 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2882 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2874 to John Hunter for all the matplotlib work.
2883 to John Hunter for all the matplotlib work.
2875
2884
2876 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2885 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2877 options for gtk thread and matplotlib support.
2886 options for gtk thread and matplotlib support.
2878
2887
2879 2004-08-16 Fernando Perez <fperez@colorado.edu>
2888 2004-08-16 Fernando Perez <fperez@colorado.edu>
2880
2889
2881 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2890 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2882 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2891 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2883 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2892 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2884
2893
2885 2004-08-11 Fernando Perez <fperez@colorado.edu>
2894 2004-08-11 Fernando Perez <fperez@colorado.edu>
2886
2895
2887 * setup.py (isfile): Fix build so documentation gets updated for
2896 * setup.py (isfile): Fix build so documentation gets updated for
2888 rpms (it was only done for .tgz builds).
2897 rpms (it was only done for .tgz builds).
2889
2898
2890 2004-08-10 Fernando Perez <fperez@colorado.edu>
2899 2004-08-10 Fernando Perez <fperez@colorado.edu>
2891
2900
2892 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2901 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2893
2902
2894 * iplib.py : Silence syntax error exceptions in tab-completion.
2903 * iplib.py : Silence syntax error exceptions in tab-completion.
2895
2904
2896 2004-08-05 Fernando Perez <fperez@colorado.edu>
2905 2004-08-05 Fernando Perez <fperez@colorado.edu>
2897
2906
2898 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2907 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2899 'color off' mark for continuation prompts. This was causing long
2908 'color off' mark for continuation prompts. This was causing long
2900 continuation lines to mis-wrap.
2909 continuation lines to mis-wrap.
2901
2910
2902 2004-08-01 Fernando Perez <fperez@colorado.edu>
2911 2004-08-01 Fernando Perez <fperez@colorado.edu>
2903
2912
2904 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2913 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2905 for building ipython to be a parameter. All this is necessary
2914 for building ipython to be a parameter. All this is necessary
2906 right now to have a multithreaded version, but this insane
2915 right now to have a multithreaded version, but this insane
2907 non-design will be cleaned up soon. For now, it's a hack that
2916 non-design will be cleaned up soon. For now, it's a hack that
2908 works.
2917 works.
2909
2918
2910 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2919 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2911 args in various places. No bugs so far, but it's a dangerous
2920 args in various places. No bugs so far, but it's a dangerous
2912 practice.
2921 practice.
2913
2922
2914 2004-07-31 Fernando Perez <fperez@colorado.edu>
2923 2004-07-31 Fernando Perez <fperez@colorado.edu>
2915
2924
2916 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2925 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2917 fix completion of files with dots in their names under most
2926 fix completion of files with dots in their names under most
2918 profiles (pysh was OK because the completion order is different).
2927 profiles (pysh was OK because the completion order is different).
2919
2928
2920 2004-07-27 Fernando Perez <fperez@colorado.edu>
2929 2004-07-27 Fernando Perez <fperez@colorado.edu>
2921
2930
2922 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2931 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2923 keywords manually, b/c the one in keyword.py was removed in python
2932 keywords manually, b/c the one in keyword.py was removed in python
2924 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2933 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2925 This is NOT a bug under python 2.3 and earlier.
2934 This is NOT a bug under python 2.3 and earlier.
2926
2935
2927 2004-07-26 Fernando Perez <fperez@colorado.edu>
2936 2004-07-26 Fernando Perez <fperez@colorado.edu>
2928
2937
2929 * IPython/ultraTB.py (VerboseTB.text): Add another
2938 * IPython/ultraTB.py (VerboseTB.text): Add another
2930 linecache.checkcache() call to try to prevent inspect.py from
2939 linecache.checkcache() call to try to prevent inspect.py from
2931 crashing under python 2.3. I think this fixes
2940 crashing under python 2.3. I think this fixes
2932 http://www.scipy.net/roundup/ipython/issue17.
2941 http://www.scipy.net/roundup/ipython/issue17.
2933
2942
2934 2004-07-26 *** Released version 0.6.2
2943 2004-07-26 *** Released version 0.6.2
2935
2944
2936 2004-07-26 Fernando Perez <fperez@colorado.edu>
2945 2004-07-26 Fernando Perez <fperez@colorado.edu>
2937
2946
2938 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2947 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2939 fail for any number.
2948 fail for any number.
2940 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2949 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2941 empty bookmarks.
2950 empty bookmarks.
2942
2951
2943 2004-07-26 *** Released version 0.6.1
2952 2004-07-26 *** Released version 0.6.1
2944
2953
2945 2004-07-26 Fernando Perez <fperez@colorado.edu>
2954 2004-07-26 Fernando Perez <fperez@colorado.edu>
2946
2955
2947 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2956 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2948
2957
2949 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2958 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2950 escaping '()[]{}' in filenames.
2959 escaping '()[]{}' in filenames.
2951
2960
2952 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2961 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2953 Python 2.2 users who lack a proper shlex.split.
2962 Python 2.2 users who lack a proper shlex.split.
2954
2963
2955 2004-07-19 Fernando Perez <fperez@colorado.edu>
2964 2004-07-19 Fernando Perez <fperez@colorado.edu>
2956
2965
2957 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2966 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2958 for reading readline's init file. I follow the normal chain:
2967 for reading readline's init file. I follow the normal chain:
2959 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2968 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2960 report by Mike Heeter. This closes
2969 report by Mike Heeter. This closes
2961 http://www.scipy.net/roundup/ipython/issue16.
2970 http://www.scipy.net/roundup/ipython/issue16.
2962
2971
2963 2004-07-18 Fernando Perez <fperez@colorado.edu>
2972 2004-07-18 Fernando Perez <fperez@colorado.edu>
2964
2973
2965 * IPython/iplib.py (__init__): Add better handling of '\' under
2974 * IPython/iplib.py (__init__): Add better handling of '\' under
2966 Win32 for filenames. After a patch by Ville.
2975 Win32 for filenames. After a patch by Ville.
2967
2976
2968 2004-07-17 Fernando Perez <fperez@colorado.edu>
2977 2004-07-17 Fernando Perez <fperez@colorado.edu>
2969
2978
2970 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2979 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2971 autocalling would be triggered for 'foo is bar' if foo is
2980 autocalling would be triggered for 'foo is bar' if foo is
2972 callable. I also cleaned up the autocall detection code to use a
2981 callable. I also cleaned up the autocall detection code to use a
2973 regexp, which is faster. Bug reported by Alexander Schmolck.
2982 regexp, which is faster. Bug reported by Alexander Schmolck.
2974
2983
2975 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2984 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2976 '?' in them would confuse the help system. Reported by Alex
2985 '?' in them would confuse the help system. Reported by Alex
2977 Schmolck.
2986 Schmolck.
2978
2987
2979 2004-07-16 Fernando Perez <fperez@colorado.edu>
2988 2004-07-16 Fernando Perez <fperez@colorado.edu>
2980
2989
2981 * IPython/GnuplotInteractive.py (__all__): added plot2.
2990 * IPython/GnuplotInteractive.py (__all__): added plot2.
2982
2991
2983 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2992 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2984 plotting dictionaries, lists or tuples of 1d arrays.
2993 plotting dictionaries, lists or tuples of 1d arrays.
2985
2994
2986 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2995 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2987 optimizations.
2996 optimizations.
2988
2997
2989 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2998 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2990 the information which was there from Janko's original IPP code:
2999 the information which was there from Janko's original IPP code:
2991
3000
2992 03.05.99 20:53 porto.ifm.uni-kiel.de
3001 03.05.99 20:53 porto.ifm.uni-kiel.de
2993 --Started changelog.
3002 --Started changelog.
2994 --make clear do what it say it does
3003 --make clear do what it say it does
2995 --added pretty output of lines from inputcache
3004 --added pretty output of lines from inputcache
2996 --Made Logger a mixin class, simplifies handling of switches
3005 --Made Logger a mixin class, simplifies handling of switches
2997 --Added own completer class. .string<TAB> expands to last history
3006 --Added own completer class. .string<TAB> expands to last history
2998 line which starts with string. The new expansion is also present
3007 line which starts with string. The new expansion is also present
2999 with Ctrl-r from the readline library. But this shows, who this
3008 with Ctrl-r from the readline library. But this shows, who this
3000 can be done for other cases.
3009 can be done for other cases.
3001 --Added convention that all shell functions should accept a
3010 --Added convention that all shell functions should accept a
3002 parameter_string This opens the door for different behaviour for
3011 parameter_string This opens the door for different behaviour for
3003 each function. @cd is a good example of this.
3012 each function. @cd is a good example of this.
3004
3013
3005 04.05.99 12:12 porto.ifm.uni-kiel.de
3014 04.05.99 12:12 porto.ifm.uni-kiel.de
3006 --added logfile rotation
3015 --added logfile rotation
3007 --added new mainloop method which freezes first the namespace
3016 --added new mainloop method which freezes first the namespace
3008
3017
3009 07.05.99 21:24 porto.ifm.uni-kiel.de
3018 07.05.99 21:24 porto.ifm.uni-kiel.de
3010 --added the docreader classes. Now there is a help system.
3019 --added the docreader classes. Now there is a help system.
3011 -This is only a first try. Currently it's not easy to put new
3020 -This is only a first try. Currently it's not easy to put new
3012 stuff in the indices. But this is the way to go. Info would be
3021 stuff in the indices. But this is the way to go. Info would be
3013 better, but HTML is every where and not everybody has an info
3022 better, but HTML is every where and not everybody has an info
3014 system installed and it's not so easy to change html-docs to info.
3023 system installed and it's not so easy to change html-docs to info.
3015 --added global logfile option
3024 --added global logfile option
3016 --there is now a hook for object inspection method pinfo needs to
3025 --there is now a hook for object inspection method pinfo needs to
3017 be provided for this. Can be reached by two '??'.
3026 be provided for this. Can be reached by two '??'.
3018
3027
3019 08.05.99 20:51 porto.ifm.uni-kiel.de
3028 08.05.99 20:51 porto.ifm.uni-kiel.de
3020 --added a README
3029 --added a README
3021 --bug in rc file. Something has changed so functions in the rc
3030 --bug in rc file. Something has changed so functions in the rc
3022 file need to reference the shell and not self. Not clear if it's a
3031 file need to reference the shell and not self. Not clear if it's a
3023 bug or feature.
3032 bug or feature.
3024 --changed rc file for new behavior
3033 --changed rc file for new behavior
3025
3034
3026 2004-07-15 Fernando Perez <fperez@colorado.edu>
3035 2004-07-15 Fernando Perez <fperez@colorado.edu>
3027
3036
3028 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3037 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3029 cache was falling out of sync in bizarre manners when multi-line
3038 cache was falling out of sync in bizarre manners when multi-line
3030 input was present. Minor optimizations and cleanup.
3039 input was present. Minor optimizations and cleanup.
3031
3040
3032 (Logger): Remove old Changelog info for cleanup. This is the
3041 (Logger): Remove old Changelog info for cleanup. This is the
3033 information which was there from Janko's original code:
3042 information which was there from Janko's original code:
3034
3043
3035 Changes to Logger: - made the default log filename a parameter
3044 Changes to Logger: - made the default log filename a parameter
3036
3045
3037 - put a check for lines beginning with !@? in log(). Needed
3046 - put a check for lines beginning with !@? in log(). Needed
3038 (even if the handlers properly log their lines) for mid-session
3047 (even if the handlers properly log their lines) for mid-session
3039 logging activation to work properly. Without this, lines logged
3048 logging activation to work properly. Without this, lines logged
3040 in mid session, which get read from the cache, would end up
3049 in mid session, which get read from the cache, would end up
3041 'bare' (with !@? in the open) in the log. Now they are caught
3050 'bare' (with !@? in the open) in the log. Now they are caught
3042 and prepended with a #.
3051 and prepended with a #.
3043
3052
3044 * IPython/iplib.py (InteractiveShell.init_readline): added check
3053 * IPython/iplib.py (InteractiveShell.init_readline): added check
3045 in case MagicCompleter fails to be defined, so we don't crash.
3054 in case MagicCompleter fails to be defined, so we don't crash.
3046
3055
3047 2004-07-13 Fernando Perez <fperez@colorado.edu>
3056 2004-07-13 Fernando Perez <fperez@colorado.edu>
3048
3057
3049 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3058 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3050 of EPS if the requested filename ends in '.eps'.
3059 of EPS if the requested filename ends in '.eps'.
3051
3060
3052 2004-07-04 Fernando Perez <fperez@colorado.edu>
3061 2004-07-04 Fernando Perez <fperez@colorado.edu>
3053
3062
3054 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3063 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3055 escaping of quotes when calling the shell.
3064 escaping of quotes when calling the shell.
3056
3065
3057 2004-07-02 Fernando Perez <fperez@colorado.edu>
3066 2004-07-02 Fernando Perez <fperez@colorado.edu>
3058
3067
3059 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3068 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3060 gettext not working because we were clobbering '_'. Fixes
3069 gettext not working because we were clobbering '_'. Fixes
3061 http://www.scipy.net/roundup/ipython/issue6.
3070 http://www.scipy.net/roundup/ipython/issue6.
3062
3071
3063 2004-07-01 Fernando Perez <fperez@colorado.edu>
3072 2004-07-01 Fernando Perez <fperez@colorado.edu>
3064
3073
3065 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3074 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3066 into @cd. Patch by Ville.
3075 into @cd. Patch by Ville.
3067
3076
3068 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3077 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3069 new function to store things after ipmaker runs. Patch by Ville.
3078 new function to store things after ipmaker runs. Patch by Ville.
3070 Eventually this will go away once ipmaker is removed and the class
3079 Eventually this will go away once ipmaker is removed and the class
3071 gets cleaned up, but for now it's ok. Key functionality here is
3080 gets cleaned up, but for now it's ok. Key functionality here is
3072 the addition of the persistent storage mechanism, a dict for
3081 the addition of the persistent storage mechanism, a dict for
3073 keeping data across sessions (for now just bookmarks, but more can
3082 keeping data across sessions (for now just bookmarks, but more can
3074 be implemented later).
3083 be implemented later).
3075
3084
3076 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3085 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3077 persistent across sections. Patch by Ville, I modified it
3086 persistent across sections. Patch by Ville, I modified it
3078 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3087 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3079 added a '-l' option to list all bookmarks.
3088 added a '-l' option to list all bookmarks.
3080
3089
3081 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3090 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3082 center for cleanup. Registered with atexit.register(). I moved
3091 center for cleanup. Registered with atexit.register(). I moved
3083 here the old exit_cleanup(). After a patch by Ville.
3092 here the old exit_cleanup(). After a patch by Ville.
3084
3093
3085 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3094 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3086 characters in the hacked shlex_split for python 2.2.
3095 characters in the hacked shlex_split for python 2.2.
3087
3096
3088 * IPython/iplib.py (file_matches): more fixes to filenames with
3097 * IPython/iplib.py (file_matches): more fixes to filenames with
3089 whitespace in them. It's not perfect, but limitations in python's
3098 whitespace in them. It's not perfect, but limitations in python's
3090 readline make it impossible to go further.
3099 readline make it impossible to go further.
3091
3100
3092 2004-06-29 Fernando Perez <fperez@colorado.edu>
3101 2004-06-29 Fernando Perez <fperez@colorado.edu>
3093
3102
3094 * IPython/iplib.py (file_matches): escape whitespace correctly in
3103 * IPython/iplib.py (file_matches): escape whitespace correctly in
3095 filename completions. Bug reported by Ville.
3104 filename completions. Bug reported by Ville.
3096
3105
3097 2004-06-28 Fernando Perez <fperez@colorado.edu>
3106 2004-06-28 Fernando Perez <fperez@colorado.edu>
3098
3107
3099 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3108 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3100 the history file will be called 'history-PROFNAME' (or just
3109 the history file will be called 'history-PROFNAME' (or just
3101 'history' if no profile is loaded). I was getting annoyed at
3110 'history' if no profile is loaded). I was getting annoyed at
3102 getting my Numerical work history clobbered by pysh sessions.
3111 getting my Numerical work history clobbered by pysh sessions.
3103
3112
3104 * IPython/iplib.py (InteractiveShell.__init__): Internal
3113 * IPython/iplib.py (InteractiveShell.__init__): Internal
3105 getoutputerror() function so that we can honor the system_verbose
3114 getoutputerror() function so that we can honor the system_verbose
3106 flag for _all_ system calls. I also added escaping of #
3115 flag for _all_ system calls. I also added escaping of #
3107 characters here to avoid confusing Itpl.
3116 characters here to avoid confusing Itpl.
3108
3117
3109 * IPython/Magic.py (shlex_split): removed call to shell in
3118 * IPython/Magic.py (shlex_split): removed call to shell in
3110 parse_options and replaced it with shlex.split(). The annoying
3119 parse_options and replaced it with shlex.split(). The annoying
3111 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3120 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3112 to backport it from 2.3, with several frail hacks (the shlex
3121 to backport it from 2.3, with several frail hacks (the shlex
3113 module is rather limited in 2.2). Thanks to a suggestion by Ville
3122 module is rather limited in 2.2). Thanks to a suggestion by Ville
3114 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3123 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3115 problem.
3124 problem.
3116
3125
3117 (Magic.magic_system_verbose): new toggle to print the actual
3126 (Magic.magic_system_verbose): new toggle to print the actual
3118 system calls made by ipython. Mainly for debugging purposes.
3127 system calls made by ipython. Mainly for debugging purposes.
3119
3128
3120 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3129 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3121 doesn't support persistence. Reported (and fix suggested) by
3130 doesn't support persistence. Reported (and fix suggested) by
3122 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3131 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3123
3132
3124 2004-06-26 Fernando Perez <fperez@colorado.edu>
3133 2004-06-26 Fernando Perez <fperez@colorado.edu>
3125
3134
3126 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3135 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3127 continue prompts.
3136 continue prompts.
3128
3137
3129 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3138 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3130 function (basically a big docstring) and a few more things here to
3139 function (basically a big docstring) and a few more things here to
3131 speedup startup. pysh.py is now very lightweight. We want because
3140 speedup startup. pysh.py is now very lightweight. We want because
3132 it gets execfile'd, while InterpreterExec gets imported, so
3141 it gets execfile'd, while InterpreterExec gets imported, so
3133 byte-compilation saves time.
3142 byte-compilation saves time.
3134
3143
3135 2004-06-25 Fernando Perez <fperez@colorado.edu>
3144 2004-06-25 Fernando Perez <fperez@colorado.edu>
3136
3145
3137 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3146 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3138 -NUM', which was recently broken.
3147 -NUM', which was recently broken.
3139
3148
3140 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3149 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3141 in multi-line input (but not !!, which doesn't make sense there).
3150 in multi-line input (but not !!, which doesn't make sense there).
3142
3151
3143 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3152 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3144 It's just too useful, and people can turn it off in the less
3153 It's just too useful, and people can turn it off in the less
3145 common cases where it's a problem.
3154 common cases where it's a problem.
3146
3155
3147 2004-06-24 Fernando Perez <fperez@colorado.edu>
3156 2004-06-24 Fernando Perez <fperez@colorado.edu>
3148
3157
3149 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3158 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3150 special syntaxes (like alias calling) is now allied in multi-line
3159 special syntaxes (like alias calling) is now allied in multi-line
3151 input. This is still _very_ experimental, but it's necessary for
3160 input. This is still _very_ experimental, but it's necessary for
3152 efficient shell usage combining python looping syntax with system
3161 efficient shell usage combining python looping syntax with system
3153 calls. For now it's restricted to aliases, I don't think it
3162 calls. For now it's restricted to aliases, I don't think it
3154 really even makes sense to have this for magics.
3163 really even makes sense to have this for magics.
3155
3164
3156 2004-06-23 Fernando Perez <fperez@colorado.edu>
3165 2004-06-23 Fernando Perez <fperez@colorado.edu>
3157
3166
3158 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3167 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3159 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3168 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3160
3169
3161 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3170 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3162 extensions under Windows (after code sent by Gary Bishop). The
3171 extensions under Windows (after code sent by Gary Bishop). The
3163 extensions considered 'executable' are stored in IPython's rc
3172 extensions considered 'executable' are stored in IPython's rc
3164 structure as win_exec_ext.
3173 structure as win_exec_ext.
3165
3174
3166 * IPython/genutils.py (shell): new function, like system() but
3175 * IPython/genutils.py (shell): new function, like system() but
3167 without return value. Very useful for interactive shell work.
3176 without return value. Very useful for interactive shell work.
3168
3177
3169 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3178 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3170 delete aliases.
3179 delete aliases.
3171
3180
3172 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3181 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3173 sure that the alias table doesn't contain python keywords.
3182 sure that the alias table doesn't contain python keywords.
3174
3183
3175 2004-06-21 Fernando Perez <fperez@colorado.edu>
3184 2004-06-21 Fernando Perez <fperez@colorado.edu>
3176
3185
3177 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3186 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3178 non-existent items are found in $PATH. Reported by Thorsten.
3187 non-existent items are found in $PATH. Reported by Thorsten.
3179
3188
3180 2004-06-20 Fernando Perez <fperez@colorado.edu>
3189 2004-06-20 Fernando Perez <fperez@colorado.edu>
3181
3190
3182 * IPython/iplib.py (complete): modified the completer so that the
3191 * IPython/iplib.py (complete): modified the completer so that the
3183 order of priorities can be easily changed at runtime.
3192 order of priorities can be easily changed at runtime.
3184
3193
3185 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3194 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3186 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3195 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3187
3196
3188 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3197 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3189 expand Python variables prepended with $ in all system calls. The
3198 expand Python variables prepended with $ in all system calls. The
3190 same was done to InteractiveShell.handle_shell_escape. Now all
3199 same was done to InteractiveShell.handle_shell_escape. Now all
3191 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3200 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3192 expansion of python variables and expressions according to the
3201 expansion of python variables and expressions according to the
3193 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3202 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3194
3203
3195 Though PEP-215 has been rejected, a similar (but simpler) one
3204 Though PEP-215 has been rejected, a similar (but simpler) one
3196 seems like it will go into Python 2.4, PEP-292 -
3205 seems like it will go into Python 2.4, PEP-292 -
3197 http://www.python.org/peps/pep-0292.html.
3206 http://www.python.org/peps/pep-0292.html.
3198
3207
3199 I'll keep the full syntax of PEP-215, since IPython has since the
3208 I'll keep the full syntax of PEP-215, since IPython has since the
3200 start used Ka-Ping Yee's reference implementation discussed there
3209 start used Ka-Ping Yee's reference implementation discussed there
3201 (Itpl), and I actually like the powerful semantics it offers.
3210 (Itpl), and I actually like the powerful semantics it offers.
3202
3211
3203 In order to access normal shell variables, the $ has to be escaped
3212 In order to access normal shell variables, the $ has to be escaped
3204 via an extra $. For example:
3213 via an extra $. For example:
3205
3214
3206 In [7]: PATH='a python variable'
3215 In [7]: PATH='a python variable'
3207
3216
3208 In [8]: !echo $PATH
3217 In [8]: !echo $PATH
3209 a python variable
3218 a python variable
3210
3219
3211 In [9]: !echo $$PATH
3220 In [9]: !echo $$PATH
3212 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3221 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3213
3222
3214 (Magic.parse_options): escape $ so the shell doesn't evaluate
3223 (Magic.parse_options): escape $ so the shell doesn't evaluate
3215 things prematurely.
3224 things prematurely.
3216
3225
3217 * IPython/iplib.py (InteractiveShell.call_alias): added the
3226 * IPython/iplib.py (InteractiveShell.call_alias): added the
3218 ability for aliases to expand python variables via $.
3227 ability for aliases to expand python variables via $.
3219
3228
3220 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3229 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3221 system, now there's a @rehash/@rehashx pair of magics. These work
3230 system, now there's a @rehash/@rehashx pair of magics. These work
3222 like the csh rehash command, and can be invoked at any time. They
3231 like the csh rehash command, and can be invoked at any time. They
3223 build a table of aliases to everything in the user's $PATH
3232 build a table of aliases to everything in the user's $PATH
3224 (@rehash uses everything, @rehashx is slower but only adds
3233 (@rehash uses everything, @rehashx is slower but only adds
3225 executable files). With this, the pysh.py-based shell profile can
3234 executable files). With this, the pysh.py-based shell profile can
3226 now simply call rehash upon startup, and full access to all
3235 now simply call rehash upon startup, and full access to all
3227 programs in the user's path is obtained.
3236 programs in the user's path is obtained.
3228
3237
3229 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3238 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3230 functionality is now fully in place. I removed the old dynamic
3239 functionality is now fully in place. I removed the old dynamic
3231 code generation based approach, in favor of a much lighter one
3240 code generation based approach, in favor of a much lighter one
3232 based on a simple dict. The advantage is that this allows me to
3241 based on a simple dict. The advantage is that this allows me to
3233 now have thousands of aliases with negligible cost (unthinkable
3242 now have thousands of aliases with negligible cost (unthinkable
3234 with the old system).
3243 with the old system).
3235
3244
3236 2004-06-19 Fernando Perez <fperez@colorado.edu>
3245 2004-06-19 Fernando Perez <fperez@colorado.edu>
3237
3246
3238 * IPython/iplib.py (__init__): extended MagicCompleter class to
3247 * IPython/iplib.py (__init__): extended MagicCompleter class to
3239 also complete (last in priority) on user aliases.
3248 also complete (last in priority) on user aliases.
3240
3249
3241 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3250 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3242 call to eval.
3251 call to eval.
3243 (ItplNS.__init__): Added a new class which functions like Itpl,
3252 (ItplNS.__init__): Added a new class which functions like Itpl,
3244 but allows configuring the namespace for the evaluation to occur
3253 but allows configuring the namespace for the evaluation to occur
3245 in.
3254 in.
3246
3255
3247 2004-06-18 Fernando Perez <fperez@colorado.edu>
3256 2004-06-18 Fernando Perez <fperez@colorado.edu>
3248
3257
3249 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3258 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3250 better message when 'exit' or 'quit' are typed (a common newbie
3259 better message when 'exit' or 'quit' are typed (a common newbie
3251 confusion).
3260 confusion).
3252
3261
3253 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3262 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3254 check for Windows users.
3263 check for Windows users.
3255
3264
3256 * IPython/iplib.py (InteractiveShell.user_setup): removed
3265 * IPython/iplib.py (InteractiveShell.user_setup): removed
3257 disabling of colors for Windows. I'll test at runtime and issue a
3266 disabling of colors for Windows. I'll test at runtime and issue a
3258 warning if Gary's readline isn't found, as to nudge users to
3267 warning if Gary's readline isn't found, as to nudge users to
3259 download it.
3268 download it.
3260
3269
3261 2004-06-16 Fernando Perez <fperez@colorado.edu>
3270 2004-06-16 Fernando Perez <fperez@colorado.edu>
3262
3271
3263 * IPython/genutils.py (Stream.__init__): changed to print errors
3272 * IPython/genutils.py (Stream.__init__): changed to print errors
3264 to sys.stderr. I had a circular dependency here. Now it's
3273 to sys.stderr. I had a circular dependency here. Now it's
3265 possible to run ipython as IDLE's shell (consider this pre-alpha,
3274 possible to run ipython as IDLE's shell (consider this pre-alpha,
3266 since true stdout things end up in the starting terminal instead
3275 since true stdout things end up in the starting terminal instead
3267 of IDLE's out).
3276 of IDLE's out).
3268
3277
3269 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3278 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3270 users who haven't # updated their prompt_in2 definitions. Remove
3279 users who haven't # updated their prompt_in2 definitions. Remove
3271 eventually.
3280 eventually.
3272 (multiple_replace): added credit to original ASPN recipe.
3281 (multiple_replace): added credit to original ASPN recipe.
3273
3282
3274 2004-06-15 Fernando Perez <fperez@colorado.edu>
3283 2004-06-15 Fernando Perez <fperez@colorado.edu>
3275
3284
3276 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3285 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3277 list of auto-defined aliases.
3286 list of auto-defined aliases.
3278
3287
3279 2004-06-13 Fernando Perez <fperez@colorado.edu>
3288 2004-06-13 Fernando Perez <fperez@colorado.edu>
3280
3289
3281 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3290 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3282 install was really requested (so setup.py can be used for other
3291 install was really requested (so setup.py can be used for other
3283 things under Windows).
3292 things under Windows).
3284
3293
3285 2004-06-10 Fernando Perez <fperez@colorado.edu>
3294 2004-06-10 Fernando Perez <fperez@colorado.edu>
3286
3295
3287 * IPython/Logger.py (Logger.create_log): Manually remove any old
3296 * IPython/Logger.py (Logger.create_log): Manually remove any old
3288 backup, since os.remove may fail under Windows. Fixes bug
3297 backup, since os.remove may fail under Windows. Fixes bug
3289 reported by Thorsten.
3298 reported by Thorsten.
3290
3299
3291 2004-06-09 Fernando Perez <fperez@colorado.edu>
3300 2004-06-09 Fernando Perez <fperez@colorado.edu>
3292
3301
3293 * examples/example-embed.py: fixed all references to %n (replaced
3302 * examples/example-embed.py: fixed all references to %n (replaced
3294 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3303 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3295 for all examples and the manual as well.
3304 for all examples and the manual as well.
3296
3305
3297 2004-06-08 Fernando Perez <fperez@colorado.edu>
3306 2004-06-08 Fernando Perez <fperez@colorado.edu>
3298
3307
3299 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3308 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3300 alignment and color management. All 3 prompt subsystems now
3309 alignment and color management. All 3 prompt subsystems now
3301 inherit from BasePrompt.
3310 inherit from BasePrompt.
3302
3311
3303 * tools/release: updates for windows installer build and tag rpms
3312 * tools/release: updates for windows installer build and tag rpms
3304 with python version (since paths are fixed).
3313 with python version (since paths are fixed).
3305
3314
3306 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3315 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3307 which will become eventually obsolete. Also fixed the default
3316 which will become eventually obsolete. Also fixed the default
3308 prompt_in2 to use \D, so at least new users start with the correct
3317 prompt_in2 to use \D, so at least new users start with the correct
3309 defaults.
3318 defaults.
3310 WARNING: Users with existing ipythonrc files will need to apply
3319 WARNING: Users with existing ipythonrc files will need to apply
3311 this fix manually!
3320 this fix manually!
3312
3321
3313 * setup.py: make windows installer (.exe). This is finally the
3322 * setup.py: make windows installer (.exe). This is finally the
3314 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3323 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3315 which I hadn't included because it required Python 2.3 (or recent
3324 which I hadn't included because it required Python 2.3 (or recent
3316 distutils).
3325 distutils).
3317
3326
3318 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3327 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3319 usage of new '\D' escape.
3328 usage of new '\D' escape.
3320
3329
3321 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3330 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3322 lacks os.getuid())
3331 lacks os.getuid())
3323 (CachedOutput.set_colors): Added the ability to turn coloring
3332 (CachedOutput.set_colors): Added the ability to turn coloring
3324 on/off with @colors even for manually defined prompt colors. It
3333 on/off with @colors even for manually defined prompt colors. It
3325 uses a nasty global, but it works safely and via the generic color
3334 uses a nasty global, but it works safely and via the generic color
3326 handling mechanism.
3335 handling mechanism.
3327 (Prompt2.__init__): Introduced new escape '\D' for continuation
3336 (Prompt2.__init__): Introduced new escape '\D' for continuation
3328 prompts. It represents the counter ('\#') as dots.
3337 prompts. It represents the counter ('\#') as dots.
3329 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3338 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3330 need to update their ipythonrc files and replace '%n' with '\D' in
3339 need to update their ipythonrc files and replace '%n' with '\D' in
3331 their prompt_in2 settings everywhere. Sorry, but there's
3340 their prompt_in2 settings everywhere. Sorry, but there's
3332 otherwise no clean way to get all prompts to properly align. The
3341 otherwise no clean way to get all prompts to properly align. The
3333 ipythonrc shipped with IPython has been updated.
3342 ipythonrc shipped with IPython has been updated.
3334
3343
3335 2004-06-07 Fernando Perez <fperez@colorado.edu>
3344 2004-06-07 Fernando Perez <fperez@colorado.edu>
3336
3345
3337 * setup.py (isfile): Pass local_icons option to latex2html, so the
3346 * setup.py (isfile): Pass local_icons option to latex2html, so the
3338 resulting HTML file is self-contained. Thanks to
3347 resulting HTML file is self-contained. Thanks to
3339 dryice-AT-liu.com.cn for the tip.
3348 dryice-AT-liu.com.cn for the tip.
3340
3349
3341 * pysh.py: I created a new profile 'shell', which implements a
3350 * pysh.py: I created a new profile 'shell', which implements a
3342 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3351 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3343 system shell, nor will it become one anytime soon. It's mainly
3352 system shell, nor will it become one anytime soon. It's mainly
3344 meant to illustrate the use of the new flexible bash-like prompts.
3353 meant to illustrate the use of the new flexible bash-like prompts.
3345 I guess it could be used by hardy souls for true shell management,
3354 I guess it could be used by hardy souls for true shell management,
3346 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3355 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3347 profile. This uses the InterpreterExec extension provided by
3356 profile. This uses the InterpreterExec extension provided by
3348 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3357 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3349
3358
3350 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3359 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3351 auto-align itself with the length of the previous input prompt
3360 auto-align itself with the length of the previous input prompt
3352 (taking into account the invisible color escapes).
3361 (taking into account the invisible color escapes).
3353 (CachedOutput.__init__): Large restructuring of this class. Now
3362 (CachedOutput.__init__): Large restructuring of this class. Now
3354 all three prompts (primary1, primary2, output) are proper objects,
3363 all three prompts (primary1, primary2, output) are proper objects,
3355 managed by the 'parent' CachedOutput class. The code is still a
3364 managed by the 'parent' CachedOutput class. The code is still a
3356 bit hackish (all prompts share state via a pointer to the cache),
3365 bit hackish (all prompts share state via a pointer to the cache),
3357 but it's overall far cleaner than before.
3366 but it's overall far cleaner than before.
3358
3367
3359 * IPython/genutils.py (getoutputerror): modified to add verbose,
3368 * IPython/genutils.py (getoutputerror): modified to add verbose,
3360 debug and header options. This makes the interface of all getout*
3369 debug and header options. This makes the interface of all getout*
3361 functions uniform.
3370 functions uniform.
3362 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3371 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3363
3372
3364 * IPython/Magic.py (Magic.default_option): added a function to
3373 * IPython/Magic.py (Magic.default_option): added a function to
3365 allow registering default options for any magic command. This
3374 allow registering default options for any magic command. This
3366 makes it easy to have profiles which customize the magics globally
3375 makes it easy to have profiles which customize the magics globally
3367 for a certain use. The values set through this function are
3376 for a certain use. The values set through this function are
3368 picked up by the parse_options() method, which all magics should
3377 picked up by the parse_options() method, which all magics should
3369 use to parse their options.
3378 use to parse their options.
3370
3379
3371 * IPython/genutils.py (warn): modified the warnings framework to
3380 * IPython/genutils.py (warn): modified the warnings framework to
3372 use the Term I/O class. I'm trying to slowly unify all of
3381 use the Term I/O class. I'm trying to slowly unify all of
3373 IPython's I/O operations to pass through Term.
3382 IPython's I/O operations to pass through Term.
3374
3383
3375 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3384 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3376 the secondary prompt to correctly match the length of the primary
3385 the secondary prompt to correctly match the length of the primary
3377 one for any prompt. Now multi-line code will properly line up
3386 one for any prompt. Now multi-line code will properly line up
3378 even for path dependent prompts, such as the new ones available
3387 even for path dependent prompts, such as the new ones available
3379 via the prompt_specials.
3388 via the prompt_specials.
3380
3389
3381 2004-06-06 Fernando Perez <fperez@colorado.edu>
3390 2004-06-06 Fernando Perez <fperez@colorado.edu>
3382
3391
3383 * IPython/Prompts.py (prompt_specials): Added the ability to have
3392 * IPython/Prompts.py (prompt_specials): Added the ability to have
3384 bash-like special sequences in the prompts, which get
3393 bash-like special sequences in the prompts, which get
3385 automatically expanded. Things like hostname, current working
3394 automatically expanded. Things like hostname, current working
3386 directory and username are implemented already, but it's easy to
3395 directory and username are implemented already, but it's easy to
3387 add more in the future. Thanks to a patch by W.J. van der Laan
3396 add more in the future. Thanks to a patch by W.J. van der Laan
3388 <gnufnork-AT-hetdigitalegat.nl>
3397 <gnufnork-AT-hetdigitalegat.nl>
3389 (prompt_specials): Added color support for prompt strings, so
3398 (prompt_specials): Added color support for prompt strings, so
3390 users can define arbitrary color setups for their prompts.
3399 users can define arbitrary color setups for their prompts.
3391
3400
3392 2004-06-05 Fernando Perez <fperez@colorado.edu>
3401 2004-06-05 Fernando Perez <fperez@colorado.edu>
3393
3402
3394 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3403 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3395 code to load Gary Bishop's readline and configure it
3404 code to load Gary Bishop's readline and configure it
3396 automatically. Thanks to Gary for help on this.
3405 automatically. Thanks to Gary for help on this.
3397
3406
3398 2004-06-01 Fernando Perez <fperez@colorado.edu>
3407 2004-06-01 Fernando Perez <fperez@colorado.edu>
3399
3408
3400 * IPython/Logger.py (Logger.create_log): fix bug for logging
3409 * IPython/Logger.py (Logger.create_log): fix bug for logging
3401 with no filename (previous fix was incomplete).
3410 with no filename (previous fix was incomplete).
3402
3411
3403 2004-05-25 Fernando Perez <fperez@colorado.edu>
3412 2004-05-25 Fernando Perez <fperez@colorado.edu>
3404
3413
3405 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3414 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3406 parens would get passed to the shell.
3415 parens would get passed to the shell.
3407
3416
3408 2004-05-20 Fernando Perez <fperez@colorado.edu>
3417 2004-05-20 Fernando Perez <fperez@colorado.edu>
3409
3418
3410 * IPython/Magic.py (Magic.magic_prun): changed default profile
3419 * IPython/Magic.py (Magic.magic_prun): changed default profile
3411 sort order to 'time' (the more common profiling need).
3420 sort order to 'time' (the more common profiling need).
3412
3421
3413 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3422 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3414 so that source code shown is guaranteed in sync with the file on
3423 so that source code shown is guaranteed in sync with the file on
3415 disk (also changed in psource). Similar fix to the one for
3424 disk (also changed in psource). Similar fix to the one for
3416 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3425 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3417 <yann.ledu-AT-noos.fr>.
3426 <yann.ledu-AT-noos.fr>.
3418
3427
3419 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3428 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3420 with a single option would not be correctly parsed. Closes
3429 with a single option would not be correctly parsed. Closes
3421 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3430 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3422 introduced in 0.6.0 (on 2004-05-06).
3431 introduced in 0.6.0 (on 2004-05-06).
3423
3432
3424 2004-05-13 *** Released version 0.6.0
3433 2004-05-13 *** Released version 0.6.0
3425
3434
3426 2004-05-13 Fernando Perez <fperez@colorado.edu>
3435 2004-05-13 Fernando Perez <fperez@colorado.edu>
3427
3436
3428 * debian/: Added debian/ directory to CVS, so that debian support
3437 * debian/: Added debian/ directory to CVS, so that debian support
3429 is publicly accessible. The debian package is maintained by Jack
3438 is publicly accessible. The debian package is maintained by Jack
3430 Moffit <jack-AT-xiph.org>.
3439 Moffit <jack-AT-xiph.org>.
3431
3440
3432 * Documentation: included the notes about an ipython-based system
3441 * Documentation: included the notes about an ipython-based system
3433 shell (the hypothetical 'pysh') into the new_design.pdf document,
3442 shell (the hypothetical 'pysh') into the new_design.pdf document,
3434 so that these ideas get distributed to users along with the
3443 so that these ideas get distributed to users along with the
3435 official documentation.
3444 official documentation.
3436
3445
3437 2004-05-10 Fernando Perez <fperez@colorado.edu>
3446 2004-05-10 Fernando Perez <fperez@colorado.edu>
3438
3447
3439 * IPython/Logger.py (Logger.create_log): fix recently introduced
3448 * IPython/Logger.py (Logger.create_log): fix recently introduced
3440 bug (misindented line) where logstart would fail when not given an
3449 bug (misindented line) where logstart would fail when not given an
3441 explicit filename.
3450 explicit filename.
3442
3451
3443 2004-05-09 Fernando Perez <fperez@colorado.edu>
3452 2004-05-09 Fernando Perez <fperez@colorado.edu>
3444
3453
3445 * IPython/Magic.py (Magic.parse_options): skip system call when
3454 * IPython/Magic.py (Magic.parse_options): skip system call when
3446 there are no options to look for. Faster, cleaner for the common
3455 there are no options to look for. Faster, cleaner for the common
3447 case.
3456 case.
3448
3457
3449 * Documentation: many updates to the manual: describing Windows
3458 * Documentation: many updates to the manual: describing Windows
3450 support better, Gnuplot updates, credits, misc small stuff. Also
3459 support better, Gnuplot updates, credits, misc small stuff. Also
3451 updated the new_design doc a bit.
3460 updated the new_design doc a bit.
3452
3461
3453 2004-05-06 *** Released version 0.6.0.rc1
3462 2004-05-06 *** Released version 0.6.0.rc1
3454
3463
3455 2004-05-06 Fernando Perez <fperez@colorado.edu>
3464 2004-05-06 Fernando Perez <fperez@colorado.edu>
3456
3465
3457 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3466 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3458 operations to use the vastly more efficient list/''.join() method.
3467 operations to use the vastly more efficient list/''.join() method.
3459 (FormattedTB.text): Fix
3468 (FormattedTB.text): Fix
3460 http://www.scipy.net/roundup/ipython/issue12 - exception source
3469 http://www.scipy.net/roundup/ipython/issue12 - exception source
3461 extract not updated after reload. Thanks to Mike Salib
3470 extract not updated after reload. Thanks to Mike Salib
3462 <msalib-AT-mit.edu> for pinning the source of the problem.
3471 <msalib-AT-mit.edu> for pinning the source of the problem.
3463 Fortunately, the solution works inside ipython and doesn't require
3472 Fortunately, the solution works inside ipython and doesn't require
3464 any changes to python proper.
3473 any changes to python proper.
3465
3474
3466 * IPython/Magic.py (Magic.parse_options): Improved to process the
3475 * IPython/Magic.py (Magic.parse_options): Improved to process the
3467 argument list as a true shell would (by actually using the
3476 argument list as a true shell would (by actually using the
3468 underlying system shell). This way, all @magics automatically get
3477 underlying system shell). This way, all @magics automatically get
3469 shell expansion for variables. Thanks to a comment by Alex
3478 shell expansion for variables. Thanks to a comment by Alex
3470 Schmolck.
3479 Schmolck.
3471
3480
3472 2004-04-04 Fernando Perez <fperez@colorado.edu>
3481 2004-04-04 Fernando Perez <fperez@colorado.edu>
3473
3482
3474 * IPython/iplib.py (InteractiveShell.interact): Added a special
3483 * IPython/iplib.py (InteractiveShell.interact): Added a special
3475 trap for a debugger quit exception, which is basically impossible
3484 trap for a debugger quit exception, which is basically impossible
3476 to handle by normal mechanisms, given what pdb does to the stack.
3485 to handle by normal mechanisms, given what pdb does to the stack.
3477 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3486 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3478
3487
3479 2004-04-03 Fernando Perez <fperez@colorado.edu>
3488 2004-04-03 Fernando Perez <fperez@colorado.edu>
3480
3489
3481 * IPython/genutils.py (Term): Standardized the names of the Term
3490 * IPython/genutils.py (Term): Standardized the names of the Term
3482 class streams to cin/cout/cerr, following C++ naming conventions
3491 class streams to cin/cout/cerr, following C++ naming conventions
3483 (I can't use in/out/err because 'in' is not a valid attribute
3492 (I can't use in/out/err because 'in' is not a valid attribute
3484 name).
3493 name).
3485
3494
3486 * IPython/iplib.py (InteractiveShell.interact): don't increment
3495 * IPython/iplib.py (InteractiveShell.interact): don't increment
3487 the prompt if there's no user input. By Daniel 'Dang' Griffith
3496 the prompt if there's no user input. By Daniel 'Dang' Griffith
3488 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3497 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3489 Francois Pinard.
3498 Francois Pinard.
3490
3499
3491 2004-04-02 Fernando Perez <fperez@colorado.edu>
3500 2004-04-02 Fernando Perez <fperez@colorado.edu>
3492
3501
3493 * IPython/genutils.py (Stream.__init__): Modified to survive at
3502 * IPython/genutils.py (Stream.__init__): Modified to survive at
3494 least importing in contexts where stdin/out/err aren't true file
3503 least importing in contexts where stdin/out/err aren't true file
3495 objects, such as PyCrust (they lack fileno() and mode). However,
3504 objects, such as PyCrust (they lack fileno() and mode). However,
3496 the recovery facilities which rely on these things existing will
3505 the recovery facilities which rely on these things existing will
3497 not work.
3506 not work.
3498
3507
3499 2004-04-01 Fernando Perez <fperez@colorado.edu>
3508 2004-04-01 Fernando Perez <fperez@colorado.edu>
3500
3509
3501 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3510 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3502 use the new getoutputerror() function, so it properly
3511 use the new getoutputerror() function, so it properly
3503 distinguishes stdout/err.
3512 distinguishes stdout/err.
3504
3513
3505 * IPython/genutils.py (getoutputerror): added a function to
3514 * IPython/genutils.py (getoutputerror): added a function to
3506 capture separately the standard output and error of a command.
3515 capture separately the standard output and error of a command.
3507 After a comment from dang on the mailing lists. This code is
3516 After a comment from dang on the mailing lists. This code is
3508 basically a modified version of commands.getstatusoutput(), from
3517 basically a modified version of commands.getstatusoutput(), from
3509 the standard library.
3518 the standard library.
3510
3519
3511 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3520 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3512 '!!' as a special syntax (shorthand) to access @sx.
3521 '!!' as a special syntax (shorthand) to access @sx.
3513
3522
3514 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3523 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3515 command and return its output as a list split on '\n'.
3524 command and return its output as a list split on '\n'.
3516
3525
3517 2004-03-31 Fernando Perez <fperez@colorado.edu>
3526 2004-03-31 Fernando Perez <fperez@colorado.edu>
3518
3527
3519 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3528 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3520 method to dictionaries used as FakeModule instances if they lack
3529 method to dictionaries used as FakeModule instances if they lack
3521 it. At least pydoc in python2.3 breaks for runtime-defined
3530 it. At least pydoc in python2.3 breaks for runtime-defined
3522 functions without this hack. At some point I need to _really_
3531 functions without this hack. At some point I need to _really_
3523 understand what FakeModule is doing, because it's a gross hack.
3532 understand what FakeModule is doing, because it's a gross hack.
3524 But it solves Arnd's problem for now...
3533 But it solves Arnd's problem for now...
3525
3534
3526 2004-02-27 Fernando Perez <fperez@colorado.edu>
3535 2004-02-27 Fernando Perez <fperez@colorado.edu>
3527
3536
3528 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3537 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3529 mode would behave erratically. Also increased the number of
3538 mode would behave erratically. Also increased the number of
3530 possible logs in rotate mod to 999. Thanks to Rod Holland
3539 possible logs in rotate mod to 999. Thanks to Rod Holland
3531 <rhh@StructureLABS.com> for the report and fixes.
3540 <rhh@StructureLABS.com> for the report and fixes.
3532
3541
3533 2004-02-26 Fernando Perez <fperez@colorado.edu>
3542 2004-02-26 Fernando Perez <fperez@colorado.edu>
3534
3543
3535 * IPython/genutils.py (page): Check that the curses module really
3544 * IPython/genutils.py (page): Check that the curses module really
3536 has the initscr attribute before trying to use it. For some
3545 has the initscr attribute before trying to use it. For some
3537 reason, the Solaris curses module is missing this. I think this
3546 reason, the Solaris curses module is missing this. I think this
3538 should be considered a Solaris python bug, but I'm not sure.
3547 should be considered a Solaris python bug, but I'm not sure.
3539
3548
3540 2004-01-17 Fernando Perez <fperez@colorado.edu>
3549 2004-01-17 Fernando Perez <fperez@colorado.edu>
3541
3550
3542 * IPython/genutils.py (Stream.__init__): Changes to try to make
3551 * IPython/genutils.py (Stream.__init__): Changes to try to make
3543 ipython robust against stdin/out/err being closed by the user.
3552 ipython robust against stdin/out/err being closed by the user.
3544 This is 'user error' (and blocks a normal python session, at least
3553 This is 'user error' (and blocks a normal python session, at least
3545 the stdout case). However, Ipython should be able to survive such
3554 the stdout case). However, Ipython should be able to survive such
3546 instances of abuse as gracefully as possible. To simplify the
3555 instances of abuse as gracefully as possible. To simplify the
3547 coding and maintain compatibility with Gary Bishop's Term
3556 coding and maintain compatibility with Gary Bishop's Term
3548 contributions, I've made use of classmethods for this. I think
3557 contributions, I've made use of classmethods for this. I think
3549 this introduces a dependency on python 2.2.
3558 this introduces a dependency on python 2.2.
3550
3559
3551 2004-01-13 Fernando Perez <fperez@colorado.edu>
3560 2004-01-13 Fernando Perez <fperez@colorado.edu>
3552
3561
3553 * IPython/numutils.py (exp_safe): simplified the code a bit and
3562 * IPython/numutils.py (exp_safe): simplified the code a bit and
3554 removed the need for importing the kinds module altogether.
3563 removed the need for importing the kinds module altogether.
3555
3564
3556 2004-01-06 Fernando Perez <fperez@colorado.edu>
3565 2004-01-06 Fernando Perez <fperez@colorado.edu>
3557
3566
3558 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3567 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3559 a magic function instead, after some community feedback. No
3568 a magic function instead, after some community feedback. No
3560 special syntax will exist for it, but its name is deliberately
3569 special syntax will exist for it, but its name is deliberately
3561 very short.
3570 very short.
3562
3571
3563 2003-12-20 Fernando Perez <fperez@colorado.edu>
3572 2003-12-20 Fernando Perez <fperez@colorado.edu>
3564
3573
3565 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3574 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3566 new functionality, to automagically assign the result of a shell
3575 new functionality, to automagically assign the result of a shell
3567 command to a variable. I'll solicit some community feedback on
3576 command to a variable. I'll solicit some community feedback on
3568 this before making it permanent.
3577 this before making it permanent.
3569
3578
3570 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3579 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3571 requested about callables for which inspect couldn't obtain a
3580 requested about callables for which inspect couldn't obtain a
3572 proper argspec. Thanks to a crash report sent by Etienne
3581 proper argspec. Thanks to a crash report sent by Etienne
3573 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3582 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3574
3583
3575 2003-12-09 Fernando Perez <fperez@colorado.edu>
3584 2003-12-09 Fernando Perez <fperez@colorado.edu>
3576
3585
3577 * IPython/genutils.py (page): patch for the pager to work across
3586 * IPython/genutils.py (page): patch for the pager to work across
3578 various versions of Windows. By Gary Bishop.
3587 various versions of Windows. By Gary Bishop.
3579
3588
3580 2003-12-04 Fernando Perez <fperez@colorado.edu>
3589 2003-12-04 Fernando Perez <fperez@colorado.edu>
3581
3590
3582 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3591 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3583 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3592 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3584 While I tested this and it looks ok, there may still be corner
3593 While I tested this and it looks ok, there may still be corner
3585 cases I've missed.
3594 cases I've missed.
3586
3595
3587 2003-12-01 Fernando Perez <fperez@colorado.edu>
3596 2003-12-01 Fernando Perez <fperez@colorado.edu>
3588
3597
3589 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3598 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3590 where a line like 'p,q=1,2' would fail because the automagic
3599 where a line like 'p,q=1,2' would fail because the automagic
3591 system would be triggered for @p.
3600 system would be triggered for @p.
3592
3601
3593 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3602 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3594 cleanups, code unmodified.
3603 cleanups, code unmodified.
3595
3604
3596 * IPython/genutils.py (Term): added a class for IPython to handle
3605 * IPython/genutils.py (Term): added a class for IPython to handle
3597 output. In most cases it will just be a proxy for stdout/err, but
3606 output. In most cases it will just be a proxy for stdout/err, but
3598 having this allows modifications to be made for some platforms,
3607 having this allows modifications to be made for some platforms,
3599 such as handling color escapes under Windows. All of this code
3608 such as handling color escapes under Windows. All of this code
3600 was contributed by Gary Bishop, with minor modifications by me.
3609 was contributed by Gary Bishop, with minor modifications by me.
3601 The actual changes affect many files.
3610 The actual changes affect many files.
3602
3611
3603 2003-11-30 Fernando Perez <fperez@colorado.edu>
3612 2003-11-30 Fernando Perez <fperez@colorado.edu>
3604
3613
3605 * IPython/iplib.py (file_matches): new completion code, courtesy
3614 * IPython/iplib.py (file_matches): new completion code, courtesy
3606 of Jeff Collins. This enables filename completion again under
3615 of Jeff Collins. This enables filename completion again under
3607 python 2.3, which disabled it at the C level.
3616 python 2.3, which disabled it at the C level.
3608
3617
3609 2003-11-11 Fernando Perez <fperez@colorado.edu>
3618 2003-11-11 Fernando Perez <fperez@colorado.edu>
3610
3619
3611 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3620 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3612 for Numeric.array(map(...)), but often convenient.
3621 for Numeric.array(map(...)), but often convenient.
3613
3622
3614 2003-11-05 Fernando Perez <fperez@colorado.edu>
3623 2003-11-05 Fernando Perez <fperez@colorado.edu>
3615
3624
3616 * IPython/numutils.py (frange): Changed a call from int() to
3625 * IPython/numutils.py (frange): Changed a call from int() to
3617 int(round()) to prevent a problem reported with arange() in the
3626 int(round()) to prevent a problem reported with arange() in the
3618 numpy list.
3627 numpy list.
3619
3628
3620 2003-10-06 Fernando Perez <fperez@colorado.edu>
3629 2003-10-06 Fernando Perez <fperez@colorado.edu>
3621
3630
3622 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3631 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3623 prevent crashes if sys lacks an argv attribute (it happens with
3632 prevent crashes if sys lacks an argv attribute (it happens with
3624 embedded interpreters which build a bare-bones sys module).
3633 embedded interpreters which build a bare-bones sys module).
3625 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3634 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3626
3635
3627 2003-09-24 Fernando Perez <fperez@colorado.edu>
3636 2003-09-24 Fernando Perez <fperez@colorado.edu>
3628
3637
3629 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3638 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3630 to protect against poorly written user objects where __getattr__
3639 to protect against poorly written user objects where __getattr__
3631 raises exceptions other than AttributeError. Thanks to a bug
3640 raises exceptions other than AttributeError. Thanks to a bug
3632 report by Oliver Sander <osander-AT-gmx.de>.
3641 report by Oliver Sander <osander-AT-gmx.de>.
3633
3642
3634 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3643 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3635 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3644 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3636
3645
3637 2003-09-09 Fernando Perez <fperez@colorado.edu>
3646 2003-09-09 Fernando Perez <fperez@colorado.edu>
3638
3647
3639 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3648 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3640 unpacking a list whith a callable as first element would
3649 unpacking a list whith a callable as first element would
3641 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3650 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3642 Collins.
3651 Collins.
3643
3652
3644 2003-08-25 *** Released version 0.5.0
3653 2003-08-25 *** Released version 0.5.0
3645
3654
3646 2003-08-22 Fernando Perez <fperez@colorado.edu>
3655 2003-08-22 Fernando Perez <fperez@colorado.edu>
3647
3656
3648 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3657 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3649 improperly defined user exceptions. Thanks to feedback from Mark
3658 improperly defined user exceptions. Thanks to feedback from Mark
3650 Russell <mrussell-AT-verio.net>.
3659 Russell <mrussell-AT-verio.net>.
3651
3660
3652 2003-08-20 Fernando Perez <fperez@colorado.edu>
3661 2003-08-20 Fernando Perez <fperez@colorado.edu>
3653
3662
3654 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3663 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3655 printing so that it would print multi-line string forms starting
3664 printing so that it would print multi-line string forms starting
3656 with a new line. This way the formatting is better respected for
3665 with a new line. This way the formatting is better respected for
3657 objects which work hard to make nice string forms.
3666 objects which work hard to make nice string forms.
3658
3667
3659 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3668 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3660 autocall would overtake data access for objects with both
3669 autocall would overtake data access for objects with both
3661 __getitem__ and __call__.
3670 __getitem__ and __call__.
3662
3671
3663 2003-08-19 *** Released version 0.5.0-rc1
3672 2003-08-19 *** Released version 0.5.0-rc1
3664
3673
3665 2003-08-19 Fernando Perez <fperez@colorado.edu>
3674 2003-08-19 Fernando Perez <fperez@colorado.edu>
3666
3675
3667 * IPython/deep_reload.py (load_tail): single tiny change here
3676 * IPython/deep_reload.py (load_tail): single tiny change here
3668 seems to fix the long-standing bug of dreload() failing to work
3677 seems to fix the long-standing bug of dreload() failing to work
3669 for dotted names. But this module is pretty tricky, so I may have
3678 for dotted names. But this module is pretty tricky, so I may have
3670 missed some subtlety. Needs more testing!.
3679 missed some subtlety. Needs more testing!.
3671
3680
3672 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3681 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3673 exceptions which have badly implemented __str__ methods.
3682 exceptions which have badly implemented __str__ methods.
3674 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3683 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3675 which I've been getting reports about from Python 2.3 users. I
3684 which I've been getting reports about from Python 2.3 users. I
3676 wish I had a simple test case to reproduce the problem, so I could
3685 wish I had a simple test case to reproduce the problem, so I could
3677 either write a cleaner workaround or file a bug report if
3686 either write a cleaner workaround or file a bug report if
3678 necessary.
3687 necessary.
3679
3688
3680 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3689 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3681 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3690 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3682 a bug report by Tjabo Kloppenburg.
3691 a bug report by Tjabo Kloppenburg.
3683
3692
3684 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3693 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3685 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3694 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3686 seems rather unstable. Thanks to a bug report by Tjabo
3695 seems rather unstable. Thanks to a bug report by Tjabo
3687 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3696 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3688
3697
3689 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3698 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3690 this out soon because of the critical fixes in the inner loop for
3699 this out soon because of the critical fixes in the inner loop for
3691 generators.
3700 generators.
3692
3701
3693 * IPython/Magic.py (Magic.getargspec): removed. This (and
3702 * IPython/Magic.py (Magic.getargspec): removed. This (and
3694 _get_def) have been obsoleted by OInspect for a long time, I
3703 _get_def) have been obsoleted by OInspect for a long time, I
3695 hadn't noticed that they were dead code.
3704 hadn't noticed that they were dead code.
3696 (Magic._ofind): restored _ofind functionality for a few literals
3705 (Magic._ofind): restored _ofind functionality for a few literals
3697 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3706 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3698 for things like "hello".capitalize?, since that would require a
3707 for things like "hello".capitalize?, since that would require a
3699 potentially dangerous eval() again.
3708 potentially dangerous eval() again.
3700
3709
3701 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3710 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3702 logic a bit more to clean up the escapes handling and minimize the
3711 logic a bit more to clean up the escapes handling and minimize the
3703 use of _ofind to only necessary cases. The interactive 'feel' of
3712 use of _ofind to only necessary cases. The interactive 'feel' of
3704 IPython should have improved quite a bit with the changes in
3713 IPython should have improved quite a bit with the changes in
3705 _prefilter and _ofind (besides being far safer than before).
3714 _prefilter and _ofind (besides being far safer than before).
3706
3715
3707 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3716 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3708 obscure, never reported). Edit would fail to find the object to
3717 obscure, never reported). Edit would fail to find the object to
3709 edit under some circumstances.
3718 edit under some circumstances.
3710 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3719 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3711 which were causing double-calling of generators. Those eval calls
3720 which were causing double-calling of generators. Those eval calls
3712 were _very_ dangerous, since code with side effects could be
3721 were _very_ dangerous, since code with side effects could be
3713 triggered. As they say, 'eval is evil'... These were the
3722 triggered. As they say, 'eval is evil'... These were the
3714 nastiest evals in IPython. Besides, _ofind is now far simpler,
3723 nastiest evals in IPython. Besides, _ofind is now far simpler,
3715 and it should also be quite a bit faster. Its use of inspect is
3724 and it should also be quite a bit faster. Its use of inspect is
3716 also safer, so perhaps some of the inspect-related crashes I've
3725 also safer, so perhaps some of the inspect-related crashes I've
3717 seen lately with Python 2.3 might be taken care of. That will
3726 seen lately with Python 2.3 might be taken care of. That will
3718 need more testing.
3727 need more testing.
3719
3728
3720 2003-08-17 Fernando Perez <fperez@colorado.edu>
3729 2003-08-17 Fernando Perez <fperez@colorado.edu>
3721
3730
3722 * IPython/iplib.py (InteractiveShell._prefilter): significant
3731 * IPython/iplib.py (InteractiveShell._prefilter): significant
3723 simplifications to the logic for handling user escapes. Faster
3732 simplifications to the logic for handling user escapes. Faster
3724 and simpler code.
3733 and simpler code.
3725
3734
3726 2003-08-14 Fernando Perez <fperez@colorado.edu>
3735 2003-08-14 Fernando Perez <fperez@colorado.edu>
3727
3736
3728 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3737 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3729 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3738 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3730 but it should be quite a bit faster. And the recursive version
3739 but it should be quite a bit faster. And the recursive version
3731 generated O(log N) intermediate storage for all rank>1 arrays,
3740 generated O(log N) intermediate storage for all rank>1 arrays,
3732 even if they were contiguous.
3741 even if they were contiguous.
3733 (l1norm): Added this function.
3742 (l1norm): Added this function.
3734 (norm): Added this function for arbitrary norms (including
3743 (norm): Added this function for arbitrary norms (including
3735 l-infinity). l1 and l2 are still special cases for convenience
3744 l-infinity). l1 and l2 are still special cases for convenience
3736 and speed.
3745 and speed.
3737
3746
3738 2003-08-03 Fernando Perez <fperez@colorado.edu>
3747 2003-08-03 Fernando Perez <fperez@colorado.edu>
3739
3748
3740 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3749 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3741 exceptions, which now raise PendingDeprecationWarnings in Python
3750 exceptions, which now raise PendingDeprecationWarnings in Python
3742 2.3. There were some in Magic and some in Gnuplot2.
3751 2.3. There were some in Magic and some in Gnuplot2.
3743
3752
3744 2003-06-30 Fernando Perez <fperez@colorado.edu>
3753 2003-06-30 Fernando Perez <fperez@colorado.edu>
3745
3754
3746 * IPython/genutils.py (page): modified to call curses only for
3755 * IPython/genutils.py (page): modified to call curses only for
3747 terminals where TERM=='xterm'. After problems under many other
3756 terminals where TERM=='xterm'. After problems under many other
3748 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3757 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3749
3758
3750 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3759 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3751 would be triggered when readline was absent. This was just an old
3760 would be triggered when readline was absent. This was just an old
3752 debugging statement I'd forgotten to take out.
3761 debugging statement I'd forgotten to take out.
3753
3762
3754 2003-06-20 Fernando Perez <fperez@colorado.edu>
3763 2003-06-20 Fernando Perez <fperez@colorado.edu>
3755
3764
3756 * IPython/genutils.py (clock): modified to return only user time
3765 * IPython/genutils.py (clock): modified to return only user time
3757 (not counting system time), after a discussion on scipy. While
3766 (not counting system time), after a discussion on scipy. While
3758 system time may be a useful quantity occasionally, it may much
3767 system time may be a useful quantity occasionally, it may much
3759 more easily be skewed by occasional swapping or other similar
3768 more easily be skewed by occasional swapping or other similar
3760 activity.
3769 activity.
3761
3770
3762 2003-06-05 Fernando Perez <fperez@colorado.edu>
3771 2003-06-05 Fernando Perez <fperez@colorado.edu>
3763
3772
3764 * IPython/numutils.py (identity): new function, for building
3773 * IPython/numutils.py (identity): new function, for building
3765 arbitrary rank Kronecker deltas (mostly backwards compatible with
3774 arbitrary rank Kronecker deltas (mostly backwards compatible with
3766 Numeric.identity)
3775 Numeric.identity)
3767
3776
3768 2003-06-03 Fernando Perez <fperez@colorado.edu>
3777 2003-06-03 Fernando Perez <fperez@colorado.edu>
3769
3778
3770 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3779 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3771 arguments passed to magics with spaces, to allow trailing '\' to
3780 arguments passed to magics with spaces, to allow trailing '\' to
3772 work normally (mainly for Windows users).
3781 work normally (mainly for Windows users).
3773
3782
3774 2003-05-29 Fernando Perez <fperez@colorado.edu>
3783 2003-05-29 Fernando Perez <fperez@colorado.edu>
3775
3784
3776 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3785 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3777 instead of pydoc.help. This fixes a bizarre behavior where
3786 instead of pydoc.help. This fixes a bizarre behavior where
3778 printing '%s' % locals() would trigger the help system. Now
3787 printing '%s' % locals() would trigger the help system. Now
3779 ipython behaves like normal python does.
3788 ipython behaves like normal python does.
3780
3789
3781 Note that if one does 'from pydoc import help', the bizarre
3790 Note that if one does 'from pydoc import help', the bizarre
3782 behavior returns, but this will also happen in normal python, so
3791 behavior returns, but this will also happen in normal python, so
3783 it's not an ipython bug anymore (it has to do with how pydoc.help
3792 it's not an ipython bug anymore (it has to do with how pydoc.help
3784 is implemented).
3793 is implemented).
3785
3794
3786 2003-05-22 Fernando Perez <fperez@colorado.edu>
3795 2003-05-22 Fernando Perez <fperez@colorado.edu>
3787
3796
3788 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3797 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3789 return [] instead of None when nothing matches, also match to end
3798 return [] instead of None when nothing matches, also match to end
3790 of line. Patch by Gary Bishop.
3799 of line. Patch by Gary Bishop.
3791
3800
3792 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3801 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3793 protection as before, for files passed on the command line. This
3802 protection as before, for files passed on the command line. This
3794 prevents the CrashHandler from kicking in if user files call into
3803 prevents the CrashHandler from kicking in if user files call into
3795 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3804 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3796 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3805 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3797
3806
3798 2003-05-20 *** Released version 0.4.0
3807 2003-05-20 *** Released version 0.4.0
3799
3808
3800 2003-05-20 Fernando Perez <fperez@colorado.edu>
3809 2003-05-20 Fernando Perez <fperez@colorado.edu>
3801
3810
3802 * setup.py: added support for manpages. It's a bit hackish b/c of
3811 * setup.py: added support for manpages. It's a bit hackish b/c of
3803 a bug in the way the bdist_rpm distutils target handles gzipped
3812 a bug in the way the bdist_rpm distutils target handles gzipped
3804 manpages, but it works. After a patch by Jack.
3813 manpages, but it works. After a patch by Jack.
3805
3814
3806 2003-05-19 Fernando Perez <fperez@colorado.edu>
3815 2003-05-19 Fernando Perez <fperez@colorado.edu>
3807
3816
3808 * IPython/numutils.py: added a mockup of the kinds module, since
3817 * IPython/numutils.py: added a mockup of the kinds module, since
3809 it was recently removed from Numeric. This way, numutils will
3818 it was recently removed from Numeric. This way, numutils will
3810 work for all users even if they are missing kinds.
3819 work for all users even if they are missing kinds.
3811
3820
3812 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3821 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3813 failure, which can occur with SWIG-wrapped extensions. After a
3822 failure, which can occur with SWIG-wrapped extensions. After a
3814 crash report from Prabhu.
3823 crash report from Prabhu.
3815
3824
3816 2003-05-16 Fernando Perez <fperez@colorado.edu>
3825 2003-05-16 Fernando Perez <fperez@colorado.edu>
3817
3826
3818 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3827 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3819 protect ipython from user code which may call directly
3828 protect ipython from user code which may call directly
3820 sys.excepthook (this looks like an ipython crash to the user, even
3829 sys.excepthook (this looks like an ipython crash to the user, even
3821 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3830 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3822 This is especially important to help users of WxWindows, but may
3831 This is especially important to help users of WxWindows, but may
3823 also be useful in other cases.
3832 also be useful in other cases.
3824
3833
3825 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3834 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3826 an optional tb_offset to be specified, and to preserve exception
3835 an optional tb_offset to be specified, and to preserve exception
3827 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3836 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3828
3837
3829 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3838 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3830
3839
3831 2003-05-15 Fernando Perez <fperez@colorado.edu>
3840 2003-05-15 Fernando Perez <fperez@colorado.edu>
3832
3841
3833 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3842 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3834 installing for a new user under Windows.
3843 installing for a new user under Windows.
3835
3844
3836 2003-05-12 Fernando Perez <fperez@colorado.edu>
3845 2003-05-12 Fernando Perez <fperez@colorado.edu>
3837
3846
3838 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3847 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3839 handler for Emacs comint-based lines. Currently it doesn't do
3848 handler for Emacs comint-based lines. Currently it doesn't do
3840 much (but importantly, it doesn't update the history cache). In
3849 much (but importantly, it doesn't update the history cache). In
3841 the future it may be expanded if Alex needs more functionality
3850 the future it may be expanded if Alex needs more functionality
3842 there.
3851 there.
3843
3852
3844 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3853 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3845 info to crash reports.
3854 info to crash reports.
3846
3855
3847 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3856 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3848 just like Python's -c. Also fixed crash with invalid -color
3857 just like Python's -c. Also fixed crash with invalid -color
3849 option value at startup. Thanks to Will French
3858 option value at startup. Thanks to Will French
3850 <wfrench-AT-bestweb.net> for the bug report.
3859 <wfrench-AT-bestweb.net> for the bug report.
3851
3860
3852 2003-05-09 Fernando Perez <fperez@colorado.edu>
3861 2003-05-09 Fernando Perez <fperez@colorado.edu>
3853
3862
3854 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3863 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3855 to EvalDict (it's a mapping, after all) and simplified its code
3864 to EvalDict (it's a mapping, after all) and simplified its code
3856 quite a bit, after a nice discussion on c.l.py where Gustavo
3865 quite a bit, after a nice discussion on c.l.py where Gustavo
3857 Córdova <gcordova-AT-sismex.com> suggested the new version.
3866 Córdova <gcordova-AT-sismex.com> suggested the new version.
3858
3867
3859 2003-04-30 Fernando Perez <fperez@colorado.edu>
3868 2003-04-30 Fernando Perez <fperez@colorado.edu>
3860
3869
3861 * IPython/genutils.py (timings_out): modified it to reduce its
3870 * IPython/genutils.py (timings_out): modified it to reduce its
3862 overhead in the common reps==1 case.
3871 overhead in the common reps==1 case.
3863
3872
3864 2003-04-29 Fernando Perez <fperez@colorado.edu>
3873 2003-04-29 Fernando Perez <fperez@colorado.edu>
3865
3874
3866 * IPython/genutils.py (timings_out): Modified to use the resource
3875 * IPython/genutils.py (timings_out): Modified to use the resource
3867 module, which avoids the wraparound problems of time.clock().
3876 module, which avoids the wraparound problems of time.clock().
3868
3877
3869 2003-04-17 *** Released version 0.2.15pre4
3878 2003-04-17 *** Released version 0.2.15pre4
3870
3879
3871 2003-04-17 Fernando Perez <fperez@colorado.edu>
3880 2003-04-17 Fernando Perez <fperez@colorado.edu>
3872
3881
3873 * setup.py (scriptfiles): Split windows-specific stuff over to a
3882 * setup.py (scriptfiles): Split windows-specific stuff over to a
3874 separate file, in an attempt to have a Windows GUI installer.
3883 separate file, in an attempt to have a Windows GUI installer.
3875 That didn't work, but part of the groundwork is done.
3884 That didn't work, but part of the groundwork is done.
3876
3885
3877 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3886 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3878 indent/unindent with 4 spaces. Particularly useful in combination
3887 indent/unindent with 4 spaces. Particularly useful in combination
3879 with the new auto-indent option.
3888 with the new auto-indent option.
3880
3889
3881 2003-04-16 Fernando Perez <fperez@colorado.edu>
3890 2003-04-16 Fernando Perez <fperez@colorado.edu>
3882
3891
3883 * IPython/Magic.py: various replacements of self.rc for
3892 * IPython/Magic.py: various replacements of self.rc for
3884 self.shell.rc. A lot more remains to be done to fully disentangle
3893 self.shell.rc. A lot more remains to be done to fully disentangle
3885 this class from the main Shell class.
3894 this class from the main Shell class.
3886
3895
3887 * IPython/GnuplotRuntime.py: added checks for mouse support so
3896 * IPython/GnuplotRuntime.py: added checks for mouse support so
3888 that we don't try to enable it if the current gnuplot doesn't
3897 that we don't try to enable it if the current gnuplot doesn't
3889 really support it. Also added checks so that we don't try to
3898 really support it. Also added checks so that we don't try to
3890 enable persist under Windows (where Gnuplot doesn't recognize the
3899 enable persist under Windows (where Gnuplot doesn't recognize the
3891 option).
3900 option).
3892
3901
3893 * IPython/iplib.py (InteractiveShell.interact): Added optional
3902 * IPython/iplib.py (InteractiveShell.interact): Added optional
3894 auto-indenting code, after a patch by King C. Shu
3903 auto-indenting code, after a patch by King C. Shu
3895 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3904 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3896 get along well with pasting indented code. If I ever figure out
3905 get along well with pasting indented code. If I ever figure out
3897 how to make that part go well, it will become on by default.
3906 how to make that part go well, it will become on by default.
3898
3907
3899 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3908 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3900 crash ipython if there was an unmatched '%' in the user's prompt
3909 crash ipython if there was an unmatched '%' in the user's prompt
3901 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3910 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3902
3911
3903 * IPython/iplib.py (InteractiveShell.interact): removed the
3912 * IPython/iplib.py (InteractiveShell.interact): removed the
3904 ability to ask the user whether he wants to crash or not at the
3913 ability to ask the user whether he wants to crash or not at the
3905 'last line' exception handler. Calling functions at that point
3914 'last line' exception handler. Calling functions at that point
3906 changes the stack, and the error reports would have incorrect
3915 changes the stack, and the error reports would have incorrect
3907 tracebacks.
3916 tracebacks.
3908
3917
3909 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3918 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3910 pass through a peger a pretty-printed form of any object. After a
3919 pass through a peger a pretty-printed form of any object. After a
3911 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3920 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3912
3921
3913 2003-04-14 Fernando Perez <fperez@colorado.edu>
3922 2003-04-14 Fernando Perez <fperez@colorado.edu>
3914
3923
3915 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3924 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3916 all files in ~ would be modified at first install (instead of
3925 all files in ~ would be modified at first install (instead of
3917 ~/.ipython). This could be potentially disastrous, as the
3926 ~/.ipython). This could be potentially disastrous, as the
3918 modification (make line-endings native) could damage binary files.
3927 modification (make line-endings native) could damage binary files.
3919
3928
3920 2003-04-10 Fernando Perez <fperez@colorado.edu>
3929 2003-04-10 Fernando Perez <fperez@colorado.edu>
3921
3930
3922 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3931 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3923 handle only lines which are invalid python. This now means that
3932 handle only lines which are invalid python. This now means that
3924 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3933 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3925 for the bug report.
3934 for the bug report.
3926
3935
3927 2003-04-01 Fernando Perez <fperez@colorado.edu>
3936 2003-04-01 Fernando Perez <fperez@colorado.edu>
3928
3937
3929 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3938 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3930 where failing to set sys.last_traceback would crash pdb.pm().
3939 where failing to set sys.last_traceback would crash pdb.pm().
3931 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3940 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3932 report.
3941 report.
3933
3942
3934 2003-03-25 Fernando Perez <fperez@colorado.edu>
3943 2003-03-25 Fernando Perez <fperez@colorado.edu>
3935
3944
3936 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3945 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3937 before printing it (it had a lot of spurious blank lines at the
3946 before printing it (it had a lot of spurious blank lines at the
3938 end).
3947 end).
3939
3948
3940 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3949 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3941 output would be sent 21 times! Obviously people don't use this
3950 output would be sent 21 times! Obviously people don't use this
3942 too often, or I would have heard about it.
3951 too often, or I would have heard about it.
3943
3952
3944 2003-03-24 Fernando Perez <fperez@colorado.edu>
3953 2003-03-24 Fernando Perez <fperez@colorado.edu>
3945
3954
3946 * setup.py (scriptfiles): renamed the data_files parameter from
3955 * setup.py (scriptfiles): renamed the data_files parameter from
3947 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3956 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3948 for the patch.
3957 for the patch.
3949
3958
3950 2003-03-20 Fernando Perez <fperez@colorado.edu>
3959 2003-03-20 Fernando Perez <fperez@colorado.edu>
3951
3960
3952 * IPython/genutils.py (error): added error() and fatal()
3961 * IPython/genutils.py (error): added error() and fatal()
3953 functions.
3962 functions.
3954
3963
3955 2003-03-18 *** Released version 0.2.15pre3
3964 2003-03-18 *** Released version 0.2.15pre3
3956
3965
3957 2003-03-18 Fernando Perez <fperez@colorado.edu>
3966 2003-03-18 Fernando Perez <fperez@colorado.edu>
3958
3967
3959 * setupext/install_data_ext.py
3968 * setupext/install_data_ext.py
3960 (install_data_ext.initialize_options): Class contributed by Jack
3969 (install_data_ext.initialize_options): Class contributed by Jack
3961 Moffit for fixing the old distutils hack. He is sending this to
3970 Moffit for fixing the old distutils hack. He is sending this to
3962 the distutils folks so in the future we may not need it as a
3971 the distutils folks so in the future we may not need it as a
3963 private fix.
3972 private fix.
3964
3973
3965 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3974 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3966 changes for Debian packaging. See his patch for full details.
3975 changes for Debian packaging. See his patch for full details.
3967 The old distutils hack of making the ipythonrc* files carry a
3976 The old distutils hack of making the ipythonrc* files carry a
3968 bogus .py extension is gone, at last. Examples were moved to a
3977 bogus .py extension is gone, at last. Examples were moved to a
3969 separate subdir under doc/, and the separate executable scripts
3978 separate subdir under doc/, and the separate executable scripts
3970 now live in their own directory. Overall a great cleanup. The
3979 now live in their own directory. Overall a great cleanup. The
3971 manual was updated to use the new files, and setup.py has been
3980 manual was updated to use the new files, and setup.py has been
3972 fixed for this setup.
3981 fixed for this setup.
3973
3982
3974 * IPython/PyColorize.py (Parser.usage): made non-executable and
3983 * IPython/PyColorize.py (Parser.usage): made non-executable and
3975 created a pycolor wrapper around it to be included as a script.
3984 created a pycolor wrapper around it to be included as a script.
3976
3985
3977 2003-03-12 *** Released version 0.2.15pre2
3986 2003-03-12 *** Released version 0.2.15pre2
3978
3987
3979 2003-03-12 Fernando Perez <fperez@colorado.edu>
3988 2003-03-12 Fernando Perez <fperez@colorado.edu>
3980
3989
3981 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3990 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3982 long-standing problem with garbage characters in some terminals.
3991 long-standing problem with garbage characters in some terminals.
3983 The issue was really that the \001 and \002 escapes must _only_ be
3992 The issue was really that the \001 and \002 escapes must _only_ be
3984 passed to input prompts (which call readline), but _never_ to
3993 passed to input prompts (which call readline), but _never_ to
3985 normal text to be printed on screen. I changed ColorANSI to have
3994 normal text to be printed on screen. I changed ColorANSI to have
3986 two classes: TermColors and InputTermColors, each with the
3995 two classes: TermColors and InputTermColors, each with the
3987 appropriate escapes for input prompts or normal text. The code in
3996 appropriate escapes for input prompts or normal text. The code in
3988 Prompts.py got slightly more complicated, but this very old and
3997 Prompts.py got slightly more complicated, but this very old and
3989 annoying bug is finally fixed.
3998 annoying bug is finally fixed.
3990
3999
3991 All the credit for nailing down the real origin of this problem
4000 All the credit for nailing down the real origin of this problem
3992 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4001 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3993 *Many* thanks to him for spending quite a bit of effort on this.
4002 *Many* thanks to him for spending quite a bit of effort on this.
3994
4003
3995 2003-03-05 *** Released version 0.2.15pre1
4004 2003-03-05 *** Released version 0.2.15pre1
3996
4005
3997 2003-03-03 Fernando Perez <fperez@colorado.edu>
4006 2003-03-03 Fernando Perez <fperez@colorado.edu>
3998
4007
3999 * IPython/FakeModule.py: Moved the former _FakeModule to a
4008 * IPython/FakeModule.py: Moved the former _FakeModule to a
4000 separate file, because it's also needed by Magic (to fix a similar
4009 separate file, because it's also needed by Magic (to fix a similar
4001 pickle-related issue in @run).
4010 pickle-related issue in @run).
4002
4011
4003 2003-03-02 Fernando Perez <fperez@colorado.edu>
4012 2003-03-02 Fernando Perez <fperez@colorado.edu>
4004
4013
4005 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4014 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4006 the autocall option at runtime.
4015 the autocall option at runtime.
4007 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4016 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4008 across Magic.py to start separating Magic from InteractiveShell.
4017 across Magic.py to start separating Magic from InteractiveShell.
4009 (Magic._ofind): Fixed to return proper namespace for dotted
4018 (Magic._ofind): Fixed to return proper namespace for dotted
4010 names. Before, a dotted name would always return 'not currently
4019 names. Before, a dotted name would always return 'not currently
4011 defined', because it would find the 'parent'. s.x would be found,
4020 defined', because it would find the 'parent'. s.x would be found,
4012 but since 'x' isn't defined by itself, it would get confused.
4021 but since 'x' isn't defined by itself, it would get confused.
4013 (Magic.magic_run): Fixed pickling problems reported by Ralf
4022 (Magic.magic_run): Fixed pickling problems reported by Ralf
4014 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4023 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4015 that I'd used when Mike Heeter reported similar issues at the
4024 that I'd used when Mike Heeter reported similar issues at the
4016 top-level, but now for @run. It boils down to injecting the
4025 top-level, but now for @run. It boils down to injecting the
4017 namespace where code is being executed with something that looks
4026 namespace where code is being executed with something that looks
4018 enough like a module to fool pickle.dump(). Since a pickle stores
4027 enough like a module to fool pickle.dump(). Since a pickle stores
4019 a named reference to the importing module, we need this for
4028 a named reference to the importing module, we need this for
4020 pickles to save something sensible.
4029 pickles to save something sensible.
4021
4030
4022 * IPython/ipmaker.py (make_IPython): added an autocall option.
4031 * IPython/ipmaker.py (make_IPython): added an autocall option.
4023
4032
4024 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4033 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4025 the auto-eval code. Now autocalling is an option, and the code is
4034 the auto-eval code. Now autocalling is an option, and the code is
4026 also vastly safer. There is no more eval() involved at all.
4035 also vastly safer. There is no more eval() involved at all.
4027
4036
4028 2003-03-01 Fernando Perez <fperez@colorado.edu>
4037 2003-03-01 Fernando Perez <fperez@colorado.edu>
4029
4038
4030 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4039 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4031 dict with named keys instead of a tuple.
4040 dict with named keys instead of a tuple.
4032
4041
4033 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4042 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4034
4043
4035 * setup.py (make_shortcut): Fixed message about directories
4044 * setup.py (make_shortcut): Fixed message about directories
4036 created during Windows installation (the directories were ok, just
4045 created during Windows installation (the directories were ok, just
4037 the printed message was misleading). Thanks to Chris Liechti
4046 the printed message was misleading). Thanks to Chris Liechti
4038 <cliechti-AT-gmx.net> for the heads up.
4047 <cliechti-AT-gmx.net> for the heads up.
4039
4048
4040 2003-02-21 Fernando Perez <fperez@colorado.edu>
4049 2003-02-21 Fernando Perez <fperez@colorado.edu>
4041
4050
4042 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4051 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4043 of ValueError exception when checking for auto-execution. This
4052 of ValueError exception when checking for auto-execution. This
4044 one is raised by things like Numeric arrays arr.flat when the
4053 one is raised by things like Numeric arrays arr.flat when the
4045 array is non-contiguous.
4054 array is non-contiguous.
4046
4055
4047 2003-01-31 Fernando Perez <fperez@colorado.edu>
4056 2003-01-31 Fernando Perez <fperez@colorado.edu>
4048
4057
4049 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4058 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4050 not return any value at all (even though the command would get
4059 not return any value at all (even though the command would get
4051 executed).
4060 executed).
4052 (xsys): Flush stdout right after printing the command to ensure
4061 (xsys): Flush stdout right after printing the command to ensure
4053 proper ordering of commands and command output in the total
4062 proper ordering of commands and command output in the total
4054 output.
4063 output.
4055 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4064 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4056 system/getoutput as defaults. The old ones are kept for
4065 system/getoutput as defaults. The old ones are kept for
4057 compatibility reasons, so no code which uses this library needs
4066 compatibility reasons, so no code which uses this library needs
4058 changing.
4067 changing.
4059
4068
4060 2003-01-27 *** Released version 0.2.14
4069 2003-01-27 *** Released version 0.2.14
4061
4070
4062 2003-01-25 Fernando Perez <fperez@colorado.edu>
4071 2003-01-25 Fernando Perez <fperez@colorado.edu>
4063
4072
4064 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4073 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4065 functions defined in previous edit sessions could not be re-edited
4074 functions defined in previous edit sessions could not be re-edited
4066 (because the temp files were immediately removed). Now temp files
4075 (because the temp files were immediately removed). Now temp files
4067 are removed only at IPython's exit.
4076 are removed only at IPython's exit.
4068 (Magic.magic_run): Improved @run to perform shell-like expansions
4077 (Magic.magic_run): Improved @run to perform shell-like expansions
4069 on its arguments (~users and $VARS). With this, @run becomes more
4078 on its arguments (~users and $VARS). With this, @run becomes more
4070 like a normal command-line.
4079 like a normal command-line.
4071
4080
4072 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4081 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4073 bugs related to embedding and cleaned up that code. A fairly
4082 bugs related to embedding and cleaned up that code. A fairly
4074 important one was the impossibility to access the global namespace
4083 important one was the impossibility to access the global namespace
4075 through the embedded IPython (only local variables were visible).
4084 through the embedded IPython (only local variables were visible).
4076
4085
4077 2003-01-14 Fernando Perez <fperez@colorado.edu>
4086 2003-01-14 Fernando Perez <fperez@colorado.edu>
4078
4087
4079 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4088 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4080 auto-calling to be a bit more conservative. Now it doesn't get
4089 auto-calling to be a bit more conservative. Now it doesn't get
4081 triggered if any of '!=()<>' are in the rest of the input line, to
4090 triggered if any of '!=()<>' are in the rest of the input line, to
4082 allow comparing callables. Thanks to Alex for the heads up.
4091 allow comparing callables. Thanks to Alex for the heads up.
4083
4092
4084 2003-01-07 Fernando Perez <fperez@colorado.edu>
4093 2003-01-07 Fernando Perez <fperez@colorado.edu>
4085
4094
4086 * IPython/genutils.py (page): fixed estimation of the number of
4095 * IPython/genutils.py (page): fixed estimation of the number of
4087 lines in a string to be paged to simply count newlines. This
4096 lines in a string to be paged to simply count newlines. This
4088 prevents over-guessing due to embedded escape sequences. A better
4097 prevents over-guessing due to embedded escape sequences. A better
4089 long-term solution would involve stripping out the control chars
4098 long-term solution would involve stripping out the control chars
4090 for the count, but it's potentially so expensive I just don't
4099 for the count, but it's potentially so expensive I just don't
4091 think it's worth doing.
4100 think it's worth doing.
4092
4101
4093 2002-12-19 *** Released version 0.2.14pre50
4102 2002-12-19 *** Released version 0.2.14pre50
4094
4103
4095 2002-12-19 Fernando Perez <fperez@colorado.edu>
4104 2002-12-19 Fernando Perez <fperez@colorado.edu>
4096
4105
4097 * tools/release (version): Changed release scripts to inform
4106 * tools/release (version): Changed release scripts to inform
4098 Andrea and build a NEWS file with a list of recent changes.
4107 Andrea and build a NEWS file with a list of recent changes.
4099
4108
4100 * IPython/ColorANSI.py (__all__): changed terminal detection
4109 * IPython/ColorANSI.py (__all__): changed terminal detection
4101 code. Seems to work better for xterms without breaking
4110 code. Seems to work better for xterms without breaking
4102 konsole. Will need more testing to determine if WinXP and Mac OSX
4111 konsole. Will need more testing to determine if WinXP and Mac OSX
4103 also work ok.
4112 also work ok.
4104
4113
4105 2002-12-18 *** Released version 0.2.14pre49
4114 2002-12-18 *** Released version 0.2.14pre49
4106
4115
4107 2002-12-18 Fernando Perez <fperez@colorado.edu>
4116 2002-12-18 Fernando Perez <fperez@colorado.edu>
4108
4117
4109 * Docs: added new info about Mac OSX, from Andrea.
4118 * Docs: added new info about Mac OSX, from Andrea.
4110
4119
4111 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4120 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4112 allow direct plotting of python strings whose format is the same
4121 allow direct plotting of python strings whose format is the same
4113 of gnuplot data files.
4122 of gnuplot data files.
4114
4123
4115 2002-12-16 Fernando Perez <fperez@colorado.edu>
4124 2002-12-16 Fernando Perez <fperez@colorado.edu>
4116
4125
4117 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4126 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4118 value of exit question to be acknowledged.
4127 value of exit question to be acknowledged.
4119
4128
4120 2002-12-03 Fernando Perez <fperez@colorado.edu>
4129 2002-12-03 Fernando Perez <fperez@colorado.edu>
4121
4130
4122 * IPython/ipmaker.py: removed generators, which had been added
4131 * IPython/ipmaker.py: removed generators, which had been added
4123 by mistake in an earlier debugging run. This was causing trouble
4132 by mistake in an earlier debugging run. This was causing trouble
4124 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4133 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4125 for pointing this out.
4134 for pointing this out.
4126
4135
4127 2002-11-17 Fernando Perez <fperez@colorado.edu>
4136 2002-11-17 Fernando Perez <fperez@colorado.edu>
4128
4137
4129 * Manual: updated the Gnuplot section.
4138 * Manual: updated the Gnuplot section.
4130
4139
4131 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4140 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4132 a much better split of what goes in Runtime and what goes in
4141 a much better split of what goes in Runtime and what goes in
4133 Interactive.
4142 Interactive.
4134
4143
4135 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4144 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4136 being imported from iplib.
4145 being imported from iplib.
4137
4146
4138 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4147 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4139 for command-passing. Now the global Gnuplot instance is called
4148 for command-passing. Now the global Gnuplot instance is called
4140 'gp' instead of 'g', which was really a far too fragile and
4149 'gp' instead of 'g', which was really a far too fragile and
4141 common name.
4150 common name.
4142
4151
4143 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4152 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4144 bounding boxes generated by Gnuplot for square plots.
4153 bounding boxes generated by Gnuplot for square plots.
4145
4154
4146 * IPython/genutils.py (popkey): new function added. I should
4155 * IPython/genutils.py (popkey): new function added. I should
4147 suggest this on c.l.py as a dict method, it seems useful.
4156 suggest this on c.l.py as a dict method, it seems useful.
4148
4157
4149 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4158 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4150 to transparently handle PostScript generation. MUCH better than
4159 to transparently handle PostScript generation. MUCH better than
4151 the previous plot_eps/replot_eps (which I removed now). The code
4160 the previous plot_eps/replot_eps (which I removed now). The code
4152 is also fairly clean and well documented now (including
4161 is also fairly clean and well documented now (including
4153 docstrings).
4162 docstrings).
4154
4163
4155 2002-11-13 Fernando Perez <fperez@colorado.edu>
4164 2002-11-13 Fernando Perez <fperez@colorado.edu>
4156
4165
4157 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4166 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4158 (inconsistent with options).
4167 (inconsistent with options).
4159
4168
4160 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4169 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4161 manually disabled, I don't know why. Fixed it.
4170 manually disabled, I don't know why. Fixed it.
4162 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4171 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4163 eps output.
4172 eps output.
4164
4173
4165 2002-11-12 Fernando Perez <fperez@colorado.edu>
4174 2002-11-12 Fernando Perez <fperez@colorado.edu>
4166
4175
4167 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4176 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4168 don't propagate up to caller. Fixes crash reported by François
4177 don't propagate up to caller. Fixes crash reported by François
4169 Pinard.
4178 Pinard.
4170
4179
4171 2002-11-09 Fernando Perez <fperez@colorado.edu>
4180 2002-11-09 Fernando Perez <fperez@colorado.edu>
4172
4181
4173 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4182 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4174 history file for new users.
4183 history file for new users.
4175 (make_IPython): fixed bug where initial install would leave the
4184 (make_IPython): fixed bug where initial install would leave the
4176 user running in the .ipython dir.
4185 user running in the .ipython dir.
4177 (make_IPython): fixed bug where config dir .ipython would be
4186 (make_IPython): fixed bug where config dir .ipython would be
4178 created regardless of the given -ipythondir option. Thanks to Cory
4187 created regardless of the given -ipythondir option. Thanks to Cory
4179 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4188 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4180
4189
4181 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4190 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4182 type confirmations. Will need to use it in all of IPython's code
4191 type confirmations. Will need to use it in all of IPython's code
4183 consistently.
4192 consistently.
4184
4193
4185 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4194 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4186 context to print 31 lines instead of the default 5. This will make
4195 context to print 31 lines instead of the default 5. This will make
4187 the crash reports extremely detailed in case the problem is in
4196 the crash reports extremely detailed in case the problem is in
4188 libraries I don't have access to.
4197 libraries I don't have access to.
4189
4198
4190 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4199 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4191 line of defense' code to still crash, but giving users fair
4200 line of defense' code to still crash, but giving users fair
4192 warning. I don't want internal errors to go unreported: if there's
4201 warning. I don't want internal errors to go unreported: if there's
4193 an internal problem, IPython should crash and generate a full
4202 an internal problem, IPython should crash and generate a full
4194 report.
4203 report.
4195
4204
4196 2002-11-08 Fernando Perez <fperez@colorado.edu>
4205 2002-11-08 Fernando Perez <fperez@colorado.edu>
4197
4206
4198 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4207 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4199 otherwise uncaught exceptions which can appear if people set
4208 otherwise uncaught exceptions which can appear if people set
4200 sys.stdout to something badly broken. Thanks to a crash report
4209 sys.stdout to something badly broken. Thanks to a crash report
4201 from henni-AT-mail.brainbot.com.
4210 from henni-AT-mail.brainbot.com.
4202
4211
4203 2002-11-04 Fernando Perez <fperez@colorado.edu>
4212 2002-11-04 Fernando Perez <fperez@colorado.edu>
4204
4213
4205 * IPython/iplib.py (InteractiveShell.interact): added
4214 * IPython/iplib.py (InteractiveShell.interact): added
4206 __IPYTHON__active to the builtins. It's a flag which goes on when
4215 __IPYTHON__active to the builtins. It's a flag which goes on when
4207 the interaction starts and goes off again when it stops. This
4216 the interaction starts and goes off again when it stops. This
4208 allows embedding code to detect being inside IPython. Before this
4217 allows embedding code to detect being inside IPython. Before this
4209 was done via __IPYTHON__, but that only shows that an IPython
4218 was done via __IPYTHON__, but that only shows that an IPython
4210 instance has been created.
4219 instance has been created.
4211
4220
4212 * IPython/Magic.py (Magic.magic_env): I realized that in a
4221 * IPython/Magic.py (Magic.magic_env): I realized that in a
4213 UserDict, instance.data holds the data as a normal dict. So I
4222 UserDict, instance.data holds the data as a normal dict. So I
4214 modified @env to return os.environ.data instead of rebuilding a
4223 modified @env to return os.environ.data instead of rebuilding a
4215 dict by hand.
4224 dict by hand.
4216
4225
4217 2002-11-02 Fernando Perez <fperez@colorado.edu>
4226 2002-11-02 Fernando Perez <fperez@colorado.edu>
4218
4227
4219 * IPython/genutils.py (warn): changed so that level 1 prints no
4228 * IPython/genutils.py (warn): changed so that level 1 prints no
4220 header. Level 2 is now the default (with 'WARNING' header, as
4229 header. Level 2 is now the default (with 'WARNING' header, as
4221 before). I think I tracked all places where changes were needed in
4230 before). I think I tracked all places where changes were needed in
4222 IPython, but outside code using the old level numbering may have
4231 IPython, but outside code using the old level numbering may have
4223 broken.
4232 broken.
4224
4233
4225 * IPython/iplib.py (InteractiveShell.runcode): added this to
4234 * IPython/iplib.py (InteractiveShell.runcode): added this to
4226 handle the tracebacks in SystemExit traps correctly. The previous
4235 handle the tracebacks in SystemExit traps correctly. The previous
4227 code (through interact) was printing more of the stack than
4236 code (through interact) was printing more of the stack than
4228 necessary, showing IPython internal code to the user.
4237 necessary, showing IPython internal code to the user.
4229
4238
4230 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4239 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4231 default. Now that the default at the confirmation prompt is yes,
4240 default. Now that the default at the confirmation prompt is yes,
4232 it's not so intrusive. François' argument that ipython sessions
4241 it's not so intrusive. François' argument that ipython sessions
4233 tend to be complex enough not to lose them from an accidental C-d,
4242 tend to be complex enough not to lose them from an accidental C-d,
4234 is a valid one.
4243 is a valid one.
4235
4244
4236 * IPython/iplib.py (InteractiveShell.interact): added a
4245 * IPython/iplib.py (InteractiveShell.interact): added a
4237 showtraceback() call to the SystemExit trap, and modified the exit
4246 showtraceback() call to the SystemExit trap, and modified the exit
4238 confirmation to have yes as the default.
4247 confirmation to have yes as the default.
4239
4248
4240 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4249 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4241 this file. It's been gone from the code for a long time, this was
4250 this file. It's been gone from the code for a long time, this was
4242 simply leftover junk.
4251 simply leftover junk.
4243
4252
4244 2002-11-01 Fernando Perez <fperez@colorado.edu>
4253 2002-11-01 Fernando Perez <fperez@colorado.edu>
4245
4254
4246 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4255 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4247 added. If set, IPython now traps EOF and asks for
4256 added. If set, IPython now traps EOF and asks for
4248 confirmation. After a request by François Pinard.
4257 confirmation. After a request by François Pinard.
4249
4258
4250 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4259 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4251 of @abort, and with a new (better) mechanism for handling the
4260 of @abort, and with a new (better) mechanism for handling the
4252 exceptions.
4261 exceptions.
4253
4262
4254 2002-10-27 Fernando Perez <fperez@colorado.edu>
4263 2002-10-27 Fernando Perez <fperez@colorado.edu>
4255
4264
4256 * IPython/usage.py (__doc__): updated the --help information and
4265 * IPython/usage.py (__doc__): updated the --help information and
4257 the ipythonrc file to indicate that -log generates
4266 the ipythonrc file to indicate that -log generates
4258 ./ipython.log. Also fixed the corresponding info in @logstart.
4267 ./ipython.log. Also fixed the corresponding info in @logstart.
4259 This and several other fixes in the manuals thanks to reports by
4268 This and several other fixes in the manuals thanks to reports by
4260 François Pinard <pinard-AT-iro.umontreal.ca>.
4269 François Pinard <pinard-AT-iro.umontreal.ca>.
4261
4270
4262 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4271 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4263 refer to @logstart (instead of @log, which doesn't exist).
4272 refer to @logstart (instead of @log, which doesn't exist).
4264
4273
4265 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4274 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4266 AttributeError crash. Thanks to Christopher Armstrong
4275 AttributeError crash. Thanks to Christopher Armstrong
4267 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4276 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4268 introduced recently (in 0.2.14pre37) with the fix to the eval
4277 introduced recently (in 0.2.14pre37) with the fix to the eval
4269 problem mentioned below.
4278 problem mentioned below.
4270
4279
4271 2002-10-17 Fernando Perez <fperez@colorado.edu>
4280 2002-10-17 Fernando Perez <fperez@colorado.edu>
4272
4281
4273 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4282 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4274 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4283 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4275
4284
4276 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4285 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4277 this function to fix a problem reported by Alex Schmolck. He saw
4286 this function to fix a problem reported by Alex Schmolck. He saw
4278 it with list comprehensions and generators, which were getting
4287 it with list comprehensions and generators, which were getting
4279 called twice. The real problem was an 'eval' call in testing for
4288 called twice. The real problem was an 'eval' call in testing for
4280 automagic which was evaluating the input line silently.
4289 automagic which was evaluating the input line silently.
4281
4290
4282 This is a potentially very nasty bug, if the input has side
4291 This is a potentially very nasty bug, if the input has side
4283 effects which must not be repeated. The code is much cleaner now,
4292 effects which must not be repeated. The code is much cleaner now,
4284 without any blanket 'except' left and with a regexp test for
4293 without any blanket 'except' left and with a regexp test for
4285 actual function names.
4294 actual function names.
4286
4295
4287 But an eval remains, which I'm not fully comfortable with. I just
4296 But an eval remains, which I'm not fully comfortable with. I just
4288 don't know how to find out if an expression could be a callable in
4297 don't know how to find out if an expression could be a callable in
4289 the user's namespace without doing an eval on the string. However
4298 the user's namespace without doing an eval on the string. However
4290 that string is now much more strictly checked so that no code
4299 that string is now much more strictly checked so that no code
4291 slips by, so the eval should only happen for things that can
4300 slips by, so the eval should only happen for things that can
4292 really be only function/method names.
4301 really be only function/method names.
4293
4302
4294 2002-10-15 Fernando Perez <fperez@colorado.edu>
4303 2002-10-15 Fernando Perez <fperez@colorado.edu>
4295
4304
4296 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4305 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4297 OSX information to main manual, removed README_Mac_OSX file from
4306 OSX information to main manual, removed README_Mac_OSX file from
4298 distribution. Also updated credits for recent additions.
4307 distribution. Also updated credits for recent additions.
4299
4308
4300 2002-10-10 Fernando Perez <fperez@colorado.edu>
4309 2002-10-10 Fernando Perez <fperez@colorado.edu>
4301
4310
4302 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4311 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4303 terminal-related issues. Many thanks to Andrea Riciputi
4312 terminal-related issues. Many thanks to Andrea Riciputi
4304 <andrea.riciputi-AT-libero.it> for writing it.
4313 <andrea.riciputi-AT-libero.it> for writing it.
4305
4314
4306 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4315 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4307 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4316 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4308
4317
4309 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4318 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4310 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4319 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4311 <syver-en-AT-online.no> who both submitted patches for this problem.
4320 <syver-en-AT-online.no> who both submitted patches for this problem.
4312
4321
4313 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4322 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4314 global embedding to make sure that things don't overwrite user
4323 global embedding to make sure that things don't overwrite user
4315 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4324 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4316
4325
4317 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4326 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4318 compatibility. Thanks to Hayden Callow
4327 compatibility. Thanks to Hayden Callow
4319 <h.callow-AT-elec.canterbury.ac.nz>
4328 <h.callow-AT-elec.canterbury.ac.nz>
4320
4329
4321 2002-10-04 Fernando Perez <fperez@colorado.edu>
4330 2002-10-04 Fernando Perez <fperez@colorado.edu>
4322
4331
4323 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4332 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4324 Gnuplot.File objects.
4333 Gnuplot.File objects.
4325
4334
4326 2002-07-23 Fernando Perez <fperez@colorado.edu>
4335 2002-07-23 Fernando Perez <fperez@colorado.edu>
4327
4336
4328 * IPython/genutils.py (timing): Added timings() and timing() for
4337 * IPython/genutils.py (timing): Added timings() and timing() for
4329 quick access to the most commonly needed data, the execution
4338 quick access to the most commonly needed data, the execution
4330 times. Old timing() renamed to timings_out().
4339 times. Old timing() renamed to timings_out().
4331
4340
4332 2002-07-18 Fernando Perez <fperez@colorado.edu>
4341 2002-07-18 Fernando Perez <fperez@colorado.edu>
4333
4342
4334 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4343 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4335 bug with nested instances disrupting the parent's tab completion.
4344 bug with nested instances disrupting the parent's tab completion.
4336
4345
4337 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4346 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4338 all_completions code to begin the emacs integration.
4347 all_completions code to begin the emacs integration.
4339
4348
4340 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4349 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4341 argument to allow titling individual arrays when plotting.
4350 argument to allow titling individual arrays when plotting.
4342
4351
4343 2002-07-15 Fernando Perez <fperez@colorado.edu>
4352 2002-07-15 Fernando Perez <fperez@colorado.edu>
4344
4353
4345 * setup.py (make_shortcut): changed to retrieve the value of
4354 * setup.py (make_shortcut): changed to retrieve the value of
4346 'Program Files' directory from the registry (this value changes in
4355 'Program Files' directory from the registry (this value changes in
4347 non-english versions of Windows). Thanks to Thomas Fanslau
4356 non-english versions of Windows). Thanks to Thomas Fanslau
4348 <tfanslau-AT-gmx.de> for the report.
4357 <tfanslau-AT-gmx.de> for the report.
4349
4358
4350 2002-07-10 Fernando Perez <fperez@colorado.edu>
4359 2002-07-10 Fernando Perez <fperez@colorado.edu>
4351
4360
4352 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4361 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4353 a bug in pdb, which crashes if a line with only whitespace is
4362 a bug in pdb, which crashes if a line with only whitespace is
4354 entered. Bug report submitted to sourceforge.
4363 entered. Bug report submitted to sourceforge.
4355
4364
4356 2002-07-09 Fernando Perez <fperez@colorado.edu>
4365 2002-07-09 Fernando Perez <fperez@colorado.edu>
4357
4366
4358 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4367 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4359 reporting exceptions (it's a bug in inspect.py, I just set a
4368 reporting exceptions (it's a bug in inspect.py, I just set a
4360 workaround).
4369 workaround).
4361
4370
4362 2002-07-08 Fernando Perez <fperez@colorado.edu>
4371 2002-07-08 Fernando Perez <fperez@colorado.edu>
4363
4372
4364 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4373 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4365 __IPYTHON__ in __builtins__ to show up in user_ns.
4374 __IPYTHON__ in __builtins__ to show up in user_ns.
4366
4375
4367 2002-07-03 Fernando Perez <fperez@colorado.edu>
4376 2002-07-03 Fernando Perez <fperez@colorado.edu>
4368
4377
4369 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4378 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4370 name from @gp_set_instance to @gp_set_default.
4379 name from @gp_set_instance to @gp_set_default.
4371
4380
4372 * IPython/ipmaker.py (make_IPython): default editor value set to
4381 * IPython/ipmaker.py (make_IPython): default editor value set to
4373 '0' (a string), to match the rc file. Otherwise will crash when
4382 '0' (a string), to match the rc file. Otherwise will crash when
4374 .strip() is called on it.
4383 .strip() is called on it.
4375
4384
4376
4385
4377 2002-06-28 Fernando Perez <fperez@colorado.edu>
4386 2002-06-28 Fernando Perez <fperez@colorado.edu>
4378
4387
4379 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4388 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4380 of files in current directory when a file is executed via
4389 of files in current directory when a file is executed via
4381 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4390 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4382
4391
4383 * setup.py (manfiles): fix for rpm builds, submitted by RA
4392 * setup.py (manfiles): fix for rpm builds, submitted by RA
4384 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4393 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4385
4394
4386 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4395 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4387 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4396 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4388 string!). A. Schmolck caught this one.
4397 string!). A. Schmolck caught this one.
4389
4398
4390 2002-06-27 Fernando Perez <fperez@colorado.edu>
4399 2002-06-27 Fernando Perez <fperez@colorado.edu>
4391
4400
4392 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4401 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4393 defined files at the cmd line. __name__ wasn't being set to
4402 defined files at the cmd line. __name__ wasn't being set to
4394 __main__.
4403 __main__.
4395
4404
4396 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4405 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4397 regular lists and tuples besides Numeric arrays.
4406 regular lists and tuples besides Numeric arrays.
4398
4407
4399 * IPython/Prompts.py (CachedOutput.__call__): Added output
4408 * IPython/Prompts.py (CachedOutput.__call__): Added output
4400 supression for input ending with ';'. Similar to Mathematica and
4409 supression for input ending with ';'. Similar to Mathematica and
4401 Matlab. The _* vars and Out[] list are still updated, just like
4410 Matlab. The _* vars and Out[] list are still updated, just like
4402 Mathematica behaves.
4411 Mathematica behaves.
4403
4412
4404 2002-06-25 Fernando Perez <fperez@colorado.edu>
4413 2002-06-25 Fernando Perez <fperez@colorado.edu>
4405
4414
4406 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4415 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4407 .ini extensions for profiels under Windows.
4416 .ini extensions for profiels under Windows.
4408
4417
4409 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4418 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4410 string form. Fix contributed by Alexander Schmolck
4419 string form. Fix contributed by Alexander Schmolck
4411 <a.schmolck-AT-gmx.net>
4420 <a.schmolck-AT-gmx.net>
4412
4421
4413 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4422 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4414 pre-configured Gnuplot instance.
4423 pre-configured Gnuplot instance.
4415
4424
4416 2002-06-21 Fernando Perez <fperez@colorado.edu>
4425 2002-06-21 Fernando Perez <fperez@colorado.edu>
4417
4426
4418 * IPython/numutils.py (exp_safe): new function, works around the
4427 * IPython/numutils.py (exp_safe): new function, works around the
4419 underflow problems in Numeric.
4428 underflow problems in Numeric.
4420 (log2): New fn. Safe log in base 2: returns exact integer answer
4429 (log2): New fn. Safe log in base 2: returns exact integer answer
4421 for exact integer powers of 2.
4430 for exact integer powers of 2.
4422
4431
4423 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4432 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4424 properly.
4433 properly.
4425
4434
4426 2002-06-20 Fernando Perez <fperez@colorado.edu>
4435 2002-06-20 Fernando Perez <fperez@colorado.edu>
4427
4436
4428 * IPython/genutils.py (timing): new function like
4437 * IPython/genutils.py (timing): new function like
4429 Mathematica's. Similar to time_test, but returns more info.
4438 Mathematica's. Similar to time_test, but returns more info.
4430
4439
4431 2002-06-18 Fernando Perez <fperez@colorado.edu>
4440 2002-06-18 Fernando Perez <fperez@colorado.edu>
4432
4441
4433 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4442 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4434 according to Mike Heeter's suggestions.
4443 according to Mike Heeter's suggestions.
4435
4444
4436 2002-06-16 Fernando Perez <fperez@colorado.edu>
4445 2002-06-16 Fernando Perez <fperez@colorado.edu>
4437
4446
4438 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4447 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4439 system. GnuplotMagic is gone as a user-directory option. New files
4448 system. GnuplotMagic is gone as a user-directory option. New files
4440 make it easier to use all the gnuplot stuff both from external
4449 make it easier to use all the gnuplot stuff both from external
4441 programs as well as from IPython. Had to rewrite part of
4450 programs as well as from IPython. Had to rewrite part of
4442 hardcopy() b/c of a strange bug: often the ps files simply don't
4451 hardcopy() b/c of a strange bug: often the ps files simply don't
4443 get created, and require a repeat of the command (often several
4452 get created, and require a repeat of the command (often several
4444 times).
4453 times).
4445
4454
4446 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4455 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4447 resolve output channel at call time, so that if sys.stderr has
4456 resolve output channel at call time, so that if sys.stderr has
4448 been redirected by user this gets honored.
4457 been redirected by user this gets honored.
4449
4458
4450 2002-06-13 Fernando Perez <fperez@colorado.edu>
4459 2002-06-13 Fernando Perez <fperez@colorado.edu>
4451
4460
4452 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4461 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4453 IPShell. Kept a copy with the old names to avoid breaking people's
4462 IPShell. Kept a copy with the old names to avoid breaking people's
4454 embedded code.
4463 embedded code.
4455
4464
4456 * IPython/ipython: simplified it to the bare minimum after
4465 * IPython/ipython: simplified it to the bare minimum after
4457 Holger's suggestions. Added info about how to use it in
4466 Holger's suggestions. Added info about how to use it in
4458 PYTHONSTARTUP.
4467 PYTHONSTARTUP.
4459
4468
4460 * IPython/Shell.py (IPythonShell): changed the options passing
4469 * IPython/Shell.py (IPythonShell): changed the options passing
4461 from a string with funky %s replacements to a straight list. Maybe
4470 from a string with funky %s replacements to a straight list. Maybe
4462 a bit more typing, but it follows sys.argv conventions, so there's
4471 a bit more typing, but it follows sys.argv conventions, so there's
4463 less special-casing to remember.
4472 less special-casing to remember.
4464
4473
4465 2002-06-12 Fernando Perez <fperez@colorado.edu>
4474 2002-06-12 Fernando Perez <fperez@colorado.edu>
4466
4475
4467 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4476 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4468 command. Thanks to a suggestion by Mike Heeter.
4477 command. Thanks to a suggestion by Mike Heeter.
4469 (Magic.magic_pfile): added behavior to look at filenames if given
4478 (Magic.magic_pfile): added behavior to look at filenames if given
4470 arg is not a defined object.
4479 arg is not a defined object.
4471 (Magic.magic_save): New @save function to save code snippets. Also
4480 (Magic.magic_save): New @save function to save code snippets. Also
4472 a Mike Heeter idea.
4481 a Mike Heeter idea.
4473
4482
4474 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4483 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4475 plot() and replot(). Much more convenient now, especially for
4484 plot() and replot(). Much more convenient now, especially for
4476 interactive use.
4485 interactive use.
4477
4486
4478 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4487 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4479 filenames.
4488 filenames.
4480
4489
4481 2002-06-02 Fernando Perez <fperez@colorado.edu>
4490 2002-06-02 Fernando Perez <fperez@colorado.edu>
4482
4491
4483 * IPython/Struct.py (Struct.__init__): modified to admit
4492 * IPython/Struct.py (Struct.__init__): modified to admit
4484 initialization via another struct.
4493 initialization via another struct.
4485
4494
4486 * IPython/genutils.py (SystemExec.__init__): New stateful
4495 * IPython/genutils.py (SystemExec.__init__): New stateful
4487 interface to xsys and bq. Useful for writing system scripts.
4496 interface to xsys and bq. Useful for writing system scripts.
4488
4497
4489 2002-05-30 Fernando Perez <fperez@colorado.edu>
4498 2002-05-30 Fernando Perez <fperez@colorado.edu>
4490
4499
4491 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4500 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4492 documents. This will make the user download smaller (it's getting
4501 documents. This will make the user download smaller (it's getting
4493 too big).
4502 too big).
4494
4503
4495 2002-05-29 Fernando Perez <fperez@colorado.edu>
4504 2002-05-29 Fernando Perez <fperez@colorado.edu>
4496
4505
4497 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4506 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4498 fix problems with shelve and pickle. Seems to work, but I don't
4507 fix problems with shelve and pickle. Seems to work, but I don't
4499 know if corner cases break it. Thanks to Mike Heeter
4508 know if corner cases break it. Thanks to Mike Heeter
4500 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4509 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4501
4510
4502 2002-05-24 Fernando Perez <fperez@colorado.edu>
4511 2002-05-24 Fernando Perez <fperez@colorado.edu>
4503
4512
4504 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4513 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4505 macros having broken.
4514 macros having broken.
4506
4515
4507 2002-05-21 Fernando Perez <fperez@colorado.edu>
4516 2002-05-21 Fernando Perez <fperez@colorado.edu>
4508
4517
4509 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4518 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4510 introduced logging bug: all history before logging started was
4519 introduced logging bug: all history before logging started was
4511 being written one character per line! This came from the redesign
4520 being written one character per line! This came from the redesign
4512 of the input history as a special list which slices to strings,
4521 of the input history as a special list which slices to strings,
4513 not to lists.
4522 not to lists.
4514
4523
4515 2002-05-20 Fernando Perez <fperez@colorado.edu>
4524 2002-05-20 Fernando Perez <fperez@colorado.edu>
4516
4525
4517 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4526 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4518 be an attribute of all classes in this module. The design of these
4527 be an attribute of all classes in this module. The design of these
4519 classes needs some serious overhauling.
4528 classes needs some serious overhauling.
4520
4529
4521 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4530 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4522 which was ignoring '_' in option names.
4531 which was ignoring '_' in option names.
4523
4532
4524 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4533 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4525 'Verbose_novars' to 'Context' and made it the new default. It's a
4534 'Verbose_novars' to 'Context' and made it the new default. It's a
4526 bit more readable and also safer than verbose.
4535 bit more readable and also safer than verbose.
4527
4536
4528 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4537 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4529 triple-quoted strings.
4538 triple-quoted strings.
4530
4539
4531 * IPython/OInspect.py (__all__): new module exposing the object
4540 * IPython/OInspect.py (__all__): new module exposing the object
4532 introspection facilities. Now the corresponding magics are dummy
4541 introspection facilities. Now the corresponding magics are dummy
4533 wrappers around this. Having this module will make it much easier
4542 wrappers around this. Having this module will make it much easier
4534 to put these functions into our modified pdb.
4543 to put these functions into our modified pdb.
4535 This new object inspector system uses the new colorizing module,
4544 This new object inspector system uses the new colorizing module,
4536 so source code and other things are nicely syntax highlighted.
4545 so source code and other things are nicely syntax highlighted.
4537
4546
4538 2002-05-18 Fernando Perez <fperez@colorado.edu>
4547 2002-05-18 Fernando Perez <fperez@colorado.edu>
4539
4548
4540 * IPython/ColorANSI.py: Split the coloring tools into a separate
4549 * IPython/ColorANSI.py: Split the coloring tools into a separate
4541 module so I can use them in other code easier (they were part of
4550 module so I can use them in other code easier (they were part of
4542 ultraTB).
4551 ultraTB).
4543
4552
4544 2002-05-17 Fernando Perez <fperez@colorado.edu>
4553 2002-05-17 Fernando Perez <fperez@colorado.edu>
4545
4554
4546 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4555 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4547 fixed it to set the global 'g' also to the called instance, as
4556 fixed it to set the global 'g' also to the called instance, as
4548 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4557 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4549 user's 'g' variables).
4558 user's 'g' variables).
4550
4559
4551 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4560 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4552 global variables (aliases to _ih,_oh) so that users which expect
4561 global variables (aliases to _ih,_oh) so that users which expect
4553 In[5] or Out[7] to work aren't unpleasantly surprised.
4562 In[5] or Out[7] to work aren't unpleasantly surprised.
4554 (InputList.__getslice__): new class to allow executing slices of
4563 (InputList.__getslice__): new class to allow executing slices of
4555 input history directly. Very simple class, complements the use of
4564 input history directly. Very simple class, complements the use of
4556 macros.
4565 macros.
4557
4566
4558 2002-05-16 Fernando Perez <fperez@colorado.edu>
4567 2002-05-16 Fernando Perez <fperez@colorado.edu>
4559
4568
4560 * setup.py (docdirbase): make doc directory be just doc/IPython
4569 * setup.py (docdirbase): make doc directory be just doc/IPython
4561 without version numbers, it will reduce clutter for users.
4570 without version numbers, it will reduce clutter for users.
4562
4571
4563 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4572 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4564 execfile call to prevent possible memory leak. See for details:
4573 execfile call to prevent possible memory leak. See for details:
4565 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4574 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4566
4575
4567 2002-05-15 Fernando Perez <fperez@colorado.edu>
4576 2002-05-15 Fernando Perez <fperez@colorado.edu>
4568
4577
4569 * IPython/Magic.py (Magic.magic_psource): made the object
4578 * IPython/Magic.py (Magic.magic_psource): made the object
4570 introspection names be more standard: pdoc, pdef, pfile and
4579 introspection names be more standard: pdoc, pdef, pfile and
4571 psource. They all print/page their output, and it makes
4580 psource. They all print/page their output, and it makes
4572 remembering them easier. Kept old names for compatibility as
4581 remembering them easier. Kept old names for compatibility as
4573 aliases.
4582 aliases.
4574
4583
4575 2002-05-14 Fernando Perez <fperez@colorado.edu>
4584 2002-05-14 Fernando Perez <fperez@colorado.edu>
4576
4585
4577 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4586 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4578 what the mouse problem was. The trick is to use gnuplot with temp
4587 what the mouse problem was. The trick is to use gnuplot with temp
4579 files and NOT with pipes (for data communication), because having
4588 files and NOT with pipes (for data communication), because having
4580 both pipes and the mouse on is bad news.
4589 both pipes and the mouse on is bad news.
4581
4590
4582 2002-05-13 Fernando Perez <fperez@colorado.edu>
4591 2002-05-13 Fernando Perez <fperez@colorado.edu>
4583
4592
4584 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4593 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4585 bug. Information would be reported about builtins even when
4594 bug. Information would be reported about builtins even when
4586 user-defined functions overrode them.
4595 user-defined functions overrode them.
4587
4596
4588 2002-05-11 Fernando Perez <fperez@colorado.edu>
4597 2002-05-11 Fernando Perez <fperez@colorado.edu>
4589
4598
4590 * IPython/__init__.py (__all__): removed FlexCompleter from
4599 * IPython/__init__.py (__all__): removed FlexCompleter from
4591 __all__ so that things don't fail in platforms without readline.
4600 __all__ so that things don't fail in platforms without readline.
4592
4601
4593 2002-05-10 Fernando Perez <fperez@colorado.edu>
4602 2002-05-10 Fernando Perez <fperez@colorado.edu>
4594
4603
4595 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4604 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4596 it requires Numeric, effectively making Numeric a dependency for
4605 it requires Numeric, effectively making Numeric a dependency for
4597 IPython.
4606 IPython.
4598
4607
4599 * Released 0.2.13
4608 * Released 0.2.13
4600
4609
4601 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4610 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4602 profiler interface. Now all the major options from the profiler
4611 profiler interface. Now all the major options from the profiler
4603 module are directly supported in IPython, both for single
4612 module are directly supported in IPython, both for single
4604 expressions (@prun) and for full programs (@run -p).
4613 expressions (@prun) and for full programs (@run -p).
4605
4614
4606 2002-05-09 Fernando Perez <fperez@colorado.edu>
4615 2002-05-09 Fernando Perez <fperez@colorado.edu>
4607
4616
4608 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4617 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4609 magic properly formatted for screen.
4618 magic properly formatted for screen.
4610
4619
4611 * setup.py (make_shortcut): Changed things to put pdf version in
4620 * setup.py (make_shortcut): Changed things to put pdf version in
4612 doc/ instead of doc/manual (had to change lyxport a bit).
4621 doc/ instead of doc/manual (had to change lyxport a bit).
4613
4622
4614 * IPython/Magic.py (Profile.string_stats): made profile runs go
4623 * IPython/Magic.py (Profile.string_stats): made profile runs go
4615 through pager (they are long and a pager allows searching, saving,
4624 through pager (they are long and a pager allows searching, saving,
4616 etc.)
4625 etc.)
4617
4626
4618 2002-05-08 Fernando Perez <fperez@colorado.edu>
4627 2002-05-08 Fernando Perez <fperez@colorado.edu>
4619
4628
4620 * Released 0.2.12
4629 * Released 0.2.12
4621
4630
4622 2002-05-06 Fernando Perez <fperez@colorado.edu>
4631 2002-05-06 Fernando Perez <fperez@colorado.edu>
4623
4632
4624 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4633 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4625 introduced); 'hist n1 n2' was broken.
4634 introduced); 'hist n1 n2' was broken.
4626 (Magic.magic_pdb): added optional on/off arguments to @pdb
4635 (Magic.magic_pdb): added optional on/off arguments to @pdb
4627 (Magic.magic_run): added option -i to @run, which executes code in
4636 (Magic.magic_run): added option -i to @run, which executes code in
4628 the IPython namespace instead of a clean one. Also added @irun as
4637 the IPython namespace instead of a clean one. Also added @irun as
4629 an alias to @run -i.
4638 an alias to @run -i.
4630
4639
4631 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4640 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4632 fixed (it didn't really do anything, the namespaces were wrong).
4641 fixed (it didn't really do anything, the namespaces were wrong).
4633
4642
4634 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4643 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4635
4644
4636 * IPython/__init__.py (__all__): Fixed package namespace, now
4645 * IPython/__init__.py (__all__): Fixed package namespace, now
4637 'import IPython' does give access to IPython.<all> as
4646 'import IPython' does give access to IPython.<all> as
4638 expected. Also renamed __release__ to Release.
4647 expected. Also renamed __release__ to Release.
4639
4648
4640 * IPython/Debugger.py (__license__): created new Pdb class which
4649 * IPython/Debugger.py (__license__): created new Pdb class which
4641 functions like a drop-in for the normal pdb.Pdb but does NOT
4650 functions like a drop-in for the normal pdb.Pdb but does NOT
4642 import readline by default. This way it doesn't muck up IPython's
4651 import readline by default. This way it doesn't muck up IPython's
4643 readline handling, and now tab-completion finally works in the
4652 readline handling, and now tab-completion finally works in the
4644 debugger -- sort of. It completes things globally visible, but the
4653 debugger -- sort of. It completes things globally visible, but the
4645 completer doesn't track the stack as pdb walks it. That's a bit
4654 completer doesn't track the stack as pdb walks it. That's a bit
4646 tricky, and I'll have to implement it later.
4655 tricky, and I'll have to implement it later.
4647
4656
4648 2002-05-05 Fernando Perez <fperez@colorado.edu>
4657 2002-05-05 Fernando Perez <fperez@colorado.edu>
4649
4658
4650 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4659 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4651 magic docstrings when printed via ? (explicit \'s were being
4660 magic docstrings when printed via ? (explicit \'s were being
4652 printed).
4661 printed).
4653
4662
4654 * IPython/ipmaker.py (make_IPython): fixed namespace
4663 * IPython/ipmaker.py (make_IPython): fixed namespace
4655 identification bug. Now variables loaded via logs or command-line
4664 identification bug. Now variables loaded via logs or command-line
4656 files are recognized in the interactive namespace by @who.
4665 files are recognized in the interactive namespace by @who.
4657
4666
4658 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4667 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4659 log replay system stemming from the string form of Structs.
4668 log replay system stemming from the string form of Structs.
4660
4669
4661 * IPython/Magic.py (Macro.__init__): improved macros to properly
4670 * IPython/Magic.py (Macro.__init__): improved macros to properly
4662 handle magic commands in them.
4671 handle magic commands in them.
4663 (Magic.magic_logstart): usernames are now expanded so 'logstart
4672 (Magic.magic_logstart): usernames are now expanded so 'logstart
4664 ~/mylog' now works.
4673 ~/mylog' now works.
4665
4674
4666 * IPython/iplib.py (complete): fixed bug where paths starting with
4675 * IPython/iplib.py (complete): fixed bug where paths starting with
4667 '/' would be completed as magic names.
4676 '/' would be completed as magic names.
4668
4677
4669 2002-05-04 Fernando Perez <fperez@colorado.edu>
4678 2002-05-04 Fernando Perez <fperez@colorado.edu>
4670
4679
4671 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4680 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4672 allow running full programs under the profiler's control.
4681 allow running full programs under the profiler's control.
4673
4682
4674 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4683 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4675 mode to report exceptions verbosely but without formatting
4684 mode to report exceptions verbosely but without formatting
4676 variables. This addresses the issue of ipython 'freezing' (it's
4685 variables. This addresses the issue of ipython 'freezing' (it's
4677 not frozen, but caught in an expensive formatting loop) when huge
4686 not frozen, but caught in an expensive formatting loop) when huge
4678 variables are in the context of an exception.
4687 variables are in the context of an exception.
4679 (VerboseTB.text): Added '--->' markers at line where exception was
4688 (VerboseTB.text): Added '--->' markers at line where exception was
4680 triggered. Much clearer to read, especially in NoColor modes.
4689 triggered. Much clearer to read, especially in NoColor modes.
4681
4690
4682 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4691 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4683 implemented in reverse when changing to the new parse_options().
4692 implemented in reverse when changing to the new parse_options().
4684
4693
4685 2002-05-03 Fernando Perez <fperez@colorado.edu>
4694 2002-05-03 Fernando Perez <fperez@colorado.edu>
4686
4695
4687 * IPython/Magic.py (Magic.parse_options): new function so that
4696 * IPython/Magic.py (Magic.parse_options): new function so that
4688 magics can parse options easier.
4697 magics can parse options easier.
4689 (Magic.magic_prun): new function similar to profile.run(),
4698 (Magic.magic_prun): new function similar to profile.run(),
4690 suggested by Chris Hart.
4699 suggested by Chris Hart.
4691 (Magic.magic_cd): fixed behavior so that it only changes if
4700 (Magic.magic_cd): fixed behavior so that it only changes if
4692 directory actually is in history.
4701 directory actually is in history.
4693
4702
4694 * IPython/usage.py (__doc__): added information about potential
4703 * IPython/usage.py (__doc__): added information about potential
4695 slowness of Verbose exception mode when there are huge data
4704 slowness of Verbose exception mode when there are huge data
4696 structures to be formatted (thanks to Archie Paulson).
4705 structures to be formatted (thanks to Archie Paulson).
4697
4706
4698 * IPython/ipmaker.py (make_IPython): Changed default logging
4707 * IPython/ipmaker.py (make_IPython): Changed default logging
4699 (when simply called with -log) to use curr_dir/ipython.log in
4708 (when simply called with -log) to use curr_dir/ipython.log in
4700 rotate mode. Fixed crash which was occuring with -log before
4709 rotate mode. Fixed crash which was occuring with -log before
4701 (thanks to Jim Boyle).
4710 (thanks to Jim Boyle).
4702
4711
4703 2002-05-01 Fernando Perez <fperez@colorado.edu>
4712 2002-05-01 Fernando Perez <fperez@colorado.edu>
4704
4713
4705 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4714 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4706 was nasty -- though somewhat of a corner case).
4715 was nasty -- though somewhat of a corner case).
4707
4716
4708 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4717 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4709 text (was a bug).
4718 text (was a bug).
4710
4719
4711 2002-04-30 Fernando Perez <fperez@colorado.edu>
4720 2002-04-30 Fernando Perez <fperez@colorado.edu>
4712
4721
4713 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4722 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4714 a print after ^D or ^C from the user so that the In[] prompt
4723 a print after ^D or ^C from the user so that the In[] prompt
4715 doesn't over-run the gnuplot one.
4724 doesn't over-run the gnuplot one.
4716
4725
4717 2002-04-29 Fernando Perez <fperez@colorado.edu>
4726 2002-04-29 Fernando Perez <fperez@colorado.edu>
4718
4727
4719 * Released 0.2.10
4728 * Released 0.2.10
4720
4729
4721 * IPython/__release__.py (version): get date dynamically.
4730 * IPython/__release__.py (version): get date dynamically.
4722
4731
4723 * Misc. documentation updates thanks to Arnd's comments. Also ran
4732 * Misc. documentation updates thanks to Arnd's comments. Also ran
4724 a full spellcheck on the manual (hadn't been done in a while).
4733 a full spellcheck on the manual (hadn't been done in a while).
4725
4734
4726 2002-04-27 Fernando Perez <fperez@colorado.edu>
4735 2002-04-27 Fernando Perez <fperez@colorado.edu>
4727
4736
4728 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4737 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4729 starting a log in mid-session would reset the input history list.
4738 starting a log in mid-session would reset the input history list.
4730
4739
4731 2002-04-26 Fernando Perez <fperez@colorado.edu>
4740 2002-04-26 Fernando Perez <fperez@colorado.edu>
4732
4741
4733 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4742 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4734 all files were being included in an update. Now anything in
4743 all files were being included in an update. Now anything in
4735 UserConfig that matches [A-Za-z]*.py will go (this excludes
4744 UserConfig that matches [A-Za-z]*.py will go (this excludes
4736 __init__.py)
4745 __init__.py)
4737
4746
4738 2002-04-25 Fernando Perez <fperez@colorado.edu>
4747 2002-04-25 Fernando Perez <fperez@colorado.edu>
4739
4748
4740 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4749 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4741 to __builtins__ so that any form of embedded or imported code can
4750 to __builtins__ so that any form of embedded or imported code can
4742 test for being inside IPython.
4751 test for being inside IPython.
4743
4752
4744 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4753 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4745 changed to GnuplotMagic because it's now an importable module,
4754 changed to GnuplotMagic because it's now an importable module,
4746 this makes the name follow that of the standard Gnuplot module.
4755 this makes the name follow that of the standard Gnuplot module.
4747 GnuplotMagic can now be loaded at any time in mid-session.
4756 GnuplotMagic can now be loaded at any time in mid-session.
4748
4757
4749 2002-04-24 Fernando Perez <fperez@colorado.edu>
4758 2002-04-24 Fernando Perez <fperez@colorado.edu>
4750
4759
4751 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4760 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4752 the globals (IPython has its own namespace) and the
4761 the globals (IPython has its own namespace) and the
4753 PhysicalQuantity stuff is much better anyway.
4762 PhysicalQuantity stuff is much better anyway.
4754
4763
4755 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4764 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4756 embedding example to standard user directory for
4765 embedding example to standard user directory for
4757 distribution. Also put it in the manual.
4766 distribution. Also put it in the manual.
4758
4767
4759 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4768 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4760 instance as first argument (so it doesn't rely on some obscure
4769 instance as first argument (so it doesn't rely on some obscure
4761 hidden global).
4770 hidden global).
4762
4771
4763 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4772 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4764 delimiters. While it prevents ().TAB from working, it allows
4773 delimiters. While it prevents ().TAB from working, it allows
4765 completions in open (... expressions. This is by far a more common
4774 completions in open (... expressions. This is by far a more common
4766 case.
4775 case.
4767
4776
4768 2002-04-23 Fernando Perez <fperez@colorado.edu>
4777 2002-04-23 Fernando Perez <fperez@colorado.edu>
4769
4778
4770 * IPython/Extensions/InterpreterPasteInput.py: new
4779 * IPython/Extensions/InterpreterPasteInput.py: new
4771 syntax-processing module for pasting lines with >>> or ... at the
4780 syntax-processing module for pasting lines with >>> or ... at the
4772 start.
4781 start.
4773
4782
4774 * IPython/Extensions/PhysicalQ_Interactive.py
4783 * IPython/Extensions/PhysicalQ_Interactive.py
4775 (PhysicalQuantityInteractive.__int__): fixed to work with either
4784 (PhysicalQuantityInteractive.__int__): fixed to work with either
4776 Numeric or math.
4785 Numeric or math.
4777
4786
4778 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4787 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4779 provided profiles. Now we have:
4788 provided profiles. Now we have:
4780 -math -> math module as * and cmath with its own namespace.
4789 -math -> math module as * and cmath with its own namespace.
4781 -numeric -> Numeric as *, plus gnuplot & grace
4790 -numeric -> Numeric as *, plus gnuplot & grace
4782 -physics -> same as before
4791 -physics -> same as before
4783
4792
4784 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4793 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4785 user-defined magics wouldn't be found by @magic if they were
4794 user-defined magics wouldn't be found by @magic if they were
4786 defined as class methods. Also cleaned up the namespace search
4795 defined as class methods. Also cleaned up the namespace search
4787 logic and the string building (to use %s instead of many repeated
4796 logic and the string building (to use %s instead of many repeated
4788 string adds).
4797 string adds).
4789
4798
4790 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4799 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4791 of user-defined magics to operate with class methods (cleaner, in
4800 of user-defined magics to operate with class methods (cleaner, in
4792 line with the gnuplot code).
4801 line with the gnuplot code).
4793
4802
4794 2002-04-22 Fernando Perez <fperez@colorado.edu>
4803 2002-04-22 Fernando Perez <fperez@colorado.edu>
4795
4804
4796 * setup.py: updated dependency list so that manual is updated when
4805 * setup.py: updated dependency list so that manual is updated when
4797 all included files change.
4806 all included files change.
4798
4807
4799 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4808 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4800 the delimiter removal option (the fix is ugly right now).
4809 the delimiter removal option (the fix is ugly right now).
4801
4810
4802 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4811 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4803 all of the math profile (quicker loading, no conflict between
4812 all of the math profile (quicker loading, no conflict between
4804 g-9.8 and g-gnuplot).
4813 g-9.8 and g-gnuplot).
4805
4814
4806 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4815 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4807 name of post-mortem files to IPython_crash_report.txt.
4816 name of post-mortem files to IPython_crash_report.txt.
4808
4817
4809 * Cleanup/update of the docs. Added all the new readline info and
4818 * Cleanup/update of the docs. Added all the new readline info and
4810 formatted all lists as 'real lists'.
4819 formatted all lists as 'real lists'.
4811
4820
4812 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4821 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4813 tab-completion options, since the full readline parse_and_bind is
4822 tab-completion options, since the full readline parse_and_bind is
4814 now accessible.
4823 now accessible.
4815
4824
4816 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4825 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4817 handling of readline options. Now users can specify any string to
4826 handling of readline options. Now users can specify any string to
4818 be passed to parse_and_bind(), as well as the delimiters to be
4827 be passed to parse_and_bind(), as well as the delimiters to be
4819 removed.
4828 removed.
4820 (InteractiveShell.__init__): Added __name__ to the global
4829 (InteractiveShell.__init__): Added __name__ to the global
4821 namespace so that things like Itpl which rely on its existence
4830 namespace so that things like Itpl which rely on its existence
4822 don't crash.
4831 don't crash.
4823 (InteractiveShell._prefilter): Defined the default with a _ so
4832 (InteractiveShell._prefilter): Defined the default with a _ so
4824 that prefilter() is easier to override, while the default one
4833 that prefilter() is easier to override, while the default one
4825 remains available.
4834 remains available.
4826
4835
4827 2002-04-18 Fernando Perez <fperez@colorado.edu>
4836 2002-04-18 Fernando Perez <fperez@colorado.edu>
4828
4837
4829 * Added information about pdb in the docs.
4838 * Added information about pdb in the docs.
4830
4839
4831 2002-04-17 Fernando Perez <fperez@colorado.edu>
4840 2002-04-17 Fernando Perez <fperez@colorado.edu>
4832
4841
4833 * IPython/ipmaker.py (make_IPython): added rc_override option to
4842 * IPython/ipmaker.py (make_IPython): added rc_override option to
4834 allow passing config options at creation time which may override
4843 allow passing config options at creation time which may override
4835 anything set in the config files or command line. This is
4844 anything set in the config files or command line. This is
4836 particularly useful for configuring embedded instances.
4845 particularly useful for configuring embedded instances.
4837
4846
4838 2002-04-15 Fernando Perez <fperez@colorado.edu>
4847 2002-04-15 Fernando Perez <fperez@colorado.edu>
4839
4848
4840 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4849 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4841 crash embedded instances because of the input cache falling out of
4850 crash embedded instances because of the input cache falling out of
4842 sync with the output counter.
4851 sync with the output counter.
4843
4852
4844 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4853 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4845 mode which calls pdb after an uncaught exception in IPython itself.
4854 mode which calls pdb after an uncaught exception in IPython itself.
4846
4855
4847 2002-04-14 Fernando Perez <fperez@colorado.edu>
4856 2002-04-14 Fernando Perez <fperez@colorado.edu>
4848
4857
4849 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4858 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4850 readline, fix it back after each call.
4859 readline, fix it back after each call.
4851
4860
4852 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4861 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4853 method to force all access via __call__(), which guarantees that
4862 method to force all access via __call__(), which guarantees that
4854 traceback references are properly deleted.
4863 traceback references are properly deleted.
4855
4864
4856 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4865 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4857 improve printing when pprint is in use.
4866 improve printing when pprint is in use.
4858
4867
4859 2002-04-13 Fernando Perez <fperez@colorado.edu>
4868 2002-04-13 Fernando Perez <fperez@colorado.edu>
4860
4869
4861 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4870 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4862 exceptions aren't caught anymore. If the user triggers one, he
4871 exceptions aren't caught anymore. If the user triggers one, he
4863 should know why he's doing it and it should go all the way up,
4872 should know why he's doing it and it should go all the way up,
4864 just like any other exception. So now @abort will fully kill the
4873 just like any other exception. So now @abort will fully kill the
4865 embedded interpreter and the embedding code (unless that happens
4874 embedded interpreter and the embedding code (unless that happens
4866 to catch SystemExit).
4875 to catch SystemExit).
4867
4876
4868 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4877 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4869 and a debugger() method to invoke the interactive pdb debugger
4878 and a debugger() method to invoke the interactive pdb debugger
4870 after printing exception information. Also added the corresponding
4879 after printing exception information. Also added the corresponding
4871 -pdb option and @pdb magic to control this feature, and updated
4880 -pdb option and @pdb magic to control this feature, and updated
4872 the docs. After a suggestion from Christopher Hart
4881 the docs. After a suggestion from Christopher Hart
4873 (hart-AT-caltech.edu).
4882 (hart-AT-caltech.edu).
4874
4883
4875 2002-04-12 Fernando Perez <fperez@colorado.edu>
4884 2002-04-12 Fernando Perez <fperez@colorado.edu>
4876
4885
4877 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4886 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4878 the exception handlers defined by the user (not the CrashHandler)
4887 the exception handlers defined by the user (not the CrashHandler)
4879 so that user exceptions don't trigger an ipython bug report.
4888 so that user exceptions don't trigger an ipython bug report.
4880
4889
4881 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4890 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4882 configurable (it should have always been so).
4891 configurable (it should have always been so).
4883
4892
4884 2002-03-26 Fernando Perez <fperez@colorado.edu>
4893 2002-03-26 Fernando Perez <fperez@colorado.edu>
4885
4894
4886 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4895 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4887 and there to fix embedding namespace issues. This should all be
4896 and there to fix embedding namespace issues. This should all be
4888 done in a more elegant way.
4897 done in a more elegant way.
4889
4898
4890 2002-03-25 Fernando Perez <fperez@colorado.edu>
4899 2002-03-25 Fernando Perez <fperez@colorado.edu>
4891
4900
4892 * IPython/genutils.py (get_home_dir): Try to make it work under
4901 * IPython/genutils.py (get_home_dir): Try to make it work under
4893 win9x also.
4902 win9x also.
4894
4903
4895 2002-03-20 Fernando Perez <fperez@colorado.edu>
4904 2002-03-20 Fernando Perez <fperez@colorado.edu>
4896
4905
4897 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4906 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4898 sys.displayhook untouched upon __init__.
4907 sys.displayhook untouched upon __init__.
4899
4908
4900 2002-03-19 Fernando Perez <fperez@colorado.edu>
4909 2002-03-19 Fernando Perez <fperez@colorado.edu>
4901
4910
4902 * Released 0.2.9 (for embedding bug, basically).
4911 * Released 0.2.9 (for embedding bug, basically).
4903
4912
4904 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4913 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4905 exceptions so that enclosing shell's state can be restored.
4914 exceptions so that enclosing shell's state can be restored.
4906
4915
4907 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4916 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4908 naming conventions in the .ipython/ dir.
4917 naming conventions in the .ipython/ dir.
4909
4918
4910 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4919 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4911 from delimiters list so filenames with - in them get expanded.
4920 from delimiters list so filenames with - in them get expanded.
4912
4921
4913 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4922 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4914 sys.displayhook not being properly restored after an embedded call.
4923 sys.displayhook not being properly restored after an embedded call.
4915
4924
4916 2002-03-18 Fernando Perez <fperez@colorado.edu>
4925 2002-03-18 Fernando Perez <fperez@colorado.edu>
4917
4926
4918 * Released 0.2.8
4927 * Released 0.2.8
4919
4928
4920 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4929 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4921 some files weren't being included in a -upgrade.
4930 some files weren't being included in a -upgrade.
4922 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4931 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4923 on' so that the first tab completes.
4932 on' so that the first tab completes.
4924 (InteractiveShell.handle_magic): fixed bug with spaces around
4933 (InteractiveShell.handle_magic): fixed bug with spaces around
4925 quotes breaking many magic commands.
4934 quotes breaking many magic commands.
4926
4935
4927 * setup.py: added note about ignoring the syntax error messages at
4936 * setup.py: added note about ignoring the syntax error messages at
4928 installation.
4937 installation.
4929
4938
4930 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4939 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4931 streamlining the gnuplot interface, now there's only one magic @gp.
4940 streamlining the gnuplot interface, now there's only one magic @gp.
4932
4941
4933 2002-03-17 Fernando Perez <fperez@colorado.edu>
4942 2002-03-17 Fernando Perez <fperez@colorado.edu>
4934
4943
4935 * IPython/UserConfig/magic_gnuplot.py: new name for the
4944 * IPython/UserConfig/magic_gnuplot.py: new name for the
4936 example-magic_pm.py file. Much enhanced system, now with a shell
4945 example-magic_pm.py file. Much enhanced system, now with a shell
4937 for communicating directly with gnuplot, one command at a time.
4946 for communicating directly with gnuplot, one command at a time.
4938
4947
4939 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4948 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4940 setting __name__=='__main__'.
4949 setting __name__=='__main__'.
4941
4950
4942 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4951 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4943 mini-shell for accessing gnuplot from inside ipython. Should
4952 mini-shell for accessing gnuplot from inside ipython. Should
4944 extend it later for grace access too. Inspired by Arnd's
4953 extend it later for grace access too. Inspired by Arnd's
4945 suggestion.
4954 suggestion.
4946
4955
4947 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4956 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4948 calling magic functions with () in their arguments. Thanks to Arnd
4957 calling magic functions with () in their arguments. Thanks to Arnd
4949 Baecker for pointing this to me.
4958 Baecker for pointing this to me.
4950
4959
4951 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4960 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4952 infinitely for integer or complex arrays (only worked with floats).
4961 infinitely for integer or complex arrays (only worked with floats).
4953
4962
4954 2002-03-16 Fernando Perez <fperez@colorado.edu>
4963 2002-03-16 Fernando Perez <fperez@colorado.edu>
4955
4964
4956 * setup.py: Merged setup and setup_windows into a single script
4965 * setup.py: Merged setup and setup_windows into a single script
4957 which properly handles things for windows users.
4966 which properly handles things for windows users.
4958
4967
4959 2002-03-15 Fernando Perez <fperez@colorado.edu>
4968 2002-03-15 Fernando Perez <fperez@colorado.edu>
4960
4969
4961 * Big change to the manual: now the magics are all automatically
4970 * Big change to the manual: now the magics are all automatically
4962 documented. This information is generated from their docstrings
4971 documented. This information is generated from their docstrings
4963 and put in a latex file included by the manual lyx file. This way
4972 and put in a latex file included by the manual lyx file. This way
4964 we get always up to date information for the magics. The manual
4973 we get always up to date information for the magics. The manual
4965 now also has proper version information, also auto-synced.
4974 now also has proper version information, also auto-synced.
4966
4975
4967 For this to work, an undocumented --magic_docstrings option was added.
4976 For this to work, an undocumented --magic_docstrings option was added.
4968
4977
4969 2002-03-13 Fernando Perez <fperez@colorado.edu>
4978 2002-03-13 Fernando Perez <fperez@colorado.edu>
4970
4979
4971 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4980 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4972 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4981 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4973
4982
4974 2002-03-12 Fernando Perez <fperez@colorado.edu>
4983 2002-03-12 Fernando Perez <fperez@colorado.edu>
4975
4984
4976 * IPython/ultraTB.py (TermColors): changed color escapes again to
4985 * IPython/ultraTB.py (TermColors): changed color escapes again to
4977 fix the (old, reintroduced) line-wrapping bug. Basically, if
4986 fix the (old, reintroduced) line-wrapping bug. Basically, if
4978 \001..\002 aren't given in the color escapes, lines get wrapped
4987 \001..\002 aren't given in the color escapes, lines get wrapped
4979 weirdly. But giving those screws up old xterms and emacs terms. So
4988 weirdly. But giving those screws up old xterms and emacs terms. So
4980 I added some logic for emacs terms to be ok, but I can't identify old
4989 I added some logic for emacs terms to be ok, but I can't identify old
4981 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4990 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4982
4991
4983 2002-03-10 Fernando Perez <fperez@colorado.edu>
4992 2002-03-10 Fernando Perez <fperez@colorado.edu>
4984
4993
4985 * IPython/usage.py (__doc__): Various documentation cleanups and
4994 * IPython/usage.py (__doc__): Various documentation cleanups and
4986 updates, both in usage docstrings and in the manual.
4995 updates, both in usage docstrings and in the manual.
4987
4996
4988 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4997 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4989 handling of caching. Set minimum acceptabe value for having a
4998 handling of caching. Set minimum acceptabe value for having a
4990 cache at 20 values.
4999 cache at 20 values.
4991
5000
4992 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5001 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4993 install_first_time function to a method, renamed it and added an
5002 install_first_time function to a method, renamed it and added an
4994 'upgrade' mode. Now people can update their config directory with
5003 'upgrade' mode. Now people can update their config directory with
4995 a simple command line switch (-upgrade, also new).
5004 a simple command line switch (-upgrade, also new).
4996
5005
4997 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5006 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4998 @file (convenient for automagic users under Python >= 2.2).
5007 @file (convenient for automagic users under Python >= 2.2).
4999 Removed @files (it seemed more like a plural than an abbrev. of
5008 Removed @files (it seemed more like a plural than an abbrev. of
5000 'file show').
5009 'file show').
5001
5010
5002 * IPython/iplib.py (install_first_time): Fixed crash if there were
5011 * IPython/iplib.py (install_first_time): Fixed crash if there were
5003 backup files ('~') in .ipython/ install directory.
5012 backup files ('~') in .ipython/ install directory.
5004
5013
5005 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5014 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5006 system. Things look fine, but these changes are fairly
5015 system. Things look fine, but these changes are fairly
5007 intrusive. Test them for a few days.
5016 intrusive. Test them for a few days.
5008
5017
5009 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5018 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5010 the prompts system. Now all in/out prompt strings are user
5019 the prompts system. Now all in/out prompt strings are user
5011 controllable. This is particularly useful for embedding, as one
5020 controllable. This is particularly useful for embedding, as one
5012 can tag embedded instances with particular prompts.
5021 can tag embedded instances with particular prompts.
5013
5022
5014 Also removed global use of sys.ps1/2, which now allows nested
5023 Also removed global use of sys.ps1/2, which now allows nested
5015 embeddings without any problems. Added command-line options for
5024 embeddings without any problems. Added command-line options for
5016 the prompt strings.
5025 the prompt strings.
5017
5026
5018 2002-03-08 Fernando Perez <fperez@colorado.edu>
5027 2002-03-08 Fernando Perez <fperez@colorado.edu>
5019
5028
5020 * IPython/UserConfig/example-embed-short.py (ipshell): added
5029 * IPython/UserConfig/example-embed-short.py (ipshell): added
5021 example file with the bare minimum code for embedding.
5030 example file with the bare minimum code for embedding.
5022
5031
5023 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5032 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5024 functionality for the embeddable shell to be activated/deactivated
5033 functionality for the embeddable shell to be activated/deactivated
5025 either globally or at each call.
5034 either globally or at each call.
5026
5035
5027 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5036 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5028 rewriting the prompt with '--->' for auto-inputs with proper
5037 rewriting the prompt with '--->' for auto-inputs with proper
5029 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5038 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5030 this is handled by the prompts class itself, as it should.
5039 this is handled by the prompts class itself, as it should.
5031
5040
5032 2002-03-05 Fernando Perez <fperez@colorado.edu>
5041 2002-03-05 Fernando Perez <fperez@colorado.edu>
5033
5042
5034 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5043 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5035 @logstart to avoid name clashes with the math log function.
5044 @logstart to avoid name clashes with the math log function.
5036
5045
5037 * Big updates to X/Emacs section of the manual.
5046 * Big updates to X/Emacs section of the manual.
5038
5047
5039 * Removed ipython_emacs. Milan explained to me how to pass
5048 * Removed ipython_emacs. Milan explained to me how to pass
5040 arguments to ipython through Emacs. Some day I'm going to end up
5049 arguments to ipython through Emacs. Some day I'm going to end up
5041 learning some lisp...
5050 learning some lisp...
5042
5051
5043 2002-03-04 Fernando Perez <fperez@colorado.edu>
5052 2002-03-04 Fernando Perez <fperez@colorado.edu>
5044
5053
5045 * IPython/ipython_emacs: Created script to be used as the
5054 * IPython/ipython_emacs: Created script to be used as the
5046 py-python-command Emacs variable so we can pass IPython
5055 py-python-command Emacs variable so we can pass IPython
5047 parameters. I can't figure out how to tell Emacs directly to pass
5056 parameters. I can't figure out how to tell Emacs directly to pass
5048 parameters to IPython, so a dummy shell script will do it.
5057 parameters to IPython, so a dummy shell script will do it.
5049
5058
5050 Other enhancements made for things to work better under Emacs'
5059 Other enhancements made for things to work better under Emacs'
5051 various types of terminals. Many thanks to Milan Zamazal
5060 various types of terminals. Many thanks to Milan Zamazal
5052 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5061 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5053
5062
5054 2002-03-01 Fernando Perez <fperez@colorado.edu>
5063 2002-03-01 Fernando Perez <fperez@colorado.edu>
5055
5064
5056 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5065 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5057 that loading of readline is now optional. This gives better
5066 that loading of readline is now optional. This gives better
5058 control to emacs users.
5067 control to emacs users.
5059
5068
5060 * IPython/ultraTB.py (__date__): Modified color escape sequences
5069 * IPython/ultraTB.py (__date__): Modified color escape sequences
5061 and now things work fine under xterm and in Emacs' term buffers
5070 and now things work fine under xterm and in Emacs' term buffers
5062 (though not shell ones). Well, in emacs you get colors, but all
5071 (though not shell ones). Well, in emacs you get colors, but all
5063 seem to be 'light' colors (no difference between dark and light
5072 seem to be 'light' colors (no difference between dark and light
5064 ones). But the garbage chars are gone, and also in xterms. It
5073 ones). But the garbage chars are gone, and also in xterms. It
5065 seems that now I'm using 'cleaner' ansi sequences.
5074 seems that now I'm using 'cleaner' ansi sequences.
5066
5075
5067 2002-02-21 Fernando Perez <fperez@colorado.edu>
5076 2002-02-21 Fernando Perez <fperez@colorado.edu>
5068
5077
5069 * Released 0.2.7 (mainly to publish the scoping fix).
5078 * Released 0.2.7 (mainly to publish the scoping fix).
5070
5079
5071 * IPython/Logger.py (Logger.logstate): added. A corresponding
5080 * IPython/Logger.py (Logger.logstate): added. A corresponding
5072 @logstate magic was created.
5081 @logstate magic was created.
5073
5082
5074 * IPython/Magic.py: fixed nested scoping problem under Python
5083 * IPython/Magic.py: fixed nested scoping problem under Python
5075 2.1.x (automagic wasn't working).
5084 2.1.x (automagic wasn't working).
5076
5085
5077 2002-02-20 Fernando Perez <fperez@colorado.edu>
5086 2002-02-20 Fernando Perez <fperez@colorado.edu>
5078
5087
5079 * Released 0.2.6.
5088 * Released 0.2.6.
5080
5089
5081 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5090 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5082 option so that logs can come out without any headers at all.
5091 option so that logs can come out without any headers at all.
5083
5092
5084 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5093 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5085 SciPy.
5094 SciPy.
5086
5095
5087 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5096 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5088 that embedded IPython calls don't require vars() to be explicitly
5097 that embedded IPython calls don't require vars() to be explicitly
5089 passed. Now they are extracted from the caller's frame (code
5098 passed. Now they are extracted from the caller's frame (code
5090 snatched from Eric Jones' weave). Added better documentation to
5099 snatched from Eric Jones' weave). Added better documentation to
5091 the section on embedding and the example file.
5100 the section on embedding and the example file.
5092
5101
5093 * IPython/genutils.py (page): Changed so that under emacs, it just
5102 * IPython/genutils.py (page): Changed so that under emacs, it just
5094 prints the string. You can then page up and down in the emacs
5103 prints the string. You can then page up and down in the emacs
5095 buffer itself. This is how the builtin help() works.
5104 buffer itself. This is how the builtin help() works.
5096
5105
5097 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5106 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5098 macro scoping: macros need to be executed in the user's namespace
5107 macro scoping: macros need to be executed in the user's namespace
5099 to work as if they had been typed by the user.
5108 to work as if they had been typed by the user.
5100
5109
5101 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5110 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5102 execute automatically (no need to type 'exec...'). They then
5111 execute automatically (no need to type 'exec...'). They then
5103 behave like 'true macros'. The printing system was also modified
5112 behave like 'true macros'. The printing system was also modified
5104 for this to work.
5113 for this to work.
5105
5114
5106 2002-02-19 Fernando Perez <fperez@colorado.edu>
5115 2002-02-19 Fernando Perez <fperez@colorado.edu>
5107
5116
5108 * IPython/genutils.py (page_file): new function for paging files
5117 * IPython/genutils.py (page_file): new function for paging files
5109 in an OS-independent way. Also necessary for file viewing to work
5118 in an OS-independent way. Also necessary for file viewing to work
5110 well inside Emacs buffers.
5119 well inside Emacs buffers.
5111 (page): Added checks for being in an emacs buffer.
5120 (page): Added checks for being in an emacs buffer.
5112 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5121 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5113 same bug in iplib.
5122 same bug in iplib.
5114
5123
5115 2002-02-18 Fernando Perez <fperez@colorado.edu>
5124 2002-02-18 Fernando Perez <fperez@colorado.edu>
5116
5125
5117 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5126 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5118 of readline so that IPython can work inside an Emacs buffer.
5127 of readline so that IPython can work inside an Emacs buffer.
5119
5128
5120 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5129 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5121 method signatures (they weren't really bugs, but it looks cleaner
5130 method signatures (they weren't really bugs, but it looks cleaner
5122 and keeps PyChecker happy).
5131 and keeps PyChecker happy).
5123
5132
5124 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5133 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5125 for implementing various user-defined hooks. Currently only
5134 for implementing various user-defined hooks. Currently only
5126 display is done.
5135 display is done.
5127
5136
5128 * IPython/Prompts.py (CachedOutput._display): changed display
5137 * IPython/Prompts.py (CachedOutput._display): changed display
5129 functions so that they can be dynamically changed by users easily.
5138 functions so that they can be dynamically changed by users easily.
5130
5139
5131 * IPython/Extensions/numeric_formats.py (num_display): added an
5140 * IPython/Extensions/numeric_formats.py (num_display): added an
5132 extension for printing NumPy arrays in flexible manners. It
5141 extension for printing NumPy arrays in flexible manners. It
5133 doesn't do anything yet, but all the structure is in
5142 doesn't do anything yet, but all the structure is in
5134 place. Ultimately the plan is to implement output format control
5143 place. Ultimately the plan is to implement output format control
5135 like in Octave.
5144 like in Octave.
5136
5145
5137 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5146 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5138 methods are found at run-time by all the automatic machinery.
5147 methods are found at run-time by all the automatic machinery.
5139
5148
5140 2002-02-17 Fernando Perez <fperez@colorado.edu>
5149 2002-02-17 Fernando Perez <fperez@colorado.edu>
5141
5150
5142 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5151 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5143 whole file a little.
5152 whole file a little.
5144
5153
5145 * ToDo: closed this document. Now there's a new_design.lyx
5154 * ToDo: closed this document. Now there's a new_design.lyx
5146 document for all new ideas. Added making a pdf of it for the
5155 document for all new ideas. Added making a pdf of it for the
5147 end-user distro.
5156 end-user distro.
5148
5157
5149 * IPython/Logger.py (Logger.switch_log): Created this to replace
5158 * IPython/Logger.py (Logger.switch_log): Created this to replace
5150 logon() and logoff(). It also fixes a nasty crash reported by
5159 logon() and logoff(). It also fixes a nasty crash reported by
5151 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5160 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5152
5161
5153 * IPython/iplib.py (complete): got auto-completion to work with
5162 * IPython/iplib.py (complete): got auto-completion to work with
5154 automagic (I had wanted this for a long time).
5163 automagic (I had wanted this for a long time).
5155
5164
5156 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5165 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5157 to @file, since file() is now a builtin and clashes with automagic
5166 to @file, since file() is now a builtin and clashes with automagic
5158 for @file.
5167 for @file.
5159
5168
5160 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5169 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5161 of this was previously in iplib, which had grown to more than 2000
5170 of this was previously in iplib, which had grown to more than 2000
5162 lines, way too long. No new functionality, but it makes managing
5171 lines, way too long. No new functionality, but it makes managing
5163 the code a bit easier.
5172 the code a bit easier.
5164
5173
5165 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5174 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5166 information to crash reports.
5175 information to crash reports.
5167
5176
5168 2002-02-12 Fernando Perez <fperez@colorado.edu>
5177 2002-02-12 Fernando Perez <fperez@colorado.edu>
5169
5178
5170 * Released 0.2.5.
5179 * Released 0.2.5.
5171
5180
5172 2002-02-11 Fernando Perez <fperez@colorado.edu>
5181 2002-02-11 Fernando Perez <fperez@colorado.edu>
5173
5182
5174 * Wrote a relatively complete Windows installer. It puts
5183 * Wrote a relatively complete Windows installer. It puts
5175 everything in place, creates Start Menu entries and fixes the
5184 everything in place, creates Start Menu entries and fixes the
5176 color issues. Nothing fancy, but it works.
5185 color issues. Nothing fancy, but it works.
5177
5186
5178 2002-02-10 Fernando Perez <fperez@colorado.edu>
5187 2002-02-10 Fernando Perez <fperez@colorado.edu>
5179
5188
5180 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5189 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5181 os.path.expanduser() call so that we can type @run ~/myfile.py and
5190 os.path.expanduser() call so that we can type @run ~/myfile.py and
5182 have thigs work as expected.
5191 have thigs work as expected.
5183
5192
5184 * IPython/genutils.py (page): fixed exception handling so things
5193 * IPython/genutils.py (page): fixed exception handling so things
5185 work both in Unix and Windows correctly. Quitting a pager triggers
5194 work both in Unix and Windows correctly. Quitting a pager triggers
5186 an IOError/broken pipe in Unix, and in windows not finding a pager
5195 an IOError/broken pipe in Unix, and in windows not finding a pager
5187 is also an IOError, so I had to actually look at the return value
5196 is also an IOError, so I had to actually look at the return value
5188 of the exception, not just the exception itself. Should be ok now.
5197 of the exception, not just the exception itself. Should be ok now.
5189
5198
5190 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5199 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5191 modified to allow case-insensitive color scheme changes.
5200 modified to allow case-insensitive color scheme changes.
5192
5201
5193 2002-02-09 Fernando Perez <fperez@colorado.edu>
5202 2002-02-09 Fernando Perez <fperez@colorado.edu>
5194
5203
5195 * IPython/genutils.py (native_line_ends): new function to leave
5204 * IPython/genutils.py (native_line_ends): new function to leave
5196 user config files with os-native line-endings.
5205 user config files with os-native line-endings.
5197
5206
5198 * README and manual updates.
5207 * README and manual updates.
5199
5208
5200 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5209 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5201 instead of StringType to catch Unicode strings.
5210 instead of StringType to catch Unicode strings.
5202
5211
5203 * IPython/genutils.py (filefind): fixed bug for paths with
5212 * IPython/genutils.py (filefind): fixed bug for paths with
5204 embedded spaces (very common in Windows).
5213 embedded spaces (very common in Windows).
5205
5214
5206 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5215 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5207 files under Windows, so that they get automatically associated
5216 files under Windows, so that they get automatically associated
5208 with a text editor. Windows makes it a pain to handle
5217 with a text editor. Windows makes it a pain to handle
5209 extension-less files.
5218 extension-less files.
5210
5219
5211 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5220 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5212 warning about readline only occur for Posix. In Windows there's no
5221 warning about readline only occur for Posix. In Windows there's no
5213 way to get readline, so why bother with the warning.
5222 way to get readline, so why bother with the warning.
5214
5223
5215 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5224 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5216 for __str__ instead of dir(self), since dir() changed in 2.2.
5225 for __str__ instead of dir(self), since dir() changed in 2.2.
5217
5226
5218 * Ported to Windows! Tested on XP, I suspect it should work fine
5227 * Ported to Windows! Tested on XP, I suspect it should work fine
5219 on NT/2000, but I don't think it will work on 98 et al. That
5228 on NT/2000, but I don't think it will work on 98 et al. That
5220 series of Windows is such a piece of junk anyway that I won't try
5229 series of Windows is such a piece of junk anyway that I won't try
5221 porting it there. The XP port was straightforward, showed a few
5230 porting it there. The XP port was straightforward, showed a few
5222 bugs here and there (fixed all), in particular some string
5231 bugs here and there (fixed all), in particular some string
5223 handling stuff which required considering Unicode strings (which
5232 handling stuff which required considering Unicode strings (which
5224 Windows uses). This is good, but hasn't been too tested :) No
5233 Windows uses). This is good, but hasn't been too tested :) No
5225 fancy installer yet, I'll put a note in the manual so people at
5234 fancy installer yet, I'll put a note in the manual so people at
5226 least make manually a shortcut.
5235 least make manually a shortcut.
5227
5236
5228 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5237 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5229 into a single one, "colors". This now controls both prompt and
5238 into a single one, "colors". This now controls both prompt and
5230 exception color schemes, and can be changed both at startup
5239 exception color schemes, and can be changed both at startup
5231 (either via command-line switches or via ipythonrc files) and at
5240 (either via command-line switches or via ipythonrc files) and at
5232 runtime, with @colors.
5241 runtime, with @colors.
5233 (Magic.magic_run): renamed @prun to @run and removed the old
5242 (Magic.magic_run): renamed @prun to @run and removed the old
5234 @run. The two were too similar to warrant keeping both.
5243 @run. The two were too similar to warrant keeping both.
5235
5244
5236 2002-02-03 Fernando Perez <fperez@colorado.edu>
5245 2002-02-03 Fernando Perez <fperez@colorado.edu>
5237
5246
5238 * IPython/iplib.py (install_first_time): Added comment on how to
5247 * IPython/iplib.py (install_first_time): Added comment on how to
5239 configure the color options for first-time users. Put a <return>
5248 configure the color options for first-time users. Put a <return>
5240 request at the end so that small-terminal users get a chance to
5249 request at the end so that small-terminal users get a chance to
5241 read the startup info.
5250 read the startup info.
5242
5251
5243 2002-01-23 Fernando Perez <fperez@colorado.edu>
5252 2002-01-23 Fernando Perez <fperez@colorado.edu>
5244
5253
5245 * IPython/iplib.py (CachedOutput.update): Changed output memory
5254 * IPython/iplib.py (CachedOutput.update): Changed output memory
5246 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5255 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5247 input history we still use _i. Did this b/c these variable are
5256 input history we still use _i. Did this b/c these variable are
5248 very commonly used in interactive work, so the less we need to
5257 very commonly used in interactive work, so the less we need to
5249 type the better off we are.
5258 type the better off we are.
5250 (Magic.magic_prun): updated @prun to better handle the namespaces
5259 (Magic.magic_prun): updated @prun to better handle the namespaces
5251 the file will run in, including a fix for __name__ not being set
5260 the file will run in, including a fix for __name__ not being set
5252 before.
5261 before.
5253
5262
5254 2002-01-20 Fernando Perez <fperez@colorado.edu>
5263 2002-01-20 Fernando Perez <fperez@colorado.edu>
5255
5264
5256 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5265 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5257 extra garbage for Python 2.2. Need to look more carefully into
5266 extra garbage for Python 2.2. Need to look more carefully into
5258 this later.
5267 this later.
5259
5268
5260 2002-01-19 Fernando Perez <fperez@colorado.edu>
5269 2002-01-19 Fernando Perez <fperez@colorado.edu>
5261
5270
5262 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5271 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5263 display SyntaxError exceptions properly formatted when they occur
5272 display SyntaxError exceptions properly formatted when they occur
5264 (they can be triggered by imported code).
5273 (they can be triggered by imported code).
5265
5274
5266 2002-01-18 Fernando Perez <fperez@colorado.edu>
5275 2002-01-18 Fernando Perez <fperez@colorado.edu>
5267
5276
5268 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5277 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5269 SyntaxError exceptions are reported nicely formatted, instead of
5278 SyntaxError exceptions are reported nicely formatted, instead of
5270 spitting out only offset information as before.
5279 spitting out only offset information as before.
5271 (Magic.magic_prun): Added the @prun function for executing
5280 (Magic.magic_prun): Added the @prun function for executing
5272 programs with command line args inside IPython.
5281 programs with command line args inside IPython.
5273
5282
5274 2002-01-16 Fernando Perez <fperez@colorado.edu>
5283 2002-01-16 Fernando Perez <fperez@colorado.edu>
5275
5284
5276 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5285 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5277 to *not* include the last item given in a range. This brings their
5286 to *not* include the last item given in a range. This brings their
5278 behavior in line with Python's slicing:
5287 behavior in line with Python's slicing:
5279 a[n1:n2] -> a[n1]...a[n2-1]
5288 a[n1:n2] -> a[n1]...a[n2-1]
5280 It may be a bit less convenient, but I prefer to stick to Python's
5289 It may be a bit less convenient, but I prefer to stick to Python's
5281 conventions *everywhere*, so users never have to wonder.
5290 conventions *everywhere*, so users never have to wonder.
5282 (Magic.magic_macro): Added @macro function to ease the creation of
5291 (Magic.magic_macro): Added @macro function to ease the creation of
5283 macros.
5292 macros.
5284
5293
5285 2002-01-05 Fernando Perez <fperez@colorado.edu>
5294 2002-01-05 Fernando Perez <fperez@colorado.edu>
5286
5295
5287 * Released 0.2.4.
5296 * Released 0.2.4.
5288
5297
5289 * IPython/iplib.py (Magic.magic_pdef):
5298 * IPython/iplib.py (Magic.magic_pdef):
5290 (InteractiveShell.safe_execfile): report magic lines and error
5299 (InteractiveShell.safe_execfile): report magic lines and error
5291 lines without line numbers so one can easily copy/paste them for
5300 lines without line numbers so one can easily copy/paste them for
5292 re-execution.
5301 re-execution.
5293
5302
5294 * Updated manual with recent changes.
5303 * Updated manual with recent changes.
5295
5304
5296 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5305 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5297 docstring printing when class? is called. Very handy for knowing
5306 docstring printing when class? is called. Very handy for knowing
5298 how to create class instances (as long as __init__ is well
5307 how to create class instances (as long as __init__ is well
5299 documented, of course :)
5308 documented, of course :)
5300 (Magic.magic_doc): print both class and constructor docstrings.
5309 (Magic.magic_doc): print both class and constructor docstrings.
5301 (Magic.magic_pdef): give constructor info if passed a class and
5310 (Magic.magic_pdef): give constructor info if passed a class and
5302 __call__ info for callable object instances.
5311 __call__ info for callable object instances.
5303
5312
5304 2002-01-04 Fernando Perez <fperez@colorado.edu>
5313 2002-01-04 Fernando Perez <fperez@colorado.edu>
5305
5314
5306 * Made deep_reload() off by default. It doesn't always work
5315 * Made deep_reload() off by default. It doesn't always work
5307 exactly as intended, so it's probably safer to have it off. It's
5316 exactly as intended, so it's probably safer to have it off. It's
5308 still available as dreload() anyway, so nothing is lost.
5317 still available as dreload() anyway, so nothing is lost.
5309
5318
5310 2002-01-02 Fernando Perez <fperez@colorado.edu>
5319 2002-01-02 Fernando Perez <fperez@colorado.edu>
5311
5320
5312 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5321 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5313 so I wanted an updated release).
5322 so I wanted an updated release).
5314
5323
5315 2001-12-27 Fernando Perez <fperez@colorado.edu>
5324 2001-12-27 Fernando Perez <fperez@colorado.edu>
5316
5325
5317 * IPython/iplib.py (InteractiveShell.interact): Added the original
5326 * IPython/iplib.py (InteractiveShell.interact): Added the original
5318 code from 'code.py' for this module in order to change the
5327 code from 'code.py' for this module in order to change the
5319 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5328 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5320 the history cache would break when the user hit Ctrl-C, and
5329 the history cache would break when the user hit Ctrl-C, and
5321 interact() offers no way to add any hooks to it.
5330 interact() offers no way to add any hooks to it.
5322
5331
5323 2001-12-23 Fernando Perez <fperez@colorado.edu>
5332 2001-12-23 Fernando Perez <fperez@colorado.edu>
5324
5333
5325 * setup.py: added check for 'MANIFEST' before trying to remove
5334 * setup.py: added check for 'MANIFEST' before trying to remove
5326 it. Thanks to Sean Reifschneider.
5335 it. Thanks to Sean Reifschneider.
5327
5336
5328 2001-12-22 Fernando Perez <fperez@colorado.edu>
5337 2001-12-22 Fernando Perez <fperez@colorado.edu>
5329
5338
5330 * Released 0.2.2.
5339 * Released 0.2.2.
5331
5340
5332 * Finished (reasonably) writing the manual. Later will add the
5341 * Finished (reasonably) writing the manual. Later will add the
5333 python-standard navigation stylesheets, but for the time being
5342 python-standard navigation stylesheets, but for the time being
5334 it's fairly complete. Distribution will include html and pdf
5343 it's fairly complete. Distribution will include html and pdf
5335 versions.
5344 versions.
5336
5345
5337 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5346 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5338 (MayaVi author).
5347 (MayaVi author).
5339
5348
5340 2001-12-21 Fernando Perez <fperez@colorado.edu>
5349 2001-12-21 Fernando Perez <fperez@colorado.edu>
5341
5350
5342 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5351 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5343 good public release, I think (with the manual and the distutils
5352 good public release, I think (with the manual and the distutils
5344 installer). The manual can use some work, but that can go
5353 installer). The manual can use some work, but that can go
5345 slowly. Otherwise I think it's quite nice for end users. Next
5354 slowly. Otherwise I think it's quite nice for end users. Next
5346 summer, rewrite the guts of it...
5355 summer, rewrite the guts of it...
5347
5356
5348 * Changed format of ipythonrc files to use whitespace as the
5357 * Changed format of ipythonrc files to use whitespace as the
5349 separator instead of an explicit '='. Cleaner.
5358 separator instead of an explicit '='. Cleaner.
5350
5359
5351 2001-12-20 Fernando Perez <fperez@colorado.edu>
5360 2001-12-20 Fernando Perez <fperez@colorado.edu>
5352
5361
5353 * Started a manual in LyX. For now it's just a quick merge of the
5362 * Started a manual in LyX. For now it's just a quick merge of the
5354 various internal docstrings and READMEs. Later it may grow into a
5363 various internal docstrings and READMEs. Later it may grow into a
5355 nice, full-blown manual.
5364 nice, full-blown manual.
5356
5365
5357 * Set up a distutils based installer. Installation should now be
5366 * Set up a distutils based installer. Installation should now be
5358 trivially simple for end-users.
5367 trivially simple for end-users.
5359
5368
5360 2001-12-11 Fernando Perez <fperez@colorado.edu>
5369 2001-12-11 Fernando Perez <fperez@colorado.edu>
5361
5370
5362 * Released 0.2.0. First public release, announced it at
5371 * Released 0.2.0. First public release, announced it at
5363 comp.lang.python. From now on, just bugfixes...
5372 comp.lang.python. From now on, just bugfixes...
5364
5373
5365 * Went through all the files, set copyright/license notices and
5374 * Went through all the files, set copyright/license notices and
5366 cleaned up things. Ready for release.
5375 cleaned up things. Ready for release.
5367
5376
5368 2001-12-10 Fernando Perez <fperez@colorado.edu>
5377 2001-12-10 Fernando Perez <fperez@colorado.edu>
5369
5378
5370 * Changed the first-time installer not to use tarfiles. It's more
5379 * Changed the first-time installer not to use tarfiles. It's more
5371 robust now and less unix-dependent. Also makes it easier for
5380 robust now and less unix-dependent. Also makes it easier for
5372 people to later upgrade versions.
5381 people to later upgrade versions.
5373
5382
5374 * Changed @exit to @abort to reflect the fact that it's pretty
5383 * Changed @exit to @abort to reflect the fact that it's pretty
5375 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5384 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5376 becomes significant only when IPyhton is embedded: in that case,
5385 becomes significant only when IPyhton is embedded: in that case,
5377 C-D closes IPython only, but @abort kills the enclosing program
5386 C-D closes IPython only, but @abort kills the enclosing program
5378 too (unless it had called IPython inside a try catching
5387 too (unless it had called IPython inside a try catching
5379 SystemExit).
5388 SystemExit).
5380
5389
5381 * Created Shell module which exposes the actuall IPython Shell
5390 * Created Shell module which exposes the actuall IPython Shell
5382 classes, currently the normal and the embeddable one. This at
5391 classes, currently the normal and the embeddable one. This at
5383 least offers a stable interface we won't need to change when
5392 least offers a stable interface we won't need to change when
5384 (later) the internals are rewritten. That rewrite will be confined
5393 (later) the internals are rewritten. That rewrite will be confined
5385 to iplib and ipmaker, but the Shell interface should remain as is.
5394 to iplib and ipmaker, but the Shell interface should remain as is.
5386
5395
5387 * Added embed module which offers an embeddable IPShell object,
5396 * Added embed module which offers an embeddable IPShell object,
5388 useful to fire up IPython *inside* a running program. Great for
5397 useful to fire up IPython *inside* a running program. Great for
5389 debugging or dynamical data analysis.
5398 debugging or dynamical data analysis.
5390
5399
5391 2001-12-08 Fernando Perez <fperez@colorado.edu>
5400 2001-12-08 Fernando Perez <fperez@colorado.edu>
5392
5401
5393 * Fixed small bug preventing seeing info from methods of defined
5402 * Fixed small bug preventing seeing info from methods of defined
5394 objects (incorrect namespace in _ofind()).
5403 objects (incorrect namespace in _ofind()).
5395
5404
5396 * Documentation cleanup. Moved the main usage docstrings to a
5405 * Documentation cleanup. Moved the main usage docstrings to a
5397 separate file, usage.py (cleaner to maintain, and hopefully in the
5406 separate file, usage.py (cleaner to maintain, and hopefully in the
5398 future some perlpod-like way of producing interactive, man and
5407 future some perlpod-like way of producing interactive, man and
5399 html docs out of it will be found).
5408 html docs out of it will be found).
5400
5409
5401 * Added @profile to see your profile at any time.
5410 * Added @profile to see your profile at any time.
5402
5411
5403 * Added @p as an alias for 'print'. It's especially convenient if
5412 * Added @p as an alias for 'print'. It's especially convenient if
5404 using automagic ('p x' prints x).
5413 using automagic ('p x' prints x).
5405
5414
5406 * Small cleanups and fixes after a pychecker run.
5415 * Small cleanups and fixes after a pychecker run.
5407
5416
5408 * Changed the @cd command to handle @cd - and @cd -<n> for
5417 * Changed the @cd command to handle @cd - and @cd -<n> for
5409 visiting any directory in _dh.
5418 visiting any directory in _dh.
5410
5419
5411 * Introduced _dh, a history of visited directories. @dhist prints
5420 * Introduced _dh, a history of visited directories. @dhist prints
5412 it out with numbers.
5421 it out with numbers.
5413
5422
5414 2001-12-07 Fernando Perez <fperez@colorado.edu>
5423 2001-12-07 Fernando Perez <fperez@colorado.edu>
5415
5424
5416 * Released 0.1.22
5425 * Released 0.1.22
5417
5426
5418 * Made initialization a bit more robust against invalid color
5427 * Made initialization a bit more robust against invalid color
5419 options in user input (exit, not traceback-crash).
5428 options in user input (exit, not traceback-crash).
5420
5429
5421 * Changed the bug crash reporter to write the report only in the
5430 * Changed the bug crash reporter to write the report only in the
5422 user's .ipython directory. That way IPython won't litter people's
5431 user's .ipython directory. That way IPython won't litter people's
5423 hard disks with crash files all over the place. Also print on
5432 hard disks with crash files all over the place. Also print on
5424 screen the necessary mail command.
5433 screen the necessary mail command.
5425
5434
5426 * With the new ultraTB, implemented LightBG color scheme for light
5435 * With the new ultraTB, implemented LightBG color scheme for light
5427 background terminals. A lot of people like white backgrounds, so I
5436 background terminals. A lot of people like white backgrounds, so I
5428 guess we should at least give them something readable.
5437 guess we should at least give them something readable.
5429
5438
5430 2001-12-06 Fernando Perez <fperez@colorado.edu>
5439 2001-12-06 Fernando Perez <fperez@colorado.edu>
5431
5440
5432 * Modified the structure of ultraTB. Now there's a proper class
5441 * Modified the structure of ultraTB. Now there's a proper class
5433 for tables of color schemes which allow adding schemes easily and
5442 for tables of color schemes which allow adding schemes easily and
5434 switching the active scheme without creating a new instance every
5443 switching the active scheme without creating a new instance every
5435 time (which was ridiculous). The syntax for creating new schemes
5444 time (which was ridiculous). The syntax for creating new schemes
5436 is also cleaner. I think ultraTB is finally done, with a clean
5445 is also cleaner. I think ultraTB is finally done, with a clean
5437 class structure. Names are also much cleaner (now there's proper
5446 class structure. Names are also much cleaner (now there's proper
5438 color tables, no need for every variable to also have 'color' in
5447 color tables, no need for every variable to also have 'color' in
5439 its name).
5448 its name).
5440
5449
5441 * Broke down genutils into separate files. Now genutils only
5450 * Broke down genutils into separate files. Now genutils only
5442 contains utility functions, and classes have been moved to their
5451 contains utility functions, and classes have been moved to their
5443 own files (they had enough independent functionality to warrant
5452 own files (they had enough independent functionality to warrant
5444 it): ConfigLoader, OutputTrap, Struct.
5453 it): ConfigLoader, OutputTrap, Struct.
5445
5454
5446 2001-12-05 Fernando Perez <fperez@colorado.edu>
5455 2001-12-05 Fernando Perez <fperez@colorado.edu>
5447
5456
5448 * IPython turns 21! Released version 0.1.21, as a candidate for
5457 * IPython turns 21! Released version 0.1.21, as a candidate for
5449 public consumption. If all goes well, release in a few days.
5458 public consumption. If all goes well, release in a few days.
5450
5459
5451 * Fixed path bug (files in Extensions/ directory wouldn't be found
5460 * Fixed path bug (files in Extensions/ directory wouldn't be found
5452 unless IPython/ was explicitly in sys.path).
5461 unless IPython/ was explicitly in sys.path).
5453
5462
5454 * Extended the FlexCompleter class as MagicCompleter to allow
5463 * Extended the FlexCompleter class as MagicCompleter to allow
5455 completion of @-starting lines.
5464 completion of @-starting lines.
5456
5465
5457 * Created __release__.py file as a central repository for release
5466 * Created __release__.py file as a central repository for release
5458 info that other files can read from.
5467 info that other files can read from.
5459
5468
5460 * Fixed small bug in logging: when logging was turned on in
5469 * Fixed small bug in logging: when logging was turned on in
5461 mid-session, old lines with special meanings (!@?) were being
5470 mid-session, old lines with special meanings (!@?) were being
5462 logged without the prepended comment, which is necessary since
5471 logged without the prepended comment, which is necessary since
5463 they are not truly valid python syntax. This should make session
5472 they are not truly valid python syntax. This should make session
5464 restores produce less errors.
5473 restores produce less errors.
5465
5474
5466 * The namespace cleanup forced me to make a FlexCompleter class
5475 * The namespace cleanup forced me to make a FlexCompleter class
5467 which is nothing but a ripoff of rlcompleter, but with selectable
5476 which is nothing but a ripoff of rlcompleter, but with selectable
5468 namespace (rlcompleter only works in __main__.__dict__). I'll try
5477 namespace (rlcompleter only works in __main__.__dict__). I'll try
5469 to submit a note to the authors to see if this change can be
5478 to submit a note to the authors to see if this change can be
5470 incorporated in future rlcompleter releases (Dec.6: done)
5479 incorporated in future rlcompleter releases (Dec.6: done)
5471
5480
5472 * More fixes to namespace handling. It was a mess! Now all
5481 * More fixes to namespace handling. It was a mess! Now all
5473 explicit references to __main__.__dict__ are gone (except when
5482 explicit references to __main__.__dict__ are gone (except when
5474 really needed) and everything is handled through the namespace
5483 really needed) and everything is handled through the namespace
5475 dicts in the IPython instance. We seem to be getting somewhere
5484 dicts in the IPython instance. We seem to be getting somewhere
5476 with this, finally...
5485 with this, finally...
5477
5486
5478 * Small documentation updates.
5487 * Small documentation updates.
5479
5488
5480 * Created the Extensions directory under IPython (with an
5489 * Created the Extensions directory under IPython (with an
5481 __init__.py). Put the PhysicalQ stuff there. This directory should
5490 __init__.py). Put the PhysicalQ stuff there. This directory should
5482 be used for all special-purpose extensions.
5491 be used for all special-purpose extensions.
5483
5492
5484 * File renaming:
5493 * File renaming:
5485 ipythonlib --> ipmaker
5494 ipythonlib --> ipmaker
5486 ipplib --> iplib
5495 ipplib --> iplib
5487 This makes a bit more sense in terms of what these files actually do.
5496 This makes a bit more sense in terms of what these files actually do.
5488
5497
5489 * Moved all the classes and functions in ipythonlib to ipplib, so
5498 * Moved all the classes and functions in ipythonlib to ipplib, so
5490 now ipythonlib only has make_IPython(). This will ease up its
5499 now ipythonlib only has make_IPython(). This will ease up its
5491 splitting in smaller functional chunks later.
5500 splitting in smaller functional chunks later.
5492
5501
5493 * Cleaned up (done, I think) output of @whos. Better column
5502 * Cleaned up (done, I think) output of @whos. Better column
5494 formatting, and now shows str(var) for as much as it can, which is
5503 formatting, and now shows str(var) for as much as it can, which is
5495 typically what one gets with a 'print var'.
5504 typically what one gets with a 'print var'.
5496
5505
5497 2001-12-04 Fernando Perez <fperez@colorado.edu>
5506 2001-12-04 Fernando Perez <fperez@colorado.edu>
5498
5507
5499 * Fixed namespace problems. Now builtin/IPyhton/user names get
5508 * Fixed namespace problems. Now builtin/IPyhton/user names get
5500 properly reported in their namespace. Internal namespace handling
5509 properly reported in their namespace. Internal namespace handling
5501 is finally getting decent (not perfect yet, but much better than
5510 is finally getting decent (not perfect yet, but much better than
5502 the ad-hoc mess we had).
5511 the ad-hoc mess we had).
5503
5512
5504 * Removed -exit option. If people just want to run a python
5513 * Removed -exit option. If people just want to run a python
5505 script, that's what the normal interpreter is for. Less
5514 script, that's what the normal interpreter is for. Less
5506 unnecessary options, less chances for bugs.
5515 unnecessary options, less chances for bugs.
5507
5516
5508 * Added a crash handler which generates a complete post-mortem if
5517 * Added a crash handler which generates a complete post-mortem if
5509 IPython crashes. This will help a lot in tracking bugs down the
5518 IPython crashes. This will help a lot in tracking bugs down the
5510 road.
5519 road.
5511
5520
5512 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5521 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5513 which were boud to functions being reassigned would bypass the
5522 which were boud to functions being reassigned would bypass the
5514 logger, breaking the sync of _il with the prompt counter. This
5523 logger, breaking the sync of _il with the prompt counter. This
5515 would then crash IPython later when a new line was logged.
5524 would then crash IPython later when a new line was logged.
5516
5525
5517 2001-12-02 Fernando Perez <fperez@colorado.edu>
5526 2001-12-02 Fernando Perez <fperez@colorado.edu>
5518
5527
5519 * Made IPython a package. This means people don't have to clutter
5528 * Made IPython a package. This means people don't have to clutter
5520 their sys.path with yet another directory. Changed the INSTALL
5529 their sys.path with yet another directory. Changed the INSTALL
5521 file accordingly.
5530 file accordingly.
5522
5531
5523 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5532 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5524 sorts its output (so @who shows it sorted) and @whos formats the
5533 sorts its output (so @who shows it sorted) and @whos formats the
5525 table according to the width of the first column. Nicer, easier to
5534 table according to the width of the first column. Nicer, easier to
5526 read. Todo: write a generic table_format() which takes a list of
5535 read. Todo: write a generic table_format() which takes a list of
5527 lists and prints it nicely formatted, with optional row/column
5536 lists and prints it nicely formatted, with optional row/column
5528 separators and proper padding and justification.
5537 separators and proper padding and justification.
5529
5538
5530 * Released 0.1.20
5539 * Released 0.1.20
5531
5540
5532 * Fixed bug in @log which would reverse the inputcache list (a
5541 * Fixed bug in @log which would reverse the inputcache list (a
5533 copy operation was missing).
5542 copy operation was missing).
5534
5543
5535 * Code cleanup. @config was changed to use page(). Better, since
5544 * Code cleanup. @config was changed to use page(). Better, since
5536 its output is always quite long.
5545 its output is always quite long.
5537
5546
5538 * Itpl is back as a dependency. I was having too many problems
5547 * Itpl is back as a dependency. I was having too many problems
5539 getting the parametric aliases to work reliably, and it's just
5548 getting the parametric aliases to work reliably, and it's just
5540 easier to code weird string operations with it than playing %()s
5549 easier to code weird string operations with it than playing %()s
5541 games. It's only ~6k, so I don't think it's too big a deal.
5550 games. It's only ~6k, so I don't think it's too big a deal.
5542
5551
5543 * Found (and fixed) a very nasty bug with history. !lines weren't
5552 * Found (and fixed) a very nasty bug with history. !lines weren't
5544 getting cached, and the out of sync caches would crash
5553 getting cached, and the out of sync caches would crash
5545 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5554 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5546 division of labor a bit better. Bug fixed, cleaner structure.
5555 division of labor a bit better. Bug fixed, cleaner structure.
5547
5556
5548 2001-12-01 Fernando Perez <fperez@colorado.edu>
5557 2001-12-01 Fernando Perez <fperez@colorado.edu>
5549
5558
5550 * Released 0.1.19
5559 * Released 0.1.19
5551
5560
5552 * Added option -n to @hist to prevent line number printing. Much
5561 * Added option -n to @hist to prevent line number printing. Much
5553 easier to copy/paste code this way.
5562 easier to copy/paste code this way.
5554
5563
5555 * Created global _il to hold the input list. Allows easy
5564 * Created global _il to hold the input list. Allows easy
5556 re-execution of blocks of code by slicing it (inspired by Janko's
5565 re-execution of blocks of code by slicing it (inspired by Janko's
5557 comment on 'macros').
5566 comment on 'macros').
5558
5567
5559 * Small fixes and doc updates.
5568 * Small fixes and doc updates.
5560
5569
5561 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5570 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5562 much too fragile with automagic. Handles properly multi-line
5571 much too fragile with automagic. Handles properly multi-line
5563 statements and takes parameters.
5572 statements and takes parameters.
5564
5573
5565 2001-11-30 Fernando Perez <fperez@colorado.edu>
5574 2001-11-30 Fernando Perez <fperez@colorado.edu>
5566
5575
5567 * Version 0.1.18 released.
5576 * Version 0.1.18 released.
5568
5577
5569 * Fixed nasty namespace bug in initial module imports.
5578 * Fixed nasty namespace bug in initial module imports.
5570
5579
5571 * Added copyright/license notes to all code files (except
5580 * Added copyright/license notes to all code files (except
5572 DPyGetOpt). For the time being, LGPL. That could change.
5581 DPyGetOpt). For the time being, LGPL. That could change.
5573
5582
5574 * Rewrote a much nicer README, updated INSTALL, cleaned up
5583 * Rewrote a much nicer README, updated INSTALL, cleaned up
5575 ipythonrc-* samples.
5584 ipythonrc-* samples.
5576
5585
5577 * Overall code/documentation cleanup. Basically ready for
5586 * Overall code/documentation cleanup. Basically ready for
5578 release. Only remaining thing: licence decision (LGPL?).
5587 release. Only remaining thing: licence decision (LGPL?).
5579
5588
5580 * Converted load_config to a class, ConfigLoader. Now recursion
5589 * Converted load_config to a class, ConfigLoader. Now recursion
5581 control is better organized. Doesn't include the same file twice.
5590 control is better organized. Doesn't include the same file twice.
5582
5591
5583 2001-11-29 Fernando Perez <fperez@colorado.edu>
5592 2001-11-29 Fernando Perez <fperez@colorado.edu>
5584
5593
5585 * Got input history working. Changed output history variables from
5594 * Got input history working. Changed output history variables from
5586 _p to _o so that _i is for input and _o for output. Just cleaner
5595 _p to _o so that _i is for input and _o for output. Just cleaner
5587 convention.
5596 convention.
5588
5597
5589 * Implemented parametric aliases. This pretty much allows the
5598 * Implemented parametric aliases. This pretty much allows the
5590 alias system to offer full-blown shell convenience, I think.
5599 alias system to offer full-blown shell convenience, I think.
5591
5600
5592 * Version 0.1.17 released, 0.1.18 opened.
5601 * Version 0.1.17 released, 0.1.18 opened.
5593
5602
5594 * dot_ipython/ipythonrc (alias): added documentation.
5603 * dot_ipython/ipythonrc (alias): added documentation.
5595 (xcolor): Fixed small bug (xcolors -> xcolor)
5604 (xcolor): Fixed small bug (xcolors -> xcolor)
5596
5605
5597 * Changed the alias system. Now alias is a magic command to define
5606 * Changed the alias system. Now alias is a magic command to define
5598 aliases just like the shell. Rationale: the builtin magics should
5607 aliases just like the shell. Rationale: the builtin magics should
5599 be there for things deeply connected to IPython's
5608 be there for things deeply connected to IPython's
5600 architecture. And this is a much lighter system for what I think
5609 architecture. And this is a much lighter system for what I think
5601 is the really important feature: allowing users to define quickly
5610 is the really important feature: allowing users to define quickly
5602 magics that will do shell things for them, so they can customize
5611 magics that will do shell things for them, so they can customize
5603 IPython easily to match their work habits. If someone is really
5612 IPython easily to match their work habits. If someone is really
5604 desperate to have another name for a builtin alias, they can
5613 desperate to have another name for a builtin alias, they can
5605 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5614 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5606 works.
5615 works.
5607
5616
5608 2001-11-28 Fernando Perez <fperez@colorado.edu>
5617 2001-11-28 Fernando Perez <fperez@colorado.edu>
5609
5618
5610 * Changed @file so that it opens the source file at the proper
5619 * Changed @file so that it opens the source file at the proper
5611 line. Since it uses less, if your EDITOR environment is
5620 line. Since it uses less, if your EDITOR environment is
5612 configured, typing v will immediately open your editor of choice
5621 configured, typing v will immediately open your editor of choice
5613 right at the line where the object is defined. Not as quick as
5622 right at the line where the object is defined. Not as quick as
5614 having a direct @edit command, but for all intents and purposes it
5623 having a direct @edit command, but for all intents and purposes it
5615 works. And I don't have to worry about writing @edit to deal with
5624 works. And I don't have to worry about writing @edit to deal with
5616 all the editors, less does that.
5625 all the editors, less does that.
5617
5626
5618 * Version 0.1.16 released, 0.1.17 opened.
5627 * Version 0.1.16 released, 0.1.17 opened.
5619
5628
5620 * Fixed some nasty bugs in the page/page_dumb combo that could
5629 * Fixed some nasty bugs in the page/page_dumb combo that could
5621 crash IPython.
5630 crash IPython.
5622
5631
5623 2001-11-27 Fernando Perez <fperez@colorado.edu>
5632 2001-11-27 Fernando Perez <fperez@colorado.edu>
5624
5633
5625 * Version 0.1.15 released, 0.1.16 opened.
5634 * Version 0.1.15 released, 0.1.16 opened.
5626
5635
5627 * Finally got ? and ?? to work for undefined things: now it's
5636 * Finally got ? and ?? to work for undefined things: now it's
5628 possible to type {}.get? and get information about the get method
5637 possible to type {}.get? and get information about the get method
5629 of dicts, or os.path? even if only os is defined (so technically
5638 of dicts, or os.path? even if only os is defined (so technically
5630 os.path isn't). Works at any level. For example, after import os,
5639 os.path isn't). Works at any level. For example, after import os,
5631 os?, os.path?, os.path.abspath? all work. This is great, took some
5640 os?, os.path?, os.path.abspath? all work. This is great, took some
5632 work in _ofind.
5641 work in _ofind.
5633
5642
5634 * Fixed more bugs with logging. The sanest way to do it was to add
5643 * Fixed more bugs with logging. The sanest way to do it was to add
5635 to @log a 'mode' parameter. Killed two in one shot (this mode
5644 to @log a 'mode' parameter. Killed two in one shot (this mode
5636 option was a request of Janko's). I think it's finally clean
5645 option was a request of Janko's). I think it's finally clean
5637 (famous last words).
5646 (famous last words).
5638
5647
5639 * Added a page_dumb() pager which does a decent job of paging on
5648 * Added a page_dumb() pager which does a decent job of paging on
5640 screen, if better things (like less) aren't available. One less
5649 screen, if better things (like less) aren't available. One less
5641 unix dependency (someday maybe somebody will port this to
5650 unix dependency (someday maybe somebody will port this to
5642 windows).
5651 windows).
5643
5652
5644 * Fixed problem in magic_log: would lock of logging out if log
5653 * Fixed problem in magic_log: would lock of logging out if log
5645 creation failed (because it would still think it had succeeded).
5654 creation failed (because it would still think it had succeeded).
5646
5655
5647 * Improved the page() function using curses to auto-detect screen
5656 * Improved the page() function using curses to auto-detect screen
5648 size. Now it can make a much better decision on whether to print
5657 size. Now it can make a much better decision on whether to print
5649 or page a string. Option screen_length was modified: a value 0
5658 or page a string. Option screen_length was modified: a value 0
5650 means auto-detect, and that's the default now.
5659 means auto-detect, and that's the default now.
5651
5660
5652 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5661 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5653 go out. I'll test it for a few days, then talk to Janko about
5662 go out. I'll test it for a few days, then talk to Janko about
5654 licences and announce it.
5663 licences and announce it.
5655
5664
5656 * Fixed the length of the auto-generated ---> prompt which appears
5665 * Fixed the length of the auto-generated ---> prompt which appears
5657 for auto-parens and auto-quotes. Getting this right isn't trivial,
5666 for auto-parens and auto-quotes. Getting this right isn't trivial,
5658 with all the color escapes, different prompt types and optional
5667 with all the color escapes, different prompt types and optional
5659 separators. But it seems to be working in all the combinations.
5668 separators. But it seems to be working in all the combinations.
5660
5669
5661 2001-11-26 Fernando Perez <fperez@colorado.edu>
5670 2001-11-26 Fernando Perez <fperez@colorado.edu>
5662
5671
5663 * Wrote a regexp filter to get option types from the option names
5672 * Wrote a regexp filter to get option types from the option names
5664 string. This eliminates the need to manually keep two duplicate
5673 string. This eliminates the need to manually keep two duplicate
5665 lists.
5674 lists.
5666
5675
5667 * Removed the unneeded check_option_names. Now options are handled
5676 * Removed the unneeded check_option_names. Now options are handled
5668 in a much saner manner and it's easy to visually check that things
5677 in a much saner manner and it's easy to visually check that things
5669 are ok.
5678 are ok.
5670
5679
5671 * Updated version numbers on all files I modified to carry a
5680 * Updated version numbers on all files I modified to carry a
5672 notice so Janko and Nathan have clear version markers.
5681 notice so Janko and Nathan have clear version markers.
5673
5682
5674 * Updated docstring for ultraTB with my changes. I should send
5683 * Updated docstring for ultraTB with my changes. I should send
5675 this to Nathan.
5684 this to Nathan.
5676
5685
5677 * Lots of small fixes. Ran everything through pychecker again.
5686 * Lots of small fixes. Ran everything through pychecker again.
5678
5687
5679 * Made loading of deep_reload an cmd line option. If it's not too
5688 * Made loading of deep_reload an cmd line option. If it's not too
5680 kosher, now people can just disable it. With -nodeep_reload it's
5689 kosher, now people can just disable it. With -nodeep_reload it's
5681 still available as dreload(), it just won't overwrite reload().
5690 still available as dreload(), it just won't overwrite reload().
5682
5691
5683 * Moved many options to the no| form (-opt and -noopt
5692 * Moved many options to the no| form (-opt and -noopt
5684 accepted). Cleaner.
5693 accepted). Cleaner.
5685
5694
5686 * Changed magic_log so that if called with no parameters, it uses
5695 * Changed magic_log so that if called with no parameters, it uses
5687 'rotate' mode. That way auto-generated logs aren't automatically
5696 'rotate' mode. That way auto-generated logs aren't automatically
5688 over-written. For normal logs, now a backup is made if it exists
5697 over-written. For normal logs, now a backup is made if it exists
5689 (only 1 level of backups). A new 'backup' mode was added to the
5698 (only 1 level of backups). A new 'backup' mode was added to the
5690 Logger class to support this. This was a request by Janko.
5699 Logger class to support this. This was a request by Janko.
5691
5700
5692 * Added @logoff/@logon to stop/restart an active log.
5701 * Added @logoff/@logon to stop/restart an active log.
5693
5702
5694 * Fixed a lot of bugs in log saving/replay. It was pretty
5703 * Fixed a lot of bugs in log saving/replay. It was pretty
5695 broken. Now special lines (!@,/) appear properly in the command
5704 broken. Now special lines (!@,/) appear properly in the command
5696 history after a log replay.
5705 history after a log replay.
5697
5706
5698 * Tried and failed to implement full session saving via pickle. My
5707 * Tried and failed to implement full session saving via pickle. My
5699 idea was to pickle __main__.__dict__, but modules can't be
5708 idea was to pickle __main__.__dict__, but modules can't be
5700 pickled. This would be a better alternative to replaying logs, but
5709 pickled. This would be a better alternative to replaying logs, but
5701 seems quite tricky to get to work. Changed -session to be called
5710 seems quite tricky to get to work. Changed -session to be called
5702 -logplay, which more accurately reflects what it does. And if we
5711 -logplay, which more accurately reflects what it does. And if we
5703 ever get real session saving working, -session is now available.
5712 ever get real session saving working, -session is now available.
5704
5713
5705 * Implemented color schemes for prompts also. As for tracebacks,
5714 * Implemented color schemes for prompts also. As for tracebacks,
5706 currently only NoColor and Linux are supported. But now the
5715 currently only NoColor and Linux are supported. But now the
5707 infrastructure is in place, based on a generic ColorScheme
5716 infrastructure is in place, based on a generic ColorScheme
5708 class. So writing and activating new schemes both for the prompts
5717 class. So writing and activating new schemes both for the prompts
5709 and the tracebacks should be straightforward.
5718 and the tracebacks should be straightforward.
5710
5719
5711 * Version 0.1.13 released, 0.1.14 opened.
5720 * Version 0.1.13 released, 0.1.14 opened.
5712
5721
5713 * Changed handling of options for output cache. Now counter is
5722 * Changed handling of options for output cache. Now counter is
5714 hardwired starting at 1 and one specifies the maximum number of
5723 hardwired starting at 1 and one specifies the maximum number of
5715 entries *in the outcache* (not the max prompt counter). This is
5724 entries *in the outcache* (not the max prompt counter). This is
5716 much better, since many statements won't increase the cache
5725 much better, since many statements won't increase the cache
5717 count. It also eliminated some confusing options, now there's only
5726 count. It also eliminated some confusing options, now there's only
5718 one: cache_size.
5727 one: cache_size.
5719
5728
5720 * Added 'alias' magic function and magic_alias option in the
5729 * Added 'alias' magic function and magic_alias option in the
5721 ipythonrc file. Now the user can easily define whatever names he
5730 ipythonrc file. Now the user can easily define whatever names he
5722 wants for the magic functions without having to play weird
5731 wants for the magic functions without having to play weird
5723 namespace games. This gives IPython a real shell-like feel.
5732 namespace games. This gives IPython a real shell-like feel.
5724
5733
5725 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5734 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5726 @ or not).
5735 @ or not).
5727
5736
5728 This was one of the last remaining 'visible' bugs (that I know
5737 This was one of the last remaining 'visible' bugs (that I know
5729 of). I think if I can clean up the session loading so it works
5738 of). I think if I can clean up the session loading so it works
5730 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5739 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5731 about licensing).
5740 about licensing).
5732
5741
5733 2001-11-25 Fernando Perez <fperez@colorado.edu>
5742 2001-11-25 Fernando Perez <fperez@colorado.edu>
5734
5743
5735 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5744 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5736 there's a cleaner distinction between what ? and ?? show.
5745 there's a cleaner distinction between what ? and ?? show.
5737
5746
5738 * Added screen_length option. Now the user can define his own
5747 * Added screen_length option. Now the user can define his own
5739 screen size for page() operations.
5748 screen size for page() operations.
5740
5749
5741 * Implemented magic shell-like functions with automatic code
5750 * Implemented magic shell-like functions with automatic code
5742 generation. Now adding another function is just a matter of adding
5751 generation. Now adding another function is just a matter of adding
5743 an entry to a dict, and the function is dynamically generated at
5752 an entry to a dict, and the function is dynamically generated at
5744 run-time. Python has some really cool features!
5753 run-time. Python has some really cool features!
5745
5754
5746 * Renamed many options to cleanup conventions a little. Now all
5755 * Renamed many options to cleanup conventions a little. Now all
5747 are lowercase, and only underscores where needed. Also in the code
5756 are lowercase, and only underscores where needed. Also in the code
5748 option name tables are clearer.
5757 option name tables are clearer.
5749
5758
5750 * Changed prompts a little. Now input is 'In [n]:' instead of
5759 * Changed prompts a little. Now input is 'In [n]:' instead of
5751 'In[n]:='. This allows it the numbers to be aligned with the
5760 'In[n]:='. This allows it the numbers to be aligned with the
5752 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5761 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5753 Python (it was a Mathematica thing). The '...' continuation prompt
5762 Python (it was a Mathematica thing). The '...' continuation prompt
5754 was also changed a little to align better.
5763 was also changed a little to align better.
5755
5764
5756 * Fixed bug when flushing output cache. Not all _p<n> variables
5765 * Fixed bug when flushing output cache. Not all _p<n> variables
5757 exist, so their deletion needs to be wrapped in a try:
5766 exist, so their deletion needs to be wrapped in a try:
5758
5767
5759 * Figured out how to properly use inspect.formatargspec() (it
5768 * Figured out how to properly use inspect.formatargspec() (it
5760 requires the args preceded by *). So I removed all the code from
5769 requires the args preceded by *). So I removed all the code from
5761 _get_pdef in Magic, which was just replicating that.
5770 _get_pdef in Magic, which was just replicating that.
5762
5771
5763 * Added test to prefilter to allow redefining magic function names
5772 * Added test to prefilter to allow redefining magic function names
5764 as variables. This is ok, since the @ form is always available,
5773 as variables. This is ok, since the @ form is always available,
5765 but whe should allow the user to define a variable called 'ls' if
5774 but whe should allow the user to define a variable called 'ls' if
5766 he needs it.
5775 he needs it.
5767
5776
5768 * Moved the ToDo information from README into a separate ToDo.
5777 * Moved the ToDo information from README into a separate ToDo.
5769
5778
5770 * General code cleanup and small bugfixes. I think it's close to a
5779 * General code cleanup and small bugfixes. I think it's close to a
5771 state where it can be released, obviously with a big 'beta'
5780 state where it can be released, obviously with a big 'beta'
5772 warning on it.
5781 warning on it.
5773
5782
5774 * Got the magic function split to work. Now all magics are defined
5783 * Got the magic function split to work. Now all magics are defined
5775 in a separate class. It just organizes things a bit, and now
5784 in a separate class. It just organizes things a bit, and now
5776 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5785 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5777 was too long).
5786 was too long).
5778
5787
5779 * Changed @clear to @reset to avoid potential confusions with
5788 * Changed @clear to @reset to avoid potential confusions with
5780 the shell command clear. Also renamed @cl to @clear, which does
5789 the shell command clear. Also renamed @cl to @clear, which does
5781 exactly what people expect it to from their shell experience.
5790 exactly what people expect it to from their shell experience.
5782
5791
5783 Added a check to the @reset command (since it's so
5792 Added a check to the @reset command (since it's so
5784 destructive, it's probably a good idea to ask for confirmation).
5793 destructive, it's probably a good idea to ask for confirmation).
5785 But now reset only works for full namespace resetting. Since the
5794 But now reset only works for full namespace resetting. Since the
5786 del keyword is already there for deleting a few specific
5795 del keyword is already there for deleting a few specific
5787 variables, I don't see the point of having a redundant magic
5796 variables, I don't see the point of having a redundant magic
5788 function for the same task.
5797 function for the same task.
5789
5798
5790 2001-11-24 Fernando Perez <fperez@colorado.edu>
5799 2001-11-24 Fernando Perez <fperez@colorado.edu>
5791
5800
5792 * Updated the builtin docs (esp. the ? ones).
5801 * Updated the builtin docs (esp. the ? ones).
5793
5802
5794 * Ran all the code through pychecker. Not terribly impressed with
5803 * Ran all the code through pychecker. Not terribly impressed with
5795 it: lots of spurious warnings and didn't really find anything of
5804 it: lots of spurious warnings and didn't really find anything of
5796 substance (just a few modules being imported and not used).
5805 substance (just a few modules being imported and not used).
5797
5806
5798 * Implemented the new ultraTB functionality into IPython. New
5807 * Implemented the new ultraTB functionality into IPython. New
5799 option: xcolors. This chooses color scheme. xmode now only selects
5808 option: xcolors. This chooses color scheme. xmode now only selects
5800 between Plain and Verbose. Better orthogonality.
5809 between Plain and Verbose. Better orthogonality.
5801
5810
5802 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5811 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5803 mode and color scheme for the exception handlers. Now it's
5812 mode and color scheme for the exception handlers. Now it's
5804 possible to have the verbose traceback with no coloring.
5813 possible to have the verbose traceback with no coloring.
5805
5814
5806 2001-11-23 Fernando Perez <fperez@colorado.edu>
5815 2001-11-23 Fernando Perez <fperez@colorado.edu>
5807
5816
5808 * Version 0.1.12 released, 0.1.13 opened.
5817 * Version 0.1.12 released, 0.1.13 opened.
5809
5818
5810 * Removed option to set auto-quote and auto-paren escapes by
5819 * Removed option to set auto-quote and auto-paren escapes by
5811 user. The chances of breaking valid syntax are just too high. If
5820 user. The chances of breaking valid syntax are just too high. If
5812 someone *really* wants, they can always dig into the code.
5821 someone *really* wants, they can always dig into the code.
5813
5822
5814 * Made prompt separators configurable.
5823 * Made prompt separators configurable.
5815
5824
5816 2001-11-22 Fernando Perez <fperez@colorado.edu>
5825 2001-11-22 Fernando Perez <fperez@colorado.edu>
5817
5826
5818 * Small bugfixes in many places.
5827 * Small bugfixes in many places.
5819
5828
5820 * Removed the MyCompleter class from ipplib. It seemed redundant
5829 * Removed the MyCompleter class from ipplib. It seemed redundant
5821 with the C-p,C-n history search functionality. Less code to
5830 with the C-p,C-n history search functionality. Less code to
5822 maintain.
5831 maintain.
5823
5832
5824 * Moved all the original ipython.py code into ipythonlib.py. Right
5833 * Moved all the original ipython.py code into ipythonlib.py. Right
5825 now it's just one big dump into a function called make_IPython, so
5834 now it's just one big dump into a function called make_IPython, so
5826 no real modularity has been gained. But at least it makes the
5835 no real modularity has been gained. But at least it makes the
5827 wrapper script tiny, and since ipythonlib is a module, it gets
5836 wrapper script tiny, and since ipythonlib is a module, it gets
5828 compiled and startup is much faster.
5837 compiled and startup is much faster.
5829
5838
5830 This is a reasobably 'deep' change, so we should test it for a
5839 This is a reasobably 'deep' change, so we should test it for a
5831 while without messing too much more with the code.
5840 while without messing too much more with the code.
5832
5841
5833 2001-11-21 Fernando Perez <fperez@colorado.edu>
5842 2001-11-21 Fernando Perez <fperez@colorado.edu>
5834
5843
5835 * Version 0.1.11 released, 0.1.12 opened for further work.
5844 * Version 0.1.11 released, 0.1.12 opened for further work.
5836
5845
5837 * Removed dependency on Itpl. It was only needed in one place. It
5846 * Removed dependency on Itpl. It was only needed in one place. It
5838 would be nice if this became part of python, though. It makes life
5847 would be nice if this became part of python, though. It makes life
5839 *a lot* easier in some cases.
5848 *a lot* easier in some cases.
5840
5849
5841 * Simplified the prefilter code a bit. Now all handlers are
5850 * Simplified the prefilter code a bit. Now all handlers are
5842 expected to explicitly return a value (at least a blank string).
5851 expected to explicitly return a value (at least a blank string).
5843
5852
5844 * Heavy edits in ipplib. Removed the help system altogether. Now
5853 * Heavy edits in ipplib. Removed the help system altogether. Now
5845 obj?/?? is used for inspecting objects, a magic @doc prints
5854 obj?/?? is used for inspecting objects, a magic @doc prints
5846 docstrings, and full-blown Python help is accessed via the 'help'
5855 docstrings, and full-blown Python help is accessed via the 'help'
5847 keyword. This cleans up a lot of code (less to maintain) and does
5856 keyword. This cleans up a lot of code (less to maintain) and does
5848 the job. Since 'help' is now a standard Python component, might as
5857 the job. Since 'help' is now a standard Python component, might as
5849 well use it and remove duplicate functionality.
5858 well use it and remove duplicate functionality.
5850
5859
5851 Also removed the option to use ipplib as a standalone program. By
5860 Also removed the option to use ipplib as a standalone program. By
5852 now it's too dependent on other parts of IPython to function alone.
5861 now it's too dependent on other parts of IPython to function alone.
5853
5862
5854 * Fixed bug in genutils.pager. It would crash if the pager was
5863 * Fixed bug in genutils.pager. It would crash if the pager was
5855 exited immediately after opening (broken pipe).
5864 exited immediately after opening (broken pipe).
5856
5865
5857 * Trimmed down the VerboseTB reporting a little. The header is
5866 * Trimmed down the VerboseTB reporting a little. The header is
5858 much shorter now and the repeated exception arguments at the end
5867 much shorter now and the repeated exception arguments at the end
5859 have been removed. For interactive use the old header seemed a bit
5868 have been removed. For interactive use the old header seemed a bit
5860 excessive.
5869 excessive.
5861
5870
5862 * Fixed small bug in output of @whos for variables with multi-word
5871 * Fixed small bug in output of @whos for variables with multi-word
5863 types (only first word was displayed).
5872 types (only first word was displayed).
5864
5873
5865 2001-11-17 Fernando Perez <fperez@colorado.edu>
5874 2001-11-17 Fernando Perez <fperez@colorado.edu>
5866
5875
5867 * Version 0.1.10 released, 0.1.11 opened for further work.
5876 * Version 0.1.10 released, 0.1.11 opened for further work.
5868
5877
5869 * Modified dirs and friends. dirs now *returns* the stack (not
5878 * Modified dirs and friends. dirs now *returns* the stack (not
5870 prints), so one can manipulate it as a variable. Convenient to
5879 prints), so one can manipulate it as a variable. Convenient to
5871 travel along many directories.
5880 travel along many directories.
5872
5881
5873 * Fixed bug in magic_pdef: would only work with functions with
5882 * Fixed bug in magic_pdef: would only work with functions with
5874 arguments with default values.
5883 arguments with default values.
5875
5884
5876 2001-11-14 Fernando Perez <fperez@colorado.edu>
5885 2001-11-14 Fernando Perez <fperez@colorado.edu>
5877
5886
5878 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5887 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5879 example with IPython. Various other minor fixes and cleanups.
5888 example with IPython. Various other minor fixes and cleanups.
5880
5889
5881 * Version 0.1.9 released, 0.1.10 opened for further work.
5890 * Version 0.1.9 released, 0.1.10 opened for further work.
5882
5891
5883 * Added sys.path to the list of directories searched in the
5892 * Added sys.path to the list of directories searched in the
5884 execfile= option. It used to be the current directory and the
5893 execfile= option. It used to be the current directory and the
5885 user's IPYTHONDIR only.
5894 user's IPYTHONDIR only.
5886
5895
5887 2001-11-13 Fernando Perez <fperez@colorado.edu>
5896 2001-11-13 Fernando Perez <fperez@colorado.edu>
5888
5897
5889 * Reinstated the raw_input/prefilter separation that Janko had
5898 * Reinstated the raw_input/prefilter separation that Janko had
5890 initially. This gives a more convenient setup for extending the
5899 initially. This gives a more convenient setup for extending the
5891 pre-processor from the outside: raw_input always gets a string,
5900 pre-processor from the outside: raw_input always gets a string,
5892 and prefilter has to process it. We can then redefine prefilter
5901 and prefilter has to process it. We can then redefine prefilter
5893 from the outside and implement extensions for special
5902 from the outside and implement extensions for special
5894 purposes.
5903 purposes.
5895
5904
5896 Today I got one for inputting PhysicalQuantity objects
5905 Today I got one for inputting PhysicalQuantity objects
5897 (from Scientific) without needing any function calls at
5906 (from Scientific) without needing any function calls at
5898 all. Extremely convenient, and it's all done as a user-level
5907 all. Extremely convenient, and it's all done as a user-level
5899 extension (no IPython code was touched). Now instead of:
5908 extension (no IPython code was touched). Now instead of:
5900 a = PhysicalQuantity(4.2,'m/s**2')
5909 a = PhysicalQuantity(4.2,'m/s**2')
5901 one can simply say
5910 one can simply say
5902 a = 4.2 m/s**2
5911 a = 4.2 m/s**2
5903 or even
5912 or even
5904 a = 4.2 m/s^2
5913 a = 4.2 m/s^2
5905
5914
5906 I use this, but it's also a proof of concept: IPython really is
5915 I use this, but it's also a proof of concept: IPython really is
5907 fully user-extensible, even at the level of the parsing of the
5916 fully user-extensible, even at the level of the parsing of the
5908 command line. It's not trivial, but it's perfectly doable.
5917 command line. It's not trivial, but it's perfectly doable.
5909
5918
5910 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5919 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5911 the problem of modules being loaded in the inverse order in which
5920 the problem of modules being loaded in the inverse order in which
5912 they were defined in
5921 they were defined in
5913
5922
5914 * Version 0.1.8 released, 0.1.9 opened for further work.
5923 * Version 0.1.8 released, 0.1.9 opened for further work.
5915
5924
5916 * Added magics pdef, source and file. They respectively show the
5925 * Added magics pdef, source and file. They respectively show the
5917 definition line ('prototype' in C), source code and full python
5926 definition line ('prototype' in C), source code and full python
5918 file for any callable object. The object inspector oinfo uses
5927 file for any callable object. The object inspector oinfo uses
5919 these to show the same information.
5928 these to show the same information.
5920
5929
5921 * Version 0.1.7 released, 0.1.8 opened for further work.
5930 * Version 0.1.7 released, 0.1.8 opened for further work.
5922
5931
5923 * Separated all the magic functions into a class called Magic. The
5932 * Separated all the magic functions into a class called Magic. The
5924 InteractiveShell class was becoming too big for Xemacs to handle
5933 InteractiveShell class was becoming too big for Xemacs to handle
5925 (de-indenting a line would lock it up for 10 seconds while it
5934 (de-indenting a line would lock it up for 10 seconds while it
5926 backtracked on the whole class!)
5935 backtracked on the whole class!)
5927
5936
5928 FIXME: didn't work. It can be done, but right now namespaces are
5937 FIXME: didn't work. It can be done, but right now namespaces are
5929 all messed up. Do it later (reverted it for now, so at least
5938 all messed up. Do it later (reverted it for now, so at least
5930 everything works as before).
5939 everything works as before).
5931
5940
5932 * Got the object introspection system (magic_oinfo) working! I
5941 * Got the object introspection system (magic_oinfo) working! I
5933 think this is pretty much ready for release to Janko, so he can
5942 think this is pretty much ready for release to Janko, so he can
5934 test it for a while and then announce it. Pretty much 100% of what
5943 test it for a while and then announce it. Pretty much 100% of what
5935 I wanted for the 'phase 1' release is ready. Happy, tired.
5944 I wanted for the 'phase 1' release is ready. Happy, tired.
5936
5945
5937 2001-11-12 Fernando Perez <fperez@colorado.edu>
5946 2001-11-12 Fernando Perez <fperez@colorado.edu>
5938
5947
5939 * Version 0.1.6 released, 0.1.7 opened for further work.
5948 * Version 0.1.6 released, 0.1.7 opened for further work.
5940
5949
5941 * Fixed bug in printing: it used to test for truth before
5950 * Fixed bug in printing: it used to test for truth before
5942 printing, so 0 wouldn't print. Now checks for None.
5951 printing, so 0 wouldn't print. Now checks for None.
5943
5952
5944 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5953 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5945 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5954 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5946 reaches by hand into the outputcache. Think of a better way to do
5955 reaches by hand into the outputcache. Think of a better way to do
5947 this later.
5956 this later.
5948
5957
5949 * Various small fixes thanks to Nathan's comments.
5958 * Various small fixes thanks to Nathan's comments.
5950
5959
5951 * Changed magic_pprint to magic_Pprint. This way it doesn't
5960 * Changed magic_pprint to magic_Pprint. This way it doesn't
5952 collide with pprint() and the name is consistent with the command
5961 collide with pprint() and the name is consistent with the command
5953 line option.
5962 line option.
5954
5963
5955 * Changed prompt counter behavior to be fully like
5964 * Changed prompt counter behavior to be fully like
5956 Mathematica's. That is, even input that doesn't return a result
5965 Mathematica's. That is, even input that doesn't return a result
5957 raises the prompt counter. The old behavior was kind of confusing
5966 raises the prompt counter. The old behavior was kind of confusing
5958 (getting the same prompt number several times if the operation
5967 (getting the same prompt number several times if the operation
5959 didn't return a result).
5968 didn't return a result).
5960
5969
5961 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5970 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5962
5971
5963 * Fixed -Classic mode (wasn't working anymore).
5972 * Fixed -Classic mode (wasn't working anymore).
5964
5973
5965 * Added colored prompts using Nathan's new code. Colors are
5974 * Added colored prompts using Nathan's new code. Colors are
5966 currently hardwired, they can be user-configurable. For
5975 currently hardwired, they can be user-configurable. For
5967 developers, they can be chosen in file ipythonlib.py, at the
5976 developers, they can be chosen in file ipythonlib.py, at the
5968 beginning of the CachedOutput class def.
5977 beginning of the CachedOutput class def.
5969
5978
5970 2001-11-11 Fernando Perez <fperez@colorado.edu>
5979 2001-11-11 Fernando Perez <fperez@colorado.edu>
5971
5980
5972 * Version 0.1.5 released, 0.1.6 opened for further work.
5981 * Version 0.1.5 released, 0.1.6 opened for further work.
5973
5982
5974 * Changed magic_env to *return* the environment as a dict (not to
5983 * Changed magic_env to *return* the environment as a dict (not to
5975 print it). This way it prints, but it can also be processed.
5984 print it). This way it prints, but it can also be processed.
5976
5985
5977 * Added Verbose exception reporting to interactive
5986 * Added Verbose exception reporting to interactive
5978 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5987 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5979 traceback. Had to make some changes to the ultraTB file. This is
5988 traceback. Had to make some changes to the ultraTB file. This is
5980 probably the last 'big' thing in my mental todo list. This ties
5989 probably the last 'big' thing in my mental todo list. This ties
5981 in with the next entry:
5990 in with the next entry:
5982
5991
5983 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5992 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5984 has to specify is Plain, Color or Verbose for all exception
5993 has to specify is Plain, Color or Verbose for all exception
5985 handling.
5994 handling.
5986
5995
5987 * Removed ShellServices option. All this can really be done via
5996 * Removed ShellServices option. All this can really be done via
5988 the magic system. It's easier to extend, cleaner and has automatic
5997 the magic system. It's easier to extend, cleaner and has automatic
5989 namespace protection and documentation.
5998 namespace protection and documentation.
5990
5999
5991 2001-11-09 Fernando Perez <fperez@colorado.edu>
6000 2001-11-09 Fernando Perez <fperez@colorado.edu>
5992
6001
5993 * Fixed bug in output cache flushing (missing parameter to
6002 * Fixed bug in output cache flushing (missing parameter to
5994 __init__). Other small bugs fixed (found using pychecker).
6003 __init__). Other small bugs fixed (found using pychecker).
5995
6004
5996 * Version 0.1.4 opened for bugfixing.
6005 * Version 0.1.4 opened for bugfixing.
5997
6006
5998 2001-11-07 Fernando Perez <fperez@colorado.edu>
6007 2001-11-07 Fernando Perez <fperez@colorado.edu>
5999
6008
6000 * Version 0.1.3 released, mainly because of the raw_input bug.
6009 * Version 0.1.3 released, mainly because of the raw_input bug.
6001
6010
6002 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6011 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6003 and when testing for whether things were callable, a call could
6012 and when testing for whether things were callable, a call could
6004 actually be made to certain functions. They would get called again
6013 actually be made to certain functions. They would get called again
6005 once 'really' executed, with a resulting double call. A disaster
6014 once 'really' executed, with a resulting double call. A disaster
6006 in many cases (list.reverse() would never work!).
6015 in many cases (list.reverse() would never work!).
6007
6016
6008 * Removed prefilter() function, moved its code to raw_input (which
6017 * Removed prefilter() function, moved its code to raw_input (which
6009 after all was just a near-empty caller for prefilter). This saves
6018 after all was just a near-empty caller for prefilter). This saves
6010 a function call on every prompt, and simplifies the class a tiny bit.
6019 a function call on every prompt, and simplifies the class a tiny bit.
6011
6020
6012 * Fix _ip to __ip name in magic example file.
6021 * Fix _ip to __ip name in magic example file.
6013
6022
6014 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6023 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6015 work with non-gnu versions of tar.
6024 work with non-gnu versions of tar.
6016
6025
6017 2001-11-06 Fernando Perez <fperez@colorado.edu>
6026 2001-11-06 Fernando Perez <fperez@colorado.edu>
6018
6027
6019 * Version 0.1.2. Just to keep track of the recent changes.
6028 * Version 0.1.2. Just to keep track of the recent changes.
6020
6029
6021 * Fixed nasty bug in output prompt routine. It used to check 'if
6030 * Fixed nasty bug in output prompt routine. It used to check 'if
6022 arg != None...'. Problem is, this fails if arg implements a
6031 arg != None...'. Problem is, this fails if arg implements a
6023 special comparison (__cmp__) which disallows comparing to
6032 special comparison (__cmp__) which disallows comparing to
6024 None. Found it when trying to use the PhysicalQuantity module from
6033 None. Found it when trying to use the PhysicalQuantity module from
6025 ScientificPython.
6034 ScientificPython.
6026
6035
6027 2001-11-05 Fernando Perez <fperez@colorado.edu>
6036 2001-11-05 Fernando Perez <fperez@colorado.edu>
6028
6037
6029 * Also added dirs. Now the pushd/popd/dirs family functions
6038 * Also added dirs. Now the pushd/popd/dirs family functions
6030 basically like the shell, with the added convenience of going home
6039 basically like the shell, with the added convenience of going home
6031 when called with no args.
6040 when called with no args.
6032
6041
6033 * pushd/popd slightly modified to mimic shell behavior more
6042 * pushd/popd slightly modified to mimic shell behavior more
6034 closely.
6043 closely.
6035
6044
6036 * Added env,pushd,popd from ShellServices as magic functions. I
6045 * Added env,pushd,popd from ShellServices as magic functions. I
6037 think the cleanest will be to port all desired functions from
6046 think the cleanest will be to port all desired functions from
6038 ShellServices as magics and remove ShellServices altogether. This
6047 ShellServices as magics and remove ShellServices altogether. This
6039 will provide a single, clean way of adding functionality
6048 will provide a single, clean way of adding functionality
6040 (shell-type or otherwise) to IP.
6049 (shell-type or otherwise) to IP.
6041
6050
6042 2001-11-04 Fernando Perez <fperez@colorado.edu>
6051 2001-11-04 Fernando Perez <fperez@colorado.edu>
6043
6052
6044 * Added .ipython/ directory to sys.path. This way users can keep
6053 * Added .ipython/ directory to sys.path. This way users can keep
6045 customizations there and access them via import.
6054 customizations there and access them via import.
6046
6055
6047 2001-11-03 Fernando Perez <fperez@colorado.edu>
6056 2001-11-03 Fernando Perez <fperez@colorado.edu>
6048
6057
6049 * Opened version 0.1.1 for new changes.
6058 * Opened version 0.1.1 for new changes.
6050
6059
6051 * Changed version number to 0.1.0: first 'public' release, sent to
6060 * Changed version number to 0.1.0: first 'public' release, sent to
6052 Nathan and Janko.
6061 Nathan and Janko.
6053
6062
6054 * Lots of small fixes and tweaks.
6063 * Lots of small fixes and tweaks.
6055
6064
6056 * Minor changes to whos format. Now strings are shown, snipped if
6065 * Minor changes to whos format. Now strings are shown, snipped if
6057 too long.
6066 too long.
6058
6067
6059 * Changed ShellServices to work on __main__ so they show up in @who
6068 * Changed ShellServices to work on __main__ so they show up in @who
6060
6069
6061 * Help also works with ? at the end of a line:
6070 * Help also works with ? at the end of a line:
6062 ?sin and sin?
6071 ?sin and sin?
6063 both produce the same effect. This is nice, as often I use the
6072 both produce the same effect. This is nice, as often I use the
6064 tab-complete to find the name of a method, but I used to then have
6073 tab-complete to find the name of a method, but I used to then have
6065 to go to the beginning of the line to put a ? if I wanted more
6074 to go to the beginning of the line to put a ? if I wanted more
6066 info. Now I can just add the ? and hit return. Convenient.
6075 info. Now I can just add the ? and hit return. Convenient.
6067
6076
6068 2001-11-02 Fernando Perez <fperez@colorado.edu>
6077 2001-11-02 Fernando Perez <fperez@colorado.edu>
6069
6078
6070 * Python version check (>=2.1) added.
6079 * Python version check (>=2.1) added.
6071
6080
6072 * Added LazyPython documentation. At this point the docs are quite
6081 * Added LazyPython documentation. At this point the docs are quite
6073 a mess. A cleanup is in order.
6082 a mess. A cleanup is in order.
6074
6083
6075 * Auto-installer created. For some bizarre reason, the zipfiles
6084 * Auto-installer created. For some bizarre reason, the zipfiles
6076 module isn't working on my system. So I made a tar version
6085 module isn't working on my system. So I made a tar version
6077 (hopefully the command line options in various systems won't kill
6086 (hopefully the command line options in various systems won't kill
6078 me).
6087 me).
6079
6088
6080 * Fixes to Struct in genutils. Now all dictionary-like methods are
6089 * Fixes to Struct in genutils. Now all dictionary-like methods are
6081 protected (reasonably).
6090 protected (reasonably).
6082
6091
6083 * Added pager function to genutils and changed ? to print usage
6092 * Added pager function to genutils and changed ? to print usage
6084 note through it (it was too long).
6093 note through it (it was too long).
6085
6094
6086 * Added the LazyPython functionality. Works great! I changed the
6095 * Added the LazyPython functionality. Works great! I changed the
6087 auto-quote escape to ';', it's on home row and next to '. But
6096 auto-quote escape to ';', it's on home row and next to '. But
6088 both auto-quote and auto-paren (still /) escapes are command-line
6097 both auto-quote and auto-paren (still /) escapes are command-line
6089 parameters.
6098 parameters.
6090
6099
6091
6100
6092 2001-11-01 Fernando Perez <fperez@colorado.edu>
6101 2001-11-01 Fernando Perez <fperez@colorado.edu>
6093
6102
6094 * Version changed to 0.0.7. Fairly large change: configuration now
6103 * Version changed to 0.0.7. Fairly large change: configuration now
6095 is all stored in a directory, by default .ipython. There, all
6104 is all stored in a directory, by default .ipython. There, all
6096 config files have normal looking names (not .names)
6105 config files have normal looking names (not .names)
6097
6106
6098 * Version 0.0.6 Released first to Lucas and Archie as a test
6107 * Version 0.0.6 Released first to Lucas and Archie as a test
6099 run. Since it's the first 'semi-public' release, change version to
6108 run. Since it's the first 'semi-public' release, change version to
6100 > 0.0.6 for any changes now.
6109 > 0.0.6 for any changes now.
6101
6110
6102 * Stuff I had put in the ipplib.py changelog:
6111 * Stuff I had put in the ipplib.py changelog:
6103
6112
6104 Changes to InteractiveShell:
6113 Changes to InteractiveShell:
6105
6114
6106 - Made the usage message a parameter.
6115 - Made the usage message a parameter.
6107
6116
6108 - Require the name of the shell variable to be given. It's a bit
6117 - Require the name of the shell variable to be given. It's a bit
6109 of a hack, but allows the name 'shell' not to be hardwired in the
6118 of a hack, but allows the name 'shell' not to be hardwired in the
6110 magic (@) handler, which is problematic b/c it requires
6119 magic (@) handler, which is problematic b/c it requires
6111 polluting the global namespace with 'shell'. This in turn is
6120 polluting the global namespace with 'shell'. This in turn is
6112 fragile: if a user redefines a variable called shell, things
6121 fragile: if a user redefines a variable called shell, things
6113 break.
6122 break.
6114
6123
6115 - magic @: all functions available through @ need to be defined
6124 - magic @: all functions available through @ need to be defined
6116 as magic_<name>, even though they can be called simply as
6125 as magic_<name>, even though they can be called simply as
6117 @<name>. This allows the special command @magic to gather
6126 @<name>. This allows the special command @magic to gather
6118 information automatically about all existing magic functions,
6127 information automatically about all existing magic functions,
6119 even if they are run-time user extensions, by parsing the shell
6128 even if they are run-time user extensions, by parsing the shell
6120 instance __dict__ looking for special magic_ names.
6129 instance __dict__ looking for special magic_ names.
6121
6130
6122 - mainloop: added *two* local namespace parameters. This allows
6131 - mainloop: added *two* local namespace parameters. This allows
6123 the class to differentiate between parameters which were there
6132 the class to differentiate between parameters which were there
6124 before and after command line initialization was processed. This
6133 before and after command line initialization was processed. This
6125 way, later @who can show things loaded at startup by the
6134 way, later @who can show things loaded at startup by the
6126 user. This trick was necessary to make session saving/reloading
6135 user. This trick was necessary to make session saving/reloading
6127 really work: ideally after saving/exiting/reloading a session,
6136 really work: ideally after saving/exiting/reloading a session,
6128 *everything* should look the same, including the output of @who. I
6137 *everything* should look the same, including the output of @who. I
6129 was only able to make this work with this double namespace
6138 was only able to make this work with this double namespace
6130 trick.
6139 trick.
6131
6140
6132 - added a header to the logfile which allows (almost) full
6141 - added a header to the logfile which allows (almost) full
6133 session restoring.
6142 session restoring.
6134
6143
6135 - prepend lines beginning with @ or !, with a and log
6144 - prepend lines beginning with @ or !, with a and log
6136 them. Why? !lines: may be useful to know what you did @lines:
6145 them. Why? !lines: may be useful to know what you did @lines:
6137 they may affect session state. So when restoring a session, at
6146 they may affect session state. So when restoring a session, at
6138 least inform the user of their presence. I couldn't quite get
6147 least inform the user of their presence. I couldn't quite get
6139 them to properly re-execute, but at least the user is warned.
6148 them to properly re-execute, but at least the user is warned.
6140
6149
6141 * Started ChangeLog.
6150 * Started ChangeLog.
@@ -1,29 +1,29 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # release test
3 # release test
4
4
5 # clean up build/dist directories
5 # clean up build/dist directories
6 rm -rf ~/ipython/ipython/build/*
6 rm -rf ~/ipython/ipython/build/*
7 rm -rf ~/ipython/ipython/dist/*
7 rm -rf ~/ipython/ipython/dist/*
8
8
9 # build source distros
9 # build source distros
10 cd ~/ipython/ipython
10 cd ~/ipython/ipython
11
11
12 ./setup.py sdist --formats=gztar
12 ./setup.py sdist --formats=gztar
13
13
14 # Build rpm
14 # Build rpm
15 python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
15 #python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
16
16
17 # Build eggs
17 # Build eggs
18 ./eggsetup.py bdist_egg
18 ./eggsetup.py bdist_egg
19
19
20 # Call the windows build separately, so that the extra Windows scripts don't
20 # Call the windows build separately, so that the extra Windows scripts don't
21 # get pulled into Unix builds (setup.py has code which checks for
21 # get pulled into Unix builds (setup.py has code which checks for
22 # bdist_wininst)
22 # bdist_wininst)
23
23
24 # For now, make the win32 installer with a hand-built 2.3.5 python, which is
24 # For now, make the win32 installer with a hand-built 2.3.5 python, which is
25 # the only one that fixes a crash in the post-install phase.
25 # the only one that fixes a crash in the post-install phase.
26 #$HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \
26 #$HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \
27 # --install-script=ipython_win_post_install.py
27 # --install-script=ipython_win_post_install.py
28
28
29 ./setup.py bdist_wininst --install-script=ipython_win_post_install.py
29 ./setup.py bdist_wininst --install-script=ipython_win_post_install.py
@@ -1,6 +1,6 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # clean public testing/ dir and upload
3 # clean public testing/ dir and upload
4 ssh "rm -f ipython@ipython.scipy.org:www/dist/testing/*"
4 #ssh "rm -f ipython@ipython.scipy.org:www/dist/testing/*"
5 cd ~/ipython/ipython/dist
5 cd ~/ipython/ipython/dist
6 scp * ipython@ipython.scipy.org:www/dist/testing/
6 scp * ipython@ipython.scipy.org:www/dist/testing/
General Comments 0
You need to be logged in to leave comments. Login now