##// END OF EJS Templates
Last set of Rocky's patches for pydb integration
vivainio -
Show More
@@ -1,315 +1,411 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 Pdb debugger class.
4 4
5 5 Modified from the standard pdb.Pdb class to avoid including readline, so that
6 6 the command line completion of other programs which include this isn't
7 7 damaged.
8 8
9 9 In the future, this class will be expanded with improvements over the standard
10 10 pdb.
11 11
12 12 The code in this file is mainly lifted out of cmd.py in Python 2.2, with minor
13 13 changes. Licensing should therefore be under the standard Python terms. For
14 14 details on the PSF (Python Software Foundation) standard license, see:
15 15
16 16 http://www.python.org/2.2.3/license.html
17 17
18 $Id: Debugger.py 1787 2006-09-27 06:56:29Z fperez $"""
18 $Id: Debugger.py 1853 2006-10-30 17:00:39Z vivainio $"""
19 19
20 20 #*****************************************************************************
21 21 #
22 22 # Since this file is essentially a modified copy of the pdb module which is
23 23 # part of the standard Python distribution, I assume that the proper procedure
24 24 # is to maintain its copyright as belonging to the Python Software Foundation
25 25 # (in addition to my own, for all new code).
26 26 #
27 27 # Copyright (C) 2001 Python Software Foundation, www.python.org
28 28 # Copyright (C) 2005-2006 Fernando Perez. <fperez@colorado.edu>
29 29 #
30 30 # Distributed under the terms of the BSD License. The full license is in
31 31 # the file COPYING, distributed as part of this software.
32 32 #
33 33 #*****************************************************************************
34 34
35 35 from IPython import Release
36 36 __author__ = '%s <%s>' % Release.authors['Fernando']
37 37 __license__ = 'Python'
38 38
39 39 import bdb
40 40 import cmd
41 41 import linecache
42 42 import os
43 import pdb
44 43 import sys
45 44
46 45 from IPython import PyColorize, ColorANSI
47 46 from IPython.genutils import Term
48 47 from IPython.excolors import ExceptionColors
49 48
49 # See if we can use pydb.
50 has_pydb = False
51 prompt = 'ipdb>'
52 if sys.version[:3] >= '2.5':
53 try:
54 import pydb
55 if hasattr(pydb.pydb, "runl"):
56 has_pydb = True
57 from pydb import Pdb as OldPdb
58 prompt = 'ipydb>'
59 except ImportError:
60 pass
61
62 if has_pydb:
63 from pydb import Pdb as OldPdb
64 else:
65 from pdb import Pdb as OldPdb
66
67 def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):
68 """Make new_fn have old_fn's doc string. This is particularly useful
69 for the do_... commands that hook into the help system.
70 Adapted from from a comp.lang.python posting
71 by Duncan Booth."""
72 def wrapper(*args, **kw):
73 return new_fn(*args, **kw)
74 if old_fn.__doc__:
75 wrapper.__doc__ = old_fn.__doc__ + additional_text
76 return wrapper
77
50 78 def _file_lines(fname):
51 79 """Return the contents of a named file as a list of lines.
52 80
53 81 This function never raises an IOError exception: if the file can't be
54 82 read, it simply returns an empty list."""
55 83
56 84 try:
57 85 outfile = open(fname)
58 86 except IOError:
59 87 return []
60 88 else:
61 89 out = outfile.readlines()
62 90 outfile.close()
63 91 return out
64 92
65 class Pdb(pdb.Pdb):
93 class Pdb(OldPdb):
66 94 """Modified Pdb class, does not load readline."""
67 95
68 96 if sys.version[:3] >= '2.5':
69 97 def __init__(self,color_scheme='NoColor',completekey=None,
70 98 stdin=None, stdout=None):
71 99
72 100 # Parent constructor:
73 pdb.Pdb.__init__(self,completekey,stdin,stdout)
101 OldPdb.__init__(self,completekey,stdin,stdout)
74 102
75 103 # IPython changes...
76 self.prompt = 'ipdb> ' # The default prompt is '(Pdb)'
104 self.prompt = prompt # The default prompt is '(Pdb)'
105 self.is_pydb = prompt == 'ipydb>'
106
107 if self.is_pydb:
108
109 # iplib.py's ipalias seems to want pdb's checkline
110 # which located in pydb.fn
111 import pydb.fns
112 self.checkline = lambda filename, lineno: \
113 pydb.fns.checkline(self, filename, lineno)
114
115 self.curframe = None
116 self.do_restart = self.new_do_restart
117
118 self.old_all_completions = __IPYTHON__.Completer.all_completions
119 __IPYTHON__.Completer.all_completions=self.all_completions
120
121 # Do we have access to pydb's list command parser?
122 self.do_list = decorate_fn_with_doc(self.list_command_pydb,
123 OldPdb.do_list)
124 self.do_l = self.do_list
125 self.do_frame = decorate_fn_with_doc(self.new_do_frame,
126 OldPdb.do_frame)
127
77 128 self.aliases = {}
78 129
79 130 # Create color table: we copy the default one from the traceback
80 131 # module and add a few attributes needed for debugging
81 132 self.color_scheme_table = ExceptionColors.copy()
82 133
83 134 # shorthands
84 135 C = ColorANSI.TermColors
85 136 cst = self.color_scheme_table
86 137
87 138 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
88 139 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
89 140
90 141 cst['Linux'].colors.breakpoint_enabled = C.LightRed
91 142 cst['Linux'].colors.breakpoint_disabled = C.Red
92 143
93 144 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
94 145 cst['LightBG'].colors.breakpoint_disabled = C.Red
95 146
96 147 self.set_colors(color_scheme)
97 148
98 149 else:
99 150 # Ugly hack: for Python 2.3-2.4, we can't call the parent constructor,
100 151 # because it binds readline and breaks tab-completion. This means we
101 152 # have to COPY the constructor here.
102 153 def __init__(self,color_scheme='NoColor'):
103 154 bdb.Bdb.__init__(self)
104 155 cmd.Cmd.__init__(self,completekey=None) # don't load readline
105 156 self.prompt = 'ipdb> ' # The default prompt is '(Pdb)'
106 157 self.aliases = {}
107 158
108 159 # These two lines are part of the py2.4 constructor, let's put them
109 160 # unconditionally here as they won't cause any problems in 2.3.
110 161 self.mainpyfile = ''
111 162 self._wait_for_mainpyfile = 0
112 163
113 164 # Read $HOME/.pdbrc and ./.pdbrc
114 165 try:
115 166 self.rcLines = _file_lines(os.path.join(os.environ['HOME'],
116 167 ".pdbrc"))
117 168 except KeyError:
118 169 self.rcLines = []
119 170 self.rcLines.extend(_file_lines(".pdbrc"))
120 171
121 172 # Create color table: we copy the default one from the traceback
122 173 # module and add a few attributes needed for debugging
123 174 self.color_scheme_table = ExceptionColors.copy()
124 175
125 176 # shorthands
126 177 C = ColorANSI.TermColors
127 178 cst = self.color_scheme_table
128 179
129 180 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
130 181 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
131 182
132 183 cst['Linux'].colors.breakpoint_enabled = C.LightRed
133 184 cst['Linux'].colors.breakpoint_disabled = C.Red
134 185
135 186 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
136 187 cst['LightBG'].colors.breakpoint_disabled = C.Red
137 188
138 189 self.set_colors(color_scheme)
139 190
140 191 def set_colors(self, scheme):
141 192 """Shorthand access to the color table scheme selector method."""
142 193 self.color_scheme_table.set_active_scheme(scheme)
143 194
144 195 def interaction(self, frame, traceback):
145 196 __IPYTHON__.set_completer_frame(frame)
146 pdb.Pdb.interaction(self, frame, traceback)
197 OldPdb.interaction(self, frame, traceback)
198
199 def new_do_up(self, arg):
200 OldPdb.do_up(self, arg)
201 __IPYTHON__.set_completer_frame(self.curframe)
202 do_u = do_up = decorate_fn_with_doc(new_do_up, OldPdb.do_up)
147 203
148 def do_up(self, arg):
149 pdb.Pdb.do_up(self, arg)
204 def new_do_down(self, arg):
205 OldPdb.do_down(self, arg)
150 206 __IPYTHON__.set_completer_frame(self.curframe)
151 do_u = do_up
152 207
153 def do_down(self, arg):
154 pdb.Pdb.do_down(self, arg)
208 do_d = do_down = decorate_fn_with_doc(new_do_down, OldPdb.do_down)
209
210 def new_do_frame(self, arg):
211 OldPdb.do_frame(self, arg)
155 212 __IPYTHON__.set_completer_frame(self.curframe)
156 do_d = do_down
213
214 def new_do_quit(self, arg):
215 __IPYTHON__.Completer.all_completions=self.old_all_completions
216 return OldPdb.do_quit(self, arg)
217
218 do_q = do_quit = decorate_fn_with_doc(new_do_quit, OldPdb.do_quit)
219
220 def new_do_restart(self, arg):
221 """Restart command. In the context of ipython this is exactly the same
222 thing as 'quit'."""
223 self.msg("Restart doesn't make sense here. Using 'quit' instead.")
224 return self.do_quit(arg)
157 225
158 226 def postloop(self):
159 227 __IPYTHON__.set_completer_frame(None)
160 228
161 229 def print_stack_trace(self):
162 230 try:
163 231 for frame_lineno in self.stack:
164 232 self.print_stack_entry(frame_lineno, context = 5)
165 233 except KeyboardInterrupt:
166 234 pass
167 235
168 236 def print_stack_entry(self,frame_lineno,prompt_prefix='\n-> ',
169 237 context = 3):
170 238 frame, lineno = frame_lineno
171 239 print >>Term.cout, self.format_stack_entry(frame_lineno, '', context)
172 240
173 241 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
174 242 import linecache, repr
175 243
176 244 ret = []
177 245
178 246 Colors = self.color_scheme_table.active_colors
179 247 ColorsNormal = Colors.Normal
180 248 tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal)
181 249 tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
182 250 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
183 251 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
184 252 ColorsNormal)
185 253
186 254 frame, lineno = frame_lineno
187 255
188 256 return_value = ''
189 257 if '__return__' in frame.f_locals:
190 258 rv = frame.f_locals['__return__']
191 259 #return_value += '->'
192 260 return_value += repr.repr(rv) + '\n'
193 261 ret.append(return_value)
194 262
195 263 #s = filename + '(' + `lineno` + ')'
196 264 filename = self.canonic(frame.f_code.co_filename)
197 265 link = tpl_link % filename
198 266
199 267 if frame.f_code.co_name:
200 268 func = frame.f_code.co_name
201 269 else:
202 270 func = "<lambda>"
203 271
204 272 call = ''
205 273 if func != '?':
206 274 if '__args__' in frame.f_locals:
207 275 args = repr.repr(frame.f_locals['__args__'])
208 276 else:
209 277 args = '()'
210 278 call = tpl_call % (func, args)
211 279
212 280 # The level info should be generated in the same format pdb uses, to
213 281 # avoid breaking the pdbtrack functionality of python-mode in *emacs.
214 282 ret.append('> %s(%s)%s\n' % (link,lineno,call))
215 283
216 284 start = lineno - 1 - context//2
217 285 lines = linecache.getlines(filename)
218 286 start = max(start, 0)
219 287 start = min(start, len(lines) - context)
220 288 lines = lines[start : start + context]
221 289
222 290 for i,line in enumerate(lines):
223 291 show_arrow = (start + 1 + i == lineno)
224 292 ret.append(self.__format_line(tpl_line_em, filename,
225 293 start + 1 + i, line,
226 294 arrow = show_arrow) )
227 295
228 296 return ''.join(ret)
229 297
230 298 def __format_line(self, tpl_line, filename, lineno, line, arrow = False):
231 299 bp_mark = ""
232 300 bp_mark_color = ""
233 301
234 302 bp = None
235 303 if lineno in self.get_file_breaks(filename):
236 304 bps = self.get_breaks(filename, lineno)
237 305 bp = bps[-1]
238 306
239 307 if bp:
240 308 Colors = self.color_scheme_table.active_colors
241 309 bp_mark = str(bp.number)
242 310 bp_mark_color = Colors.breakpoint_enabled
243 311 if not bp.enabled:
244 312 bp_mark_color = Colors.breakpoint_disabled
245 313
246 314 numbers_width = 7
247 315 if arrow:
248 316 # This is the line with the error
249 317 pad = numbers_width - len(str(lineno)) - len(bp_mark)
250 318 if pad >= 3:
251 319 marker = '-'*(pad-3) + '-> '
252 320 elif pad == 2:
253 321 marker = '> '
254 322 elif pad == 1:
255 323 marker = '>'
256 324 else:
257 325 marker = ''
258 326 num = '%s%s' % (marker, str(lineno))
259 327 line = tpl_line % (bp_mark_color + bp_mark, num, line)
260 328 else:
261 329 num = '%*s' % (numbers_width - len(bp_mark), str(lineno))
262 330 line = tpl_line % (bp_mark_color + bp_mark, num, line)
263 331
264 332 return line
265 333
334 def list_command_pydb(self, arg):
335 """List command to use if we have a newer pydb installed"""
336 filename, first, last = OldPdb.parse_list_cmd(self, arg)
337 if filename is not None:
338 self.print_list_lines(filename, first, last)
339
340 def print_list_lines(self, filename, first, last):
341 """The printing (as opposed to the parsing part of a 'list'
342 command."""
343 try:
344 Colors = self.color_scheme_table.active_colors
345 ColorsNormal = Colors.Normal
346 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
347 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal)
348 src = []
349 for lineno in range(first, last+1):
350 line = linecache.getline(filename, lineno)
351 if not line:
352 break
353
354 if lineno == self.curframe.f_lineno:
355 line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True)
356 else:
357 line = self.__format_line(tpl_line, filename, lineno, line, arrow = False)
358
359 src.append(line)
360 self.lineno = lineno
361
362 print >>Term.cout, ''.join(src)
363
364 except KeyboardInterrupt:
365 pass
366
266 367 def do_list(self, arg):
267 368 self.lastcmd = 'list'
268 369 last = None
269 370 if arg:
270 371 try:
271 372 x = eval(arg, {}, {})
272 373 if type(x) == type(()):
273 374 first, last = x
274 375 first = int(first)
275 376 last = int(last)
276 377 if last < first:
277 378 # Assume it's a count
278 379 last = first + last
279 380 else:
280 381 first = max(1, int(x) - 5)
281 382 except:
282 383 print '*** Error in argument:', `arg`
283 384 return
284 385 elif self.lineno is None:
285 386 first = max(1, self.curframe.f_lineno - 5)
286 387 else:
287 388 first = self.lineno + 1
288 389 if last is None:
289 390 last = first + 10
290 filename = self.curframe.f_code.co_filename
291 try:
292 Colors = self.color_scheme_table.active_colors
293 ColorsNormal = Colors.Normal
294 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
295 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal)
296 src = []
297 for lineno in range(first, last+1):
298 line = linecache.getline(filename, lineno)
299 if not line:
300 break
301
302 if lineno == self.curframe.f_lineno:
303 line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True)
304 else:
305 line = self.__format_line(tpl_line, filename, lineno, line, arrow = False)
306
307 src.append(line)
308 self.lineno = lineno
309
310 print >>Term.cout, ''.join(src)
311
312 except KeyboardInterrupt:
313 pass
391 self.print_list_lines(self.curframe.f_code.co_filename, first, last)
314 392
315 393 do_l = do_list
394
395 def do_pdef(self, arg):
396 """The debugger interface to magic_pdef"""
397 namespaces = [('Locals', self.curframe.f_locals),
398 ('Globals', self.curframe.f_globals)]
399 __IPYTHON__.magic_pdef(arg, namespaces=namespaces)
400
401 def do_pdoc(self, arg):
402 """The debugger interface to magic_pdoc"""
403 namespaces = [('Locals', self.curframe.f_locals),
404 ('Globals', self.curframe.f_globals)]
405 __IPYTHON__.magic_pdoc(arg, namespaces=namespaces)
406
407 def do_pinfo(self, arg):
408 """The debugger equivalant of ?obj"""
409 namespaces = [('Locals', self.curframe.f_locals),
410 ('Globals', self.curframe.f_globals)]
411 __IPYTHON__.magic_pinfo("pinfo %s" % arg, namespaces=namespaces)
@@ -1,2434 +1,2442 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 Requires Python 2.3 or newer.
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 1850 2006-10-28 19:48:13Z fptest $
9 $Id: iplib.py 1853 2006-10-30 17:00:39Z vivainio $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 15 #
16 16 # Distributed under the terms of the BSD License. The full license is in
17 17 # the file COPYING, distributed as part of this software.
18 18 #
19 19 # Note: this code originally subclassed code.InteractiveConsole from the
20 20 # Python standard library. Over time, all of that class has been copied
21 21 # verbatim here for modifications which could not be accomplished by
22 22 # subclassing. At this point, there are no dependencies at all on the code
23 23 # module anymore (it is not even imported). The Python License (sec. 2)
24 24 # allows for this, but it's always nice to acknowledge credit where credit is
25 25 # due.
26 26 #*****************************************************************************
27 27
28 28 #****************************************************************************
29 29 # Modules and globals
30 30
31 31 from IPython import Release
32 32 __author__ = '%s <%s>\n%s <%s>' % \
33 33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 34 __license__ = Release.license
35 35 __version__ = Release.version
36 36
37 37 # Python standard modules
38 38 import __main__
39 39 import __builtin__
40 40 import StringIO
41 41 import bdb
42 42 import cPickle as pickle
43 43 import codeop
44 44 import exceptions
45 45 import glob
46 46 import inspect
47 47 import keyword
48 48 import new
49 49 import os
50 import pdb
51 50 import pydoc
52 51 import re
53 52 import shutil
54 53 import string
55 54 import sys
56 55 import tempfile
57 56 import traceback
58 57 import types
59 58 import pickleshare
60 59 from sets import Set
61 60 from pprint import pprint, pformat
62 61
63 62 # IPython's own modules
64 63 import IPython
65 64 from IPython import OInspect,PyColorize,ultraTB
66 65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 66 from IPython.FakeModule import FakeModule
68 67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 68 from IPython.Logger import Logger
70 69 from IPython.Magic import Magic
71 70 from IPython.Prompts import CachedOutput
72 71 from IPython.ipstruct import Struct
73 72 from IPython.background_jobs import BackgroundJobManager
74 73 from IPython.usage import cmd_line_usage,interactive_usage
75 74 from IPython.genutils import *
76 75 import IPython.ipapi
77 76
78 77 # Globals
79 78
80 79 # store the builtin raw_input globally, and use this always, in case user code
81 80 # overwrites it (like wx.py.PyShell does)
82 81 raw_input_original = raw_input
83 82
84 83 # compiled regexps for autoindent management
85 84 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86 85
87 86
88 87 #****************************************************************************
89 88 # Some utility function definitions
90 89
91 90 ini_spaces_re = re.compile(r'^(\s+)')
92 91
93 92 def num_ini_spaces(strng):
94 93 """Return the number of initial spaces in a string"""
95 94
96 95 ini_spaces = ini_spaces_re.match(strng)
97 96 if ini_spaces:
98 97 return ini_spaces.end()
99 98 else:
100 99 return 0
101 100
102 101 def softspace(file, newvalue):
103 102 """Copied from code.py, to remove the dependency"""
104 103
105 104 oldvalue = 0
106 105 try:
107 106 oldvalue = file.softspace
108 107 except AttributeError:
109 108 pass
110 109 try:
111 110 file.softspace = newvalue
112 111 except (AttributeError, TypeError):
113 112 # "attribute-less object" or "read-only attributes"
114 113 pass
115 114 return oldvalue
116 115
117 116
118 117 #****************************************************************************
119 118 # Local use exceptions
120 119 class SpaceInInput(exceptions.Exception): pass
121 120
122 121
123 122 #****************************************************************************
124 123 # Local use classes
125 124 class Bunch: pass
126 125
127 126 class Undefined: pass
128 127
129 128 class Quitter(object):
130 129 """Simple class to handle exit, similar to Python 2.5's.
131 130
132 131 It handles exiting in an ipython-safe manner, which the one in Python 2.5
133 132 doesn't do (obviously, since it doesn't know about ipython)."""
134 133
135 134 def __init__(self,shell,name):
136 135 self.shell = shell
137 136 self.name = name
138 137
139 138 def __repr__(self):
140 139 return 'Type %s() to exit.' % self.name
141 140 __str__ = __repr__
142 141
143 142 def __call__(self):
144 143 self.shell.exit()
145 144
146 145 class InputList(list):
147 146 """Class to store user input.
148 147
149 148 It's basically a list, but slices return a string instead of a list, thus
150 149 allowing things like (assuming 'In' is an instance):
151 150
152 151 exec In[4:7]
153 152
154 153 or
155 154
156 155 exec In[5:9] + In[14] + In[21:25]"""
157 156
158 157 def __getslice__(self,i,j):
159 158 return ''.join(list.__getslice__(self,i,j))
160 159
161 160 class SyntaxTB(ultraTB.ListTB):
162 161 """Extension which holds some state: the last exception value"""
163 162
164 163 def __init__(self,color_scheme = 'NoColor'):
165 164 ultraTB.ListTB.__init__(self,color_scheme)
166 165 self.last_syntax_error = None
167 166
168 167 def __call__(self, etype, value, elist):
169 168 self.last_syntax_error = value
170 169 ultraTB.ListTB.__call__(self,etype,value,elist)
171 170
172 171 def clear_err_state(self):
173 172 """Return the current error state and clear it"""
174 173 e = self.last_syntax_error
175 174 self.last_syntax_error = None
176 175 return e
177 176
178 177 #****************************************************************************
179 178 # Main IPython class
180 179
181 180 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
182 181 # until a full rewrite is made. I've cleaned all cross-class uses of
183 182 # attributes and methods, but too much user code out there relies on the
184 183 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
185 184 #
186 185 # But at least now, all the pieces have been separated and we could, in
187 186 # principle, stop using the mixin. This will ease the transition to the
188 187 # chainsaw branch.
189 188
190 189 # For reference, the following is the list of 'self.foo' uses in the Magic
191 190 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
192 191 # class, to prevent clashes.
193 192
194 193 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 194 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 195 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 196 # 'self.value']
198 197
199 198 class InteractiveShell(object,Magic):
200 199 """An enhanced console for Python."""
201 200
202 201 # class attribute to indicate whether the class supports threads or not.
203 202 # Subclasses with thread support should override this as needed.
204 203 isthreaded = False
205 204
206 205 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
207 206 user_ns = None,user_global_ns=None,banner2='',
208 207 custom_exceptions=((),None),embedded=False):
209 208
210 209 # log system
211 210 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212 211
213 212 # some minimal strict typechecks. For some core data structures, I
214 213 # want actual basic python types, not just anything that looks like
215 214 # one. This is especially true for namespaces.
216 215 for ns in (user_ns,user_global_ns):
217 216 if ns is not None and type(ns) != types.DictType:
218 217 raise TypeError,'namespace must be a dictionary'
219 218
220 219 # Job manager (for jobs run as background threads)
221 220 self.jobs = BackgroundJobManager()
222 221
223 222 # Store the actual shell's name
224 223 self.name = name
225 224
226 225 # We need to know whether the instance is meant for embedding, since
227 226 # global/local namespaces need to be handled differently in that case
228 227 self.embedded = embedded
229 228
230 229 # command compiler
231 230 self.compile = codeop.CommandCompiler()
232 231
233 232 # User input buffer
234 233 self.buffer = []
235 234
236 235 # Default name given in compilation of code
237 236 self.filename = '<ipython console>'
238 237
239 238 # Install our own quitter instead of the builtins. For python2.3-2.4,
240 239 # this brings in behavior like 2.5, and for 2.5 it's identical.
241 240 __builtin__.exit = Quitter(self,'exit')
242 241 __builtin__.quit = Quitter(self,'quit')
243 242
244 243 # Make an empty namespace, which extension writers can rely on both
245 244 # existing and NEVER being used by ipython itself. This gives them a
246 245 # convenient location for storing additional information and state
247 246 # their extensions may require, without fear of collisions with other
248 247 # ipython names that may develop later.
249 248 self.meta = Struct()
250 249
251 250 # Create the namespace where the user will operate. user_ns is
252 251 # normally the only one used, and it is passed to the exec calls as
253 252 # the locals argument. But we do carry a user_global_ns namespace
254 253 # given as the exec 'globals' argument, This is useful in embedding
255 254 # situations where the ipython shell opens in a context where the
256 255 # distinction between locals and globals is meaningful.
257 256
258 257 # FIXME. For some strange reason, __builtins__ is showing up at user
259 258 # level as a dict instead of a module. This is a manual fix, but I
260 259 # should really track down where the problem is coming from. Alex
261 260 # Schmolck reported this problem first.
262 261
263 262 # A useful post by Alex Martelli on this topic:
264 263 # Re: inconsistent value from __builtins__
265 264 # Von: Alex Martelli <aleaxit@yahoo.com>
266 265 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 266 # Gruppen: comp.lang.python
268 267
269 268 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 269 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 270 # > <type 'dict'>
272 271 # > >>> print type(__builtins__)
273 272 # > <type 'module'>
274 273 # > Is this difference in return value intentional?
275 274
276 275 # Well, it's documented that '__builtins__' can be either a dictionary
277 276 # or a module, and it's been that way for a long time. Whether it's
278 277 # intentional (or sensible), I don't know. In any case, the idea is
279 278 # that if you need to access the built-in namespace directly, you
280 279 # should start with "import __builtin__" (note, no 's') which will
281 280 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282 281
283 282 # These routines return properly built dicts as needed by the rest of
284 283 # the code, and can also be used by extension writers to generate
285 284 # properly initialized namespaces.
286 285 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 286 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
288 287
289 288 # Assign namespaces
290 289 # This is the namespace where all normal user variables live
291 290 self.user_ns = user_ns
292 291 # Embedded instances require a separate namespace for globals.
293 292 # Normally this one is unused by non-embedded instances.
294 293 self.user_global_ns = user_global_ns
295 294 # A namespace to keep track of internal data structures to prevent
296 295 # them from cluttering user-visible stuff. Will be updated later
297 296 self.internal_ns = {}
298 297
299 298 # Namespace of system aliases. Each entry in the alias
300 299 # table must be a 2-tuple of the form (N,name), where N is the number
301 300 # of positional arguments of the alias.
302 301 self.alias_table = {}
303 302
304 303 # A table holding all the namespaces IPython deals with, so that
305 304 # introspection facilities can search easily.
306 305 self.ns_table = {'user':user_ns,
307 306 'user_global':user_global_ns,
308 307 'alias':self.alias_table,
309 308 'internal':self.internal_ns,
310 309 'builtin':__builtin__.__dict__
311 310 }
312 311
313 312 # The user namespace MUST have a pointer to the shell itself.
314 313 self.user_ns[name] = self
315 314
316 315 # We need to insert into sys.modules something that looks like a
317 316 # module but which accesses the IPython namespace, for shelve and
318 317 # pickle to work interactively. Normally they rely on getting
319 318 # everything out of __main__, but for embedding purposes each IPython
320 319 # instance has its own private namespace, so we can't go shoving
321 320 # everything into __main__.
322 321
323 322 # note, however, that we should only do this for non-embedded
324 323 # ipythons, which really mimic the __main__.__dict__ with their own
325 324 # namespace. Embedded instances, on the other hand, should not do
326 325 # this because they need to manage the user local/global namespaces
327 326 # only, but they live within a 'normal' __main__ (meaning, they
328 327 # shouldn't overtake the execution environment of the script they're
329 328 # embedded in).
330 329
331 330 if not embedded:
332 331 try:
333 332 main_name = self.user_ns['__name__']
334 333 except KeyError:
335 334 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 335 else:
337 336 #print "pickle hack in place" # dbg
338 337 #print 'main_name:',main_name # dbg
339 338 sys.modules[main_name] = FakeModule(self.user_ns)
340 339
341 340 # List of input with multi-line handling.
342 341 # Fill its zero entry, user counter starts at 1
343 342 self.input_hist = InputList(['\n'])
344 343 # This one will hold the 'raw' input history, without any
345 344 # pre-processing. This will allow users to retrieve the input just as
346 345 # it was exactly typed in by the user, with %hist -r.
347 346 self.input_hist_raw = InputList(['\n'])
348 347
349 348 # list of visited directories
350 349 try:
351 350 self.dir_hist = [os.getcwd()]
352 351 except IOError, e:
353 352 self.dir_hist = []
354 353
355 354 # dict of output history
356 355 self.output_hist = {}
357 356
358 357 # dict of things NOT to alias (keywords, builtins and some magics)
359 358 no_alias = {}
360 359 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 360 for key in keyword.kwlist + no_alias_magics:
362 361 no_alias[key] = 1
363 362 no_alias.update(__builtin__.__dict__)
364 363 self.no_alias = no_alias
365 364
366 365 # make global variables for user access to these
367 366 self.user_ns['_ih'] = self.input_hist
368 367 self.user_ns['_oh'] = self.output_hist
369 368 self.user_ns['_dh'] = self.dir_hist
370 369
371 370 # user aliases to input and output histories
372 371 self.user_ns['In'] = self.input_hist
373 372 self.user_ns['Out'] = self.output_hist
374 373
375 374 # Object variable to store code object waiting execution. This is
376 375 # used mainly by the multithreaded shells, but it can come in handy in
377 376 # other situations. No need to use a Queue here, since it's a single
378 377 # item which gets cleared once run.
379 378 self.code_to_run = None
380 379
381 380 # escapes for automatic behavior on the command line
382 381 self.ESC_SHELL = '!'
383 382 self.ESC_HELP = '?'
384 383 self.ESC_MAGIC = '%'
385 384 self.ESC_QUOTE = ','
386 385 self.ESC_QUOTE2 = ';'
387 386 self.ESC_PAREN = '/'
388 387
389 388 # And their associated handlers
390 389 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 390 self.ESC_QUOTE : self.handle_auto,
392 391 self.ESC_QUOTE2 : self.handle_auto,
393 392 self.ESC_MAGIC : self.handle_magic,
394 393 self.ESC_HELP : self.handle_help,
395 394 self.ESC_SHELL : self.handle_shell_escape,
396 395 }
397 396
398 397 # class initializations
399 398 Magic.__init__(self,self)
400 399
401 400 # Python source parser/formatter for syntax highlighting
402 401 pyformat = PyColorize.Parser().format
403 402 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404 403
405 404 # hooks holds pointers used for user-side customizations
406 405 self.hooks = Struct()
407 406
408 407 # Set all default hooks, defined in the IPython.hooks module.
409 408 hooks = IPython.hooks
410 409 for hook_name in hooks.__all__:
411 410 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
412 411 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
413 412 #print "bound hook",hook_name
414 413
415 414 # Flag to mark unconditional exit
416 415 self.exit_now = False
417 416
418 417 self.usage_min = """\
419 418 An enhanced console for Python.
420 419 Some of its features are:
421 420 - Readline support if the readline library is present.
422 421 - Tab completion in the local namespace.
423 422 - Logging of input, see command-line options.
424 423 - System shell escape via ! , eg !ls.
425 424 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
426 425 - Keeps track of locally defined variables via %who, %whos.
427 426 - Show object information with a ? eg ?x or x? (use ?? for more info).
428 427 """
429 428 if usage: self.usage = usage
430 429 else: self.usage = self.usage_min
431 430
432 431 # Storage
433 432 self.rc = rc # This will hold all configuration information
434 433 self.pager = 'less'
435 434 # temporary files used for various purposes. Deleted at exit.
436 435 self.tempfiles = []
437 436
438 437 # Keep track of readline usage (later set by init_readline)
439 438 self.has_readline = False
440 439
441 440 # template for logfile headers. It gets resolved at runtime by the
442 441 # logstart method.
443 442 self.loghead_tpl = \
444 443 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
445 444 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
446 445 #log# opts = %s
447 446 #log# args = %s
448 447 #log# It is safe to make manual edits below here.
449 448 #log#-----------------------------------------------------------------------
450 449 """
451 450 # for pushd/popd management
452 451 try:
453 452 self.home_dir = get_home_dir()
454 453 except HomeDirError,msg:
455 454 fatal(msg)
456 455
457 456 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
458 457
459 458 # Functions to call the underlying shell.
460 459
461 460 # utility to expand user variables via Itpl
462 461 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
463 462 self.user_ns))
464 463 # The first is similar to os.system, but it doesn't return a value,
465 464 # and it allows interpolation of variables in the user's namespace.
466 465 self.system = lambda cmd: shell(self.var_expand(cmd),
467 466 header='IPython system call: ',
468 467 verbose=self.rc.system_verbose)
469 468 # These are for getoutput and getoutputerror:
470 469 self.getoutput = lambda cmd: \
471 470 getoutput(self.var_expand(cmd),
472 471 header='IPython system call: ',
473 472 verbose=self.rc.system_verbose)
474 473 self.getoutputerror = lambda cmd: \
475 474 getoutputerror(self.var_expand(cmd),
476 475 header='IPython system call: ',
477 476 verbose=self.rc.system_verbose)
478 477
479 478 # RegExp for splitting line contents into pre-char//first
480 479 # word-method//rest. For clarity, each group in on one line.
481 480
482 481 # WARNING: update the regexp if the above escapes are changed, as they
483 482 # are hardwired in.
484 483
485 484 # Don't get carried away with trying to make the autocalling catch too
486 485 # much: it's better to be conservative rather than to trigger hidden
487 486 # evals() somewhere and end up causing side effects.
488 487
489 488 self.line_split = re.compile(r'^([\s*,;/])'
490 489 r'([\?\w\.]+\w*\s*)'
491 490 r'(\(?.*$)')
492 491
493 492 # Original re, keep around for a while in case changes break something
494 493 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
495 494 # r'(\s*[\?\w\.]+\w*\s*)'
496 495 # r'(\(?.*$)')
497 496
498 497 # RegExp to identify potential function names
499 498 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
500 499
501 500 # RegExp to exclude strings with this start from autocalling. In
502 501 # particular, all binary operators should be excluded, so that if foo
503 502 # is callable, foo OP bar doesn't become foo(OP bar), which is
504 503 # invalid. The characters '!=()' don't need to be checked for, as the
505 504 # _prefilter routine explicitely does so, to catch direct calls and
506 505 # rebindings of existing names.
507 506
508 507 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
509 508 # it affects the rest of the group in square brackets.
510 509 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
511 510 '|^is |^not |^in |^and |^or ')
512 511
513 512 # try to catch also methods for stuff in lists/tuples/dicts: off
514 513 # (experimental). For this to work, the line_split regexp would need
515 514 # to be modified so it wouldn't break things at '['. That line is
516 515 # nasty enough that I shouldn't change it until I can test it _well_.
517 516 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
518 517
519 518 # keep track of where we started running (mainly for crash post-mortem)
520 519 self.starting_dir = os.getcwd()
521 520
522 521 # Various switches which can be set
523 522 self.CACHELENGTH = 5000 # this is cheap, it's just text
524 523 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
525 524 self.banner2 = banner2
526 525
527 526 # TraceBack handlers:
528 527
529 528 # Syntax error handler.
530 529 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
531 530
532 531 # The interactive one is initialized with an offset, meaning we always
533 532 # want to remove the topmost item in the traceback, which is our own
534 533 # internal code. Valid modes: ['Plain','Context','Verbose']
535 534 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
536 535 color_scheme='NoColor',
537 536 tb_offset = 1)
538 537
539 538 # IPython itself shouldn't crash. This will produce a detailed
540 539 # post-mortem if it does. But we only install the crash handler for
541 540 # non-threaded shells, the threaded ones use a normal verbose reporter
542 541 # and lose the crash handler. This is because exceptions in the main
543 542 # thread (such as in GUI code) propagate directly to sys.excepthook,
544 543 # and there's no point in printing crash dumps for every user exception.
545 544 if self.isthreaded:
546 545 ipCrashHandler = ultraTB.FormattedTB()
547 546 else:
548 547 from IPython import CrashHandler
549 548 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
550 549 self.set_crash_handler(ipCrashHandler)
551 550
552 551 # and add any custom exception handlers the user may have specified
553 552 self.set_custom_exc(*custom_exceptions)
554 553
555 554 # indentation management
556 555 self.autoindent = False
557 556 self.indent_current_nsp = 0
558 557
559 558 # Make some aliases automatically
560 559 # Prepare list of shell aliases to auto-define
561 560 if os.name == 'posix':
562 561 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
563 562 'mv mv -i','rm rm -i','cp cp -i',
564 563 'cat cat','less less','clear clear',
565 564 # a better ls
566 565 'ls ls -F',
567 566 # long ls
568 567 'll ls -lF')
569 568 # Extra ls aliases with color, which need special treatment on BSD
570 569 # variants
571 570 ls_extra = ( # color ls
572 571 'lc ls -F -o --color',
573 572 # ls normal files only
574 573 'lf ls -F -o --color %l | grep ^-',
575 574 # ls symbolic links
576 575 'lk ls -F -o --color %l | grep ^l',
577 576 # directories or links to directories,
578 577 'ldir ls -F -o --color %l | grep /$',
579 578 # things which are executable
580 579 'lx ls -F -o --color %l | grep ^-..x',
581 580 )
582 581 # The BSDs don't ship GNU ls, so they don't understand the
583 582 # --color switch out of the box
584 583 if 'bsd' in sys.platform:
585 584 ls_extra = ( # ls normal files only
586 585 'lf ls -lF | grep ^-',
587 586 # ls symbolic links
588 587 'lk ls -lF | grep ^l',
589 588 # directories or links to directories,
590 589 'ldir ls -lF | grep /$',
591 590 # things which are executable
592 591 'lx ls -lF | grep ^-..x',
593 592 )
594 593 auto_alias = auto_alias + ls_extra
595 594 elif os.name in ['nt','dos']:
596 595 auto_alias = ('dir dir /on', 'ls dir /on',
597 596 'ddir dir /ad /on', 'ldir dir /ad /on',
598 597 'mkdir mkdir','rmdir rmdir','echo echo',
599 598 'ren ren','cls cls','copy copy')
600 599 else:
601 600 auto_alias = ()
602 601 self.auto_alias = [s.split(None,1) for s in auto_alias]
603 602 # Call the actual (public) initializer
604 603 self.init_auto_alias()
605 604
606 605 # Produce a public API instance
607 606 self.api = IPython.ipapi.IPApi(self)
608 607
609 608 # track which builtins we add, so we can clean up later
610 609 self.builtins_added = {}
611 610 # This method will add the necessary builtins for operation, but
612 611 # tracking what it did via the builtins_added dict.
613 612 self.add_builtins()
614 613
615 614 # end __init__
616 615
617 616 def pre_config_initialization(self):
618 617 """Pre-configuration init method
619 618
620 619 This is called before the configuration files are processed to
621 620 prepare the services the config files might need.
622 621
623 622 self.rc already has reasonable default values at this point.
624 623 """
625 624 rc = self.rc
626 625
627 626 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
628 627
629 628 def post_config_initialization(self):
630 629 """Post configuration init method
631 630
632 631 This is called after the configuration files have been processed to
633 632 'finalize' the initialization."""
634 633
635 634 rc = self.rc
636 635
637 636 # Object inspector
638 637 self.inspector = OInspect.Inspector(OInspect.InspectColors,
639 638 PyColorize.ANSICodeColors,
640 639 'NoColor',
641 640 rc.object_info_string_level)
642 641
643 642 # Load readline proper
644 643 if rc.readline:
645 644 self.init_readline()
646 645
647 646 # local shortcut, this is used a LOT
648 647 self.log = self.logger.log
649 648
650 649 # Initialize cache, set in/out prompts and printing system
651 650 self.outputcache = CachedOutput(self,
652 651 rc.cache_size,
653 652 rc.pprint,
654 653 input_sep = rc.separate_in,
655 654 output_sep = rc.separate_out,
656 655 output_sep2 = rc.separate_out2,
657 656 ps1 = rc.prompt_in1,
658 657 ps2 = rc.prompt_in2,
659 658 ps_out = rc.prompt_out,
660 659 pad_left = rc.prompts_pad_left)
661 660
662 661 # user may have over-ridden the default print hook:
663 662 try:
664 663 self.outputcache.__class__.display = self.hooks.display
665 664 except AttributeError:
666 665 pass
667 666
668 667 # I don't like assigning globally to sys, because it means when
669 668 # embedding instances, each embedded instance overrides the previous
670 669 # choice. But sys.displayhook seems to be called internally by exec,
671 670 # so I don't see a way around it. We first save the original and then
672 671 # overwrite it.
673 672 self.sys_displayhook = sys.displayhook
674 673 sys.displayhook = self.outputcache
675 674
676 675 # Set user colors (don't do it in the constructor above so that it
677 676 # doesn't crash if colors option is invalid)
678 677 self.magic_colors(rc.colors)
679 678
680 679 # Set calling of pdb on exceptions
681 680 self.call_pdb = rc.pdb
682 681
683 682 # Load user aliases
684 683 for alias in rc.alias:
685 684 self.magic_alias(alias)
686 685 self.hooks.late_startup_hook()
687 686
688 687 batchrun = False
689 688 for batchfile in [path(arg) for arg in self.rc.args
690 689 if arg.lower().endswith('.ipy')]:
691 690 if not batchfile.isfile():
692 691 print "No such batch file:", batchfile
693 692 continue
694 693 self.api.runlines(batchfile.text())
695 694 batchrun = True
696 695 if batchrun:
697 696 self.exit_now = True
698 697
699 698 def add_builtins(self):
700 699 """Store ipython references into the builtin namespace.
701 700
702 701 Some parts of ipython operate via builtins injected here, which hold a
703 702 reference to IPython itself."""
704 703
705 704 # TODO: deprecate all except _ip; 'jobs' should be installed
706 705 # by an extension and the rest are under _ip, ipalias is redundant
707 706 builtins_new = dict(__IPYTHON__ = self,
708 707 ip_set_hook = self.set_hook,
709 708 jobs = self.jobs,
710 709 ipmagic = self.ipmagic,
711 710 ipalias = self.ipalias,
712 711 ipsystem = self.ipsystem,
713 712 _ip = self.api
714 713 )
715 714 for biname,bival in builtins_new.items():
716 715 try:
717 716 # store the orignal value so we can restore it
718 717 self.builtins_added[biname] = __builtin__.__dict__[biname]
719 718 except KeyError:
720 719 # or mark that it wasn't defined, and we'll just delete it at
721 720 # cleanup
722 721 self.builtins_added[biname] = Undefined
723 722 __builtin__.__dict__[biname] = bival
724 723
725 724 # Keep in the builtins a flag for when IPython is active. We set it
726 725 # with setdefault so that multiple nested IPythons don't clobber one
727 726 # another. Each will increase its value by one upon being activated,
728 727 # which also gives us a way to determine the nesting level.
729 728 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
730 729
731 730 def clean_builtins(self):
732 731 """Remove any builtins which might have been added by add_builtins, or
733 732 restore overwritten ones to their previous values."""
734 733 for biname,bival in self.builtins_added.items():
735 734 if bival is Undefined:
736 735 del __builtin__.__dict__[biname]
737 736 else:
738 737 __builtin__.__dict__[biname] = bival
739 738 self.builtins_added.clear()
740 739
741 740 def set_hook(self,name,hook, priority = 50):
742 741 """set_hook(name,hook) -> sets an internal IPython hook.
743 742
744 743 IPython exposes some of its internal API as user-modifiable hooks. By
745 744 adding your function to one of these hooks, you can modify IPython's
746 745 behavior to call at runtime your own routines."""
747 746
748 747 # At some point in the future, this should validate the hook before it
749 748 # accepts it. Probably at least check that the hook takes the number
750 749 # of args it's supposed to.
751 750 dp = getattr(self.hooks, name, None)
752 751 if name not in IPython.hooks.__all__:
753 752 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
754 753 if not dp:
755 754 dp = IPython.hooks.CommandChainDispatcher()
756 755
757 756 f = new.instancemethod(hook,self,self.__class__)
758 757 try:
759 758 dp.add(f,priority)
760 759 except AttributeError:
761 760 # it was not commandchain, plain old func - replace
762 761 dp = f
763 762
764 763 setattr(self.hooks,name, dp)
765 764
766 765
767 766 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
768 767
769 768 def set_crash_handler(self,crashHandler):
770 769 """Set the IPython crash handler.
771 770
772 771 This must be a callable with a signature suitable for use as
773 772 sys.excepthook."""
774 773
775 774 # Install the given crash handler as the Python exception hook
776 775 sys.excepthook = crashHandler
777 776
778 777 # The instance will store a pointer to this, so that runtime code
779 778 # (such as magics) can access it. This is because during the
780 779 # read-eval loop, it gets temporarily overwritten (to deal with GUI
781 780 # frameworks).
782 781 self.sys_excepthook = sys.excepthook
783 782
784 783
785 784 def set_custom_exc(self,exc_tuple,handler):
786 785 """set_custom_exc(exc_tuple,handler)
787 786
788 787 Set a custom exception handler, which will be called if any of the
789 788 exceptions in exc_tuple occur in the mainloop (specifically, in the
790 789 runcode() method.
791 790
792 791 Inputs:
793 792
794 793 - exc_tuple: a *tuple* of valid exceptions to call the defined
795 794 handler for. It is very important that you use a tuple, and NOT A
796 795 LIST here, because of the way Python's except statement works. If
797 796 you only want to trap a single exception, use a singleton tuple:
798 797
799 798 exc_tuple == (MyCustomException,)
800 799
801 800 - handler: this must be defined as a function with the following
802 801 basic interface: def my_handler(self,etype,value,tb).
803 802
804 803 This will be made into an instance method (via new.instancemethod)
805 804 of IPython itself, and it will be called if any of the exceptions
806 805 listed in the exc_tuple are caught. If the handler is None, an
807 806 internal basic one is used, which just prints basic info.
808 807
809 808 WARNING: by putting in your own exception handler into IPython's main
810 809 execution loop, you run a very good chance of nasty crashes. This
811 810 facility should only be used if you really know what you are doing."""
812 811
813 812 assert type(exc_tuple)==type(()) , \
814 813 "The custom exceptions must be given AS A TUPLE."
815 814
816 815 def dummy_handler(self,etype,value,tb):
817 816 print '*** Simple custom exception handler ***'
818 817 print 'Exception type :',etype
819 818 print 'Exception value:',value
820 819 print 'Traceback :',tb
821 820 print 'Source code :','\n'.join(self.buffer)
822 821
823 822 if handler is None: handler = dummy_handler
824 823
825 824 self.CustomTB = new.instancemethod(handler,self,self.__class__)
826 825 self.custom_exceptions = exc_tuple
827 826
828 827 def set_custom_completer(self,completer,pos=0):
829 828 """set_custom_completer(completer,pos=0)
830 829
831 830 Adds a new custom completer function.
832 831
833 832 The position argument (defaults to 0) is the index in the completers
834 833 list where you want the completer to be inserted."""
835 834
836 835 newcomp = new.instancemethod(completer,self.Completer,
837 836 self.Completer.__class__)
838 837 self.Completer.matchers.insert(pos,newcomp)
839 838
840 839 def _get_call_pdb(self):
841 840 return self._call_pdb
842 841
843 842 def _set_call_pdb(self,val):
844 843
845 844 if val not in (0,1,False,True):
846 845 raise ValueError,'new call_pdb value must be boolean'
847 846
848 847 # store value in instance
849 848 self._call_pdb = val
850 849
851 850 # notify the actual exception handlers
852 851 self.InteractiveTB.call_pdb = val
853 852 if self.isthreaded:
854 853 try:
855 854 self.sys_excepthook.call_pdb = val
856 855 except:
857 856 warn('Failed to activate pdb for threaded exception handler')
858 857
859 858 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
860 859 'Control auto-activation of pdb at exceptions')
861 860
862 861
863 862 # These special functions get installed in the builtin namespace, to
864 863 # provide programmatic (pure python) access to magics, aliases and system
865 864 # calls. This is important for logging, user scripting, and more.
866 865
867 866 # We are basically exposing, via normal python functions, the three
868 867 # mechanisms in which ipython offers special call modes (magics for
869 868 # internal control, aliases for direct system access via pre-selected
870 869 # names, and !cmd for calling arbitrary system commands).
871 870
872 871 def ipmagic(self,arg_s):
873 872 """Call a magic function by name.
874 873
875 874 Input: a string containing the name of the magic function to call and any
876 875 additional arguments to be passed to the magic.
877 876
878 877 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
879 878 prompt:
880 879
881 880 In[1]: %name -opt foo bar
882 881
883 882 To call a magic without arguments, simply use ipmagic('name').
884 883
885 884 This provides a proper Python function to call IPython's magics in any
886 885 valid Python code you can type at the interpreter, including loops and
887 886 compound statements. It is added by IPython to the Python builtin
888 887 namespace upon initialization."""
889 888
890 889 args = arg_s.split(' ',1)
891 890 magic_name = args[0]
892 891 magic_name = magic_name.lstrip(self.ESC_MAGIC)
893 892
894 893 try:
895 894 magic_args = args[1]
896 895 except IndexError:
897 896 magic_args = ''
898 897 fn = getattr(self,'magic_'+magic_name,None)
899 898 if fn is None:
900 899 error("Magic function `%s` not found." % magic_name)
901 900 else:
902 901 magic_args = self.var_expand(magic_args)
903 902 return fn(magic_args)
904 903
905 904 def ipalias(self,arg_s):
906 905 """Call an alias by name.
907 906
908 907 Input: a string containing the name of the alias to call and any
909 908 additional arguments to be passed to the magic.
910 909
911 910 ipalias('name -opt foo bar') is equivalent to typing at the ipython
912 911 prompt:
913 912
914 913 In[1]: name -opt foo bar
915 914
916 915 To call an alias without arguments, simply use ipalias('name').
917 916
918 917 This provides a proper Python function to call IPython's aliases in any
919 918 valid Python code you can type at the interpreter, including loops and
920 919 compound statements. It is added by IPython to the Python builtin
921 920 namespace upon initialization."""
922 921
923 922 args = arg_s.split(' ',1)
924 923 alias_name = args[0]
925 924 try:
926 925 alias_args = args[1]
927 926 except IndexError:
928 927 alias_args = ''
929 928 if alias_name in self.alias_table:
930 929 self.call_alias(alias_name,alias_args)
931 930 else:
932 931 error("Alias `%s` not found." % alias_name)
933 932
934 933 def ipsystem(self,arg_s):
935 934 """Make a system call, using IPython."""
936 935
937 936 self.system(arg_s)
938 937
939 938 def complete(self,text):
940 939 """Return a sorted list of all possible completions on text.
941 940
942 941 Inputs:
943 942
944 943 - text: a string of text to be completed on.
945 944
946 945 This is a wrapper around the completion mechanism, similar to what
947 946 readline does at the command line when the TAB key is hit. By
948 947 exposing it as a method, it can be used by other non-readline
949 948 environments (such as GUIs) for text completion.
950 949
951 950 Simple usage example:
952 951
953 952 In [1]: x = 'hello'
954 953
955 954 In [2]: __IP.complete('x.l')
956 955 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
957 956
958 957 complete = self.Completer.complete
959 958 state = 0
960 959 # use a dict so we get unique keys, since ipyhton's multiple
961 960 # completers can return duplicates.
962 961 comps = {}
963 962 while True:
964 963 newcomp = complete(text,state)
965 964 if newcomp is None:
966 965 break
967 966 comps[newcomp] = 1
968 967 state += 1
969 968 outcomps = comps.keys()
970 969 outcomps.sort()
971 970 return outcomps
972 971
973 972 def set_completer_frame(self, frame=None):
974 973 if frame:
975 974 self.Completer.namespace = frame.f_locals
976 975 self.Completer.global_namespace = frame.f_globals
977 976 else:
978 977 self.Completer.namespace = self.user_ns
979 978 self.Completer.global_namespace = self.user_global_ns
980 979
981 980 def init_auto_alias(self):
982 981 """Define some aliases automatically.
983 982
984 983 These are ALL parameter-less aliases"""
985 984
986 985 for alias,cmd in self.auto_alias:
987 986 self.alias_table[alias] = (0,cmd)
988 987
989 988 def alias_table_validate(self,verbose=0):
990 989 """Update information about the alias table.
991 990
992 991 In particular, make sure no Python keywords/builtins are in it."""
993 992
994 993 no_alias = self.no_alias
995 994 for k in self.alias_table.keys():
996 995 if k in no_alias:
997 996 del self.alias_table[k]
998 997 if verbose:
999 998 print ("Deleting alias <%s>, it's a Python "
1000 999 "keyword or builtin." % k)
1001 1000
1002 1001 def set_autoindent(self,value=None):
1003 1002 """Set the autoindent flag, checking for readline support.
1004 1003
1005 1004 If called with no arguments, it acts as a toggle."""
1006 1005
1007 1006 if not self.has_readline:
1008 1007 if os.name == 'posix':
1009 1008 warn("The auto-indent feature requires the readline library")
1010 1009 self.autoindent = 0
1011 1010 return
1012 1011 if value is None:
1013 1012 self.autoindent = not self.autoindent
1014 1013 else:
1015 1014 self.autoindent = value
1016 1015
1017 1016 def rc_set_toggle(self,rc_field,value=None):
1018 1017 """Set or toggle a field in IPython's rc config. structure.
1019 1018
1020 1019 If called with no arguments, it acts as a toggle.
1021 1020
1022 1021 If called with a non-existent field, the resulting AttributeError
1023 1022 exception will propagate out."""
1024 1023
1025 1024 rc_val = getattr(self.rc,rc_field)
1026 1025 if value is None:
1027 1026 value = not rc_val
1028 1027 setattr(self.rc,rc_field,value)
1029 1028
1030 1029 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1031 1030 """Install the user configuration directory.
1032 1031
1033 1032 Can be called when running for the first time or to upgrade the user's
1034 1033 .ipython/ directory with the mode parameter. Valid modes are 'install'
1035 1034 and 'upgrade'."""
1036 1035
1037 1036 def wait():
1038 1037 try:
1039 1038 raw_input("Please press <RETURN> to start IPython.")
1040 1039 except EOFError:
1041 1040 print >> Term.cout
1042 1041 print '*'*70
1043 1042
1044 1043 cwd = os.getcwd() # remember where we started
1045 1044 glb = glob.glob
1046 1045 print '*'*70
1047 1046 if mode == 'install':
1048 1047 print \
1049 1048 """Welcome to IPython. I will try to create a personal configuration directory
1050 1049 where you can customize many aspects of IPython's functionality in:\n"""
1051 1050 else:
1052 1051 print 'I am going to upgrade your configuration in:'
1053 1052
1054 1053 print ipythondir
1055 1054
1056 1055 rcdirend = os.path.join('IPython','UserConfig')
1057 1056 cfg = lambda d: os.path.join(d,rcdirend)
1058 1057 try:
1059 1058 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1060 1059 except IOError:
1061 1060 warning = """
1062 1061 Installation error. IPython's directory was not found.
1063 1062
1064 1063 Check the following:
1065 1064
1066 1065 The ipython/IPython directory should be in a directory belonging to your
1067 1066 PYTHONPATH environment variable (that is, it should be in a directory
1068 1067 belonging to sys.path). You can copy it explicitly there or just link to it.
1069 1068
1070 1069 IPython will proceed with builtin defaults.
1071 1070 """
1072 1071 warn(warning)
1073 1072 wait()
1074 1073 return
1075 1074
1076 1075 if mode == 'install':
1077 1076 try:
1078 1077 shutil.copytree(rcdir,ipythondir)
1079 1078 os.chdir(ipythondir)
1080 1079 rc_files = glb("ipythonrc*")
1081 1080 for rc_file in rc_files:
1082 1081 os.rename(rc_file,rc_file+rc_suffix)
1083 1082 except:
1084 1083 warning = """
1085 1084
1086 1085 There was a problem with the installation:
1087 1086 %s
1088 1087 Try to correct it or contact the developers if you think it's a bug.
1089 1088 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1090 1089 warn(warning)
1091 1090 wait()
1092 1091 return
1093 1092
1094 1093 elif mode == 'upgrade':
1095 1094 try:
1096 1095 os.chdir(ipythondir)
1097 1096 except:
1098 1097 print """
1099 1098 Can not upgrade: changing to directory %s failed. Details:
1100 1099 %s
1101 1100 """ % (ipythondir,sys.exc_info()[1])
1102 1101 wait()
1103 1102 return
1104 1103 else:
1105 1104 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1106 1105 for new_full_path in sources:
1107 1106 new_filename = os.path.basename(new_full_path)
1108 1107 if new_filename.startswith('ipythonrc'):
1109 1108 new_filename = new_filename + rc_suffix
1110 1109 # The config directory should only contain files, skip any
1111 1110 # directories which may be there (like CVS)
1112 1111 if os.path.isdir(new_full_path):
1113 1112 continue
1114 1113 if os.path.exists(new_filename):
1115 1114 old_file = new_filename+'.old'
1116 1115 if os.path.exists(old_file):
1117 1116 os.remove(old_file)
1118 1117 os.rename(new_filename,old_file)
1119 1118 shutil.copy(new_full_path,new_filename)
1120 1119 else:
1121 1120 raise ValueError,'unrecognized mode for install:',`mode`
1122 1121
1123 1122 # Fix line-endings to those native to each platform in the config
1124 1123 # directory.
1125 1124 try:
1126 1125 os.chdir(ipythondir)
1127 1126 except:
1128 1127 print """
1129 1128 Problem: changing to directory %s failed.
1130 1129 Details:
1131 1130 %s
1132 1131
1133 1132 Some configuration files may have incorrect line endings. This should not
1134 1133 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1135 1134 wait()
1136 1135 else:
1137 1136 for fname in glb('ipythonrc*'):
1138 1137 try:
1139 1138 native_line_ends(fname,backup=0)
1140 1139 except IOError:
1141 1140 pass
1142 1141
1143 1142 if mode == 'install':
1144 1143 print """
1145 1144 Successful installation!
1146 1145
1147 1146 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1148 1147 IPython manual (there are both HTML and PDF versions supplied with the
1149 1148 distribution) to make sure that your system environment is properly configured
1150 1149 to take advantage of IPython's features.
1151 1150
1152 1151 Important note: the configuration system has changed! The old system is
1153 1152 still in place, but its setting may be partly overridden by the settings in
1154 1153 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1155 1154 if some of the new settings bother you.
1156 1155
1157 1156 """
1158 1157 else:
1159 1158 print """
1160 1159 Successful upgrade!
1161 1160
1162 1161 All files in your directory:
1163 1162 %(ipythondir)s
1164 1163 which would have been overwritten by the upgrade were backed up with a .old
1165 1164 extension. If you had made particular customizations in those files you may
1166 1165 want to merge them back into the new files.""" % locals()
1167 1166 wait()
1168 1167 os.chdir(cwd)
1169 1168 # end user_setup()
1170 1169
1171 1170 def atexit_operations(self):
1172 1171 """This will be executed at the time of exit.
1173 1172
1174 1173 Saving of persistent data should be performed here. """
1175 1174
1176 1175 #print '*** IPython exit cleanup ***' # dbg
1177 1176 # input history
1178 1177 self.savehist()
1179 1178
1180 1179 # Cleanup all tempfiles left around
1181 1180 for tfile in self.tempfiles:
1182 1181 try:
1183 1182 os.unlink(tfile)
1184 1183 except OSError:
1185 1184 pass
1186 1185
1187 1186 # save the "persistent data" catch-all dictionary
1188 1187 self.hooks.shutdown_hook()
1189 1188
1190 1189 def savehist(self):
1191 1190 """Save input history to a file (via readline library)."""
1192 1191 try:
1193 1192 self.readline.write_history_file(self.histfile)
1194 1193 except:
1195 1194 print 'Unable to save IPython command history to file: ' + \
1196 1195 `self.histfile`
1197 1196
1198 1197 def pre_readline(self):
1199 1198 """readline hook to be used at the start of each line.
1200 1199
1201 1200 Currently it handles auto-indent only."""
1202 1201
1203 1202 #debugx('self.indent_current_nsp','pre_readline:')
1204 1203 self.readline.insert_text(self.indent_current_str())
1205 1204
1206 1205 def init_readline(self):
1207 1206 """Command history completion/saving/reloading."""
1208 1207
1209 1208 import IPython.rlineimpl as readline
1210 1209 if not readline.have_readline:
1211 1210 self.has_readline = 0
1212 1211 self.readline = None
1213 1212 # no point in bugging windows users with this every time:
1214 1213 warn('Readline services not available on this platform.')
1215 1214 else:
1216 1215 sys.modules['readline'] = readline
1217 1216 import atexit
1218 1217 from IPython.completer import IPCompleter
1219 1218 self.Completer = IPCompleter(self,
1220 1219 self.user_ns,
1221 1220 self.user_global_ns,
1222 1221 self.rc.readline_omit__names,
1223 1222 self.alias_table)
1224 1223
1225 1224 # Platform-specific configuration
1226 1225 if os.name == 'nt':
1227 1226 self.readline_startup_hook = readline.set_pre_input_hook
1228 1227 else:
1229 1228 self.readline_startup_hook = readline.set_startup_hook
1230 1229
1231 1230 # Load user's initrc file (readline config)
1232 1231 inputrc_name = os.environ.get('INPUTRC')
1233 1232 if inputrc_name is None:
1234 1233 home_dir = get_home_dir()
1235 1234 if home_dir is not None:
1236 1235 inputrc_name = os.path.join(home_dir,'.inputrc')
1237 1236 if os.path.isfile(inputrc_name):
1238 1237 try:
1239 1238 readline.read_init_file(inputrc_name)
1240 1239 except:
1241 1240 warn('Problems reading readline initialization file <%s>'
1242 1241 % inputrc_name)
1243 1242
1244 1243 self.has_readline = 1
1245 1244 self.readline = readline
1246 1245 # save this in sys so embedded copies can restore it properly
1247 1246 sys.ipcompleter = self.Completer.complete
1248 1247 readline.set_completer(self.Completer.complete)
1249 1248
1250 1249 # Configure readline according to user's prefs
1251 1250 for rlcommand in self.rc.readline_parse_and_bind:
1252 1251 readline.parse_and_bind(rlcommand)
1253 1252
1254 1253 # remove some chars from the delimiters list
1255 1254 delims = readline.get_completer_delims()
1256 1255 delims = delims.translate(string._idmap,
1257 1256 self.rc.readline_remove_delims)
1258 1257 readline.set_completer_delims(delims)
1259 1258 # otherwise we end up with a monster history after a while:
1260 1259 readline.set_history_length(1000)
1261 1260 try:
1262 1261 #print '*** Reading readline history' # dbg
1263 1262 readline.read_history_file(self.histfile)
1264 1263 except IOError:
1265 1264 pass # It doesn't exist yet.
1266 1265
1267 1266 atexit.register(self.atexit_operations)
1268 1267 del atexit
1269 1268
1270 1269 # Configure auto-indent for all platforms
1271 1270 self.set_autoindent(self.rc.autoindent)
1272 1271
1273 1272 def ask_yes_no(self,prompt,default=True):
1274 1273 if self.rc.quiet:
1275 1274 return True
1276 1275 return ask_yes_no(prompt,default)
1277 1276
1278 1277 def _should_recompile(self,e):
1279 1278 """Utility routine for edit_syntax_error"""
1280 1279
1281 1280 if e.filename in ('<ipython console>','<input>','<string>',
1282 1281 '<console>','<BackgroundJob compilation>',
1283 1282 None):
1284 1283
1285 1284 return False
1286 1285 try:
1287 1286 if (self.rc.autoedit_syntax and
1288 1287 not self.ask_yes_no('Return to editor to correct syntax error? '
1289 1288 '[Y/n] ','y')):
1290 1289 return False
1291 1290 except EOFError:
1292 1291 return False
1293 1292
1294 1293 def int0(x):
1295 1294 try:
1296 1295 return int(x)
1297 1296 except TypeError:
1298 1297 return 0
1299 1298 # always pass integer line and offset values to editor hook
1300 1299 self.hooks.fix_error_editor(e.filename,
1301 1300 int0(e.lineno),int0(e.offset),e.msg)
1302 1301 return True
1303 1302
1304 1303 def edit_syntax_error(self):
1305 1304 """The bottom half of the syntax error handler called in the main loop.
1306 1305
1307 1306 Loop until syntax error is fixed or user cancels.
1308 1307 """
1309 1308
1310 1309 while self.SyntaxTB.last_syntax_error:
1311 1310 # copy and clear last_syntax_error
1312 1311 err = self.SyntaxTB.clear_err_state()
1313 1312 if not self._should_recompile(err):
1314 1313 return
1315 1314 try:
1316 1315 # may set last_syntax_error again if a SyntaxError is raised
1317 1316 self.safe_execfile(err.filename,self.user_ns)
1318 1317 except:
1319 1318 self.showtraceback()
1320 1319 else:
1321 1320 try:
1322 1321 f = file(err.filename)
1323 1322 try:
1324 1323 sys.displayhook(f.read())
1325 1324 finally:
1326 1325 f.close()
1327 1326 except:
1328 1327 self.showtraceback()
1329 1328
1330 1329 def showsyntaxerror(self, filename=None):
1331 1330 """Display the syntax error that just occurred.
1332 1331
1333 1332 This doesn't display a stack trace because there isn't one.
1334 1333
1335 1334 If a filename is given, it is stuffed in the exception instead
1336 1335 of what was there before (because Python's parser always uses
1337 1336 "<string>" when reading from a string).
1338 1337 """
1339 1338 etype, value, last_traceback = sys.exc_info()
1340 1339
1341 1340 # See note about these variables in showtraceback() below
1342 1341 sys.last_type = etype
1343 1342 sys.last_value = value
1344 1343 sys.last_traceback = last_traceback
1345 1344
1346 1345 if filename and etype is SyntaxError:
1347 1346 # Work hard to stuff the correct filename in the exception
1348 1347 try:
1349 1348 msg, (dummy_filename, lineno, offset, line) = value
1350 1349 except:
1351 1350 # Not the format we expect; leave it alone
1352 1351 pass
1353 1352 else:
1354 1353 # Stuff in the right filename
1355 1354 try:
1356 1355 # Assume SyntaxError is a class exception
1357 1356 value = SyntaxError(msg, (filename, lineno, offset, line))
1358 1357 except:
1359 1358 # If that failed, assume SyntaxError is a string
1360 1359 value = msg, (filename, lineno, offset, line)
1361 1360 self.SyntaxTB(etype,value,[])
1362 1361
1363 1362 def debugger(self):
1364 """Call the pdb debugger."""
1363 """Call the pydb/pdb debugger."""
1365 1364
1366 1365 if not self.rc.pdb:
1367 1366 return
1368 pdb.pm()
1367 have_pydb = False
1368 if sys.version[:3] >= '2.5':
1369 try:
1370 from pydb import pm
1371 have_pydb = True
1372 except ImportError:
1373 pass
1374 if not have_pydb:
1375 from pdb import pm
1376 pm()
1369 1377
1370 1378 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1371 1379 """Display the exception that just occurred.
1372 1380
1373 1381 If nothing is known about the exception, this is the method which
1374 1382 should be used throughout the code for presenting user tracebacks,
1375 1383 rather than directly invoking the InteractiveTB object.
1376 1384
1377 1385 A specific showsyntaxerror() also exists, but this method can take
1378 1386 care of calling it if needed, so unless you are explicitly catching a
1379 1387 SyntaxError exception, don't try to analyze the stack manually and
1380 1388 simply call this method."""
1381 1389
1382 1390 # Though this won't be called by syntax errors in the input line,
1383 1391 # there may be SyntaxError cases whith imported code.
1384 1392 if exc_tuple is None:
1385 1393 etype, value, tb = sys.exc_info()
1386 1394 else:
1387 1395 etype, value, tb = exc_tuple
1388 1396 if etype is SyntaxError:
1389 1397 self.showsyntaxerror(filename)
1390 1398 else:
1391 1399 # WARNING: these variables are somewhat deprecated and not
1392 1400 # necessarily safe to use in a threaded environment, but tools
1393 1401 # like pdb depend on their existence, so let's set them. If we
1394 1402 # find problems in the field, we'll need to revisit their use.
1395 1403 sys.last_type = etype
1396 1404 sys.last_value = value
1397 1405 sys.last_traceback = tb
1398 1406
1399 1407 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1400 1408 if self.InteractiveTB.call_pdb and self.has_readline:
1401 1409 # pdb mucks up readline, fix it back
1402 1410 self.readline.set_completer(self.Completer.complete)
1403 1411
1404 1412 def mainloop(self,banner=None):
1405 1413 """Creates the local namespace and starts the mainloop.
1406 1414
1407 1415 If an optional banner argument is given, it will override the
1408 1416 internally created default banner."""
1409 1417
1410 1418 if self.rc.c: # Emulate Python's -c option
1411 1419 self.exec_init_cmd()
1412 1420 if banner is None:
1413 1421 if not self.rc.banner:
1414 1422 banner = ''
1415 1423 # banner is string? Use it directly!
1416 1424 elif isinstance(self.rc.banner,basestring):
1417 1425 banner = self.rc.banner
1418 1426 else:
1419 1427 banner = self.BANNER+self.banner2
1420 1428
1421 1429 self.interact(banner)
1422 1430
1423 1431 def exec_init_cmd(self):
1424 1432 """Execute a command given at the command line.
1425 1433
1426 1434 This emulates Python's -c option."""
1427 1435
1428 1436 #sys.argv = ['-c']
1429 1437 self.push(self.rc.c)
1430 1438
1431 1439 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1432 1440 """Embeds IPython into a running python program.
1433 1441
1434 1442 Input:
1435 1443
1436 1444 - header: An optional header message can be specified.
1437 1445
1438 1446 - local_ns, global_ns: working namespaces. If given as None, the
1439 1447 IPython-initialized one is updated with __main__.__dict__, so that
1440 1448 program variables become visible but user-specific configuration
1441 1449 remains possible.
1442 1450
1443 1451 - stack_depth: specifies how many levels in the stack to go to
1444 1452 looking for namespaces (when local_ns and global_ns are None). This
1445 1453 allows an intermediate caller to make sure that this function gets
1446 1454 the namespace from the intended level in the stack. By default (0)
1447 1455 it will get its locals and globals from the immediate caller.
1448 1456
1449 1457 Warning: it's possible to use this in a program which is being run by
1450 1458 IPython itself (via %run), but some funny things will happen (a few
1451 1459 globals get overwritten). In the future this will be cleaned up, as
1452 1460 there is no fundamental reason why it can't work perfectly."""
1453 1461
1454 1462 # Get locals and globals from caller
1455 1463 if local_ns is None or global_ns is None:
1456 1464 call_frame = sys._getframe(stack_depth).f_back
1457 1465
1458 1466 if local_ns is None:
1459 1467 local_ns = call_frame.f_locals
1460 1468 if global_ns is None:
1461 1469 global_ns = call_frame.f_globals
1462 1470
1463 1471 # Update namespaces and fire up interpreter
1464 1472
1465 1473 # The global one is easy, we can just throw it in
1466 1474 self.user_global_ns = global_ns
1467 1475
1468 1476 # but the user/local one is tricky: ipython needs it to store internal
1469 1477 # data, but we also need the locals. We'll copy locals in the user
1470 1478 # one, but will track what got copied so we can delete them at exit.
1471 1479 # This is so that a later embedded call doesn't see locals from a
1472 1480 # previous call (which most likely existed in a separate scope).
1473 1481 local_varnames = local_ns.keys()
1474 1482 self.user_ns.update(local_ns)
1475 1483
1476 1484 # Patch for global embedding to make sure that things don't overwrite
1477 1485 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1478 1486 # FIXME. Test this a bit more carefully (the if.. is new)
1479 1487 if local_ns is None and global_ns is None:
1480 1488 self.user_global_ns.update(__main__.__dict__)
1481 1489
1482 1490 # make sure the tab-completer has the correct frame information, so it
1483 1491 # actually completes using the frame's locals/globals
1484 1492 self.set_completer_frame()
1485 1493
1486 1494 # before activating the interactive mode, we need to make sure that
1487 1495 # all names in the builtin namespace needed by ipython point to
1488 1496 # ourselves, and not to other instances.
1489 1497 self.add_builtins()
1490 1498
1491 1499 self.interact(header)
1492 1500
1493 1501 # now, purge out the user namespace from anything we might have added
1494 1502 # from the caller's local namespace
1495 1503 delvar = self.user_ns.pop
1496 1504 for var in local_varnames:
1497 1505 delvar(var,None)
1498 1506 # and clean builtins we may have overridden
1499 1507 self.clean_builtins()
1500 1508
1501 1509 def interact(self, banner=None):
1502 1510 """Closely emulate the interactive Python console.
1503 1511
1504 1512 The optional banner argument specify the banner to print
1505 1513 before the first interaction; by default it prints a banner
1506 1514 similar to the one printed by the real Python interpreter,
1507 1515 followed by the current class name in parentheses (so as not
1508 1516 to confuse this with the real interpreter -- since it's so
1509 1517 close!).
1510 1518
1511 1519 """
1512 1520
1513 1521 if self.exit_now:
1514 1522 # batch run -> do not interact
1515 1523 return
1516 1524 cprt = 'Type "copyright", "credits" or "license" for more information.'
1517 1525 if banner is None:
1518 1526 self.write("Python %s on %s\n%s\n(%s)\n" %
1519 1527 (sys.version, sys.platform, cprt,
1520 1528 self.__class__.__name__))
1521 1529 else:
1522 1530 self.write(banner)
1523 1531
1524 1532 more = 0
1525 1533
1526 1534 # Mark activity in the builtins
1527 1535 __builtin__.__dict__['__IPYTHON__active'] += 1
1528 1536
1529 1537 # exit_now is set by a call to %Exit or %Quit
1530 1538 while not self.exit_now:
1531 1539 if more:
1532 1540 prompt = self.hooks.generate_prompt(True)
1533 1541 if self.autoindent:
1534 1542 self.readline_startup_hook(self.pre_readline)
1535 1543 else:
1536 1544 prompt = self.hooks.generate_prompt(False)
1537 1545 try:
1538 1546 line = self.raw_input(prompt,more)
1539 1547 if self.exit_now:
1540 1548 # quick exit on sys.std[in|out] close
1541 1549 break
1542 1550 if self.autoindent:
1543 1551 self.readline_startup_hook(None)
1544 1552 except KeyboardInterrupt:
1545 1553 self.write('\nKeyboardInterrupt\n')
1546 1554 self.resetbuffer()
1547 1555 # keep cache in sync with the prompt counter:
1548 1556 self.outputcache.prompt_count -= 1
1549 1557
1550 1558 if self.autoindent:
1551 1559 self.indent_current_nsp = 0
1552 1560 more = 0
1553 1561 except EOFError:
1554 1562 if self.autoindent:
1555 1563 self.readline_startup_hook(None)
1556 1564 self.write('\n')
1557 1565 self.exit()
1558 1566 except bdb.BdbQuit:
1559 1567 warn('The Python debugger has exited with a BdbQuit exception.\n'
1560 1568 'Because of how pdb handles the stack, it is impossible\n'
1561 1569 'for IPython to properly format this particular exception.\n'
1562 1570 'IPython will resume normal operation.')
1563 1571 except:
1564 1572 # exceptions here are VERY RARE, but they can be triggered
1565 1573 # asynchronously by signal handlers, for example.
1566 1574 self.showtraceback()
1567 1575 else:
1568 1576 more = self.push(line)
1569 1577 if (self.SyntaxTB.last_syntax_error and
1570 1578 self.rc.autoedit_syntax):
1571 1579 self.edit_syntax_error()
1572 1580
1573 1581 # We are off again...
1574 1582 __builtin__.__dict__['__IPYTHON__active'] -= 1
1575 1583
1576 1584 def excepthook(self, etype, value, tb):
1577 1585 """One more defense for GUI apps that call sys.excepthook.
1578 1586
1579 1587 GUI frameworks like wxPython trap exceptions and call
1580 1588 sys.excepthook themselves. I guess this is a feature that
1581 1589 enables them to keep running after exceptions that would
1582 1590 otherwise kill their mainloop. This is a bother for IPython
1583 1591 which excepts to catch all of the program exceptions with a try:
1584 1592 except: statement.
1585 1593
1586 1594 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1587 1595 any app directly invokes sys.excepthook, it will look to the user like
1588 1596 IPython crashed. In order to work around this, we can disable the
1589 1597 CrashHandler and replace it with this excepthook instead, which prints a
1590 1598 regular traceback using our InteractiveTB. In this fashion, apps which
1591 1599 call sys.excepthook will generate a regular-looking exception from
1592 1600 IPython, and the CrashHandler will only be triggered by real IPython
1593 1601 crashes.
1594 1602
1595 1603 This hook should be used sparingly, only in places which are not likely
1596 1604 to be true IPython errors.
1597 1605 """
1598 1606 self.showtraceback((etype,value,tb),tb_offset=0)
1599 1607
1600 1608 def expand_aliases(self,fn,rest):
1601 1609 """ Expand multiple levels of aliases:
1602 1610
1603 1611 if:
1604 1612
1605 1613 alias foo bar /tmp
1606 1614 alias baz foo
1607 1615
1608 1616 then:
1609 1617
1610 1618 baz huhhahhei -> bar /tmp huhhahhei
1611 1619
1612 1620 """
1613 1621 line = fn + " " + rest
1614 1622
1615 1623 done = Set()
1616 1624 while 1:
1617 1625 pre,fn,rest = self.split_user_input(line)
1618 1626 if fn in self.alias_table:
1619 1627 if fn in done:
1620 1628 warn("Cyclic alias definition, repeated '%s'" % fn)
1621 1629 return ""
1622 1630 done.add(fn)
1623 1631
1624 1632 l2 = self.transform_alias(fn,rest)
1625 1633 # dir -> dir
1626 1634 if l2 == line:
1627 1635 break
1628 1636 # ls -> ls -F should not recurse forever
1629 1637 if l2.split(None,1)[0] == line.split(None,1)[0]:
1630 1638 line = l2
1631 1639 break
1632 1640
1633 1641 line=l2
1634 1642
1635 1643
1636 1644 # print "al expand to",line #dbg
1637 1645 else:
1638 1646 break
1639 1647
1640 1648 return line
1641 1649
1642 1650 def transform_alias(self, alias,rest=''):
1643 1651 """ Transform alias to system command string.
1644 1652 """
1645 1653 nargs,cmd = self.alias_table[alias]
1646 1654 if ' ' in cmd and os.path.isfile(cmd):
1647 1655 cmd = '"%s"' % cmd
1648 1656
1649 1657 # Expand the %l special to be the user's input line
1650 1658 if cmd.find('%l') >= 0:
1651 1659 cmd = cmd.replace('%l',rest)
1652 1660 rest = ''
1653 1661 if nargs==0:
1654 1662 # Simple, argument-less aliases
1655 1663 cmd = '%s %s' % (cmd,rest)
1656 1664 else:
1657 1665 # Handle aliases with positional arguments
1658 1666 args = rest.split(None,nargs)
1659 1667 if len(args)< nargs:
1660 1668 error('Alias <%s> requires %s arguments, %s given.' %
1661 1669 (alias,nargs,len(args)))
1662 1670 return None
1663 1671 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1664 1672 # Now call the macro, evaluating in the user's namespace
1665 1673 #print 'new command: <%r>' % cmd # dbg
1666 1674 return cmd
1667 1675
1668 1676 def call_alias(self,alias,rest=''):
1669 1677 """Call an alias given its name and the rest of the line.
1670 1678
1671 1679 This is only used to provide backwards compatibility for users of
1672 1680 ipalias(), use of which is not recommended for anymore."""
1673 1681
1674 1682 # Now call the macro, evaluating in the user's namespace
1675 1683 cmd = self.transform_alias(alias, rest)
1676 1684 try:
1677 1685 self.system(cmd)
1678 1686 except:
1679 1687 self.showtraceback()
1680 1688
1681 1689 def indent_current_str(self):
1682 1690 """return the current level of indentation as a string"""
1683 1691 return self.indent_current_nsp * ' '
1684 1692
1685 1693 def autoindent_update(self,line):
1686 1694 """Keep track of the indent level."""
1687 1695
1688 1696 #debugx('line')
1689 1697 #debugx('self.indent_current_nsp')
1690 1698 if self.autoindent:
1691 1699 if line:
1692 1700 inisp = num_ini_spaces(line)
1693 1701 if inisp < self.indent_current_nsp:
1694 1702 self.indent_current_nsp = inisp
1695 1703
1696 1704 if line[-1] == ':':
1697 1705 self.indent_current_nsp += 4
1698 1706 elif dedent_re.match(line):
1699 1707 self.indent_current_nsp -= 4
1700 1708 else:
1701 1709 self.indent_current_nsp = 0
1702 1710
1703 1711 def runlines(self,lines):
1704 1712 """Run a string of one or more lines of source.
1705 1713
1706 1714 This method is capable of running a string containing multiple source
1707 1715 lines, as if they had been entered at the IPython prompt. Since it
1708 1716 exposes IPython's processing machinery, the given strings can contain
1709 1717 magic calls (%magic), special shell access (!cmd), etc."""
1710 1718
1711 1719 # We must start with a clean buffer, in case this is run from an
1712 1720 # interactive IPython session (via a magic, for example).
1713 1721 self.resetbuffer()
1714 1722 lines = lines.split('\n')
1715 1723 more = 0
1716 1724 for line in lines:
1717 1725 # skip blank lines so we don't mess up the prompt counter, but do
1718 1726 # NOT skip even a blank line if we are in a code block (more is
1719 1727 # true)
1720 1728 if line or more:
1721 1729 more = self.push(self.prefilter(line,more))
1722 1730 # IPython's runsource returns None if there was an error
1723 1731 # compiling the code. This allows us to stop processing right
1724 1732 # away, so the user gets the error message at the right place.
1725 1733 if more is None:
1726 1734 break
1727 1735 # final newline in case the input didn't have it, so that the code
1728 1736 # actually does get executed
1729 1737 if more:
1730 1738 self.push('\n')
1731 1739
1732 1740 def runsource(self, source, filename='<input>', symbol='single'):
1733 1741 """Compile and run some source in the interpreter.
1734 1742
1735 1743 Arguments are as for compile_command().
1736 1744
1737 1745 One several things can happen:
1738 1746
1739 1747 1) The input is incorrect; compile_command() raised an
1740 1748 exception (SyntaxError or OverflowError). A syntax traceback
1741 1749 will be printed by calling the showsyntaxerror() method.
1742 1750
1743 1751 2) The input is incomplete, and more input is required;
1744 1752 compile_command() returned None. Nothing happens.
1745 1753
1746 1754 3) The input is complete; compile_command() returned a code
1747 1755 object. The code is executed by calling self.runcode() (which
1748 1756 also handles run-time exceptions, except for SystemExit).
1749 1757
1750 1758 The return value is:
1751 1759
1752 1760 - True in case 2
1753 1761
1754 1762 - False in the other cases, unless an exception is raised, where
1755 1763 None is returned instead. This can be used by external callers to
1756 1764 know whether to continue feeding input or not.
1757 1765
1758 1766 The return value can be used to decide whether to use sys.ps1 or
1759 1767 sys.ps2 to prompt the next line."""
1760 1768
1761 1769 try:
1762 1770 code = self.compile(source,filename,symbol)
1763 1771 except (OverflowError, SyntaxError, ValueError):
1764 1772 # Case 1
1765 1773 self.showsyntaxerror(filename)
1766 1774 return None
1767 1775
1768 1776 if code is None:
1769 1777 # Case 2
1770 1778 return True
1771 1779
1772 1780 # Case 3
1773 1781 # We store the code object so that threaded shells and
1774 1782 # custom exception handlers can access all this info if needed.
1775 1783 # The source corresponding to this can be obtained from the
1776 1784 # buffer attribute as '\n'.join(self.buffer).
1777 1785 self.code_to_run = code
1778 1786 # now actually execute the code object
1779 1787 if self.runcode(code) == 0:
1780 1788 return False
1781 1789 else:
1782 1790 return None
1783 1791
1784 1792 def runcode(self,code_obj):
1785 1793 """Execute a code object.
1786 1794
1787 1795 When an exception occurs, self.showtraceback() is called to display a
1788 1796 traceback.
1789 1797
1790 1798 Return value: a flag indicating whether the code to be run completed
1791 1799 successfully:
1792 1800
1793 1801 - 0: successful execution.
1794 1802 - 1: an error occurred.
1795 1803 """
1796 1804
1797 1805 # Set our own excepthook in case the user code tries to call it
1798 1806 # directly, so that the IPython crash handler doesn't get triggered
1799 1807 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1800 1808
1801 1809 # we save the original sys.excepthook in the instance, in case config
1802 1810 # code (such as magics) needs access to it.
1803 1811 self.sys_excepthook = old_excepthook
1804 1812 outflag = 1 # happens in more places, so it's easier as default
1805 1813 try:
1806 1814 try:
1807 1815 # Embedded instances require separate global/local namespaces
1808 1816 # so they can see both the surrounding (local) namespace and
1809 1817 # the module-level globals when called inside another function.
1810 1818 if self.embedded:
1811 1819 exec code_obj in self.user_global_ns, self.user_ns
1812 1820 # Normal (non-embedded) instances should only have a single
1813 1821 # namespace for user code execution, otherwise functions won't
1814 1822 # see interactive top-level globals.
1815 1823 else:
1816 1824 exec code_obj in self.user_ns
1817 1825 finally:
1818 1826 # Reset our crash handler in place
1819 1827 sys.excepthook = old_excepthook
1820 1828 except SystemExit:
1821 1829 self.resetbuffer()
1822 1830 self.showtraceback()
1823 1831 warn("Type %exit or %quit to exit IPython "
1824 1832 "(%Exit or %Quit do so unconditionally).",level=1)
1825 1833 except self.custom_exceptions:
1826 1834 etype,value,tb = sys.exc_info()
1827 1835 self.CustomTB(etype,value,tb)
1828 1836 except:
1829 1837 self.showtraceback()
1830 1838 else:
1831 1839 outflag = 0
1832 1840 if softspace(sys.stdout, 0):
1833 1841 print
1834 1842 # Flush out code object which has been run (and source)
1835 1843 self.code_to_run = None
1836 1844 return outflag
1837 1845
1838 1846 def push(self, line):
1839 1847 """Push a line to the interpreter.
1840 1848
1841 1849 The line should not have a trailing newline; it may have
1842 1850 internal newlines. The line is appended to a buffer and the
1843 1851 interpreter's runsource() method is called with the
1844 1852 concatenated contents of the buffer as source. If this
1845 1853 indicates that the command was executed or invalid, the buffer
1846 1854 is reset; otherwise, the command is incomplete, and the buffer
1847 1855 is left as it was after the line was appended. The return
1848 1856 value is 1 if more input is required, 0 if the line was dealt
1849 1857 with in some way (this is the same as runsource()).
1850 1858 """
1851 1859
1852 1860 # autoindent management should be done here, and not in the
1853 1861 # interactive loop, since that one is only seen by keyboard input. We
1854 1862 # need this done correctly even for code run via runlines (which uses
1855 1863 # push).
1856 1864
1857 1865 #print 'push line: <%s>' % line # dbg
1858 1866 for subline in line.splitlines():
1859 1867 self.autoindent_update(subline)
1860 1868 self.buffer.append(line)
1861 1869 more = self.runsource('\n'.join(self.buffer), self.filename)
1862 1870 if not more:
1863 1871 self.resetbuffer()
1864 1872 return more
1865 1873
1866 1874 def resetbuffer(self):
1867 1875 """Reset the input buffer."""
1868 1876 self.buffer[:] = []
1869 1877
1870 1878 def raw_input(self,prompt='',continue_prompt=False):
1871 1879 """Write a prompt and read a line.
1872 1880
1873 1881 The returned line does not include the trailing newline.
1874 1882 When the user enters the EOF key sequence, EOFError is raised.
1875 1883
1876 1884 Optional inputs:
1877 1885
1878 1886 - prompt(''): a string to be printed to prompt the user.
1879 1887
1880 1888 - continue_prompt(False): whether this line is the first one or a
1881 1889 continuation in a sequence of inputs.
1882 1890 """
1883 1891
1884 1892 try:
1885 1893 line = raw_input_original(prompt)
1886 1894 except ValueError:
1887 1895 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1888 1896 self.exit_now = True
1889 1897 return ""
1890 1898
1891 1899
1892 1900 # Try to be reasonably smart about not re-indenting pasted input more
1893 1901 # than necessary. We do this by trimming out the auto-indent initial
1894 1902 # spaces, if the user's actual input started itself with whitespace.
1895 1903 #debugx('self.buffer[-1]')
1896 1904
1897 1905 if self.autoindent:
1898 1906 if num_ini_spaces(line) > self.indent_current_nsp:
1899 1907 line = line[self.indent_current_nsp:]
1900 1908 self.indent_current_nsp = 0
1901 1909
1902 1910 # store the unfiltered input before the user has any chance to modify
1903 1911 # it.
1904 1912 if line.strip():
1905 1913 if continue_prompt:
1906 1914 self.input_hist_raw[-1] += '%s\n' % line
1907 1915 if self.has_readline: # and some config option is set?
1908 1916 try:
1909 1917 histlen = self.readline.get_current_history_length()
1910 1918 newhist = self.input_hist_raw[-1].rstrip()
1911 1919 self.readline.remove_history_item(histlen-1)
1912 1920 self.readline.replace_history_item(histlen-2,newhist)
1913 1921 except AttributeError:
1914 1922 pass # re{move,place}_history_item are new in 2.4.
1915 1923 else:
1916 1924 self.input_hist_raw.append('%s\n' % line)
1917 1925
1918 1926 try:
1919 1927 lineout = self.prefilter(line,continue_prompt)
1920 1928 except:
1921 1929 # blanket except, in case a user-defined prefilter crashes, so it
1922 1930 # can't take all of ipython with it.
1923 1931 self.showtraceback()
1924 1932 return ''
1925 1933 else:
1926 1934 return lineout
1927 1935
1928 1936 def split_user_input(self,line):
1929 1937 """Split user input into pre-char, function part and rest."""
1930 1938
1931 1939 lsplit = self.line_split.match(line)
1932 1940 if lsplit is None: # no regexp match returns None
1933 1941 try:
1934 1942 iFun,theRest = line.split(None,1)
1935 1943 except ValueError:
1936 1944 iFun,theRest = line,''
1937 1945 pre = re.match('^(\s*)(.*)',line).groups()[0]
1938 1946 else:
1939 1947 pre,iFun,theRest = lsplit.groups()
1940 1948
1941 1949 #print 'line:<%s>' % line # dbg
1942 1950 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1943 1951 return pre,iFun.strip(),theRest
1944 1952
1945 1953 def _prefilter(self, line, continue_prompt):
1946 1954 """Calls different preprocessors, depending on the form of line."""
1947 1955
1948 1956 # All handlers *must* return a value, even if it's blank ('').
1949 1957
1950 1958 # Lines are NOT logged here. Handlers should process the line as
1951 1959 # needed, update the cache AND log it (so that the input cache array
1952 1960 # stays synced).
1953 1961
1954 1962 # This function is _very_ delicate, and since it's also the one which
1955 1963 # determines IPython's response to user input, it must be as efficient
1956 1964 # as possible. For this reason it has _many_ returns in it, trying
1957 1965 # always to exit as quickly as it can figure out what it needs to do.
1958 1966
1959 1967 # This function is the main responsible for maintaining IPython's
1960 1968 # behavior respectful of Python's semantics. So be _very_ careful if
1961 1969 # making changes to anything here.
1962 1970
1963 1971 #.....................................................................
1964 1972 # Code begins
1965 1973
1966 1974 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1967 1975
1968 1976 # save the line away in case we crash, so the post-mortem handler can
1969 1977 # record it
1970 1978 self._last_input_line = line
1971 1979
1972 1980 #print '***line: <%s>' % line # dbg
1973 1981
1974 1982 # the input history needs to track even empty lines
1975 1983 stripped = line.strip()
1976 1984
1977 1985 if not stripped:
1978 1986 if not continue_prompt:
1979 1987 self.outputcache.prompt_count -= 1
1980 1988 return self.handle_normal(line,continue_prompt)
1981 1989 #return self.handle_normal('',continue_prompt)
1982 1990
1983 1991 # print '***cont',continue_prompt # dbg
1984 1992 # special handlers are only allowed for single line statements
1985 1993 if continue_prompt and not self.rc.multi_line_specials:
1986 1994 return self.handle_normal(line,continue_prompt)
1987 1995
1988 1996
1989 1997 # For the rest, we need the structure of the input
1990 1998 pre,iFun,theRest = self.split_user_input(line)
1991 1999
1992 2000 # See whether any pre-existing handler can take care of it
1993 2001
1994 2002 rewritten = self.hooks.input_prefilter(stripped)
1995 2003 if rewritten != stripped: # ok, some prefilter did something
1996 2004 rewritten = pre + rewritten # add indentation
1997 2005 return self.handle_normal(rewritten)
1998 2006
1999 2007 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2000 2008
2001 2009 # First check for explicit escapes in the last/first character
2002 2010 handler = None
2003 2011 if line[-1] == self.ESC_HELP:
2004 2012 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2005 2013 if handler is None:
2006 2014 # look at the first character of iFun, NOT of line, so we skip
2007 2015 # leading whitespace in multiline input
2008 2016 handler = self.esc_handlers.get(iFun[0:1])
2009 2017 if handler is not None:
2010 2018 return handler(line,continue_prompt,pre,iFun,theRest)
2011 2019 # Emacs ipython-mode tags certain input lines
2012 2020 if line.endswith('# PYTHON-MODE'):
2013 2021 return self.handle_emacs(line,continue_prompt)
2014 2022
2015 2023 # Next, check if we can automatically execute this thing
2016 2024
2017 2025 # Allow ! in multi-line statements if multi_line_specials is on:
2018 2026 if continue_prompt and self.rc.multi_line_specials and \
2019 2027 iFun.startswith(self.ESC_SHELL):
2020 2028 return self.handle_shell_escape(line,continue_prompt,
2021 2029 pre=pre,iFun=iFun,
2022 2030 theRest=theRest)
2023 2031
2024 2032 # Let's try to find if the input line is a magic fn
2025 2033 oinfo = None
2026 2034 if hasattr(self,'magic_'+iFun):
2027 2035 # WARNING: _ofind uses getattr(), so it can consume generators and
2028 2036 # cause other side effects.
2029 2037 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2030 2038 if oinfo['ismagic']:
2031 2039 # Be careful not to call magics when a variable assignment is
2032 2040 # being made (ls='hi', for example)
2033 2041 if self.rc.automagic and \
2034 2042 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2035 2043 (self.rc.multi_line_specials or not continue_prompt):
2036 2044 return self.handle_magic(line,continue_prompt,
2037 2045 pre,iFun,theRest)
2038 2046 else:
2039 2047 return self.handle_normal(line,continue_prompt)
2040 2048
2041 2049 # If the rest of the line begins with an (in)equality, assginment or
2042 2050 # function call, we should not call _ofind but simply execute it.
2043 2051 # This avoids spurious geattr() accesses on objects upon assignment.
2044 2052 #
2045 2053 # It also allows users to assign to either alias or magic names true
2046 2054 # python variables (the magic/alias systems always take second seat to
2047 2055 # true python code).
2048 2056 if theRest and theRest[0] in '!=()':
2049 2057 return self.handle_normal(line,continue_prompt)
2050 2058
2051 2059 if oinfo is None:
2052 2060 # let's try to ensure that _oinfo is ONLY called when autocall is
2053 2061 # on. Since it has inevitable potential side effects, at least
2054 2062 # having autocall off should be a guarantee to the user that no
2055 2063 # weird things will happen.
2056 2064
2057 2065 if self.rc.autocall:
2058 2066 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2059 2067 else:
2060 2068 # in this case, all that's left is either an alias or
2061 2069 # processing the line normally.
2062 2070 if iFun in self.alias_table:
2063 2071 # if autocall is off, by not running _ofind we won't know
2064 2072 # whether the given name may also exist in one of the
2065 2073 # user's namespace. At this point, it's best to do a
2066 2074 # quick check just to be sure that we don't let aliases
2067 2075 # shadow variables.
2068 2076 head = iFun.split('.',1)[0]
2069 2077 if head in self.user_ns or head in self.internal_ns \
2070 2078 or head in __builtin__.__dict__:
2071 2079 return self.handle_normal(line,continue_prompt)
2072 2080 else:
2073 2081 return self.handle_alias(line,continue_prompt,
2074 2082 pre,iFun,theRest)
2075 2083
2076 2084 else:
2077 2085 return self.handle_normal(line,continue_prompt)
2078 2086
2079 2087 if not oinfo['found']:
2080 2088 return self.handle_normal(line,continue_prompt)
2081 2089 else:
2082 2090 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2083 2091 if oinfo['isalias']:
2084 2092 return self.handle_alias(line,continue_prompt,
2085 2093 pre,iFun,theRest)
2086 2094
2087 2095 if (self.rc.autocall
2088 2096 and
2089 2097 (
2090 2098 #only consider exclusion re if not "," or ";" autoquoting
2091 2099 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2092 2100 or pre == self.ESC_PAREN) or
2093 2101 (not self.re_exclude_auto.match(theRest)))
2094 2102 and
2095 2103 self.re_fun_name.match(iFun) and
2096 2104 callable(oinfo['obj'])) :
2097 2105 #print 'going auto' # dbg
2098 2106 return self.handle_auto(line,continue_prompt,
2099 2107 pre,iFun,theRest,oinfo['obj'])
2100 2108 else:
2101 2109 #print 'was callable?', callable(oinfo['obj']) # dbg
2102 2110 return self.handle_normal(line,continue_prompt)
2103 2111
2104 2112 # If we get here, we have a normal Python line. Log and return.
2105 2113 return self.handle_normal(line,continue_prompt)
2106 2114
2107 2115 def _prefilter_dumb(self, line, continue_prompt):
2108 2116 """simple prefilter function, for debugging"""
2109 2117 return self.handle_normal(line,continue_prompt)
2110 2118
2111 2119
2112 2120 def multiline_prefilter(self, line, continue_prompt):
2113 2121 """ Run _prefilter for each line of input
2114 2122
2115 2123 Covers cases where there are multiple lines in the user entry,
2116 2124 which is the case when the user goes back to a multiline history
2117 2125 entry and presses enter.
2118 2126
2119 2127 """
2120 2128 out = []
2121 2129 for l in line.rstrip('\n').split('\n'):
2122 2130 out.append(self._prefilter(l, continue_prompt))
2123 2131 return '\n'.join(out)
2124 2132
2125 2133 # Set the default prefilter() function (this can be user-overridden)
2126 2134 prefilter = multiline_prefilter
2127 2135
2128 2136 def handle_normal(self,line,continue_prompt=None,
2129 2137 pre=None,iFun=None,theRest=None):
2130 2138 """Handle normal input lines. Use as a template for handlers."""
2131 2139
2132 2140 # With autoindent on, we need some way to exit the input loop, and I
2133 2141 # don't want to force the user to have to backspace all the way to
2134 2142 # clear the line. The rule will be in this case, that either two
2135 2143 # lines of pure whitespace in a row, or a line of pure whitespace but
2136 2144 # of a size different to the indent level, will exit the input loop.
2137 2145
2138 2146 if (continue_prompt and self.autoindent and line.isspace() and
2139 2147 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2140 2148 (self.buffer[-1]).isspace() )):
2141 2149 line = ''
2142 2150
2143 2151 self.log(line,line,continue_prompt)
2144 2152 return line
2145 2153
2146 2154 def handle_alias(self,line,continue_prompt=None,
2147 2155 pre=None,iFun=None,theRest=None):
2148 2156 """Handle alias input lines. """
2149 2157
2150 2158 # pre is needed, because it carries the leading whitespace. Otherwise
2151 2159 # aliases won't work in indented sections.
2152 2160 transformed = self.expand_aliases(iFun, theRest)
2153 2161 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2154 2162 self.log(line,line_out,continue_prompt)
2155 2163 #print 'line out:',line_out # dbg
2156 2164 return line_out
2157 2165
2158 2166 def handle_shell_escape(self, line, continue_prompt=None,
2159 2167 pre=None,iFun=None,theRest=None):
2160 2168 """Execute the line in a shell, empty return value"""
2161 2169
2162 2170 #print 'line in :', `line` # dbg
2163 2171 # Example of a special handler. Others follow a similar pattern.
2164 2172 if line.lstrip().startswith('!!'):
2165 2173 # rewrite iFun/theRest to properly hold the call to %sx and
2166 2174 # the actual command to be executed, so handle_magic can work
2167 2175 # correctly
2168 2176 theRest = '%s %s' % (iFun[2:],theRest)
2169 2177 iFun = 'sx'
2170 2178 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2171 2179 line.lstrip()[2:]),
2172 2180 continue_prompt,pre,iFun,theRest)
2173 2181 else:
2174 2182 cmd=line.lstrip().lstrip('!')
2175 2183 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2176 2184 # update cache/log and return
2177 2185 self.log(line,line_out,continue_prompt)
2178 2186 return line_out
2179 2187
2180 2188 def handle_magic(self, line, continue_prompt=None,
2181 2189 pre=None,iFun=None,theRest=None):
2182 2190 """Execute magic functions."""
2183 2191
2184 2192
2185 2193 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2186 2194 self.log(line,cmd,continue_prompt)
2187 2195 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2188 2196 return cmd
2189 2197
2190 2198 def handle_auto(self, line, continue_prompt=None,
2191 2199 pre=None,iFun=None,theRest=None,obj=None):
2192 2200 """Hande lines which can be auto-executed, quoting if requested."""
2193 2201
2194 2202 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2195 2203
2196 2204 # This should only be active for single-line input!
2197 2205 if continue_prompt:
2198 2206 self.log(line,line,continue_prompt)
2199 2207 return line
2200 2208
2201 2209 auto_rewrite = True
2202 2210
2203 2211 if pre == self.ESC_QUOTE:
2204 2212 # Auto-quote splitting on whitespace
2205 2213 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2206 2214 elif pre == self.ESC_QUOTE2:
2207 2215 # Auto-quote whole string
2208 2216 newcmd = '%s("%s")' % (iFun,theRest)
2209 2217 elif pre == self.ESC_PAREN:
2210 2218 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2211 2219 else:
2212 2220 # Auto-paren.
2213 2221 # We only apply it to argument-less calls if the autocall
2214 2222 # parameter is set to 2. We only need to check that autocall is <
2215 2223 # 2, since this function isn't called unless it's at least 1.
2216 2224 if not theRest and (self.rc.autocall < 2):
2217 2225 newcmd = '%s %s' % (iFun,theRest)
2218 2226 auto_rewrite = False
2219 2227 else:
2220 2228 if theRest.startswith('['):
2221 2229 if hasattr(obj,'__getitem__'):
2222 2230 # Don't autocall in this case: item access for an object
2223 2231 # which is BOTH callable and implements __getitem__.
2224 2232 newcmd = '%s %s' % (iFun,theRest)
2225 2233 auto_rewrite = False
2226 2234 else:
2227 2235 # if the object doesn't support [] access, go ahead and
2228 2236 # autocall
2229 2237 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2230 2238 elif theRest.endswith(';'):
2231 2239 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2232 2240 else:
2233 2241 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2234 2242
2235 2243 if auto_rewrite:
2236 2244 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2237 2245 # log what is now valid Python, not the actual user input (without the
2238 2246 # final newline)
2239 2247 self.log(line,newcmd,continue_prompt)
2240 2248 return newcmd
2241 2249
2242 2250 def handle_help(self, line, continue_prompt=None,
2243 2251 pre=None,iFun=None,theRest=None):
2244 2252 """Try to get some help for the object.
2245 2253
2246 2254 obj? or ?obj -> basic information.
2247 2255 obj?? or ??obj -> more details.
2248 2256 """
2249 2257
2250 2258 # We need to make sure that we don't process lines which would be
2251 2259 # otherwise valid python, such as "x=1 # what?"
2252 2260 try:
2253 2261 codeop.compile_command(line)
2254 2262 except SyntaxError:
2255 2263 # We should only handle as help stuff which is NOT valid syntax
2256 2264 if line[0]==self.ESC_HELP:
2257 2265 line = line[1:]
2258 2266 elif line[-1]==self.ESC_HELP:
2259 2267 line = line[:-1]
2260 2268 self.log(line,'#?'+line,continue_prompt)
2261 2269 if line:
2262 2270 self.magic_pinfo(line)
2263 2271 else:
2264 2272 page(self.usage,screen_lines=self.rc.screen_length)
2265 2273 return '' # Empty string is needed here!
2266 2274 except:
2267 2275 # Pass any other exceptions through to the normal handler
2268 2276 return self.handle_normal(line,continue_prompt)
2269 2277 else:
2270 2278 # If the code compiles ok, we should handle it normally
2271 2279 return self.handle_normal(line,continue_prompt)
2272 2280
2273 2281 def getapi(self):
2274 2282 """ Get an IPApi object for this shell instance
2275 2283
2276 2284 Getting an IPApi object is always preferable to accessing the shell
2277 2285 directly, but this holds true especially for extensions.
2278 2286
2279 2287 It should always be possible to implement an extension with IPApi
2280 2288 alone. If not, contact maintainer to request an addition.
2281 2289
2282 2290 """
2283 2291 return self.api
2284 2292
2285 2293 def handle_emacs(self,line,continue_prompt=None,
2286 2294 pre=None,iFun=None,theRest=None):
2287 2295 """Handle input lines marked by python-mode."""
2288 2296
2289 2297 # Currently, nothing is done. Later more functionality can be added
2290 2298 # here if needed.
2291 2299
2292 2300 # The input cache shouldn't be updated
2293 2301
2294 2302 return line
2295 2303
2296 2304 def mktempfile(self,data=None):
2297 2305 """Make a new tempfile and return its filename.
2298 2306
2299 2307 This makes a call to tempfile.mktemp, but it registers the created
2300 2308 filename internally so ipython cleans it up at exit time.
2301 2309
2302 2310 Optional inputs:
2303 2311
2304 2312 - data(None): if data is given, it gets written out to the temp file
2305 2313 immediately, and the file is closed again."""
2306 2314
2307 2315 filename = tempfile.mktemp('.py','ipython_edit_')
2308 2316 self.tempfiles.append(filename)
2309 2317
2310 2318 if data:
2311 2319 tmp_file = open(filename,'w')
2312 2320 tmp_file.write(data)
2313 2321 tmp_file.close()
2314 2322 return filename
2315 2323
2316 2324 def write(self,data):
2317 2325 """Write a string to the default output"""
2318 2326 Term.cout.write(data)
2319 2327
2320 2328 def write_err(self,data):
2321 2329 """Write a string to the default error output"""
2322 2330 Term.cerr.write(data)
2323 2331
2324 2332 def exit(self):
2325 2333 """Handle interactive exit.
2326 2334
2327 2335 This method sets the exit_now attribute."""
2328 2336
2329 2337 if self.rc.confirm_exit:
2330 2338 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2331 2339 self.exit_now = True
2332 2340 else:
2333 2341 self.exit_now = True
2334 2342
2335 2343 def safe_execfile(self,fname,*where,**kw):
2336 2344 fname = os.path.expanduser(fname)
2337 2345
2338 2346 # find things also in current directory
2339 2347 dname = os.path.dirname(fname)
2340 2348 if not sys.path.count(dname):
2341 2349 sys.path.append(dname)
2342 2350
2343 2351 try:
2344 2352 xfile = open(fname)
2345 2353 except:
2346 2354 print >> Term.cerr, \
2347 2355 'Could not open file <%s> for safe execution.' % fname
2348 2356 return None
2349 2357
2350 2358 kw.setdefault('islog',0)
2351 2359 kw.setdefault('quiet',1)
2352 2360 kw.setdefault('exit_ignore',0)
2353 2361 first = xfile.readline()
2354 2362 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2355 2363 xfile.close()
2356 2364 # line by line execution
2357 2365 if first.startswith(loghead) or kw['islog']:
2358 2366 print 'Loading log file <%s> one line at a time...' % fname
2359 2367 if kw['quiet']:
2360 2368 stdout_save = sys.stdout
2361 2369 sys.stdout = StringIO.StringIO()
2362 2370 try:
2363 2371 globs,locs = where[0:2]
2364 2372 except:
2365 2373 try:
2366 2374 globs = locs = where[0]
2367 2375 except:
2368 2376 globs = locs = globals()
2369 2377 badblocks = []
2370 2378
2371 2379 # we also need to identify indented blocks of code when replaying
2372 2380 # logs and put them together before passing them to an exec
2373 2381 # statement. This takes a bit of regexp and look-ahead work in the
2374 2382 # file. It's easiest if we swallow the whole thing in memory
2375 2383 # first, and manually walk through the lines list moving the
2376 2384 # counter ourselves.
2377 2385 indent_re = re.compile('\s+\S')
2378 2386 xfile = open(fname)
2379 2387 filelines = xfile.readlines()
2380 2388 xfile.close()
2381 2389 nlines = len(filelines)
2382 2390 lnum = 0
2383 2391 while lnum < nlines:
2384 2392 line = filelines[lnum]
2385 2393 lnum += 1
2386 2394 # don't re-insert logger status info into cache
2387 2395 if line.startswith('#log#'):
2388 2396 continue
2389 2397 else:
2390 2398 # build a block of code (maybe a single line) for execution
2391 2399 block = line
2392 2400 try:
2393 2401 next = filelines[lnum] # lnum has already incremented
2394 2402 except:
2395 2403 next = None
2396 2404 while next and indent_re.match(next):
2397 2405 block += next
2398 2406 lnum += 1
2399 2407 try:
2400 2408 next = filelines[lnum]
2401 2409 except:
2402 2410 next = None
2403 2411 # now execute the block of one or more lines
2404 2412 try:
2405 2413 exec block in globs,locs
2406 2414 except SystemExit:
2407 2415 pass
2408 2416 except:
2409 2417 badblocks.append(block.rstrip())
2410 2418 if kw['quiet']: # restore stdout
2411 2419 sys.stdout.close()
2412 2420 sys.stdout = stdout_save
2413 2421 print 'Finished replaying log file <%s>' % fname
2414 2422 if badblocks:
2415 2423 print >> sys.stderr, ('\nThe following lines/blocks in file '
2416 2424 '<%s> reported errors:' % fname)
2417 2425
2418 2426 for badline in badblocks:
2419 2427 print >> sys.stderr, badline
2420 2428 else: # regular file execution
2421 2429 try:
2422 2430 execfile(fname,*where)
2423 2431 except SyntaxError:
2424 2432 self.showsyntaxerror()
2425 2433 warn('Failure executing file: <%s>' % fname)
2426 2434 except SystemExit,status:
2427 2435 if not kw['exit_ignore']:
2428 2436 self.showtraceback()
2429 2437 warn('Failure executing file: <%s>' % fname)
2430 2438 except:
2431 2439 self.showtraceback()
2432 2440 warn('Failure executing file: <%s>' % fname)
2433 2441
2434 2442 #************************* end of file <iplib.py> *****************************
@@ -1,5833 +1,5839 b''
1 2006-10-30 Ville Vainio <vivainio@gmail.com>
2
3 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
4 Bernsteins's patches for pydb integration.
5 http://bashdb.sourceforge.net/pydb/
6
1 7 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
2 8
3 9 * IPython/UserConfig/ipythonrc-scipy: minor clenaups to remove old
4 10 Numeric leftovers.
5 11
6 12 * ipython.el (py-execute-region): apply Stefan's patch to fix
7 13 garbled results if the python shell hasn't been previously started.
8 14
9 15 * IPython/genutils.py (arg_split): moved to genutils, since it's a
10 16 pretty generic function and useful for other things.
11 17
12 18 * IPython/OInspect.py (getsource): Add customizable source
13 19 extractor. After a request/patch form W. Stein (SAGE).
14 20
15 21 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
16 22 window size to a more reasonable value from what pexpect does,
17 23 since their choice causes wrapping bugs with long input lines.
18 24
19 25 2006-10-28 Ville Vainio <vivainio@gmail.com>
20 26
21 27 * Magic.py (%run): Save and restore the readline history from
22 28 file around %run commands to prevent side effects from
23 29 %runned programs that might use readline (e.g. pydb).
24 30
25 * extensions/pydb_ipy.py: Adds %pydb magic when imported, for
31 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
26 32 invoking the pydb enhanced debugger.
27 33
28 34 2006-10-23 Walter Doerwald <walter@livinglogic.de>
29 35
30 36 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
31 37 call the base class method and propagate the return value to
32 38 ifile. This is now done by path itself.
33 39
34 40 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
35 41
36 42 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
37 43 api: set_crash_handler(), to expose the ability to change the
38 44 internal crash handler.
39 45
40 46 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
41 47 the various parameters of the crash handler so that apps using
42 48 IPython as their engine can customize crash handling. Ipmlemented
43 49 at the request of SAGE.
44 50
45 51 2006-10-14 Ville Vainio <vivainio@gmail.com>
46 52
47 53 * Magic.py, ipython.el: applied first "safe" part of Rocky
48 54 Bernstein's patch set for pydb integration.
49 55
50 56 * Magic.py (%unalias, %alias): %store'd aliases can now be
51 57 removed with '%unalias'. %alias w/o args now shows most
52 58 interesting (stored / manually defined) aliases last
53 59 where they catch the eye w/o scrolling.
54 60
55 61 * Magic.py (%rehashx), ext_rehashdir.py: files with
56 62 'py' extension are always considered executable, even
57 63 when not in PATHEXT environment variable.
58 64
59 65 2006-10-12 Ville Vainio <vivainio@gmail.com>
60 66
61 67 * jobctrl.py: Add new "jobctrl" extension for spawning background
62 68 processes with "&find /". 'import jobctrl' to try it out. Requires
63 69 'subprocess' module, standard in python 2.4+.
64 70
65 71 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
66 72 so if foo -> bar and bar -> baz, then foo -> baz.
67 73
68 74 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
69 75
70 76 * IPython/Magic.py (Magic.parse_options): add a new posix option
71 77 to allow parsing of input args in magics that doesn't strip quotes
72 78 (if posix=False). This also closes %timeit bug reported by
73 79 Stefan.
74 80
75 81 2006-10-03 Ville Vainio <vivainio@gmail.com>
76 82
77 83 * iplib.py (raw_input, interact): Return ValueError catching for
78 84 raw_input. Fixes infinite loop for sys.stdin.close() or
79 85 sys.stdout.close().
80 86
81 87 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
82 88
83 89 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
84 90 to help in handling doctests. irunner is now pretty useful for
85 91 running standalone scripts and simulate a full interactive session
86 92 in a format that can be then pasted as a doctest.
87 93
88 94 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
89 95 on top of the default (useless) ones. This also fixes the nasty
90 96 way in which 2.5's Quitter() exits (reverted [1785]).
91 97
92 98 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
93 99 2.5.
94 100
95 101 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
96 102 color scheme is updated as well when color scheme is changed
97 103 interactively.
98 104
99 105 2006-09-27 Ville Vainio <vivainio@gmail.com>
100 106
101 107 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
102 108 infinite loop and just exit. It's a hack, but will do for a while.
103 109
104 110 2006-08-25 Walter Doerwald <walter@livinglogic.de>
105 111
106 112 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
107 113 the constructor, this makes it possible to get a list of only directories
108 114 or only files.
109 115
110 116 2006-08-12 Ville Vainio <vivainio@gmail.com>
111 117
112 118 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
113 119 they broke unittest
114 120
115 121 2006-08-11 Ville Vainio <vivainio@gmail.com>
116 122
117 123 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
118 124 by resolving issue properly, i.e. by inheriting FakeModule
119 125 from types.ModuleType. Pickling ipython interactive data
120 126 should still work as usual (testing appreciated).
121 127
122 128 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
123 129
124 130 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
125 131 running under python 2.3 with code from 2.4 to fix a bug with
126 132 help(). Reported by the Debian maintainers, Norbert Tretkowski
127 133 <norbert-AT-tretkowski.de> and Alexandre Fayolle
128 134 <afayolle-AT-debian.org>.
129 135
130 136 2006-08-04 Walter Doerwald <walter@livinglogic.de>
131 137
132 138 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
133 139 (which was displaying "quit" twice).
134 140
135 141 2006-07-28 Walter Doerwald <walter@livinglogic.de>
136 142
137 143 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
138 144 the mode argument).
139 145
140 146 2006-07-27 Walter Doerwald <walter@livinglogic.de>
141 147
142 148 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
143 149 not running under IPython.
144 150
145 151 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
146 152 and make it iterable (iterating over the attribute itself). Add two new
147 153 magic strings for __xattrs__(): If the string starts with "-", the attribute
148 154 will not be displayed in ibrowse's detail view (but it can still be
149 155 iterated over). This makes it possible to add attributes that are large
150 156 lists or generator methods to the detail view. Replace magic attribute names
151 157 and _attrname() and _getattr() with "descriptors": For each type of magic
152 158 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
153 159 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
154 160 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
155 161 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
156 162 are still supported.
157 163
158 164 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
159 165 fails in ibrowse.fetch(), the exception object is added as the last item
160 166 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
161 167 a generator throws an exception midway through execution.
162 168
163 169 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
164 170 encoding into methods.
165 171
166 172 2006-07-26 Ville Vainio <vivainio@gmail.com>
167 173
168 174 * iplib.py: history now stores multiline input as single
169 175 history entries. Patch by Jorgen Cederlof.
170 176
171 177 2006-07-18 Walter Doerwald <walter@livinglogic.de>
172 178
173 179 * IPython/Extensions/ibrowse.py: Make cursor visible over
174 180 non existing attributes.
175 181
176 182 2006-07-14 Walter Doerwald <walter@livinglogic.de>
177 183
178 184 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
179 185 error output of the running command doesn't mess up the screen.
180 186
181 187 2006-07-13 Walter Doerwald <walter@livinglogic.de>
182 188
183 189 * IPython/Extensions/ipipe.py (isort): Make isort usable without
184 190 argument. This sorts the items themselves.
185 191
186 192 2006-07-12 Walter Doerwald <walter@livinglogic.de>
187 193
188 194 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
189 195 Compile expression strings into code objects. This should speed
190 196 up ifilter and friends somewhat.
191 197
192 198 2006-07-08 Ville Vainio <vivainio@gmail.com>
193 199
194 200 * Magic.py: %cpaste now strips > from the beginning of lines
195 201 to ease pasting quoted code from emails. Contributed by
196 202 Stefan van der Walt.
197 203
198 204 2006-06-29 Ville Vainio <vivainio@gmail.com>
199 205
200 206 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
201 207 mode, patch contributed by Darren Dale. NEEDS TESTING!
202 208
203 209 2006-06-28 Walter Doerwald <walter@livinglogic.de>
204 210
205 211 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
206 212 a blue background. Fix fetching new display rows when the browser
207 213 scrolls more than a screenful (e.g. by using the goto command).
208 214
209 215 2006-06-27 Ville Vainio <vivainio@gmail.com>
210 216
211 217 * Magic.py (_inspect, _ofind) Apply David Huard's
212 218 patch for displaying the correct docstring for 'property'
213 219 attributes.
214 220
215 221 2006-06-23 Walter Doerwald <walter@livinglogic.de>
216 222
217 223 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
218 224 commands into the methods implementing them.
219 225
220 226 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
221 227
222 228 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
223 229 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
224 230 autoindent support was authored by Jin Liu.
225 231
226 232 2006-06-22 Walter Doerwald <walter@livinglogic.de>
227 233
228 234 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
229 235 for keymaps with a custom class that simplifies handling.
230 236
231 237 2006-06-19 Walter Doerwald <walter@livinglogic.de>
232 238
233 239 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
234 240 resizing. This requires Python 2.5 to work.
235 241
236 242 2006-06-16 Walter Doerwald <walter@livinglogic.de>
237 243
238 244 * IPython/Extensions/ibrowse.py: Add two new commands to
239 245 ibrowse: "hideattr" (mapped to "h") hides the attribute under
240 246 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
241 247 attributes again. Remapped the help command to "?". Display
242 248 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
243 249 as keys for the "home" and "end" commands. Add three new commands
244 250 to the input mode for "find" and friends: "delend" (CTRL-K)
245 251 deletes to the end of line. "incsearchup" searches upwards in the
246 252 command history for an input that starts with the text before the cursor.
247 253 "incsearchdown" does the same downwards. Removed a bogus mapping of
248 254 the x key to "delete".
249 255
250 256 2006-06-15 Ville Vainio <vivainio@gmail.com>
251 257
252 258 * iplib.py, hooks.py: Added new generate_prompt hook that can be
253 259 used to create prompts dynamically, instead of the "old" way of
254 260 assigning "magic" strings to prompt_in1 and prompt_in2. The old
255 261 way still works (it's invoked by the default hook), of course.
256 262
257 263 * Prompts.py: added generate_output_prompt hook for altering output
258 264 prompt
259 265
260 266 * Release.py: Changed version string to 0.7.3.svn.
261 267
262 268 2006-06-15 Walter Doerwald <walter@livinglogic.de>
263 269
264 270 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
265 271 the call to fetch() always tries to fetch enough data for at least one
266 272 full screen. This makes it possible to simply call moveto(0,0,True) in
267 273 the constructor. Fix typos and removed the obsolete goto attribute.
268 274
269 275 2006-06-12 Ville Vainio <vivainio@gmail.com>
270 276
271 277 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
272 278 allowing $variable interpolation within multiline statements,
273 279 though so far only with "sh" profile for a testing period.
274 280 The patch also enables splitting long commands with \ but it
275 281 doesn't work properly yet.
276 282
277 283 2006-06-12 Walter Doerwald <walter@livinglogic.de>
278 284
279 285 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
280 286 input history and the position of the cursor in the input history for
281 287 the find, findbackwards and goto command.
282 288
283 289 2006-06-10 Walter Doerwald <walter@livinglogic.de>
284 290
285 291 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
286 292 implements the basic functionality of browser commands that require
287 293 input. Reimplement the goto, find and findbackwards commands as
288 294 subclasses of _CommandInput. Add an input history and keymaps to those
289 295 commands. Add "\r" as a keyboard shortcut for the enterdefault and
290 296 execute commands.
291 297
292 298 2006-06-07 Ville Vainio <vivainio@gmail.com>
293 299
294 300 * iplib.py: ipython mybatch.ipy exits ipython immediately after
295 301 running the batch files instead of leaving the session open.
296 302
297 303 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
298 304
299 305 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
300 306 the original fix was incomplete. Patch submitted by W. Maier.
301 307
302 308 2006-06-07 Ville Vainio <vivainio@gmail.com>
303 309
304 310 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
305 311 Confirmation prompts can be supressed by 'quiet' option.
306 312 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
307 313
308 314 2006-06-06 *** Released version 0.7.2
309 315
310 316 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
311 317
312 318 * IPython/Release.py (version): Made 0.7.2 final for release.
313 319 Repo tagged and release cut.
314 320
315 321 2006-06-05 Ville Vainio <vivainio@gmail.com>
316 322
317 323 * Magic.py (magic_rehashx): Honor no_alias list earlier in
318 324 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
319 325
320 326 * upgrade_dir.py: try import 'path' module a bit harder
321 327 (for %upgrade)
322 328
323 329 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
324 330
325 331 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
326 332 instead of looping 20 times.
327 333
328 334 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
329 335 correctly at initialization time. Bug reported by Krishna Mohan
330 336 Gundu <gkmohan-AT-gmail.com> on the user list.
331 337
332 338 * IPython/Release.py (version): Mark 0.7.2 version to start
333 339 testing for release on 06/06.
334 340
335 341 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
336 342
337 343 * scripts/irunner: thin script interface so users don't have to
338 344 find the module and call it as an executable, since modules rarely
339 345 live in people's PATH.
340 346
341 347 * IPython/irunner.py (InteractiveRunner.__init__): added
342 348 delaybeforesend attribute to control delays with newer versions of
343 349 pexpect. Thanks to detailed help from pexpect's author, Noah
344 350 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
345 351 correctly (it works in NoColor mode).
346 352
347 353 * IPython/iplib.py (handle_normal): fix nasty crash reported on
348 354 SAGE list, from improper log() calls.
349 355
350 356 2006-05-31 Ville Vainio <vivainio@gmail.com>
351 357
352 358 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
353 359 with args in parens to work correctly with dirs that have spaces.
354 360
355 361 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
356 362
357 363 * IPython/Logger.py (Logger.logstart): add option to log raw input
358 364 instead of the processed one. A -r flag was added to the
359 365 %logstart magic used for controlling logging.
360 366
361 367 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
362 368
363 369 * IPython/iplib.py (InteractiveShell.__init__): add check for the
364 370 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
365 371 recognize the option. After a bug report by Will Maier. This
366 372 closes #64 (will do it after confirmation from W. Maier).
367 373
368 374 * IPython/irunner.py: New module to run scripts as if manually
369 375 typed into an interactive environment, based on pexpect. After a
370 376 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
371 377 ipython-user list. Simple unittests in the tests/ directory.
372 378
373 379 * tools/release: add Will Maier, OpenBSD port maintainer, to
374 380 recepients list. We are now officially part of the OpenBSD ports:
375 381 http://www.openbsd.org/ports.html ! Many thanks to Will for the
376 382 work.
377 383
378 384 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
379 385
380 386 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
381 387 so that it doesn't break tkinter apps.
382 388
383 389 * IPython/iplib.py (_prefilter): fix bug where aliases would
384 390 shadow variables when autocall was fully off. Reported by SAGE
385 391 author William Stein.
386 392
387 393 * IPython/OInspect.py (Inspector.__init__): add a flag to control
388 394 at what detail level strings are computed when foo? is requested.
389 395 This allows users to ask for example that the string form of an
390 396 object is only computed when foo?? is called, or even never, by
391 397 setting the object_info_string_level >= 2 in the configuration
392 398 file. This new option has been added and documented. After a
393 399 request by SAGE to be able to control the printing of very large
394 400 objects more easily.
395 401
396 402 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
397 403
398 404 * IPython/ipmaker.py (make_IPython): remove the ipython call path
399 405 from sys.argv, to be 100% consistent with how Python itself works
400 406 (as seen for example with python -i file.py). After a bug report
401 407 by Jeffrey Collins.
402 408
403 409 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
404 410 nasty bug which was preventing custom namespaces with -pylab,
405 411 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
406 412 compatibility (long gone from mpl).
407 413
408 414 * IPython/ipapi.py (make_session): name change: create->make. We
409 415 use make in other places (ipmaker,...), it's shorter and easier to
410 416 type and say, etc. I'm trying to clean things before 0.7.2 so
411 417 that I can keep things stable wrt to ipapi in the chainsaw branch.
412 418
413 419 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
414 420 python-mode recognizes our debugger mode. Add support for
415 421 autoindent inside (X)emacs. After a patch sent in by Jin Liu
416 422 <m.liu.jin-AT-gmail.com> originally written by
417 423 doxgen-AT-newsmth.net (with minor modifications for xemacs
418 424 compatibility)
419 425
420 426 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
421 427 tracebacks when walking the stack so that the stack tracking system
422 428 in emacs' python-mode can identify the frames correctly.
423 429
424 430 * IPython/ipmaker.py (make_IPython): make the internal (and
425 431 default config) autoedit_syntax value false by default. Too many
426 432 users have complained to me (both on and off-list) about problems
427 433 with this option being on by default, so I'm making it default to
428 434 off. It can still be enabled by anyone via the usual mechanisms.
429 435
430 436 * IPython/completer.py (Completer.attr_matches): add support for
431 437 PyCrust-style _getAttributeNames magic method. Patch contributed
432 438 by <mscott-AT-goldenspud.com>. Closes #50.
433 439
434 440 * IPython/iplib.py (InteractiveShell.__init__): remove the
435 441 deletion of exit/quit from __builtin__, which can break
436 442 third-party tools like the Zope debugging console. The
437 443 %exit/%quit magics remain. In general, it's probably a good idea
438 444 not to delete anything from __builtin__, since we never know what
439 445 that will break. In any case, python now (for 2.5) will support
440 446 'real' exit/quit, so this issue is moot. Closes #55.
441 447
442 448 * IPython/genutils.py (with_obj): rename the 'with' function to
443 449 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
444 450 becomes a language keyword. Closes #53.
445 451
446 452 * IPython/FakeModule.py (FakeModule.__init__): add a proper
447 453 __file__ attribute to this so it fools more things into thinking
448 454 it is a real module. Closes #59.
449 455
450 456 * IPython/Magic.py (magic_edit): add -n option to open the editor
451 457 at a specific line number. After a patch by Stefan van der Walt.
452 458
453 459 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
454 460
455 461 * IPython/iplib.py (edit_syntax_error): fix crash when for some
456 462 reason the file could not be opened. After automatic crash
457 463 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
458 464 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
459 465 (_should_recompile): Don't fire editor if using %bg, since there
460 466 is no file in the first place. From the same report as above.
461 467 (raw_input): protect against faulty third-party prefilters. After
462 468 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
463 469 while running under SAGE.
464 470
465 471 2006-05-23 Ville Vainio <vivainio@gmail.com>
466 472
467 473 * ipapi.py: Stripped down ip.to_user_ns() to work only as
468 474 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
469 475 now returns None (again), unless dummy is specifically allowed by
470 476 ipapi.get(allow_dummy=True).
471 477
472 478 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
473 479
474 480 * IPython: remove all 2.2-compatibility objects and hacks from
475 481 everywhere, since we only support 2.3 at this point. Docs
476 482 updated.
477 483
478 484 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
479 485 Anything requiring extra validation can be turned into a Python
480 486 property in the future. I used a property for the db one b/c
481 487 there was a nasty circularity problem with the initialization
482 488 order, which right now I don't have time to clean up.
483 489
484 490 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
485 491 another locking bug reported by Jorgen. I'm not 100% sure though,
486 492 so more testing is needed...
487 493
488 494 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
489 495
490 496 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
491 497 local variables from any routine in user code (typically executed
492 498 with %run) directly into the interactive namespace. Very useful
493 499 when doing complex debugging.
494 500 (IPythonNotRunning): Changed the default None object to a dummy
495 501 whose attributes can be queried as well as called without
496 502 exploding, to ease writing code which works transparently both in
497 503 and out of ipython and uses some of this API.
498 504
499 505 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
500 506
501 507 * IPython/hooks.py (result_display): Fix the fact that our display
502 508 hook was using str() instead of repr(), as the default python
503 509 console does. This had gone unnoticed b/c it only happened if
504 510 %Pprint was off, but the inconsistency was there.
505 511
506 512 2006-05-15 Ville Vainio <vivainio@gmail.com>
507 513
508 514 * Oinspect.py: Only show docstring for nonexisting/binary files
509 515 when doing object??, closing ticket #62
510 516
511 517 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
512 518
513 519 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
514 520 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
515 521 was being released in a routine which hadn't checked if it had
516 522 been the one to acquire it.
517 523
518 524 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
519 525
520 526 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
521 527
522 528 2006-04-11 Ville Vainio <vivainio@gmail.com>
523 529
524 530 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
525 531 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
526 532 prefilters, allowing stuff like magics and aliases in the file.
527 533
528 534 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
529 535 added. Supported now are "%clear in" and "%clear out" (clear input and
530 536 output history, respectively). Also fixed CachedOutput.flush to
531 537 properly flush the output cache.
532 538
533 539 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
534 540 half-success (and fail explicitly).
535 541
536 542 2006-03-28 Ville Vainio <vivainio@gmail.com>
537 543
538 544 * iplib.py: Fix quoting of aliases so that only argless ones
539 545 are quoted
540 546
541 547 2006-03-28 Ville Vainio <vivainio@gmail.com>
542 548
543 549 * iplib.py: Quote aliases with spaces in the name.
544 550 "c:\program files\blah\bin" is now legal alias target.
545 551
546 552 * ext_rehashdir.py: Space no longer allowed as arg
547 553 separator, since space is legal in path names.
548 554
549 555 2006-03-16 Ville Vainio <vivainio@gmail.com>
550 556
551 557 * upgrade_dir.py: Take path.py from Extensions, correcting
552 558 %upgrade magic
553 559
554 560 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
555 561
556 562 * hooks.py: Only enclose editor binary in quotes if legal and
557 563 necessary (space in the name, and is an existing file). Fixes a bug
558 564 reported by Zachary Pincus.
559 565
560 566 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
561 567
562 568 * Manual: thanks to a tip on proper color handling for Emacs, by
563 569 Eric J Haywiser <ejh1-AT-MIT.EDU>.
564 570
565 571 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
566 572 by applying the provided patch. Thanks to Liu Jin
567 573 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
568 574 XEmacs/Linux, I'm trusting the submitter that it actually helps
569 575 under win32/GNU Emacs. Will revisit if any problems are reported.
570 576
571 577 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
572 578
573 579 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
574 580 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
575 581
576 582 2006-03-12 Ville Vainio <vivainio@gmail.com>
577 583
578 584 * Magic.py (magic_timeit): Added %timeit magic, contributed by
579 585 Torsten Marek.
580 586
581 587 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
582 588
583 589 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
584 590 line ranges works again.
585 591
586 592 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
587 593
588 594 * IPython/iplib.py (showtraceback): add back sys.last_traceback
589 595 and friends, after a discussion with Zach Pincus on ipython-user.
590 596 I'm not 100% sure, but after thinking about it quite a bit, it may
591 597 be OK. Testing with the multithreaded shells didn't reveal any
592 598 problems, but let's keep an eye out.
593 599
594 600 In the process, I fixed a few things which were calling
595 601 self.InteractiveTB() directly (like safe_execfile), which is a
596 602 mistake: ALL exception reporting should be done by calling
597 603 self.showtraceback(), which handles state and tab-completion and
598 604 more.
599 605
600 606 2006-03-01 Ville Vainio <vivainio@gmail.com>
601 607
602 608 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
603 609 To use, do "from ipipe import *".
604 610
605 611 2006-02-24 Ville Vainio <vivainio@gmail.com>
606 612
607 613 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
608 614 "cleanly" and safely than the older upgrade mechanism.
609 615
610 616 2006-02-21 Ville Vainio <vivainio@gmail.com>
611 617
612 618 * Magic.py: %save works again.
613 619
614 620 2006-02-15 Ville Vainio <vivainio@gmail.com>
615 621
616 622 * Magic.py: %Pprint works again
617 623
618 624 * Extensions/ipy_sane_defaults.py: Provide everything provided
619 625 in default ipythonrc, to make it possible to have a completely empty
620 626 ipythonrc (and thus completely rc-file free configuration)
621 627
622 628 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
623 629
624 630 * IPython/hooks.py (editor): quote the call to the editor command,
625 631 to allow commands with spaces in them. Problem noted by watching
626 632 Ian Oswald's video about textpad under win32 at
627 633 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
628 634
629 635 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
630 636 describing magics (we haven't used @ for a loong time).
631 637
632 638 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
633 639 contributed by marienz to close
634 640 http://www.scipy.net/roundup/ipython/issue53.
635 641
636 642 2006-02-10 Ville Vainio <vivainio@gmail.com>
637 643
638 644 * genutils.py: getoutput now works in win32 too
639 645
640 646 * completer.py: alias and magic completion only invoked
641 647 at the first "item" in the line, to avoid "cd %store"
642 648 nonsense.
643 649
644 650 2006-02-09 Ville Vainio <vivainio@gmail.com>
645 651
646 652 * test/*: Added a unit testing framework (finally).
647 653 '%run runtests.py' to run test_*.
648 654
649 655 * ipapi.py: Exposed runlines and set_custom_exc
650 656
651 657 2006-02-07 Ville Vainio <vivainio@gmail.com>
652 658
653 659 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
654 660 instead use "f(1 2)" as before.
655 661
656 662 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
657 663
658 664 * IPython/demo.py (IPythonDemo): Add new classes to the demo
659 665 facilities, for demos processed by the IPython input filter
660 666 (IPythonDemo), and for running a script one-line-at-a-time as a
661 667 demo, both for pure Python (LineDemo) and for IPython-processed
662 668 input (IPythonLineDemo). After a request by Dave Kohel, from the
663 669 SAGE team.
664 670 (Demo.edit): added an edit() method to the demo objects, to edit
665 671 the in-memory copy of the last executed block.
666 672
667 673 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
668 674 processing to %edit, %macro and %save. These commands can now be
669 675 invoked on the unprocessed input as it was typed by the user
670 676 (without any prefilters applied). After requests by the SAGE team
671 677 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
672 678
673 679 2006-02-01 Ville Vainio <vivainio@gmail.com>
674 680
675 681 * setup.py, eggsetup.py: easy_install ipython==dev works
676 682 correctly now (on Linux)
677 683
678 684 * ipy_user_conf,ipmaker: user config changes, removed spurious
679 685 warnings
680 686
681 687 * iplib: if rc.banner is string, use it as is.
682 688
683 689 * Magic: %pycat accepts a string argument and pages it's contents.
684 690
685 691
686 692 2006-01-30 Ville Vainio <vivainio@gmail.com>
687 693
688 694 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
689 695 Now %store and bookmarks work through PickleShare, meaning that
690 696 concurrent access is possible and all ipython sessions see the
691 697 same database situation all the time, instead of snapshot of
692 698 the situation when the session was started. Hence, %bookmark
693 699 results are immediately accessible from othes sessions. The database
694 700 is also available for use by user extensions. See:
695 701 http://www.python.org/pypi/pickleshare
696 702
697 703 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
698 704
699 705 * aliases can now be %store'd
700 706
701 707 * path.py moved to Extensions so that pickleshare does not need
702 708 IPython-specific import. Extensions added to pythonpath right
703 709 at __init__.
704 710
705 711 * iplib.py: ipalias deprecated/redundant; aliases are converted and
706 712 called with _ip.system and the pre-transformed command string.
707 713
708 714 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
709 715
710 716 * IPython/iplib.py (interact): Fix that we were not catching
711 717 KeyboardInterrupt exceptions properly. I'm not quite sure why the
712 718 logic here had to change, but it's fixed now.
713 719
714 720 2006-01-29 Ville Vainio <vivainio@gmail.com>
715 721
716 722 * iplib.py: Try to import pyreadline on Windows.
717 723
718 724 2006-01-27 Ville Vainio <vivainio@gmail.com>
719 725
720 726 * iplib.py: Expose ipapi as _ip in builtin namespace.
721 727 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
722 728 and ip_set_hook (-> _ip.set_hook) redundant. % and !
723 729 syntax now produce _ip.* variant of the commands.
724 730
725 731 * "_ip.options().autoedit_syntax = 2" automatically throws
726 732 user to editor for syntax error correction without prompting.
727 733
728 734 2006-01-27 Ville Vainio <vivainio@gmail.com>
729 735
730 736 * ipmaker.py: Give "realistic" sys.argv for scripts (without
731 737 'ipython' at argv[0]) executed through command line.
732 738 NOTE: this DEPRECATES calling ipython with multiple scripts
733 739 ("ipython a.py b.py c.py")
734 740
735 741 * iplib.py, hooks.py: Added configurable input prefilter,
736 742 named 'input_prefilter'. See ext_rescapture.py for example
737 743 usage.
738 744
739 745 * ext_rescapture.py, Magic.py: Better system command output capture
740 746 through 'var = !ls' (deprecates user-visible %sc). Same notation
741 747 applies for magics, 'var = %alias' assigns alias list to var.
742 748
743 749 * ipapi.py: added meta() for accessing extension-usable data store.
744 750
745 751 * iplib.py: added InteractiveShell.getapi(). New magics should be
746 752 written doing self.getapi() instead of using the shell directly.
747 753
748 754 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
749 755 %store foo >> ~/myfoo.txt to store variables to files (in clean
750 756 textual form, not a restorable pickle).
751 757
752 758 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
753 759
754 760 * usage.py, Magic.py: added %quickref
755 761
756 762 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
757 763
758 764 * GetoptErrors when invoking magics etc. with wrong args
759 765 are now more helpful:
760 766 GetoptError: option -l not recognized (allowed: "qb" )
761 767
762 768 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
763 769
764 770 * IPython/demo.py (Demo.show): Flush stdout after each block, so
765 771 computationally intensive blocks don't appear to stall the demo.
766 772
767 773 2006-01-24 Ville Vainio <vivainio@gmail.com>
768 774
769 775 * iplib.py, hooks.py: 'result_display' hook can return a non-None
770 776 value to manipulate resulting history entry.
771 777
772 778 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
773 779 to instance methods of IPApi class, to make extending an embedded
774 780 IPython feasible. See ext_rehashdir.py for example usage.
775 781
776 782 * Merged 1071-1076 from branches/0.7.1
777 783
778 784
779 785 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
780 786
781 787 * tools/release (daystamp): Fix build tools to use the new
782 788 eggsetup.py script to build lightweight eggs.
783 789
784 790 * Applied changesets 1062 and 1064 before 0.7.1 release.
785 791
786 792 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
787 793 see the raw input history (without conversions like %ls ->
788 794 ipmagic("ls")). After a request from W. Stein, SAGE
789 795 (http://modular.ucsd.edu/sage) developer. This information is
790 796 stored in the input_hist_raw attribute of the IPython instance, so
791 797 developers can access it if needed (it's an InputList instance).
792 798
793 799 * Versionstring = 0.7.2.svn
794 800
795 801 * eggsetup.py: A separate script for constructing eggs, creates
796 802 proper launch scripts even on Windows (an .exe file in
797 803 \python24\scripts).
798 804
799 805 * ipapi.py: launch_new_instance, launch entry point needed for the
800 806 egg.
801 807
802 808 2006-01-23 Ville Vainio <vivainio@gmail.com>
803 809
804 810 * Added %cpaste magic for pasting python code
805 811
806 812 2006-01-22 Ville Vainio <vivainio@gmail.com>
807 813
808 814 * Merge from branches/0.7.1 into trunk, revs 1052-1057
809 815
810 816 * Versionstring = 0.7.2.svn
811 817
812 818 * eggsetup.py: A separate script for constructing eggs, creates
813 819 proper launch scripts even on Windows (an .exe file in
814 820 \python24\scripts).
815 821
816 822 * ipapi.py: launch_new_instance, launch entry point needed for the
817 823 egg.
818 824
819 825 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
820 826
821 827 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
822 828 %pfile foo would print the file for foo even if it was a binary.
823 829 Now, extensions '.so' and '.dll' are skipped.
824 830
825 831 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
826 832 bug, where macros would fail in all threaded modes. I'm not 100%
827 833 sure, so I'm going to put out an rc instead of making a release
828 834 today, and wait for feedback for at least a few days.
829 835
830 836 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
831 837 it...) the handling of pasting external code with autoindent on.
832 838 To get out of a multiline input, the rule will appear for most
833 839 users unchanged: two blank lines or change the indent level
834 840 proposed by IPython. But there is a twist now: you can
835 841 add/subtract only *one or two spaces*. If you add/subtract three
836 842 or more (unless you completely delete the line), IPython will
837 843 accept that line, and you'll need to enter a second one of pure
838 844 whitespace. I know it sounds complicated, but I can't find a
839 845 different solution that covers all the cases, with the right
840 846 heuristics. Hopefully in actual use, nobody will really notice
841 847 all these strange rules and things will 'just work'.
842 848
843 849 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
844 850
845 851 * IPython/iplib.py (interact): catch exceptions which can be
846 852 triggered asynchronously by signal handlers. Thanks to an
847 853 automatic crash report, submitted by Colin Kingsley
848 854 <tercel-AT-gentoo.org>.
849 855
850 856 2006-01-20 Ville Vainio <vivainio@gmail.com>
851 857
852 858 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
853 859 (%rehashdir, very useful, try it out) of how to extend ipython
854 860 with new magics. Also added Extensions dir to pythonpath to make
855 861 importing extensions easy.
856 862
857 863 * %store now complains when trying to store interactively declared
858 864 classes / instances of those classes.
859 865
860 866 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
861 867 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
862 868 if they exist, and ipy_user_conf.py with some defaults is created for
863 869 the user.
864 870
865 871 * Startup rehashing done by the config file, not InterpreterExec.
866 872 This means system commands are available even without selecting the
867 873 pysh profile. It's the sensible default after all.
868 874
869 875 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
870 876
871 877 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
872 878 multiline code with autoindent on working. But I am really not
873 879 sure, so this needs more testing. Will commit a debug-enabled
874 880 version for now, while I test it some more, so that Ville and
875 881 others may also catch any problems. Also made
876 882 self.indent_current_str() a method, to ensure that there's no
877 883 chance of the indent space count and the corresponding string
878 884 falling out of sync. All code needing the string should just call
879 885 the method.
880 886
881 887 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
882 888
883 889 * IPython/Magic.py (magic_edit): fix check for when users don't
884 890 save their output files, the try/except was in the wrong section.
885 891
886 892 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
887 893
888 894 * IPython/Magic.py (magic_run): fix __file__ global missing from
889 895 script's namespace when executed via %run. After a report by
890 896 Vivian.
891 897
892 898 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
893 899 when using python 2.4. The parent constructor changed in 2.4, and
894 900 we need to track it directly (we can't call it, as it messes up
895 901 readline and tab-completion inside our pdb would stop working).
896 902 After a bug report by R. Bernstein <rocky-AT-panix.com>.
897 903
898 904 2006-01-16 Ville Vainio <vivainio@gmail.com>
899 905
900 906 * Ipython/magic.py: Reverted back to old %edit functionality
901 907 that returns file contents on exit.
902 908
903 909 * IPython/path.py: Added Jason Orendorff's "path" module to
904 910 IPython tree, http://www.jorendorff.com/articles/python/path/.
905 911 You can get path objects conveniently through %sc, and !!, e.g.:
906 912 sc files=ls
907 913 for p in files.paths: # or files.p
908 914 print p,p.mtime
909 915
910 916 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
911 917 now work again without considering the exclusion regexp -
912 918 hence, things like ',foo my/path' turn to 'foo("my/path")'
913 919 instead of syntax error.
914 920
915 921
916 922 2006-01-14 Ville Vainio <vivainio@gmail.com>
917 923
918 924 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
919 925 ipapi decorators for python 2.4 users, options() provides access to rc
920 926 data.
921 927
922 928 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
923 929 as path separators (even on Linux ;-). Space character after
924 930 backslash (as yielded by tab completer) is still space;
925 931 "%cd long\ name" works as expected.
926 932
927 933 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
928 934 as "chain of command", with priority. API stays the same,
929 935 TryNext exception raised by a hook function signals that
930 936 current hook failed and next hook should try handling it, as
931 937 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
932 938 requested configurable display hook, which is now implemented.
933 939
934 940 2006-01-13 Ville Vainio <vivainio@gmail.com>
935 941
936 942 * IPython/platutils*.py: platform specific utility functions,
937 943 so far only set_term_title is implemented (change terminal
938 944 label in windowing systems). %cd now changes the title to
939 945 current dir.
940 946
941 947 * IPython/Release.py: Added myself to "authors" list,
942 948 had to create new files.
943 949
944 950 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
945 951 shell escape; not a known bug but had potential to be one in the
946 952 future.
947 953
948 954 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
949 955 extension API for IPython! See the module for usage example. Fix
950 956 OInspect for docstring-less magic functions.
951 957
952 958
953 959 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
954 960
955 961 * IPython/iplib.py (raw_input): temporarily deactivate all
956 962 attempts at allowing pasting of code with autoindent on. It
957 963 introduced bugs (reported by Prabhu) and I can't seem to find a
958 964 robust combination which works in all cases. Will have to revisit
959 965 later.
960 966
961 967 * IPython/genutils.py: remove isspace() function. We've dropped
962 968 2.2 compatibility, so it's OK to use the string method.
963 969
964 970 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
965 971
966 972 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
967 973 matching what NOT to autocall on, to include all python binary
968 974 operators (including things like 'and', 'or', 'is' and 'in').
969 975 Prompted by a bug report on 'foo & bar', but I realized we had
970 976 many more potential bug cases with other operators. The regexp is
971 977 self.re_exclude_auto, it's fairly commented.
972 978
973 979 2006-01-12 Ville Vainio <vivainio@gmail.com>
974 980
975 981 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
976 982 Prettified and hardened string/backslash quoting with ipsystem(),
977 983 ipalias() and ipmagic(). Now even \ characters are passed to
978 984 %magics, !shell escapes and aliases exactly as they are in the
979 985 ipython command line. Should improve backslash experience,
980 986 particularly in Windows (path delimiter for some commands that
981 987 won't understand '/'), but Unix benefits as well (regexps). %cd
982 988 magic still doesn't support backslash path delimiters, though. Also
983 989 deleted all pretense of supporting multiline command strings in
984 990 !system or %magic commands. Thanks to Jerry McRae for suggestions.
985 991
986 992 * doc/build_doc_instructions.txt added. Documentation on how to
987 993 use doc/update_manual.py, added yesterday. Both files contributed
988 994 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
989 995 doc/*.sh for deprecation at a later date.
990 996
991 997 * /ipython.py Added ipython.py to root directory for
992 998 zero-installation (tar xzvf ipython.tgz; cd ipython; python
993 999 ipython.py) and development convenience (no need to keep doing
994 1000 "setup.py install" between changes).
995 1001
996 1002 * Made ! and !! shell escapes work (again) in multiline expressions:
997 1003 if 1:
998 1004 !ls
999 1005 !!ls
1000 1006
1001 1007 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1002 1008
1003 1009 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1004 1010 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1005 1011 module in case-insensitive installation. Was causing crashes
1006 1012 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1007 1013
1008 1014 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1009 1015 <marienz-AT-gentoo.org>, closes
1010 1016 http://www.scipy.net/roundup/ipython/issue51.
1011 1017
1012 1018 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1013 1019
1014 1020 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1015 1021 problem of excessive CPU usage under *nix and keyboard lag under
1016 1022 win32.
1017 1023
1018 1024 2006-01-10 *** Released version 0.7.0
1019 1025
1020 1026 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1021 1027
1022 1028 * IPython/Release.py (revision): tag version number to 0.7.0,
1023 1029 ready for release.
1024 1030
1025 1031 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1026 1032 it informs the user of the name of the temp. file used. This can
1027 1033 help if you decide later to reuse that same file, so you know
1028 1034 where to copy the info from.
1029 1035
1030 1036 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1031 1037
1032 1038 * setup_bdist_egg.py: little script to build an egg. Added
1033 1039 support in the release tools as well.
1034 1040
1035 1041 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1036 1042
1037 1043 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1038 1044 version selection (new -wxversion command line and ipythonrc
1039 1045 parameter). Patch contributed by Arnd Baecker
1040 1046 <arnd.baecker-AT-web.de>.
1041 1047
1042 1048 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1043 1049 embedded instances, for variables defined at the interactive
1044 1050 prompt of the embedded ipython. Reported by Arnd.
1045 1051
1046 1052 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1047 1053 it can be used as a (stateful) toggle, or with a direct parameter.
1048 1054
1049 1055 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1050 1056 could be triggered in certain cases and cause the traceback
1051 1057 printer not to work.
1052 1058
1053 1059 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1054 1060
1055 1061 * IPython/iplib.py (_should_recompile): Small fix, closes
1056 1062 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1057 1063
1058 1064 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1059 1065
1060 1066 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1061 1067 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1062 1068 Moad for help with tracking it down.
1063 1069
1064 1070 * IPython/iplib.py (handle_auto): fix autocall handling for
1065 1071 objects which support BOTH __getitem__ and __call__ (so that f [x]
1066 1072 is left alone, instead of becoming f([x]) automatically).
1067 1073
1068 1074 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1069 1075 Ville's patch.
1070 1076
1071 1077 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1072 1078
1073 1079 * IPython/iplib.py (handle_auto): changed autocall semantics to
1074 1080 include 'smart' mode, where the autocall transformation is NOT
1075 1081 applied if there are no arguments on the line. This allows you to
1076 1082 just type 'foo' if foo is a callable to see its internal form,
1077 1083 instead of having it called with no arguments (typically a
1078 1084 mistake). The old 'full' autocall still exists: for that, you
1079 1085 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1080 1086
1081 1087 * IPython/completer.py (Completer.attr_matches): add
1082 1088 tab-completion support for Enthoughts' traits. After a report by
1083 1089 Arnd and a patch by Prabhu.
1084 1090
1085 1091 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1086 1092
1087 1093 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1088 1094 Schmolck's patch to fix inspect.getinnerframes().
1089 1095
1090 1096 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1091 1097 for embedded instances, regarding handling of namespaces and items
1092 1098 added to the __builtin__ one. Multiple embedded instances and
1093 1099 recursive embeddings should work better now (though I'm not sure
1094 1100 I've got all the corner cases fixed, that code is a bit of a brain
1095 1101 twister).
1096 1102
1097 1103 * IPython/Magic.py (magic_edit): added support to edit in-memory
1098 1104 macros (automatically creates the necessary temp files). %edit
1099 1105 also doesn't return the file contents anymore, it's just noise.
1100 1106
1101 1107 * IPython/completer.py (Completer.attr_matches): revert change to
1102 1108 complete only on attributes listed in __all__. I realized it
1103 1109 cripples the tab-completion system as a tool for exploring the
1104 1110 internals of unknown libraries (it renders any non-__all__
1105 1111 attribute off-limits). I got bit by this when trying to see
1106 1112 something inside the dis module.
1107 1113
1108 1114 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1109 1115
1110 1116 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1111 1117 namespace for users and extension writers to hold data in. This
1112 1118 follows the discussion in
1113 1119 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1114 1120
1115 1121 * IPython/completer.py (IPCompleter.complete): small patch to help
1116 1122 tab-completion under Emacs, after a suggestion by John Barnard
1117 1123 <barnarj-AT-ccf.org>.
1118 1124
1119 1125 * IPython/Magic.py (Magic.extract_input_slices): added support for
1120 1126 the slice notation in magics to use N-M to represent numbers N...M
1121 1127 (closed endpoints). This is used by %macro and %save.
1122 1128
1123 1129 * IPython/completer.py (Completer.attr_matches): for modules which
1124 1130 define __all__, complete only on those. After a patch by Jeffrey
1125 1131 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1126 1132 speed up this routine.
1127 1133
1128 1134 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1129 1135 don't know if this is the end of it, but the behavior now is
1130 1136 certainly much more correct. Note that coupled with macros,
1131 1137 slightly surprising (at first) behavior may occur: a macro will in
1132 1138 general expand to multiple lines of input, so upon exiting, the
1133 1139 in/out counters will both be bumped by the corresponding amount
1134 1140 (as if the macro's contents had been typed interactively). Typing
1135 1141 %hist will reveal the intermediate (silently processed) lines.
1136 1142
1137 1143 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1138 1144 pickle to fail (%run was overwriting __main__ and not restoring
1139 1145 it, but pickle relies on __main__ to operate).
1140 1146
1141 1147 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1142 1148 using properties, but forgot to make the main InteractiveShell
1143 1149 class a new-style class. Properties fail silently, and
1144 1150 mysteriously, with old-style class (getters work, but
1145 1151 setters don't do anything).
1146 1152
1147 1153 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1148 1154
1149 1155 * IPython/Magic.py (magic_history): fix history reporting bug (I
1150 1156 know some nasties are still there, I just can't seem to find a
1151 1157 reproducible test case to track them down; the input history is
1152 1158 falling out of sync...)
1153 1159
1154 1160 * IPython/iplib.py (handle_shell_escape): fix bug where both
1155 1161 aliases and system accesses where broken for indented code (such
1156 1162 as loops).
1157 1163
1158 1164 * IPython/genutils.py (shell): fix small but critical bug for
1159 1165 win32 system access.
1160 1166
1161 1167 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1162 1168
1163 1169 * IPython/iplib.py (showtraceback): remove use of the
1164 1170 sys.last_{type/value/traceback} structures, which are non
1165 1171 thread-safe.
1166 1172 (_prefilter): change control flow to ensure that we NEVER
1167 1173 introspect objects when autocall is off. This will guarantee that
1168 1174 having an input line of the form 'x.y', where access to attribute
1169 1175 'y' has side effects, doesn't trigger the side effect TWICE. It
1170 1176 is important to note that, with autocall on, these side effects
1171 1177 can still happen.
1172 1178 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1173 1179 trio. IPython offers these three kinds of special calls which are
1174 1180 not python code, and it's a good thing to have their call method
1175 1181 be accessible as pure python functions (not just special syntax at
1176 1182 the command line). It gives us a better internal implementation
1177 1183 structure, as well as exposing these for user scripting more
1178 1184 cleanly.
1179 1185
1180 1186 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1181 1187 file. Now that they'll be more likely to be used with the
1182 1188 persistance system (%store), I want to make sure their module path
1183 1189 doesn't change in the future, so that we don't break things for
1184 1190 users' persisted data.
1185 1191
1186 1192 * IPython/iplib.py (autoindent_update): move indentation
1187 1193 management into the _text_ processing loop, not the keyboard
1188 1194 interactive one. This is necessary to correctly process non-typed
1189 1195 multiline input (such as macros).
1190 1196
1191 1197 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1192 1198 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1193 1199 which was producing problems in the resulting manual.
1194 1200 (magic_whos): improve reporting of instances (show their class,
1195 1201 instead of simply printing 'instance' which isn't terribly
1196 1202 informative).
1197 1203
1198 1204 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1199 1205 (minor mods) to support network shares under win32.
1200 1206
1201 1207 * IPython/winconsole.py (get_console_size): add new winconsole
1202 1208 module and fixes to page_dumb() to improve its behavior under
1203 1209 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1204 1210
1205 1211 * IPython/Magic.py (Macro): simplified Macro class to just
1206 1212 subclass list. We've had only 2.2 compatibility for a very long
1207 1213 time, yet I was still avoiding subclassing the builtin types. No
1208 1214 more (I'm also starting to use properties, though I won't shift to
1209 1215 2.3-specific features quite yet).
1210 1216 (magic_store): added Ville's patch for lightweight variable
1211 1217 persistence, after a request on the user list by Matt Wilkie
1212 1218 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1213 1219 details.
1214 1220
1215 1221 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1216 1222 changed the default logfile name from 'ipython.log' to
1217 1223 'ipython_log.py'. These logs are real python files, and now that
1218 1224 we have much better multiline support, people are more likely to
1219 1225 want to use them as such. Might as well name them correctly.
1220 1226
1221 1227 * IPython/Magic.py: substantial cleanup. While we can't stop
1222 1228 using magics as mixins, due to the existing customizations 'out
1223 1229 there' which rely on the mixin naming conventions, at least I
1224 1230 cleaned out all cross-class name usage. So once we are OK with
1225 1231 breaking compatibility, the two systems can be separated.
1226 1232
1227 1233 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1228 1234 anymore, and the class is a fair bit less hideous as well. New
1229 1235 features were also introduced: timestamping of input, and logging
1230 1236 of output results. These are user-visible with the -t and -o
1231 1237 options to %logstart. Closes
1232 1238 http://www.scipy.net/roundup/ipython/issue11 and a request by
1233 1239 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1234 1240
1235 1241 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1236 1242
1237 1243 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1238 1244 better handle backslashes in paths. See the thread 'More Windows
1239 1245 questions part 2 - \/ characters revisited' on the iypthon user
1240 1246 list:
1241 1247 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1242 1248
1243 1249 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1244 1250
1245 1251 (InteractiveShell.__init__): change threaded shells to not use the
1246 1252 ipython crash handler. This was causing more problems than not,
1247 1253 as exceptions in the main thread (GUI code, typically) would
1248 1254 always show up as a 'crash', when they really weren't.
1249 1255
1250 1256 The colors and exception mode commands (%colors/%xmode) have been
1251 1257 synchronized to also take this into account, so users can get
1252 1258 verbose exceptions for their threaded code as well. I also added
1253 1259 support for activating pdb inside this exception handler as well,
1254 1260 so now GUI authors can use IPython's enhanced pdb at runtime.
1255 1261
1256 1262 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1257 1263 true by default, and add it to the shipped ipythonrc file. Since
1258 1264 this asks the user before proceeding, I think it's OK to make it
1259 1265 true by default.
1260 1266
1261 1267 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1262 1268 of the previous special-casing of input in the eval loop. I think
1263 1269 this is cleaner, as they really are commands and shouldn't have
1264 1270 a special role in the middle of the core code.
1265 1271
1266 1272 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1267 1273
1268 1274 * IPython/iplib.py (edit_syntax_error): added support for
1269 1275 automatically reopening the editor if the file had a syntax error
1270 1276 in it. Thanks to scottt who provided the patch at:
1271 1277 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1272 1278 version committed).
1273 1279
1274 1280 * IPython/iplib.py (handle_normal): add suport for multi-line
1275 1281 input with emtpy lines. This fixes
1276 1282 http://www.scipy.net/roundup/ipython/issue43 and a similar
1277 1283 discussion on the user list.
1278 1284
1279 1285 WARNING: a behavior change is necessarily introduced to support
1280 1286 blank lines: now a single blank line with whitespace does NOT
1281 1287 break the input loop, which means that when autoindent is on, by
1282 1288 default hitting return on the next (indented) line does NOT exit.
1283 1289
1284 1290 Instead, to exit a multiline input you can either have:
1285 1291
1286 1292 - TWO whitespace lines (just hit return again), or
1287 1293 - a single whitespace line of a different length than provided
1288 1294 by the autoindent (add or remove a space).
1289 1295
1290 1296 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1291 1297 module to better organize all readline-related functionality.
1292 1298 I've deleted FlexCompleter and put all completion clases here.
1293 1299
1294 1300 * IPython/iplib.py (raw_input): improve indentation management.
1295 1301 It is now possible to paste indented code with autoindent on, and
1296 1302 the code is interpreted correctly (though it still looks bad on
1297 1303 screen, due to the line-oriented nature of ipython).
1298 1304 (MagicCompleter.complete): change behavior so that a TAB key on an
1299 1305 otherwise empty line actually inserts a tab, instead of completing
1300 1306 on the entire global namespace. This makes it easier to use the
1301 1307 TAB key for indentation. After a request by Hans Meine
1302 1308 <hans_meine-AT-gmx.net>
1303 1309 (_prefilter): add support so that typing plain 'exit' or 'quit'
1304 1310 does a sensible thing. Originally I tried to deviate as little as
1305 1311 possible from the default python behavior, but even that one may
1306 1312 change in this direction (thread on python-dev to that effect).
1307 1313 Regardless, ipython should do the right thing even if CPython's
1308 1314 '>>>' prompt doesn't.
1309 1315 (InteractiveShell): removed subclassing code.InteractiveConsole
1310 1316 class. By now we'd overridden just about all of its methods: I've
1311 1317 copied the remaining two over, and now ipython is a standalone
1312 1318 class. This will provide a clearer picture for the chainsaw
1313 1319 branch refactoring.
1314 1320
1315 1321 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1316 1322
1317 1323 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1318 1324 failures for objects which break when dir() is called on them.
1319 1325
1320 1326 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1321 1327 distinct local and global namespaces in the completer API. This
1322 1328 change allows us to properly handle completion with distinct
1323 1329 scopes, including in embedded instances (this had never really
1324 1330 worked correctly).
1325 1331
1326 1332 Note: this introduces a change in the constructor for
1327 1333 MagicCompleter, as a new global_namespace parameter is now the
1328 1334 second argument (the others were bumped one position).
1329 1335
1330 1336 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1331 1337
1332 1338 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1333 1339 embedded instances (which can be done now thanks to Vivian's
1334 1340 frame-handling fixes for pdb).
1335 1341 (InteractiveShell.__init__): Fix namespace handling problem in
1336 1342 embedded instances. We were overwriting __main__ unconditionally,
1337 1343 and this should only be done for 'full' (non-embedded) IPython;
1338 1344 embedded instances must respect the caller's __main__. Thanks to
1339 1345 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1340 1346
1341 1347 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1342 1348
1343 1349 * setup.py: added download_url to setup(). This registers the
1344 1350 download address at PyPI, which is not only useful to humans
1345 1351 browsing the site, but is also picked up by setuptools (the Eggs
1346 1352 machinery). Thanks to Ville and R. Kern for the info/discussion
1347 1353 on this.
1348 1354
1349 1355 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1350 1356
1351 1357 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1352 1358 This brings a lot of nice functionality to the pdb mode, which now
1353 1359 has tab-completion, syntax highlighting, and better stack handling
1354 1360 than before. Many thanks to Vivian De Smedt
1355 1361 <vivian-AT-vdesmedt.com> for the original patches.
1356 1362
1357 1363 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1358 1364
1359 1365 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1360 1366 sequence to consistently accept the banner argument. The
1361 1367 inconsistency was tripping SAGE, thanks to Gary Zablackis
1362 1368 <gzabl-AT-yahoo.com> for the report.
1363 1369
1364 1370 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1365 1371
1366 1372 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1367 1373 Fix bug where a naked 'alias' call in the ipythonrc file would
1368 1374 cause a crash. Bug reported by Jorgen Stenarson.
1369 1375
1370 1376 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1371 1377
1372 1378 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1373 1379 startup time.
1374 1380
1375 1381 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1376 1382 instances had introduced a bug with globals in normal code. Now
1377 1383 it's working in all cases.
1378 1384
1379 1385 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1380 1386 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1381 1387 has been introduced to set the default case sensitivity of the
1382 1388 searches. Users can still select either mode at runtime on a
1383 1389 per-search basis.
1384 1390
1385 1391 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1386 1392
1387 1393 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1388 1394 attributes in wildcard searches for subclasses. Modified version
1389 1395 of a patch by Jorgen.
1390 1396
1391 1397 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1392 1398
1393 1399 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1394 1400 embedded instances. I added a user_global_ns attribute to the
1395 1401 InteractiveShell class to handle this.
1396 1402
1397 1403 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1398 1404
1399 1405 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1400 1406 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1401 1407 (reported under win32, but may happen also in other platforms).
1402 1408 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1403 1409
1404 1410 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1405 1411
1406 1412 * IPython/Magic.py (magic_psearch): new support for wildcard
1407 1413 patterns. Now, typing ?a*b will list all names which begin with a
1408 1414 and end in b, for example. The %psearch magic has full
1409 1415 docstrings. Many thanks to JΓΆrgen Stenarson
1410 1416 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1411 1417 implementing this functionality.
1412 1418
1413 1419 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1414 1420
1415 1421 * Manual: fixed long-standing annoyance of double-dashes (as in
1416 1422 --prefix=~, for example) being stripped in the HTML version. This
1417 1423 is a latex2html bug, but a workaround was provided. Many thanks
1418 1424 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1419 1425 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1420 1426 rolling. This seemingly small issue had tripped a number of users
1421 1427 when first installing, so I'm glad to see it gone.
1422 1428
1423 1429 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1424 1430
1425 1431 * IPython/Extensions/numeric_formats.py: fix missing import,
1426 1432 reported by Stephen Walton.
1427 1433
1428 1434 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1429 1435
1430 1436 * IPython/demo.py: finish demo module, fully documented now.
1431 1437
1432 1438 * IPython/genutils.py (file_read): simple little utility to read a
1433 1439 file and ensure it's closed afterwards.
1434 1440
1435 1441 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1436 1442
1437 1443 * IPython/demo.py (Demo.__init__): added support for individually
1438 1444 tagging blocks for automatic execution.
1439 1445
1440 1446 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1441 1447 syntax-highlighted python sources, requested by John.
1442 1448
1443 1449 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1444 1450
1445 1451 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1446 1452 finishing.
1447 1453
1448 1454 * IPython/genutils.py (shlex_split): moved from Magic to here,
1449 1455 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1450 1456
1451 1457 * IPython/demo.py (Demo.__init__): added support for silent
1452 1458 blocks, improved marks as regexps, docstrings written.
1453 1459 (Demo.__init__): better docstring, added support for sys.argv.
1454 1460
1455 1461 * IPython/genutils.py (marquee): little utility used by the demo
1456 1462 code, handy in general.
1457 1463
1458 1464 * IPython/demo.py (Demo.__init__): new class for interactive
1459 1465 demos. Not documented yet, I just wrote it in a hurry for
1460 1466 scipy'05. Will docstring later.
1461 1467
1462 1468 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1463 1469
1464 1470 * IPython/Shell.py (sigint_handler): Drastic simplification which
1465 1471 also seems to make Ctrl-C work correctly across threads! This is
1466 1472 so simple, that I can't beleive I'd missed it before. Needs more
1467 1473 testing, though.
1468 1474 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1469 1475 like this before...
1470 1476
1471 1477 * IPython/genutils.py (get_home_dir): add protection against
1472 1478 non-dirs in win32 registry.
1473 1479
1474 1480 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1475 1481 bug where dict was mutated while iterating (pysh crash).
1476 1482
1477 1483 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1478 1484
1479 1485 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1480 1486 spurious newlines added by this routine. After a report by
1481 1487 F. Mantegazza.
1482 1488
1483 1489 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1484 1490
1485 1491 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1486 1492 calls. These were a leftover from the GTK 1.x days, and can cause
1487 1493 problems in certain cases (after a report by John Hunter).
1488 1494
1489 1495 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1490 1496 os.getcwd() fails at init time. Thanks to patch from David Remahl
1491 1497 <chmod007-AT-mac.com>.
1492 1498 (InteractiveShell.__init__): prevent certain special magics from
1493 1499 being shadowed by aliases. Closes
1494 1500 http://www.scipy.net/roundup/ipython/issue41.
1495 1501
1496 1502 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1497 1503
1498 1504 * IPython/iplib.py (InteractiveShell.complete): Added new
1499 1505 top-level completion method to expose the completion mechanism
1500 1506 beyond readline-based environments.
1501 1507
1502 1508 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1503 1509
1504 1510 * tools/ipsvnc (svnversion): fix svnversion capture.
1505 1511
1506 1512 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1507 1513 attribute to self, which was missing. Before, it was set by a
1508 1514 routine which in certain cases wasn't being called, so the
1509 1515 instance could end up missing the attribute. This caused a crash.
1510 1516 Closes http://www.scipy.net/roundup/ipython/issue40.
1511 1517
1512 1518 2005-08-16 Fernando Perez <fperez@colorado.edu>
1513 1519
1514 1520 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1515 1521 contains non-string attribute. Closes
1516 1522 http://www.scipy.net/roundup/ipython/issue38.
1517 1523
1518 1524 2005-08-14 Fernando Perez <fperez@colorado.edu>
1519 1525
1520 1526 * tools/ipsvnc: Minor improvements, to add changeset info.
1521 1527
1522 1528 2005-08-12 Fernando Perez <fperez@colorado.edu>
1523 1529
1524 1530 * IPython/iplib.py (runsource): remove self.code_to_run_src
1525 1531 attribute. I realized this is nothing more than
1526 1532 '\n'.join(self.buffer), and having the same data in two different
1527 1533 places is just asking for synchronization bugs. This may impact
1528 1534 people who have custom exception handlers, so I need to warn
1529 1535 ipython-dev about it (F. Mantegazza may use them).
1530 1536
1531 1537 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1532 1538
1533 1539 * IPython/genutils.py: fix 2.2 compatibility (generators)
1534 1540
1535 1541 2005-07-18 Fernando Perez <fperez@colorado.edu>
1536 1542
1537 1543 * IPython/genutils.py (get_home_dir): fix to help users with
1538 1544 invalid $HOME under win32.
1539 1545
1540 1546 2005-07-17 Fernando Perez <fperez@colorado.edu>
1541 1547
1542 1548 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1543 1549 some old hacks and clean up a bit other routines; code should be
1544 1550 simpler and a bit faster.
1545 1551
1546 1552 * IPython/iplib.py (interact): removed some last-resort attempts
1547 1553 to survive broken stdout/stderr. That code was only making it
1548 1554 harder to abstract out the i/o (necessary for gui integration),
1549 1555 and the crashes it could prevent were extremely rare in practice
1550 1556 (besides being fully user-induced in a pretty violent manner).
1551 1557
1552 1558 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1553 1559 Nothing major yet, but the code is simpler to read; this should
1554 1560 make it easier to do more serious modifications in the future.
1555 1561
1556 1562 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1557 1563 which broke in .15 (thanks to a report by Ville).
1558 1564
1559 1565 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1560 1566 be quite correct, I know next to nothing about unicode). This
1561 1567 will allow unicode strings to be used in prompts, amongst other
1562 1568 cases. It also will prevent ipython from crashing when unicode
1563 1569 shows up unexpectedly in many places. If ascii encoding fails, we
1564 1570 assume utf_8. Currently the encoding is not a user-visible
1565 1571 setting, though it could be made so if there is demand for it.
1566 1572
1567 1573 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1568 1574
1569 1575 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1570 1576
1571 1577 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1572 1578
1573 1579 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1574 1580 code can work transparently for 2.2/2.3.
1575 1581
1576 1582 2005-07-16 Fernando Perez <fperez@colorado.edu>
1577 1583
1578 1584 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1579 1585 out of the color scheme table used for coloring exception
1580 1586 tracebacks. This allows user code to add new schemes at runtime.
1581 1587 This is a minimally modified version of the patch at
1582 1588 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1583 1589 for the contribution.
1584 1590
1585 1591 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1586 1592 slightly modified version of the patch in
1587 1593 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1588 1594 to remove the previous try/except solution (which was costlier).
1589 1595 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1590 1596
1591 1597 2005-06-08 Fernando Perez <fperez@colorado.edu>
1592 1598
1593 1599 * IPython/iplib.py (write/write_err): Add methods to abstract all
1594 1600 I/O a bit more.
1595 1601
1596 1602 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1597 1603 warning, reported by Aric Hagberg, fix by JD Hunter.
1598 1604
1599 1605 2005-06-02 *** Released version 0.6.15
1600 1606
1601 1607 2005-06-01 Fernando Perez <fperez@colorado.edu>
1602 1608
1603 1609 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1604 1610 tab-completion of filenames within open-quoted strings. Note that
1605 1611 this requires that in ~/.ipython/ipythonrc, users change the
1606 1612 readline delimiters configuration to read:
1607 1613
1608 1614 readline_remove_delims -/~
1609 1615
1610 1616
1611 1617 2005-05-31 *** Released version 0.6.14
1612 1618
1613 1619 2005-05-29 Fernando Perez <fperez@colorado.edu>
1614 1620
1615 1621 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1616 1622 with files not on the filesystem. Reported by Eliyahu Sandler
1617 1623 <eli@gondolin.net>
1618 1624
1619 1625 2005-05-22 Fernando Perez <fperez@colorado.edu>
1620 1626
1621 1627 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1622 1628 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1623 1629
1624 1630 2005-05-19 Fernando Perez <fperez@colorado.edu>
1625 1631
1626 1632 * IPython/iplib.py (safe_execfile): close a file which could be
1627 1633 left open (causing problems in win32, which locks open files).
1628 1634 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1629 1635
1630 1636 2005-05-18 Fernando Perez <fperez@colorado.edu>
1631 1637
1632 1638 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1633 1639 keyword arguments correctly to safe_execfile().
1634 1640
1635 1641 2005-05-13 Fernando Perez <fperez@colorado.edu>
1636 1642
1637 1643 * ipython.1: Added info about Qt to manpage, and threads warning
1638 1644 to usage page (invoked with --help).
1639 1645
1640 1646 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1641 1647 new matcher (it goes at the end of the priority list) to do
1642 1648 tab-completion on named function arguments. Submitted by George
1643 1649 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1644 1650 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1645 1651 for more details.
1646 1652
1647 1653 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1648 1654 SystemExit exceptions in the script being run. Thanks to a report
1649 1655 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1650 1656 producing very annoying behavior when running unit tests.
1651 1657
1652 1658 2005-05-12 Fernando Perez <fperez@colorado.edu>
1653 1659
1654 1660 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1655 1661 which I'd broken (again) due to a changed regexp. In the process,
1656 1662 added ';' as an escape to auto-quote the whole line without
1657 1663 splitting its arguments. Thanks to a report by Jerry McRae
1658 1664 <qrs0xyc02-AT-sneakemail.com>.
1659 1665
1660 1666 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1661 1667 possible crashes caused by a TokenError. Reported by Ed Schofield
1662 1668 <schofield-AT-ftw.at>.
1663 1669
1664 1670 2005-05-06 Fernando Perez <fperez@colorado.edu>
1665 1671
1666 1672 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1667 1673
1668 1674 2005-04-29 Fernando Perez <fperez@colorado.edu>
1669 1675
1670 1676 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1671 1677 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1672 1678 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1673 1679 which provides support for Qt interactive usage (similar to the
1674 1680 existing one for WX and GTK). This had been often requested.
1675 1681
1676 1682 2005-04-14 *** Released version 0.6.13
1677 1683
1678 1684 2005-04-08 Fernando Perez <fperez@colorado.edu>
1679 1685
1680 1686 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1681 1687 from _ofind, which gets called on almost every input line. Now,
1682 1688 we only try to get docstrings if they are actually going to be
1683 1689 used (the overhead of fetching unnecessary docstrings can be
1684 1690 noticeable for certain objects, such as Pyro proxies).
1685 1691
1686 1692 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1687 1693 for completers. For some reason I had been passing them the state
1688 1694 variable, which completers never actually need, and was in
1689 1695 conflict with the rlcompleter API. Custom completers ONLY need to
1690 1696 take the text parameter.
1691 1697
1692 1698 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1693 1699 work correctly in pysh. I've also moved all the logic which used
1694 1700 to be in pysh.py here, which will prevent problems with future
1695 1701 upgrades. However, this time I must warn users to update their
1696 1702 pysh profile to include the line
1697 1703
1698 1704 import_all IPython.Extensions.InterpreterExec
1699 1705
1700 1706 because otherwise things won't work for them. They MUST also
1701 1707 delete pysh.py and the line
1702 1708
1703 1709 execfile pysh.py
1704 1710
1705 1711 from their ipythonrc-pysh.
1706 1712
1707 1713 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1708 1714 robust in the face of objects whose dir() returns non-strings
1709 1715 (which it shouldn't, but some broken libs like ITK do). Thanks to
1710 1716 a patch by John Hunter (implemented differently, though). Also
1711 1717 minor improvements by using .extend instead of + on lists.
1712 1718
1713 1719 * pysh.py:
1714 1720
1715 1721 2005-04-06 Fernando Perez <fperez@colorado.edu>
1716 1722
1717 1723 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1718 1724 by default, so that all users benefit from it. Those who don't
1719 1725 want it can still turn it off.
1720 1726
1721 1727 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1722 1728 config file, I'd forgotten about this, so users were getting it
1723 1729 off by default.
1724 1730
1725 1731 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1726 1732 consistency. Now magics can be called in multiline statements,
1727 1733 and python variables can be expanded in magic calls via $var.
1728 1734 This makes the magic system behave just like aliases or !system
1729 1735 calls.
1730 1736
1731 1737 2005-03-28 Fernando Perez <fperez@colorado.edu>
1732 1738
1733 1739 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1734 1740 expensive string additions for building command. Add support for
1735 1741 trailing ';' when autocall is used.
1736 1742
1737 1743 2005-03-26 Fernando Perez <fperez@colorado.edu>
1738 1744
1739 1745 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1740 1746 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1741 1747 ipython.el robust against prompts with any number of spaces
1742 1748 (including 0) after the ':' character.
1743 1749
1744 1750 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1745 1751 continuation prompt, which misled users to think the line was
1746 1752 already indented. Closes debian Bug#300847, reported to me by
1747 1753 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1748 1754
1749 1755 2005-03-23 Fernando Perez <fperez@colorado.edu>
1750 1756
1751 1757 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1752 1758 properly aligned if they have embedded newlines.
1753 1759
1754 1760 * IPython/iplib.py (runlines): Add a public method to expose
1755 1761 IPython's code execution machinery, so that users can run strings
1756 1762 as if they had been typed at the prompt interactively.
1757 1763 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1758 1764 methods which can call the system shell, but with python variable
1759 1765 expansion. The three such methods are: __IPYTHON__.system,
1760 1766 .getoutput and .getoutputerror. These need to be documented in a
1761 1767 'public API' section (to be written) of the manual.
1762 1768
1763 1769 2005-03-20 Fernando Perez <fperez@colorado.edu>
1764 1770
1765 1771 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1766 1772 for custom exception handling. This is quite powerful, and it
1767 1773 allows for user-installable exception handlers which can trap
1768 1774 custom exceptions at runtime and treat them separately from
1769 1775 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1770 1776 Mantegazza <mantegazza-AT-ill.fr>.
1771 1777 (InteractiveShell.set_custom_completer): public API function to
1772 1778 add new completers at runtime.
1773 1779
1774 1780 2005-03-19 Fernando Perez <fperez@colorado.edu>
1775 1781
1776 1782 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1777 1783 allow objects which provide their docstrings via non-standard
1778 1784 mechanisms (like Pyro proxies) to still be inspected by ipython's
1779 1785 ? system.
1780 1786
1781 1787 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1782 1788 automatic capture system. I tried quite hard to make it work
1783 1789 reliably, and simply failed. I tried many combinations with the
1784 1790 subprocess module, but eventually nothing worked in all needed
1785 1791 cases (not blocking stdin for the child, duplicating stdout
1786 1792 without blocking, etc). The new %sc/%sx still do capture to these
1787 1793 magical list/string objects which make shell use much more
1788 1794 conveninent, so not all is lost.
1789 1795
1790 1796 XXX - FIX MANUAL for the change above!
1791 1797
1792 1798 (runsource): I copied code.py's runsource() into ipython to modify
1793 1799 it a bit. Now the code object and source to be executed are
1794 1800 stored in ipython. This makes this info accessible to third-party
1795 1801 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1796 1802 Mantegazza <mantegazza-AT-ill.fr>.
1797 1803
1798 1804 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1799 1805 history-search via readline (like C-p/C-n). I'd wanted this for a
1800 1806 long time, but only recently found out how to do it. For users
1801 1807 who already have their ipythonrc files made and want this, just
1802 1808 add:
1803 1809
1804 1810 readline_parse_and_bind "\e[A": history-search-backward
1805 1811 readline_parse_and_bind "\e[B": history-search-forward
1806 1812
1807 1813 2005-03-18 Fernando Perez <fperez@colorado.edu>
1808 1814
1809 1815 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1810 1816 LSString and SList classes which allow transparent conversions
1811 1817 between list mode and whitespace-separated string.
1812 1818 (magic_r): Fix recursion problem in %r.
1813 1819
1814 1820 * IPython/genutils.py (LSString): New class to be used for
1815 1821 automatic storage of the results of all alias/system calls in _o
1816 1822 and _e (stdout/err). These provide a .l/.list attribute which
1817 1823 does automatic splitting on newlines. This means that for most
1818 1824 uses, you'll never need to do capturing of output with %sc/%sx
1819 1825 anymore, since ipython keeps this always done for you. Note that
1820 1826 only the LAST results are stored, the _o/e variables are
1821 1827 overwritten on each call. If you need to save their contents
1822 1828 further, simply bind them to any other name.
1823 1829
1824 1830 2005-03-17 Fernando Perez <fperez@colorado.edu>
1825 1831
1826 1832 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1827 1833 prompt namespace handling.
1828 1834
1829 1835 2005-03-16 Fernando Perez <fperez@colorado.edu>
1830 1836
1831 1837 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1832 1838 classic prompts to be '>>> ' (final space was missing, and it
1833 1839 trips the emacs python mode).
1834 1840 (BasePrompt.__str__): Added safe support for dynamic prompt
1835 1841 strings. Now you can set your prompt string to be '$x', and the
1836 1842 value of x will be printed from your interactive namespace. The
1837 1843 interpolation syntax includes the full Itpl support, so
1838 1844 ${foo()+x+bar()} is a valid prompt string now, and the function
1839 1845 calls will be made at runtime.
1840 1846
1841 1847 2005-03-15 Fernando Perez <fperez@colorado.edu>
1842 1848
1843 1849 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1844 1850 avoid name clashes in pylab. %hist still works, it just forwards
1845 1851 the call to %history.
1846 1852
1847 1853 2005-03-02 *** Released version 0.6.12
1848 1854
1849 1855 2005-03-02 Fernando Perez <fperez@colorado.edu>
1850 1856
1851 1857 * IPython/iplib.py (handle_magic): log magic calls properly as
1852 1858 ipmagic() function calls.
1853 1859
1854 1860 * IPython/Magic.py (magic_time): Improved %time to support
1855 1861 statements and provide wall-clock as well as CPU time.
1856 1862
1857 1863 2005-02-27 Fernando Perez <fperez@colorado.edu>
1858 1864
1859 1865 * IPython/hooks.py: New hooks module, to expose user-modifiable
1860 1866 IPython functionality in a clean manner. For now only the editor
1861 1867 hook is actually written, and other thigns which I intend to turn
1862 1868 into proper hooks aren't yet there. The display and prefilter
1863 1869 stuff, for example, should be hooks. But at least now the
1864 1870 framework is in place, and the rest can be moved here with more
1865 1871 time later. IPython had had a .hooks variable for a long time for
1866 1872 this purpose, but I'd never actually used it for anything.
1867 1873
1868 1874 2005-02-26 Fernando Perez <fperez@colorado.edu>
1869 1875
1870 1876 * IPython/ipmaker.py (make_IPython): make the default ipython
1871 1877 directory be called _ipython under win32, to follow more the
1872 1878 naming peculiarities of that platform (where buggy software like
1873 1879 Visual Sourcesafe breaks with .named directories). Reported by
1874 1880 Ville Vainio.
1875 1881
1876 1882 2005-02-23 Fernando Perez <fperez@colorado.edu>
1877 1883
1878 1884 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1879 1885 auto_aliases for win32 which were causing problems. Users can
1880 1886 define the ones they personally like.
1881 1887
1882 1888 2005-02-21 Fernando Perez <fperez@colorado.edu>
1883 1889
1884 1890 * IPython/Magic.py (magic_time): new magic to time execution of
1885 1891 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1886 1892
1887 1893 2005-02-19 Fernando Perez <fperez@colorado.edu>
1888 1894
1889 1895 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1890 1896 into keys (for prompts, for example).
1891 1897
1892 1898 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1893 1899 prompts in case users want them. This introduces a small behavior
1894 1900 change: ipython does not automatically add a space to all prompts
1895 1901 anymore. To get the old prompts with a space, users should add it
1896 1902 manually to their ipythonrc file, so for example prompt_in1 should
1897 1903 now read 'In [\#]: ' instead of 'In [\#]:'.
1898 1904 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1899 1905 file) to control left-padding of secondary prompts.
1900 1906
1901 1907 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1902 1908 the profiler can't be imported. Fix for Debian, which removed
1903 1909 profile.py because of License issues. I applied a slightly
1904 1910 modified version of the original Debian patch at
1905 1911 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1906 1912
1907 1913 2005-02-17 Fernando Perez <fperez@colorado.edu>
1908 1914
1909 1915 * IPython/genutils.py (native_line_ends): Fix bug which would
1910 1916 cause improper line-ends under win32 b/c I was not opening files
1911 1917 in binary mode. Bug report and fix thanks to Ville.
1912 1918
1913 1919 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1914 1920 trying to catch spurious foo[1] autocalls. My fix actually broke
1915 1921 ',/' autoquote/call with explicit escape (bad regexp).
1916 1922
1917 1923 2005-02-15 *** Released version 0.6.11
1918 1924
1919 1925 2005-02-14 Fernando Perez <fperez@colorado.edu>
1920 1926
1921 1927 * IPython/background_jobs.py: New background job management
1922 1928 subsystem. This is implemented via a new set of classes, and
1923 1929 IPython now provides a builtin 'jobs' object for background job
1924 1930 execution. A convenience %bg magic serves as a lightweight
1925 1931 frontend for starting the more common type of calls. This was
1926 1932 inspired by discussions with B. Granger and the BackgroundCommand
1927 1933 class described in the book Python Scripting for Computational
1928 1934 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1929 1935 (although ultimately no code from this text was used, as IPython's
1930 1936 system is a separate implementation).
1931 1937
1932 1938 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1933 1939 to control the completion of single/double underscore names
1934 1940 separately. As documented in the example ipytonrc file, the
1935 1941 readline_omit__names variable can now be set to 2, to omit even
1936 1942 single underscore names. Thanks to a patch by Brian Wong
1937 1943 <BrianWong-AT-AirgoNetworks.Com>.
1938 1944 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1939 1945 be autocalled as foo([1]) if foo were callable. A problem for
1940 1946 things which are both callable and implement __getitem__.
1941 1947 (init_readline): Fix autoindentation for win32. Thanks to a patch
1942 1948 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1943 1949
1944 1950 2005-02-12 Fernando Perez <fperez@colorado.edu>
1945 1951
1946 1952 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1947 1953 which I had written long ago to sort out user error messages which
1948 1954 may occur during startup. This seemed like a good idea initially,
1949 1955 but it has proven a disaster in retrospect. I don't want to
1950 1956 change much code for now, so my fix is to set the internal 'debug'
1951 1957 flag to true everywhere, whose only job was precisely to control
1952 1958 this subsystem. This closes issue 28 (as well as avoiding all
1953 1959 sorts of strange hangups which occur from time to time).
1954 1960
1955 1961 2005-02-07 Fernando Perez <fperez@colorado.edu>
1956 1962
1957 1963 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1958 1964 previous call produced a syntax error.
1959 1965
1960 1966 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1961 1967 classes without constructor.
1962 1968
1963 1969 2005-02-06 Fernando Perez <fperez@colorado.edu>
1964 1970
1965 1971 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1966 1972 completions with the results of each matcher, so we return results
1967 1973 to the user from all namespaces. This breaks with ipython
1968 1974 tradition, but I think it's a nicer behavior. Now you get all
1969 1975 possible completions listed, from all possible namespaces (python,
1970 1976 filesystem, magics...) After a request by John Hunter
1971 1977 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1972 1978
1973 1979 2005-02-05 Fernando Perez <fperez@colorado.edu>
1974 1980
1975 1981 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1976 1982 the call had quote characters in it (the quotes were stripped).
1977 1983
1978 1984 2005-01-31 Fernando Perez <fperez@colorado.edu>
1979 1985
1980 1986 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1981 1987 Itpl.itpl() to make the code more robust against psyco
1982 1988 optimizations.
1983 1989
1984 1990 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1985 1991 of causing an exception. Quicker, cleaner.
1986 1992
1987 1993 2005-01-28 Fernando Perez <fperez@colorado.edu>
1988 1994
1989 1995 * scripts/ipython_win_post_install.py (install): hardcode
1990 1996 sys.prefix+'python.exe' as the executable path. It turns out that
1991 1997 during the post-installation run, sys.executable resolves to the
1992 1998 name of the binary installer! I should report this as a distutils
1993 1999 bug, I think. I updated the .10 release with this tiny fix, to
1994 2000 avoid annoying the lists further.
1995 2001
1996 2002 2005-01-27 *** Released version 0.6.10
1997 2003
1998 2004 2005-01-27 Fernando Perez <fperez@colorado.edu>
1999 2005
2000 2006 * IPython/numutils.py (norm): Added 'inf' as optional name for
2001 2007 L-infinity norm, included references to mathworld.com for vector
2002 2008 norm definitions.
2003 2009 (amin/amax): added amin/amax for array min/max. Similar to what
2004 2010 pylab ships with after the recent reorganization of names.
2005 2011 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2006 2012
2007 2013 * ipython.el: committed Alex's recent fixes and improvements.
2008 2014 Tested with python-mode from CVS, and it looks excellent. Since
2009 2015 python-mode hasn't released anything in a while, I'm temporarily
2010 2016 putting a copy of today's CVS (v 4.70) of python-mode in:
2011 2017 http://ipython.scipy.org/tmp/python-mode.el
2012 2018
2013 2019 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2014 2020 sys.executable for the executable name, instead of assuming it's
2015 2021 called 'python.exe' (the post-installer would have produced broken
2016 2022 setups on systems with a differently named python binary).
2017 2023
2018 2024 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2019 2025 references to os.linesep, to make the code more
2020 2026 platform-independent. This is also part of the win32 coloring
2021 2027 fixes.
2022 2028
2023 2029 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2024 2030 lines, which actually cause coloring bugs because the length of
2025 2031 the line is very difficult to correctly compute with embedded
2026 2032 escapes. This was the source of all the coloring problems under
2027 2033 Win32. I think that _finally_, Win32 users have a properly
2028 2034 working ipython in all respects. This would never have happened
2029 2035 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2030 2036
2031 2037 2005-01-26 *** Released version 0.6.9
2032 2038
2033 2039 2005-01-25 Fernando Perez <fperez@colorado.edu>
2034 2040
2035 2041 * setup.py: finally, we have a true Windows installer, thanks to
2036 2042 the excellent work of Viktor Ransmayr
2037 2043 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2038 2044 Windows users. The setup routine is quite a bit cleaner thanks to
2039 2045 this, and the post-install script uses the proper functions to
2040 2046 allow a clean de-installation using the standard Windows Control
2041 2047 Panel.
2042 2048
2043 2049 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2044 2050 environment variable under all OSes (including win32) if
2045 2051 available. This will give consistency to win32 users who have set
2046 2052 this variable for any reason. If os.environ['HOME'] fails, the
2047 2053 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2048 2054
2049 2055 2005-01-24 Fernando Perez <fperez@colorado.edu>
2050 2056
2051 2057 * IPython/numutils.py (empty_like): add empty_like(), similar to
2052 2058 zeros_like() but taking advantage of the new empty() Numeric routine.
2053 2059
2054 2060 2005-01-23 *** Released version 0.6.8
2055 2061
2056 2062 2005-01-22 Fernando Perez <fperez@colorado.edu>
2057 2063
2058 2064 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2059 2065 automatic show() calls. After discussing things with JDH, it
2060 2066 turns out there are too many corner cases where this can go wrong.
2061 2067 It's best not to try to be 'too smart', and simply have ipython
2062 2068 reproduce as much as possible the default behavior of a normal
2063 2069 python shell.
2064 2070
2065 2071 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2066 2072 line-splitting regexp and _prefilter() to avoid calling getattr()
2067 2073 on assignments. This closes
2068 2074 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2069 2075 readline uses getattr(), so a simple <TAB> keypress is still
2070 2076 enough to trigger getattr() calls on an object.
2071 2077
2072 2078 2005-01-21 Fernando Perez <fperez@colorado.edu>
2073 2079
2074 2080 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2075 2081 docstring under pylab so it doesn't mask the original.
2076 2082
2077 2083 2005-01-21 *** Released version 0.6.7
2078 2084
2079 2085 2005-01-21 Fernando Perez <fperez@colorado.edu>
2080 2086
2081 2087 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2082 2088 signal handling for win32 users in multithreaded mode.
2083 2089
2084 2090 2005-01-17 Fernando Perez <fperez@colorado.edu>
2085 2091
2086 2092 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2087 2093 instances with no __init__. After a crash report by Norbert Nemec
2088 2094 <Norbert-AT-nemec-online.de>.
2089 2095
2090 2096 2005-01-14 Fernando Perez <fperez@colorado.edu>
2091 2097
2092 2098 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2093 2099 names for verbose exceptions, when multiple dotted names and the
2094 2100 'parent' object were present on the same line.
2095 2101
2096 2102 2005-01-11 Fernando Perez <fperez@colorado.edu>
2097 2103
2098 2104 * IPython/genutils.py (flag_calls): new utility to trap and flag
2099 2105 calls in functions. I need it to clean up matplotlib support.
2100 2106 Also removed some deprecated code in genutils.
2101 2107
2102 2108 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2103 2109 that matplotlib scripts called with %run, which don't call show()
2104 2110 themselves, still have their plotting windows open.
2105 2111
2106 2112 2005-01-05 Fernando Perez <fperez@colorado.edu>
2107 2113
2108 2114 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2109 2115 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2110 2116
2111 2117 2004-12-19 Fernando Perez <fperez@colorado.edu>
2112 2118
2113 2119 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2114 2120 parent_runcode, which was an eyesore. The same result can be
2115 2121 obtained with Python's regular superclass mechanisms.
2116 2122
2117 2123 2004-12-17 Fernando Perez <fperez@colorado.edu>
2118 2124
2119 2125 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2120 2126 reported by Prabhu.
2121 2127 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2122 2128 sys.stderr) instead of explicitly calling sys.stderr. This helps
2123 2129 maintain our I/O abstractions clean, for future GUI embeddings.
2124 2130
2125 2131 * IPython/genutils.py (info): added new utility for sys.stderr
2126 2132 unified info message handling (thin wrapper around warn()).
2127 2133
2128 2134 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2129 2135 composite (dotted) names on verbose exceptions.
2130 2136 (VerboseTB.nullrepr): harden against another kind of errors which
2131 2137 Python's inspect module can trigger, and which were crashing
2132 2138 IPython. Thanks to a report by Marco Lombardi
2133 2139 <mlombard-AT-ma010192.hq.eso.org>.
2134 2140
2135 2141 2004-12-13 *** Released version 0.6.6
2136 2142
2137 2143 2004-12-12 Fernando Perez <fperez@colorado.edu>
2138 2144
2139 2145 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2140 2146 generated by pygtk upon initialization if it was built without
2141 2147 threads (for matplotlib users). After a crash reported by
2142 2148 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2143 2149
2144 2150 * IPython/ipmaker.py (make_IPython): fix small bug in the
2145 2151 import_some parameter for multiple imports.
2146 2152
2147 2153 * IPython/iplib.py (ipmagic): simplified the interface of
2148 2154 ipmagic() to take a single string argument, just as it would be
2149 2155 typed at the IPython cmd line.
2150 2156 (ipalias): Added new ipalias() with an interface identical to
2151 2157 ipmagic(). This completes exposing a pure python interface to the
2152 2158 alias and magic system, which can be used in loops or more complex
2153 2159 code where IPython's automatic line mangling is not active.
2154 2160
2155 2161 * IPython/genutils.py (timing): changed interface of timing to
2156 2162 simply run code once, which is the most common case. timings()
2157 2163 remains unchanged, for the cases where you want multiple runs.
2158 2164
2159 2165 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2160 2166 bug where Python2.2 crashes with exec'ing code which does not end
2161 2167 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2162 2168 before.
2163 2169
2164 2170 2004-12-10 Fernando Perez <fperez@colorado.edu>
2165 2171
2166 2172 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2167 2173 -t to -T, to accomodate the new -t flag in %run (the %run and
2168 2174 %prun options are kind of intermixed, and it's not easy to change
2169 2175 this with the limitations of python's getopt).
2170 2176
2171 2177 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2172 2178 the execution of scripts. It's not as fine-tuned as timeit.py,
2173 2179 but it works from inside ipython (and under 2.2, which lacks
2174 2180 timeit.py). Optionally a number of runs > 1 can be given for
2175 2181 timing very short-running code.
2176 2182
2177 2183 * IPython/genutils.py (uniq_stable): new routine which returns a
2178 2184 list of unique elements in any iterable, but in stable order of
2179 2185 appearance. I needed this for the ultraTB fixes, and it's a handy
2180 2186 utility.
2181 2187
2182 2188 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2183 2189 dotted names in Verbose exceptions. This had been broken since
2184 2190 the very start, now x.y will properly be printed in a Verbose
2185 2191 traceback, instead of x being shown and y appearing always as an
2186 2192 'undefined global'. Getting this to work was a bit tricky,
2187 2193 because by default python tokenizers are stateless. Saved by
2188 2194 python's ability to easily add a bit of state to an arbitrary
2189 2195 function (without needing to build a full-blown callable object).
2190 2196
2191 2197 Also big cleanup of this code, which had horrendous runtime
2192 2198 lookups of zillions of attributes for colorization. Moved all
2193 2199 this code into a few templates, which make it cleaner and quicker.
2194 2200
2195 2201 Printout quality was also improved for Verbose exceptions: one
2196 2202 variable per line, and memory addresses are printed (this can be
2197 2203 quite handy in nasty debugging situations, which is what Verbose
2198 2204 is for).
2199 2205
2200 2206 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2201 2207 the command line as scripts to be loaded by embedded instances.
2202 2208 Doing so has the potential for an infinite recursion if there are
2203 2209 exceptions thrown in the process. This fixes a strange crash
2204 2210 reported by Philippe MULLER <muller-AT-irit.fr>.
2205 2211
2206 2212 2004-12-09 Fernando Perez <fperez@colorado.edu>
2207 2213
2208 2214 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2209 2215 to reflect new names in matplotlib, which now expose the
2210 2216 matlab-compatible interface via a pylab module instead of the
2211 2217 'matlab' name. The new code is backwards compatible, so users of
2212 2218 all matplotlib versions are OK. Patch by J. Hunter.
2213 2219
2214 2220 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2215 2221 of __init__ docstrings for instances (class docstrings are already
2216 2222 automatically printed). Instances with customized docstrings
2217 2223 (indep. of the class) are also recognized and all 3 separate
2218 2224 docstrings are printed (instance, class, constructor). After some
2219 2225 comments/suggestions by J. Hunter.
2220 2226
2221 2227 2004-12-05 Fernando Perez <fperez@colorado.edu>
2222 2228
2223 2229 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2224 2230 warnings when tab-completion fails and triggers an exception.
2225 2231
2226 2232 2004-12-03 Fernando Perez <fperez@colorado.edu>
2227 2233
2228 2234 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2229 2235 be triggered when using 'run -p'. An incorrect option flag was
2230 2236 being set ('d' instead of 'D').
2231 2237 (manpage): fix missing escaped \- sign.
2232 2238
2233 2239 2004-11-30 *** Released version 0.6.5
2234 2240
2235 2241 2004-11-30 Fernando Perez <fperez@colorado.edu>
2236 2242
2237 2243 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2238 2244 setting with -d option.
2239 2245
2240 2246 * setup.py (docfiles): Fix problem where the doc glob I was using
2241 2247 was COMPLETELY BROKEN. It was giving the right files by pure
2242 2248 accident, but failed once I tried to include ipython.el. Note:
2243 2249 glob() does NOT allow you to do exclusion on multiple endings!
2244 2250
2245 2251 2004-11-29 Fernando Perez <fperez@colorado.edu>
2246 2252
2247 2253 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2248 2254 the manpage as the source. Better formatting & consistency.
2249 2255
2250 2256 * IPython/Magic.py (magic_run): Added new -d option, to run
2251 2257 scripts under the control of the python pdb debugger. Note that
2252 2258 this required changing the %prun option -d to -D, to avoid a clash
2253 2259 (since %run must pass options to %prun, and getopt is too dumb to
2254 2260 handle options with string values with embedded spaces). Thanks
2255 2261 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2256 2262 (magic_who_ls): added type matching to %who and %whos, so that one
2257 2263 can filter their output to only include variables of certain
2258 2264 types. Another suggestion by Matthew.
2259 2265 (magic_whos): Added memory summaries in kb and Mb for arrays.
2260 2266 (magic_who): Improve formatting (break lines every 9 vars).
2261 2267
2262 2268 2004-11-28 Fernando Perez <fperez@colorado.edu>
2263 2269
2264 2270 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2265 2271 cache when empty lines were present.
2266 2272
2267 2273 2004-11-24 Fernando Perez <fperez@colorado.edu>
2268 2274
2269 2275 * IPython/usage.py (__doc__): document the re-activated threading
2270 2276 options for WX and GTK.
2271 2277
2272 2278 2004-11-23 Fernando Perez <fperez@colorado.edu>
2273 2279
2274 2280 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2275 2281 the -wthread and -gthread options, along with a new -tk one to try
2276 2282 and coordinate Tk threading with wx/gtk. The tk support is very
2277 2283 platform dependent, since it seems to require Tcl and Tk to be
2278 2284 built with threads (Fedora1/2 appears NOT to have it, but in
2279 2285 Prabhu's Debian boxes it works OK). But even with some Tk
2280 2286 limitations, this is a great improvement.
2281 2287
2282 2288 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2283 2289 info in user prompts. Patch by Prabhu.
2284 2290
2285 2291 2004-11-18 Fernando Perez <fperez@colorado.edu>
2286 2292
2287 2293 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2288 2294 EOFErrors and bail, to avoid infinite loops if a non-terminating
2289 2295 file is fed into ipython. Patch submitted in issue 19 by user,
2290 2296 many thanks.
2291 2297
2292 2298 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2293 2299 autoquote/parens in continuation prompts, which can cause lots of
2294 2300 problems. Closes roundup issue 20.
2295 2301
2296 2302 2004-11-17 Fernando Perez <fperez@colorado.edu>
2297 2303
2298 2304 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2299 2305 reported as debian bug #280505. I'm not sure my local changelog
2300 2306 entry has the proper debian format (Jack?).
2301 2307
2302 2308 2004-11-08 *** Released version 0.6.4
2303 2309
2304 2310 2004-11-08 Fernando Perez <fperez@colorado.edu>
2305 2311
2306 2312 * IPython/iplib.py (init_readline): Fix exit message for Windows
2307 2313 when readline is active. Thanks to a report by Eric Jones
2308 2314 <eric-AT-enthought.com>.
2309 2315
2310 2316 2004-11-07 Fernando Perez <fperez@colorado.edu>
2311 2317
2312 2318 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2313 2319 sometimes seen by win2k/cygwin users.
2314 2320
2315 2321 2004-11-06 Fernando Perez <fperez@colorado.edu>
2316 2322
2317 2323 * IPython/iplib.py (interact): Change the handling of %Exit from
2318 2324 trying to propagate a SystemExit to an internal ipython flag.
2319 2325 This is less elegant than using Python's exception mechanism, but
2320 2326 I can't get that to work reliably with threads, so under -pylab
2321 2327 %Exit was hanging IPython. Cross-thread exception handling is
2322 2328 really a bitch. Thaks to a bug report by Stephen Walton
2323 2329 <stephen.walton-AT-csun.edu>.
2324 2330
2325 2331 2004-11-04 Fernando Perez <fperez@colorado.edu>
2326 2332
2327 2333 * IPython/iplib.py (raw_input_original): store a pointer to the
2328 2334 true raw_input to harden against code which can modify it
2329 2335 (wx.py.PyShell does this and would otherwise crash ipython).
2330 2336 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2331 2337
2332 2338 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2333 2339 Ctrl-C problem, which does not mess up the input line.
2334 2340
2335 2341 2004-11-03 Fernando Perez <fperez@colorado.edu>
2336 2342
2337 2343 * IPython/Release.py: Changed licensing to BSD, in all files.
2338 2344 (name): lowercase name for tarball/RPM release.
2339 2345
2340 2346 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2341 2347 use throughout ipython.
2342 2348
2343 2349 * IPython/Magic.py (Magic._ofind): Switch to using the new
2344 2350 OInspect.getdoc() function.
2345 2351
2346 2352 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2347 2353 of the line currently being canceled via Ctrl-C. It's extremely
2348 2354 ugly, but I don't know how to do it better (the problem is one of
2349 2355 handling cross-thread exceptions).
2350 2356
2351 2357 2004-10-28 Fernando Perez <fperez@colorado.edu>
2352 2358
2353 2359 * IPython/Shell.py (signal_handler): add signal handlers to trap
2354 2360 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2355 2361 report by Francesc Alted.
2356 2362
2357 2363 2004-10-21 Fernando Perez <fperez@colorado.edu>
2358 2364
2359 2365 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2360 2366 to % for pysh syntax extensions.
2361 2367
2362 2368 2004-10-09 Fernando Perez <fperez@colorado.edu>
2363 2369
2364 2370 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2365 2371 arrays to print a more useful summary, without calling str(arr).
2366 2372 This avoids the problem of extremely lengthy computations which
2367 2373 occur if arr is large, and appear to the user as a system lockup
2368 2374 with 100% cpu activity. After a suggestion by Kristian Sandberg
2369 2375 <Kristian.Sandberg@colorado.edu>.
2370 2376 (Magic.__init__): fix bug in global magic escapes not being
2371 2377 correctly set.
2372 2378
2373 2379 2004-10-08 Fernando Perez <fperez@colorado.edu>
2374 2380
2375 2381 * IPython/Magic.py (__license__): change to absolute imports of
2376 2382 ipython's own internal packages, to start adapting to the absolute
2377 2383 import requirement of PEP-328.
2378 2384
2379 2385 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2380 2386 files, and standardize author/license marks through the Release
2381 2387 module instead of having per/file stuff (except for files with
2382 2388 particular licenses, like the MIT/PSF-licensed codes).
2383 2389
2384 2390 * IPython/Debugger.py: remove dead code for python 2.1
2385 2391
2386 2392 2004-10-04 Fernando Perez <fperez@colorado.edu>
2387 2393
2388 2394 * IPython/iplib.py (ipmagic): New function for accessing magics
2389 2395 via a normal python function call.
2390 2396
2391 2397 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2392 2398 from '@' to '%', to accomodate the new @decorator syntax of python
2393 2399 2.4.
2394 2400
2395 2401 2004-09-29 Fernando Perez <fperez@colorado.edu>
2396 2402
2397 2403 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2398 2404 matplotlib.use to prevent running scripts which try to switch
2399 2405 interactive backends from within ipython. This will just crash
2400 2406 the python interpreter, so we can't allow it (but a detailed error
2401 2407 is given to the user).
2402 2408
2403 2409 2004-09-28 Fernando Perez <fperez@colorado.edu>
2404 2410
2405 2411 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2406 2412 matplotlib-related fixes so that using @run with non-matplotlib
2407 2413 scripts doesn't pop up spurious plot windows. This requires
2408 2414 matplotlib >= 0.63, where I had to make some changes as well.
2409 2415
2410 2416 * IPython/ipmaker.py (make_IPython): update version requirement to
2411 2417 python 2.2.
2412 2418
2413 2419 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2414 2420 banner arg for embedded customization.
2415 2421
2416 2422 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2417 2423 explicit uses of __IP as the IPython's instance name. Now things
2418 2424 are properly handled via the shell.name value. The actual code
2419 2425 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2420 2426 is much better than before. I'll clean things completely when the
2421 2427 magic stuff gets a real overhaul.
2422 2428
2423 2429 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2424 2430 minor changes to debian dir.
2425 2431
2426 2432 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2427 2433 pointer to the shell itself in the interactive namespace even when
2428 2434 a user-supplied dict is provided. This is needed for embedding
2429 2435 purposes (found by tests with Michel Sanner).
2430 2436
2431 2437 2004-09-27 Fernando Perez <fperez@colorado.edu>
2432 2438
2433 2439 * IPython/UserConfig/ipythonrc: remove []{} from
2434 2440 readline_remove_delims, so that things like [modname.<TAB> do
2435 2441 proper completion. This disables [].TAB, but that's a less common
2436 2442 case than module names in list comprehensions, for example.
2437 2443 Thanks to a report by Andrea Riciputi.
2438 2444
2439 2445 2004-09-09 Fernando Perez <fperez@colorado.edu>
2440 2446
2441 2447 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2442 2448 blocking problems in win32 and osx. Fix by John.
2443 2449
2444 2450 2004-09-08 Fernando Perez <fperez@colorado.edu>
2445 2451
2446 2452 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2447 2453 for Win32 and OSX. Fix by John Hunter.
2448 2454
2449 2455 2004-08-30 *** Released version 0.6.3
2450 2456
2451 2457 2004-08-30 Fernando Perez <fperez@colorado.edu>
2452 2458
2453 2459 * setup.py (isfile): Add manpages to list of dependent files to be
2454 2460 updated.
2455 2461
2456 2462 2004-08-27 Fernando Perez <fperez@colorado.edu>
2457 2463
2458 2464 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2459 2465 for now. They don't really work with standalone WX/GTK code
2460 2466 (though matplotlib IS working fine with both of those backends).
2461 2467 This will neeed much more testing. I disabled most things with
2462 2468 comments, so turning it back on later should be pretty easy.
2463 2469
2464 2470 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2465 2471 autocalling of expressions like r'foo', by modifying the line
2466 2472 split regexp. Closes
2467 2473 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2468 2474 Riley <ipythonbugs-AT-sabi.net>.
2469 2475 (InteractiveShell.mainloop): honor --nobanner with banner
2470 2476 extensions.
2471 2477
2472 2478 * IPython/Shell.py: Significant refactoring of all classes, so
2473 2479 that we can really support ALL matplotlib backends and threading
2474 2480 models (John spotted a bug with Tk which required this). Now we
2475 2481 should support single-threaded, WX-threads and GTK-threads, both
2476 2482 for generic code and for matplotlib.
2477 2483
2478 2484 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2479 2485 -pylab, to simplify things for users. Will also remove the pylab
2480 2486 profile, since now all of matplotlib configuration is directly
2481 2487 handled here. This also reduces startup time.
2482 2488
2483 2489 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2484 2490 shell wasn't being correctly called. Also in IPShellWX.
2485 2491
2486 2492 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2487 2493 fine-tune banner.
2488 2494
2489 2495 * IPython/numutils.py (spike): Deprecate these spike functions,
2490 2496 delete (long deprecated) gnuplot_exec handler.
2491 2497
2492 2498 2004-08-26 Fernando Perez <fperez@colorado.edu>
2493 2499
2494 2500 * ipython.1: Update for threading options, plus some others which
2495 2501 were missing.
2496 2502
2497 2503 * IPython/ipmaker.py (__call__): Added -wthread option for
2498 2504 wxpython thread handling. Make sure threading options are only
2499 2505 valid at the command line.
2500 2506
2501 2507 * scripts/ipython: moved shell selection into a factory function
2502 2508 in Shell.py, to keep the starter script to a minimum.
2503 2509
2504 2510 2004-08-25 Fernando Perez <fperez@colorado.edu>
2505 2511
2506 2512 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2507 2513 John. Along with some recent changes he made to matplotlib, the
2508 2514 next versions of both systems should work very well together.
2509 2515
2510 2516 2004-08-24 Fernando Perez <fperez@colorado.edu>
2511 2517
2512 2518 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2513 2519 tried to switch the profiling to using hotshot, but I'm getting
2514 2520 strange errors from prof.runctx() there. I may be misreading the
2515 2521 docs, but it looks weird. For now the profiling code will
2516 2522 continue to use the standard profiler.
2517 2523
2518 2524 2004-08-23 Fernando Perez <fperez@colorado.edu>
2519 2525
2520 2526 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2521 2527 threaded shell, by John Hunter. It's not quite ready yet, but
2522 2528 close.
2523 2529
2524 2530 2004-08-22 Fernando Perez <fperez@colorado.edu>
2525 2531
2526 2532 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2527 2533 in Magic and ultraTB.
2528 2534
2529 2535 * ipython.1: document threading options in manpage.
2530 2536
2531 2537 * scripts/ipython: Changed name of -thread option to -gthread,
2532 2538 since this is GTK specific. I want to leave the door open for a
2533 2539 -wthread option for WX, which will most likely be necessary. This
2534 2540 change affects usage and ipmaker as well.
2535 2541
2536 2542 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2537 2543 handle the matplotlib shell issues. Code by John Hunter
2538 2544 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2539 2545 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2540 2546 broken (and disabled for end users) for now, but it puts the
2541 2547 infrastructure in place.
2542 2548
2543 2549 2004-08-21 Fernando Perez <fperez@colorado.edu>
2544 2550
2545 2551 * ipythonrc-pylab: Add matplotlib support.
2546 2552
2547 2553 * matplotlib_config.py: new files for matplotlib support, part of
2548 2554 the pylab profile.
2549 2555
2550 2556 * IPython/usage.py (__doc__): documented the threading options.
2551 2557
2552 2558 2004-08-20 Fernando Perez <fperez@colorado.edu>
2553 2559
2554 2560 * ipython: Modified the main calling routine to handle the -thread
2555 2561 and -mpthread options. This needs to be done as a top-level hack,
2556 2562 because it determines which class to instantiate for IPython
2557 2563 itself.
2558 2564
2559 2565 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2560 2566 classes to support multithreaded GTK operation without blocking,
2561 2567 and matplotlib with all backends. This is a lot of still very
2562 2568 experimental code, and threads are tricky. So it may still have a
2563 2569 few rough edges... This code owes a lot to
2564 2570 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2565 2571 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2566 2572 to John Hunter for all the matplotlib work.
2567 2573
2568 2574 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2569 2575 options for gtk thread and matplotlib support.
2570 2576
2571 2577 2004-08-16 Fernando Perez <fperez@colorado.edu>
2572 2578
2573 2579 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2574 2580 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2575 2581 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2576 2582
2577 2583 2004-08-11 Fernando Perez <fperez@colorado.edu>
2578 2584
2579 2585 * setup.py (isfile): Fix build so documentation gets updated for
2580 2586 rpms (it was only done for .tgz builds).
2581 2587
2582 2588 2004-08-10 Fernando Perez <fperez@colorado.edu>
2583 2589
2584 2590 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2585 2591
2586 2592 * iplib.py : Silence syntax error exceptions in tab-completion.
2587 2593
2588 2594 2004-08-05 Fernando Perez <fperez@colorado.edu>
2589 2595
2590 2596 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2591 2597 'color off' mark for continuation prompts. This was causing long
2592 2598 continuation lines to mis-wrap.
2593 2599
2594 2600 2004-08-01 Fernando Perez <fperez@colorado.edu>
2595 2601
2596 2602 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2597 2603 for building ipython to be a parameter. All this is necessary
2598 2604 right now to have a multithreaded version, but this insane
2599 2605 non-design will be cleaned up soon. For now, it's a hack that
2600 2606 works.
2601 2607
2602 2608 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2603 2609 args in various places. No bugs so far, but it's a dangerous
2604 2610 practice.
2605 2611
2606 2612 2004-07-31 Fernando Perez <fperez@colorado.edu>
2607 2613
2608 2614 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2609 2615 fix completion of files with dots in their names under most
2610 2616 profiles (pysh was OK because the completion order is different).
2611 2617
2612 2618 2004-07-27 Fernando Perez <fperez@colorado.edu>
2613 2619
2614 2620 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2615 2621 keywords manually, b/c the one in keyword.py was removed in python
2616 2622 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2617 2623 This is NOT a bug under python 2.3 and earlier.
2618 2624
2619 2625 2004-07-26 Fernando Perez <fperez@colorado.edu>
2620 2626
2621 2627 * IPython/ultraTB.py (VerboseTB.text): Add another
2622 2628 linecache.checkcache() call to try to prevent inspect.py from
2623 2629 crashing under python 2.3. I think this fixes
2624 2630 http://www.scipy.net/roundup/ipython/issue17.
2625 2631
2626 2632 2004-07-26 *** Released version 0.6.2
2627 2633
2628 2634 2004-07-26 Fernando Perez <fperez@colorado.edu>
2629 2635
2630 2636 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2631 2637 fail for any number.
2632 2638 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2633 2639 empty bookmarks.
2634 2640
2635 2641 2004-07-26 *** Released version 0.6.1
2636 2642
2637 2643 2004-07-26 Fernando Perez <fperez@colorado.edu>
2638 2644
2639 2645 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2640 2646
2641 2647 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2642 2648 escaping '()[]{}' in filenames.
2643 2649
2644 2650 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2645 2651 Python 2.2 users who lack a proper shlex.split.
2646 2652
2647 2653 2004-07-19 Fernando Perez <fperez@colorado.edu>
2648 2654
2649 2655 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2650 2656 for reading readline's init file. I follow the normal chain:
2651 2657 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2652 2658 report by Mike Heeter. This closes
2653 2659 http://www.scipy.net/roundup/ipython/issue16.
2654 2660
2655 2661 2004-07-18 Fernando Perez <fperez@colorado.edu>
2656 2662
2657 2663 * IPython/iplib.py (__init__): Add better handling of '\' under
2658 2664 Win32 for filenames. After a patch by Ville.
2659 2665
2660 2666 2004-07-17 Fernando Perez <fperez@colorado.edu>
2661 2667
2662 2668 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2663 2669 autocalling would be triggered for 'foo is bar' if foo is
2664 2670 callable. I also cleaned up the autocall detection code to use a
2665 2671 regexp, which is faster. Bug reported by Alexander Schmolck.
2666 2672
2667 2673 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2668 2674 '?' in them would confuse the help system. Reported by Alex
2669 2675 Schmolck.
2670 2676
2671 2677 2004-07-16 Fernando Perez <fperez@colorado.edu>
2672 2678
2673 2679 * IPython/GnuplotInteractive.py (__all__): added plot2.
2674 2680
2675 2681 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2676 2682 plotting dictionaries, lists or tuples of 1d arrays.
2677 2683
2678 2684 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2679 2685 optimizations.
2680 2686
2681 2687 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2682 2688 the information which was there from Janko's original IPP code:
2683 2689
2684 2690 03.05.99 20:53 porto.ifm.uni-kiel.de
2685 2691 --Started changelog.
2686 2692 --make clear do what it say it does
2687 2693 --added pretty output of lines from inputcache
2688 2694 --Made Logger a mixin class, simplifies handling of switches
2689 2695 --Added own completer class. .string<TAB> expands to last history
2690 2696 line which starts with string. The new expansion is also present
2691 2697 with Ctrl-r from the readline library. But this shows, who this
2692 2698 can be done for other cases.
2693 2699 --Added convention that all shell functions should accept a
2694 2700 parameter_string This opens the door for different behaviour for
2695 2701 each function. @cd is a good example of this.
2696 2702
2697 2703 04.05.99 12:12 porto.ifm.uni-kiel.de
2698 2704 --added logfile rotation
2699 2705 --added new mainloop method which freezes first the namespace
2700 2706
2701 2707 07.05.99 21:24 porto.ifm.uni-kiel.de
2702 2708 --added the docreader classes. Now there is a help system.
2703 2709 -This is only a first try. Currently it's not easy to put new
2704 2710 stuff in the indices. But this is the way to go. Info would be
2705 2711 better, but HTML is every where and not everybody has an info
2706 2712 system installed and it's not so easy to change html-docs to info.
2707 2713 --added global logfile option
2708 2714 --there is now a hook for object inspection method pinfo needs to
2709 2715 be provided for this. Can be reached by two '??'.
2710 2716
2711 2717 08.05.99 20:51 porto.ifm.uni-kiel.de
2712 2718 --added a README
2713 2719 --bug in rc file. Something has changed so functions in the rc
2714 2720 file need to reference the shell and not self. Not clear if it's a
2715 2721 bug or feature.
2716 2722 --changed rc file for new behavior
2717 2723
2718 2724 2004-07-15 Fernando Perez <fperez@colorado.edu>
2719 2725
2720 2726 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2721 2727 cache was falling out of sync in bizarre manners when multi-line
2722 2728 input was present. Minor optimizations and cleanup.
2723 2729
2724 2730 (Logger): Remove old Changelog info for cleanup. This is the
2725 2731 information which was there from Janko's original code:
2726 2732
2727 2733 Changes to Logger: - made the default log filename a parameter
2728 2734
2729 2735 - put a check for lines beginning with !@? in log(). Needed
2730 2736 (even if the handlers properly log their lines) for mid-session
2731 2737 logging activation to work properly. Without this, lines logged
2732 2738 in mid session, which get read from the cache, would end up
2733 2739 'bare' (with !@? in the open) in the log. Now they are caught
2734 2740 and prepended with a #.
2735 2741
2736 2742 * IPython/iplib.py (InteractiveShell.init_readline): added check
2737 2743 in case MagicCompleter fails to be defined, so we don't crash.
2738 2744
2739 2745 2004-07-13 Fernando Perez <fperez@colorado.edu>
2740 2746
2741 2747 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2742 2748 of EPS if the requested filename ends in '.eps'.
2743 2749
2744 2750 2004-07-04 Fernando Perez <fperez@colorado.edu>
2745 2751
2746 2752 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2747 2753 escaping of quotes when calling the shell.
2748 2754
2749 2755 2004-07-02 Fernando Perez <fperez@colorado.edu>
2750 2756
2751 2757 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2752 2758 gettext not working because we were clobbering '_'. Fixes
2753 2759 http://www.scipy.net/roundup/ipython/issue6.
2754 2760
2755 2761 2004-07-01 Fernando Perez <fperez@colorado.edu>
2756 2762
2757 2763 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2758 2764 into @cd. Patch by Ville.
2759 2765
2760 2766 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2761 2767 new function to store things after ipmaker runs. Patch by Ville.
2762 2768 Eventually this will go away once ipmaker is removed and the class
2763 2769 gets cleaned up, but for now it's ok. Key functionality here is
2764 2770 the addition of the persistent storage mechanism, a dict for
2765 2771 keeping data across sessions (for now just bookmarks, but more can
2766 2772 be implemented later).
2767 2773
2768 2774 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2769 2775 persistent across sections. Patch by Ville, I modified it
2770 2776 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2771 2777 added a '-l' option to list all bookmarks.
2772 2778
2773 2779 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2774 2780 center for cleanup. Registered with atexit.register(). I moved
2775 2781 here the old exit_cleanup(). After a patch by Ville.
2776 2782
2777 2783 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2778 2784 characters in the hacked shlex_split for python 2.2.
2779 2785
2780 2786 * IPython/iplib.py (file_matches): more fixes to filenames with
2781 2787 whitespace in them. It's not perfect, but limitations in python's
2782 2788 readline make it impossible to go further.
2783 2789
2784 2790 2004-06-29 Fernando Perez <fperez@colorado.edu>
2785 2791
2786 2792 * IPython/iplib.py (file_matches): escape whitespace correctly in
2787 2793 filename completions. Bug reported by Ville.
2788 2794
2789 2795 2004-06-28 Fernando Perez <fperez@colorado.edu>
2790 2796
2791 2797 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2792 2798 the history file will be called 'history-PROFNAME' (or just
2793 2799 'history' if no profile is loaded). I was getting annoyed at
2794 2800 getting my Numerical work history clobbered by pysh sessions.
2795 2801
2796 2802 * IPython/iplib.py (InteractiveShell.__init__): Internal
2797 2803 getoutputerror() function so that we can honor the system_verbose
2798 2804 flag for _all_ system calls. I also added escaping of #
2799 2805 characters here to avoid confusing Itpl.
2800 2806
2801 2807 * IPython/Magic.py (shlex_split): removed call to shell in
2802 2808 parse_options and replaced it with shlex.split(). The annoying
2803 2809 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2804 2810 to backport it from 2.3, with several frail hacks (the shlex
2805 2811 module is rather limited in 2.2). Thanks to a suggestion by Ville
2806 2812 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2807 2813 problem.
2808 2814
2809 2815 (Magic.magic_system_verbose): new toggle to print the actual
2810 2816 system calls made by ipython. Mainly for debugging purposes.
2811 2817
2812 2818 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2813 2819 doesn't support persistence. Reported (and fix suggested) by
2814 2820 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2815 2821
2816 2822 2004-06-26 Fernando Perez <fperez@colorado.edu>
2817 2823
2818 2824 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2819 2825 continue prompts.
2820 2826
2821 2827 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2822 2828 function (basically a big docstring) and a few more things here to
2823 2829 speedup startup. pysh.py is now very lightweight. We want because
2824 2830 it gets execfile'd, while InterpreterExec gets imported, so
2825 2831 byte-compilation saves time.
2826 2832
2827 2833 2004-06-25 Fernando Perez <fperez@colorado.edu>
2828 2834
2829 2835 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2830 2836 -NUM', which was recently broken.
2831 2837
2832 2838 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2833 2839 in multi-line input (but not !!, which doesn't make sense there).
2834 2840
2835 2841 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2836 2842 It's just too useful, and people can turn it off in the less
2837 2843 common cases where it's a problem.
2838 2844
2839 2845 2004-06-24 Fernando Perez <fperez@colorado.edu>
2840 2846
2841 2847 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2842 2848 special syntaxes (like alias calling) is now allied in multi-line
2843 2849 input. This is still _very_ experimental, but it's necessary for
2844 2850 efficient shell usage combining python looping syntax with system
2845 2851 calls. For now it's restricted to aliases, I don't think it
2846 2852 really even makes sense to have this for magics.
2847 2853
2848 2854 2004-06-23 Fernando Perez <fperez@colorado.edu>
2849 2855
2850 2856 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2851 2857 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2852 2858
2853 2859 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2854 2860 extensions under Windows (after code sent by Gary Bishop). The
2855 2861 extensions considered 'executable' are stored in IPython's rc
2856 2862 structure as win_exec_ext.
2857 2863
2858 2864 * IPython/genutils.py (shell): new function, like system() but
2859 2865 without return value. Very useful for interactive shell work.
2860 2866
2861 2867 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2862 2868 delete aliases.
2863 2869
2864 2870 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2865 2871 sure that the alias table doesn't contain python keywords.
2866 2872
2867 2873 2004-06-21 Fernando Perez <fperez@colorado.edu>
2868 2874
2869 2875 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2870 2876 non-existent items are found in $PATH. Reported by Thorsten.
2871 2877
2872 2878 2004-06-20 Fernando Perez <fperez@colorado.edu>
2873 2879
2874 2880 * IPython/iplib.py (complete): modified the completer so that the
2875 2881 order of priorities can be easily changed at runtime.
2876 2882
2877 2883 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2878 2884 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2879 2885
2880 2886 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2881 2887 expand Python variables prepended with $ in all system calls. The
2882 2888 same was done to InteractiveShell.handle_shell_escape. Now all
2883 2889 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2884 2890 expansion of python variables and expressions according to the
2885 2891 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2886 2892
2887 2893 Though PEP-215 has been rejected, a similar (but simpler) one
2888 2894 seems like it will go into Python 2.4, PEP-292 -
2889 2895 http://www.python.org/peps/pep-0292.html.
2890 2896
2891 2897 I'll keep the full syntax of PEP-215, since IPython has since the
2892 2898 start used Ka-Ping Yee's reference implementation discussed there
2893 2899 (Itpl), and I actually like the powerful semantics it offers.
2894 2900
2895 2901 In order to access normal shell variables, the $ has to be escaped
2896 2902 via an extra $. For example:
2897 2903
2898 2904 In [7]: PATH='a python variable'
2899 2905
2900 2906 In [8]: !echo $PATH
2901 2907 a python variable
2902 2908
2903 2909 In [9]: !echo $$PATH
2904 2910 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2905 2911
2906 2912 (Magic.parse_options): escape $ so the shell doesn't evaluate
2907 2913 things prematurely.
2908 2914
2909 2915 * IPython/iplib.py (InteractiveShell.call_alias): added the
2910 2916 ability for aliases to expand python variables via $.
2911 2917
2912 2918 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2913 2919 system, now there's a @rehash/@rehashx pair of magics. These work
2914 2920 like the csh rehash command, and can be invoked at any time. They
2915 2921 build a table of aliases to everything in the user's $PATH
2916 2922 (@rehash uses everything, @rehashx is slower but only adds
2917 2923 executable files). With this, the pysh.py-based shell profile can
2918 2924 now simply call rehash upon startup, and full access to all
2919 2925 programs in the user's path is obtained.
2920 2926
2921 2927 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2922 2928 functionality is now fully in place. I removed the old dynamic
2923 2929 code generation based approach, in favor of a much lighter one
2924 2930 based on a simple dict. The advantage is that this allows me to
2925 2931 now have thousands of aliases with negligible cost (unthinkable
2926 2932 with the old system).
2927 2933
2928 2934 2004-06-19 Fernando Perez <fperez@colorado.edu>
2929 2935
2930 2936 * IPython/iplib.py (__init__): extended MagicCompleter class to
2931 2937 also complete (last in priority) on user aliases.
2932 2938
2933 2939 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2934 2940 call to eval.
2935 2941 (ItplNS.__init__): Added a new class which functions like Itpl,
2936 2942 but allows configuring the namespace for the evaluation to occur
2937 2943 in.
2938 2944
2939 2945 2004-06-18 Fernando Perez <fperez@colorado.edu>
2940 2946
2941 2947 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2942 2948 better message when 'exit' or 'quit' are typed (a common newbie
2943 2949 confusion).
2944 2950
2945 2951 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2946 2952 check for Windows users.
2947 2953
2948 2954 * IPython/iplib.py (InteractiveShell.user_setup): removed
2949 2955 disabling of colors for Windows. I'll test at runtime and issue a
2950 2956 warning if Gary's readline isn't found, as to nudge users to
2951 2957 download it.
2952 2958
2953 2959 2004-06-16 Fernando Perez <fperez@colorado.edu>
2954 2960
2955 2961 * IPython/genutils.py (Stream.__init__): changed to print errors
2956 2962 to sys.stderr. I had a circular dependency here. Now it's
2957 2963 possible to run ipython as IDLE's shell (consider this pre-alpha,
2958 2964 since true stdout things end up in the starting terminal instead
2959 2965 of IDLE's out).
2960 2966
2961 2967 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2962 2968 users who haven't # updated their prompt_in2 definitions. Remove
2963 2969 eventually.
2964 2970 (multiple_replace): added credit to original ASPN recipe.
2965 2971
2966 2972 2004-06-15 Fernando Perez <fperez@colorado.edu>
2967 2973
2968 2974 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2969 2975 list of auto-defined aliases.
2970 2976
2971 2977 2004-06-13 Fernando Perez <fperez@colorado.edu>
2972 2978
2973 2979 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2974 2980 install was really requested (so setup.py can be used for other
2975 2981 things under Windows).
2976 2982
2977 2983 2004-06-10 Fernando Perez <fperez@colorado.edu>
2978 2984
2979 2985 * IPython/Logger.py (Logger.create_log): Manually remove any old
2980 2986 backup, since os.remove may fail under Windows. Fixes bug
2981 2987 reported by Thorsten.
2982 2988
2983 2989 2004-06-09 Fernando Perez <fperez@colorado.edu>
2984 2990
2985 2991 * examples/example-embed.py: fixed all references to %n (replaced
2986 2992 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2987 2993 for all examples and the manual as well.
2988 2994
2989 2995 2004-06-08 Fernando Perez <fperez@colorado.edu>
2990 2996
2991 2997 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2992 2998 alignment and color management. All 3 prompt subsystems now
2993 2999 inherit from BasePrompt.
2994 3000
2995 3001 * tools/release: updates for windows installer build and tag rpms
2996 3002 with python version (since paths are fixed).
2997 3003
2998 3004 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2999 3005 which will become eventually obsolete. Also fixed the default
3000 3006 prompt_in2 to use \D, so at least new users start with the correct
3001 3007 defaults.
3002 3008 WARNING: Users with existing ipythonrc files will need to apply
3003 3009 this fix manually!
3004 3010
3005 3011 * setup.py: make windows installer (.exe). This is finally the
3006 3012 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3007 3013 which I hadn't included because it required Python 2.3 (or recent
3008 3014 distutils).
3009 3015
3010 3016 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3011 3017 usage of new '\D' escape.
3012 3018
3013 3019 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3014 3020 lacks os.getuid())
3015 3021 (CachedOutput.set_colors): Added the ability to turn coloring
3016 3022 on/off with @colors even for manually defined prompt colors. It
3017 3023 uses a nasty global, but it works safely and via the generic color
3018 3024 handling mechanism.
3019 3025 (Prompt2.__init__): Introduced new escape '\D' for continuation
3020 3026 prompts. It represents the counter ('\#') as dots.
3021 3027 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3022 3028 need to update their ipythonrc files and replace '%n' with '\D' in
3023 3029 their prompt_in2 settings everywhere. Sorry, but there's
3024 3030 otherwise no clean way to get all prompts to properly align. The
3025 3031 ipythonrc shipped with IPython has been updated.
3026 3032
3027 3033 2004-06-07 Fernando Perez <fperez@colorado.edu>
3028 3034
3029 3035 * setup.py (isfile): Pass local_icons option to latex2html, so the
3030 3036 resulting HTML file is self-contained. Thanks to
3031 3037 dryice-AT-liu.com.cn for the tip.
3032 3038
3033 3039 * pysh.py: I created a new profile 'shell', which implements a
3034 3040 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3035 3041 system shell, nor will it become one anytime soon. It's mainly
3036 3042 meant to illustrate the use of the new flexible bash-like prompts.
3037 3043 I guess it could be used by hardy souls for true shell management,
3038 3044 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3039 3045 profile. This uses the InterpreterExec extension provided by
3040 3046 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3041 3047
3042 3048 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3043 3049 auto-align itself with the length of the previous input prompt
3044 3050 (taking into account the invisible color escapes).
3045 3051 (CachedOutput.__init__): Large restructuring of this class. Now
3046 3052 all three prompts (primary1, primary2, output) are proper objects,
3047 3053 managed by the 'parent' CachedOutput class. The code is still a
3048 3054 bit hackish (all prompts share state via a pointer to the cache),
3049 3055 but it's overall far cleaner than before.
3050 3056
3051 3057 * IPython/genutils.py (getoutputerror): modified to add verbose,
3052 3058 debug and header options. This makes the interface of all getout*
3053 3059 functions uniform.
3054 3060 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3055 3061
3056 3062 * IPython/Magic.py (Magic.default_option): added a function to
3057 3063 allow registering default options for any magic command. This
3058 3064 makes it easy to have profiles which customize the magics globally
3059 3065 for a certain use. The values set through this function are
3060 3066 picked up by the parse_options() method, which all magics should
3061 3067 use to parse their options.
3062 3068
3063 3069 * IPython/genutils.py (warn): modified the warnings framework to
3064 3070 use the Term I/O class. I'm trying to slowly unify all of
3065 3071 IPython's I/O operations to pass through Term.
3066 3072
3067 3073 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3068 3074 the secondary prompt to correctly match the length of the primary
3069 3075 one for any prompt. Now multi-line code will properly line up
3070 3076 even for path dependent prompts, such as the new ones available
3071 3077 via the prompt_specials.
3072 3078
3073 3079 2004-06-06 Fernando Perez <fperez@colorado.edu>
3074 3080
3075 3081 * IPython/Prompts.py (prompt_specials): Added the ability to have
3076 3082 bash-like special sequences in the prompts, which get
3077 3083 automatically expanded. Things like hostname, current working
3078 3084 directory and username are implemented already, but it's easy to
3079 3085 add more in the future. Thanks to a patch by W.J. van der Laan
3080 3086 <gnufnork-AT-hetdigitalegat.nl>
3081 3087 (prompt_specials): Added color support for prompt strings, so
3082 3088 users can define arbitrary color setups for their prompts.
3083 3089
3084 3090 2004-06-05 Fernando Perez <fperez@colorado.edu>
3085 3091
3086 3092 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3087 3093 code to load Gary Bishop's readline and configure it
3088 3094 automatically. Thanks to Gary for help on this.
3089 3095
3090 3096 2004-06-01 Fernando Perez <fperez@colorado.edu>
3091 3097
3092 3098 * IPython/Logger.py (Logger.create_log): fix bug for logging
3093 3099 with no filename (previous fix was incomplete).
3094 3100
3095 3101 2004-05-25 Fernando Perez <fperez@colorado.edu>
3096 3102
3097 3103 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3098 3104 parens would get passed to the shell.
3099 3105
3100 3106 2004-05-20 Fernando Perez <fperez@colorado.edu>
3101 3107
3102 3108 * IPython/Magic.py (Magic.magic_prun): changed default profile
3103 3109 sort order to 'time' (the more common profiling need).
3104 3110
3105 3111 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3106 3112 so that source code shown is guaranteed in sync with the file on
3107 3113 disk (also changed in psource). Similar fix to the one for
3108 3114 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3109 3115 <yann.ledu-AT-noos.fr>.
3110 3116
3111 3117 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3112 3118 with a single option would not be correctly parsed. Closes
3113 3119 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3114 3120 introduced in 0.6.0 (on 2004-05-06).
3115 3121
3116 3122 2004-05-13 *** Released version 0.6.0
3117 3123
3118 3124 2004-05-13 Fernando Perez <fperez@colorado.edu>
3119 3125
3120 3126 * debian/: Added debian/ directory to CVS, so that debian support
3121 3127 is publicly accessible. The debian package is maintained by Jack
3122 3128 Moffit <jack-AT-xiph.org>.
3123 3129
3124 3130 * Documentation: included the notes about an ipython-based system
3125 3131 shell (the hypothetical 'pysh') into the new_design.pdf document,
3126 3132 so that these ideas get distributed to users along with the
3127 3133 official documentation.
3128 3134
3129 3135 2004-05-10 Fernando Perez <fperez@colorado.edu>
3130 3136
3131 3137 * IPython/Logger.py (Logger.create_log): fix recently introduced
3132 3138 bug (misindented line) where logstart would fail when not given an
3133 3139 explicit filename.
3134 3140
3135 3141 2004-05-09 Fernando Perez <fperez@colorado.edu>
3136 3142
3137 3143 * IPython/Magic.py (Magic.parse_options): skip system call when
3138 3144 there are no options to look for. Faster, cleaner for the common
3139 3145 case.
3140 3146
3141 3147 * Documentation: many updates to the manual: describing Windows
3142 3148 support better, Gnuplot updates, credits, misc small stuff. Also
3143 3149 updated the new_design doc a bit.
3144 3150
3145 3151 2004-05-06 *** Released version 0.6.0.rc1
3146 3152
3147 3153 2004-05-06 Fernando Perez <fperez@colorado.edu>
3148 3154
3149 3155 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3150 3156 operations to use the vastly more efficient list/''.join() method.
3151 3157 (FormattedTB.text): Fix
3152 3158 http://www.scipy.net/roundup/ipython/issue12 - exception source
3153 3159 extract not updated after reload. Thanks to Mike Salib
3154 3160 <msalib-AT-mit.edu> for pinning the source of the problem.
3155 3161 Fortunately, the solution works inside ipython and doesn't require
3156 3162 any changes to python proper.
3157 3163
3158 3164 * IPython/Magic.py (Magic.parse_options): Improved to process the
3159 3165 argument list as a true shell would (by actually using the
3160 3166 underlying system shell). This way, all @magics automatically get
3161 3167 shell expansion for variables. Thanks to a comment by Alex
3162 3168 Schmolck.
3163 3169
3164 3170 2004-04-04 Fernando Perez <fperez@colorado.edu>
3165 3171
3166 3172 * IPython/iplib.py (InteractiveShell.interact): Added a special
3167 3173 trap for a debugger quit exception, which is basically impossible
3168 3174 to handle by normal mechanisms, given what pdb does to the stack.
3169 3175 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3170 3176
3171 3177 2004-04-03 Fernando Perez <fperez@colorado.edu>
3172 3178
3173 3179 * IPython/genutils.py (Term): Standardized the names of the Term
3174 3180 class streams to cin/cout/cerr, following C++ naming conventions
3175 3181 (I can't use in/out/err because 'in' is not a valid attribute
3176 3182 name).
3177 3183
3178 3184 * IPython/iplib.py (InteractiveShell.interact): don't increment
3179 3185 the prompt if there's no user input. By Daniel 'Dang' Griffith
3180 3186 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3181 3187 Francois Pinard.
3182 3188
3183 3189 2004-04-02 Fernando Perez <fperez@colorado.edu>
3184 3190
3185 3191 * IPython/genutils.py (Stream.__init__): Modified to survive at
3186 3192 least importing in contexts where stdin/out/err aren't true file
3187 3193 objects, such as PyCrust (they lack fileno() and mode). However,
3188 3194 the recovery facilities which rely on these things existing will
3189 3195 not work.
3190 3196
3191 3197 2004-04-01 Fernando Perez <fperez@colorado.edu>
3192 3198
3193 3199 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3194 3200 use the new getoutputerror() function, so it properly
3195 3201 distinguishes stdout/err.
3196 3202
3197 3203 * IPython/genutils.py (getoutputerror): added a function to
3198 3204 capture separately the standard output and error of a command.
3199 3205 After a comment from dang on the mailing lists. This code is
3200 3206 basically a modified version of commands.getstatusoutput(), from
3201 3207 the standard library.
3202 3208
3203 3209 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3204 3210 '!!' as a special syntax (shorthand) to access @sx.
3205 3211
3206 3212 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3207 3213 command and return its output as a list split on '\n'.
3208 3214
3209 3215 2004-03-31 Fernando Perez <fperez@colorado.edu>
3210 3216
3211 3217 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3212 3218 method to dictionaries used as FakeModule instances if they lack
3213 3219 it. At least pydoc in python2.3 breaks for runtime-defined
3214 3220 functions without this hack. At some point I need to _really_
3215 3221 understand what FakeModule is doing, because it's a gross hack.
3216 3222 But it solves Arnd's problem for now...
3217 3223
3218 3224 2004-02-27 Fernando Perez <fperez@colorado.edu>
3219 3225
3220 3226 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3221 3227 mode would behave erratically. Also increased the number of
3222 3228 possible logs in rotate mod to 999. Thanks to Rod Holland
3223 3229 <rhh@StructureLABS.com> for the report and fixes.
3224 3230
3225 3231 2004-02-26 Fernando Perez <fperez@colorado.edu>
3226 3232
3227 3233 * IPython/genutils.py (page): Check that the curses module really
3228 3234 has the initscr attribute before trying to use it. For some
3229 3235 reason, the Solaris curses module is missing this. I think this
3230 3236 should be considered a Solaris python bug, but I'm not sure.
3231 3237
3232 3238 2004-01-17 Fernando Perez <fperez@colorado.edu>
3233 3239
3234 3240 * IPython/genutils.py (Stream.__init__): Changes to try to make
3235 3241 ipython robust against stdin/out/err being closed by the user.
3236 3242 This is 'user error' (and blocks a normal python session, at least
3237 3243 the stdout case). However, Ipython should be able to survive such
3238 3244 instances of abuse as gracefully as possible. To simplify the
3239 3245 coding and maintain compatibility with Gary Bishop's Term
3240 3246 contributions, I've made use of classmethods for this. I think
3241 3247 this introduces a dependency on python 2.2.
3242 3248
3243 3249 2004-01-13 Fernando Perez <fperez@colorado.edu>
3244 3250
3245 3251 * IPython/numutils.py (exp_safe): simplified the code a bit and
3246 3252 removed the need for importing the kinds module altogether.
3247 3253
3248 3254 2004-01-06 Fernando Perez <fperez@colorado.edu>
3249 3255
3250 3256 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3251 3257 a magic function instead, after some community feedback. No
3252 3258 special syntax will exist for it, but its name is deliberately
3253 3259 very short.
3254 3260
3255 3261 2003-12-20 Fernando Perez <fperez@colorado.edu>
3256 3262
3257 3263 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3258 3264 new functionality, to automagically assign the result of a shell
3259 3265 command to a variable. I'll solicit some community feedback on
3260 3266 this before making it permanent.
3261 3267
3262 3268 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3263 3269 requested about callables for which inspect couldn't obtain a
3264 3270 proper argspec. Thanks to a crash report sent by Etienne
3265 3271 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3266 3272
3267 3273 2003-12-09 Fernando Perez <fperez@colorado.edu>
3268 3274
3269 3275 * IPython/genutils.py (page): patch for the pager to work across
3270 3276 various versions of Windows. By Gary Bishop.
3271 3277
3272 3278 2003-12-04 Fernando Perez <fperez@colorado.edu>
3273 3279
3274 3280 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3275 3281 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3276 3282 While I tested this and it looks ok, there may still be corner
3277 3283 cases I've missed.
3278 3284
3279 3285 2003-12-01 Fernando Perez <fperez@colorado.edu>
3280 3286
3281 3287 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3282 3288 where a line like 'p,q=1,2' would fail because the automagic
3283 3289 system would be triggered for @p.
3284 3290
3285 3291 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3286 3292 cleanups, code unmodified.
3287 3293
3288 3294 * IPython/genutils.py (Term): added a class for IPython to handle
3289 3295 output. In most cases it will just be a proxy for stdout/err, but
3290 3296 having this allows modifications to be made for some platforms,
3291 3297 such as handling color escapes under Windows. All of this code
3292 3298 was contributed by Gary Bishop, with minor modifications by me.
3293 3299 The actual changes affect many files.
3294 3300
3295 3301 2003-11-30 Fernando Perez <fperez@colorado.edu>
3296 3302
3297 3303 * IPython/iplib.py (file_matches): new completion code, courtesy
3298 3304 of Jeff Collins. This enables filename completion again under
3299 3305 python 2.3, which disabled it at the C level.
3300 3306
3301 3307 2003-11-11 Fernando Perez <fperez@colorado.edu>
3302 3308
3303 3309 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3304 3310 for Numeric.array(map(...)), but often convenient.
3305 3311
3306 3312 2003-11-05 Fernando Perez <fperez@colorado.edu>
3307 3313
3308 3314 * IPython/numutils.py (frange): Changed a call from int() to
3309 3315 int(round()) to prevent a problem reported with arange() in the
3310 3316 numpy list.
3311 3317
3312 3318 2003-10-06 Fernando Perez <fperez@colorado.edu>
3313 3319
3314 3320 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3315 3321 prevent crashes if sys lacks an argv attribute (it happens with
3316 3322 embedded interpreters which build a bare-bones sys module).
3317 3323 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3318 3324
3319 3325 2003-09-24 Fernando Perez <fperez@colorado.edu>
3320 3326
3321 3327 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3322 3328 to protect against poorly written user objects where __getattr__
3323 3329 raises exceptions other than AttributeError. Thanks to a bug
3324 3330 report by Oliver Sander <osander-AT-gmx.de>.
3325 3331
3326 3332 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3327 3333 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3328 3334
3329 3335 2003-09-09 Fernando Perez <fperez@colorado.edu>
3330 3336
3331 3337 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3332 3338 unpacking a list whith a callable as first element would
3333 3339 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3334 3340 Collins.
3335 3341
3336 3342 2003-08-25 *** Released version 0.5.0
3337 3343
3338 3344 2003-08-22 Fernando Perez <fperez@colorado.edu>
3339 3345
3340 3346 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3341 3347 improperly defined user exceptions. Thanks to feedback from Mark
3342 3348 Russell <mrussell-AT-verio.net>.
3343 3349
3344 3350 2003-08-20 Fernando Perez <fperez@colorado.edu>
3345 3351
3346 3352 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3347 3353 printing so that it would print multi-line string forms starting
3348 3354 with a new line. This way the formatting is better respected for
3349 3355 objects which work hard to make nice string forms.
3350 3356
3351 3357 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3352 3358 autocall would overtake data access for objects with both
3353 3359 __getitem__ and __call__.
3354 3360
3355 3361 2003-08-19 *** Released version 0.5.0-rc1
3356 3362
3357 3363 2003-08-19 Fernando Perez <fperez@colorado.edu>
3358 3364
3359 3365 * IPython/deep_reload.py (load_tail): single tiny change here
3360 3366 seems to fix the long-standing bug of dreload() failing to work
3361 3367 for dotted names. But this module is pretty tricky, so I may have
3362 3368 missed some subtlety. Needs more testing!.
3363 3369
3364 3370 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3365 3371 exceptions which have badly implemented __str__ methods.
3366 3372 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3367 3373 which I've been getting reports about from Python 2.3 users. I
3368 3374 wish I had a simple test case to reproduce the problem, so I could
3369 3375 either write a cleaner workaround or file a bug report if
3370 3376 necessary.
3371 3377
3372 3378 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3373 3379 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3374 3380 a bug report by Tjabo Kloppenburg.
3375 3381
3376 3382 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3377 3383 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3378 3384 seems rather unstable. Thanks to a bug report by Tjabo
3379 3385 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3380 3386
3381 3387 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3382 3388 this out soon because of the critical fixes in the inner loop for
3383 3389 generators.
3384 3390
3385 3391 * IPython/Magic.py (Magic.getargspec): removed. This (and
3386 3392 _get_def) have been obsoleted by OInspect for a long time, I
3387 3393 hadn't noticed that they were dead code.
3388 3394 (Magic._ofind): restored _ofind functionality for a few literals
3389 3395 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3390 3396 for things like "hello".capitalize?, since that would require a
3391 3397 potentially dangerous eval() again.
3392 3398
3393 3399 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3394 3400 logic a bit more to clean up the escapes handling and minimize the
3395 3401 use of _ofind to only necessary cases. The interactive 'feel' of
3396 3402 IPython should have improved quite a bit with the changes in
3397 3403 _prefilter and _ofind (besides being far safer than before).
3398 3404
3399 3405 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3400 3406 obscure, never reported). Edit would fail to find the object to
3401 3407 edit under some circumstances.
3402 3408 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3403 3409 which were causing double-calling of generators. Those eval calls
3404 3410 were _very_ dangerous, since code with side effects could be
3405 3411 triggered. As they say, 'eval is evil'... These were the
3406 3412 nastiest evals in IPython. Besides, _ofind is now far simpler,
3407 3413 and it should also be quite a bit faster. Its use of inspect is
3408 3414 also safer, so perhaps some of the inspect-related crashes I've
3409 3415 seen lately with Python 2.3 might be taken care of. That will
3410 3416 need more testing.
3411 3417
3412 3418 2003-08-17 Fernando Perez <fperez@colorado.edu>
3413 3419
3414 3420 * IPython/iplib.py (InteractiveShell._prefilter): significant
3415 3421 simplifications to the logic for handling user escapes. Faster
3416 3422 and simpler code.
3417 3423
3418 3424 2003-08-14 Fernando Perez <fperez@colorado.edu>
3419 3425
3420 3426 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3421 3427 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3422 3428 but it should be quite a bit faster. And the recursive version
3423 3429 generated O(log N) intermediate storage for all rank>1 arrays,
3424 3430 even if they were contiguous.
3425 3431 (l1norm): Added this function.
3426 3432 (norm): Added this function for arbitrary norms (including
3427 3433 l-infinity). l1 and l2 are still special cases for convenience
3428 3434 and speed.
3429 3435
3430 3436 2003-08-03 Fernando Perez <fperez@colorado.edu>
3431 3437
3432 3438 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3433 3439 exceptions, which now raise PendingDeprecationWarnings in Python
3434 3440 2.3. There were some in Magic and some in Gnuplot2.
3435 3441
3436 3442 2003-06-30 Fernando Perez <fperez@colorado.edu>
3437 3443
3438 3444 * IPython/genutils.py (page): modified to call curses only for
3439 3445 terminals where TERM=='xterm'. After problems under many other
3440 3446 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3441 3447
3442 3448 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3443 3449 would be triggered when readline was absent. This was just an old
3444 3450 debugging statement I'd forgotten to take out.
3445 3451
3446 3452 2003-06-20 Fernando Perez <fperez@colorado.edu>
3447 3453
3448 3454 * IPython/genutils.py (clock): modified to return only user time
3449 3455 (not counting system time), after a discussion on scipy. While
3450 3456 system time may be a useful quantity occasionally, it may much
3451 3457 more easily be skewed by occasional swapping or other similar
3452 3458 activity.
3453 3459
3454 3460 2003-06-05 Fernando Perez <fperez@colorado.edu>
3455 3461
3456 3462 * IPython/numutils.py (identity): new function, for building
3457 3463 arbitrary rank Kronecker deltas (mostly backwards compatible with
3458 3464 Numeric.identity)
3459 3465
3460 3466 2003-06-03 Fernando Perez <fperez@colorado.edu>
3461 3467
3462 3468 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3463 3469 arguments passed to magics with spaces, to allow trailing '\' to
3464 3470 work normally (mainly for Windows users).
3465 3471
3466 3472 2003-05-29 Fernando Perez <fperez@colorado.edu>
3467 3473
3468 3474 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3469 3475 instead of pydoc.help. This fixes a bizarre behavior where
3470 3476 printing '%s' % locals() would trigger the help system. Now
3471 3477 ipython behaves like normal python does.
3472 3478
3473 3479 Note that if one does 'from pydoc import help', the bizarre
3474 3480 behavior returns, but this will also happen in normal python, so
3475 3481 it's not an ipython bug anymore (it has to do with how pydoc.help
3476 3482 is implemented).
3477 3483
3478 3484 2003-05-22 Fernando Perez <fperez@colorado.edu>
3479 3485
3480 3486 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3481 3487 return [] instead of None when nothing matches, also match to end
3482 3488 of line. Patch by Gary Bishop.
3483 3489
3484 3490 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3485 3491 protection as before, for files passed on the command line. This
3486 3492 prevents the CrashHandler from kicking in if user files call into
3487 3493 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3488 3494 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3489 3495
3490 3496 2003-05-20 *** Released version 0.4.0
3491 3497
3492 3498 2003-05-20 Fernando Perez <fperez@colorado.edu>
3493 3499
3494 3500 * setup.py: added support for manpages. It's a bit hackish b/c of
3495 3501 a bug in the way the bdist_rpm distutils target handles gzipped
3496 3502 manpages, but it works. After a patch by Jack.
3497 3503
3498 3504 2003-05-19 Fernando Perez <fperez@colorado.edu>
3499 3505
3500 3506 * IPython/numutils.py: added a mockup of the kinds module, since
3501 3507 it was recently removed from Numeric. This way, numutils will
3502 3508 work for all users even if they are missing kinds.
3503 3509
3504 3510 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3505 3511 failure, which can occur with SWIG-wrapped extensions. After a
3506 3512 crash report from Prabhu.
3507 3513
3508 3514 2003-05-16 Fernando Perez <fperez@colorado.edu>
3509 3515
3510 3516 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3511 3517 protect ipython from user code which may call directly
3512 3518 sys.excepthook (this looks like an ipython crash to the user, even
3513 3519 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3514 3520 This is especially important to help users of WxWindows, but may
3515 3521 also be useful in other cases.
3516 3522
3517 3523 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3518 3524 an optional tb_offset to be specified, and to preserve exception
3519 3525 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3520 3526
3521 3527 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3522 3528
3523 3529 2003-05-15 Fernando Perez <fperez@colorado.edu>
3524 3530
3525 3531 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3526 3532 installing for a new user under Windows.
3527 3533
3528 3534 2003-05-12 Fernando Perez <fperez@colorado.edu>
3529 3535
3530 3536 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3531 3537 handler for Emacs comint-based lines. Currently it doesn't do
3532 3538 much (but importantly, it doesn't update the history cache). In
3533 3539 the future it may be expanded if Alex needs more functionality
3534 3540 there.
3535 3541
3536 3542 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3537 3543 info to crash reports.
3538 3544
3539 3545 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3540 3546 just like Python's -c. Also fixed crash with invalid -color
3541 3547 option value at startup. Thanks to Will French
3542 3548 <wfrench-AT-bestweb.net> for the bug report.
3543 3549
3544 3550 2003-05-09 Fernando Perez <fperez@colorado.edu>
3545 3551
3546 3552 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3547 3553 to EvalDict (it's a mapping, after all) and simplified its code
3548 3554 quite a bit, after a nice discussion on c.l.py where Gustavo
3549 3555 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3550 3556
3551 3557 2003-04-30 Fernando Perez <fperez@colorado.edu>
3552 3558
3553 3559 * IPython/genutils.py (timings_out): modified it to reduce its
3554 3560 overhead in the common reps==1 case.
3555 3561
3556 3562 2003-04-29 Fernando Perez <fperez@colorado.edu>
3557 3563
3558 3564 * IPython/genutils.py (timings_out): Modified to use the resource
3559 3565 module, which avoids the wraparound problems of time.clock().
3560 3566
3561 3567 2003-04-17 *** Released version 0.2.15pre4
3562 3568
3563 3569 2003-04-17 Fernando Perez <fperez@colorado.edu>
3564 3570
3565 3571 * setup.py (scriptfiles): Split windows-specific stuff over to a
3566 3572 separate file, in an attempt to have a Windows GUI installer.
3567 3573 That didn't work, but part of the groundwork is done.
3568 3574
3569 3575 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3570 3576 indent/unindent with 4 spaces. Particularly useful in combination
3571 3577 with the new auto-indent option.
3572 3578
3573 3579 2003-04-16 Fernando Perez <fperez@colorado.edu>
3574 3580
3575 3581 * IPython/Magic.py: various replacements of self.rc for
3576 3582 self.shell.rc. A lot more remains to be done to fully disentangle
3577 3583 this class from the main Shell class.
3578 3584
3579 3585 * IPython/GnuplotRuntime.py: added checks for mouse support so
3580 3586 that we don't try to enable it if the current gnuplot doesn't
3581 3587 really support it. Also added checks so that we don't try to
3582 3588 enable persist under Windows (where Gnuplot doesn't recognize the
3583 3589 option).
3584 3590
3585 3591 * IPython/iplib.py (InteractiveShell.interact): Added optional
3586 3592 auto-indenting code, after a patch by King C. Shu
3587 3593 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3588 3594 get along well with pasting indented code. If I ever figure out
3589 3595 how to make that part go well, it will become on by default.
3590 3596
3591 3597 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3592 3598 crash ipython if there was an unmatched '%' in the user's prompt
3593 3599 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3594 3600
3595 3601 * IPython/iplib.py (InteractiveShell.interact): removed the
3596 3602 ability to ask the user whether he wants to crash or not at the
3597 3603 'last line' exception handler. Calling functions at that point
3598 3604 changes the stack, and the error reports would have incorrect
3599 3605 tracebacks.
3600 3606
3601 3607 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3602 3608 pass through a peger a pretty-printed form of any object. After a
3603 3609 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3604 3610
3605 3611 2003-04-14 Fernando Perez <fperez@colorado.edu>
3606 3612
3607 3613 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3608 3614 all files in ~ would be modified at first install (instead of
3609 3615 ~/.ipython). This could be potentially disastrous, as the
3610 3616 modification (make line-endings native) could damage binary files.
3611 3617
3612 3618 2003-04-10 Fernando Perez <fperez@colorado.edu>
3613 3619
3614 3620 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3615 3621 handle only lines which are invalid python. This now means that
3616 3622 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3617 3623 for the bug report.
3618 3624
3619 3625 2003-04-01 Fernando Perez <fperez@colorado.edu>
3620 3626
3621 3627 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3622 3628 where failing to set sys.last_traceback would crash pdb.pm().
3623 3629 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3624 3630 report.
3625 3631
3626 3632 2003-03-25 Fernando Perez <fperez@colorado.edu>
3627 3633
3628 3634 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3629 3635 before printing it (it had a lot of spurious blank lines at the
3630 3636 end).
3631 3637
3632 3638 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3633 3639 output would be sent 21 times! Obviously people don't use this
3634 3640 too often, or I would have heard about it.
3635 3641
3636 3642 2003-03-24 Fernando Perez <fperez@colorado.edu>
3637 3643
3638 3644 * setup.py (scriptfiles): renamed the data_files parameter from
3639 3645 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3640 3646 for the patch.
3641 3647
3642 3648 2003-03-20 Fernando Perez <fperez@colorado.edu>
3643 3649
3644 3650 * IPython/genutils.py (error): added error() and fatal()
3645 3651 functions.
3646 3652
3647 3653 2003-03-18 *** Released version 0.2.15pre3
3648 3654
3649 3655 2003-03-18 Fernando Perez <fperez@colorado.edu>
3650 3656
3651 3657 * setupext/install_data_ext.py
3652 3658 (install_data_ext.initialize_options): Class contributed by Jack
3653 3659 Moffit for fixing the old distutils hack. He is sending this to
3654 3660 the distutils folks so in the future we may not need it as a
3655 3661 private fix.
3656 3662
3657 3663 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3658 3664 changes for Debian packaging. See his patch for full details.
3659 3665 The old distutils hack of making the ipythonrc* files carry a
3660 3666 bogus .py extension is gone, at last. Examples were moved to a
3661 3667 separate subdir under doc/, and the separate executable scripts
3662 3668 now live in their own directory. Overall a great cleanup. The
3663 3669 manual was updated to use the new files, and setup.py has been
3664 3670 fixed for this setup.
3665 3671
3666 3672 * IPython/PyColorize.py (Parser.usage): made non-executable and
3667 3673 created a pycolor wrapper around it to be included as a script.
3668 3674
3669 3675 2003-03-12 *** Released version 0.2.15pre2
3670 3676
3671 3677 2003-03-12 Fernando Perez <fperez@colorado.edu>
3672 3678
3673 3679 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3674 3680 long-standing problem with garbage characters in some terminals.
3675 3681 The issue was really that the \001 and \002 escapes must _only_ be
3676 3682 passed to input prompts (which call readline), but _never_ to
3677 3683 normal text to be printed on screen. I changed ColorANSI to have
3678 3684 two classes: TermColors and InputTermColors, each with the
3679 3685 appropriate escapes for input prompts or normal text. The code in
3680 3686 Prompts.py got slightly more complicated, but this very old and
3681 3687 annoying bug is finally fixed.
3682 3688
3683 3689 All the credit for nailing down the real origin of this problem
3684 3690 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3685 3691 *Many* thanks to him for spending quite a bit of effort on this.
3686 3692
3687 3693 2003-03-05 *** Released version 0.2.15pre1
3688 3694
3689 3695 2003-03-03 Fernando Perez <fperez@colorado.edu>
3690 3696
3691 3697 * IPython/FakeModule.py: Moved the former _FakeModule to a
3692 3698 separate file, because it's also needed by Magic (to fix a similar
3693 3699 pickle-related issue in @run).
3694 3700
3695 3701 2003-03-02 Fernando Perez <fperez@colorado.edu>
3696 3702
3697 3703 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3698 3704 the autocall option at runtime.
3699 3705 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3700 3706 across Magic.py to start separating Magic from InteractiveShell.
3701 3707 (Magic._ofind): Fixed to return proper namespace for dotted
3702 3708 names. Before, a dotted name would always return 'not currently
3703 3709 defined', because it would find the 'parent'. s.x would be found,
3704 3710 but since 'x' isn't defined by itself, it would get confused.
3705 3711 (Magic.magic_run): Fixed pickling problems reported by Ralf
3706 3712 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3707 3713 that I'd used when Mike Heeter reported similar issues at the
3708 3714 top-level, but now for @run. It boils down to injecting the
3709 3715 namespace where code is being executed with something that looks
3710 3716 enough like a module to fool pickle.dump(). Since a pickle stores
3711 3717 a named reference to the importing module, we need this for
3712 3718 pickles to save something sensible.
3713 3719
3714 3720 * IPython/ipmaker.py (make_IPython): added an autocall option.
3715 3721
3716 3722 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3717 3723 the auto-eval code. Now autocalling is an option, and the code is
3718 3724 also vastly safer. There is no more eval() involved at all.
3719 3725
3720 3726 2003-03-01 Fernando Perez <fperez@colorado.edu>
3721 3727
3722 3728 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3723 3729 dict with named keys instead of a tuple.
3724 3730
3725 3731 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3726 3732
3727 3733 * setup.py (make_shortcut): Fixed message about directories
3728 3734 created during Windows installation (the directories were ok, just
3729 3735 the printed message was misleading). Thanks to Chris Liechti
3730 3736 <cliechti-AT-gmx.net> for the heads up.
3731 3737
3732 3738 2003-02-21 Fernando Perez <fperez@colorado.edu>
3733 3739
3734 3740 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3735 3741 of ValueError exception when checking for auto-execution. This
3736 3742 one is raised by things like Numeric arrays arr.flat when the
3737 3743 array is non-contiguous.
3738 3744
3739 3745 2003-01-31 Fernando Perez <fperez@colorado.edu>
3740 3746
3741 3747 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3742 3748 not return any value at all (even though the command would get
3743 3749 executed).
3744 3750 (xsys): Flush stdout right after printing the command to ensure
3745 3751 proper ordering of commands and command output in the total
3746 3752 output.
3747 3753 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3748 3754 system/getoutput as defaults. The old ones are kept for
3749 3755 compatibility reasons, so no code which uses this library needs
3750 3756 changing.
3751 3757
3752 3758 2003-01-27 *** Released version 0.2.14
3753 3759
3754 3760 2003-01-25 Fernando Perez <fperez@colorado.edu>
3755 3761
3756 3762 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3757 3763 functions defined in previous edit sessions could not be re-edited
3758 3764 (because the temp files were immediately removed). Now temp files
3759 3765 are removed only at IPython's exit.
3760 3766 (Magic.magic_run): Improved @run to perform shell-like expansions
3761 3767 on its arguments (~users and $VARS). With this, @run becomes more
3762 3768 like a normal command-line.
3763 3769
3764 3770 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3765 3771 bugs related to embedding and cleaned up that code. A fairly
3766 3772 important one was the impossibility to access the global namespace
3767 3773 through the embedded IPython (only local variables were visible).
3768 3774
3769 3775 2003-01-14 Fernando Perez <fperez@colorado.edu>
3770 3776
3771 3777 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3772 3778 auto-calling to be a bit more conservative. Now it doesn't get
3773 3779 triggered if any of '!=()<>' are in the rest of the input line, to
3774 3780 allow comparing callables. Thanks to Alex for the heads up.
3775 3781
3776 3782 2003-01-07 Fernando Perez <fperez@colorado.edu>
3777 3783
3778 3784 * IPython/genutils.py (page): fixed estimation of the number of
3779 3785 lines in a string to be paged to simply count newlines. This
3780 3786 prevents over-guessing due to embedded escape sequences. A better
3781 3787 long-term solution would involve stripping out the control chars
3782 3788 for the count, but it's potentially so expensive I just don't
3783 3789 think it's worth doing.
3784 3790
3785 3791 2002-12-19 *** Released version 0.2.14pre50
3786 3792
3787 3793 2002-12-19 Fernando Perez <fperez@colorado.edu>
3788 3794
3789 3795 * tools/release (version): Changed release scripts to inform
3790 3796 Andrea and build a NEWS file with a list of recent changes.
3791 3797
3792 3798 * IPython/ColorANSI.py (__all__): changed terminal detection
3793 3799 code. Seems to work better for xterms without breaking
3794 3800 konsole. Will need more testing to determine if WinXP and Mac OSX
3795 3801 also work ok.
3796 3802
3797 3803 2002-12-18 *** Released version 0.2.14pre49
3798 3804
3799 3805 2002-12-18 Fernando Perez <fperez@colorado.edu>
3800 3806
3801 3807 * Docs: added new info about Mac OSX, from Andrea.
3802 3808
3803 3809 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3804 3810 allow direct plotting of python strings whose format is the same
3805 3811 of gnuplot data files.
3806 3812
3807 3813 2002-12-16 Fernando Perez <fperez@colorado.edu>
3808 3814
3809 3815 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3810 3816 value of exit question to be acknowledged.
3811 3817
3812 3818 2002-12-03 Fernando Perez <fperez@colorado.edu>
3813 3819
3814 3820 * IPython/ipmaker.py: removed generators, which had been added
3815 3821 by mistake in an earlier debugging run. This was causing trouble
3816 3822 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3817 3823 for pointing this out.
3818 3824
3819 3825 2002-11-17 Fernando Perez <fperez@colorado.edu>
3820 3826
3821 3827 * Manual: updated the Gnuplot section.
3822 3828
3823 3829 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3824 3830 a much better split of what goes in Runtime and what goes in
3825 3831 Interactive.
3826 3832
3827 3833 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3828 3834 being imported from iplib.
3829 3835
3830 3836 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3831 3837 for command-passing. Now the global Gnuplot instance is called
3832 3838 'gp' instead of 'g', which was really a far too fragile and
3833 3839 common name.
3834 3840
3835 3841 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3836 3842 bounding boxes generated by Gnuplot for square plots.
3837 3843
3838 3844 * IPython/genutils.py (popkey): new function added. I should
3839 3845 suggest this on c.l.py as a dict method, it seems useful.
3840 3846
3841 3847 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3842 3848 to transparently handle PostScript generation. MUCH better than
3843 3849 the previous plot_eps/replot_eps (which I removed now). The code
3844 3850 is also fairly clean and well documented now (including
3845 3851 docstrings).
3846 3852
3847 3853 2002-11-13 Fernando Perez <fperez@colorado.edu>
3848 3854
3849 3855 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3850 3856 (inconsistent with options).
3851 3857
3852 3858 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3853 3859 manually disabled, I don't know why. Fixed it.
3854 3860 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3855 3861 eps output.
3856 3862
3857 3863 2002-11-12 Fernando Perez <fperez@colorado.edu>
3858 3864
3859 3865 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3860 3866 don't propagate up to caller. Fixes crash reported by François
3861 3867 Pinard.
3862 3868
3863 3869 2002-11-09 Fernando Perez <fperez@colorado.edu>
3864 3870
3865 3871 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3866 3872 history file for new users.
3867 3873 (make_IPython): fixed bug where initial install would leave the
3868 3874 user running in the .ipython dir.
3869 3875 (make_IPython): fixed bug where config dir .ipython would be
3870 3876 created regardless of the given -ipythondir option. Thanks to Cory
3871 3877 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3872 3878
3873 3879 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3874 3880 type confirmations. Will need to use it in all of IPython's code
3875 3881 consistently.
3876 3882
3877 3883 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3878 3884 context to print 31 lines instead of the default 5. This will make
3879 3885 the crash reports extremely detailed in case the problem is in
3880 3886 libraries I don't have access to.
3881 3887
3882 3888 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3883 3889 line of defense' code to still crash, but giving users fair
3884 3890 warning. I don't want internal errors to go unreported: if there's
3885 3891 an internal problem, IPython should crash and generate a full
3886 3892 report.
3887 3893
3888 3894 2002-11-08 Fernando Perez <fperez@colorado.edu>
3889 3895
3890 3896 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3891 3897 otherwise uncaught exceptions which can appear if people set
3892 3898 sys.stdout to something badly broken. Thanks to a crash report
3893 3899 from henni-AT-mail.brainbot.com.
3894 3900
3895 3901 2002-11-04 Fernando Perez <fperez@colorado.edu>
3896 3902
3897 3903 * IPython/iplib.py (InteractiveShell.interact): added
3898 3904 __IPYTHON__active to the builtins. It's a flag which goes on when
3899 3905 the interaction starts and goes off again when it stops. This
3900 3906 allows embedding code to detect being inside IPython. Before this
3901 3907 was done via __IPYTHON__, but that only shows that an IPython
3902 3908 instance has been created.
3903 3909
3904 3910 * IPython/Magic.py (Magic.magic_env): I realized that in a
3905 3911 UserDict, instance.data holds the data as a normal dict. So I
3906 3912 modified @env to return os.environ.data instead of rebuilding a
3907 3913 dict by hand.
3908 3914
3909 3915 2002-11-02 Fernando Perez <fperez@colorado.edu>
3910 3916
3911 3917 * IPython/genutils.py (warn): changed so that level 1 prints no
3912 3918 header. Level 2 is now the default (with 'WARNING' header, as
3913 3919 before). I think I tracked all places where changes were needed in
3914 3920 IPython, but outside code using the old level numbering may have
3915 3921 broken.
3916 3922
3917 3923 * IPython/iplib.py (InteractiveShell.runcode): added this to
3918 3924 handle the tracebacks in SystemExit traps correctly. The previous
3919 3925 code (through interact) was printing more of the stack than
3920 3926 necessary, showing IPython internal code to the user.
3921 3927
3922 3928 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3923 3929 default. Now that the default at the confirmation prompt is yes,
3924 3930 it's not so intrusive. François' argument that ipython sessions
3925 3931 tend to be complex enough not to lose them from an accidental C-d,
3926 3932 is a valid one.
3927 3933
3928 3934 * IPython/iplib.py (InteractiveShell.interact): added a
3929 3935 showtraceback() call to the SystemExit trap, and modified the exit
3930 3936 confirmation to have yes as the default.
3931 3937
3932 3938 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3933 3939 this file. It's been gone from the code for a long time, this was
3934 3940 simply leftover junk.
3935 3941
3936 3942 2002-11-01 Fernando Perez <fperez@colorado.edu>
3937 3943
3938 3944 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3939 3945 added. If set, IPython now traps EOF and asks for
3940 3946 confirmation. After a request by François Pinard.
3941 3947
3942 3948 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3943 3949 of @abort, and with a new (better) mechanism for handling the
3944 3950 exceptions.
3945 3951
3946 3952 2002-10-27 Fernando Perez <fperez@colorado.edu>
3947 3953
3948 3954 * IPython/usage.py (__doc__): updated the --help information and
3949 3955 the ipythonrc file to indicate that -log generates
3950 3956 ./ipython.log. Also fixed the corresponding info in @logstart.
3951 3957 This and several other fixes in the manuals thanks to reports by
3952 3958 François Pinard <pinard-AT-iro.umontreal.ca>.
3953 3959
3954 3960 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3955 3961 refer to @logstart (instead of @log, which doesn't exist).
3956 3962
3957 3963 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3958 3964 AttributeError crash. Thanks to Christopher Armstrong
3959 3965 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3960 3966 introduced recently (in 0.2.14pre37) with the fix to the eval
3961 3967 problem mentioned below.
3962 3968
3963 3969 2002-10-17 Fernando Perez <fperez@colorado.edu>
3964 3970
3965 3971 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3966 3972 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3967 3973
3968 3974 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3969 3975 this function to fix a problem reported by Alex Schmolck. He saw
3970 3976 it with list comprehensions and generators, which were getting
3971 3977 called twice. The real problem was an 'eval' call in testing for
3972 3978 automagic which was evaluating the input line silently.
3973 3979
3974 3980 This is a potentially very nasty bug, if the input has side
3975 3981 effects which must not be repeated. The code is much cleaner now,
3976 3982 without any blanket 'except' left and with a regexp test for
3977 3983 actual function names.
3978 3984
3979 3985 But an eval remains, which I'm not fully comfortable with. I just
3980 3986 don't know how to find out if an expression could be a callable in
3981 3987 the user's namespace without doing an eval on the string. However
3982 3988 that string is now much more strictly checked so that no code
3983 3989 slips by, so the eval should only happen for things that can
3984 3990 really be only function/method names.
3985 3991
3986 3992 2002-10-15 Fernando Perez <fperez@colorado.edu>
3987 3993
3988 3994 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3989 3995 OSX information to main manual, removed README_Mac_OSX file from
3990 3996 distribution. Also updated credits for recent additions.
3991 3997
3992 3998 2002-10-10 Fernando Perez <fperez@colorado.edu>
3993 3999
3994 4000 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3995 4001 terminal-related issues. Many thanks to Andrea Riciputi
3996 4002 <andrea.riciputi-AT-libero.it> for writing it.
3997 4003
3998 4004 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3999 4005 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4000 4006
4001 4007 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4002 4008 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4003 4009 <syver-en-AT-online.no> who both submitted patches for this problem.
4004 4010
4005 4011 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4006 4012 global embedding to make sure that things don't overwrite user
4007 4013 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4008 4014
4009 4015 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4010 4016 compatibility. Thanks to Hayden Callow
4011 4017 <h.callow-AT-elec.canterbury.ac.nz>
4012 4018
4013 4019 2002-10-04 Fernando Perez <fperez@colorado.edu>
4014 4020
4015 4021 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4016 4022 Gnuplot.File objects.
4017 4023
4018 4024 2002-07-23 Fernando Perez <fperez@colorado.edu>
4019 4025
4020 4026 * IPython/genutils.py (timing): Added timings() and timing() for
4021 4027 quick access to the most commonly needed data, the execution
4022 4028 times. Old timing() renamed to timings_out().
4023 4029
4024 4030 2002-07-18 Fernando Perez <fperez@colorado.edu>
4025 4031
4026 4032 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4027 4033 bug with nested instances disrupting the parent's tab completion.
4028 4034
4029 4035 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4030 4036 all_completions code to begin the emacs integration.
4031 4037
4032 4038 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4033 4039 argument to allow titling individual arrays when plotting.
4034 4040
4035 4041 2002-07-15 Fernando Perez <fperez@colorado.edu>
4036 4042
4037 4043 * setup.py (make_shortcut): changed to retrieve the value of
4038 4044 'Program Files' directory from the registry (this value changes in
4039 4045 non-english versions of Windows). Thanks to Thomas Fanslau
4040 4046 <tfanslau-AT-gmx.de> for the report.
4041 4047
4042 4048 2002-07-10 Fernando Perez <fperez@colorado.edu>
4043 4049
4044 4050 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4045 4051 a bug in pdb, which crashes if a line with only whitespace is
4046 4052 entered. Bug report submitted to sourceforge.
4047 4053
4048 4054 2002-07-09 Fernando Perez <fperez@colorado.edu>
4049 4055
4050 4056 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4051 4057 reporting exceptions (it's a bug in inspect.py, I just set a
4052 4058 workaround).
4053 4059
4054 4060 2002-07-08 Fernando Perez <fperez@colorado.edu>
4055 4061
4056 4062 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4057 4063 __IPYTHON__ in __builtins__ to show up in user_ns.
4058 4064
4059 4065 2002-07-03 Fernando Perez <fperez@colorado.edu>
4060 4066
4061 4067 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4062 4068 name from @gp_set_instance to @gp_set_default.
4063 4069
4064 4070 * IPython/ipmaker.py (make_IPython): default editor value set to
4065 4071 '0' (a string), to match the rc file. Otherwise will crash when
4066 4072 .strip() is called on it.
4067 4073
4068 4074
4069 4075 2002-06-28 Fernando Perez <fperez@colorado.edu>
4070 4076
4071 4077 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4072 4078 of files in current directory when a file is executed via
4073 4079 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4074 4080
4075 4081 * setup.py (manfiles): fix for rpm builds, submitted by RA
4076 4082 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4077 4083
4078 4084 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4079 4085 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4080 4086 string!). A. Schmolck caught this one.
4081 4087
4082 4088 2002-06-27 Fernando Perez <fperez@colorado.edu>
4083 4089
4084 4090 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4085 4091 defined files at the cmd line. __name__ wasn't being set to
4086 4092 __main__.
4087 4093
4088 4094 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4089 4095 regular lists and tuples besides Numeric arrays.
4090 4096
4091 4097 * IPython/Prompts.py (CachedOutput.__call__): Added output
4092 4098 supression for input ending with ';'. Similar to Mathematica and
4093 4099 Matlab. The _* vars and Out[] list are still updated, just like
4094 4100 Mathematica behaves.
4095 4101
4096 4102 2002-06-25 Fernando Perez <fperez@colorado.edu>
4097 4103
4098 4104 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4099 4105 .ini extensions for profiels under Windows.
4100 4106
4101 4107 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4102 4108 string form. Fix contributed by Alexander Schmolck
4103 4109 <a.schmolck-AT-gmx.net>
4104 4110
4105 4111 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4106 4112 pre-configured Gnuplot instance.
4107 4113
4108 4114 2002-06-21 Fernando Perez <fperez@colorado.edu>
4109 4115
4110 4116 * IPython/numutils.py (exp_safe): new function, works around the
4111 4117 underflow problems in Numeric.
4112 4118 (log2): New fn. Safe log in base 2: returns exact integer answer
4113 4119 for exact integer powers of 2.
4114 4120
4115 4121 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4116 4122 properly.
4117 4123
4118 4124 2002-06-20 Fernando Perez <fperez@colorado.edu>
4119 4125
4120 4126 * IPython/genutils.py (timing): new function like
4121 4127 Mathematica's. Similar to time_test, but returns more info.
4122 4128
4123 4129 2002-06-18 Fernando Perez <fperez@colorado.edu>
4124 4130
4125 4131 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4126 4132 according to Mike Heeter's suggestions.
4127 4133
4128 4134 2002-06-16 Fernando Perez <fperez@colorado.edu>
4129 4135
4130 4136 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4131 4137 system. GnuplotMagic is gone as a user-directory option. New files
4132 4138 make it easier to use all the gnuplot stuff both from external
4133 4139 programs as well as from IPython. Had to rewrite part of
4134 4140 hardcopy() b/c of a strange bug: often the ps files simply don't
4135 4141 get created, and require a repeat of the command (often several
4136 4142 times).
4137 4143
4138 4144 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4139 4145 resolve output channel at call time, so that if sys.stderr has
4140 4146 been redirected by user this gets honored.
4141 4147
4142 4148 2002-06-13 Fernando Perez <fperez@colorado.edu>
4143 4149
4144 4150 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4145 4151 IPShell. Kept a copy with the old names to avoid breaking people's
4146 4152 embedded code.
4147 4153
4148 4154 * IPython/ipython: simplified it to the bare minimum after
4149 4155 Holger's suggestions. Added info about how to use it in
4150 4156 PYTHONSTARTUP.
4151 4157
4152 4158 * IPython/Shell.py (IPythonShell): changed the options passing
4153 4159 from a string with funky %s replacements to a straight list. Maybe
4154 4160 a bit more typing, but it follows sys.argv conventions, so there's
4155 4161 less special-casing to remember.
4156 4162
4157 4163 2002-06-12 Fernando Perez <fperez@colorado.edu>
4158 4164
4159 4165 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4160 4166 command. Thanks to a suggestion by Mike Heeter.
4161 4167 (Magic.magic_pfile): added behavior to look at filenames if given
4162 4168 arg is not a defined object.
4163 4169 (Magic.magic_save): New @save function to save code snippets. Also
4164 4170 a Mike Heeter idea.
4165 4171
4166 4172 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4167 4173 plot() and replot(). Much more convenient now, especially for
4168 4174 interactive use.
4169 4175
4170 4176 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4171 4177 filenames.
4172 4178
4173 4179 2002-06-02 Fernando Perez <fperez@colorado.edu>
4174 4180
4175 4181 * IPython/Struct.py (Struct.__init__): modified to admit
4176 4182 initialization via another struct.
4177 4183
4178 4184 * IPython/genutils.py (SystemExec.__init__): New stateful
4179 4185 interface to xsys and bq. Useful for writing system scripts.
4180 4186
4181 4187 2002-05-30 Fernando Perez <fperez@colorado.edu>
4182 4188
4183 4189 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4184 4190 documents. This will make the user download smaller (it's getting
4185 4191 too big).
4186 4192
4187 4193 2002-05-29 Fernando Perez <fperez@colorado.edu>
4188 4194
4189 4195 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4190 4196 fix problems with shelve and pickle. Seems to work, but I don't
4191 4197 know if corner cases break it. Thanks to Mike Heeter
4192 4198 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4193 4199
4194 4200 2002-05-24 Fernando Perez <fperez@colorado.edu>
4195 4201
4196 4202 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4197 4203 macros having broken.
4198 4204
4199 4205 2002-05-21 Fernando Perez <fperez@colorado.edu>
4200 4206
4201 4207 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4202 4208 introduced logging bug: all history before logging started was
4203 4209 being written one character per line! This came from the redesign
4204 4210 of the input history as a special list which slices to strings,
4205 4211 not to lists.
4206 4212
4207 4213 2002-05-20 Fernando Perez <fperez@colorado.edu>
4208 4214
4209 4215 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4210 4216 be an attribute of all classes in this module. The design of these
4211 4217 classes needs some serious overhauling.
4212 4218
4213 4219 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4214 4220 which was ignoring '_' in option names.
4215 4221
4216 4222 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4217 4223 'Verbose_novars' to 'Context' and made it the new default. It's a
4218 4224 bit more readable and also safer than verbose.
4219 4225
4220 4226 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4221 4227 triple-quoted strings.
4222 4228
4223 4229 * IPython/OInspect.py (__all__): new module exposing the object
4224 4230 introspection facilities. Now the corresponding magics are dummy
4225 4231 wrappers around this. Having this module will make it much easier
4226 4232 to put these functions into our modified pdb.
4227 4233 This new object inspector system uses the new colorizing module,
4228 4234 so source code and other things are nicely syntax highlighted.
4229 4235
4230 4236 2002-05-18 Fernando Perez <fperez@colorado.edu>
4231 4237
4232 4238 * IPython/ColorANSI.py: Split the coloring tools into a separate
4233 4239 module so I can use them in other code easier (they were part of
4234 4240 ultraTB).
4235 4241
4236 4242 2002-05-17 Fernando Perez <fperez@colorado.edu>
4237 4243
4238 4244 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4239 4245 fixed it to set the global 'g' also to the called instance, as
4240 4246 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4241 4247 user's 'g' variables).
4242 4248
4243 4249 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4244 4250 global variables (aliases to _ih,_oh) so that users which expect
4245 4251 In[5] or Out[7] to work aren't unpleasantly surprised.
4246 4252 (InputList.__getslice__): new class to allow executing slices of
4247 4253 input history directly. Very simple class, complements the use of
4248 4254 macros.
4249 4255
4250 4256 2002-05-16 Fernando Perez <fperez@colorado.edu>
4251 4257
4252 4258 * setup.py (docdirbase): make doc directory be just doc/IPython
4253 4259 without version numbers, it will reduce clutter for users.
4254 4260
4255 4261 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4256 4262 execfile call to prevent possible memory leak. See for details:
4257 4263 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4258 4264
4259 4265 2002-05-15 Fernando Perez <fperez@colorado.edu>
4260 4266
4261 4267 * IPython/Magic.py (Magic.magic_psource): made the object
4262 4268 introspection names be more standard: pdoc, pdef, pfile and
4263 4269 psource. They all print/page their output, and it makes
4264 4270 remembering them easier. Kept old names for compatibility as
4265 4271 aliases.
4266 4272
4267 4273 2002-05-14 Fernando Perez <fperez@colorado.edu>
4268 4274
4269 4275 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4270 4276 what the mouse problem was. The trick is to use gnuplot with temp
4271 4277 files and NOT with pipes (for data communication), because having
4272 4278 both pipes and the mouse on is bad news.
4273 4279
4274 4280 2002-05-13 Fernando Perez <fperez@colorado.edu>
4275 4281
4276 4282 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4277 4283 bug. Information would be reported about builtins even when
4278 4284 user-defined functions overrode them.
4279 4285
4280 4286 2002-05-11 Fernando Perez <fperez@colorado.edu>
4281 4287
4282 4288 * IPython/__init__.py (__all__): removed FlexCompleter from
4283 4289 __all__ so that things don't fail in platforms without readline.
4284 4290
4285 4291 2002-05-10 Fernando Perez <fperez@colorado.edu>
4286 4292
4287 4293 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4288 4294 it requires Numeric, effectively making Numeric a dependency for
4289 4295 IPython.
4290 4296
4291 4297 * Released 0.2.13
4292 4298
4293 4299 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4294 4300 profiler interface. Now all the major options from the profiler
4295 4301 module are directly supported in IPython, both for single
4296 4302 expressions (@prun) and for full programs (@run -p).
4297 4303
4298 4304 2002-05-09 Fernando Perez <fperez@colorado.edu>
4299 4305
4300 4306 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4301 4307 magic properly formatted for screen.
4302 4308
4303 4309 * setup.py (make_shortcut): Changed things to put pdf version in
4304 4310 doc/ instead of doc/manual (had to change lyxport a bit).
4305 4311
4306 4312 * IPython/Magic.py (Profile.string_stats): made profile runs go
4307 4313 through pager (they are long and a pager allows searching, saving,
4308 4314 etc.)
4309 4315
4310 4316 2002-05-08 Fernando Perez <fperez@colorado.edu>
4311 4317
4312 4318 * Released 0.2.12
4313 4319
4314 4320 2002-05-06 Fernando Perez <fperez@colorado.edu>
4315 4321
4316 4322 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4317 4323 introduced); 'hist n1 n2' was broken.
4318 4324 (Magic.magic_pdb): added optional on/off arguments to @pdb
4319 4325 (Magic.magic_run): added option -i to @run, which executes code in
4320 4326 the IPython namespace instead of a clean one. Also added @irun as
4321 4327 an alias to @run -i.
4322 4328
4323 4329 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4324 4330 fixed (it didn't really do anything, the namespaces were wrong).
4325 4331
4326 4332 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4327 4333
4328 4334 * IPython/__init__.py (__all__): Fixed package namespace, now
4329 4335 'import IPython' does give access to IPython.<all> as
4330 4336 expected. Also renamed __release__ to Release.
4331 4337
4332 4338 * IPython/Debugger.py (__license__): created new Pdb class which
4333 4339 functions like a drop-in for the normal pdb.Pdb but does NOT
4334 4340 import readline by default. This way it doesn't muck up IPython's
4335 4341 readline handling, and now tab-completion finally works in the
4336 4342 debugger -- sort of. It completes things globally visible, but the
4337 4343 completer doesn't track the stack as pdb walks it. That's a bit
4338 4344 tricky, and I'll have to implement it later.
4339 4345
4340 4346 2002-05-05 Fernando Perez <fperez@colorado.edu>
4341 4347
4342 4348 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4343 4349 magic docstrings when printed via ? (explicit \'s were being
4344 4350 printed).
4345 4351
4346 4352 * IPython/ipmaker.py (make_IPython): fixed namespace
4347 4353 identification bug. Now variables loaded via logs or command-line
4348 4354 files are recognized in the interactive namespace by @who.
4349 4355
4350 4356 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4351 4357 log replay system stemming from the string form of Structs.
4352 4358
4353 4359 * IPython/Magic.py (Macro.__init__): improved macros to properly
4354 4360 handle magic commands in them.
4355 4361 (Magic.magic_logstart): usernames are now expanded so 'logstart
4356 4362 ~/mylog' now works.
4357 4363
4358 4364 * IPython/iplib.py (complete): fixed bug where paths starting with
4359 4365 '/' would be completed as magic names.
4360 4366
4361 4367 2002-05-04 Fernando Perez <fperez@colorado.edu>
4362 4368
4363 4369 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4364 4370 allow running full programs under the profiler's control.
4365 4371
4366 4372 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4367 4373 mode to report exceptions verbosely but without formatting
4368 4374 variables. This addresses the issue of ipython 'freezing' (it's
4369 4375 not frozen, but caught in an expensive formatting loop) when huge
4370 4376 variables are in the context of an exception.
4371 4377 (VerboseTB.text): Added '--->' markers at line where exception was
4372 4378 triggered. Much clearer to read, especially in NoColor modes.
4373 4379
4374 4380 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4375 4381 implemented in reverse when changing to the new parse_options().
4376 4382
4377 4383 2002-05-03 Fernando Perez <fperez@colorado.edu>
4378 4384
4379 4385 * IPython/Magic.py (Magic.parse_options): new function so that
4380 4386 magics can parse options easier.
4381 4387 (Magic.magic_prun): new function similar to profile.run(),
4382 4388 suggested by Chris Hart.
4383 4389 (Magic.magic_cd): fixed behavior so that it only changes if
4384 4390 directory actually is in history.
4385 4391
4386 4392 * IPython/usage.py (__doc__): added information about potential
4387 4393 slowness of Verbose exception mode when there are huge data
4388 4394 structures to be formatted (thanks to Archie Paulson).
4389 4395
4390 4396 * IPython/ipmaker.py (make_IPython): Changed default logging
4391 4397 (when simply called with -log) to use curr_dir/ipython.log in
4392 4398 rotate mode. Fixed crash which was occuring with -log before
4393 4399 (thanks to Jim Boyle).
4394 4400
4395 4401 2002-05-01 Fernando Perez <fperez@colorado.edu>
4396 4402
4397 4403 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4398 4404 was nasty -- though somewhat of a corner case).
4399 4405
4400 4406 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4401 4407 text (was a bug).
4402 4408
4403 4409 2002-04-30 Fernando Perez <fperez@colorado.edu>
4404 4410
4405 4411 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4406 4412 a print after ^D or ^C from the user so that the In[] prompt
4407 4413 doesn't over-run the gnuplot one.
4408 4414
4409 4415 2002-04-29 Fernando Perez <fperez@colorado.edu>
4410 4416
4411 4417 * Released 0.2.10
4412 4418
4413 4419 * IPython/__release__.py (version): get date dynamically.
4414 4420
4415 4421 * Misc. documentation updates thanks to Arnd's comments. Also ran
4416 4422 a full spellcheck on the manual (hadn't been done in a while).
4417 4423
4418 4424 2002-04-27 Fernando Perez <fperez@colorado.edu>
4419 4425
4420 4426 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4421 4427 starting a log in mid-session would reset the input history list.
4422 4428
4423 4429 2002-04-26 Fernando Perez <fperez@colorado.edu>
4424 4430
4425 4431 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4426 4432 all files were being included in an update. Now anything in
4427 4433 UserConfig that matches [A-Za-z]*.py will go (this excludes
4428 4434 __init__.py)
4429 4435
4430 4436 2002-04-25 Fernando Perez <fperez@colorado.edu>
4431 4437
4432 4438 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4433 4439 to __builtins__ so that any form of embedded or imported code can
4434 4440 test for being inside IPython.
4435 4441
4436 4442 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4437 4443 changed to GnuplotMagic because it's now an importable module,
4438 4444 this makes the name follow that of the standard Gnuplot module.
4439 4445 GnuplotMagic can now be loaded at any time in mid-session.
4440 4446
4441 4447 2002-04-24 Fernando Perez <fperez@colorado.edu>
4442 4448
4443 4449 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4444 4450 the globals (IPython has its own namespace) and the
4445 4451 PhysicalQuantity stuff is much better anyway.
4446 4452
4447 4453 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4448 4454 embedding example to standard user directory for
4449 4455 distribution. Also put it in the manual.
4450 4456
4451 4457 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4452 4458 instance as first argument (so it doesn't rely on some obscure
4453 4459 hidden global).
4454 4460
4455 4461 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4456 4462 delimiters. While it prevents ().TAB from working, it allows
4457 4463 completions in open (... expressions. This is by far a more common
4458 4464 case.
4459 4465
4460 4466 2002-04-23 Fernando Perez <fperez@colorado.edu>
4461 4467
4462 4468 * IPython/Extensions/InterpreterPasteInput.py: new
4463 4469 syntax-processing module for pasting lines with >>> or ... at the
4464 4470 start.
4465 4471
4466 4472 * IPython/Extensions/PhysicalQ_Interactive.py
4467 4473 (PhysicalQuantityInteractive.__int__): fixed to work with either
4468 4474 Numeric or math.
4469 4475
4470 4476 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4471 4477 provided profiles. Now we have:
4472 4478 -math -> math module as * and cmath with its own namespace.
4473 4479 -numeric -> Numeric as *, plus gnuplot & grace
4474 4480 -physics -> same as before
4475 4481
4476 4482 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4477 4483 user-defined magics wouldn't be found by @magic if they were
4478 4484 defined as class methods. Also cleaned up the namespace search
4479 4485 logic and the string building (to use %s instead of many repeated
4480 4486 string adds).
4481 4487
4482 4488 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4483 4489 of user-defined magics to operate with class methods (cleaner, in
4484 4490 line with the gnuplot code).
4485 4491
4486 4492 2002-04-22 Fernando Perez <fperez@colorado.edu>
4487 4493
4488 4494 * setup.py: updated dependency list so that manual is updated when
4489 4495 all included files change.
4490 4496
4491 4497 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4492 4498 the delimiter removal option (the fix is ugly right now).
4493 4499
4494 4500 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4495 4501 all of the math profile (quicker loading, no conflict between
4496 4502 g-9.8 and g-gnuplot).
4497 4503
4498 4504 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4499 4505 name of post-mortem files to IPython_crash_report.txt.
4500 4506
4501 4507 * Cleanup/update of the docs. Added all the new readline info and
4502 4508 formatted all lists as 'real lists'.
4503 4509
4504 4510 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4505 4511 tab-completion options, since the full readline parse_and_bind is
4506 4512 now accessible.
4507 4513
4508 4514 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4509 4515 handling of readline options. Now users can specify any string to
4510 4516 be passed to parse_and_bind(), as well as the delimiters to be
4511 4517 removed.
4512 4518 (InteractiveShell.__init__): Added __name__ to the global
4513 4519 namespace so that things like Itpl which rely on its existence
4514 4520 don't crash.
4515 4521 (InteractiveShell._prefilter): Defined the default with a _ so
4516 4522 that prefilter() is easier to override, while the default one
4517 4523 remains available.
4518 4524
4519 4525 2002-04-18 Fernando Perez <fperez@colorado.edu>
4520 4526
4521 4527 * Added information about pdb in the docs.
4522 4528
4523 4529 2002-04-17 Fernando Perez <fperez@colorado.edu>
4524 4530
4525 4531 * IPython/ipmaker.py (make_IPython): added rc_override option to
4526 4532 allow passing config options at creation time which may override
4527 4533 anything set in the config files or command line. This is
4528 4534 particularly useful for configuring embedded instances.
4529 4535
4530 4536 2002-04-15 Fernando Perez <fperez@colorado.edu>
4531 4537
4532 4538 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4533 4539 crash embedded instances because of the input cache falling out of
4534 4540 sync with the output counter.
4535 4541
4536 4542 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4537 4543 mode which calls pdb after an uncaught exception in IPython itself.
4538 4544
4539 4545 2002-04-14 Fernando Perez <fperez@colorado.edu>
4540 4546
4541 4547 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4542 4548 readline, fix it back after each call.
4543 4549
4544 4550 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4545 4551 method to force all access via __call__(), which guarantees that
4546 4552 traceback references are properly deleted.
4547 4553
4548 4554 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4549 4555 improve printing when pprint is in use.
4550 4556
4551 4557 2002-04-13 Fernando Perez <fperez@colorado.edu>
4552 4558
4553 4559 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4554 4560 exceptions aren't caught anymore. If the user triggers one, he
4555 4561 should know why he's doing it and it should go all the way up,
4556 4562 just like any other exception. So now @abort will fully kill the
4557 4563 embedded interpreter and the embedding code (unless that happens
4558 4564 to catch SystemExit).
4559 4565
4560 4566 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4561 4567 and a debugger() method to invoke the interactive pdb debugger
4562 4568 after printing exception information. Also added the corresponding
4563 4569 -pdb option and @pdb magic to control this feature, and updated
4564 4570 the docs. After a suggestion from Christopher Hart
4565 4571 (hart-AT-caltech.edu).
4566 4572
4567 4573 2002-04-12 Fernando Perez <fperez@colorado.edu>
4568 4574
4569 4575 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4570 4576 the exception handlers defined by the user (not the CrashHandler)
4571 4577 so that user exceptions don't trigger an ipython bug report.
4572 4578
4573 4579 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4574 4580 configurable (it should have always been so).
4575 4581
4576 4582 2002-03-26 Fernando Perez <fperez@colorado.edu>
4577 4583
4578 4584 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4579 4585 and there to fix embedding namespace issues. This should all be
4580 4586 done in a more elegant way.
4581 4587
4582 4588 2002-03-25 Fernando Perez <fperez@colorado.edu>
4583 4589
4584 4590 * IPython/genutils.py (get_home_dir): Try to make it work under
4585 4591 win9x also.
4586 4592
4587 4593 2002-03-20 Fernando Perez <fperez@colorado.edu>
4588 4594
4589 4595 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4590 4596 sys.displayhook untouched upon __init__.
4591 4597
4592 4598 2002-03-19 Fernando Perez <fperez@colorado.edu>
4593 4599
4594 4600 * Released 0.2.9 (for embedding bug, basically).
4595 4601
4596 4602 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4597 4603 exceptions so that enclosing shell's state can be restored.
4598 4604
4599 4605 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4600 4606 naming conventions in the .ipython/ dir.
4601 4607
4602 4608 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4603 4609 from delimiters list so filenames with - in them get expanded.
4604 4610
4605 4611 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4606 4612 sys.displayhook not being properly restored after an embedded call.
4607 4613
4608 4614 2002-03-18 Fernando Perez <fperez@colorado.edu>
4609 4615
4610 4616 * Released 0.2.8
4611 4617
4612 4618 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4613 4619 some files weren't being included in a -upgrade.
4614 4620 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4615 4621 on' so that the first tab completes.
4616 4622 (InteractiveShell.handle_magic): fixed bug with spaces around
4617 4623 quotes breaking many magic commands.
4618 4624
4619 4625 * setup.py: added note about ignoring the syntax error messages at
4620 4626 installation.
4621 4627
4622 4628 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4623 4629 streamlining the gnuplot interface, now there's only one magic @gp.
4624 4630
4625 4631 2002-03-17 Fernando Perez <fperez@colorado.edu>
4626 4632
4627 4633 * IPython/UserConfig/magic_gnuplot.py: new name for the
4628 4634 example-magic_pm.py file. Much enhanced system, now with a shell
4629 4635 for communicating directly with gnuplot, one command at a time.
4630 4636
4631 4637 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4632 4638 setting __name__=='__main__'.
4633 4639
4634 4640 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4635 4641 mini-shell for accessing gnuplot from inside ipython. Should
4636 4642 extend it later for grace access too. Inspired by Arnd's
4637 4643 suggestion.
4638 4644
4639 4645 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4640 4646 calling magic functions with () in their arguments. Thanks to Arnd
4641 4647 Baecker for pointing this to me.
4642 4648
4643 4649 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4644 4650 infinitely for integer or complex arrays (only worked with floats).
4645 4651
4646 4652 2002-03-16 Fernando Perez <fperez@colorado.edu>
4647 4653
4648 4654 * setup.py: Merged setup and setup_windows into a single script
4649 4655 which properly handles things for windows users.
4650 4656
4651 4657 2002-03-15 Fernando Perez <fperez@colorado.edu>
4652 4658
4653 4659 * Big change to the manual: now the magics are all automatically
4654 4660 documented. This information is generated from their docstrings
4655 4661 and put in a latex file included by the manual lyx file. This way
4656 4662 we get always up to date information for the magics. The manual
4657 4663 now also has proper version information, also auto-synced.
4658 4664
4659 4665 For this to work, an undocumented --magic_docstrings option was added.
4660 4666
4661 4667 2002-03-13 Fernando Perez <fperez@colorado.edu>
4662 4668
4663 4669 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4664 4670 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4665 4671
4666 4672 2002-03-12 Fernando Perez <fperez@colorado.edu>
4667 4673
4668 4674 * IPython/ultraTB.py (TermColors): changed color escapes again to
4669 4675 fix the (old, reintroduced) line-wrapping bug. Basically, if
4670 4676 \001..\002 aren't given in the color escapes, lines get wrapped
4671 4677 weirdly. But giving those screws up old xterms and emacs terms. So
4672 4678 I added some logic for emacs terms to be ok, but I can't identify old
4673 4679 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4674 4680
4675 4681 2002-03-10 Fernando Perez <fperez@colorado.edu>
4676 4682
4677 4683 * IPython/usage.py (__doc__): Various documentation cleanups and
4678 4684 updates, both in usage docstrings and in the manual.
4679 4685
4680 4686 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4681 4687 handling of caching. Set minimum acceptabe value for having a
4682 4688 cache at 20 values.
4683 4689
4684 4690 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4685 4691 install_first_time function to a method, renamed it and added an
4686 4692 'upgrade' mode. Now people can update their config directory with
4687 4693 a simple command line switch (-upgrade, also new).
4688 4694
4689 4695 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4690 4696 @file (convenient for automagic users under Python >= 2.2).
4691 4697 Removed @files (it seemed more like a plural than an abbrev. of
4692 4698 'file show').
4693 4699
4694 4700 * IPython/iplib.py (install_first_time): Fixed crash if there were
4695 4701 backup files ('~') in .ipython/ install directory.
4696 4702
4697 4703 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4698 4704 system. Things look fine, but these changes are fairly
4699 4705 intrusive. Test them for a few days.
4700 4706
4701 4707 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4702 4708 the prompts system. Now all in/out prompt strings are user
4703 4709 controllable. This is particularly useful for embedding, as one
4704 4710 can tag embedded instances with particular prompts.
4705 4711
4706 4712 Also removed global use of sys.ps1/2, which now allows nested
4707 4713 embeddings without any problems. Added command-line options for
4708 4714 the prompt strings.
4709 4715
4710 4716 2002-03-08 Fernando Perez <fperez@colorado.edu>
4711 4717
4712 4718 * IPython/UserConfig/example-embed-short.py (ipshell): added
4713 4719 example file with the bare minimum code for embedding.
4714 4720
4715 4721 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4716 4722 functionality for the embeddable shell to be activated/deactivated
4717 4723 either globally or at each call.
4718 4724
4719 4725 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4720 4726 rewriting the prompt with '--->' for auto-inputs with proper
4721 4727 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4722 4728 this is handled by the prompts class itself, as it should.
4723 4729
4724 4730 2002-03-05 Fernando Perez <fperez@colorado.edu>
4725 4731
4726 4732 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4727 4733 @logstart to avoid name clashes with the math log function.
4728 4734
4729 4735 * Big updates to X/Emacs section of the manual.
4730 4736
4731 4737 * Removed ipython_emacs. Milan explained to me how to pass
4732 4738 arguments to ipython through Emacs. Some day I'm going to end up
4733 4739 learning some lisp...
4734 4740
4735 4741 2002-03-04 Fernando Perez <fperez@colorado.edu>
4736 4742
4737 4743 * IPython/ipython_emacs: Created script to be used as the
4738 4744 py-python-command Emacs variable so we can pass IPython
4739 4745 parameters. I can't figure out how to tell Emacs directly to pass
4740 4746 parameters to IPython, so a dummy shell script will do it.
4741 4747
4742 4748 Other enhancements made for things to work better under Emacs'
4743 4749 various types of terminals. Many thanks to Milan Zamazal
4744 4750 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4745 4751
4746 4752 2002-03-01 Fernando Perez <fperez@colorado.edu>
4747 4753
4748 4754 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4749 4755 that loading of readline is now optional. This gives better
4750 4756 control to emacs users.
4751 4757
4752 4758 * IPython/ultraTB.py (__date__): Modified color escape sequences
4753 4759 and now things work fine under xterm and in Emacs' term buffers
4754 4760 (though not shell ones). Well, in emacs you get colors, but all
4755 4761 seem to be 'light' colors (no difference between dark and light
4756 4762 ones). But the garbage chars are gone, and also in xterms. It
4757 4763 seems that now I'm using 'cleaner' ansi sequences.
4758 4764
4759 4765 2002-02-21 Fernando Perez <fperez@colorado.edu>
4760 4766
4761 4767 * Released 0.2.7 (mainly to publish the scoping fix).
4762 4768
4763 4769 * IPython/Logger.py (Logger.logstate): added. A corresponding
4764 4770 @logstate magic was created.
4765 4771
4766 4772 * IPython/Magic.py: fixed nested scoping problem under Python
4767 4773 2.1.x (automagic wasn't working).
4768 4774
4769 4775 2002-02-20 Fernando Perez <fperez@colorado.edu>
4770 4776
4771 4777 * Released 0.2.6.
4772 4778
4773 4779 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4774 4780 option so that logs can come out without any headers at all.
4775 4781
4776 4782 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4777 4783 SciPy.
4778 4784
4779 4785 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4780 4786 that embedded IPython calls don't require vars() to be explicitly
4781 4787 passed. Now they are extracted from the caller's frame (code
4782 4788 snatched from Eric Jones' weave). Added better documentation to
4783 4789 the section on embedding and the example file.
4784 4790
4785 4791 * IPython/genutils.py (page): Changed so that under emacs, it just
4786 4792 prints the string. You can then page up and down in the emacs
4787 4793 buffer itself. This is how the builtin help() works.
4788 4794
4789 4795 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4790 4796 macro scoping: macros need to be executed in the user's namespace
4791 4797 to work as if they had been typed by the user.
4792 4798
4793 4799 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4794 4800 execute automatically (no need to type 'exec...'). They then
4795 4801 behave like 'true macros'. The printing system was also modified
4796 4802 for this to work.
4797 4803
4798 4804 2002-02-19 Fernando Perez <fperez@colorado.edu>
4799 4805
4800 4806 * IPython/genutils.py (page_file): new function for paging files
4801 4807 in an OS-independent way. Also necessary for file viewing to work
4802 4808 well inside Emacs buffers.
4803 4809 (page): Added checks for being in an emacs buffer.
4804 4810 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4805 4811 same bug in iplib.
4806 4812
4807 4813 2002-02-18 Fernando Perez <fperez@colorado.edu>
4808 4814
4809 4815 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4810 4816 of readline so that IPython can work inside an Emacs buffer.
4811 4817
4812 4818 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4813 4819 method signatures (they weren't really bugs, but it looks cleaner
4814 4820 and keeps PyChecker happy).
4815 4821
4816 4822 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4817 4823 for implementing various user-defined hooks. Currently only
4818 4824 display is done.
4819 4825
4820 4826 * IPython/Prompts.py (CachedOutput._display): changed display
4821 4827 functions so that they can be dynamically changed by users easily.
4822 4828
4823 4829 * IPython/Extensions/numeric_formats.py (num_display): added an
4824 4830 extension for printing NumPy arrays in flexible manners. It
4825 4831 doesn't do anything yet, but all the structure is in
4826 4832 place. Ultimately the plan is to implement output format control
4827 4833 like in Octave.
4828 4834
4829 4835 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4830 4836 methods are found at run-time by all the automatic machinery.
4831 4837
4832 4838 2002-02-17 Fernando Perez <fperez@colorado.edu>
4833 4839
4834 4840 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4835 4841 whole file a little.
4836 4842
4837 4843 * ToDo: closed this document. Now there's a new_design.lyx
4838 4844 document for all new ideas. Added making a pdf of it for the
4839 4845 end-user distro.
4840 4846
4841 4847 * IPython/Logger.py (Logger.switch_log): Created this to replace
4842 4848 logon() and logoff(). It also fixes a nasty crash reported by
4843 4849 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4844 4850
4845 4851 * IPython/iplib.py (complete): got auto-completion to work with
4846 4852 automagic (I had wanted this for a long time).
4847 4853
4848 4854 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4849 4855 to @file, since file() is now a builtin and clashes with automagic
4850 4856 for @file.
4851 4857
4852 4858 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4853 4859 of this was previously in iplib, which had grown to more than 2000
4854 4860 lines, way too long. No new functionality, but it makes managing
4855 4861 the code a bit easier.
4856 4862
4857 4863 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4858 4864 information to crash reports.
4859 4865
4860 4866 2002-02-12 Fernando Perez <fperez@colorado.edu>
4861 4867
4862 4868 * Released 0.2.5.
4863 4869
4864 4870 2002-02-11 Fernando Perez <fperez@colorado.edu>
4865 4871
4866 4872 * Wrote a relatively complete Windows installer. It puts
4867 4873 everything in place, creates Start Menu entries and fixes the
4868 4874 color issues. Nothing fancy, but it works.
4869 4875
4870 4876 2002-02-10 Fernando Perez <fperez@colorado.edu>
4871 4877
4872 4878 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4873 4879 os.path.expanduser() call so that we can type @run ~/myfile.py and
4874 4880 have thigs work as expected.
4875 4881
4876 4882 * IPython/genutils.py (page): fixed exception handling so things
4877 4883 work both in Unix and Windows correctly. Quitting a pager triggers
4878 4884 an IOError/broken pipe in Unix, and in windows not finding a pager
4879 4885 is also an IOError, so I had to actually look at the return value
4880 4886 of the exception, not just the exception itself. Should be ok now.
4881 4887
4882 4888 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4883 4889 modified to allow case-insensitive color scheme changes.
4884 4890
4885 4891 2002-02-09 Fernando Perez <fperez@colorado.edu>
4886 4892
4887 4893 * IPython/genutils.py (native_line_ends): new function to leave
4888 4894 user config files with os-native line-endings.
4889 4895
4890 4896 * README and manual updates.
4891 4897
4892 4898 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4893 4899 instead of StringType to catch Unicode strings.
4894 4900
4895 4901 * IPython/genutils.py (filefind): fixed bug for paths with
4896 4902 embedded spaces (very common in Windows).
4897 4903
4898 4904 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4899 4905 files under Windows, so that they get automatically associated
4900 4906 with a text editor. Windows makes it a pain to handle
4901 4907 extension-less files.
4902 4908
4903 4909 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4904 4910 warning about readline only occur for Posix. In Windows there's no
4905 4911 way to get readline, so why bother with the warning.
4906 4912
4907 4913 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4908 4914 for __str__ instead of dir(self), since dir() changed in 2.2.
4909 4915
4910 4916 * Ported to Windows! Tested on XP, I suspect it should work fine
4911 4917 on NT/2000, but I don't think it will work on 98 et al. That
4912 4918 series of Windows is such a piece of junk anyway that I won't try
4913 4919 porting it there. The XP port was straightforward, showed a few
4914 4920 bugs here and there (fixed all), in particular some string
4915 4921 handling stuff which required considering Unicode strings (which
4916 4922 Windows uses). This is good, but hasn't been too tested :) No
4917 4923 fancy installer yet, I'll put a note in the manual so people at
4918 4924 least make manually a shortcut.
4919 4925
4920 4926 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4921 4927 into a single one, "colors". This now controls both prompt and
4922 4928 exception color schemes, and can be changed both at startup
4923 4929 (either via command-line switches or via ipythonrc files) and at
4924 4930 runtime, with @colors.
4925 4931 (Magic.magic_run): renamed @prun to @run and removed the old
4926 4932 @run. The two were too similar to warrant keeping both.
4927 4933
4928 4934 2002-02-03 Fernando Perez <fperez@colorado.edu>
4929 4935
4930 4936 * IPython/iplib.py (install_first_time): Added comment on how to
4931 4937 configure the color options for first-time users. Put a <return>
4932 4938 request at the end so that small-terminal users get a chance to
4933 4939 read the startup info.
4934 4940
4935 4941 2002-01-23 Fernando Perez <fperez@colorado.edu>
4936 4942
4937 4943 * IPython/iplib.py (CachedOutput.update): Changed output memory
4938 4944 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4939 4945 input history we still use _i. Did this b/c these variable are
4940 4946 very commonly used in interactive work, so the less we need to
4941 4947 type the better off we are.
4942 4948 (Magic.magic_prun): updated @prun to better handle the namespaces
4943 4949 the file will run in, including a fix for __name__ not being set
4944 4950 before.
4945 4951
4946 4952 2002-01-20 Fernando Perez <fperez@colorado.edu>
4947 4953
4948 4954 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4949 4955 extra garbage for Python 2.2. Need to look more carefully into
4950 4956 this later.
4951 4957
4952 4958 2002-01-19 Fernando Perez <fperez@colorado.edu>
4953 4959
4954 4960 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4955 4961 display SyntaxError exceptions properly formatted when they occur
4956 4962 (they can be triggered by imported code).
4957 4963
4958 4964 2002-01-18 Fernando Perez <fperez@colorado.edu>
4959 4965
4960 4966 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4961 4967 SyntaxError exceptions are reported nicely formatted, instead of
4962 4968 spitting out only offset information as before.
4963 4969 (Magic.magic_prun): Added the @prun function for executing
4964 4970 programs with command line args inside IPython.
4965 4971
4966 4972 2002-01-16 Fernando Perez <fperez@colorado.edu>
4967 4973
4968 4974 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4969 4975 to *not* include the last item given in a range. This brings their
4970 4976 behavior in line with Python's slicing:
4971 4977 a[n1:n2] -> a[n1]...a[n2-1]
4972 4978 It may be a bit less convenient, but I prefer to stick to Python's
4973 4979 conventions *everywhere*, so users never have to wonder.
4974 4980 (Magic.magic_macro): Added @macro function to ease the creation of
4975 4981 macros.
4976 4982
4977 4983 2002-01-05 Fernando Perez <fperez@colorado.edu>
4978 4984
4979 4985 * Released 0.2.4.
4980 4986
4981 4987 * IPython/iplib.py (Magic.magic_pdef):
4982 4988 (InteractiveShell.safe_execfile): report magic lines and error
4983 4989 lines without line numbers so one can easily copy/paste them for
4984 4990 re-execution.
4985 4991
4986 4992 * Updated manual with recent changes.
4987 4993
4988 4994 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4989 4995 docstring printing when class? is called. Very handy for knowing
4990 4996 how to create class instances (as long as __init__ is well
4991 4997 documented, of course :)
4992 4998 (Magic.magic_doc): print both class and constructor docstrings.
4993 4999 (Magic.magic_pdef): give constructor info if passed a class and
4994 5000 __call__ info for callable object instances.
4995 5001
4996 5002 2002-01-04 Fernando Perez <fperez@colorado.edu>
4997 5003
4998 5004 * Made deep_reload() off by default. It doesn't always work
4999 5005 exactly as intended, so it's probably safer to have it off. It's
5000 5006 still available as dreload() anyway, so nothing is lost.
5001 5007
5002 5008 2002-01-02 Fernando Perez <fperez@colorado.edu>
5003 5009
5004 5010 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5005 5011 so I wanted an updated release).
5006 5012
5007 5013 2001-12-27 Fernando Perez <fperez@colorado.edu>
5008 5014
5009 5015 * IPython/iplib.py (InteractiveShell.interact): Added the original
5010 5016 code from 'code.py' for this module in order to change the
5011 5017 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5012 5018 the history cache would break when the user hit Ctrl-C, and
5013 5019 interact() offers no way to add any hooks to it.
5014 5020
5015 5021 2001-12-23 Fernando Perez <fperez@colorado.edu>
5016 5022
5017 5023 * setup.py: added check for 'MANIFEST' before trying to remove
5018 5024 it. Thanks to Sean Reifschneider.
5019 5025
5020 5026 2001-12-22 Fernando Perez <fperez@colorado.edu>
5021 5027
5022 5028 * Released 0.2.2.
5023 5029
5024 5030 * Finished (reasonably) writing the manual. Later will add the
5025 5031 python-standard navigation stylesheets, but for the time being
5026 5032 it's fairly complete. Distribution will include html and pdf
5027 5033 versions.
5028 5034
5029 5035 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5030 5036 (MayaVi author).
5031 5037
5032 5038 2001-12-21 Fernando Perez <fperez@colorado.edu>
5033 5039
5034 5040 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5035 5041 good public release, I think (with the manual and the distutils
5036 5042 installer). The manual can use some work, but that can go
5037 5043 slowly. Otherwise I think it's quite nice for end users. Next
5038 5044 summer, rewrite the guts of it...
5039 5045
5040 5046 * Changed format of ipythonrc files to use whitespace as the
5041 5047 separator instead of an explicit '='. Cleaner.
5042 5048
5043 5049 2001-12-20 Fernando Perez <fperez@colorado.edu>
5044 5050
5045 5051 * Started a manual in LyX. For now it's just a quick merge of the
5046 5052 various internal docstrings and READMEs. Later it may grow into a
5047 5053 nice, full-blown manual.
5048 5054
5049 5055 * Set up a distutils based installer. Installation should now be
5050 5056 trivially simple for end-users.
5051 5057
5052 5058 2001-12-11 Fernando Perez <fperez@colorado.edu>
5053 5059
5054 5060 * Released 0.2.0. First public release, announced it at
5055 5061 comp.lang.python. From now on, just bugfixes...
5056 5062
5057 5063 * Went through all the files, set copyright/license notices and
5058 5064 cleaned up things. Ready for release.
5059 5065
5060 5066 2001-12-10 Fernando Perez <fperez@colorado.edu>
5061 5067
5062 5068 * Changed the first-time installer not to use tarfiles. It's more
5063 5069 robust now and less unix-dependent. Also makes it easier for
5064 5070 people to later upgrade versions.
5065 5071
5066 5072 * Changed @exit to @abort to reflect the fact that it's pretty
5067 5073 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5068 5074 becomes significant only when IPyhton is embedded: in that case,
5069 5075 C-D closes IPython only, but @abort kills the enclosing program
5070 5076 too (unless it had called IPython inside a try catching
5071 5077 SystemExit).
5072 5078
5073 5079 * Created Shell module which exposes the actuall IPython Shell
5074 5080 classes, currently the normal and the embeddable one. This at
5075 5081 least offers a stable interface we won't need to change when
5076 5082 (later) the internals are rewritten. That rewrite will be confined
5077 5083 to iplib and ipmaker, but the Shell interface should remain as is.
5078 5084
5079 5085 * Added embed module which offers an embeddable IPShell object,
5080 5086 useful to fire up IPython *inside* a running program. Great for
5081 5087 debugging or dynamical data analysis.
5082 5088
5083 5089 2001-12-08 Fernando Perez <fperez@colorado.edu>
5084 5090
5085 5091 * Fixed small bug preventing seeing info from methods of defined
5086 5092 objects (incorrect namespace in _ofind()).
5087 5093
5088 5094 * Documentation cleanup. Moved the main usage docstrings to a
5089 5095 separate file, usage.py (cleaner to maintain, and hopefully in the
5090 5096 future some perlpod-like way of producing interactive, man and
5091 5097 html docs out of it will be found).
5092 5098
5093 5099 * Added @profile to see your profile at any time.
5094 5100
5095 5101 * Added @p as an alias for 'print'. It's especially convenient if
5096 5102 using automagic ('p x' prints x).
5097 5103
5098 5104 * Small cleanups and fixes after a pychecker run.
5099 5105
5100 5106 * Changed the @cd command to handle @cd - and @cd -<n> for
5101 5107 visiting any directory in _dh.
5102 5108
5103 5109 * Introduced _dh, a history of visited directories. @dhist prints
5104 5110 it out with numbers.
5105 5111
5106 5112 2001-12-07 Fernando Perez <fperez@colorado.edu>
5107 5113
5108 5114 * Released 0.1.22
5109 5115
5110 5116 * Made initialization a bit more robust against invalid color
5111 5117 options in user input (exit, not traceback-crash).
5112 5118
5113 5119 * Changed the bug crash reporter to write the report only in the
5114 5120 user's .ipython directory. That way IPython won't litter people's
5115 5121 hard disks with crash files all over the place. Also print on
5116 5122 screen the necessary mail command.
5117 5123
5118 5124 * With the new ultraTB, implemented LightBG color scheme for light
5119 5125 background terminals. A lot of people like white backgrounds, so I
5120 5126 guess we should at least give them something readable.
5121 5127
5122 5128 2001-12-06 Fernando Perez <fperez@colorado.edu>
5123 5129
5124 5130 * Modified the structure of ultraTB. Now there's a proper class
5125 5131 for tables of color schemes which allow adding schemes easily and
5126 5132 switching the active scheme without creating a new instance every
5127 5133 time (which was ridiculous). The syntax for creating new schemes
5128 5134 is also cleaner. I think ultraTB is finally done, with a clean
5129 5135 class structure. Names are also much cleaner (now there's proper
5130 5136 color tables, no need for every variable to also have 'color' in
5131 5137 its name).
5132 5138
5133 5139 * Broke down genutils into separate files. Now genutils only
5134 5140 contains utility functions, and classes have been moved to their
5135 5141 own files (they had enough independent functionality to warrant
5136 5142 it): ConfigLoader, OutputTrap, Struct.
5137 5143
5138 5144 2001-12-05 Fernando Perez <fperez@colorado.edu>
5139 5145
5140 5146 * IPython turns 21! Released version 0.1.21, as a candidate for
5141 5147 public consumption. If all goes well, release in a few days.
5142 5148
5143 5149 * Fixed path bug (files in Extensions/ directory wouldn't be found
5144 5150 unless IPython/ was explicitly in sys.path).
5145 5151
5146 5152 * Extended the FlexCompleter class as MagicCompleter to allow
5147 5153 completion of @-starting lines.
5148 5154
5149 5155 * Created __release__.py file as a central repository for release
5150 5156 info that other files can read from.
5151 5157
5152 5158 * Fixed small bug in logging: when logging was turned on in
5153 5159 mid-session, old lines with special meanings (!@?) were being
5154 5160 logged without the prepended comment, which is necessary since
5155 5161 they are not truly valid python syntax. This should make session
5156 5162 restores produce less errors.
5157 5163
5158 5164 * The namespace cleanup forced me to make a FlexCompleter class
5159 5165 which is nothing but a ripoff of rlcompleter, but with selectable
5160 5166 namespace (rlcompleter only works in __main__.__dict__). I'll try
5161 5167 to submit a note to the authors to see if this change can be
5162 5168 incorporated in future rlcompleter releases (Dec.6: done)
5163 5169
5164 5170 * More fixes to namespace handling. It was a mess! Now all
5165 5171 explicit references to __main__.__dict__ are gone (except when
5166 5172 really needed) and everything is handled through the namespace
5167 5173 dicts in the IPython instance. We seem to be getting somewhere
5168 5174 with this, finally...
5169 5175
5170 5176 * Small documentation updates.
5171 5177
5172 5178 * Created the Extensions directory under IPython (with an
5173 5179 __init__.py). Put the PhysicalQ stuff there. This directory should
5174 5180 be used for all special-purpose extensions.
5175 5181
5176 5182 * File renaming:
5177 5183 ipythonlib --> ipmaker
5178 5184 ipplib --> iplib
5179 5185 This makes a bit more sense in terms of what these files actually do.
5180 5186
5181 5187 * Moved all the classes and functions in ipythonlib to ipplib, so
5182 5188 now ipythonlib only has make_IPython(). This will ease up its
5183 5189 splitting in smaller functional chunks later.
5184 5190
5185 5191 * Cleaned up (done, I think) output of @whos. Better column
5186 5192 formatting, and now shows str(var) for as much as it can, which is
5187 5193 typically what one gets with a 'print var'.
5188 5194
5189 5195 2001-12-04 Fernando Perez <fperez@colorado.edu>
5190 5196
5191 5197 * Fixed namespace problems. Now builtin/IPyhton/user names get
5192 5198 properly reported in their namespace. Internal namespace handling
5193 5199 is finally getting decent (not perfect yet, but much better than
5194 5200 the ad-hoc mess we had).
5195 5201
5196 5202 * Removed -exit option. If people just want to run a python
5197 5203 script, that's what the normal interpreter is for. Less
5198 5204 unnecessary options, less chances for bugs.
5199 5205
5200 5206 * Added a crash handler which generates a complete post-mortem if
5201 5207 IPython crashes. This will help a lot in tracking bugs down the
5202 5208 road.
5203 5209
5204 5210 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5205 5211 which were boud to functions being reassigned would bypass the
5206 5212 logger, breaking the sync of _il with the prompt counter. This
5207 5213 would then crash IPython later when a new line was logged.
5208 5214
5209 5215 2001-12-02 Fernando Perez <fperez@colorado.edu>
5210 5216
5211 5217 * Made IPython a package. This means people don't have to clutter
5212 5218 their sys.path with yet another directory. Changed the INSTALL
5213 5219 file accordingly.
5214 5220
5215 5221 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5216 5222 sorts its output (so @who shows it sorted) and @whos formats the
5217 5223 table according to the width of the first column. Nicer, easier to
5218 5224 read. Todo: write a generic table_format() which takes a list of
5219 5225 lists and prints it nicely formatted, with optional row/column
5220 5226 separators and proper padding and justification.
5221 5227
5222 5228 * Released 0.1.20
5223 5229
5224 5230 * Fixed bug in @log which would reverse the inputcache list (a
5225 5231 copy operation was missing).
5226 5232
5227 5233 * Code cleanup. @config was changed to use page(). Better, since
5228 5234 its output is always quite long.
5229 5235
5230 5236 * Itpl is back as a dependency. I was having too many problems
5231 5237 getting the parametric aliases to work reliably, and it's just
5232 5238 easier to code weird string operations with it than playing %()s
5233 5239 games. It's only ~6k, so I don't think it's too big a deal.
5234 5240
5235 5241 * Found (and fixed) a very nasty bug with history. !lines weren't
5236 5242 getting cached, and the out of sync caches would crash
5237 5243 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5238 5244 division of labor a bit better. Bug fixed, cleaner structure.
5239 5245
5240 5246 2001-12-01 Fernando Perez <fperez@colorado.edu>
5241 5247
5242 5248 * Released 0.1.19
5243 5249
5244 5250 * Added option -n to @hist to prevent line number printing. Much
5245 5251 easier to copy/paste code this way.
5246 5252
5247 5253 * Created global _il to hold the input list. Allows easy
5248 5254 re-execution of blocks of code by slicing it (inspired by Janko's
5249 5255 comment on 'macros').
5250 5256
5251 5257 * Small fixes and doc updates.
5252 5258
5253 5259 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5254 5260 much too fragile with automagic. Handles properly multi-line
5255 5261 statements and takes parameters.
5256 5262
5257 5263 2001-11-30 Fernando Perez <fperez@colorado.edu>
5258 5264
5259 5265 * Version 0.1.18 released.
5260 5266
5261 5267 * Fixed nasty namespace bug in initial module imports.
5262 5268
5263 5269 * Added copyright/license notes to all code files (except
5264 5270 DPyGetOpt). For the time being, LGPL. That could change.
5265 5271
5266 5272 * Rewrote a much nicer README, updated INSTALL, cleaned up
5267 5273 ipythonrc-* samples.
5268 5274
5269 5275 * Overall code/documentation cleanup. Basically ready for
5270 5276 release. Only remaining thing: licence decision (LGPL?).
5271 5277
5272 5278 * Converted load_config to a class, ConfigLoader. Now recursion
5273 5279 control is better organized. Doesn't include the same file twice.
5274 5280
5275 5281 2001-11-29 Fernando Perez <fperez@colorado.edu>
5276 5282
5277 5283 * Got input history working. Changed output history variables from
5278 5284 _p to _o so that _i is for input and _o for output. Just cleaner
5279 5285 convention.
5280 5286
5281 5287 * Implemented parametric aliases. This pretty much allows the
5282 5288 alias system to offer full-blown shell convenience, I think.
5283 5289
5284 5290 * Version 0.1.17 released, 0.1.18 opened.
5285 5291
5286 5292 * dot_ipython/ipythonrc (alias): added documentation.
5287 5293 (xcolor): Fixed small bug (xcolors -> xcolor)
5288 5294
5289 5295 * Changed the alias system. Now alias is a magic command to define
5290 5296 aliases just like the shell. Rationale: the builtin magics should
5291 5297 be there for things deeply connected to IPython's
5292 5298 architecture. And this is a much lighter system for what I think
5293 5299 is the really important feature: allowing users to define quickly
5294 5300 magics that will do shell things for them, so they can customize
5295 5301 IPython easily to match their work habits. If someone is really
5296 5302 desperate to have another name for a builtin alias, they can
5297 5303 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5298 5304 works.
5299 5305
5300 5306 2001-11-28 Fernando Perez <fperez@colorado.edu>
5301 5307
5302 5308 * Changed @file so that it opens the source file at the proper
5303 5309 line. Since it uses less, if your EDITOR environment is
5304 5310 configured, typing v will immediately open your editor of choice
5305 5311 right at the line where the object is defined. Not as quick as
5306 5312 having a direct @edit command, but for all intents and purposes it
5307 5313 works. And I don't have to worry about writing @edit to deal with
5308 5314 all the editors, less does that.
5309 5315
5310 5316 * Version 0.1.16 released, 0.1.17 opened.
5311 5317
5312 5318 * Fixed some nasty bugs in the page/page_dumb combo that could
5313 5319 crash IPython.
5314 5320
5315 5321 2001-11-27 Fernando Perez <fperez@colorado.edu>
5316 5322
5317 5323 * Version 0.1.15 released, 0.1.16 opened.
5318 5324
5319 5325 * Finally got ? and ?? to work for undefined things: now it's
5320 5326 possible to type {}.get? and get information about the get method
5321 5327 of dicts, or os.path? even if only os is defined (so technically
5322 5328 os.path isn't). Works at any level. For example, after import os,
5323 5329 os?, os.path?, os.path.abspath? all work. This is great, took some
5324 5330 work in _ofind.
5325 5331
5326 5332 * Fixed more bugs with logging. The sanest way to do it was to add
5327 5333 to @log a 'mode' parameter. Killed two in one shot (this mode
5328 5334 option was a request of Janko's). I think it's finally clean
5329 5335 (famous last words).
5330 5336
5331 5337 * Added a page_dumb() pager which does a decent job of paging on
5332 5338 screen, if better things (like less) aren't available. One less
5333 5339 unix dependency (someday maybe somebody will port this to
5334 5340 windows).
5335 5341
5336 5342 * Fixed problem in magic_log: would lock of logging out if log
5337 5343 creation failed (because it would still think it had succeeded).
5338 5344
5339 5345 * Improved the page() function using curses to auto-detect screen
5340 5346 size. Now it can make a much better decision on whether to print
5341 5347 or page a string. Option screen_length was modified: a value 0
5342 5348 means auto-detect, and that's the default now.
5343 5349
5344 5350 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5345 5351 go out. I'll test it for a few days, then talk to Janko about
5346 5352 licences and announce it.
5347 5353
5348 5354 * Fixed the length of the auto-generated ---> prompt which appears
5349 5355 for auto-parens and auto-quotes. Getting this right isn't trivial,
5350 5356 with all the color escapes, different prompt types and optional
5351 5357 separators. But it seems to be working in all the combinations.
5352 5358
5353 5359 2001-11-26 Fernando Perez <fperez@colorado.edu>
5354 5360
5355 5361 * Wrote a regexp filter to get option types from the option names
5356 5362 string. This eliminates the need to manually keep two duplicate
5357 5363 lists.
5358 5364
5359 5365 * Removed the unneeded check_option_names. Now options are handled
5360 5366 in a much saner manner and it's easy to visually check that things
5361 5367 are ok.
5362 5368
5363 5369 * Updated version numbers on all files I modified to carry a
5364 5370 notice so Janko and Nathan have clear version markers.
5365 5371
5366 5372 * Updated docstring for ultraTB with my changes. I should send
5367 5373 this to Nathan.
5368 5374
5369 5375 * Lots of small fixes. Ran everything through pychecker again.
5370 5376
5371 5377 * Made loading of deep_reload an cmd line option. If it's not too
5372 5378 kosher, now people can just disable it. With -nodeep_reload it's
5373 5379 still available as dreload(), it just won't overwrite reload().
5374 5380
5375 5381 * Moved many options to the no| form (-opt and -noopt
5376 5382 accepted). Cleaner.
5377 5383
5378 5384 * Changed magic_log so that if called with no parameters, it uses
5379 5385 'rotate' mode. That way auto-generated logs aren't automatically
5380 5386 over-written. For normal logs, now a backup is made if it exists
5381 5387 (only 1 level of backups). A new 'backup' mode was added to the
5382 5388 Logger class to support this. This was a request by Janko.
5383 5389
5384 5390 * Added @logoff/@logon to stop/restart an active log.
5385 5391
5386 5392 * Fixed a lot of bugs in log saving/replay. It was pretty
5387 5393 broken. Now special lines (!@,/) appear properly in the command
5388 5394 history after a log replay.
5389 5395
5390 5396 * Tried and failed to implement full session saving via pickle. My
5391 5397 idea was to pickle __main__.__dict__, but modules can't be
5392 5398 pickled. This would be a better alternative to replaying logs, but
5393 5399 seems quite tricky to get to work. Changed -session to be called
5394 5400 -logplay, which more accurately reflects what it does. And if we
5395 5401 ever get real session saving working, -session is now available.
5396 5402
5397 5403 * Implemented color schemes for prompts also. As for tracebacks,
5398 5404 currently only NoColor and Linux are supported. But now the
5399 5405 infrastructure is in place, based on a generic ColorScheme
5400 5406 class. So writing and activating new schemes both for the prompts
5401 5407 and the tracebacks should be straightforward.
5402 5408
5403 5409 * Version 0.1.13 released, 0.1.14 opened.
5404 5410
5405 5411 * Changed handling of options for output cache. Now counter is
5406 5412 hardwired starting at 1 and one specifies the maximum number of
5407 5413 entries *in the outcache* (not the max prompt counter). This is
5408 5414 much better, since many statements won't increase the cache
5409 5415 count. It also eliminated some confusing options, now there's only
5410 5416 one: cache_size.
5411 5417
5412 5418 * Added 'alias' magic function and magic_alias option in the
5413 5419 ipythonrc file. Now the user can easily define whatever names he
5414 5420 wants for the magic functions without having to play weird
5415 5421 namespace games. This gives IPython a real shell-like feel.
5416 5422
5417 5423 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5418 5424 @ or not).
5419 5425
5420 5426 This was one of the last remaining 'visible' bugs (that I know
5421 5427 of). I think if I can clean up the session loading so it works
5422 5428 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5423 5429 about licensing).
5424 5430
5425 5431 2001-11-25 Fernando Perez <fperez@colorado.edu>
5426 5432
5427 5433 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5428 5434 there's a cleaner distinction between what ? and ?? show.
5429 5435
5430 5436 * Added screen_length option. Now the user can define his own
5431 5437 screen size for page() operations.
5432 5438
5433 5439 * Implemented magic shell-like functions with automatic code
5434 5440 generation. Now adding another function is just a matter of adding
5435 5441 an entry to a dict, and the function is dynamically generated at
5436 5442 run-time. Python has some really cool features!
5437 5443
5438 5444 * Renamed many options to cleanup conventions a little. Now all
5439 5445 are lowercase, and only underscores where needed. Also in the code
5440 5446 option name tables are clearer.
5441 5447
5442 5448 * Changed prompts a little. Now input is 'In [n]:' instead of
5443 5449 'In[n]:='. This allows it the numbers to be aligned with the
5444 5450 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5445 5451 Python (it was a Mathematica thing). The '...' continuation prompt
5446 5452 was also changed a little to align better.
5447 5453
5448 5454 * Fixed bug when flushing output cache. Not all _p<n> variables
5449 5455 exist, so their deletion needs to be wrapped in a try:
5450 5456
5451 5457 * Figured out how to properly use inspect.formatargspec() (it
5452 5458 requires the args preceded by *). So I removed all the code from
5453 5459 _get_pdef in Magic, which was just replicating that.
5454 5460
5455 5461 * Added test to prefilter to allow redefining magic function names
5456 5462 as variables. This is ok, since the @ form is always available,
5457 5463 but whe should allow the user to define a variable called 'ls' if
5458 5464 he needs it.
5459 5465
5460 5466 * Moved the ToDo information from README into a separate ToDo.
5461 5467
5462 5468 * General code cleanup and small bugfixes. I think it's close to a
5463 5469 state where it can be released, obviously with a big 'beta'
5464 5470 warning on it.
5465 5471
5466 5472 * Got the magic function split to work. Now all magics are defined
5467 5473 in a separate class. It just organizes things a bit, and now
5468 5474 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5469 5475 was too long).
5470 5476
5471 5477 * Changed @clear to @reset to avoid potential confusions with
5472 5478 the shell command clear. Also renamed @cl to @clear, which does
5473 5479 exactly what people expect it to from their shell experience.
5474 5480
5475 5481 Added a check to the @reset command (since it's so
5476 5482 destructive, it's probably a good idea to ask for confirmation).
5477 5483 But now reset only works for full namespace resetting. Since the
5478 5484 del keyword is already there for deleting a few specific
5479 5485 variables, I don't see the point of having a redundant magic
5480 5486 function for the same task.
5481 5487
5482 5488 2001-11-24 Fernando Perez <fperez@colorado.edu>
5483 5489
5484 5490 * Updated the builtin docs (esp. the ? ones).
5485 5491
5486 5492 * Ran all the code through pychecker. Not terribly impressed with
5487 5493 it: lots of spurious warnings and didn't really find anything of
5488 5494 substance (just a few modules being imported and not used).
5489 5495
5490 5496 * Implemented the new ultraTB functionality into IPython. New
5491 5497 option: xcolors. This chooses color scheme. xmode now only selects
5492 5498 between Plain and Verbose. Better orthogonality.
5493 5499
5494 5500 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5495 5501 mode and color scheme for the exception handlers. Now it's
5496 5502 possible to have the verbose traceback with no coloring.
5497 5503
5498 5504 2001-11-23 Fernando Perez <fperez@colorado.edu>
5499 5505
5500 5506 * Version 0.1.12 released, 0.1.13 opened.
5501 5507
5502 5508 * Removed option to set auto-quote and auto-paren escapes by
5503 5509 user. The chances of breaking valid syntax are just too high. If
5504 5510 someone *really* wants, they can always dig into the code.
5505 5511
5506 5512 * Made prompt separators configurable.
5507 5513
5508 5514 2001-11-22 Fernando Perez <fperez@colorado.edu>
5509 5515
5510 5516 * Small bugfixes in many places.
5511 5517
5512 5518 * Removed the MyCompleter class from ipplib. It seemed redundant
5513 5519 with the C-p,C-n history search functionality. Less code to
5514 5520 maintain.
5515 5521
5516 5522 * Moved all the original ipython.py code into ipythonlib.py. Right
5517 5523 now it's just one big dump into a function called make_IPython, so
5518 5524 no real modularity has been gained. But at least it makes the
5519 5525 wrapper script tiny, and since ipythonlib is a module, it gets
5520 5526 compiled and startup is much faster.
5521 5527
5522 5528 This is a reasobably 'deep' change, so we should test it for a
5523 5529 while without messing too much more with the code.
5524 5530
5525 5531 2001-11-21 Fernando Perez <fperez@colorado.edu>
5526 5532
5527 5533 * Version 0.1.11 released, 0.1.12 opened for further work.
5528 5534
5529 5535 * Removed dependency on Itpl. It was only needed in one place. It
5530 5536 would be nice if this became part of python, though. It makes life
5531 5537 *a lot* easier in some cases.
5532 5538
5533 5539 * Simplified the prefilter code a bit. Now all handlers are
5534 5540 expected to explicitly return a value (at least a blank string).
5535 5541
5536 5542 * Heavy edits in ipplib. Removed the help system altogether. Now
5537 5543 obj?/?? is used for inspecting objects, a magic @doc prints
5538 5544 docstrings, and full-blown Python help is accessed via the 'help'
5539 5545 keyword. This cleans up a lot of code (less to maintain) and does
5540 5546 the job. Since 'help' is now a standard Python component, might as
5541 5547 well use it and remove duplicate functionality.
5542 5548
5543 5549 Also removed the option to use ipplib as a standalone program. By
5544 5550 now it's too dependent on other parts of IPython to function alone.
5545 5551
5546 5552 * Fixed bug in genutils.pager. It would crash if the pager was
5547 5553 exited immediately after opening (broken pipe).
5548 5554
5549 5555 * Trimmed down the VerboseTB reporting a little. The header is
5550 5556 much shorter now and the repeated exception arguments at the end
5551 5557 have been removed. For interactive use the old header seemed a bit
5552 5558 excessive.
5553 5559
5554 5560 * Fixed small bug in output of @whos for variables with multi-word
5555 5561 types (only first word was displayed).
5556 5562
5557 5563 2001-11-17 Fernando Perez <fperez@colorado.edu>
5558 5564
5559 5565 * Version 0.1.10 released, 0.1.11 opened for further work.
5560 5566
5561 5567 * Modified dirs and friends. dirs now *returns* the stack (not
5562 5568 prints), so one can manipulate it as a variable. Convenient to
5563 5569 travel along many directories.
5564 5570
5565 5571 * Fixed bug in magic_pdef: would only work with functions with
5566 5572 arguments with default values.
5567 5573
5568 5574 2001-11-14 Fernando Perez <fperez@colorado.edu>
5569 5575
5570 5576 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5571 5577 example with IPython. Various other minor fixes and cleanups.
5572 5578
5573 5579 * Version 0.1.9 released, 0.1.10 opened for further work.
5574 5580
5575 5581 * Added sys.path to the list of directories searched in the
5576 5582 execfile= option. It used to be the current directory and the
5577 5583 user's IPYTHONDIR only.
5578 5584
5579 5585 2001-11-13 Fernando Perez <fperez@colorado.edu>
5580 5586
5581 5587 * Reinstated the raw_input/prefilter separation that Janko had
5582 5588 initially. This gives a more convenient setup for extending the
5583 5589 pre-processor from the outside: raw_input always gets a string,
5584 5590 and prefilter has to process it. We can then redefine prefilter
5585 5591 from the outside and implement extensions for special
5586 5592 purposes.
5587 5593
5588 5594 Today I got one for inputting PhysicalQuantity objects
5589 5595 (from Scientific) without needing any function calls at
5590 5596 all. Extremely convenient, and it's all done as a user-level
5591 5597 extension (no IPython code was touched). Now instead of:
5592 5598 a = PhysicalQuantity(4.2,'m/s**2')
5593 5599 one can simply say
5594 5600 a = 4.2 m/s**2
5595 5601 or even
5596 5602 a = 4.2 m/s^2
5597 5603
5598 5604 I use this, but it's also a proof of concept: IPython really is
5599 5605 fully user-extensible, even at the level of the parsing of the
5600 5606 command line. It's not trivial, but it's perfectly doable.
5601 5607
5602 5608 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5603 5609 the problem of modules being loaded in the inverse order in which
5604 5610 they were defined in
5605 5611
5606 5612 * Version 0.1.8 released, 0.1.9 opened for further work.
5607 5613
5608 5614 * Added magics pdef, source and file. They respectively show the
5609 5615 definition line ('prototype' in C), source code and full python
5610 5616 file for any callable object. The object inspector oinfo uses
5611 5617 these to show the same information.
5612 5618
5613 5619 * Version 0.1.7 released, 0.1.8 opened for further work.
5614 5620
5615 5621 * Separated all the magic functions into a class called Magic. The
5616 5622 InteractiveShell class was becoming too big for Xemacs to handle
5617 5623 (de-indenting a line would lock it up for 10 seconds while it
5618 5624 backtracked on the whole class!)
5619 5625
5620 5626 FIXME: didn't work. It can be done, but right now namespaces are
5621 5627 all messed up. Do it later (reverted it for now, so at least
5622 5628 everything works as before).
5623 5629
5624 5630 * Got the object introspection system (magic_oinfo) working! I
5625 5631 think this is pretty much ready for release to Janko, so he can
5626 5632 test it for a while and then announce it. Pretty much 100% of what
5627 5633 I wanted for the 'phase 1' release is ready. Happy, tired.
5628 5634
5629 5635 2001-11-12 Fernando Perez <fperez@colorado.edu>
5630 5636
5631 5637 * Version 0.1.6 released, 0.1.7 opened for further work.
5632 5638
5633 5639 * Fixed bug in printing: it used to test for truth before
5634 5640 printing, so 0 wouldn't print. Now checks for None.
5635 5641
5636 5642 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5637 5643 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5638 5644 reaches by hand into the outputcache. Think of a better way to do
5639 5645 this later.
5640 5646
5641 5647 * Various small fixes thanks to Nathan's comments.
5642 5648
5643 5649 * Changed magic_pprint to magic_Pprint. This way it doesn't
5644 5650 collide with pprint() and the name is consistent with the command
5645 5651 line option.
5646 5652
5647 5653 * Changed prompt counter behavior to be fully like
5648 5654 Mathematica's. That is, even input that doesn't return a result
5649 5655 raises the prompt counter. The old behavior was kind of confusing
5650 5656 (getting the same prompt number several times if the operation
5651 5657 didn't return a result).
5652 5658
5653 5659 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5654 5660
5655 5661 * Fixed -Classic mode (wasn't working anymore).
5656 5662
5657 5663 * Added colored prompts using Nathan's new code. Colors are
5658 5664 currently hardwired, they can be user-configurable. For
5659 5665 developers, they can be chosen in file ipythonlib.py, at the
5660 5666 beginning of the CachedOutput class def.
5661 5667
5662 5668 2001-11-11 Fernando Perez <fperez@colorado.edu>
5663 5669
5664 5670 * Version 0.1.5 released, 0.1.6 opened for further work.
5665 5671
5666 5672 * Changed magic_env to *return* the environment as a dict (not to
5667 5673 print it). This way it prints, but it can also be processed.
5668 5674
5669 5675 * Added Verbose exception reporting to interactive
5670 5676 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5671 5677 traceback. Had to make some changes to the ultraTB file. This is
5672 5678 probably the last 'big' thing in my mental todo list. This ties
5673 5679 in with the next entry:
5674 5680
5675 5681 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5676 5682 has to specify is Plain, Color or Verbose for all exception
5677 5683 handling.
5678 5684
5679 5685 * Removed ShellServices option. All this can really be done via
5680 5686 the magic system. It's easier to extend, cleaner and has automatic
5681 5687 namespace protection and documentation.
5682 5688
5683 5689 2001-11-09 Fernando Perez <fperez@colorado.edu>
5684 5690
5685 5691 * Fixed bug in output cache flushing (missing parameter to
5686 5692 __init__). Other small bugs fixed (found using pychecker).
5687 5693
5688 5694 * Version 0.1.4 opened for bugfixing.
5689 5695
5690 5696 2001-11-07 Fernando Perez <fperez@colorado.edu>
5691 5697
5692 5698 * Version 0.1.3 released, mainly because of the raw_input bug.
5693 5699
5694 5700 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5695 5701 and when testing for whether things were callable, a call could
5696 5702 actually be made to certain functions. They would get called again
5697 5703 once 'really' executed, with a resulting double call. A disaster
5698 5704 in many cases (list.reverse() would never work!).
5699 5705
5700 5706 * Removed prefilter() function, moved its code to raw_input (which
5701 5707 after all was just a near-empty caller for prefilter). This saves
5702 5708 a function call on every prompt, and simplifies the class a tiny bit.
5703 5709
5704 5710 * Fix _ip to __ip name in magic example file.
5705 5711
5706 5712 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5707 5713 work with non-gnu versions of tar.
5708 5714
5709 5715 2001-11-06 Fernando Perez <fperez@colorado.edu>
5710 5716
5711 5717 * Version 0.1.2. Just to keep track of the recent changes.
5712 5718
5713 5719 * Fixed nasty bug in output prompt routine. It used to check 'if
5714 5720 arg != None...'. Problem is, this fails if arg implements a
5715 5721 special comparison (__cmp__) which disallows comparing to
5716 5722 None. Found it when trying to use the PhysicalQuantity module from
5717 5723 ScientificPython.
5718 5724
5719 5725 2001-11-05 Fernando Perez <fperez@colorado.edu>
5720 5726
5721 5727 * Also added dirs. Now the pushd/popd/dirs family functions
5722 5728 basically like the shell, with the added convenience of going home
5723 5729 when called with no args.
5724 5730
5725 5731 * pushd/popd slightly modified to mimic shell behavior more
5726 5732 closely.
5727 5733
5728 5734 * Added env,pushd,popd from ShellServices as magic functions. I
5729 5735 think the cleanest will be to port all desired functions from
5730 5736 ShellServices as magics and remove ShellServices altogether. This
5731 5737 will provide a single, clean way of adding functionality
5732 5738 (shell-type or otherwise) to IP.
5733 5739
5734 5740 2001-11-04 Fernando Perez <fperez@colorado.edu>
5735 5741
5736 5742 * Added .ipython/ directory to sys.path. This way users can keep
5737 5743 customizations there and access them via import.
5738 5744
5739 5745 2001-11-03 Fernando Perez <fperez@colorado.edu>
5740 5746
5741 5747 * Opened version 0.1.1 for new changes.
5742 5748
5743 5749 * Changed version number to 0.1.0: first 'public' release, sent to
5744 5750 Nathan and Janko.
5745 5751
5746 5752 * Lots of small fixes and tweaks.
5747 5753
5748 5754 * Minor changes to whos format. Now strings are shown, snipped if
5749 5755 too long.
5750 5756
5751 5757 * Changed ShellServices to work on __main__ so they show up in @who
5752 5758
5753 5759 * Help also works with ? at the end of a line:
5754 5760 ?sin and sin?
5755 5761 both produce the same effect. This is nice, as often I use the
5756 5762 tab-complete to find the name of a method, but I used to then have
5757 5763 to go to the beginning of the line to put a ? if I wanted more
5758 5764 info. Now I can just add the ? and hit return. Convenient.
5759 5765
5760 5766 2001-11-02 Fernando Perez <fperez@colorado.edu>
5761 5767
5762 5768 * Python version check (>=2.1) added.
5763 5769
5764 5770 * Added LazyPython documentation. At this point the docs are quite
5765 5771 a mess. A cleanup is in order.
5766 5772
5767 5773 * Auto-installer created. For some bizarre reason, the zipfiles
5768 5774 module isn't working on my system. So I made a tar version
5769 5775 (hopefully the command line options in various systems won't kill
5770 5776 me).
5771 5777
5772 5778 * Fixes to Struct in genutils. Now all dictionary-like methods are
5773 5779 protected (reasonably).
5774 5780
5775 5781 * Added pager function to genutils and changed ? to print usage
5776 5782 note through it (it was too long).
5777 5783
5778 5784 * Added the LazyPython functionality. Works great! I changed the
5779 5785 auto-quote escape to ';', it's on home row and next to '. But
5780 5786 both auto-quote and auto-paren (still /) escapes are command-line
5781 5787 parameters.
5782 5788
5783 5789
5784 5790 2001-11-01 Fernando Perez <fperez@colorado.edu>
5785 5791
5786 5792 * Version changed to 0.0.7. Fairly large change: configuration now
5787 5793 is all stored in a directory, by default .ipython. There, all
5788 5794 config files have normal looking names (not .names)
5789 5795
5790 5796 * Version 0.0.6 Released first to Lucas and Archie as a test
5791 5797 run. Since it's the first 'semi-public' release, change version to
5792 5798 > 0.0.6 for any changes now.
5793 5799
5794 5800 * Stuff I had put in the ipplib.py changelog:
5795 5801
5796 5802 Changes to InteractiveShell:
5797 5803
5798 5804 - Made the usage message a parameter.
5799 5805
5800 5806 - Require the name of the shell variable to be given. It's a bit
5801 5807 of a hack, but allows the name 'shell' not to be hardwired in the
5802 5808 magic (@) handler, which is problematic b/c it requires
5803 5809 polluting the global namespace with 'shell'. This in turn is
5804 5810 fragile: if a user redefines a variable called shell, things
5805 5811 break.
5806 5812
5807 5813 - magic @: all functions available through @ need to be defined
5808 5814 as magic_<name>, even though they can be called simply as
5809 5815 @<name>. This allows the special command @magic to gather
5810 5816 information automatically about all existing magic functions,
5811 5817 even if they are run-time user extensions, by parsing the shell
5812 5818 instance __dict__ looking for special magic_ names.
5813 5819
5814 5820 - mainloop: added *two* local namespace parameters. This allows
5815 5821 the class to differentiate between parameters which were there
5816 5822 before and after command line initialization was processed. This
5817 5823 way, later @who can show things loaded at startup by the
5818 5824 user. This trick was necessary to make session saving/reloading
5819 5825 really work: ideally after saving/exiting/reloading a session,
5820 5826 *everything* should look the same, including the output of @who. I
5821 5827 was only able to make this work with this double namespace
5822 5828 trick.
5823 5829
5824 5830 - added a header to the logfile which allows (almost) full
5825 5831 session restoring.
5826 5832
5827 5833 - prepend lines beginning with @ or !, with a and log
5828 5834 them. Why? !lines: may be useful to know what you did @lines:
5829 5835 they may affect session state. So when restoring a session, at
5830 5836 least inform the user of their presence. I couldn't quite get
5831 5837 them to properly re-execute, but at least the user is warned.
5832 5838
5833 5839 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now